aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--dep/PackageList.txt12
-rw-r--r--dep/bzip2/LICENSE42
-rw-r--r--dep/bzip2/README215
-rw-r--r--dep/bzip2/blocksort.c4
-rw-r--r--dep/bzip2/bzip2.c2034
-rw-r--r--dep/bzip2/bzip2recover.c514
-rw-r--r--dep/bzip2/bzlib.c4
-rw-r--r--dep/bzip2/bzlib.h4
-rw-r--r--dep/bzip2/bzlib_private.h6
-rw-r--r--dep/bzip2/compress.c4
-rw-r--r--dep/bzip2/crctable.c4
-rw-r--r--dep/bzip2/decompress.c24
-rw-r--r--dep/bzip2/huffman.c4
-rw-r--r--dep/bzip2/randtable.c4
-rw-r--r--dep/g3dlite/G3D-v8.0_extra.diff12
-rw-r--r--dep/g3dlite/include/G3D/AABox.h3
-rw-r--r--dep/g3dlite/include/G3D/Any.h125
-rw-r--r--dep/g3dlite/include/G3D/GMutex.h1
-rw-r--r--dep/g3dlite/include/G3D/PointHashGrid.h6
-rw-r--r--dep/g3dlite/include/G3D/Quat.inl36
-rw-r--r--dep/g3dlite/include/G3D/Sphere.h1
-rw-r--r--dep/g3dlite/include/G3D/Table.h5
-rw-r--r--dep/g3dlite/include/G3D/Vector2.inl18
-rw-r--r--dep/g3dlite/include/G3D/Vector3.inl249
-rw-r--r--dep/g3dlite/include/G3D/Vector4.inl191
-rw-r--r--dep/g3dlite/include/G3D/g3dmath.inl288
-rw-r--r--dep/g3dlite/include/G3D/platform.h4
-rw-r--r--dep/g3dlite/source/AABox.cpp4
-rw-r--r--dep/g3dlite/source/Log.cpp14
-rw-r--r--dep/g3dlite/source/System.cpp95
-rw-r--r--dep/g3dlite/source/TextInput.cpp28
-rw-r--r--dep/gsoap/gsoap.stub1
-rw-r--r--dep/gsoap/soapC.cpp97
-rw-r--r--dep/gsoap/soapH.h11
-rw-r--r--dep/gsoap/soapServer.cpp14
-rw-r--r--dep/gsoap/soapStub.h15
-rw-r--r--dep/gsoap/stdsoap2.cpp1672
-rw-r--r--dep/gsoap/stdsoap2.h248
-rw-r--r--dep/gsoap/tc_upgrades.txt12
-rw-r--r--dep/utf8cpp/utf8/checked.h118
-rw-r--r--dep/utf8cpp/utf8/core.h209
-rw-r--r--dep/utf8cpp/utf8/unchecked.h44
-rw-r--r--dep/zlib/adler32.c68
-rw-r--r--dep/zlib/crc32.c83
-rw-r--r--dep/zlib/crc32.h2
-rw-r--r--dep/zlib/deflate.c259
-rw-r--r--dep/zlib/deflate.h10
-rw-r--r--dep/zlib/gzguts.h87
-rw-r--r--dep/zlib/gzlib.c165
-rw-r--r--dep/zlib/gzread.c418
-rw-r--r--dep/zlib/gzwrite.c146
-rw-r--r--dep/zlib/infback.c14
-rw-r--r--dep/zlib/inffixed.h6
-rw-r--r--dep/zlib/inflate.c90
-rw-r--r--dep/zlib/inftrees.c46
-rw-r--r--dep/zlib/trees.c40
-rw-r--r--dep/zlib/zconf.h196
-rw-r--r--dep/zlib/zlib.h309
-rw-r--r--dep/zlib/zutil.c24
-rw-r--r--dep/zlib/zutil.h98
-rw-r--r--doc/GPL-2.0.txt (renamed from doc/gpl-2.0.txt)0
-rw-r--r--doc/LoggingHOWTO.txt274
-rw-r--r--sql/base/auth_database.sql1
-rw-r--r--sql/base/characters_database.sql6
-rw-r--r--sql/old/3.3.5a/2012_06_13_00_characters_character_equipmentsets.sql (renamed from sql/updates/characters/2012_06_13_00_characters_character_equipmentsets.sql)0
-rw-r--r--sql/old/3.3.5a/2012_07_12_00_world_version.sql (renamed from sql/updates/world/2012_07_12_00_world_version.sql)0
-rw-r--r--sql/old/3.3.5a/2012_07_13_00_world_spell_proc_event.sql (renamed from sql/updates/world/2012_07_13_00_world_spell_proc_event.sql)0
-rw-r--r--sql/old/3.3.5a/2012_07_13_00_world_spell_script_names.sql (renamed from sql/updates/world/2012_07_13_00_world_spell_script_names.sql)0
-rw-r--r--sql/old/3.3.5a/2012_07_14_00_world_creature_loot_template.sql (renamed from sql/updates/world/2012_07_14_00_world_creature_loot_template.sql)0
-rw-r--r--sql/old/3.3.5a/2012_07_14_01_world_creature_loot_template.sql (renamed from sql/updates/world/2012_07_14_01_world_creature_loot_template.sql)0
-rw-r--r--sql/old/3.3.5a/2012_07_16_00_world_creature_template.sql (renamed from sql/updates/world/2012_07_16_00_world_creature_template.sql)0
-rw-r--r--sql/old/3.3.5a/2012_07_16_01_world_reference_loot_template.sql (renamed from sql/updates/world/2012_07_16_01_world_reference_loot_template.sql)0
-rw-r--r--sql/old/3.3.5a/2012_07_22_00_world_spelldifficulty_dbc.sql (renamed from sql/updates/world/2012_07_22_00_world_spelldifficulty_dbc.sql)0
-rw-r--r--sql/old/3.3.5a/2012_07_22_01_world_conditions.sql (renamed from sql/updates/world/2012_07_22_01_world_conditions.sql)0
-rw-r--r--sql/old/3.3.5a/2012_07_22_02_world_creature_loot_template.sql (renamed from sql/updates/world/2012_07_22_02_world_creature_loot_template.sql)0
-rw-r--r--sql/old/3.3.5a/2012_07_22_03_world_gossip.sql (renamed from sql/updates/world/2012_07_22_03_world_gossip.sql)0
-rw-r--r--sql/old/3.3.5a/2012_07_22_04_world_gossip.sql (renamed from sql/updates/world/2012_07_22_04_world_gossip.sql)0
-rw-r--r--sql/old/3.3.5a/2012_07_22_05_world_script_texts.sql (renamed from sql/updates/world/2012_07_22_05_world_script_texts.sql)0
-rw-r--r--sql/old/3.3.5a/2012_07_22_06_world_gossip.sql (renamed from sql/updates/world/2012_07_22_06_world_gossip.sql)0
-rw-r--r--sql/old/3.3.5a/2012_07_22_07_world_sai.sql (renamed from sql/updates/world/2012_07_22_07_world_sai.sql)0
-rw-r--r--sql/old/3.3.5a/2012_07_22_08_world_sai.sql (renamed from sql/updates/world/2012_07_22_08_world_sai.sql)0
-rw-r--r--sql/old/3.3.5a/2012_07_22_09_world_creature_template.sql (renamed from sql/updates/world/2012_07_22_09_world_creature_template.sql)0
-rw-r--r--sql/old/3.3.5a/2012_07_22_10_world_creature_onkill_rep.sql (renamed from sql/updates/world/2012_07_22_10_world_creature_onkill_rep.sql)0
-rw-r--r--sql/old/3.3.5a/2012_07_22_11_world_conditions.sql (renamed from sql/updates/world/2012_07_22_11_world_conditions.sql)0
-rw-r--r--sql/old/3.3.5a/2012_07_22_12_world_creature_template.sql (renamed from sql/updates/world/2012_07_22_12_world_creature_template.sql)0
-rw-r--r--sql/old/3.3.5a/2012_07_22_13_world_conditions.sql (renamed from sql/updates/world/2012_07_22_13_world_conditions.sql)0
-rw-r--r--sql/old/3.3.5a/2012_07_22_14_world_gameobject.sql (renamed from sql/updates/world/2012_07_22_14_world_gameobject.sql)0
-rw-r--r--sql/old/3.3.5a/2012_07_22_15_world_sai.sql (renamed from sql/updates/world/2012_07_22_15_world_sai.sql)0
-rw-r--r--sql/old/3.3.5a/2012_07_29_00_world_factionchange.sql (renamed from sql/updates/world/2012_07_29_00_world_factionchange.sql)0
-rw-r--r--sql/old/3.3.5a/2012_07_29_01_world_pool_quest.sql (renamed from sql/updates/world/2012_07_29_01_world_pool_quest.sql)0
-rw-r--r--sql/old/3.3.5a/2012_07_29_02_world_sai.sql (renamed from sql/updates/world/2012_07_29_02_world_sai.sql)0
-rw-r--r--sql/old/3.3.5a/2012_07_29_03_world_sai.sql (renamed from sql/updates/world/2012_07_29_03_world_sai.sql)0
-rw-r--r--sql/old/3.3.5a/2012_07_29_04_world_sai.sql (renamed from sql/updates/world/2012_07_29_04_world_sai.sql)0
-rw-r--r--sql/old/3.3.5a/2012_07_29_05_world_sai.sql (renamed from sql/updates/world/2012_07_29_05_world_sai.sql)0
-rw-r--r--sql/old/3.3.5a/2012_07_29_06_world_sai.sql (renamed from sql/updates/world/2012_07_29_06_world_sai.sql)0
-rw-r--r--sql/old/3.3.5a/2012_07_29_07_world_sai.sql (renamed from sql/updates/world/2012_07_29_07_world_sai.sql)0
-rw-r--r--sql/old/3.3.5a/2012_07_29_08_world_sai.sql (renamed from sql/updates/world/2012_07_29_08_world_sai.sql)0
-rw-r--r--sql/old/3.3.5a/2012_07_29_09_world_gossip_menu_option.sql (renamed from sql/updates/world/2012_07_29_09_world_gossip_menu_option.sql)0
-rw-r--r--sql/old/3.3.5a/2012_07_29_10_world_sai.sql (renamed from sql/updates/world/2012_07_29_10_world_sai.sql)0
-rw-r--r--sql/old/3.3.5a/2012_08_01_00_world_sai.sql (renamed from sql/updates/world/2012_08_01_00_world_sai.sql)0
-rw-r--r--sql/old/3.3.5a/2012_08_01_01_world_creature.sql (renamed from sql/updates/world/2012_08_01_01_world_creature.sql)0
-rw-r--r--sql/old/3.3.5a/2012_08_01_02_world_loot.sql (renamed from sql/updates/world/2012_08_01_02_world_loot.sql)0
-rw-r--r--sql/old/3.3.5a/2012_08_02_00_world_spell_script_names.sql (renamed from sql/updates/world/2012_08_02_00_world_spell_script_names.sql)0
-rw-r--r--sql/old/3.3.5a/2012_08_04_00_world_disables.sql219
-rw-r--r--sql/old/3.3.5a/2012_08_04_01_world_disables.sql50
-rw-r--r--sql/old/3.3.5a/2012_08_04_02_world_disables.sql23
-rw-r--r--sql/old/3.3.5a/2012_08_04_03_world_disables.sql38
-rw-r--r--sql/old/3.3.5a/2012_08_04_04_world_disables.sql34
-rw-r--r--sql/old/3.3.5a/2012_08_04_05_world_disables.sql28
-rw-r--r--sql/old/3.3.5a/2012_08_04_06_world_quest_template.sql10
-rw-r--r--sql/old/3.3.5a/2012_08_04_07_world_game_event_creature_quest.sql110
-rw-r--r--sql/old/3.3.5a/2012_08_04_08_world_disables.sql65
-rw-r--r--sql/old/3.3.5a/2012_08_04_09_world_disables.sql10
-rw-r--r--sql/old/3.3.5a/2012_08_04_10_world_disables.sql43
-rw-r--r--sql/old/3.3.5a/2012_08_04_11_world_game_event_creature_quest.sql365
-rw-r--r--sql/old/3.3.5a/2012_08_05_00_world_trinity_string.sql5
-rw-r--r--sql/old/3.3.5a/2012_08_05_01_world_command.sql19
-rw-r--r--sql/old/3.3.5a/2012_08_06_00_auth_logs.sql2
-rw-r--r--sql/old/3.3.5a/2012_08_06_00_world_command.sql4
-rw-r--r--sql/old/3.3.5a/2012_08_07_00_characters_characters.sql2
-rw-r--r--sql/old/3.3.5a/2012_08_09_00_world_creature_template.sql6
-rw-r--r--sql/old/3.3.5a/2012_08_09_01_world_sai.sql48
-rw-r--r--sql/old/3.3.5a/2012_08_10_00_world_conditions.sql7
-rw-r--r--sql/old/3.3.5a/2012_08_10_01_world_loot_template.sql25
-rw-r--r--sql/old/3.3.5a/2012_08_10_02_world_script_texts.sql6
-rw-r--r--sql/old/3.3.5a/2012_08_10_03_world_quest_template.sql18
-rw-r--r--sql/old/3.3.5a/2012_08_10_04_world_gossip.sql5
-rw-r--r--sql/old/3.3.5a/2012_08_10_05_world_quest_template.sql2
-rw-r--r--sql/old/3.3.5a/2012_08_10_06_world_creature.sql16
-rw-r--r--sql/old/3.3.5a/2012_08_11_00_world_creature_template.sql1
-rw-r--r--sql/old/3.3.5a/2012_08_11_01_world_quest_poi.sql60
-rw-r--r--sql/old/3.3.5a/2012_08_12_00_world_conditions.sql3
-rw-r--r--sql/old/3.3.5a/2012_08_12_01_world_spell_script_names.sql3
-rw-r--r--sql/old/3.3.5a/2012_08_12_02_world_spell_script_names.sql (renamed from sql/updates/world/2012_02_02_01_world_spell_script_names.sql)0
-rw-r--r--sql/old/3.3.5a/2012_08_13_00_world_creature_text.sql133
-rw-r--r--sql/old/3.3.5a/2012_08_13_01_world_creature.sql10
-rw-r--r--sql/old/3.3.5a/2012_08_14_00_world_creature_text.sql24
-rw-r--r--sql/old/3.3.5a/2012_08_14_01_world_creature_text.sql8
-rw-r--r--sql/old/3.3.5a/2012_08_14_02_world_creature.sql12
-rw-r--r--sql/old/3.3.5a/2012_08_16_00_world_creature_template.sql3
-rw-r--r--sql/old/3.3.5a/2012_08_16_00_world_spell_dbc.sql3
-rw-r--r--sql/old/3.3.5a/2012_08_17_00_world_spell_dbc.sql1
-rw-r--r--sql/old/3.3.5a/2012_08_19_00_world_pickpocketing_loot_template.sql11
-rw-r--r--sql/old/3.3.5a/2012_08_19_01_world_spell_dbc.sql4
-rw-r--r--sql/old/3.3.5a/2012_08_20_00_world_spell_script_names.sql3
-rw-r--r--sql/old/3.3.5a/2012_08_20_01_world_wintergrasp_conditions.sql31
-rw-r--r--sql/old/3.3.5a/2012_08_20_02_world_wintergrasp_creatures.sql64
-rw-r--r--sql/old/3.3.5a/2012_08_20_03_world_wintergrasp_gameobjects.sql86
-rw-r--r--sql/old/3.3.5a/2012_08_20_04_world_wintergrasp_gossips.sql20
-rw-r--r--sql/old/3.3.5a/2012_08_20_05_world_wintergrasp_quests.sql16
-rw-r--r--sql/old/3.3.5a/2012_08_20_06_world_wintergrasp_spells.sql81
-rw-r--r--sql/old/3.3.5a/2012_08_20_07_world_wintergrasp_texts.sql108
-rw-r--r--sql/old/3.3.5a/2012_08_20_08_world_achievement_criteria_data.sql4
-rw-r--r--sql/old/3.3.5a/2012_08_20_09_world_disables.sql1
-rw-r--r--sql/old/3.3.5a/2012_08_21_00_world_spell_proc_event.sql3
-rw-r--r--sql/old/3.3.5a/2012_08_21_01_world_command.sql3
-rw-r--r--sql/old/3.3.5a/2012_08_21_02_world_wintergrasp_conditions.sql23
-rw-r--r--sql/old/3.3.5a/2012_08_23_00_world_wintergrasp_spell_script_names.sql3
-rw-r--r--sql/old/3.3.5a/2012_08_23_01_world_wintergrasp_gameobject.sql1
-rw-r--r--sql/old/3.3.5a/2012_08_25_00_world_creature_template.sql3
-rw-r--r--sql/old/3.3.5a/2012_08_25_01_world_creature_template.sql1
-rw-r--r--sql/old/3.3.5a/2012_08_26_00_world_conditions.sql5
-rw-r--r--sql/old/3.3.5a/2012_08_26_01_world_creature.sql1
-rw-r--r--sql/old/3.3.5a/2012_08_26_02_world_spell_area.sql3
-rw-r--r--sql/old/3.3.5a/2012_08_26_03_world_spell_area.sql3
-rw-r--r--sql/old/3.3.5a/2012_08_27_00_world_creature_template.sql2
-rw-r--r--sql/old/3.3.5a/2012_08_27_00_world_spell_script_name.sql4
-rw-r--r--sql/old/3.3.5a/2012_08_27_01_world_sai.sql13
-rw-r--r--sql/old/3.3.5a/2012_08_27_02_world_creature.sql4
-rw-r--r--sql/old/3.3.5a/2012_08_27_02_world_playercreateinfo_spell.sql9
-rw-r--r--sql/old/3.3.5a/2012_08_27_03_world_gameobject.sql6
-rw-r--r--sql/old/3.3.5a/2012_08_27_04_world_quest_template.sql1
-rw-r--r--sql/old/3.3.5a/2012_08_27_05_world_sai.sql56
-rw-r--r--sql/old/3.3.5a/2012_08_27_06_world_sai.sql43
-rw-r--r--sql/old/3.3.5a/2012_08_27_07_world_spell_area.sql4
-rw-r--r--sql/old/3.3.5a/2012_08_27_08_world_misc.sql29
-rw-r--r--sql/old/3.3.5a/2012_08_27_09_world_conditions.sql8
-rw-r--r--sql/old/3.3.5a/2012_08_27_10_world_spell_script_names.sql4
-rw-r--r--sql/old/3.3.5a/2012_08_28_00_world_spell_script_name.sql4
-rw-r--r--sql/old/3.3.5a/2012_08_28_01_world_achievement_criteria_data.sql6
-rw-r--r--sql/old/3.3.5a/2012_08_29_00_world_blood_furnace.sql290
-rw-r--r--sql/old/3.3.5a/2012_08_30_00_world_creature_template.sql1
-rw-r--r--sql/old/3.3.5a/2012_08_30_00_world_spell_script_names.sql8
-rw-r--r--sql/old/3.3.5a/2012_08_31_00_world_command.sql14
-rw-r--r--sql/old/3.3.5a/2012_08_31_00_world_sai.sql50
-rw-r--r--sql/old/3.3.5a/2012_09_01_00_world_spell_script_names.sql4
-rw-r--r--sql/old/3.3.5a/2012_09_02_00_world_quest_template.sql49
-rw-r--r--sql/old/3.3.5a/2012_09_02_01_world_sai.sql36
-rw-r--r--sql/old/3.3.5a/2012_09_03_00_world_misc.sql36
-rw-r--r--sql/old/3.3.5a/2012_09_03_01_world_gameobject_template.sql1
-rw-r--r--sql/old/3.3.5a/2012_09_03_02_world_quest_template.sql2
-rw-r--r--sql/old/3.3.5a/2012_09_07_00_characters_characters.sql2
-rw-r--r--sql/old/3.3.5a/2012_09_07_00_world_spell_bonus_data.sql4
-rw-r--r--sql/old/3.3.5a/2012_09_07_01_world_creature_template.sql1
-rw-r--r--sql/old/3.3.5a/2012_09_07_02_world_spell_script_names.sql3
-rw-r--r--sql/old/3.3.5a/2012_09_08_00_world_achievement_criteria_data.sql6
-rw-r--r--sql/old/3.3.5a/2012_09_08_01_world_creature_template.sql1
-rw-r--r--sql/old/3.3.5a/2012_09_08_02_world_achievement_criteria_data.sql10
-rw-r--r--sql/old/3.3.5a/2012_09_09_00_world_command.sql4
-rw-r--r--sql/old/3.3.5a/2012_09_09_01_world_trinity_string.sql3
-rw-r--r--sql/old/3.3.5a/2012_09_09_02_world_spell_script_names.sql10
-rw-r--r--sql/old/3.3.5a/2012_09_09_03_world_spell_bonus_data.sql9
-rw-r--r--sql/old/3.3.5a/2012_09_09_04_world_quest_template.sql1
-rw-r--r--sql/old/3.3.5a/2012_09_10_00_world_game_event.sql3
-rw-r--r--sql/old/3.3.5a/2012_09_10_01_world_quest_template.sql1
-rw-r--r--sql/old/3.3.5a/2012_09_10_02_world_creature_text.sql1
-rw-r--r--sql/old/3.3.5a/2012_09_10_03_world_quest_template.sql3
-rw-r--r--sql/old/3.3.5a/2012_09_10_04_world_quest_template.sql2
-rw-r--r--sql/old/3.3.5a/2012_09_10_06_world_creature_template.sql1
-rw-r--r--sql/old/3.3.5a/2012_09_10_07_world_go_loot_template.sql2
-rw-r--r--sql/old/3.3.5a/2012_09_10_08_world_spell_area.sql5
-rw-r--r--sql/old/3.3.5a/2012_09_10_09_world_creature_involvedrelation.sql4
-rw-r--r--sql/old/3.3.5a/2012_09_10_10_world_gossips.sql111
-rw-r--r--sql/old/3.3.5a/2012_09_10_11_world_event_scripts.sql7
-rw-r--r--sql/old/3.3.5a/2012_09_10_12_world_sai.sql4
-rw-r--r--sql/old/3.3.5a/2012_09_10_13_world_creature_model_info.sql4
-rw-r--r--sql/old/3.3.5a/2012_09_11_00_world_misc.sql11
-rw-r--r--sql/old/3.3.5a/2012_09_12_00_world_misc.sql9
-rw-r--r--sql/old/3.3.5a/2012_09_12_01_world_creature.sql1
-rw-r--r--sql/old/3.3.5a/2012_09_13_00_world_item_template.sql1
-rw-r--r--sql/old/3.3.5a/2012_09_13_01_world_fires_over_skettis.sql91
-rw-r--r--sql/old/3.3.5a/2012_09_13_01_world_ogrila.sql158
-rw-r--r--sql/old/3.3.5a/2012_09_13_01_world_spell_script_name.sql14
-rw-r--r--sql/old/3.3.5a/2012_09_13_01_world_spell_target_position.sql15
-rw-r--r--sql/old/3.3.5a/2012_09_13_02_world_trinity_string.sql12
-rw-r--r--sql/old/3.3.5a/2012_09_14_00_world_creature_template.sql287
-rw-r--r--sql/old/3.3.5a/2012_09_14_00_world_sai.sql1
-rw-r--r--sql/old/3.3.5a/2012_09_14_01_world_creature_loot_template.sql5
-rw-r--r--sql/old/3.3.5a/2012_09_15_00_world_achievement_criteria_data.sql6
-rw-r--r--sql/old/3.3.5a/2012_09_15_00_world_creature_template.sql288
-rw-r--r--sql/old/3.3.5a/2012_09_15_00_world_disables.sql4
-rw-r--r--sql/old/3.3.5a/2012_09_15_01_world_creature_loot_template.sql19
-rw-r--r--sql/updates/world/2012_09_16_00_world_version.sql1
-rw-r--r--sql/updates/world/2012_09_16_01_world_conditions.sql4
-rw-r--r--sql/updates/world/2012_09_16_01_world_creature_loot_template.sql1
-rw-r--r--sql/updates/world/2012_09_16_01_world_creature_template_addon.sql3
-rw-r--r--sql/updates/world/2012_09_16_02_world_fires_over_skettis.sql26
-rw-r--r--sql/updates/world/2012_09_16_03_world_spell_script_names.sql3
-rw-r--r--src/server/authserver/Authentication/AuthCodes.cpp48
-rwxr-xr-xsrc/server/authserver/Authentication/AuthCodes.h13
-rwxr-xr-xsrc/server/authserver/Main.cpp22
-rwxr-xr-xsrc/server/authserver/Server/AuthSocket.cpp119
-rw-r--r--src/server/authserver/authserver.conf.dist201
-rwxr-xr-xsrc/server/collision/Management/IVMapManager.h2
-rw-r--r--src/server/collision/Maps/MapTree.cpp4
-rw-r--r--src/server/collision/Maps/TileAssembler.cpp13
-rw-r--r--src/server/collision/Models/GameObjectModel.cpp2
-rw-r--r--src/server/collision/Models/GameObjectModel.h2
-rwxr-xr-xsrc/server/collision/Models/ModelInstance.h2
-rwxr-xr-xsrc/server/game/AI/CoreAI/CombatAI.cpp5
-rwxr-xr-xsrc/server/game/AI/CoreAI/CombatAI.h1
-rw-r--r--src/server/game/AI/CoreAI/GameObjectAI.h5
-rwxr-xr-xsrc/server/game/AI/CoreAI/UnitAI.h8
-rwxr-xr-xsrc/server/game/AI/CreatureAI.h4
-rwxr-xr-xsrc/server/game/AI/CreatureAIImpl.h4
-rwxr-xr-xsrc/server/game/AI/CreatureAISelector.cpp5
-rwxr-xr-xsrc/server/game/AI/EventAI/CreatureEventAI.cpp4
-rwxr-xr-xsrc/server/game/AI/EventAI/CreatureEventAI.h6
-rwxr-xr-xsrc/server/game/AI/EventAI/CreatureEventAIMgr.cpp12
-rw-r--r--src/server/game/AI/ScriptedAI/ScriptedCreature.h6
-rw-r--r--src/server/game/AI/SmartScripts/SmartAI.cpp7
-rw-r--r--src/server/game/AI/SmartScripts/SmartAI.h2
-rw-r--r--src/server/game/AI/SmartScripts/SmartScript.cpp20
-rw-r--r--src/server/game/AI/SmartScripts/SmartScriptMgr.cpp13
-rw-r--r--src/server/game/AI/SmartScripts/SmartScriptMgr.h49
-rwxr-xr-xsrc/server/game/Accounts/AccountMgr.h2
-rwxr-xr-xsrc/server/game/Achievements/AchievementMgr.cpp59
-rwxr-xr-xsrc/server/game/Achievements/AchievementMgr.h2
-rwxr-xr-xsrc/server/game/Addons/AddonMgr.cpp4
-rwxr-xr-xsrc/server/game/Addons/AddonMgr.h8
-rw-r--r--src/server/game/AuctionHouse/AuctionHouseMgr.cpp14
-rw-r--r--src/server/game/Battlefield/Battlefield.cpp1118
-rw-r--r--src/server/game/Battlefield/Battlefield.h430
-rw-r--r--src/server/game/Battlefield/BattlefieldHandler.cpp150
-rw-r--r--src/server/game/Battlefield/BattlefieldMgr.cpp140
-rw-r--r--src/server/game/Battlefield/BattlefieldMgr.h79
-rw-r--r--src/server/game/Battlefield/Zones/BattlefieldWG.cpp1102
-rw-r--r--src/server/game/Battlefield/Zones/BattlefieldWG.h1784
-rwxr-xr-xsrc/server/game/Battlegrounds/ArenaTeam.cpp31
-rw-r--r--src/server/game/Battlegrounds/ArenaTeamMgr.cpp6
-rwxr-xr-xsrc/server/game/Battlegrounds/Battleground.cpp10
-rwxr-xr-xsrc/server/game/Battlegrounds/Battleground.h18
-rwxr-xr-xsrc/server/game/Battlegrounds/BattlegroundMgr.cpp12
-rwxr-xr-xsrc/server/game/Battlegrounds/BattlegroundQueue.cpp2
-rwxr-xr-xsrc/server/game/Battlegrounds/Zones/BattlegroundAB.cpp5
-rwxr-xr-xsrc/server/game/Battlegrounds/Zones/BattlegroundAB.h6
-rwxr-xr-xsrc/server/game/Battlegrounds/Zones/BattlegroundAV.h4
-rwxr-xr-xsrc/server/game/Battlegrounds/Zones/BattlegroundDS.h6
-rwxr-xr-xsrc/server/game/Battlegrounds/Zones/BattlegroundEY.h2
-rwxr-xr-xsrc/server/game/Battlegrounds/Zones/BattlegroundIC.cpp3
-rwxr-xr-xsrc/server/game/Battlegrounds/Zones/BattlegroundIC.h8
-rwxr-xr-xsrc/server/game/Battlegrounds/Zones/BattlegroundRV.h6
-rwxr-xr-xsrc/server/game/Battlegrounds/Zones/BattlegroundSA.h6
-rwxr-xr-xsrc/server/game/Battlegrounds/Zones/BattlegroundWS.cpp55
-rw-r--r--src/server/game/CMakeLists.txt4
-rwxr-xr-xsrc/server/game/Chat/Channels/Channel.h6
-rwxr-xr-xsrc/server/game/Chat/Chat.h6
-rwxr-xr-xsrc/server/game/Combat/UnitEvents.h6
-rwxr-xr-xsrc/server/game/Conditions/ConditionMgr.cpp23
-rwxr-xr-xsrc/server/game/Conditions/ConditionMgr.h4
-rwxr-xr-xsrc/server/game/Conditions/DisableMgr.cpp8
-rwxr-xr-xsrc/server/game/Conditions/DisableMgr.h6
-rwxr-xr-xsrc/server/game/DataStores/DBCEnums.h28
-rwxr-xr-xsrc/server/game/DataStores/DBCStores.cpp2
-rwxr-xr-xsrc/server/game/DataStores/DBCStructure.h2
-rwxr-xr-xsrc/server/game/DungeonFinding/LFGMgr.cpp10
-rwxr-xr-xsrc/server/game/DungeonFinding/LFGMgr.h2
-rwxr-xr-xsrc/server/game/Entities/Corpse/Corpse.cpp4
-rwxr-xr-xsrc/server/game/Entities/Creature/Creature.cpp35
-rwxr-xr-xsrc/server/game/Entities/Creature/Creature.h20
-rwxr-xr-xsrc/server/game/Entities/Creature/CreatureGroups.cpp6
-rwxr-xr-xsrc/server/game/Entities/Creature/GossipDef.cpp12
-rwxr-xr-xsrc/server/game/Entities/Creature/TemporarySummon.h2
-rwxr-xr-xsrc/server/game/Entities/DynamicObject/DynamicObject.h2
-rwxr-xr-xsrc/server/game/Entities/GameObject/GameObject.cpp68
-rwxr-xr-xsrc/server/game/Entities/GameObject/GameObject.h1
-rwxr-xr-xsrc/server/game/Entities/Item/Item.cpp2
-rwxr-xr-xsrc/server/game/Entities/Item/ItemEnchantmentMgr.cpp6
-rwxr-xr-xsrc/server/game/Entities/Item/ItemPrototype.h6
-rwxr-xr-xsrc/server/game/Entities/Object/Object.cpp25
-rwxr-xr-xsrc/server/game/Entities/Object/Object.h1
-rwxr-xr-xsrc/server/game/Entities/Object/ObjectDefines.h2
-rw-r--r--src/server/game/Entities/Object/Updates/UpdateFieldFlags.h2
-rwxr-xr-xsrc/server/game/Entities/Object/Updates/UpdateFields.h20
-rwxr-xr-xsrc/server/game/Entities/Pet/Pet.cpp37
-rwxr-xr-xsrc/server/game/Entities/Pet/Pet.h5
-rwxr-xr-xsrc/server/game/Entities/Player/Player.cpp215
-rwxr-xr-xsrc/server/game/Entities/Player/Player.h48
-rwxr-xr-xsrc/server/game/Entities/Player/SocialMgr.h16
-rwxr-xr-xsrc/server/game/Entities/Totem/Totem.cpp20
-rwxr-xr-xsrc/server/game/Entities/Totem/Totem.h6
-rwxr-xr-xsrc/server/game/Entities/Transport/Transport.cpp24
-rwxr-xr-xsrc/server/game/Entities/Transport/Transport.h8
-rwxr-xr-xsrc/server/game/Entities/Unit/Unit.cpp301
-rwxr-xr-xsrc/server/game/Entities/Unit/Unit.h114
-rwxr-xr-xsrc/server/game/Entities/Vehicle/Vehicle.cpp34
-rwxr-xr-xsrc/server/game/Entities/Vehicle/Vehicle.h14
-rw-r--r--src/server/game/Entities/Vehicle/VehicleDefines.h12
-rwxr-xr-xsrc/server/game/Events/GameEventMgr.cpp119
-rwxr-xr-xsrc/server/game/Events/GameEventMgr.h12
-rwxr-xr-xsrc/server/game/Globals/ObjectAccessor.h1
-rwxr-xr-xsrc/server/game/Globals/ObjectMgr.cpp437
-rwxr-xr-xsrc/server/game/Globals/ObjectMgr.h16
-rwxr-xr-xsrc/server/game/Grids/NGrid.h8
-rwxr-xr-xsrc/server/game/Grids/Notifiers/GridNotifiers.h24
-rwxr-xr-xsrc/server/game/Groups/Group.cpp80
-rwxr-xr-xsrc/server/game/Groups/Group.h15
-rw-r--r--src/server/game/Groups/GroupMgr.cpp22
-rwxr-xr-xsrc/server/game/Guilds/Guild.cpp2
-rwxr-xr-xsrc/server/game/Guilds/Guild.h14
-rw-r--r--src/server/game/Guilds/GuildMgr.cpp65
-rwxr-xr-xsrc/server/game/Handlers/AddonHandler.cpp41
-rwxr-xr-xsrc/server/game/Handlers/AuctionHouseHandler.cpp4
-rwxr-xr-xsrc/server/game/Handlers/BattleGroundHandler.cpp90
-rwxr-xr-xsrc/server/game/Handlers/CalendarHandler.cpp56
-rw-r--r--src/server/game/Handlers/CharacterHandler.cpp52
-rwxr-xr-xsrc/server/game/Handlers/GroupHandler.cpp2
-rwxr-xr-xsrc/server/game/Handlers/ItemHandler.cpp2
-rwxr-xr-xsrc/server/game/Handlers/MailHandler.cpp7
-rwxr-xr-xsrc/server/game/Handlers/MiscHandler.cpp55
-rwxr-xr-xsrc/server/game/Handlers/NPCHandler.cpp2
-rwxr-xr-xsrc/server/game/Handlers/QuestHandler.cpp4
-rwxr-xr-xsrc/server/game/Handlers/SkillHandler.cpp12
-rwxr-xr-xsrc/server/game/Handlers/SpellHandler.cpp4
-rwxr-xr-xsrc/server/game/Instances/InstanceSaveMgr.cpp2
-rwxr-xr-xsrc/server/game/Instances/InstanceScript.h8
-rwxr-xr-xsrc/server/game/Loot/LootMgr.cpp71
-rwxr-xr-xsrc/server/game/Loot/LootMgr.h4
-rwxr-xr-xsrc/server/game/Mails/Mail.h8
-rwxr-xr-xsrc/server/game/Maps/Map.cpp10
-rwxr-xr-xsrc/server/game/Maps/Map.h6
-rwxr-xr-xsrc/server/game/Miscellaneous/Language.h18
-rwxr-xr-xsrc/server/game/Miscellaneous/SharedDefines.h56
-rwxr-xr-xsrc/server/game/Movement/MotionMaster.h6
-rwxr-xr-xsrc/server/game/Movement/MovementGenerators/FleeingMovementGenerator.cpp9
-rwxr-xr-xsrc/server/game/Movement/MovementGenerators/TargetedMovementGenerator.cpp1
-rw-r--r--src/server/game/Movement/Spline/MoveSpline.cpp5
-rw-r--r--src/server/game/Movement/Spline/MoveSpline.h3
-rw-r--r--src/server/game/Movement/Spline/MoveSplineFlag.h2
-rw-r--r--src/server/game/Movement/Spline/MoveSplineInit.cpp16
-rw-r--r--src/server/game/Movement/Spline/MoveSplineInit.h2
-rw-r--r--src/server/game/Movement/Spline/Spline.h2
-rwxr-xr-xsrc/server/game/Movement/Waypoints/WaypointManager.cpp2
-rwxr-xr-xsrc/server/game/OutdoorPvP/OutdoorPvP.cpp4
-rwxr-xr-xsrc/server/game/OutdoorPvP/OutdoorPvP.h4
-rwxr-xr-xsrc/server/game/OutdoorPvP/OutdoorPvPMgr.cpp6
-rwxr-xr-xsrc/server/game/Pools/PoolMgr.cpp32
-rwxr-xr-xsrc/server/game/Quests/QuestDef.cpp5
-rwxr-xr-xsrc/server/game/Quests/QuestDef.h6
-rwxr-xr-xsrc/server/game/Reputation/ReputationMgr.h2
-rwxr-xr-xsrc/server/game/Scripting/ScriptLoader.cpp8
-rwxr-xr-xsrc/server/game/Scripting/ScriptMgr.cpp21
-rwxr-xr-xsrc/server/game/Scripting/ScriptMgr.h2
-rwxr-xr-xsrc/server/game/Scripting/ScriptSystem.cpp28
-rwxr-xr-xsrc/server/game/Server/Protocol/Opcodes.cpp6
-rwxr-xr-xsrc/server/game/Server/Protocol/Opcodes.h10
-rw-r--r--src/server/game/Server/Protocol/PacketLog.cpp62
-rw-r--r--src/server/game/Server/Protocol/PacketLog.h50
-rwxr-xr-xsrc/server/game/Server/WorldSession.cpp81
-rwxr-xr-xsrc/server/game/Server/WorldSession.h28
-rwxr-xr-xsrc/server/game/Server/WorldSocket.cpp145
-rwxr-xr-xsrc/server/game/Skills/SkillDiscovery.cpp2
-rwxr-xr-xsrc/server/game/Skills/SkillExtraItems.cpp2
-rwxr-xr-xsrc/server/game/Spells/Auras/SpellAuraDefines.h7
-rwxr-xr-xsrc/server/game/Spells/Auras/SpellAuraEffects.cpp13
-rwxr-xr-xsrc/server/game/Spells/Auras/SpellAuras.cpp19
-rwxr-xr-xsrc/server/game/Spells/Spell.cpp108
-rwxr-xr-xsrc/server/game/Spells/Spell.h7
-rwxr-xr-xsrc/server/game/Spells/SpellEffects.cpp74
-rw-r--r--src/server/game/Spells/SpellInfo.cpp15
-rw-r--r--src/server/game/Spells/SpellInfo.h18
-rwxr-xr-xsrc/server/game/Spells/SpellMgr.cpp184
-rwxr-xr-xsrc/server/game/Spells/SpellMgr.h33
-rwxr-xr-xsrc/server/game/Spells/SpellScript.h6
-rwxr-xr-xsrc/server/game/Texts/CreatureTextMgr.cpp6
-rwxr-xr-xsrc/server/game/Tickets/TicketMgr.cpp6
-rwxr-xr-xsrc/server/game/Tickets/TicketMgr.h10
-rw-r--r--src/server/game/Tools/CharacterDatabaseCleaner.cpp2
-rwxr-xr-xsrc/server/game/Tools/PlayerDump.h2
-rw-r--r--src/server/game/Warden/Warden.cpp5
-rw-r--r--src/server/game/Warden/Warden.h2
-rw-r--r--src/server/game/Warden/WardenMac.cpp4
-rw-r--r--src/server/game/Warden/WardenWin.cpp16
-rwxr-xr-xsrc/server/game/Weather/Weather.h2
-rwxr-xr-xsrc/server/game/Weather/WeatherMgr.cpp2
-rwxr-xr-xsrc/server/game/World/World.cpp459
-rwxr-xr-xsrc/server/game/World/World.h26
-rw-r--r--src/server/scripts/CMakeLists.txt2
-rw-r--r--src/server/scripts/Commands/CMakeLists.txt2
-rw-r--r--src/server/scripts/Commands/cs_account.cpp2
-rw-r--r--src/server/scripts/Commands/cs_ban.cpp4
-rw-r--r--src/server/scripts/Commands/cs_bf.cpp180
-rw-r--r--src/server/scripts/Commands/cs_cheat.cpp298
-rw-r--r--src/server/scripts/Commands/cs_debug.cpp2
-rw-r--r--src/server/scripts/Commands/cs_disable.cpp306
-rw-r--r--src/server/scripts/Commands/cs_misc.cpp5673
-rw-r--r--src/server/scripts/Commands/cs_modify.cpp15
-rw-r--r--src/server/scripts/Commands/cs_quest.cpp35
-rw-r--r--src/server/scripts/Commands/cs_reload.cpp99
-rw-r--r--src/server/scripts/Commands/cs_wp.cpp13
-rw-r--r--src/server/scripts/EasternKingdoms/BlackwingLair/boss_chromaggus.cpp4
-rw-r--r--src/server/scripts/EasternKingdoms/Karazhan/boss_moroes.cpp47
-rw-r--r--src/server/scripts/EasternKingdoms/Karazhan/boss_prince_malchezaar.cpp6
-rw-r--r--src/server/scripts/EasternKingdoms/MoltenCore/boss_golemagg.cpp2
-rw-r--r--src/server/scripts/EasternKingdoms/ScarletMonastery/boss_mograine_and_whitemane.cpp6
-rw-r--r--src/server/scripts/EasternKingdoms/ShadowfangKeep/instance_shadowfang_keep.cpp7
-rw-r--r--src/server/scripts/EasternKingdoms/SunwellPlateau/instance_sunwell_plateau.cpp11
-rw-r--r--src/server/scripts/EasternKingdoms/Uldaman/boss_archaedas.cpp13
-rw-r--r--src/server/scripts/EasternKingdoms/Uldaman/instance_uldaman.cpp3
-rw-r--r--src/server/scripts/EasternKingdoms/ZulAman/boss_akilzon.cpp5
-rw-r--r--src/server/scripts/EasternKingdoms/ZulAman/boss_halazzi.cpp1
-rw-r--r--src/server/scripts/EasternKingdoms/ZulAman/boss_zuljin.cpp8
-rw-r--r--src/server/scripts/EasternKingdoms/ZulAman/instance_zulaman.cpp9
-rw-r--r--src/server/scripts/EasternKingdoms/ZulGurub/boss_mandokir.cpp22
-rw-r--r--src/server/scripts/EasternKingdoms/silverpine_forest.cpp6
-rw-r--r--src/server/scripts/EasternKingdoms/wetlands.cpp10
-rw-r--r--src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/hyjal.cpp6
-rw-r--r--src/server/scripts/Kalimdor/CavernsOfTime/CullingOfStratholme/boss_mal_ganis.cpp5
-rw-r--r--src/server/scripts/Kalimdor/OnyxiasLair/boss_onyxia.cpp23
-rw-r--r--src/server/scripts/Kalimdor/ZulFarrak/instance_zulfarrak.cpp12
-rw-r--r--src/server/scripts/Kalimdor/ashenvale.cpp2
-rw-r--r--src/server/scripts/Kalimdor/moonglade.cpp5
-rw-r--r--src/server/scripts/Kalimdor/silithus.cpp6
-rw-r--r--src/server/scripts/Northrend/CMakeLists.txt1
-rw-r--r--src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheChampion/boss_argent_challenge.cpp2
-rwxr-xr-xsrc/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_anubarak_trial.cpp118
-rwxr-xr-xsrc/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_faction_champions.cpp12
-rwxr-xr-xsrc/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_lord_jaraxxus.cpp44
-rwxr-xr-xsrc/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_northrend_beasts.cpp55
-rwxr-xr-xsrc/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_twin_valkyr.cpp45
-rwxr-xr-xsrc/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/instance_trial_of_the_crusader.cpp22
-rwxr-xr-xsrc/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/trial_of_the_crusader.cpp205
-rw-r--r--src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/trial_of_the_crusader.h14
-rw-r--r--src/server/scripts/Northrend/DraktharonKeep/instance_drak_tharon_keep.cpp7
-rw-r--r--src/server/scripts/Northrend/FrozenHalls/PitOfSaron/boss_krickandick.cpp4
-rwxr-xr-xsrc/server/scripts/Northrend/IcecrownCitadel/boss_professor_putricide.cpp184
-rw-r--r--src/server/scripts/Northrend/IcecrownCitadel/boss_the_lich_king.cpp6
-rw-r--r--src/server/scripts/Northrend/Naxxramas/boss_four_horsemen.cpp1
-rw-r--r--src/server/scripts/Northrend/Naxxramas/boss_gothik.cpp5
-rw-r--r--src/server/scripts/Northrend/Nexus/Nexus/instance_nexus.cpp3
-rw-r--r--src/server/scripts/Northrend/Nexus/Oculus/boss_eregos.cpp73
-rw-r--r--src/server/scripts/Northrend/Ulduar/Ulduar/instance_ulduar.cpp1
-rw-r--r--src/server/scripts/Northrend/UtgardeKeep/UtgardeKeep/boss_ingvar_the_plunderer.cpp1
-rw-r--r--src/server/scripts/Northrend/UtgardeKeep/UtgardeKeep/boss_keleseth.cpp9
-rw-r--r--src/server/scripts/Northrend/UtgardeKeep/UtgardePinnacle/boss_skadi.cpp5
-rw-r--r--src/server/scripts/Northrend/UtgardeKeep/UtgardePinnacle/boss_ymiron.cpp3
-rw-r--r--src/server/scripts/Northrend/VioletHold/violet_hold.cpp7
-rw-r--r--src/server/scripts/Northrend/dragonblight.cpp61
-rw-r--r--src/server/scripts/Northrend/grizzly_hills.cpp147
-rw-r--r--src/server/scripts/Northrend/storm_peaks.cpp446
-rw-r--r--src/server/scripts/Northrend/wintergrasp.cpp585
-rw-r--r--src/server/scripts/Outland/Auchindoun/ShadowLabyrinth/boss_grandmaster_vorpil.cpp1
-rw-r--r--src/server/scripts/Outland/BlackTemple/boss_mother_shahraz.cpp4
-rw-r--r--src/server/scripts/Outland/BlackTemple/boss_reliquary_of_souls.cpp19
-rw-r--r--src/server/scripts/Outland/BlackTemple/illidari_council.cpp7
-rw-r--r--src/server/scripts/Outland/CoilfangReservoir/SteamVault/instance_steam_vault.cpp12
-rw-r--r--src/server/scripts/Outland/GruulsLair/instance_gruuls_lair.cpp10
-rw-r--r--src/server/scripts/Outland/HellfireCitadel/BloodFurnace/blood_furnace.h4
-rw-r--r--src/server/scripts/Outland/HellfireCitadel/BloodFurnace/boss_broggok.cpp61
-rw-r--r--src/server/scripts/Outland/HellfireCitadel/BloodFurnace/boss_kelidan_the_breaker.cpp19
-rw-r--r--src/server/scripts/Outland/HellfireCitadel/BloodFurnace/instance_blood_furnace.cpp224
-rw-r--r--src/server/scripts/Outland/TempestKeep/Eye/instance_the_eye.cpp12
-rw-r--r--src/server/scripts/Outland/shadowmoon_valley.cpp60
-rw-r--r--src/server/scripts/Spells/spell_generic.cpp372
-rw-r--r--src/server/scripts/Spells/spell_item.cpp11
-rw-r--r--src/server/scripts/Spells/spell_paladin.cpp36
-rw-r--r--src/server/scripts/Spells/spell_quest.cpp247
-rw-r--r--src/server/scripts/Spells/spell_rogue.cpp29
-rw-r--r--src/server/scripts/Spells/spell_warlock.cpp47
-rwxr-xr-xsrc/server/scripts/World/achievement_scripts.cpp30
-rw-r--r--src/server/shared/AutoPtr.h4
-rw-r--r--src/server/shared/Containers.h6
-rwxr-xr-xsrc/server/shared/Cryptography/BigNumber.cpp4
-rwxr-xr-xsrc/server/shared/Cryptography/BigNumber.h2
-rwxr-xr-xsrc/server/shared/DataStores/DBCFileLoader.cpp4
-rwxr-xr-xsrc/server/shared/DataStores/DBCFileLoader.h4
-rwxr-xr-xsrc/server/shared/Database/AdhocStatement.cpp1
-rwxr-xr-xsrc/server/shared/Database/DatabaseWorkerPool.h24
-rw-r--r--src/server/shared/Database/Implementation/CharacterDatabase.h2
-rwxr-xr-xsrc/server/shared/Database/Implementation/LoginDatabase.cpp2
-rwxr-xr-xsrc/server/shared/Database/Implementation/LoginDatabase.h2
-rwxr-xr-xsrc/server/shared/Database/Implementation/WorldDatabase.cpp5
-rwxr-xr-xsrc/server/shared/Database/Implementation/WorldDatabase.h3
-rwxr-xr-xsrc/server/shared/Database/MySQLConnection.cpp6
-rwxr-xr-xsrc/server/shared/Database/MySQLConnection.h2
-rwxr-xr-xsrc/server/shared/Database/PreparedStatement.cpp1
-rwxr-xr-xsrc/server/shared/Database/QueryHolder.cpp18
-rwxr-xr-xsrc/server/shared/Database/SQLOperation.h2
-rw-r--r--src/server/shared/Debugging/WheatyExceptionReport.cpp11
-rwxr-xr-xsrc/server/shared/Dynamic/TypeContainerFunctions.h4
-rwxr-xr-xsrc/server/shared/Dynamic/TypeContainerVisitor.h2
-rw-r--r--src/server/shared/Logging/Appender.cpp72
-rw-r--r--src/server/shared/Logging/Appender.h40
-rw-r--r--src/server/shared/Logging/AppenderConsole.cpp14
-rw-r--r--src/server/shared/Logging/AppenderConsole.h2
-rw-r--r--src/server/shared/Logging/AppenderDB.cpp32
-rw-r--r--src/server/shared/Logging/AppenderFile.cpp20
-rw-r--r--src/server/shared/Logging/AppenderFile.h2
-rwxr-xr-xsrc/server/shared/Logging/Log.cpp196
-rwxr-xr-xsrc/server/shared/Logging/Log.h4
-rwxr-xr-xsrc/server/shared/Packets/ByteBuffer.h40
-rwxr-xr-xsrc/server/shared/Threading/Threading.h2
-rwxr-xr-xsrc/server/shared/Utilities/ServiceWin32.cpp6
-rwxr-xr-xsrc/server/shared/Utilities/Util.cpp4
-rwxr-xr-xsrc/server/shared/Utilities/Util.h53
-rwxr-xr-xsrc/server/worldserver/Main.cpp14
-rwxr-xr-xsrc/server/worldserver/Master.cpp2
-rwxr-xr-xsrc/server/worldserver/TCSoap/TCSoap.h2
-rw-r--r--src/server/worldserver/worldserver.conf.dist422
-rw-r--r--src/tools/map_extractor/CMakeLists.txt2
-rw-r--r--src/tools/map_extractor/System.cpp7
-rw-r--r--src/tools/map_extractor/dbcfile.cpp6
-rw-r--r--src/tools/vmap4_extractor/adtfile.cpp42
-rw-r--r--src/tools/vmap4_extractor/dbcfile.cpp5
-rw-r--r--src/tools/vmap4_extractor/model.cpp47
-rw-r--r--src/tools/vmap4_extractor/model.h27
-rw-r--r--src/tools/vmap4_extractor/mpq_libmpq04.h6
-rw-r--r--src/tools/vmap4_extractor/vmapexport.cpp30
-rw-r--r--src/tools/vmap4_extractor/wdtfile.cpp18
-rw-r--r--src/tools/vmap4_extractor/wdtfile.h5
-rw-r--r--src/tools/vmap4_extractor/wmo.cpp39
-rw-r--r--src/tools/vmap4_extractor/wmo.h36
562 files changed, 24132 insertions, 9511 deletions
diff --git a/dep/PackageList.txt b/dep/PackageList.txt
index e5003ec744a..21d6c596b51 100644
--- a/dep/PackageList.txt
+++ b/dep/PackageList.txt
@@ -6,15 +6,15 @@ ACE (ADAPTIVE Communication Environment)
bzip2 (a freely available, patent free, high-quality data compressor)
http://www.bzip.org/
- Version: 1.0.5
+ Version: 1.0.6
G3D (a commercial-grade C++ 3D engine available as Open Source (BSD License)
http://g3d.sourceforge.net/
- Version: 8.0-Release
+ Version: 8.01-Release
jemalloc (a general-purpose scalable concurrent malloc-implementation)
http://www.canonware.com/jemalloc/
- Version: 2.2.5
+ Version: 2.1.0
libMPQ (a library for reading MPQ files)
https://libmpq.org/
@@ -30,12 +30,12 @@ SFMT (SIMD-oriented Fast Mersenne Twister)
utf8-cpp (UTF-8 with C++ in a Portable Way)
http://utfcpp.sourceforge.net/
- Version: 2.3
+ Version: 2.3.2
zlib (A Massively Spiffy Yet Delicately Unobtrusive Compression Library)
http://www.zlib.net/
- Version: 1.2.5
+ Version: 1.2.7
gSOAP (a portable development toolkit for C and C++ XML Web services and XML data bindings)
http://gsoap2.sourceforge.net/
- Version: 2.8.2
+ Version: 2.8.10
diff --git a/dep/bzip2/LICENSE b/dep/bzip2/LICENSE
new file mode 100644
index 00000000000..cc614178cf7
--- /dev/null
+++ b/dep/bzip2/LICENSE
@@ -0,0 +1,42 @@
+
+--------------------------------------------------------------------------
+
+This program, "bzip2", the associated library "libbzip2", and all
+documentation, are copyright (C) 1996-2010 Julian R Seward. All
+rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions
+are met:
+
+1. Redistributions of source code must retain the above copyright
+ notice, this list of conditions and the following disclaimer.
+
+2. The origin of this software must not be misrepresented; you must
+ not claim that you wrote the original software. If you use this
+ software in a product, an acknowledgment in the product
+ documentation would be appreciated but is not required.
+
+3. Altered source versions must be plainly marked as such, and must
+ not be misrepresented as being the original software.
+
+4. The name of the author may not be used to endorse or promote
+ products derived from this software without specific prior written
+ permission.
+
+THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS
+OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
+DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
+GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+Julian Seward, jseward@bzip.org
+bzip2/libbzip2 version 1.0.6 of 6 September 2010
+
+--------------------------------------------------------------------------
diff --git a/dep/bzip2/README b/dep/bzip2/README
new file mode 100644
index 00000000000..9fb0f636013
--- /dev/null
+++ b/dep/bzip2/README
@@ -0,0 +1,215 @@
+
+This is the README for bzip2/libzip2.
+This version is fully compatible with the previous public releases.
+
+------------------------------------------------------------------
+This file is part of bzip2/libbzip2, a program and library for
+lossless, block-sorting data compression.
+
+bzip2/libbzip2 version 1.0.6 of 6 September 2010
+Copyright (C) 1996-2010 Julian Seward <jseward@bzip.org>
+
+Please read the WARNING, DISCLAIMER and PATENTS sections in this file.
+
+This program is released under the terms of the license contained
+in the file LICENSE.
+------------------------------------------------------------------
+
+Complete documentation is available in Postscript form (manual.ps),
+PDF (manual.pdf) or html (manual.html). A plain-text version of the
+manual page is available as bzip2.txt.
+
+
+HOW TO BUILD -- UNIX
+
+Type 'make'. This builds the library libbz2.a and then the programs
+bzip2 and bzip2recover. Six self-tests are run. If the self-tests
+complete ok, carry on to installation:
+
+To install in /usr/local/bin, /usr/local/lib, /usr/local/man and
+/usr/local/include, type
+
+ make install
+
+To install somewhere else, eg, /xxx/yyy/{bin,lib,man,include}, type
+
+ make install PREFIX=/xxx/yyy
+
+If you are (justifiably) paranoid and want to see what 'make install'
+is going to do, you can first do
+
+ make -n install or
+ make -n install PREFIX=/xxx/yyy respectively.
+
+The -n instructs make to show the commands it would execute, but not
+actually execute them.
+
+
+HOW TO BUILD -- UNIX, shared library libbz2.so.
+
+Do 'make -f Makefile-libbz2_so'. This Makefile seems to work for
+Linux-ELF (RedHat 7.2 on an x86 box), with gcc. I make no claims
+that it works for any other platform, though I suspect it probably
+will work for most platforms employing both ELF and gcc.
+
+bzip2-shared, a client of the shared library, is also built, but not
+self-tested. So I suggest you also build using the normal Makefile,
+since that conducts a self-test. A second reason to prefer the
+version statically linked to the library is that, on x86 platforms,
+building shared objects makes a valuable register (%ebx) unavailable
+to gcc, resulting in a slowdown of 10%-20%, at least for bzip2.
+
+Important note for people upgrading .so's from 0.9.0/0.9.5 to version
+1.0.X. All the functions in the library have been renamed, from (eg)
+bzCompress to BZ2_bzCompress, to avoid namespace pollution.
+Unfortunately this means that the libbz2.so created by
+Makefile-libbz2_so will not work with any program which used an older
+version of the library. I do encourage library clients to make the
+effort to upgrade to use version 1.0, since it is both faster and more
+robust than previous versions.
+
+
+HOW TO BUILD -- Windows 95, NT, DOS, Mac, etc.
+
+It's difficult for me to support compilation on all these platforms.
+My approach is to collect binaries for these platforms, and put them
+on the master web site (http://www.bzip.org). Look there. However
+(FWIW), bzip2-1.0.X is very standard ANSI C and should compile
+unmodified with MS Visual C. If you have difficulties building, you
+might want to read README.COMPILATION.PROBLEMS.
+
+At least using MS Visual C++ 6, you can build from the unmodified
+sources by issuing, in a command shell:
+
+ nmake -f makefile.msc
+
+(you may need to first run the MSVC-provided script VCVARS32.BAT
+ so as to set up paths to the MSVC tools correctly).
+
+
+VALIDATION
+
+Correct operation, in the sense that a compressed file can always be
+decompressed to reproduce the original, is obviously of paramount
+importance. To validate bzip2, I used a modified version of Mark
+Nelson's churn program. Churn is an automated test driver which
+recursively traverses a directory structure, using bzip2 to compress
+and then decompress each file it encounters, and checking that the
+decompressed data is the same as the original.
+
+
+
+Please read and be aware of the following:
+
+WARNING:
+
+ This program and library (attempts to) compress data by
+ performing several non-trivial transformations on it.
+ Unless you are 100% familiar with *all* the algorithms
+ contained herein, and with the consequences of modifying them,
+ you should NOT meddle with the compression or decompression
+ machinery. Incorrect changes can and very likely *will*
+ lead to disastrous loss of data.
+
+
+DISCLAIMER:
+
+ I TAKE NO RESPONSIBILITY FOR ANY LOSS OF DATA ARISING FROM THE
+ USE OF THIS PROGRAM/LIBRARY, HOWSOEVER CAUSED.
+
+ Every compression of a file implies an assumption that the
+ compressed file can be decompressed to reproduce the original.
+ Great efforts in design, coding and testing have been made to
+ ensure that this program works correctly. However, the complexity
+ of the algorithms, and, in particular, the presence of various
+ special cases in the code which occur with very low but non-zero
+ probability make it impossible to rule out the possibility of bugs
+ remaining in the program. DO NOT COMPRESS ANY DATA WITH THIS
+ PROGRAM UNLESS YOU ARE PREPARED TO ACCEPT THE POSSIBILITY, HOWEVER
+ SMALL, THAT THE DATA WILL NOT BE RECOVERABLE.
+
+ That is not to say this program is inherently unreliable.
+ Indeed, I very much hope the opposite is true. bzip2/libbzip2
+ has been carefully constructed and extensively tested.
+
+
+PATENTS:
+
+ To the best of my knowledge, bzip2/libbzip2 does not use any
+ patented algorithms. However, I do not have the resources
+ to carry out a patent search. Therefore I cannot give any
+ guarantee of the above statement.
+
+
+
+WHAT'S NEW IN 0.9.0 (as compared to 0.1pl2) ?
+
+ * Approx 10% faster compression, 30% faster decompression
+ * -t (test mode) is a lot quicker
+ * Can decompress concatenated compressed files
+ * Programming interface, so programs can directly read/write .bz2 files
+ * Less restrictive (BSD-style) licensing
+ * Flag handling more compatible with GNU gzip
+ * Much more documentation, i.e., a proper user manual
+ * Hopefully, improved portability (at least of the library)
+
+WHAT'S NEW IN 0.9.5 ?
+
+ * Compression speed is much less sensitive to the input
+ data than in previous versions. Specifically, the very
+ slow performance caused by repetitive data is fixed.
+ * Many small improvements in file and flag handling.
+ * A Y2K statement.
+
+WHAT'S NEW IN 1.0.0 ?
+
+ See the CHANGES file.
+
+WHAT'S NEW IN 1.0.2 ?
+
+ See the CHANGES file.
+
+WHAT'S NEW IN 1.0.3 ?
+
+ See the CHANGES file.
+
+WHAT'S NEW IN 1.0.4 ?
+
+ See the CHANGES file.
+
+WHAT'S NEW IN 1.0.5 ?
+
+ See the CHANGES file.
+
+WHAT'S NEW IN 1.0.6 ?
+
+ See the CHANGES file.
+
+
+I hope you find bzip2 useful. Feel free to contact me at
+ jseward@bzip.org
+if you have any suggestions or queries. Many people mailed me with
+comments, suggestions and patches after the releases of bzip-0.15,
+bzip-0.21, and bzip2 versions 0.1pl2, 0.9.0, 0.9.5, 1.0.0, 1.0.1,
+1.0.2 and 1.0.3, and the changes in bzip2 are largely a result of this
+feedback. I thank you for your comments.
+
+bzip2's "home" is http://www.bzip.org/
+
+Julian Seward
+jseward@bzip.org
+Cambridge, UK.
+
+18 July 1996 (version 0.15)
+25 August 1996 (version 0.21)
+ 7 August 1997 (bzip2, version 0.1)
+29 August 1997 (bzip2, version 0.1pl2)
+23 August 1998 (bzip2, version 0.9.0)
+ 8 June 1999 (bzip2, version 0.9.5)
+ 4 Sept 1999 (bzip2, version 0.9.5d)
+ 5 May 2000 (bzip2, version 1.0pre8)
+30 December 2001 (bzip2, version 1.0.2pre1)
+15 February 2005 (bzip2, version 1.0.3)
+20 December 2006 (bzip2, version 1.0.4)
+10 December 2007 (bzip2, version 1.0.5)
+ 6 Sept 2010 (bzip2, version 1.0.6)
diff --git a/dep/bzip2/blocksort.c b/dep/bzip2/blocksort.c
index bd2dec157fa..d0d662cd4e9 100644
--- a/dep/bzip2/blocksort.c
+++ b/dep/bzip2/blocksort.c
@@ -8,8 +8,8 @@
This file is part of bzip2/libbzip2, a program and library for
lossless, block-sorting data compression.
- bzip2/libbzip2 version 1.0.5 of 10 December 2007
- Copyright (C) 1996-2007 Julian Seward <jseward@bzip.org>
+ bzip2/libbzip2 version 1.0.6 of 6 September 2010
+ Copyright (C) 1996-2010 Julian Seward <jseward@bzip.org>
Please read the WARNING, DISCLAIMER and PATENTS sections in the
README file.
diff --git a/dep/bzip2/bzip2.c b/dep/bzip2/bzip2.c
new file mode 100644
index 00000000000..6de9d1d1488
--- /dev/null
+++ b/dep/bzip2/bzip2.c
@@ -0,0 +1,2034 @@
+
+/*-----------------------------------------------------------*/
+/*--- A block-sorting, lossless compressor bzip2.c ---*/
+/*-----------------------------------------------------------*/
+
+/* ------------------------------------------------------------------
+ This file is part of bzip2/libbzip2, a program and library for
+ lossless, block-sorting data compression.
+
+ bzip2/libbzip2 version 1.0.6 of 6 September 2010
+ Copyright (C) 1996-2010 Julian Seward <jseward@bzip.org>
+
+ Please read the WARNING, DISCLAIMER and PATENTS sections in the
+ README file.
+
+ This program is released under the terms of the license contained
+ in the file LICENSE.
+ ------------------------------------------------------------------ */
+
+
+/* Place a 1 beside your platform, and 0 elsewhere.
+ Generic 32-bit Unix.
+ Also works on 64-bit Unix boxes.
+ This is the default.
+*/
+#define BZ_UNIX 1
+
+/*--
+ Win32, as seen by Jacob Navia's excellent
+ port of (Chris Fraser & David Hanson)'s excellent
+ lcc compiler. Or with MS Visual C.
+ This is selected automatically if compiled by a compiler which
+ defines _WIN32, not including the Cygwin GCC.
+--*/
+#define BZ_LCCWIN32 0
+
+#if defined(_WIN32) && !defined(__CYGWIN__)
+#undef BZ_LCCWIN32
+#define BZ_LCCWIN32 1
+#undef BZ_UNIX
+#define BZ_UNIX 0
+#endif
+
+
+/*---------------------------------------------*/
+/*--
+ Some stuff for all platforms.
+--*/
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <signal.h>
+#include <math.h>
+#include <errno.h>
+#include <ctype.h>
+#include "bzlib.h"
+
+#define ERROR_IF_EOF(i) { if ((i) == EOF) ioError(); }
+#define ERROR_IF_NOT_ZERO(i) { if ((i) != 0) ioError(); }
+#define ERROR_IF_MINUS_ONE(i) { if ((i) == (-1)) ioError(); }
+
+
+/*---------------------------------------------*/
+/*--
+ Platform-specific stuff.
+--*/
+
+#if BZ_UNIX
+# include <fcntl.h>
+# include <sys/types.h>
+# include <utime.h>
+# include <unistd.h>
+# include <sys/stat.h>
+# include <sys/times.h>
+
+# define PATH_SEP '/'
+# define MY_LSTAT lstat
+# define MY_STAT stat
+# define MY_S_ISREG S_ISREG
+# define MY_S_ISDIR S_ISDIR
+
+# define APPEND_FILESPEC(root, name) \
+ root=snocString((root), (name))
+
+# define APPEND_FLAG(root, name) \
+ root=snocString((root), (name))
+
+# define SET_BINARY_MODE(fd) /**/
+
+# ifdef __GNUC__
+# define NORETURN __attribute__ ((noreturn))
+# else
+# define NORETURN /**/
+# endif
+
+# ifdef __DJGPP__
+# include <io.h>
+# include <fcntl.h>
+# undef MY_LSTAT
+# undef MY_STAT
+# define MY_LSTAT stat
+# define MY_STAT stat
+# undef SET_BINARY_MODE
+# define SET_BINARY_MODE(fd) \
+ do { \
+ int retVal = setmode ( fileno ( fd ), \
+ O_BINARY ); \
+ ERROR_IF_MINUS_ONE ( retVal ); \
+ } while ( 0 )
+# endif
+
+# ifdef __CYGWIN__
+# include <io.h>
+# include <fcntl.h>
+# undef SET_BINARY_MODE
+# define SET_BINARY_MODE(fd) \
+ do { \
+ int retVal = setmode ( fileno ( fd ), \
+ O_BINARY ); \
+ ERROR_IF_MINUS_ONE ( retVal ); \
+ } while ( 0 )
+# endif
+#endif /* BZ_UNIX */
+
+
+
+#if BZ_LCCWIN32
+# include <io.h>
+# include <fcntl.h>
+# include <sys\stat.h>
+
+# define NORETURN /**/
+# define PATH_SEP '\\'
+# define MY_LSTAT _stat
+# define MY_STAT _stat
+# define MY_S_ISREG(x) ((x) & _S_IFREG)
+# define MY_S_ISDIR(x) ((x) & _S_IFDIR)
+
+# define APPEND_FLAG(root, name) \
+ root=snocString((root), (name))
+
+# define APPEND_FILESPEC(root, name) \
+ root = snocString ((root), (name))
+
+# define SET_BINARY_MODE(fd) \
+ do { \
+ int retVal = setmode ( fileno ( fd ), \
+ O_BINARY ); \
+ ERROR_IF_MINUS_ONE ( retVal ); \
+ } while ( 0 )
+
+#endif /* BZ_LCCWIN32 */
+
+
+/*---------------------------------------------*/
+/*--
+ Some more stuff for all platforms :-)
+--*/
+
+typedef char Char;
+typedef unsigned char Bool;
+typedef unsigned char UChar;
+typedef int Int32;
+typedef unsigned int UInt32;
+typedef short Int16;
+typedef unsigned short UInt16;
+
+#define True ((Bool)1)
+#define False ((Bool)0)
+
+/*--
+ IntNative is your platform's `native' int size.
+ Only here to avoid probs with 64-bit platforms.
+--*/
+typedef int IntNative;
+
+
+/*---------------------------------------------------*/
+/*--- Misc (file handling) data decls ---*/
+/*---------------------------------------------------*/
+
+Int32 verbosity;
+Bool keepInputFiles, smallMode, deleteOutputOnInterrupt;
+Bool forceOverwrite, testFailsExist, unzFailsExist, noisy;
+Int32 numFileNames, numFilesProcessed, blockSize100k;
+Int32 exitValue;
+
+/*-- source modes; F==file, I==stdin, O==stdout --*/
+#define SM_I2O 1
+#define SM_F2O 2
+#define SM_F2F 3
+
+/*-- operation modes --*/
+#define OM_Z 1
+#define OM_UNZ 2
+#define OM_TEST 3
+
+Int32 opMode;
+Int32 srcMode;
+
+#define FILE_NAME_LEN 1034
+
+Int32 longestFileName;
+Char inName [FILE_NAME_LEN];
+Char outName[FILE_NAME_LEN];
+Char tmpName[FILE_NAME_LEN];
+Char *progName;
+Char progNameReally[FILE_NAME_LEN];
+FILE *outputHandleJustInCase;
+Int32 workFactor;
+
+static void panic ( const Char* ) NORETURN;
+static void ioError ( void ) NORETURN;
+static void outOfMemory ( void ) NORETURN;
+static void configError ( void ) NORETURN;
+static void crcError ( void ) NORETURN;
+static void cleanUpAndFail ( Int32 ) NORETURN;
+static void compressedStreamEOF ( void ) NORETURN;
+
+static void copyFileName ( Char*, Char* );
+static void* myMalloc ( Int32 );
+static void applySavedFileAttrToOutputFile ( IntNative fd );
+
+
+
+/*---------------------------------------------------*/
+/*--- An implementation of 64-bit ints. Sigh. ---*/
+/*--- Roll on widespread deployment of ANSI C9X ! ---*/
+/*---------------------------------------------------*/
+
+typedef
+ struct { UChar b[8]; }
+ UInt64;
+
+
+static
+void uInt64_from_UInt32s ( UInt64* n, UInt32 lo32, UInt32 hi32 )
+{
+ n->b[7] = (UChar)((hi32 >> 24) & 0xFF);
+ n->b[6] = (UChar)((hi32 >> 16) & 0xFF);
+ n->b[5] = (UChar)((hi32 >> 8) & 0xFF);
+ n->b[4] = (UChar) (hi32 & 0xFF);
+ n->b[3] = (UChar)((lo32 >> 24) & 0xFF);
+ n->b[2] = (UChar)((lo32 >> 16) & 0xFF);
+ n->b[1] = (UChar)((lo32 >> 8) & 0xFF);
+ n->b[0] = (UChar) (lo32 & 0xFF);
+}
+
+
+static
+double uInt64_to_double ( UInt64* n )
+{
+ Int32 i;
+ double base = 1.0;
+ double sum = 0.0;
+ for (i = 0; i < 8; i++) {
+ sum += base * (double)(n->b[i]);
+ base *= 256.0;
+ }
+ return sum;
+}
+
+
+static
+Bool uInt64_isZero ( UInt64* n )
+{
+ Int32 i;
+ for (i = 0; i < 8; i++)
+ if (n->b[i] != 0) return 0;
+ return 1;
+}
+
+
+/* Divide *n by 10, and return the remainder. */
+static
+Int32 uInt64_qrm10 ( UInt64* n )
+{
+ UInt32 rem, tmp;
+ Int32 i;
+ rem = 0;
+ for (i = 7; i >= 0; i--) {
+ tmp = rem * 256 + n->b[i];
+ n->b[i] = tmp / 10;
+ rem = tmp % 10;
+ }
+ return rem;
+}
+
+
+/* ... and the Whole Entire Point of all this UInt64 stuff is
+ so that we can supply the following function.
+*/
+static
+void uInt64_toAscii ( char* outbuf, UInt64* n )
+{
+ Int32 i, q;
+ UChar buf[32];
+ Int32 nBuf = 0;
+ UInt64 n_copy = *n;
+ do {
+ q = uInt64_qrm10 ( &n_copy );
+ buf[nBuf] = q + '0';
+ nBuf++;
+ } while (!uInt64_isZero(&n_copy));
+ outbuf[nBuf] = 0;
+ for (i = 0; i < nBuf; i++)
+ outbuf[i] = buf[nBuf-i-1];
+}
+
+
+/*---------------------------------------------------*/
+/*--- Processing of complete files and streams ---*/
+/*---------------------------------------------------*/
+
+/*---------------------------------------------*/
+static
+Bool myfeof ( FILE* f )
+{
+ Int32 c = fgetc ( f );
+ if (c == EOF) return True;
+ ungetc ( c, f );
+ return False;
+}
+
+
+/*---------------------------------------------*/
+static
+void compressStream ( FILE *stream, FILE *zStream )
+{
+ BZFILE* bzf = NULL;
+ UChar ibuf[5000];
+ Int32 nIbuf;
+ UInt32 nbytes_in_lo32, nbytes_in_hi32;
+ UInt32 nbytes_out_lo32, nbytes_out_hi32;
+ Int32 bzerr, bzerr_dummy, ret;
+
+ SET_BINARY_MODE(stream);
+ SET_BINARY_MODE(zStream);
+
+ if (ferror(stream)) goto errhandler_io;
+ if (ferror(zStream)) goto errhandler_io;
+
+ bzf = BZ2_bzWriteOpen ( &bzerr, zStream,
+ blockSize100k, verbosity, workFactor );
+ if (bzerr != BZ_OK) goto errhandler;
+
+ if (verbosity >= 2) fprintf ( stderr, "\n" );
+
+ while (True) {
+
+ if (myfeof(stream)) break;
+ nIbuf = fread ( ibuf, sizeof(UChar), 5000, stream );
+ if (ferror(stream)) goto errhandler_io;
+ if (nIbuf > 0) BZ2_bzWrite ( &bzerr, bzf, (void*)ibuf, nIbuf );
+ if (bzerr != BZ_OK) goto errhandler;
+
+ }
+
+ BZ2_bzWriteClose64 ( &bzerr, bzf, 0,
+ &nbytes_in_lo32, &nbytes_in_hi32,
+ &nbytes_out_lo32, &nbytes_out_hi32 );
+ if (bzerr != BZ_OK) goto errhandler;
+
+ if (ferror(zStream)) goto errhandler_io;
+ ret = fflush ( zStream );
+ if (ret == EOF) goto errhandler_io;
+ if (zStream != stdout) {
+ Int32 fd = fileno ( zStream );
+ if (fd < 0) goto errhandler_io;
+ applySavedFileAttrToOutputFile ( fd );
+ ret = fclose ( zStream );
+ outputHandleJustInCase = NULL;
+ if (ret == EOF) goto errhandler_io;
+ }
+ outputHandleJustInCase = NULL;
+ if (ferror(stream)) goto errhandler_io;
+ ret = fclose ( stream );
+ if (ret == EOF) goto errhandler_io;
+
+ if (verbosity >= 1) {
+ if (nbytes_in_lo32 == 0 && nbytes_in_hi32 == 0) {
+ fprintf ( stderr, " no data compressed.\n");
+ } else {
+ Char buf_nin[32], buf_nout[32];
+ UInt64 nbytes_in, nbytes_out;
+ double nbytes_in_d, nbytes_out_d;
+ uInt64_from_UInt32s ( &nbytes_in,
+ nbytes_in_lo32, nbytes_in_hi32 );
+ uInt64_from_UInt32s ( &nbytes_out,
+ nbytes_out_lo32, nbytes_out_hi32 );
+ nbytes_in_d = uInt64_to_double ( &nbytes_in );
+ nbytes_out_d = uInt64_to_double ( &nbytes_out );
+ uInt64_toAscii ( buf_nin, &nbytes_in );
+ uInt64_toAscii ( buf_nout, &nbytes_out );
+ fprintf ( stderr, "%6.3f:1, %6.3f bits/byte, "
+ "%5.2f%% saved, %s in, %s out.\n",
+ nbytes_in_d / nbytes_out_d,
+ (8.0 * nbytes_out_d) / nbytes_in_d,
+ 100.0 * (1.0 - nbytes_out_d / nbytes_in_d),
+ buf_nin,
+ buf_nout
+ );
+ }
+ }
+
+ return;
+
+ errhandler:
+ BZ2_bzWriteClose64 ( &bzerr_dummy, bzf, 1,
+ &nbytes_in_lo32, &nbytes_in_hi32,
+ &nbytes_out_lo32, &nbytes_out_hi32 );
+ switch (bzerr) {
+ case BZ_CONFIG_ERROR:
+ configError(); break;
+ case BZ_MEM_ERROR:
+ outOfMemory (); break;
+ case BZ_IO_ERROR:
+ errhandler_io:
+ ioError(); break;
+ default:
+ panic ( "compress:unexpected error" );
+ }
+
+ panic ( "compress:end" );
+ /*notreached*/
+}
+
+
+
+/*---------------------------------------------*/
+static
+Bool uncompressStream ( FILE *zStream, FILE *stream )
+{
+ BZFILE* bzf = NULL;
+ Int32 bzerr, bzerr_dummy, ret, nread, streamNo, i;
+ UChar obuf[5000];
+ UChar unused[BZ_MAX_UNUSED];
+ Int32 nUnused;
+ void* unusedTmpV;
+ UChar* unusedTmp;
+
+ nUnused = 0;
+ streamNo = 0;
+
+ SET_BINARY_MODE(stream);
+ SET_BINARY_MODE(zStream);
+
+ if (ferror(stream)) goto errhandler_io;
+ if (ferror(zStream)) goto errhandler_io;
+
+ while (True) {
+
+ bzf = BZ2_bzReadOpen (
+ &bzerr, zStream, verbosity,
+ (int)smallMode, unused, nUnused
+ );
+ if (bzf == NULL || bzerr != BZ_OK) goto errhandler;
+ streamNo++;
+
+ while (bzerr == BZ_OK) {
+ nread = BZ2_bzRead ( &bzerr, bzf, obuf, 5000 );
+ if (bzerr == BZ_DATA_ERROR_MAGIC) goto trycat;
+ if ((bzerr == BZ_OK || bzerr == BZ_STREAM_END) && nread > 0)
+ fwrite ( obuf, sizeof(UChar), nread, stream );
+ if (ferror(stream)) goto errhandler_io;
+ }
+ if (bzerr != BZ_STREAM_END) goto errhandler;
+
+ BZ2_bzReadGetUnused ( &bzerr, bzf, &unusedTmpV, &nUnused );
+ if (bzerr != BZ_OK) panic ( "decompress:bzReadGetUnused" );
+
+ unusedTmp = (UChar*)unusedTmpV;
+ for (i = 0; i < nUnused; i++) unused[i] = unusedTmp[i];
+
+ BZ2_bzReadClose ( &bzerr, bzf );
+ if (bzerr != BZ_OK) panic ( "decompress:bzReadGetUnused" );
+
+ if (nUnused == 0 && myfeof(zStream)) break;
+ }
+
+ closeok:
+ if (ferror(zStream)) goto errhandler_io;
+ if (stream != stdout) {
+ Int32 fd = fileno ( stream );
+ if (fd < 0) goto errhandler_io;
+ applySavedFileAttrToOutputFile ( fd );
+ }
+ ret = fclose ( zStream );
+ if (ret == EOF) goto errhandler_io;
+
+ if (ferror(stream)) goto errhandler_io;
+ ret = fflush ( stream );
+ if (ret != 0) goto errhandler_io;
+ if (stream != stdout) {
+ ret = fclose ( stream );
+ outputHandleJustInCase = NULL;
+ if (ret == EOF) goto errhandler_io;
+ }
+ outputHandleJustInCase = NULL;
+ if (verbosity >= 2) fprintf ( stderr, "\n " );
+ return True;
+
+ trycat:
+ if (forceOverwrite) {
+ rewind(zStream);
+ while (True) {
+ if (myfeof(zStream)) break;
+ nread = fread ( obuf, sizeof(UChar), 5000, zStream );
+ if (ferror(zStream)) goto errhandler_io;
+ if (nread > 0) fwrite ( obuf, sizeof(UChar), nread, stream );
+ if (ferror(stream)) goto errhandler_io;
+ }
+ goto closeok;
+ }
+
+ errhandler:
+ BZ2_bzReadClose ( &bzerr_dummy, bzf );
+ switch (bzerr) {
+ case BZ_CONFIG_ERROR:
+ configError(); break;
+ case BZ_IO_ERROR:
+ errhandler_io:
+ ioError(); break;
+ case BZ_DATA_ERROR:
+ crcError();
+ case BZ_MEM_ERROR:
+ outOfMemory();
+ case BZ_UNEXPECTED_EOF:
+ compressedStreamEOF();
+ case BZ_DATA_ERROR_MAGIC:
+ if (zStream != stdin) fclose(zStream);
+ if (stream != stdout) fclose(stream);
+ if (streamNo == 1) {
+ return False;
+ } else {
+ if (noisy)
+ fprintf ( stderr,
+ "\n%s: %s: trailing garbage after EOF ignored\n",
+ progName, inName );
+ return True;
+ }
+ default:
+ panic ( "decompress:unexpected error" );
+ }
+
+ panic ( "decompress:end" );
+ return True; /*notreached*/
+}
+
+
+/*---------------------------------------------*/
+static
+Bool testStream ( FILE *zStream )
+{
+ BZFILE* bzf = NULL;
+ Int32 bzerr, bzerr_dummy, ret, nread, streamNo, i;
+ UChar obuf[5000];
+ UChar unused[BZ_MAX_UNUSED];
+ Int32 nUnused;
+ void* unusedTmpV;
+ UChar* unusedTmp;
+
+ nUnused = 0;
+ streamNo = 0;
+
+ SET_BINARY_MODE(zStream);
+ if (ferror(zStream)) goto errhandler_io;
+
+ while (True) {
+
+ bzf = BZ2_bzReadOpen (
+ &bzerr, zStream, verbosity,
+ (int)smallMode, unused, nUnused
+ );
+ if (bzf == NULL || bzerr != BZ_OK) goto errhandler;
+ streamNo++;
+
+ while (bzerr == BZ_OK) {
+ nread = BZ2_bzRead ( &bzerr, bzf, obuf, 5000 );
+ if (bzerr == BZ_DATA_ERROR_MAGIC) goto errhandler;
+ }
+ if (bzerr != BZ_STREAM_END) goto errhandler;
+
+ BZ2_bzReadGetUnused ( &bzerr, bzf, &unusedTmpV, &nUnused );
+ if (bzerr != BZ_OK) panic ( "test:bzReadGetUnused" );
+
+ unusedTmp = (UChar*)unusedTmpV;
+ for (i = 0; i < nUnused; i++) unused[i] = unusedTmp[i];
+
+ BZ2_bzReadClose ( &bzerr, bzf );
+ if (bzerr != BZ_OK) panic ( "test:bzReadGetUnused" );
+ if (nUnused == 0 && myfeof(zStream)) break;
+
+ }
+
+ if (ferror(zStream)) goto errhandler_io;
+ ret = fclose ( zStream );
+ if (ret == EOF) goto errhandler_io;
+
+ if (verbosity >= 2) fprintf ( stderr, "\n " );
+ return True;
+
+ errhandler:
+ BZ2_bzReadClose ( &bzerr_dummy, bzf );
+ if (verbosity == 0)
+ fprintf ( stderr, "%s: %s: ", progName, inName );
+ switch (bzerr) {
+ case BZ_CONFIG_ERROR:
+ configError(); break;
+ case BZ_IO_ERROR:
+ errhandler_io:
+ ioError(); break;
+ case BZ_DATA_ERROR:
+ fprintf ( stderr,
+ "data integrity (CRC) error in data\n" );
+ return False;
+ case BZ_MEM_ERROR:
+ outOfMemory();
+ case BZ_UNEXPECTED_EOF:
+ fprintf ( stderr,
+ "file ends unexpectedly\n" );
+ return False;
+ case BZ_DATA_ERROR_MAGIC:
+ if (zStream != stdin) fclose(zStream);
+ if (streamNo == 1) {
+ fprintf ( stderr,
+ "bad magic number (file not created by bzip2)\n" );
+ return False;
+ } else {
+ if (noisy)
+ fprintf ( stderr,
+ "trailing garbage after EOF ignored\n" );
+ return True;
+ }
+ default:
+ panic ( "test:unexpected error" );
+ }
+
+ panic ( "test:end" );
+ return True; /*notreached*/
+}
+
+
+/*---------------------------------------------------*/
+/*--- Error [non-] handling grunge ---*/
+/*---------------------------------------------------*/
+
+/*---------------------------------------------*/
+static
+void setExit ( Int32 v )
+{
+ if (v > exitValue) exitValue = v;
+}
+
+
+/*---------------------------------------------*/
+static
+void cadvise ( void )
+{
+ if (noisy)
+ fprintf (
+ stderr,
+ "\nIt is possible that the compressed file(s) have become corrupted.\n"
+ "You can use the -tvv option to test integrity of such files.\n\n"
+ "You can use the `bzip2recover' program to attempt to recover\n"
+ "data from undamaged sections of corrupted files.\n\n"
+ );
+}
+
+
+/*---------------------------------------------*/
+static
+void showFileNames ( void )
+{
+ if (noisy)
+ fprintf (
+ stderr,
+ "\tInput file = %s, output file = %s\n",
+ inName, outName
+ );
+}
+
+
+/*---------------------------------------------*/
+static
+void cleanUpAndFail ( Int32 ec )
+{
+ IntNative retVal;
+ struct MY_STAT statBuf;
+
+ if ( srcMode == SM_F2F
+ && opMode != OM_TEST
+ && deleteOutputOnInterrupt ) {
+
+ /* Check whether input file still exists. Delete output file
+ only if input exists to avoid loss of data. Joerg Prante, 5
+ January 2002. (JRS 06-Jan-2002: other changes in 1.0.2 mean
+ this is less likely to happen. But to be ultra-paranoid, we
+ do the check anyway.) */
+ retVal = MY_STAT ( inName, &statBuf );
+ if (retVal == 0) {
+ if (noisy)
+ fprintf ( stderr,
+ "%s: Deleting output file %s, if it exists.\n",
+ progName, outName );
+ if (outputHandleJustInCase != NULL)
+ fclose ( outputHandleJustInCase );
+ retVal = remove ( outName );
+ if (retVal != 0)
+ fprintf ( stderr,
+ "%s: WARNING: deletion of output file "
+ "(apparently) failed.\n",
+ progName );
+ } else {
+ fprintf ( stderr,
+ "%s: WARNING: deletion of output file suppressed\n",
+ progName );
+ fprintf ( stderr,
+ "%s: since input file no longer exists. Output file\n",
+ progName );
+ fprintf ( stderr,
+ "%s: `%s' may be incomplete.\n",
+ progName, outName );
+ fprintf ( stderr,
+ "%s: I suggest doing an integrity test (bzip2 -tv)"
+ " of it.\n",
+ progName );
+ }
+ }
+
+ if (noisy && numFileNames > 0 && numFilesProcessed < numFileNames) {
+ fprintf ( stderr,
+ "%s: WARNING: some files have not been processed:\n"
+ "%s: %d specified on command line, %d not processed yet.\n\n",
+ progName, progName,
+ numFileNames, numFileNames - numFilesProcessed );
+ }
+ setExit(ec);
+ exit(exitValue);
+}
+
+
+/*---------------------------------------------*/
+static
+void panic ( const Char* s )
+{
+ fprintf ( stderr,
+ "\n%s: PANIC -- internal consistency error:\n"
+ "\t%s\n"
+ "\tThis is a BUG. Please report it to me at:\n"
+ "\tjseward@bzip.org\n",
+ progName, s );
+ showFileNames();
+ cleanUpAndFail( 3 );
+}
+
+
+/*---------------------------------------------*/
+static
+void crcError ( void )
+{
+ fprintf ( stderr,
+ "\n%s: Data integrity error when decompressing.\n",
+ progName );
+ showFileNames();
+ cadvise();
+ cleanUpAndFail( 2 );
+}
+
+
+/*---------------------------------------------*/
+static
+void compressedStreamEOF ( void )
+{
+ if (noisy) {
+ fprintf ( stderr,
+ "\n%s: Compressed file ends unexpectedly;\n\t"
+ "perhaps it is corrupted? *Possible* reason follows.\n",
+ progName );
+ perror ( progName );
+ showFileNames();
+ cadvise();
+ }
+ cleanUpAndFail( 2 );
+}
+
+
+/*---------------------------------------------*/
+static
+void ioError ( void )
+{
+ fprintf ( stderr,
+ "\n%s: I/O or other error, bailing out. "
+ "Possible reason follows.\n",
+ progName );
+ perror ( progName );
+ showFileNames();
+ cleanUpAndFail( 1 );
+}
+
+
+/*---------------------------------------------*/
+static
+void mySignalCatcher ( IntNative n )
+{
+ fprintf ( stderr,
+ "\n%s: Control-C or similar caught, quitting.\n",
+ progName );
+ cleanUpAndFail(1);
+}
+
+
+/*---------------------------------------------*/
+static
+void mySIGSEGVorSIGBUScatcher ( IntNative n )
+{
+ if (opMode == OM_Z)
+ fprintf (
+ stderr,
+ "\n%s: Caught a SIGSEGV or SIGBUS whilst compressing.\n"
+ "\n"
+ " Possible causes are (most likely first):\n"
+ " (1) This computer has unreliable memory or cache hardware\n"
+ " (a surprisingly common problem; try a different machine.)\n"
+ " (2) A bug in the compiler used to create this executable\n"
+ " (unlikely, if you didn't compile bzip2 yourself.)\n"
+ " (3) A real bug in bzip2 -- I hope this should never be the case.\n"
+ " The user's manual, Section 4.3, has more info on (1) and (2).\n"
+ " \n"
+ " If you suspect this is a bug in bzip2, or are unsure about (1)\n"
+ " or (2), feel free to report it to me at: jseward@bzip.org.\n"
+ " Section 4.3 of the user's manual describes the info a useful\n"
+ " bug report should have. If the manual is available on your\n"
+ " system, please try and read it before mailing me. If you don't\n"
+ " have the manual or can't be bothered to read it, mail me anyway.\n"
+ "\n",
+ progName );
+ else
+ fprintf (
+ stderr,
+ "\n%s: Caught a SIGSEGV or SIGBUS whilst decompressing.\n"
+ "\n"
+ " Possible causes are (most likely first):\n"
+ " (1) The compressed data is corrupted, and bzip2's usual checks\n"
+ " failed to detect this. Try bzip2 -tvv my_file.bz2.\n"
+ " (2) This computer has unreliable memory or cache hardware\n"
+ " (a surprisingly common problem; try a different machine.)\n"
+ " (3) A bug in the compiler used to create this executable\n"
+ " (unlikely, if you didn't compile bzip2 yourself.)\n"
+ " (4) A real bug in bzip2 -- I hope this should never be the case.\n"
+ " The user's manual, Section 4.3, has more info on (2) and (3).\n"
+ " \n"
+ " If you suspect this is a bug in bzip2, or are unsure about (2)\n"
+ " or (3), feel free to report it to me at: jseward@bzip.org.\n"
+ " Section 4.3 of the user's manual describes the info a useful\n"
+ " bug report should have. If the manual is available on your\n"
+ " system, please try and read it before mailing me. If you don't\n"
+ " have the manual or can't be bothered to read it, mail me anyway.\n"
+ "\n",
+ progName );
+
+ showFileNames();
+ if (opMode == OM_Z)
+ cleanUpAndFail( 3 ); else
+ { cadvise(); cleanUpAndFail( 2 ); }
+}
+
+
+/*---------------------------------------------*/
+static
+void outOfMemory ( void )
+{
+ fprintf ( stderr,
+ "\n%s: couldn't allocate enough memory\n",
+ progName );
+ showFileNames();
+ cleanUpAndFail(1);
+}
+
+
+/*---------------------------------------------*/
+static
+void configError ( void )
+{
+ fprintf ( stderr,
+ "bzip2: I'm not configured correctly for this platform!\n"
+ "\tI require Int32, Int16 and Char to have sizes\n"
+ "\tof 4, 2 and 1 bytes to run properly, and they don't.\n"
+ "\tProbably you can fix this by defining them correctly,\n"
+ "\tand recompiling. Bye!\n" );
+ setExit(3);
+ exit(exitValue);
+}
+
+
+/*---------------------------------------------------*/
+/*--- The main driver machinery ---*/
+/*---------------------------------------------------*/
+
+/* All rather crufty. The main problem is that input files
+ are stat()d multiple times before use. This should be
+ cleaned up.
+*/
+
+/*---------------------------------------------*/
+static
+void pad ( Char *s )
+{
+ Int32 i;
+ if ( (Int32)strlen(s) >= longestFileName ) return;
+ for (i = 1; i <= longestFileName - (Int32)strlen(s); i++)
+ fprintf ( stderr, " " );
+}
+
+
+/*---------------------------------------------*/
+static
+void copyFileName ( Char* to, Char* from )
+{
+ if ( strlen(from) > FILE_NAME_LEN-10 ) {
+ fprintf (
+ stderr,
+ "bzip2: file name\n`%s'\n"
+ "is suspiciously (more than %d chars) long.\n"
+ "Try using a reasonable file name instead. Sorry! :-)\n",
+ from, FILE_NAME_LEN-10
+ );
+ setExit(1);
+ exit(exitValue);
+ }
+
+ strncpy(to,from,FILE_NAME_LEN-10);
+ to[FILE_NAME_LEN-10]='\0';
+}
+
+
+/*---------------------------------------------*/
+static
+Bool fileExists ( Char* name )
+{
+ FILE *tmp = fopen ( name, "rb" );
+ Bool exists = (tmp != NULL);
+ if (tmp != NULL) fclose ( tmp );
+ return exists;
+}
+
+
+/*---------------------------------------------*/
+/* Open an output file safely with O_EXCL and good permissions.
+ This avoids a race condition in versions < 1.0.2, in which
+ the file was first opened and then had its interim permissions
+ set safely. We instead use open() to create the file with
+ the interim permissions required. (--- --- rw-).
+
+ For non-Unix platforms, if we are not worrying about
+ security issues, simple this simply behaves like fopen.
+*/
+static
+FILE* fopen_output_safely ( Char* name, const char* mode )
+{
+# if BZ_UNIX
+ FILE* fp;
+ IntNative fh;
+ fh = open(name, O_WRONLY|O_CREAT|O_EXCL, S_IWUSR|S_IRUSR);
+ if (fh == -1) return NULL;
+ fp = fdopen(fh, mode);
+ if (fp == NULL) close(fh);
+ return fp;
+# else
+ return fopen(name, mode);
+# endif
+}
+
+
+/*---------------------------------------------*/
+/*--
+ if in doubt, return True
+--*/
+static
+Bool notAStandardFile ( Char* name )
+{
+ IntNative i;
+ struct MY_STAT statBuf;
+
+ i = MY_LSTAT ( name, &statBuf );
+ if (i != 0) return True;
+ if (MY_S_ISREG(statBuf.st_mode)) return False;
+ return True;
+}
+
+
+/*---------------------------------------------*/
+/*--
+ rac 11/21/98 see if file has hard links to it
+--*/
+static
+Int32 countHardLinks ( Char* name )
+{
+ IntNative i;
+ struct MY_STAT statBuf;
+
+ i = MY_LSTAT ( name, &statBuf );
+ if (i != 0) return 0;
+ return (statBuf.st_nlink - 1);
+}
+
+
+/*---------------------------------------------*/
+/* Copy modification date, access date, permissions and owner from the
+ source to destination file. We have to copy this meta-info off
+ into fileMetaInfo before starting to compress / decompress it,
+ because doing it afterwards means we get the wrong access time.
+
+ To complicate matters, in compress() and decompress() below, the
+ sequence of tests preceding the call to saveInputFileMetaInfo()
+ involves calling fileExists(), which in turn establishes its result
+ by attempting to fopen() the file, and if successful, immediately
+ fclose()ing it again. So we have to assume that the fopen() call
+ does not cause the access time field to be updated.
+
+ Reading of the man page for stat() (man 2 stat) on RedHat 7.2 seems
+ to imply that merely doing open() will not affect the access time.
+ Therefore we merely need to hope that the C library only does
+ open() as a result of fopen(), and not any kind of read()-ahead
+ cleverness.
+
+ It sounds pretty fragile to me. Whether this carries across
+ robustly to arbitrary Unix-like platforms (or even works robustly
+ on this one, RedHat 7.2) is unknown to me. Nevertheless ...
+*/
+#if BZ_UNIX
+static
+struct MY_STAT fileMetaInfo;
+#endif
+
+static
+void saveInputFileMetaInfo ( Char *srcName )
+{
+# if BZ_UNIX
+ IntNative retVal;
+ /* Note use of stat here, not lstat. */
+ retVal = MY_STAT( srcName, &fileMetaInfo );
+ ERROR_IF_NOT_ZERO ( retVal );
+# endif
+}
+
+
+static
+void applySavedTimeInfoToOutputFile ( Char *dstName )
+{
+# if BZ_UNIX
+ IntNative retVal;
+ struct utimbuf uTimBuf;
+
+ uTimBuf.actime = fileMetaInfo.st_atime;
+ uTimBuf.modtime = fileMetaInfo.st_mtime;
+
+ retVal = utime ( dstName, &uTimBuf );
+ ERROR_IF_NOT_ZERO ( retVal );
+# endif
+}
+
+static
+void applySavedFileAttrToOutputFile ( IntNative fd )
+{
+# if BZ_UNIX
+ IntNative retVal;
+
+ retVal = fchmod ( fd, fileMetaInfo.st_mode );
+ ERROR_IF_NOT_ZERO ( retVal );
+
+ (void) fchown ( fd, fileMetaInfo.st_uid, fileMetaInfo.st_gid );
+ /* chown() will in many cases return with EPERM, which can
+ be safely ignored.
+ */
+# endif
+}
+
+
+/*---------------------------------------------*/
+static
+Bool containsDubiousChars ( Char* name )
+{
+# if BZ_UNIX
+ /* On unix, files can contain any characters and the file expansion
+ * is performed by the shell.
+ */
+ return False;
+# else /* ! BZ_UNIX */
+ /* On non-unix (Win* platforms), wildcard characters are not allowed in
+ * filenames.
+ */
+ for (; *name != '\0'; name++)
+ if (*name == '?' || *name == '*') return True;
+ return False;
+# endif /* BZ_UNIX */
+}
+
+
+/*---------------------------------------------*/
+#define BZ_N_SUFFIX_PAIRS 4
+
+const Char* zSuffix[BZ_N_SUFFIX_PAIRS]
+ = { ".bz2", ".bz", ".tbz2", ".tbz" };
+const Char* unzSuffix[BZ_N_SUFFIX_PAIRS]
+ = { "", "", ".tar", ".tar" };
+
+static
+Bool hasSuffix ( Char* s, const Char* suffix )
+{
+ Int32 ns = strlen(s);
+ Int32 nx = strlen(suffix);
+ if (ns < nx) return False;
+ if (strcmp(s + ns - nx, suffix) == 0) return True;
+ return False;
+}
+
+static
+Bool mapSuffix ( Char* name,
+ const Char* oldSuffix,
+ const Char* newSuffix )
+{
+ if (!hasSuffix(name,oldSuffix)) return False;
+ name[strlen(name)-strlen(oldSuffix)] = 0;
+ strcat ( name, newSuffix );
+ return True;
+}
+
+
+/*---------------------------------------------*/
+static
+void compress ( Char *name )
+{
+ FILE *inStr;
+ FILE *outStr;
+ Int32 n, i;
+ struct MY_STAT statBuf;
+
+ deleteOutputOnInterrupt = False;
+
+ if (name == NULL && srcMode != SM_I2O)
+ panic ( "compress: bad modes\n" );
+
+ switch (srcMode) {
+ case SM_I2O:
+ copyFileName ( inName, (Char*)"(stdin)" );
+ copyFileName ( outName, (Char*)"(stdout)" );
+ break;
+ case SM_F2F:
+ copyFileName ( inName, name );
+ copyFileName ( outName, name );
+ strcat ( outName, ".bz2" );
+ break;
+ case SM_F2O:
+ copyFileName ( inName, name );
+ copyFileName ( outName, (Char*)"(stdout)" );
+ break;
+ }
+
+ if ( srcMode != SM_I2O && containsDubiousChars ( inName ) ) {
+ if (noisy)
+ fprintf ( stderr, "%s: There are no files matching `%s'.\n",
+ progName, inName );
+ setExit(1);
+ return;
+ }
+ if ( srcMode != SM_I2O && !fileExists ( inName ) ) {
+ fprintf ( stderr, "%s: Can't open input file %s: %s.\n",
+ progName, inName, strerror(errno) );
+ setExit(1);
+ return;
+ }
+ for (i = 0; i < BZ_N_SUFFIX_PAIRS; i++) {
+ if (hasSuffix(inName, zSuffix[i])) {
+ if (noisy)
+ fprintf ( stderr,
+ "%s: Input file %s already has %s suffix.\n",
+ progName, inName, zSuffix[i] );
+ setExit(1);
+ return;
+ }
+ }
+ if ( srcMode == SM_F2F || srcMode == SM_F2O ) {
+ MY_STAT(inName, &statBuf);
+ if ( MY_S_ISDIR(statBuf.st_mode) ) {
+ fprintf( stderr,
+ "%s: Input file %s is a directory.\n",
+ progName,inName);
+ setExit(1);
+ return;
+ }
+ }
+ if ( srcMode == SM_F2F && !forceOverwrite && notAStandardFile ( inName )) {
+ if (noisy)
+ fprintf ( stderr, "%s: Input file %s is not a normal file.\n",
+ progName, inName );
+ setExit(1);
+ return;
+ }
+ if ( srcMode == SM_F2F && fileExists ( outName ) ) {
+ if (forceOverwrite) {
+ remove(outName);
+ } else {
+ fprintf ( stderr, "%s: Output file %s already exists.\n",
+ progName, outName );
+ setExit(1);
+ return;
+ }
+ }
+ if ( srcMode == SM_F2F && !forceOverwrite &&
+ (n=countHardLinks ( inName )) > 0) {
+ fprintf ( stderr, "%s: Input file %s has %d other link%s.\n",
+ progName, inName, n, n > 1 ? "s" : "" );
+ setExit(1);
+ return;
+ }
+
+ if ( srcMode == SM_F2F ) {
+ /* Save the file's meta-info before we open it. Doing it later
+ means we mess up the access times. */
+ saveInputFileMetaInfo ( inName );
+ }
+
+ switch ( srcMode ) {
+
+ case SM_I2O:
+ inStr = stdin;
+ outStr = stdout;
+ if ( isatty ( fileno ( stdout ) ) ) {
+ fprintf ( stderr,
+ "%s: I won't write compressed data to a terminal.\n",
+ progName );
+ fprintf ( stderr, "%s: For help, type: `%s --help'.\n",
+ progName, progName );
+ setExit(1);
+ return;
+ };
+ break;
+
+ case SM_F2O:
+ inStr = fopen ( inName, "rb" );
+ outStr = stdout;
+ if ( isatty ( fileno ( stdout ) ) ) {
+ fprintf ( stderr,
+ "%s: I won't write compressed data to a terminal.\n",
+ progName );
+ fprintf ( stderr, "%s: For help, type: `%s --help'.\n",
+ progName, progName );
+ if ( inStr != NULL ) fclose ( inStr );
+ setExit(1);
+ return;
+ };
+ if ( inStr == NULL ) {
+ fprintf ( stderr, "%s: Can't open input file %s: %s.\n",
+ progName, inName, strerror(errno) );
+ setExit(1);
+ return;
+ };
+ break;
+
+ case SM_F2F:
+ inStr = fopen ( inName, "rb" );
+ outStr = fopen_output_safely ( outName, "wb" );
+ if ( outStr == NULL) {
+ fprintf ( stderr, "%s: Can't create output file %s: %s.\n",
+ progName, outName, strerror(errno) );
+ if ( inStr != NULL ) fclose ( inStr );
+ setExit(1);
+ return;
+ }
+ if ( inStr == NULL ) {
+ fprintf ( stderr, "%s: Can't open input file %s: %s.\n",
+ progName, inName, strerror(errno) );
+ if ( outStr != NULL ) fclose ( outStr );
+ setExit(1);
+ return;
+ };
+ break;
+
+ default:
+ panic ( "compress: bad srcMode" );
+ break;
+ }
+
+ if (verbosity >= 1) {
+ fprintf ( stderr, " %s: ", inName );
+ pad ( inName );
+ fflush ( stderr );
+ }
+
+ /*--- Now the input and output handles are sane. Do the Biz. ---*/
+ outputHandleJustInCase = outStr;
+ deleteOutputOnInterrupt = True;
+ compressStream ( inStr, outStr );
+ outputHandleJustInCase = NULL;
+
+ /*--- If there was an I/O error, we won't get here. ---*/
+ if ( srcMode == SM_F2F ) {
+ applySavedTimeInfoToOutputFile ( outName );
+ deleteOutputOnInterrupt = False;
+ if ( !keepInputFiles ) {
+ IntNative retVal = remove ( inName );
+ ERROR_IF_NOT_ZERO ( retVal );
+ }
+ }
+
+ deleteOutputOnInterrupt = False;
+}
+
+
+/*---------------------------------------------*/
+static
+void uncompress ( Char *name )
+{
+ FILE *inStr;
+ FILE *outStr;
+ Int32 n, i;
+ Bool magicNumberOK;
+ Bool cantGuess;
+ struct MY_STAT statBuf;
+
+ deleteOutputOnInterrupt = False;
+
+ if (name == NULL && srcMode != SM_I2O)
+ panic ( "uncompress: bad modes\n" );
+
+ cantGuess = False;
+ switch (srcMode) {
+ case SM_I2O:
+ copyFileName ( inName, (Char*)"(stdin)" );
+ copyFileName ( outName, (Char*)"(stdout)" );
+ break;
+ case SM_F2F:
+ copyFileName ( inName, name );
+ copyFileName ( outName, name );
+ for (i = 0; i < BZ_N_SUFFIX_PAIRS; i++)
+ if (mapSuffix(outName,zSuffix[i],unzSuffix[i]))
+ goto zzz;
+ cantGuess = True;
+ strcat ( outName, ".out" );
+ break;
+ case SM_F2O:
+ copyFileName ( inName, name );
+ copyFileName ( outName, (Char*)"(stdout)" );
+ break;
+ }
+
+ zzz:
+ if ( srcMode != SM_I2O && containsDubiousChars ( inName ) ) {
+ if (noisy)
+ fprintf ( stderr, "%s: There are no files matching `%s'.\n",
+ progName, inName );
+ setExit(1);
+ return;
+ }
+ if ( srcMode != SM_I2O && !fileExists ( inName ) ) {
+ fprintf ( stderr, "%s: Can't open input file %s: %s.\n",
+ progName, inName, strerror(errno) );
+ setExit(1);
+ return;
+ }
+ if ( srcMode == SM_F2F || srcMode == SM_F2O ) {
+ MY_STAT(inName, &statBuf);
+ if ( MY_S_ISDIR(statBuf.st_mode) ) {
+ fprintf( stderr,
+ "%s: Input file %s is a directory.\n",
+ progName,inName);
+ setExit(1);
+ return;
+ }
+ }
+ if ( srcMode == SM_F2F && !forceOverwrite && notAStandardFile ( inName )) {
+ if (noisy)
+ fprintf ( stderr, "%s: Input file %s is not a normal file.\n",
+ progName, inName );
+ setExit(1);
+ return;
+ }
+ if ( /* srcMode == SM_F2F implied && */ cantGuess ) {
+ if (noisy)
+ fprintf ( stderr,
+ "%s: Can't guess original name for %s -- using %s\n",
+ progName, inName, outName );
+ /* just a warning, no return */
+ }
+ if ( srcMode == SM_F2F && fileExists ( outName ) ) {
+ if (forceOverwrite) {
+ remove(outName);
+ } else {
+ fprintf ( stderr, "%s: Output file %s already exists.\n",
+ progName, outName );
+ setExit(1);
+ return;
+ }
+ }
+ if ( srcMode == SM_F2F && !forceOverwrite &&
+ (n=countHardLinks ( inName ) ) > 0) {
+ fprintf ( stderr, "%s: Input file %s has %d other link%s.\n",
+ progName, inName, n, n > 1 ? "s" : "" );
+ setExit(1);
+ return;
+ }
+
+ if ( srcMode == SM_F2F ) {
+ /* Save the file's meta-info before we open it. Doing it later
+ means we mess up the access times. */
+ saveInputFileMetaInfo ( inName );
+ }
+
+ switch ( srcMode ) {
+
+ case SM_I2O:
+ inStr = stdin;
+ outStr = stdout;
+ if ( isatty ( fileno ( stdin ) ) ) {
+ fprintf ( stderr,
+ "%s: I won't read compressed data from a terminal.\n",
+ progName );
+ fprintf ( stderr, "%s: For help, type: `%s --help'.\n",
+ progName, progName );
+ setExit(1);
+ return;
+ };
+ break;
+
+ case SM_F2O:
+ inStr = fopen ( inName, "rb" );
+ outStr = stdout;
+ if ( inStr == NULL ) {
+ fprintf ( stderr, "%s: Can't open input file %s:%s.\n",
+ progName, inName, strerror(errno) );
+ if ( inStr != NULL ) fclose ( inStr );
+ setExit(1);
+ return;
+ };
+ break;
+
+ case SM_F2F:
+ inStr = fopen ( inName, "rb" );
+ outStr = fopen_output_safely ( outName, "wb" );
+ if ( outStr == NULL) {
+ fprintf ( stderr, "%s: Can't create output file %s: %s.\n",
+ progName, outName, strerror(errno) );
+ if ( inStr != NULL ) fclose ( inStr );
+ setExit(1);
+ return;
+ }
+ if ( inStr == NULL ) {
+ fprintf ( stderr, "%s: Can't open input file %s: %s.\n",
+ progName, inName, strerror(errno) );
+ if ( outStr != NULL ) fclose ( outStr );
+ setExit(1);
+ return;
+ };
+ break;
+
+ default:
+ panic ( "uncompress: bad srcMode" );
+ break;
+ }
+
+ if (verbosity >= 1) {
+ fprintf ( stderr, " %s: ", inName );
+ pad ( inName );
+ fflush ( stderr );
+ }
+
+ /*--- Now the input and output handles are sane. Do the Biz. ---*/
+ outputHandleJustInCase = outStr;
+ deleteOutputOnInterrupt = True;
+ magicNumberOK = uncompressStream ( inStr, outStr );
+ outputHandleJustInCase = NULL;
+
+ /*--- If there was an I/O error, we won't get here. ---*/
+ if ( magicNumberOK ) {
+ if ( srcMode == SM_F2F ) {
+ applySavedTimeInfoToOutputFile ( outName );
+ deleteOutputOnInterrupt = False;
+ if ( !keepInputFiles ) {
+ IntNative retVal = remove ( inName );
+ ERROR_IF_NOT_ZERO ( retVal );
+ }
+ }
+ } else {
+ unzFailsExist = True;
+ deleteOutputOnInterrupt = False;
+ if ( srcMode == SM_F2F ) {
+ IntNative retVal = remove ( outName );
+ ERROR_IF_NOT_ZERO ( retVal );
+ }
+ }
+ deleteOutputOnInterrupt = False;
+
+ if ( magicNumberOK ) {
+ if (verbosity >= 1)
+ fprintf ( stderr, "done\n" );
+ } else {
+ setExit(2);
+ if (verbosity >= 1)
+ fprintf ( stderr, "not a bzip2 file.\n" ); else
+ fprintf ( stderr,
+ "%s: %s is not a bzip2 file.\n",
+ progName, inName );
+ }
+
+}
+
+
+/*---------------------------------------------*/
+static
+void testf ( Char *name )
+{
+ FILE *inStr;
+ Bool allOK;
+ struct MY_STAT statBuf;
+
+ deleteOutputOnInterrupt = False;
+
+ if (name == NULL && srcMode != SM_I2O)
+ panic ( "testf: bad modes\n" );
+
+ copyFileName ( outName, (Char*)"(none)" );
+ switch (srcMode) {
+ case SM_I2O: copyFileName ( inName, (Char*)"(stdin)" ); break;
+ case SM_F2F: copyFileName ( inName, name ); break;
+ case SM_F2O: copyFileName ( inName, name ); break;
+ }
+
+ if ( srcMode != SM_I2O && containsDubiousChars ( inName ) ) {
+ if (noisy)
+ fprintf ( stderr, "%s: There are no files matching `%s'.\n",
+ progName, inName );
+ setExit(1);
+ return;
+ }
+ if ( srcMode != SM_I2O && !fileExists ( inName ) ) {
+ fprintf ( stderr, "%s: Can't open input %s: %s.\n",
+ progName, inName, strerror(errno) );
+ setExit(1);
+ return;
+ }
+ if ( srcMode != SM_I2O ) {
+ MY_STAT(inName, &statBuf);
+ if ( MY_S_ISDIR(statBuf.st_mode) ) {
+ fprintf( stderr,
+ "%s: Input file %s is a directory.\n",
+ progName,inName);
+ setExit(1);
+ return;
+ }
+ }
+
+ switch ( srcMode ) {
+
+ case SM_I2O:
+ if ( isatty ( fileno ( stdin ) ) ) {
+ fprintf ( stderr,
+ "%s: I won't read compressed data from a terminal.\n",
+ progName );
+ fprintf ( stderr, "%s: For help, type: `%s --help'.\n",
+ progName, progName );
+ setExit(1);
+ return;
+ };
+ inStr = stdin;
+ break;
+
+ case SM_F2O: case SM_F2F:
+ inStr = fopen ( inName, "rb" );
+ if ( inStr == NULL ) {
+ fprintf ( stderr, "%s: Can't open input file %s:%s.\n",
+ progName, inName, strerror(errno) );
+ setExit(1);
+ return;
+ };
+ break;
+
+ default:
+ panic ( "testf: bad srcMode" );
+ break;
+ }
+
+ if (verbosity >= 1) {
+ fprintf ( stderr, " %s: ", inName );
+ pad ( inName );
+ fflush ( stderr );
+ }
+
+ /*--- Now the input handle is sane. Do the Biz. ---*/
+ outputHandleJustInCase = NULL;
+ allOK = testStream ( inStr );
+
+ if (allOK && verbosity >= 1) fprintf ( stderr, "ok\n" );
+ if (!allOK) testFailsExist = True;
+}
+
+
+/*---------------------------------------------*/
+static
+void license ( void )
+{
+ fprintf ( stderr,
+
+ "bzip2, a block-sorting file compressor. "
+ "Version %s.\n"
+ " \n"
+ " Copyright (C) 1996-2010 by Julian Seward.\n"
+ " \n"
+ " This program is free software; you can redistribute it and/or modify\n"
+ " it under the terms set out in the LICENSE file, which is included\n"
+ " in the bzip2-1.0.6 source distribution.\n"
+ " \n"
+ " This program is distributed in the hope that it will be useful,\n"
+ " but WITHOUT ANY WARRANTY; without even the implied warranty of\n"
+ " MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n"
+ " LICENSE file for more details.\n"
+ " \n",
+ BZ2_bzlibVersion()
+ );
+}
+
+
+/*---------------------------------------------*/
+static
+void usage ( Char *fullProgName )
+{
+ fprintf (
+ stderr,
+ "bzip2, a block-sorting file compressor. "
+ "Version %s.\n"
+ "\n usage: %s [flags and input files in any order]\n"
+ "\n"
+ " -h --help print this message\n"
+ " -d --decompress force decompression\n"
+ " -z --compress force compression\n"
+ " -k --keep keep (don't delete) input files\n"
+ " -f --force overwrite existing output files\n"
+ " -t --test test compressed file integrity\n"
+ " -c --stdout output to standard out\n"
+ " -q --quiet suppress noncritical error messages\n"
+ " -v --verbose be verbose (a 2nd -v gives more)\n"
+ " -L --license display software version & license\n"
+ " -V --version display software version & license\n"
+ " -s --small use less memory (at most 2500k)\n"
+ " -1 .. -9 set block size to 100k .. 900k\n"
+ " --fast alias for -1\n"
+ " --best alias for -9\n"
+ "\n"
+ " If invoked as `bzip2', default action is to compress.\n"
+ " as `bunzip2', default action is to decompress.\n"
+ " as `bzcat', default action is to decompress to stdout.\n"
+ "\n"
+ " If no file names are given, bzip2 compresses or decompresses\n"
+ " from standard input to standard output. You can combine\n"
+ " short flags, so `-v -4' means the same as -v4 or -4v, &c.\n"
+# if BZ_UNIX
+ "\n"
+# endif
+ ,
+
+ BZ2_bzlibVersion(),
+ fullProgName
+ );
+}
+
+
+/*---------------------------------------------*/
+static
+void redundant ( Char* flag )
+{
+ fprintf (
+ stderr,
+ "%s: %s is redundant in versions 0.9.5 and above\n",
+ progName, flag );
+}
+
+
+/*---------------------------------------------*/
+/*--
+ All the garbage from here to main() is purely to
+ implement a linked list of command-line arguments,
+ into which main() copies argv[1 .. argc-1].
+
+ The purpose of this exercise is to facilitate
+ the expansion of wildcard characters * and ? in
+ filenames for OSs which don't know how to do it
+ themselves, like MSDOS, Windows 95 and NT.
+
+ The actual Dirty Work is done by the platform-
+ specific macro APPEND_FILESPEC.
+--*/
+
+typedef
+ struct zzzz {
+ Char *name;
+ struct zzzz *link;
+ }
+ Cell;
+
+
+/*---------------------------------------------*/
+static
+void *myMalloc ( Int32 n )
+{
+ void* p;
+
+ p = malloc ( (size_t)n );
+ if (p == NULL) outOfMemory ();
+ return p;
+}
+
+
+/*---------------------------------------------*/
+static
+Cell *mkCell ( void )
+{
+ Cell *c;
+
+ c = (Cell*) myMalloc ( sizeof ( Cell ) );
+ c->name = NULL;
+ c->link = NULL;
+ return c;
+}
+
+
+/*---------------------------------------------*/
+static
+Cell *snocString ( Cell *root, Char *name )
+{
+ if (root == NULL) {
+ Cell *tmp = mkCell();
+ tmp->name = (Char*) myMalloc ( 5 + strlen(name) );
+ strcpy ( tmp->name, name );
+ return tmp;
+ } else {
+ Cell *tmp = root;
+ while (tmp->link != NULL) tmp = tmp->link;
+ tmp->link = snocString ( tmp->link, name );
+ return root;
+ }
+}
+
+
+/*---------------------------------------------*/
+static
+void addFlagsFromEnvVar ( Cell** argList, Char* varName )
+{
+ Int32 i, j, k;
+ Char *envbase, *p;
+
+ envbase = getenv(varName);
+ if (envbase != NULL) {
+ p = envbase;
+ i = 0;
+ while (True) {
+ if (p[i] == 0) break;
+ p += i;
+ i = 0;
+ while (isspace((Int32)(p[0]))) p++;
+ while (p[i] != 0 && !isspace((Int32)(p[i]))) i++;
+ if (i > 0) {
+ k = i; if (k > FILE_NAME_LEN-10) k = FILE_NAME_LEN-10;
+ for (j = 0; j < k; j++) tmpName[j] = p[j];
+ tmpName[k] = 0;
+ APPEND_FLAG(*argList, tmpName);
+ }
+ }
+ }
+}
+
+
+/*---------------------------------------------*/
+#define ISFLAG(s) (strcmp(aa->name, (s))==0)
+
+IntNative main ( IntNative argc, Char *argv[] )
+{
+ Int32 i, j;
+ Char *tmp;
+ Cell *argList;
+ Cell *aa;
+ Bool decode;
+
+ /*-- Be really really really paranoid :-) --*/
+ if (sizeof(Int32) != 4 || sizeof(UInt32) != 4 ||
+ sizeof(Int16) != 2 || sizeof(UInt16) != 2 ||
+ sizeof(Char) != 1 || sizeof(UChar) != 1)
+ configError();
+
+ /*-- Initialise --*/
+ outputHandleJustInCase = NULL;
+ smallMode = False;
+ keepInputFiles = False;
+ forceOverwrite = False;
+ noisy = True;
+ verbosity = 0;
+ blockSize100k = 9;
+ testFailsExist = False;
+ unzFailsExist = False;
+ numFileNames = 0;
+ numFilesProcessed = 0;
+ workFactor = 30;
+ deleteOutputOnInterrupt = False;
+ exitValue = 0;
+ i = j = 0; /* avoid bogus warning from egcs-1.1.X */
+
+ /*-- Set up signal handlers for mem access errors --*/
+ signal (SIGSEGV, mySIGSEGVorSIGBUScatcher);
+# if BZ_UNIX
+# ifndef __DJGPP__
+ signal (SIGBUS, mySIGSEGVorSIGBUScatcher);
+# endif
+# endif
+
+ copyFileName ( inName, (Char*)"(none)" );
+ copyFileName ( outName, (Char*)"(none)" );
+
+ copyFileName ( progNameReally, argv[0] );
+ progName = &progNameReally[0];
+ for (tmp = &progNameReally[0]; *tmp != '\0'; tmp++)
+ if (*tmp == PATH_SEP) progName = tmp + 1;
+
+
+ /*-- Copy flags from env var BZIP2, and
+ expand filename wildcards in arg list.
+ --*/
+ argList = NULL;
+ addFlagsFromEnvVar ( &argList, (Char*)"BZIP2" );
+ addFlagsFromEnvVar ( &argList, (Char*)"BZIP" );
+ for (i = 1; i <= argc-1; i++)
+ APPEND_FILESPEC(argList, argv[i]);
+
+
+ /*-- Find the length of the longest filename --*/
+ longestFileName = 7;
+ numFileNames = 0;
+ decode = True;
+ for (aa = argList; aa != NULL; aa = aa->link) {
+ if (ISFLAG("--")) { decode = False; continue; }
+ if (aa->name[0] == '-' && decode) continue;
+ numFileNames++;
+ if (longestFileName < (Int32)strlen(aa->name) )
+ longestFileName = (Int32)strlen(aa->name);
+ }
+
+
+ /*-- Determine source modes; flag handling may change this too. --*/
+ if (numFileNames == 0)
+ srcMode = SM_I2O; else srcMode = SM_F2F;
+
+
+ /*-- Determine what to do (compress/uncompress/test/cat). --*/
+ /*-- Note that subsequent flag handling may change this. --*/
+ opMode = OM_Z;
+
+ if ( (strstr ( progName, "unzip" ) != 0) ||
+ (strstr ( progName, "UNZIP" ) != 0) )
+ opMode = OM_UNZ;
+
+ if ( (strstr ( progName, "z2cat" ) != 0) ||
+ (strstr ( progName, "Z2CAT" ) != 0) ||
+ (strstr ( progName, "zcat" ) != 0) ||
+ (strstr ( progName, "ZCAT" ) != 0) ) {
+ opMode = OM_UNZ;
+ srcMode = (numFileNames == 0) ? SM_I2O : SM_F2O;
+ }
+
+
+ /*-- Look at the flags. --*/
+ for (aa = argList; aa != NULL; aa = aa->link) {
+ if (ISFLAG("--")) break;
+ if (aa->name[0] == '-' && aa->name[1] != '-') {
+ for (j = 1; aa->name[j] != '\0'; j++) {
+ switch (aa->name[j]) {
+ case 'c': srcMode = SM_F2O; break;
+ case 'd': opMode = OM_UNZ; break;
+ case 'z': opMode = OM_Z; break;
+ case 'f': forceOverwrite = True; break;
+ case 't': opMode = OM_TEST; break;
+ case 'k': keepInputFiles = True; break;
+ case 's': smallMode = True; break;
+ case 'q': noisy = False; break;
+ case '1': blockSize100k = 1; break;
+ case '2': blockSize100k = 2; break;
+ case '3': blockSize100k = 3; break;
+ case '4': blockSize100k = 4; break;
+ case '5': blockSize100k = 5; break;
+ case '6': blockSize100k = 6; break;
+ case '7': blockSize100k = 7; break;
+ case '8': blockSize100k = 8; break;
+ case '9': blockSize100k = 9; break;
+ case 'V':
+ case 'L': license(); break;
+ case 'v': verbosity++; break;
+ case 'h': usage ( progName );
+ exit ( 0 );
+ break;
+ default: fprintf ( stderr, "%s: Bad flag `%s'\n",
+ progName, aa->name );
+ usage ( progName );
+ exit ( 1 );
+ break;
+ }
+ }
+ }
+ }
+
+ /*-- And again ... --*/
+ for (aa = argList; aa != NULL; aa = aa->link) {
+ if (ISFLAG("--")) break;
+ if (ISFLAG("--stdout")) srcMode = SM_F2O; else
+ if (ISFLAG("--decompress")) opMode = OM_UNZ; else
+ if (ISFLAG("--compress")) opMode = OM_Z; else
+ if (ISFLAG("--force")) forceOverwrite = True; else
+ if (ISFLAG("--test")) opMode = OM_TEST; else
+ if (ISFLAG("--keep")) keepInputFiles = True; else
+ if (ISFLAG("--small")) smallMode = True; else
+ if (ISFLAG("--quiet")) noisy = False; else
+ if (ISFLAG("--version")) license(); else
+ if (ISFLAG("--license")) license(); else
+ if (ISFLAG("--exponential")) workFactor = 1; else
+ if (ISFLAG("--repetitive-best")) redundant(aa->name); else
+ if (ISFLAG("--repetitive-fast")) redundant(aa->name); else
+ if (ISFLAG("--fast")) blockSize100k = 1; else
+ if (ISFLAG("--best")) blockSize100k = 9; else
+ if (ISFLAG("--verbose")) verbosity++; else
+ if (ISFLAG("--help")) { usage ( progName ); exit ( 0 ); }
+ else
+ if (strncmp ( aa->name, "--", 2) == 0) {
+ fprintf ( stderr, "%s: Bad flag `%s'\n", progName, aa->name );
+ usage ( progName );
+ exit ( 1 );
+ }
+ }
+
+ if (verbosity > 4) verbosity = 4;
+ if (opMode == OM_Z && smallMode && blockSize100k > 2)
+ blockSize100k = 2;
+
+ if (opMode == OM_TEST && srcMode == SM_F2O) {
+ fprintf ( stderr, "%s: -c and -t cannot be used together.\n",
+ progName );
+ exit ( 1 );
+ }
+
+ if (srcMode == SM_F2O && numFileNames == 0)
+ srcMode = SM_I2O;
+
+ if (opMode != OM_Z) blockSize100k = 0;
+
+ if (srcMode == SM_F2F) {
+ signal (SIGINT, mySignalCatcher);
+ signal (SIGTERM, mySignalCatcher);
+# if BZ_UNIX
+ signal (SIGHUP, mySignalCatcher);
+# endif
+ }
+
+ if (opMode == OM_Z) {
+ if (srcMode == SM_I2O) {
+ compress ( NULL );
+ } else {
+ decode = True;
+ for (aa = argList; aa != NULL; aa = aa->link) {
+ if (ISFLAG("--")) { decode = False; continue; }
+ if (aa->name[0] == '-' && decode) continue;
+ numFilesProcessed++;
+ compress ( aa->name );
+ }
+ }
+ }
+ else
+
+ if (opMode == OM_UNZ) {
+ unzFailsExist = False;
+ if (srcMode == SM_I2O) {
+ uncompress ( NULL );
+ } else {
+ decode = True;
+ for (aa = argList; aa != NULL; aa = aa->link) {
+ if (ISFLAG("--")) { decode = False; continue; }
+ if (aa->name[0] == '-' && decode) continue;
+ numFilesProcessed++;
+ uncompress ( aa->name );
+ }
+ }
+ if (unzFailsExist) {
+ setExit(2);
+ exit(exitValue);
+ }
+ }
+
+ else {
+ testFailsExist = False;
+ if (srcMode == SM_I2O) {
+ testf ( NULL );
+ } else {
+ decode = True;
+ for (aa = argList; aa != NULL; aa = aa->link) {
+ if (ISFLAG("--")) { decode = False; continue; }
+ if (aa->name[0] == '-' && decode) continue;
+ numFilesProcessed++;
+ testf ( aa->name );
+ }
+ }
+ if (testFailsExist && noisy) {
+ fprintf ( stderr,
+ "\n"
+ "You can use the `bzip2recover' program to attempt to recover\n"
+ "data from undamaged sections of corrupted files.\n\n"
+ );
+ setExit(2);
+ exit(exitValue);
+ }
+ }
+
+ /* Free the argument list memory to mollify leak detectors
+ (eg) Purify, Checker. Serves no other useful purpose.
+ */
+ aa = argList;
+ while (aa != NULL) {
+ Cell* aa2 = aa->link;
+ if (aa->name != NULL) free(aa->name);
+ free(aa);
+ aa = aa2;
+ }
+
+ return exitValue;
+}
+
+
+/*-----------------------------------------------------------*/
+/*--- end bzip2.c ---*/
+/*-----------------------------------------------------------*/
diff --git a/dep/bzip2/bzip2recover.c b/dep/bzip2/bzip2recover.c
new file mode 100644
index 00000000000..f9de0496abf
--- /dev/null
+++ b/dep/bzip2/bzip2recover.c
@@ -0,0 +1,514 @@
+/*-----------------------------------------------------------*/
+/*--- Block recoverer program for bzip2 ---*/
+/*--- bzip2recover.c ---*/
+/*-----------------------------------------------------------*/
+
+/* ------------------------------------------------------------------
+ This file is part of bzip2/libbzip2, a program and library for
+ lossless, block-sorting data compression.
+
+ bzip2/libbzip2 version 1.0.6 of 6 September 2010
+ Copyright (C) 1996-2010 Julian Seward <jseward@bzip.org>
+
+ Please read the WARNING, DISCLAIMER and PATENTS sections in the
+ README file.
+
+ This program is released under the terms of the license contained
+ in the file LICENSE.
+ ------------------------------------------------------------------ */
+
+/* This program is a complete hack and should be rewritten properly.
+ It isn't very complicated. */
+
+#include <stdio.h>
+#include <errno.h>
+#include <stdlib.h>
+#include <string.h>
+
+
+/* This program records bit locations in the file to be recovered.
+ That means that if 64-bit ints are not supported, we will not
+ be able to recover .bz2 files over 512MB (2^32 bits) long.
+ On GNU supported platforms, we take advantage of the 64-bit
+ int support to circumvent this problem. Ditto MSVC.
+
+ This change occurred in version 1.0.2; all prior versions have
+ the 512MB limitation.
+*/
+#ifdef __GNUC__
+ typedef unsigned long long int MaybeUInt64;
+# define MaybeUInt64_FMT "%Lu"
+#else
+#ifdef _MSC_VER
+ typedef unsigned __int64 MaybeUInt64;
+# define MaybeUInt64_FMT "%I64u"
+#else
+ typedef unsigned int MaybeUInt64;
+# define MaybeUInt64_FMT "%u"
+#endif
+#endif
+
+typedef unsigned int UInt32;
+typedef int Int32;
+typedef unsigned char UChar;
+typedef char Char;
+typedef unsigned char Bool;
+#define True ((Bool)1)
+#define False ((Bool)0)
+
+
+#define BZ_MAX_FILENAME 2000
+
+Char inFileName[BZ_MAX_FILENAME];
+Char outFileName[BZ_MAX_FILENAME];
+Char progName[BZ_MAX_FILENAME];
+
+MaybeUInt64 bytesOut = 0;
+MaybeUInt64 bytesIn = 0;
+
+
+/*---------------------------------------------------*/
+/*--- Header bytes ---*/
+/*---------------------------------------------------*/
+
+#define BZ_HDR_B 0x42 /* 'B' */
+#define BZ_HDR_Z 0x5a /* 'Z' */
+#define BZ_HDR_h 0x68 /* 'h' */
+#define BZ_HDR_0 0x30 /* '0' */
+
+
+/*---------------------------------------------------*/
+/*--- I/O errors ---*/
+/*---------------------------------------------------*/
+
+/*---------------------------------------------*/
+static void readError ( void )
+{
+ fprintf ( stderr,
+ "%s: I/O error reading `%s', possible reason follows.\n",
+ progName, inFileName );
+ perror ( progName );
+ fprintf ( stderr, "%s: warning: output file(s) may be incomplete.\n",
+ progName );
+ exit ( 1 );
+}
+
+
+/*---------------------------------------------*/
+static void writeError ( void )
+{
+ fprintf ( stderr,
+ "%s: I/O error reading `%s', possible reason follows.\n",
+ progName, inFileName );
+ perror ( progName );
+ fprintf ( stderr, "%s: warning: output file(s) may be incomplete.\n",
+ progName );
+ exit ( 1 );
+}
+
+
+/*---------------------------------------------*/
+static void mallocFail ( Int32 n )
+{
+ fprintf ( stderr,
+ "%s: malloc failed on request for %d bytes.\n",
+ progName, n );
+ fprintf ( stderr, "%s: warning: output file(s) may be incomplete.\n",
+ progName );
+ exit ( 1 );
+}
+
+
+/*---------------------------------------------*/
+static void tooManyBlocks ( Int32 max_handled_blocks )
+{
+ fprintf ( stderr,
+ "%s: `%s' appears to contain more than %d blocks\n",
+ progName, inFileName, max_handled_blocks );
+ fprintf ( stderr,
+ "%s: and cannot be handled. To fix, increase\n",
+ progName );
+ fprintf ( stderr,
+ "%s: BZ_MAX_HANDLED_BLOCKS in bzip2recover.c, and recompile.\n",
+ progName );
+ exit ( 1 );
+}
+
+
+
+/*---------------------------------------------------*/
+/*--- Bit stream I/O ---*/
+/*---------------------------------------------------*/
+
+typedef
+ struct {
+ FILE* handle;
+ Int32 buffer;
+ Int32 buffLive;
+ Char mode;
+ }
+ BitStream;
+
+
+/*---------------------------------------------*/
+static BitStream* bsOpenReadStream ( FILE* stream )
+{
+ BitStream *bs = malloc ( sizeof(BitStream) );
+ if (bs == NULL) mallocFail ( sizeof(BitStream) );
+ bs->handle = stream;
+ bs->buffer = 0;
+ bs->buffLive = 0;
+ bs->mode = 'r';
+ return bs;
+}
+
+
+/*---------------------------------------------*/
+static BitStream* bsOpenWriteStream ( FILE* stream )
+{
+ BitStream *bs = malloc ( sizeof(BitStream) );
+ if (bs == NULL) mallocFail ( sizeof(BitStream) );
+ bs->handle = stream;
+ bs->buffer = 0;
+ bs->buffLive = 0;
+ bs->mode = 'w';
+ return bs;
+}
+
+
+/*---------------------------------------------*/
+static void bsPutBit ( BitStream* bs, Int32 bit )
+{
+ if (bs->buffLive == 8) {
+ Int32 retVal = putc ( (UChar) bs->buffer, bs->handle );
+ if (retVal == EOF) writeError();
+ bytesOut++;
+ bs->buffLive = 1;
+ bs->buffer = bit & 0x1;
+ } else {
+ bs->buffer = ( (bs->buffer << 1) | (bit & 0x1) );
+ bs->buffLive++;
+ };
+}
+
+
+/*---------------------------------------------*/
+/*--
+ Returns 0 or 1, or 2 to indicate EOF.
+--*/
+static Int32 bsGetBit ( BitStream* bs )
+{
+ if (bs->buffLive > 0) {
+ bs->buffLive --;
+ return ( ((bs->buffer) >> (bs->buffLive)) & 0x1 );
+ } else {
+ Int32 retVal = getc ( bs->handle );
+ if ( retVal == EOF ) {
+ if (errno != 0) readError();
+ return 2;
+ }
+ bs->buffLive = 7;
+ bs->buffer = retVal;
+ return ( ((bs->buffer) >> 7) & 0x1 );
+ }
+}
+
+
+/*---------------------------------------------*/
+static void bsClose ( BitStream* bs )
+{
+ Int32 retVal;
+
+ if ( bs->mode == 'w' ) {
+ while ( bs->buffLive < 8 ) {
+ bs->buffLive++;
+ bs->buffer <<= 1;
+ };
+ retVal = putc ( (UChar) (bs->buffer), bs->handle );
+ if (retVal == EOF) writeError();
+ bytesOut++;
+ retVal = fflush ( bs->handle );
+ if (retVal == EOF) writeError();
+ }
+ retVal = fclose ( bs->handle );
+ if (retVal == EOF) {
+ if (bs->mode == 'w') writeError(); else readError();
+ }
+ free ( bs );
+}
+
+
+/*---------------------------------------------*/
+static void bsPutUChar ( BitStream* bs, UChar c )
+{
+ Int32 i;
+ for (i = 7; i >= 0; i--)
+ bsPutBit ( bs, (((UInt32) c) >> i) & 0x1 );
+}
+
+
+/*---------------------------------------------*/
+static void bsPutUInt32 ( BitStream* bs, UInt32 c )
+{
+ Int32 i;
+
+ for (i = 31; i >= 0; i--)
+ bsPutBit ( bs, (c >> i) & 0x1 );
+}
+
+
+/*---------------------------------------------*/
+static Bool endsInBz2 ( Char* name )
+{
+ Int32 n = strlen ( name );
+ if (n <= 4) return False;
+ return
+ (name[n-4] == '.' &&
+ name[n-3] == 'b' &&
+ name[n-2] == 'z' &&
+ name[n-1] == '2');
+}
+
+
+/*---------------------------------------------------*/
+/*--- ---*/
+/*---------------------------------------------------*/
+
+/* This logic isn't really right when it comes to Cygwin. */
+#ifdef _WIN32
+# define BZ_SPLIT_SYM '\\' /* path splitter on Windows platform */
+#else
+# define BZ_SPLIT_SYM '/' /* path splitter on Unix platform */
+#endif
+
+#define BLOCK_HEADER_HI 0x00003141UL
+#define BLOCK_HEADER_LO 0x59265359UL
+
+#define BLOCK_ENDMARK_HI 0x00001772UL
+#define BLOCK_ENDMARK_LO 0x45385090UL
+
+/* Increase if necessary. However, a .bz2 file with > 50000 blocks
+ would have an uncompressed size of at least 40GB, so the chances
+ are low you'll need to up this.
+*/
+#define BZ_MAX_HANDLED_BLOCKS 50000
+
+MaybeUInt64 bStart [BZ_MAX_HANDLED_BLOCKS];
+MaybeUInt64 bEnd [BZ_MAX_HANDLED_BLOCKS];
+MaybeUInt64 rbStart[BZ_MAX_HANDLED_BLOCKS];
+MaybeUInt64 rbEnd [BZ_MAX_HANDLED_BLOCKS];
+
+Int32 main ( Int32 argc, Char** argv )
+{
+ FILE* inFile;
+ FILE* outFile;
+ BitStream* bsIn, *bsWr;
+ Int32 b, wrBlock, currBlock, rbCtr;
+ MaybeUInt64 bitsRead;
+
+ UInt32 buffHi, buffLo, blockCRC;
+ Char* p;
+
+ strcpy ( progName, argv[0] );
+ inFileName[0] = outFileName[0] = 0;
+
+ fprintf ( stderr,
+ "bzip2recover 1.0.6: extracts blocks from damaged .bz2 files.\n" );
+
+ if (argc != 2) {
+ fprintf ( stderr, "%s: usage is `%s damaged_file_name'.\n",
+ progName, progName );
+ switch (sizeof(MaybeUInt64)) {
+ case 8:
+ fprintf(stderr,
+ "\trestrictions on size of recovered file: None\n");
+ break;
+ case 4:
+ fprintf(stderr,
+ "\trestrictions on size of recovered file: 512 MB\n");
+ fprintf(stderr,
+ "\tto circumvent, recompile with MaybeUInt64 as an\n"
+ "\tunsigned 64-bit int.\n");
+ break;
+ default:
+ fprintf(stderr,
+ "\tsizeof(MaybeUInt64) is not 4 or 8 -- "
+ "configuration error.\n");
+ break;
+ }
+ exit(1);
+ }
+
+ if (strlen(argv[1]) >= BZ_MAX_FILENAME-20) {
+ fprintf ( stderr,
+ "%s: supplied filename is suspiciously (>= %d chars) long. Bye!\n",
+ progName, (int)strlen(argv[1]) );
+ exit(1);
+ }
+
+ strcpy ( inFileName, argv[1] );
+
+ inFile = fopen ( inFileName, "rb" );
+ if (inFile == NULL) {
+ fprintf ( stderr, "%s: can't read `%s'\n", progName, inFileName );
+ exit(1);
+ }
+
+ bsIn = bsOpenReadStream ( inFile );
+ fprintf ( stderr, "%s: searching for block boundaries ...\n", progName );
+
+ bitsRead = 0;
+ buffHi = buffLo = 0;
+ currBlock = 0;
+ bStart[currBlock] = 0;
+
+ rbCtr = 0;
+
+ while (True) {
+ b = bsGetBit ( bsIn );
+ bitsRead++;
+ if (b == 2) {
+ if (bitsRead >= bStart[currBlock] &&
+ (bitsRead - bStart[currBlock]) >= 40) {
+ bEnd[currBlock] = bitsRead-1;
+ if (currBlock > 0)
+ fprintf ( stderr, " block %d runs from " MaybeUInt64_FMT
+ " to " MaybeUInt64_FMT " (incomplete)\n",
+ currBlock, bStart[currBlock], bEnd[currBlock] );
+ } else
+ currBlock--;
+ break;
+ }
+ buffHi = (buffHi << 1) | (buffLo >> 31);
+ buffLo = (buffLo << 1) | (b & 1);
+ if ( ( (buffHi & 0x0000ffff) == BLOCK_HEADER_HI
+ && buffLo == BLOCK_HEADER_LO)
+ ||
+ ( (buffHi & 0x0000ffff) == BLOCK_ENDMARK_HI
+ && buffLo == BLOCK_ENDMARK_LO)
+ ) {
+ if (bitsRead > 49) {
+ bEnd[currBlock] = bitsRead-49;
+ } else {
+ bEnd[currBlock] = 0;
+ }
+ if (currBlock > 0 &&
+ (bEnd[currBlock] - bStart[currBlock]) >= 130) {
+ fprintf ( stderr, " block %d runs from " MaybeUInt64_FMT
+ " to " MaybeUInt64_FMT "\n",
+ rbCtr+1, bStart[currBlock], bEnd[currBlock] );
+ rbStart[rbCtr] = bStart[currBlock];
+ rbEnd[rbCtr] = bEnd[currBlock];
+ rbCtr++;
+ }
+ if (currBlock >= BZ_MAX_HANDLED_BLOCKS)
+ tooManyBlocks(BZ_MAX_HANDLED_BLOCKS);
+ currBlock++;
+
+ bStart[currBlock] = bitsRead;
+ }
+ }
+
+ bsClose ( bsIn );
+
+ /*-- identified blocks run from 1 to rbCtr inclusive. --*/
+
+ if (rbCtr < 1) {
+ fprintf ( stderr,
+ "%s: sorry, I couldn't find any block boundaries.\n",
+ progName );
+ exit(1);
+ };
+
+ fprintf ( stderr, "%s: splitting into blocks\n", progName );
+
+ inFile = fopen ( inFileName, "rb" );
+ if (inFile == NULL) {
+ fprintf ( stderr, "%s: can't open `%s'\n", progName, inFileName );
+ exit(1);
+ }
+ bsIn = bsOpenReadStream ( inFile );
+
+ /*-- placate gcc's dataflow analyser --*/
+ blockCRC = 0; bsWr = 0;
+
+ bitsRead = 0;
+ outFile = NULL;
+ wrBlock = 0;
+ while (True) {
+ b = bsGetBit(bsIn);
+ if (b == 2) break;
+ buffHi = (buffHi << 1) | (buffLo >> 31);
+ buffLo = (buffLo << 1) | (b & 1);
+ if (bitsRead == 47+rbStart[wrBlock])
+ blockCRC = (buffHi << 16) | (buffLo >> 16);
+
+ if (outFile != NULL && bitsRead >= rbStart[wrBlock]
+ && bitsRead <= rbEnd[wrBlock]) {
+ bsPutBit ( bsWr, b );
+ }
+
+ bitsRead++;
+
+ if (bitsRead == rbEnd[wrBlock]+1) {
+ if (outFile != NULL) {
+ bsPutUChar ( bsWr, 0x17 ); bsPutUChar ( bsWr, 0x72 );
+ bsPutUChar ( bsWr, 0x45 ); bsPutUChar ( bsWr, 0x38 );
+ bsPutUChar ( bsWr, 0x50 ); bsPutUChar ( bsWr, 0x90 );
+ bsPutUInt32 ( bsWr, blockCRC );
+ bsClose ( bsWr );
+ }
+ if (wrBlock >= rbCtr) break;
+ wrBlock++;
+ } else
+ if (bitsRead == rbStart[wrBlock]) {
+ /* Create the output file name, correctly handling leading paths.
+ (31.10.2001 by Sergey E. Kusikov) */
+ Char* split;
+ Int32 ofs, k;
+ for (k = 0; k < BZ_MAX_FILENAME; k++)
+ outFileName[k] = 0;
+ strcpy (outFileName, inFileName);
+ split = strrchr (outFileName, BZ_SPLIT_SYM);
+ if (split == NULL) {
+ split = outFileName;
+ } else {
+ ++split;
+ }
+ /* Now split points to the start of the basename. */
+ ofs = split - outFileName;
+ sprintf (split, "rec%5d", wrBlock+1);
+ for (p = split; *p != 0; p++) if (*p == ' ') *p = '0';
+ strcat (outFileName, inFileName + ofs);
+
+ if ( !endsInBz2(outFileName)) strcat ( outFileName, ".bz2" );
+
+ fprintf ( stderr, " writing block %d to `%s' ...\n",
+ wrBlock+1, outFileName );
+
+ outFile = fopen ( outFileName, "wb" );
+ if (outFile == NULL) {
+ fprintf ( stderr, "%s: can't write `%s'\n",
+ progName, outFileName );
+ exit(1);
+ }
+ bsWr = bsOpenWriteStream ( outFile );
+ bsPutUChar ( bsWr, BZ_HDR_B );
+ bsPutUChar ( bsWr, BZ_HDR_Z );
+ bsPutUChar ( bsWr, BZ_HDR_h );
+ bsPutUChar ( bsWr, BZ_HDR_0 + 9 );
+ bsPutUChar ( bsWr, 0x31 ); bsPutUChar ( bsWr, 0x41 );
+ bsPutUChar ( bsWr, 0x59 ); bsPutUChar ( bsWr, 0x26 );
+ bsPutUChar ( bsWr, 0x53 ); bsPutUChar ( bsWr, 0x59 );
+ }
+ }
+
+ fprintf ( stderr, "%s: finished\n", progName );
+ return 0;
+}
+
+
+
+/*-----------------------------------------------------------*/
+/*--- end bzip2recover.c ---*/
+/*-----------------------------------------------------------*/
diff --git a/dep/bzip2/bzlib.c b/dep/bzip2/bzlib.c
index ef86c91e695..bd358a793b8 100644
--- a/dep/bzip2/bzlib.c
+++ b/dep/bzip2/bzlib.c
@@ -8,8 +8,8 @@
This file is part of bzip2/libbzip2, a program and library for
lossless, block-sorting data compression.
- bzip2/libbzip2 version 1.0.5 of 10 December 2007
- Copyright (C) 1996-2007 Julian Seward <jseward@bzip.org>
+ bzip2/libbzip2 version 1.0.6 of 6 September 2010
+ Copyright (C) 1996-2010 Julian Seward <jseward@bzip.org>
Please read the WARNING, DISCLAIMER and PATENTS sections in the
README file.
diff --git a/dep/bzip2/bzlib.h b/dep/bzip2/bzlib.h
index c5b75d6d8ff..8277123da8c 100644
--- a/dep/bzip2/bzlib.h
+++ b/dep/bzip2/bzlib.h
@@ -8,8 +8,8 @@
This file is part of bzip2/libbzip2, a program and library for
lossless, block-sorting data compression.
- bzip2/libbzip2 version 1.0.5 of 10 December 2007
- Copyright (C) 1996-2007 Julian Seward <jseward@bzip.org>
+ bzip2/libbzip2 version 1.0.6 of 6 September 2010
+ Copyright (C) 1996-2010 Julian Seward <jseward@bzip.org>
Please read the WARNING, DISCLAIMER and PATENTS sections in the
README file.
diff --git a/dep/bzip2/bzlib_private.h b/dep/bzip2/bzlib_private.h
index 23427879b18..5d0217f4635 100644
--- a/dep/bzip2/bzlib_private.h
+++ b/dep/bzip2/bzlib_private.h
@@ -8,8 +8,8 @@
This file is part of bzip2/libbzip2, a program and library for
lossless, block-sorting data compression.
- bzip2/libbzip2 version 1.0.5 of 10 December 2007
- Copyright (C) 1996-2007 Julian Seward <jseward@bzip.org>
+ bzip2/libbzip2 version 1.0.6 of 6 September 2010
+ Copyright (C) 1996-2010 Julian Seward <jseward@bzip.org>
Please read the WARNING, DISCLAIMER and PATENTS sections in the
README file.
@@ -36,7 +36,7 @@
/*-- General stuff. --*/
-#define BZ_VERSION "1.0.5, 10-Dec-2007"
+#define BZ_VERSION "1.0.6, 6-Sept-2010"
typedef char Char;
typedef unsigned char Bool;
diff --git a/dep/bzip2/compress.c b/dep/bzip2/compress.c
index 8c80a079700..caf7696011b 100644
--- a/dep/bzip2/compress.c
+++ b/dep/bzip2/compress.c
@@ -8,8 +8,8 @@
This file is part of bzip2/libbzip2, a program and library for
lossless, block-sorting data compression.
- bzip2/libbzip2 version 1.0.5 of 10 December 2007
- Copyright (C) 1996-2007 Julian Seward <jseward@bzip.org>
+ bzip2/libbzip2 version 1.0.6 of 6 September 2010
+ Copyright (C) 1996-2010 Julian Seward <jseward@bzip.org>
Please read the WARNING, DISCLAIMER and PATENTS sections in the
README file.
diff --git a/dep/bzip2/crctable.c b/dep/bzip2/crctable.c
index 215687b2c05..1fea7e946c5 100644
--- a/dep/bzip2/crctable.c
+++ b/dep/bzip2/crctable.c
@@ -8,8 +8,8 @@
This file is part of bzip2/libbzip2, a program and library for
lossless, block-sorting data compression.
- bzip2/libbzip2 version 1.0.5 of 10 December 2007
- Copyright (C) 1996-2007 Julian Seward <jseward@bzip.org>
+ bzip2/libbzip2 version 1.0.6 of 6 September 2010
+ Copyright (C) 1996-2010 Julian Seward <jseward@bzip.org>
Please read the WARNING, DISCLAIMER and PATENTS sections in the
README file.
diff --git a/dep/bzip2/decompress.c b/dep/bzip2/decompress.c
index bba5e0fa36d..311f5668f9a 100644
--- a/dep/bzip2/decompress.c
+++ b/dep/bzip2/decompress.c
@@ -8,8 +8,8 @@
This file is part of bzip2/libbzip2, a program and library for
lossless, block-sorting data compression.
- bzip2/libbzip2 version 1.0.5 of 10 December 2007
- Copyright (C) 1996-2007 Julian Seward <jseward@bzip.org>
+ bzip2/libbzip2 version 1.0.6 of 6 September 2010
+ Copyright (C) 1996-2010 Julian Seward <jseward@bzip.org>
Please read the WARNING, DISCLAIMER and PATENTS sections in the
README file.
@@ -381,6 +381,13 @@ Int32 BZ2_decompress ( DState* s )
es = -1;
N = 1;
do {
+ /* Check that N doesn't get too big, so that es doesn't
+ go negative. The maximum value that can be
+ RUNA/RUNB encoded is equal to the block size (post
+ the initial RLE), viz, 900k, so bounding N at 2
+ million should guard against overflow without
+ rejecting any legitimate inputs. */
+ if (N >= 2*1024*1024) RETURN(BZ_DATA_ERROR);
if (nextSym == BZ_RUNA) es = es + (0+1) * N; else
if (nextSym == BZ_RUNB) es = es + (1+1) * N;
N = N * 2;
@@ -485,15 +492,28 @@ Int32 BZ2_decompress ( DState* s )
RETURN(BZ_DATA_ERROR);
/*-- Set up cftab to facilitate generation of T^(-1) --*/
+ /* Check: unzftab entries in range. */
+ for (i = 0; i <= 255; i++) {
+ if (s->unzftab[i] < 0 || s->unzftab[i] > nblock)
+ RETURN(BZ_DATA_ERROR);
+ }
+ /* Actually generate cftab. */
s->cftab[0] = 0;
for (i = 1; i <= 256; i++) s->cftab[i] = s->unzftab[i-1];
for (i = 1; i <= 256; i++) s->cftab[i] += s->cftab[i-1];
+ /* Check: cftab entries in range. */
for (i = 0; i <= 256; i++) {
if (s->cftab[i] < 0 || s->cftab[i] > nblock) {
/* s->cftab[i] can legitimately be == nblock */
RETURN(BZ_DATA_ERROR);
}
}
+ /* Check: cftab entries non-descending. */
+ for (i = 1; i <= 256; i++) {
+ if (s->cftab[i-1] > s->cftab[i]) {
+ RETURN(BZ_DATA_ERROR);
+ }
+ }
s->state_out_len = 0;
s->state_out_ch = 0;
diff --git a/dep/bzip2/huffman.c b/dep/bzip2/huffman.c
index 87e79e38af0..2283fdbc5a1 100644
--- a/dep/bzip2/huffman.c
+++ b/dep/bzip2/huffman.c
@@ -8,8 +8,8 @@
This file is part of bzip2/libbzip2, a program and library for
lossless, block-sorting data compression.
- bzip2/libbzip2 version 1.0.5 of 10 December 2007
- Copyright (C) 1996-2007 Julian Seward <jseward@bzip.org>
+ bzip2/libbzip2 version 1.0.6 of 6 September 2010
+ Copyright (C) 1996-2010 Julian Seward <jseward@bzip.org>
Please read the WARNING, DISCLAIMER and PATENTS sections in the
README file.
diff --git a/dep/bzip2/randtable.c b/dep/bzip2/randtable.c
index 068b76367bc..6d624599061 100644
--- a/dep/bzip2/randtable.c
+++ b/dep/bzip2/randtable.c
@@ -8,8 +8,8 @@
This file is part of bzip2/libbzip2, a program and library for
lossless, block-sorting data compression.
- bzip2/libbzip2 version 1.0.5 of 10 December 2007
- Copyright (C) 1996-2007 Julian Seward <jseward@bzip.org>
+ bzip2/libbzip2 version 1.0.6 of 6 September 2010
+ Copyright (C) 1996-2010 Julian Seward <jseward@bzip.org>
Please read the WARNING, DISCLAIMER and PATENTS sections in the
README file.
diff --git a/dep/g3dlite/G3D-v8.0_extra.diff b/dep/g3dlite/G3D-v8.0_extra.diff
new file mode 100644
index 00000000000..d556103c96d
--- /dev/null
+++ b/dep/g3dlite/G3D-v8.0_extra.diff
@@ -0,0 +1,12 @@
+diff --git a/dep/g3dlite/include/G3D/GMutex.h b/dep/g3dlite/include/G3D/GMutex.h
+index 3469b81..9fe098d 100644
+--- a/dep/g3dlite/include/G3D/GMutex.h
++++ b/dep/g3dlite/include/G3D/GMutex.h
+@@ -16,6 +16,7 @@
+ #ifndef G3D_WIN32
+ # include <pthread.h>
+ # include <signal.h>
++# include <unistd.h>
+ #endif
+
+
diff --git a/dep/g3dlite/include/G3D/AABox.h b/dep/g3dlite/include/G3D/AABox.h
index 2e8da1f6098..d57320d73eb 100644
--- a/dep/g3dlite/include/G3D/AABox.h
+++ b/dep/g3dlite/include/G3D/AABox.h
@@ -20,6 +20,7 @@
#include "G3D/debug.h"
#include "G3D/Array.h"
#include "G3D/Plane.h"
+#include "G3D/Sphere.h"
namespace G3D {
@@ -259,6 +260,8 @@ public:
void getBounds(AABox& out) const {
out = *this;
}
+
+ void getBounds(Sphere& out) const;
};
}
diff --git a/dep/g3dlite/include/G3D/Any.h b/dep/g3dlite/include/G3D/Any.h
index c267eedd22f..e2d0fbe7e62 100644
--- a/dep/g3dlite/include/G3D/Any.h
+++ b/dep/g3dlite/include/G3D/Any.h
@@ -17,7 +17,9 @@
#include "G3D/platform.h"
#include "G3D/Table.h"
#include "G3D/Array.h"
+#include "G3D/Set.h"
#include "G3D/AtomicInt32.h"
+#include "G3D/stringutils.h"
#include <string>
// needed for Token
@@ -448,7 +450,6 @@ public:
*/
std::string resolveStringAsFilename() const;
-
/** If this is named ARRAY or TABLE, returns the name. */
const std::string& name() const;
@@ -518,7 +519,7 @@ public:
// Needed to prevent the operator[](int) overload from catching
// string literals
- inline const Any& operator[](const char* key) const {
+ const Any& operator[](const char* key) const {
return operator[](std::string(key));
}
@@ -548,7 +549,7 @@ public:
Any& operator[](const std::string& key);
/** \copydoc Any::operator[](const std::string&) */
- inline Any& operator[](const char* key) {
+ Any& operator[](const char* key) {
return operator[](std::string(key));
}
@@ -636,6 +637,124 @@ private:
}; // class Any
+
+/**
+ Convenient iteration over the keys of a Any::TABLE, usually
+ for implementing construction of an object from an Any.
+
+ Getting an element using either iteration or explicit requests
+ consumes that element from the iterator (but not from the Any!)
+ It is an error to consume the same element more than once from
+ the same iterator.
+
+ <pre>
+ AnyKeyIterator r(a);
+ r.getIfPresent("enabled", enabled);
+ r.getIfPresent("showSamples", showSamples);
+ r.getIfPresent("showTiles", showTiles);
+
+ r.verifyDone();
+ </pre>
+
+ \beta
+*/
+class AnyTableReader {
+private:
+ Any m_any;
+ Set<std::string> m_alreadyRead;
+public:
+
+ /** Verifies that \a is a TABLE with the given \a name. */
+ AnyTableReader(const std::string& name, const Any& a) : m_any(a) {
+ try {
+ m_any.verifyType(Any::TABLE);
+ m_any.verifyName(name);
+ } catch (const ParseError& e) {
+ // If an exception is thrown, the destructors will not be
+ // invoked automatically.
+ m_any.~Any();
+ m_alreadyRead.~Set();
+ throw e;
+ }
+ }
+
+ /** Verifies that \a is a TABLE. */
+ AnyTableReader(const Any& a) : m_any(a) {
+ try {
+ m_any.verifyType(Any::TABLE);
+ } catch (const ParseError& e) {
+ // If an exception is thrown, the destructors will not be
+ // invoked automatically.
+ m_any.~Any();
+ m_alreadyRead.~Set();
+ throw e;
+ }
+ }
+
+ bool hasMore() const {
+ return m_any.size() > m_alreadyRead.size();
+ }
+
+ /** Verifies that all keys have been read. */
+ void verifyDone() const {
+ if (hasMore()) {
+ // Generate all keys
+ // Remove the ones we've read
+ // Assert the rest
+ // any.verify("");
+ }
+ }
+
+#if 0
+ /** Returns the current key */
+ const std::string& key() const;
+
+ /** Returns the current value */
+ const Any& value() const;
+
+ AnyKeyIterator& operator++();
+#endif
+
+ /** If key \s appears in the any, reads its value into \a v and
+ removes that key from the ones available to iterate over.
+
+ If key \s does not appear in the any, throws a G3D::ParseError.
+
+ Assumes that if key \s appears in the any it has not already been extracted
+ by this iterator. If it has been read before, an assertion will fail in debug mode.
+
+ */
+ template<class ValueType>
+ void get(const std::string& s, ValueType& v) {
+ v = m_any[s];
+ m_alreadyRead.insert(toLower(s));
+ }
+
+ /** Get the value associated with a key only if the key is actually present.
+
+ If key \s appears in the any, reads its value into \a v and
+ removes that key from the ones available to iterate over.
+
+ If key \s does not appear in the any, does nothing.
+
+ Assumes that if key \s appears in the any it has not already been extracted
+ by this iterator. If it has been read before, an assertion will fail in debug mode.
+
+ \return True if the value was read.
+ */
+ template<class ValueType>
+ bool getIfPresent(const std::string& s, ValueType& v) {
+ if (m_any.containsKey(s)) {
+ debugAssertM(! m_alreadyRead.contains(toLower(s)), "read twice");
+
+ get(s, v);
+ return true;
+ } else {
+ return false;
+ }
+ }
+};
+
} // namespace G3D
#endif
diff --git a/dep/g3dlite/include/G3D/GMutex.h b/dep/g3dlite/include/G3D/GMutex.h
index 3469b812736..9fe098d10e3 100644
--- a/dep/g3dlite/include/G3D/GMutex.h
+++ b/dep/g3dlite/include/G3D/GMutex.h
@@ -16,6 +16,7 @@
#ifndef G3D_WIN32
# include <pthread.h>
# include <signal.h>
+# include <unistd.h>
#endif
diff --git a/dep/g3dlite/include/G3D/PointHashGrid.h b/dep/g3dlite/include/G3D/PointHashGrid.h
index 5b128d1b5d9..d0b60a88ae5 100644
--- a/dep/g3dlite/include/G3D/PointHashGrid.h
+++ b/dep/g3dlite/include/G3D/PointHashGrid.h
@@ -360,7 +360,7 @@ public:
m_arrayIndex(0), m_epoch(0) {}
Iterator(const ThisType* grid) :
- m_isEnd(false),
+ m_isEnd(grid->size() == 0),
m_grid(grid),
m_tableIterator( grid->m_data.begin() ),
m_arrayIndex(0),
@@ -387,6 +387,10 @@ public:
}
}
+ bool hasMore() const {
+ return ! m_isEnd;
+ }
+
bool operator==(const Iterator& other) const {
return !(*this != other);
}
diff --git a/dep/g3dlite/include/G3D/Quat.inl b/dep/g3dlite/include/G3D/Quat.inl
deleted file mode 100644
index 9e4c861d93b..00000000000
--- a/dep/g3dlite/include/G3D/Quat.inl
+++ /dev/null
@@ -1,36 +0,0 @@
-/**
- Quat.inl
-
- @cite Quaternion implementation based on Watt & Watt page 363.
- Thanks to Max McGuire for slerp optimizations.
-
- @maintainer Morgan McGuire, matrix@graphics3d.com
-
- @created 2002-01-23
- @edited 2004-03-04
- */
-
-namespace G3D {
-
-inline float& Quat::operator[] (int i) {
- debugAssert(i >= 0);
- debugAssert(i < 4);
- return ((float*)this)[i];
-}
-
-inline const float& Quat::operator[] (int i) const {
- debugAssert(i >= 0);
- debugAssert(i < 4);
- return ((float*)this)[i];
-}
-
-inline Quat Quat::operator-(const Quat& other) const {
- return Quat(x - other.x, y - other.y, z - other.z, w - other.w);
-}
-
-inline Quat Quat::operator+(const Quat& other) const {
- return Quat(x + other.x, y + other.y, z + other.z, w + other.w);
-}
-
-}
-
diff --git a/dep/g3dlite/include/G3D/Sphere.h b/dep/g3dlite/include/G3D/Sphere.h
index 595b61c4bf1..d1448261d9f 100644
--- a/dep/g3dlite/include/G3D/Sphere.h
+++ b/dep/g3dlite/include/G3D/Sphere.h
@@ -15,7 +15,6 @@
#include "G3D/platform.h"
#include "G3D/Vector3.h"
#include "G3D/Array.h"
-#include "G3D/Sphere.h"
namespace G3D {
diff --git a/dep/g3dlite/include/G3D/Table.h b/dep/g3dlite/include/G3D/Table.h
index 896a5a2a08a..ab0b114b1c4 100644
--- a/dep/g3dlite/include/G3D/Table.h
+++ b/dep/g3dlite/include/G3D/Table.h
@@ -86,12 +86,11 @@ namespace G3D {
<PRE>
template<> struct HashTrait<MyEnum> {
- static size_t equals(const MyEnum& key) const { return reinterpret_cast<size_t>( key ); }
+ static size_t hashCode(const MyEnum& key) const { return reinterpret_cast<size_t>( key ); }
};
</PRE>
- And rely on the default enum operator==.
-
+ and rely on the default enum operator==.
Periodically check that debugGetLoad() is low (> 0.1). When it gets near
1.0 your hash function is badly designed and maps too many inputs to
diff --git a/dep/g3dlite/include/G3D/Vector2.inl b/dep/g3dlite/include/G3D/Vector2.inl
deleted file mode 100644
index 4f7c55a39cf..00000000000
--- a/dep/g3dlite/include/G3D/Vector2.inl
+++ /dev/null
@@ -1,18 +0,0 @@
-/**
- @file Vector2.inl
-
- @maintainer Morgan McGuire, matrix@graphics3d.com
- @cite Portions by Laura Wollstadt, graphics3d.com
-
- @cite Portions based on Dave Eberly'x Magic Software Library
- at http://www.magic-software.com
-
- @created 2001-06-02
- @edited 2006-01-14
-
- Copyright 2000-2006, Morgan McGuire.
- All rights reserved.
- */
-
-}
-
diff --git a/dep/g3dlite/include/G3D/Vector3.inl b/dep/g3dlite/include/G3D/Vector3.inl
deleted file mode 100644
index 9211c2a70fd..00000000000
--- a/dep/g3dlite/include/G3D/Vector3.inl
+++ /dev/null
@@ -1,249 +0,0 @@
-/**
- @file Vector3.inl
-
- @maintainer Morgan McGuire, matrix@graphics3d.com
-
- @cite Portions based on Dave Eberly's Magic Software Library at http://www.magic-software.com
-
- @created 2001-06-02
- @edited 2004-05-21
- Copyright 2000-2004, Morgan McGuire.
- All rights reserved.
- */
-
-//----------------------------------------------------------------------------
-#ifdef SSE
- // If you receive an error on this line, it is because you do not have the file
- // xmmintrin.h needed for MMX & SSE extensions. Download and install
- //
- // http://download.microsoft.com/download/vstudio60ent/SP5/Wideband-Full/WIN98Me/EN-US/vs6sp5.exe
- // and
- // http://download.microsoft.com/download/vb60ent/Update/6/W9X2KXP/EN-US/vcpp5.exe
- //
- // to get this file.
-# include <xmmintrin.h>
-#endif
-
-inline unsigned int hashCode(const G3D::Vector3& v) {
- return v.hashCode();
-}
-
-namespace G3D {
-
-//----------------------------------------------------------------------------
-inline Vector3::Vector3() : x(0.0f), y(0.0f), z(0.0f) {
-}
-
-//----------------------------------------------------------------------------
-
-inline Vector3::Vector3 (float fX, float fY, float fZ) : x(fX), y(fY), z(fZ) {
-}
-
-//----------------------------------------------------------------------------
-inline Vector3::Vector3 (float V[3]) : x(V[0]), y(V[1]), z(V[2]){
-}
-//----------------------------------------------------------------------------
-inline Vector3::Vector3 (double V[3]) : x((float)V[0]), y((float)V[1]), z((float)V[2]){
-}
-
-//----------------------------------------------------------------------------
-inline Vector3::Vector3 (const Vector3& V) : x(V.x), y(V.y), z(V.z) {
-}
-
-//----------------------------------------------------------------------------
-
-//inline Vector3::Vector3 (const __m128& m) {
- // Cast from SSE packed floats
-// *this = *(Vector3*)&m;
-//}
-
-//----------------------------------------------------------------------------
-inline const float& Vector3::operator[] (int i) const {
- return ((float*)this)[i];
-}
-
-inline float& Vector3::operator[] (int i) {
- return ((float*)this)[i];
-}
-
-//----------------------------------------------------------------------------
-inline Vector3& Vector3::operator= (const Vector3& rkVector) {
- x = rkVector.x;
- y = rkVector.y;
- z = rkVector.z;
- return *this;
-}
-
-//----------------------------------------------------------------------------
-
-inline bool Vector3::fuzzyEq(const Vector3& other) const {
- return G3D::fuzzyEq((*this - other).squaredMagnitude(), 0);
-}
-
-//----------------------------------------------------------------------------
-
-inline bool Vector3::fuzzyNe(const Vector3& other) const {
- return G3D::fuzzyNe((*this - other).squaredMagnitude(), 0);
-}
-
-//----------------------------------------------------------------------------
-
-inline bool Vector3::isFinite() const {
- return G3D::isFinite(x) && G3D::isFinite(y) && G3D::isFinite(z);
-}
-
-//----------------------------------------------------------------------------
-inline bool Vector3::operator== (const Vector3& rkVector) const {
- return ( x == rkVector.x && y == rkVector.y && z == rkVector.z );
-}
-
-//----------------------------------------------------------------------------
-inline bool Vector3::operator!= (const Vector3& rkVector) const {
- return ( x != rkVector.x || y != rkVector.y || z != rkVector.z );
-}
-
-//----------------------------------------------------------------------------
-inline Vector3 Vector3::operator+ (const Vector3& rkVector) const {
- return Vector3(x + rkVector.x, y + rkVector.y, z + rkVector.z);
-}
-
-//----------------------------------------------------------------------------
-inline Vector3 Vector3::operator- (const Vector3& rkVector) const {
- return Vector3(x - rkVector.x, y - rkVector.y, z - rkVector.z);
-}
-
-//----------------------------------------------------------------------------
-inline Vector3 Vector3::operator* (const Vector3& rkVector) const {
- return Vector3(x * rkVector.x, y * rkVector.y, z * rkVector.z);
-}
-
-inline Vector3 Vector3::operator*(float f) const {
- return Vector3(x * f, y * f, z * f);
-}
-
-//----------------------------------------------------------------------------
-inline Vector3 Vector3::operator/ (const Vector3& rkVector) const {
- return Vector3(x / rkVector.x, y / rkVector.y, z / rkVector.z);
-}
-
-//----------------------------------------------------------------------------
-inline Vector3 Vector3::operator- () const {
- return Vector3(-x, -y, -z);
-}
-
-//----------------------------------------------------------------------------
-inline Vector3& Vector3::operator+= (const Vector3& rkVector) {
- x += rkVector.x;
- y += rkVector.y;
- z += rkVector.z;
- return *this;
-}
-
-//----------------------------------------------------------------------------
-inline Vector3& Vector3::operator-= (const Vector3& rkVector) {
- x -= rkVector.x;
- y -= rkVector.y;
- z -= rkVector.z;
- return *this;
-}
-
-//----------------------------------------------------------------------------
-inline Vector3& Vector3::operator*= (float fScalar) {
- x *= fScalar;
- y *= fScalar;
- z *= fScalar;
- return *this;
-}
-
-//----------------------------------------------------------------------------
-inline Vector3& Vector3::operator*= (const Vector3& rkVector) {
- x *= rkVector.x;
- y *= rkVector.y;
- z *= rkVector.z;
- return *this;
-}
-
-//----------------------------------------------------------------------------
-inline Vector3& Vector3::operator/= (const Vector3& rkVector) {
- x /= rkVector.x;
- y /= rkVector.y;
- z /= rkVector.z;
- return *this;
-}
-
-//----------------------------------------------------------------------------
-inline float Vector3::squaredMagnitude () const {
- return x*x + y*y + z*z;
-}
-
-//----------------------------------------------------------------------------
-inline float Vector3::squaredLength () const {
- return squaredMagnitude();
-}
-
-//----------------------------------------------------------------------------
-inline float Vector3::magnitude() const {
- return sqrtf(x*x + y*y + z*z);
-}
-
-//----------------------------------------------------------------------------
-inline float Vector3::length() const {
- return magnitude();
-}
-
-//----------------------------------------------------------------------------
-inline Vector3 Vector3::direction () const {
- float lenSquared = squaredMagnitude();
- float invSqrt = 1.0f / sqrtf(lenSquared);
- return Vector3(x * invSqrt, y * invSqrt, z * invSqrt);
-}
-
-//----------------------------------------------------------------------------
-
-inline Vector3 Vector3::fastDirection () const {
- float lenSquared = x * x + y * y + z * z;
- float invSqrt = rsq(lenSquared);
- return Vector3(x * invSqrt, y * invSqrt, z * invSqrt);
-}
-
-//----------------------------------------------------------------------------
-inline float Vector3::dot (const Vector3& rkVector) const {
- return x*rkVector.x + y*rkVector.y + z*rkVector.z;
-}
-
-//----------------------------------------------------------------------------
-inline Vector3 Vector3::cross (const Vector3& rkVector) const {
- return Vector3(y*rkVector.z - z*rkVector.y, z*rkVector.x - x*rkVector.z,
- x*rkVector.y - y*rkVector.x);
-}
-
-//----------------------------------------------------------------------------
-inline Vector3 Vector3::unitCross (const Vector3& rkVector) const {
- Vector3 kCross(y*rkVector.z - z*rkVector.y, z*rkVector.x - x*rkVector.z,
- x*rkVector.y - y*rkVector.x);
- kCross.unitize();
- return kCross;
-}
-
-//----------------------------------------------------------------------------
-inline Vector3 Vector3::min(const Vector3 &v) const {
- return Vector3(G3D::min(v.x, x), G3D::min(v.y, y), G3D::min(v.z, z));
-}
-
-//----------------------------------------------------------------------------
-inline Vector3 Vector3::max(const Vector3 &v) const {
- return Vector3(G3D::max(v.x, x), G3D::max(v.y, y), G3D::max(v.z, z));
-}
-
-//----------------------------------------------------------------------------
-inline bool Vector3::isZero() const {
- return G3D::fuzzyEq(squaredMagnitude(), 0.0f);
-}
-
-//----------------------------------------------------------------------------
-
-inline bool Vector3::isUnit() const {
- return G3D::fuzzyEq(squaredMagnitude(), 1.0f);
-}
-
-} // namespace
diff --git a/dep/g3dlite/include/G3D/Vector4.inl b/dep/g3dlite/include/G3D/Vector4.inl
deleted file mode 100644
index 576cca83b56..00000000000
--- a/dep/g3dlite/include/G3D/Vector4.inl
+++ /dev/null
@@ -1,191 +0,0 @@
-/**
- @file Vector4.inl
-
- @maintainer Morgan McGuire, matrix@graphics3d.com
-
- @created 2002-07-09
- @edited 2003-02-10
- */
-
-//----------------------------------------------------------------------------
-
-inline unsigned int hashCode(const G3D::Vector4& v) {
- return v.hashCode();
-}
-
-namespace G3D {
-
-//----------------------------------------------------------------------------
-inline Vector4::Vector4() {
- x = y = z = w = 0;
-}
-
-//----------------------------------------------------------------------------
-
-inline Vector4::Vector4 (float fX, float fY, float fZ, float fW) {
- x = fX;
- y = fY;
- z = fZ;
- w = fW;
-}
-
-//----------------------------------------------------------------------------
-inline Vector4::Vector4 (float afCoordinate[4]) {
- x = afCoordinate[0];
- y = afCoordinate[1];
- z = afCoordinate[2];
- w = afCoordinate[3];
-}
-
-//----------------------------------------------------------------------------
-inline Vector4::Vector4(const Vector4& rkVector) {
- x = rkVector.x;
- y = rkVector.y;
- z = rkVector.z;
- w = rkVector.w;
-}
-//----------------------------------------------------------------------------
-inline Vector4::Vector4(const Vector3& rkVector, float fW) {
- x = rkVector.x;
- y = rkVector.y;
- z = rkVector.z;
- w = fW;
-}
-
-//----------------------------------------------------------------------------
-inline float& Vector4::operator[] (int i) {
- return ((float*)this)[i];
-}
-
-//----------------------------------------------------------------------------
-inline const float& Vector4::operator[] (int i) const {
- return ((float*)this)[i];
-}
-
-//----------------------------------------------------------------------------
-inline Vector4::operator float* () {
- return (float*)this;
-}
-
-inline Vector4::operator const float* () const {
- return (float*)this;
-}
-
-//----------------------------------------------------------------------------
-inline Vector4& Vector4::operator= (const Vector4& rkVector) {
- x = rkVector.x;
- y = rkVector.y;
- z = rkVector.z;
- w = rkVector.w;
- return *this;
-}
-
-//----------------------------------------------------------------------------
-inline bool Vector4::operator== (const Vector4& rkVector) const {
- return ( (x == rkVector.x) && (y == rkVector.y) && (z == rkVector.z) && (w == rkVector.w));
-}
-
-//----------------------------------------------------------------------------
-inline bool Vector4::operator!= (const Vector4& rkVector) const {
- return ( x != rkVector.x || y != rkVector.y || z != rkVector.z || w != rkVector.w);
-}
-
-//----------------------------------------------------------------------------
-inline Vector4 Vector4::operator+ (const Vector4& rkVector) const {
- return Vector4(x + rkVector.x, y + rkVector.y, z + rkVector.z, w + rkVector.w);
-}
-
-//----------------------------------------------------------------------------
-inline Vector4 Vector4::operator- (const Vector4& rkVector) const {
- return Vector4(x - rkVector.x, y - rkVector.y, z - rkVector.z, w - rkVector.w);
-}
-
-//----------------------------------------------------------------------------
-inline Vector4 Vector4::operator* (float fScalar) const {
- return Vector4(fScalar*x, fScalar*y, fScalar*z, fScalar*w);
-}
-
-//----------------------------------------------------------------------------
-inline Vector4 Vector4::operator- () const {
- return Vector4( -x, -y, -z, -w);
-}
-
-//----------------------------------------------------------------------------
-inline Vector4& Vector4::operator+= (const Vector4& rkVector) {
- x += rkVector.x;
- y += rkVector.y;
- z += rkVector.z;
- w += rkVector.w;
- return *this;
-}
-
-//----------------------------------------------------------------------------
-inline Vector4& Vector4::operator-= (const Vector4& rkVector) {
- x -= rkVector.x;
- y -= rkVector.y;
- z -= rkVector.z;
- w -= rkVector.w;
- return *this;
-}
-
-//----------------------------------------------------------------------------
-
-inline Vector4 Vector4::lerp(const Vector4& v, float alpha) const {
- return (*this) + (v - *this) * alpha;
-}
-
-//----------------------------------------------------------------------------
-inline Vector4& Vector4::operator*= (float fScalar) {
- x *= fScalar;
- y *= fScalar;
- z *= fScalar;
- w *= fScalar;
- return *this;
-}
-
-//----------------------------------------------------------------------------
-inline float Vector4::dot(const Vector4& rkVector) const {
- return x*rkVector.x + y*rkVector.y + z*rkVector.z + w*rkVector.w;
-}
-
-//----------------------------------------------------------------------------
-inline Vector4 Vector4::min(const Vector4 &v) const {
- return Vector4(G3D::min(v.x, x), G3D::min(v.y, y), G3D::min(v.z, z), G3D::min(v.w, w));
-}
-
-//----------------------------------------------------------------------------
-inline Vector4 Vector4::max(const Vector4 &v) const {
- return Vector4(G3D::max(v.x, x), G3D::max(v.y, y), G3D::max(v.z, z), G3D::max(v.w, w));
-}
-
-//----------------------------------------------------------------------------
-inline bool Vector4::isZero() const {
- return (x == 0.0f) && (y == 0.0f) && (z == 0.0f) && (w == 0.0f);
-}
-
-//----------------------------------------------------------------------------
-
-inline bool Vector4::isFinite() const {
- return G3D::isFinite(x) && G3D::isFinite(y) && G3D::isFinite(z) && G3D::isFinite(w);
-}
-
-//----------------------------------------------------------------------------
-
-inline bool Vector4::isUnit() const {
- return squaredLength() == 1.0;
-}
-
-//----------------------------------------------------------------------------
-
-inline float Vector4::length() const {
- return sqrtf(squaredLength());
-}
-
-//----------------------------------------------------------------------------
-
-inline float Vector4::squaredLength() const {
- return x * x + y * y + z * z + w * w;
-}
-
-}
-
diff --git a/dep/g3dlite/include/G3D/g3dmath.inl b/dep/g3dlite/include/G3D/g3dmath.inl
deleted file mode 100644
index 9bf661a7ebc..00000000000
--- a/dep/g3dlite/include/G3D/g3dmath.inl
+++ /dev/null
@@ -1,288 +0,0 @@
-/**
- @file g3dmath.inl
-
- @maintainer Morgan McGuire, matrix@graphics3d.com
-
- @created 2001-06-02
- @edited 2006-01-14
- */
-
-#include <stdlib.h>
-
-#ifdef _MSC_VER
-// Disable conditional expression is constant, which occurs incorrectly on inlined functions
-# pragma warning (push)
-# pragma warning( disable : 4127 )
-#endif
-
-namespace G3D {
-
-inline bool isNaN(double x) {
- bool b1 = (x < 0.0);
- bool b2 = (x >= 0.0);
- bool b3 = !(b1 || b2);
- return b3;
-}
-
-inline bool isFinite(double x) {
- return ! isNaN(x) && (x < G3D::inf()) && (x > -G3D::inf());
-}
-
-//----------------------------------------------------------------------------
-inline int iAbs (int iValue) {
- return ( iValue >= 0 ? iValue : -iValue );
-}
-
-//----------------------------------------------------------------------------
-inline int iCeil (double fValue) {
- return int(::ceil(fValue));
-}
-
-//----------------------------------------------------------------------------
-
-inline int iClamp(int val, int low, int hi) {
- debugAssert(low <= hi);
- if (val <= low) {
- return low;
- } else if (val >= hi) {
- return hi;
- } else {
- return val;
- }
-}
-
-//----------------------------------------------------------------------------
-
-inline double clamp(double val, double low, double hi) {
- debugAssert(low <= hi);
- if (val <= low) {
- return low;
- } else if (val >= hi) {
- return hi;
- } else {
- return val;
- }
-}
-
-inline float clamp(float val, float low, float hi) {
- debugAssert(low <= hi);
- if (val <= low) {
- return low;
- } else if (val >= hi) {
- return hi;
- } else {
- return val;
- }
-}
-//----------------------------------------------------------------------------
-
-inline int iWrap(int val, int hi) {
- if (val < 0) {
- return ((val % hi) + hi) % hi;
- } else {
- return val % hi;
- }
-}
-
-//----------------------------------------------------------------------------
-inline int iFloor (double fValue) {
- return int(::floor(fValue));
-}
-
-//----------------------------------------------------------------------------
-inline int iSign (int iValue) {
- return ( iValue > 0 ? + 1 : ( iValue < 0 ? -1 : 0 ) );
-}
-
-inline int iSign (double fValue) {
- return ( fValue > 0.0 ? + 1 : ( fValue < 0.0 ? -1 : 0 ) );
-}
-
-//----------------------------------------------------------------------------
-inline double abs (double fValue) {
- return double(::fabs(fValue));
-}
-
-//----------------------------------------------------------------------------
-inline double aCos (double fValue) {
- if ( -1.0 < fValue ) {
- if ( fValue < 1.0 )
- return double(::acos(fValue));
- else
- return 0.0;
- } else {
- return G3D_PI;
- }
-}
-
-//----------------------------------------------------------------------------
-inline double aSin (double fValue) {
- if ( -1.0 < fValue ) {
- if ( fValue < 1.0 ) {
- return double(::asin(fValue));
- } else {
- return -G3D_HALF_PI;
- }
- } else {
- return G3D_HALF_PI;
- }
-}
-
-//----------------------------------------------------------------------------
-inline double aTan (double fValue) {
- return double(::atan(fValue));
-}
-
-//----------------------------------------------------------------------------
-inline double aTan2 (double fY, double fX) {
- return double(::atan2(fY, fX));
-}
-
-//----------------------------------------------------------------------------
-inline double sign (double fValue) {
- if (fValue > 0.0) {
- return 1.0;
- }
-
- if (fValue < 0.0) {
- return -1.0;
- }
-
- return 0.0;
-}
-
-inline double G3D_DEPRECATED unitRandom () {
- return double(::rand()) / double(RAND_MAX);
-}
-
-inline float uniformRandom(float low, float hi) {
- return (hi - low) * float(::rand()) / float(RAND_MAX) + low;
-}
-
-//----------------------------------------------------------------------------
-inline double G3D_DEPRECATED symmetricRandom () {
- return 2.0 * double(::rand()) / double(RAND_MAX) - 1.0;
-}
-
-//----------------------------------------------------------------------------
-inline double square(double x) {
- return x * x;
-}
-
-//----------------------------------------------------------------------------
-inline double sumSquares(double x, double y) {
- return x*x + y*y;
-}
-
-//----------------------------------------------------------------------------
-inline double sumSquares(double x, double y, double z) {
- return x*x + y*y + z*z;
-}
-
-//----------------------------------------------------------------------------
-inline double distance(double x, double y) {
- return sqrt(sumSquares(x, y));
-}
-
-//----------------------------------------------------------------------------
-inline double distance(double x, double y, double z) {
- return sqrt(sumSquares(x, y, z));
-}
-
-//----------------------------------------------------------------------------
-
-/** @deprecated use G3D::min */
-inline int iMin(int x, int y) {
- return (x >= y) ? y : x;
-}
-
-//----------------------------------------------------------------------------
-/** @deprecated use G3D::min */
-inline int iMax(int x, int y) {
- return (x >= y) ? x : y;
-}
-
-//----------------------------------------------------------------------------
-inline int ceilPow2(unsigned int in) {
- in -= 1;
-
- in |= in >> 16;
- in |= in >> 8;
- in |= in >> 4;
- in |= in >> 2;
- in |= in >> 1;
-
- return in + 1;
-}
-
-inline bool isPow2(int num) {
- return ((num & -num) == num);
-}
-
-inline bool isOdd(int num) {
- return (num & 1) == 1;
-}
-
-inline bool isEven(int num) {
- return (num & 1) == 0;
-}
-
-inline double toRadians(double deg) {
- return deg * G3D_PI / 180.0;
-}
-
-inline double toDegrees(double rad) {
- return rad * 180.0 / G3D_PI;
-}
-
-/**
- Computes an appropriate epsilon for comparing a and b.
- */
-inline double eps(double a, double b) {
- // For a and b to be nearly equal, they must have nearly
- // the same magnitude. This means that we can ignore b
- // since it either has the same magnitude or the comparison
- // will fail anyway.
- (void)b;
- const double aa = abs(a) + 1;
- if (aa == inf()) {
- return fuzzyEpsilon;
- } else {
- return fuzzyEpsilon * aa;
- }
-}
-
-inline bool fuzzyEq(double a, double b) {
- return (a == b) || (abs(a - b) <= eps(a, b));
-}
-
-inline bool fuzzyNe(double a, double b) {
- return ! fuzzyEq(a, b);
-}
-
-inline bool fuzzyGt(double a, double b) {
- return a > b + eps(a, b);
-}
-
-inline bool fuzzyGe(double a, double b) {
- return a > b - eps(a, b);
-}
-
-inline bool fuzzyLt(double a, double b) {
- return a < b - eps(a, b);
-}
-
-inline bool fuzzyLe(double a, double b) {
- return a < b + eps(a, b);
-}
-
-inline int iMod3(int x) {
- return x % 3;
-}
-
-} // namespace G3D
-
-#ifdef _MSC_VER
-// Disable conditional expression is constant, which occurs incorrectly on inlined functions
-# pragma warning (pop)
-#endif
diff --git a/dep/g3dlite/include/G3D/platform.h b/dep/g3dlite/include/G3D/platform.h
index d399135101b..c8d2f0b6534 100644
--- a/dep/g3dlite/include/G3D/platform.h
+++ b/dep/g3dlite/include/G3D/platform.h
@@ -6,7 +6,7 @@
@maintainer Morgan McGuire, http://graphics.cs.williams.edu
@created 2003-06-09
- @edited 2010-01-11
+ @edited 2010-08-11
*/
#ifndef G3D_platform_h
@@ -16,7 +16,7 @@
The version number of G3D in the form: MmmBB ->
version M.mm [beta BB]
*/
-#define G3D_VER 80000
+#define G3D_VER 80100
// fatal error for unsupported architectures
#if defined(__powerpc__)
diff --git a/dep/g3dlite/source/AABox.cpp b/dep/g3dlite/source/AABox.cpp
index 035497aa3c4..8e66456c013 100644
--- a/dep/g3dlite/source/AABox.cpp
+++ b/dep/g3dlite/source/AABox.cpp
@@ -282,6 +282,10 @@ bool AABox::culledBy(
return false;
}
+void AABox::getBounds(Sphere& s) const {
+ s.center = center();
+ s.radius = extent().length() / 2;
+}
bool AABox::intersects(const class Sphere& sphere) const {
double d = 0;
diff --git a/dep/g3dlite/source/Log.cpp b/dep/g3dlite/source/Log.cpp
index d44d88d0242..f437351cfbd 100644
--- a/dep/g3dlite/source/Log.cpp
+++ b/dep/g3dlite/source/Log.cpp
@@ -23,23 +23,23 @@
namespace G3D {
void logPrintf(const char* fmt, ...) {
- va_list arg_list;
- va_start(arg_list, fmt);
+ va_list arg_list;
+ va_start(arg_list, fmt);
Log::common()->vprintf(fmt, arg_list);
va_end(arg_list);
}
void logLazyPrintf(const char* fmt, ...) {
- va_list arg_list;
- va_start(arg_list, fmt);
+ va_list arg_list;
+ va_start(arg_list, fmt);
Log::common()->lazyvprintf(fmt, arg_list);
va_end(arg_list);
}
Log* Log::commonLog = NULL;
-Log::Log(const std::string& filename, int stripFromStackBottom) :
+Log::Log(const std::string& filename, int stripFromStackBottom) :
stripFromStackBottom(stripFromStackBottom) {
this->filename = filename;
@@ -50,7 +50,7 @@ Log::Log(const std::string& filename, int stripFromStackBottom) :
std::string drive, base, ext;
Array<std::string> path;
parseFilename(filename, drive, path, base, ext);
- std::string logName = base + ((ext != "") ? ("." + ext) : "");
+ std::string logName = base + ((ext != "") ? ("." + ext) : "");
// Write time is greater than 1ms. This may be a network drive.... try another file.
#ifdef G3D_WIN32
@@ -80,7 +80,7 @@ Log::Log(const std::string& filename, int stripFromStackBottom) :
Log::~Log() {
section("Shutdown");
println("Closing log file");
-
+
// Make sure we don't leave a dangling pointer
if (Log::commonLog == this) {
Log::commonLog = NULL;
diff --git a/dep/g3dlite/source/System.cpp b/dep/g3dlite/source/System.cpp
index 5170ba44941..809f05c0ab4 100644
--- a/dep/g3dlite/source/System.cpp
+++ b/dep/g3dlite/source/System.cpp
@@ -920,9 +920,12 @@ RealTime System::time() {
////////////////////////////////////////////////////////////////
-#define REALPTR_TO_USERPTR(x) ((uint8*)(x) + sizeof (void *))
-#define USERPTR_TO_REALPTR(x) ((uint8*)(x) - sizeof (void *))
-#define REALBLOCK_SIZE(x) ((x) + sizeof (void *))
+
+#define REALPTR_TO_USERPTR(x) ((uint8*)(x) + sizeof(uint32))
+#define USERPTR_TO_REALPTR(x) ((uint8*)(x) - sizeof(uint32))
+#define USERSIZE_TO_REALSIZE(x) ((x) + sizeof(uint32))
+#define REALSIZE_FROM_USERPTR(u) (*(uint32*)USERPTR_TO_REALPTR(ptr) + sizeof(uint32))
+#define USERSIZE_FROM_USERPTR(u) (*(uint32*)USERPTR_TO_REALPTR(ptr))
class BufferPool {
public:
@@ -947,13 +950,19 @@ public:
private:
+ /** Pointer given to the program. Unless in the tiny heap, the user size of the block is stored right in front of the pointer as a uint32.*/
+ typedef void* UserPtr;
+
+ /** Actual block allocated on the heap */
+ typedef void* RealPtr;
+
class MemBlock {
public:
- void* ptr;
- size_t bytes;
+ UserPtr ptr;
+ size_t bytes;
inline MemBlock() : ptr(NULL), bytes(0) {}
- inline MemBlock(void* p, size_t b) : ptr(p), bytes(b) {}
+ inline MemBlock(UserPtr p, size_t b) : ptr(p), bytes(b) {}
};
MemBlock smallPool[maxSmallBuffers];
@@ -1010,13 +1019,13 @@ private:
/**
Malloc out of the tiny heap. Returns NULL if allocation failed.
*/
- inline void* tinyMalloc(size_t bytes) {
+ inline UserPtr tinyMalloc(size_t bytes) {
// Note that we ignore the actual byte size
// and create a constant size block.
(void)bytes;
assert(tinyBufferSize >= bytes);
- void* ptr = NULL;
+ UserPtr ptr = NULL;
if (tinyPoolSize > 0) {
--tinyPoolSize;
@@ -1040,20 +1049,20 @@ private:
}
/** Returns true if this is a pointer into the tiny heap. */
- bool inTinyHeap(void* ptr) {
+ bool inTinyHeap(UserPtr ptr) {
return
(ptr >= tinyHeap) &&
(ptr < (uint8*)tinyHeap + maxTinyBuffers * tinyBufferSize);
}
- void tinyFree(void* ptr) {
+ void tinyFree(UserPtr ptr) {
assert(ptr);
assert(tinyPoolSize < maxTinyBuffers);
// "Tried to free a tiny pool buffer when the tiny pool freelist is full.");
# ifdef G3D_DEBUG
if (tinyPoolSize > 0) {
- void* prevOnHeap = tinyPool[tinyPoolSize - 1];
+ UserPtr prevOnHeap = tinyPool[tinyPoolSize - 1];
assert(prevOnHeap != ptr);
// "System::malloc heap corruption detected: "
// "the last two pointers on the freelist are identical (during tinyFree).");
@@ -1070,7 +1079,8 @@ private:
void flushPool(MemBlock* pool, int& poolSize) {
for (int i = 0; i < poolSize; ++i) {
- ::free(pool[i].ptr);
+ bytesAllocated -= USERSIZE_TO_REALSIZE(pool[i].bytes);
+ ::free(USERPTR_TO_REALPTR(pool[i].ptr));
pool[i].ptr = NULL;
pool[i].bytes = 0;
}
@@ -1078,24 +1088,23 @@ private:
}
- /** Allocate out of a specific pool-> Return NULL if no suitable
- memory was found.
-
- */
- void* malloc(MemBlock* pool, int& poolSize, size_t bytes) {
+ /** Allocate out of a specific pool. Return NULL if no suitable
+ memory was found. */
+ UserPtr malloc(MemBlock* pool, int& poolSize, size_t bytes) {
// OPT: find the smallest block that satisfies the request.
- // See if there's something we can use in the buffer pool->
+ // See if there's something we can use in the buffer pool.
// Search backwards since usually we'll re-use the last one.
for (int i = (int)poolSize - 1; i >= 0; --i) {
if (pool[i].bytes >= bytes) {
- // We found a suitable entry in the pool->
+ // We found a suitable entry in the pool.
// No need to offset the pointer; it is already offset
- void* ptr = pool[i].ptr;
+ UserPtr ptr = pool[i].ptr;
- // Remove this element from the pool
+ // Remove this element from the pool, replacing it with
+ // the one from the end (same as Array::fastRemove)
--poolSize;
pool[i] = pool[poolSize];
@@ -1159,6 +1168,8 @@ public:
~BufferPool() {
::free(tinyHeap);
+ flushPool(smallPool, smallPoolSize);
+ flushPool(medPool, medPoolSize);
#if 0 //-------------------------------- old mutex
# ifdef G3D_WIN32
DeleteCriticalSection(&mutex);
@@ -1169,7 +1180,7 @@ public:
}
- void* realloc(void* ptr, size_t bytes) {
+ UserPtr realloc(UserPtr ptr, size_t bytes) {
if (ptr == NULL) {
return malloc(bytes);
}
@@ -1181,7 +1192,7 @@ public:
} else {
// Free the old pointer and malloc
- void* newPtr = malloc(bytes);
+ UserPtr newPtr = malloc(bytes);
System::memcpy(newPtr, ptr, tinyBufferSize);
tinyFree(ptr);
return newPtr;
@@ -1191,28 +1202,28 @@ public:
// In one of our heaps.
// See how big the block really was
- size_t realSize = *(uint32*)USERPTR_TO_REALPTR(ptr);
- if (bytes <= realSize) {
+ size_t userSize = USERSIZE_FROM_USERPTR(ptr);
+ if (bytes <= userSize) {
// The old block was big enough.
return ptr;
}
- // Need to reallocate
- void* newPtr = malloc(bytes);
- System::memcpy(newPtr, ptr, realSize);
+ // Need to reallocate and move
+ UserPtr newPtr = malloc(bytes);
+ System::memcpy(newPtr, ptr, userSize);
free(ptr);
return newPtr;
}
}
- void* malloc(size_t bytes) {
+ UserPtr malloc(size_t bytes) {
lock();
++totalMallocs;
if (bytes <= tinyBufferSize) {
- void* ptr = tinyMalloc(bytes);
+ UserPtr ptr = tinyMalloc(bytes);
if (ptr) {
++mallocsFromTinyPool;
@@ -1226,7 +1237,7 @@ public:
// through to a small buffer
if (bytes <= smallBufferSize) {
- void* ptr = malloc(smallPool, smallPoolSize, bytes);
+ UserPtr ptr = malloc(smallPool, smallPoolSize, bytes);
if (ptr) {
++mallocsFromSmallPool;
@@ -1239,7 +1250,7 @@ public:
// through into a medium allocation because that would
// waste the medium buffer's resources.
- void* ptr = malloc(medPool, medPoolSize, bytes);
+ UserPtr ptr = malloc(medPool, medPoolSize, bytes);
if (ptr) {
++mallocsFromMedPool;
@@ -1249,37 +1260,37 @@ public:
}
}
- bytesAllocated += REALBLOCK_SIZE(bytes);
+ bytesAllocated += USERSIZE_TO_REALSIZE(bytes);
unlock();
// Heap allocate
// Allocate 4 extra bytes for our size header (unfortunate,
// since malloc already added its own header).
- void* ptr = ::malloc(REALBLOCK_SIZE(bytes));
+ RealPtr ptr = ::malloc(USERSIZE_TO_REALSIZE(bytes));
if (ptr == NULL) {
// Flush memory pools to try and recover space
flushPool(smallPool, smallPoolSize);
flushPool(medPool, medPoolSize);
- ptr = ::malloc(REALBLOCK_SIZE(bytes));
+ ptr = ::malloc(USERSIZE_TO_REALSIZE(bytes));
}
if (ptr == NULL) {
if ((System::outOfMemoryCallback() != NULL) &&
- (System::outOfMemoryCallback()(REALBLOCK_SIZE(bytes), true) == true)) {
+ (System::outOfMemoryCallback()(USERSIZE_TO_REALSIZE(bytes), true) == true)) {
// Re-attempt the malloc
- ptr = ::malloc(REALBLOCK_SIZE(bytes));
+ ptr = ::malloc(USERSIZE_TO_REALSIZE(bytes));
}
}
if (ptr == NULL) {
if (System::outOfMemoryCallback() != NULL) {
// Notify the application
- System::outOfMemoryCallback()(REALBLOCK_SIZE(bytes), false);
+ System::outOfMemoryCallback()(USERSIZE_TO_REALSIZE(bytes), false);
}
# ifdef G3D_DEBUG
- debugPrintf("::malloc(%d) returned NULL\n", (int)REALBLOCK_SIZE(bytes));
+ debugPrintf("::malloc(%d) returned NULL\n", (int)USERSIZE_TO_REALSIZE(bytes));
# endif
debugAssertM(ptr != NULL,
"::malloc returned NULL. Either the "
@@ -1294,7 +1305,7 @@ public:
}
- void free(void* ptr) {
+ void free(UserPtr ptr) {
if (ptr == NULL) {
// Free does nothing on null pointers
return;
@@ -1309,7 +1320,7 @@ public:
return;
}
- uint32 bytes = *(uint32*)USERPTR_TO_REALPTR(ptr);
+ uint32 bytes = USERSIZE_FROM_USERPTR(ptr);
lock();
if (bytes <= smallBufferSize) {
@@ -1327,7 +1338,7 @@ public:
return;
}
}
- bytesAllocated -= REALBLOCK_SIZE(bytes);
+ bytesAllocated -= USERSIZE_TO_REALSIZE(bytes);
unlock();
// Free; the buffer pools are full or this is too big to store.
diff --git a/dep/g3dlite/source/TextInput.cpp b/dep/g3dlite/source/TextInput.cpp
index 09abacc7391..354d0de13c0 100644
--- a/dep/g3dlite/source/TextInput.cpp
+++ b/dep/g3dlite/source/TextInput.cpp
@@ -128,32 +128,34 @@ Token TextInput::read() {
}
-std::string TextInput::readUntilNewlineAsString() {
- // Go to the front of the next token
- Token t = read();
- // Reset the position to the start of this token
+std::string TextInput::readUntilNewlineAsString() {
+/*
+ // Reset the read position back to the start of that token
currentCharOffset = t.bytePosition();
+ lineNumber = t.line();
+ charNumber = t.character();
stack.clear();
if (currentCharOffset == buffer.size()) {
// End of file
return "";
}
-
+ */
std::string s;
// Read until newline or eof
char c = '\0';
do {
- c = buffer[currentCharOffset];
- if (c == '\r' || c == '\n') {
- // Done
- break;
- } else {
- s += c;
- ++currentCharOffset;
- }
+ c = buffer[currentCharOffset];
+ if (c == '\r' || c == '\n') {
+ // Done
+ break;
+ } else {
+ s += c;
+ ++currentCharOffset;
+ ++charNumber;
+ }
} while (currentCharOffset < buffer.size());
return s;
diff --git a/dep/gsoap/gsoap.stub b/dep/gsoap/gsoap.stub
new file mode 100644
index 00000000000..be215b46655
--- /dev/null
+++ b/dep/gsoap/gsoap.stub
@@ -0,0 +1 @@
+int ns1__executeCommand(char* command, char** result);
diff --git a/dep/gsoap/soapC.cpp b/dep/gsoap/soapC.cpp
index 7fefc27f5d1..2c675cc339d 100644
--- a/dep/gsoap/soapC.cpp
+++ b/dep/gsoap/soapC.cpp
@@ -1,8 +1,11 @@
/* soapC.cpp
- Generated by gSOAP 2.8.2 from stub.h
- Copyright(C) 2000-2011, Robert van Engelen, Genivia Inc. All Rights Reserved.
- The generated code is released under one of the following licenses:
- GPL OR Genivia's license for commercial use.
+ Generated by gSOAP 2.8.10 from gsoap.stub
+
+Copyright(C) 2000-2012, Robert van Engelen, Genivia Inc. All Rights Reserved.
+The generated code is released under one of the following licenses:
+1) GPL or 2) Genivia's license for commercial use.
+This program is released under the GPL with the additional exemption that
+compiling, linking, and/or using OpenSSL is allowed.
*/
#if defined(__BORLANDC__)
@@ -12,15 +15,17 @@
#include "soapH.h"
-SOAP_SOURCE_STAMP("@(#) soapC.cpp ver 2.8.2 2011-04-26 21:49:07 GMT")
+SOAP_SOURCE_STAMP("@(#) soapC.cpp ver 2.8.10 2012-09-02 20:48:00 GMT")
#ifndef WITH_NOGLOBAL
-SOAP_FMAC3 void SOAP_FMAC4 soap_serializeheader(struct soap *soap)
+SOAP_FMAC3 int SOAP_FMAC4 soap_getheader(struct soap *soap)
{
- if (soap->header)
- soap_serialize_SOAP_ENV__Header(soap, soap->header);
+ soap->part = SOAP_IN_HEADER;
+ soap->header = soap_in_SOAP_ENV__Header(soap, "SOAP-ENV:Header", soap->header, NULL);
+ soap->part = SOAP_END_HEADER;
+ return soap->header == NULL;
}
SOAP_FMAC3 int SOAP_FMAC4 soap_putheader(struct soap *soap)
@@ -34,12 +39,10 @@ SOAP_FMAC3 int SOAP_FMAC4 soap_putheader(struct soap *soap)
return SOAP_OK;
}
-SOAP_FMAC3 int SOAP_FMAC4 soap_getheader(struct soap *soap)
+SOAP_FMAC3 void SOAP_FMAC4 soap_serializeheader(struct soap *soap)
{
- soap->part = SOAP_IN_HEADER;
- soap->header = soap_in_SOAP_ENV__Header(soap, "SOAP-ENV:Header", NULL, NULL);
- soap->part = SOAP_END_HEADER;
- return soap->header == NULL;
+ if (soap->header)
+ soap_serialize_SOAP_ENV__Header(soap, soap->header);
}
SOAP_FMAC3 void SOAP_FMAC4 soap_header(struct soap *soap)
@@ -90,7 +93,7 @@ SOAP_FMAC3 int SOAP_FMAC4 soap_getfault(struct soap *soap)
SOAP_FMAC3 const char ** SOAP_FMAC4 soap_faultcode(struct soap *soap)
{
soap_fault(soap);
- if (soap->version == 2)
+ if (soap->version == 2 && soap->fault->SOAP_ENV__Code)
return (const char**)&soap->fault->SOAP_ENV__Code->SOAP_ENV__Value;
return (const char**)&soap->fault->faultcode;
}
@@ -108,6 +111,17 @@ SOAP_FMAC3 const char ** SOAP_FMAC4 soap_faultsubcode(struct soap *soap)
return (const char**)&soap->fault->faultcode;
}
+SOAP_FMAC3 const char * SOAP_FMAC4 soap_check_faultsubcode(struct soap *soap)
+{
+ soap_fault(soap);
+ if (soap->version == 2)
+ { if (soap->fault->SOAP_ENV__Code && soap->fault->SOAP_ENV__Code->SOAP_ENV__Subcode && soap->fault->SOAP_ENV__Code->SOAP_ENV__Subcode)
+ return soap->fault->SOAP_ENV__Code->SOAP_ENV__Subcode->SOAP_ENV__Value;
+ return NULL;
+ }
+ return soap->fault->faultcode;
+}
+
SOAP_FMAC3 const char ** SOAP_FMAC4 soap_faultstring(struct soap *soap)
{
soap_fault(soap);
@@ -133,6 +147,16 @@ SOAP_FMAC3 const char ** SOAP_FMAC4 soap_faultdetail(struct soap *soap)
return (const char**)&soap->fault->SOAP_ENV__Detail->__any;
}
+SOAP_FMAC3 const char * SOAP_FMAC4 soap_check_faultdetail(struct soap *soap)
+{
+ soap_fault(soap);
+ if (soap->version == 2 && soap->fault->SOAP_ENV__Detail)
+ return soap->fault->SOAP_ENV__Detail->__any;
+ if (soap->fault->detail)
+ return soap->fault->detail->__any;
+ return NULL;
+}
+
#endif
#ifndef WITH_NOIDREF
@@ -158,7 +182,7 @@ SOAP_FMAC3 int SOAP_FMAC4 soap_getindependent(struct soap *soap)
extern "C" {
#endif
SOAP_FMAC3 void * SOAP_FMAC4 soap_getelement(struct soap *soap, int *type)
-{
+{ (void)type;
if (soap_peek_element(soap))
return NULL;
if (!*soap->id || !(*type = soap_lookup_type(soap, soap->id)))
@@ -280,7 +304,7 @@ SOAP_FMAC3 int SOAP_FMAC4 soap_putindependent(struct soap *soap)
extern "C" {
#endif
SOAP_FMAC3 int SOAP_FMAC4 soap_putelement(struct soap *soap, const void *ptr, const char *tag, int id, int type)
-{
+{ (void)tag;
switch (type)
{
case SOAP_TYPE_byte:
@@ -340,7 +364,7 @@ SOAP_FMAC3 void SOAP_FMAC4 soap_markelement(struct soap *soap, const void *ptr,
#endif
SOAP_FMAC3 void * SOAP_FMAC4 soap_instantiate(struct soap *soap, int t, const char *type, const char *arrayType, size_t *n)
-{
+{ (void)type;
switch (t)
{
case SOAP_TYPE_ns1__executeCommandResponse:
@@ -446,7 +470,7 @@ SOAP_FMAC3 void SOAP_FMAC4 soap_default_byte(struct soap *soap, char *a)
}
SOAP_FMAC3 int SOAP_FMAC4 soap_out_byte(struct soap *soap, const char *tag, int id, const char *a, const char *type)
-{
+{ (void)soap; (void)type; (void)tag; (void)id;
return soap_outbyte(soap, tag, id, a, type, SOAP_TYPE_byte);
}
@@ -483,7 +507,7 @@ SOAP_FMAC3 void SOAP_FMAC4 soap_default_int(struct soap *soap, int *a)
}
SOAP_FMAC3 int SOAP_FMAC4 soap_out_int(struct soap *soap, const char *tag, int id, const int *a, const char *type)
-{
+{ (void)soap; (void)type; (void)tag; (void)id;
return soap_outint(soap, tag, id, a, type, SOAP_TYPE_int);
}
@@ -542,13 +566,14 @@ SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_SOAP_ENV__Fault(struct soap *soap, con
SOAP_FMAC3 int SOAP_FMAC4 soap_out_SOAP_ENV__Fault(struct soap *soap, const char *tag, int id, const struct SOAP_ENV__Fault *a, const char *type)
{
const char *soap_tmp_faultcode = soap_QName2s(soap, a->faultcode);
+ (void)soap; (void)tag; (void)id; (void)type;
if (soap_element_begin_out(soap, tag, soap_embedded_id(soap, id, a, SOAP_TYPE_SOAP_ENV__Fault), type))
return soap->error;
if (soap_out__QName(soap, "faultcode", -1, (char*const*)&soap_tmp_faultcode, ""))
return soap->error;
- if (soap_out_string(soap, "faultstring", -1, &a->faultstring, "xsd:string"))
+ if (soap_out_string(soap, "faultstring", -1, &a->faultstring, ""))
return soap->error;
- if (soap_out_string(soap, "faultactor", -1, &a->faultactor, "xsd:string"))
+ if (soap_out_string(soap, "faultactor", -1, &a->faultactor, ""))
return soap->error;
if (soap_out_PointerToSOAP_ENV__Detail(soap, "detail", -1, &a->detail, ""))
return soap->error;
@@ -692,7 +717,7 @@ SOAP_FMAC1 struct SOAP_ENV__Fault * SOAP_FMAC2 soap_instantiate_SOAP_ENV__Fault(
SOAP_FMAC3 void SOAP_FMAC4 soap_copy_SOAP_ENV__Fault(struct soap *soap, int st, int tt, void *p, size_t len, const void *q, size_t n)
{
- (void)soap; (void)st; (void)len; (void)n; /* appease -Wall -Werror */
+ (void)soap; (void)tt; (void)st; (void)len; (void)n; /* appease -Wall -Werror */
DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Copying struct SOAP_ENV__Fault %p -> %p\n", q, p));
*(struct SOAP_ENV__Fault*)p = *(struct SOAP_ENV__Fault*)q;
}
@@ -715,6 +740,7 @@ SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_SOAP_ENV__Reason(struct soap *soap, co
SOAP_FMAC3 int SOAP_FMAC4 soap_out_SOAP_ENV__Reason(struct soap *soap, const char *tag, int id, const struct SOAP_ENV__Reason *a, const char *type)
{
+ (void)soap; (void)tag; (void)id; (void)type;
if (soap_element_begin_out(soap, tag, soap_embedded_id(soap, id, a, SOAP_TYPE_SOAP_ENV__Reason), type))
return soap->error;
if (soap->lang)
@@ -803,7 +829,7 @@ SOAP_FMAC1 struct SOAP_ENV__Reason * SOAP_FMAC2 soap_instantiate_SOAP_ENV__Reaso
SOAP_FMAC3 void SOAP_FMAC4 soap_copy_SOAP_ENV__Reason(struct soap *soap, int st, int tt, void *p, size_t len, const void *q, size_t n)
{
- (void)soap; (void)st; (void)len; (void)n; /* appease -Wall -Werror */
+ (void)soap; (void)tt; (void)st; (void)len; (void)n; /* appease -Wall -Werror */
DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Copying struct SOAP_ENV__Reason %p -> %p\n", q, p));
*(struct SOAP_ENV__Reason*)p = *(struct SOAP_ENV__Reason*)q;
}
@@ -828,6 +854,7 @@ SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_SOAP_ENV__Detail(struct soap *soap, co
SOAP_FMAC3 int SOAP_FMAC4 soap_out_SOAP_ENV__Detail(struct soap *soap, const char *tag, int id, const struct SOAP_ENV__Detail *a, const char *type)
{
+ (void)soap; (void)tag; (void)id; (void)type;
if (soap_element_begin_out(soap, tag, soap_embedded_id(soap, id, a, SOAP_TYPE_SOAP_ENV__Detail), type))
return soap->error;
soap_outliteral(soap, "-any", &a->__any, NULL);
@@ -921,7 +948,7 @@ SOAP_FMAC1 struct SOAP_ENV__Detail * SOAP_FMAC2 soap_instantiate_SOAP_ENV__Detai
SOAP_FMAC3 void SOAP_FMAC4 soap_copy_SOAP_ENV__Detail(struct soap *soap, int st, int tt, void *p, size_t len, const void *q, size_t n)
{
- (void)soap; (void)st; (void)len; (void)n; /* appease -Wall -Werror */
+ (void)soap; (void)tt; (void)st; (void)len; (void)n; /* appease -Wall -Werror */
DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Copying struct SOAP_ENV__Detail %p -> %p\n", q, p));
*(struct SOAP_ENV__Detail*)p = *(struct SOAP_ENV__Detail*)q;
}
@@ -947,6 +974,7 @@ SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_SOAP_ENV__Code(struct soap *soap, cons
SOAP_FMAC3 int SOAP_FMAC4 soap_out_SOAP_ENV__Code(struct soap *soap, const char *tag, int id, const struct SOAP_ENV__Code *a, const char *type)
{
const char *soap_tmp_SOAP_ENV__Value = soap_QName2s(soap, a->SOAP_ENV__Value);
+ (void)soap; (void)tag; (void)id; (void)type;
if (soap_element_begin_out(soap, tag, soap_embedded_id(soap, id, a, SOAP_TYPE_SOAP_ENV__Code), type))
return soap->error;
if (soap_out__QName(soap, "SOAP-ENV:Value", -1, (char*const*)&soap_tmp_SOAP_ENV__Value, ""))
@@ -1041,7 +1069,7 @@ SOAP_FMAC1 struct SOAP_ENV__Code * SOAP_FMAC2 soap_instantiate_SOAP_ENV__Code(st
SOAP_FMAC3 void SOAP_FMAC4 soap_copy_SOAP_ENV__Code(struct soap *soap, int st, int tt, void *p, size_t len, const void *q, size_t n)
{
- (void)soap; (void)st; (void)len; (void)n; /* appease -Wall -Werror */
+ (void)soap; (void)tt; (void)st; (void)len; (void)n; /* appease -Wall -Werror */
DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Copying struct SOAP_ENV__Code %p -> %p\n", q, p));
*(struct SOAP_ENV__Code*)p = *(struct SOAP_ENV__Code*)q;
}
@@ -1062,6 +1090,7 @@ SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_SOAP_ENV__Header(struct soap *soap, co
SOAP_FMAC3 int SOAP_FMAC4 soap_out_SOAP_ENV__Header(struct soap *soap, const char *tag, int id, const struct SOAP_ENV__Header *a, const char *type)
{
+ (void)soap; (void)tag; (void)id; (void)type;
if (soap_element_begin_out(soap, tag, soap_embedded_id(soap, id, a, SOAP_TYPE_SOAP_ENV__Header), type))
return soap->error;
return soap_element_end_out(soap, tag);
@@ -1140,7 +1169,7 @@ SOAP_FMAC1 struct SOAP_ENV__Header * SOAP_FMAC2 soap_instantiate_SOAP_ENV__Heade
SOAP_FMAC3 void SOAP_FMAC4 soap_copy_SOAP_ENV__Header(struct soap *soap, int st, int tt, void *p, size_t len, const void *q, size_t n)
{
- (void)soap; (void)st; (void)len; (void)n; /* appease -Wall -Werror */
+ (void)soap; (void)tt; (void)st; (void)len; (void)n; /* appease -Wall -Werror */
DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Copying struct SOAP_ENV__Header %p -> %p\n", q, p));
*(struct SOAP_ENV__Header*)p = *(struct SOAP_ENV__Header*)q;
}
@@ -1161,9 +1190,10 @@ SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_ns1__executeCommand(struct soap *soap,
SOAP_FMAC3 int SOAP_FMAC4 soap_out_ns1__executeCommand(struct soap *soap, const char *tag, int id, const struct ns1__executeCommand *a, const char *type)
{
+ (void)soap; (void)tag; (void)id; (void)type;
if (soap_element_begin_out(soap, tag, soap_embedded_id(soap, id, a, SOAP_TYPE_ns1__executeCommand), type))
return soap->error;
- if (soap_out_string(soap, "command", -1, &a->command, "xsd:string"))
+ if (soap_out_string(soap, "command", -1, &a->command, ""))
return soap->error;
return soap_element_end_out(soap, tag);
}
@@ -1247,7 +1277,7 @@ SOAP_FMAC1 struct ns1__executeCommand * SOAP_FMAC2 soap_instantiate_ns1__execute
SOAP_FMAC3 void SOAP_FMAC4 soap_copy_ns1__executeCommand(struct soap *soap, int st, int tt, void *p, size_t len, const void *q, size_t n)
{
- (void)soap; (void)st; (void)len; (void)n; /* appease -Wall -Werror */
+ (void)soap; (void)tt; (void)st; (void)len; (void)n; /* appease -Wall -Werror */
DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Copying struct ns1__executeCommand %p -> %p\n", q, p));
*(struct ns1__executeCommand*)p = *(struct ns1__executeCommand*)q;
}
@@ -1266,9 +1296,10 @@ SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_ns1__executeCommandResponse(struct soa
SOAP_FMAC3 int SOAP_FMAC4 soap_out_ns1__executeCommandResponse(struct soap *soap, const char *tag, int id, const struct ns1__executeCommandResponse *a, const char *type)
{
+ (void)soap; (void)tag; (void)id; (void)type;
if (soap_element_begin_out(soap, tag, soap_embedded_id(soap, id, a, SOAP_TYPE_ns1__executeCommandResponse), type))
return soap->error;
- if (soap_out_PointerTostring(soap, "result", -1, &a->result, "xsd:string"))
+ if (soap_out_PointerTostring(soap, "result", -1, &a->result, ""))
return soap->error;
return soap_element_end_out(soap, tag);
}
@@ -1352,7 +1383,7 @@ SOAP_FMAC1 struct ns1__executeCommandResponse * SOAP_FMAC2 soap_instantiate_ns1_
SOAP_FMAC3 void SOAP_FMAC4 soap_copy_ns1__executeCommandResponse(struct soap *soap, int st, int tt, void *p, size_t len, const void *q, size_t n)
{
- (void)soap; (void)st; (void)len; (void)n; /* appease -Wall -Werror */
+ (void)soap; (void)tt; (void)st; (void)len; (void)n; /* appease -Wall -Werror */
DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Copying struct ns1__executeCommandResponse %p -> %p\n", q, p));
*(struct ns1__executeCommandResponse*)p = *(struct ns1__executeCommandResponse*)q;
}
@@ -1383,6 +1414,8 @@ SOAP_FMAC3 struct SOAP_ENV__Reason ** SOAP_FMAC4 soap_in_PointerToSOAP_ENV__Reas
*a = NULL;
if (!soap->null && *soap->href != '#')
{ soap_revert(soap);
+ *a = (struct SOAP_ENV__Reason *)soap_malloc(soap, sizeof(struct SOAP_ENV__Reason));
+ soap_default_SOAP_ENV__Reason(soap, *a);
if (!(*a = soap_in_SOAP_ENV__Reason(soap, tag, *a, type)))
return NULL;
}
@@ -1438,6 +1471,8 @@ SOAP_FMAC3 struct SOAP_ENV__Detail ** SOAP_FMAC4 soap_in_PointerToSOAP_ENV__Deta
*a = NULL;
if (!soap->null && *soap->href != '#')
{ soap_revert(soap);
+ *a = (struct SOAP_ENV__Detail *)soap_malloc(soap, sizeof(struct SOAP_ENV__Detail));
+ soap_default_SOAP_ENV__Detail(soap, *a);
if (!(*a = soap_in_SOAP_ENV__Detail(soap, tag, *a, type)))
return NULL;
}
@@ -1493,6 +1528,8 @@ SOAP_FMAC3 struct SOAP_ENV__Code ** SOAP_FMAC4 soap_in_PointerToSOAP_ENV__Code(s
*a = NULL;
if (!soap->null && *soap->href != '#')
{ soap_revert(soap);
+ *a = (struct SOAP_ENV__Code *)soap_malloc(soap, sizeof(struct SOAP_ENV__Code));
+ soap_default_SOAP_ENV__Code(soap, *a);
if (!(*a = soap_in_SOAP_ENV__Code(soap, tag, *a, type)))
return NULL;
}
diff --git a/dep/gsoap/soapH.h b/dep/gsoap/soapH.h
index e51d3defaaf..06e9ec21239 100644
--- a/dep/gsoap/soapH.h
+++ b/dep/gsoap/soapH.h
@@ -1,8 +1,11 @@
/* soapH.h
- Generated by gSOAP 2.8.2 from stub.h
- Copyright(C) 2000-2011, Robert van Engelen, Genivia Inc. All Rights Reserved.
- The generated code is released under one of the following licenses:
- GPL OR Genivia's license for commercial use.
+ Generated by gSOAP 2.8.10 from gsoap.stub
+
+Copyright(C) 2000-2012, Robert van Engelen, Genivia Inc. All Rights Reserved.
+The generated code is released under one of the following licenses:
+1) GPL or 2) Genivia's license for commercial use.
+This program is released under the GPL with the additional exemption that
+compiling, linking, and/or using OpenSSL is allowed.
*/
#ifndef soapH_H
diff --git a/dep/gsoap/soapServer.cpp b/dep/gsoap/soapServer.cpp
index 8c8206fb3ef..b6304a3e525 100644
--- a/dep/gsoap/soapServer.cpp
+++ b/dep/gsoap/soapServer.cpp
@@ -1,8 +1,11 @@
/* soapServer.cpp
- Generated by gSOAP 2.8.2 from stub.h
- Copyright(C) 2000-2011, Robert van Engelen, Genivia Inc. All Rights Reserved.
- The generated code is released under one of the following licenses:
- GPL OR Genivia's license for commercial use.
+ Generated by gSOAP 2.8.10 from gsoap.stub
+
+Copyright(C) 2000-2012, Robert van Engelen, Genivia Inc. All Rights Reserved.
+The generated code is released under one of the following licenses:
+1) GPL or 2) Genivia's license for commercial use.
+This program is released under the GPL with the additional exemption that
+compiling, linking, and/or using OpenSSL is allowed.
*/
#if defined(__BORLANDC__)
@@ -11,7 +14,7 @@
#endif
#include "soapH.h"
-SOAP_SOURCE_STAMP("@(#) soapServer.cpp ver 2.8.2 2011-04-26 21:49:07 GMT")
+SOAP_SOURCE_STAMP("@(#) soapServer.cpp ver 2.8.10 2012-09-02 20:48:00 GMT")
SOAP_FMAC5 int SOAP_FMAC6 soap_serve(struct soap *soap)
@@ -67,6 +70,7 @@ SOAP_FMAC5 int SOAP_FMAC6 soap_serve_ns1__executeCommand(struct soap *soap)
soap_tmp_string = NULL;
soap_tmp_ns1__executeCommandResponse.result = &soap_tmp_string;
soap_default_ns1__executeCommand(soap, &soap_tmp_ns1__executeCommand);
+ soap->encodingStyle = NULL;
if (!soap_get_ns1__executeCommand(soap, &soap_tmp_ns1__executeCommand, "ns1:executeCommand", NULL))
return soap->error;
if (soap_body_end_in(soap)
diff --git a/dep/gsoap/soapStub.h b/dep/gsoap/soapStub.h
index 85f3119b9ff..fbdd170e0f4 100644
--- a/dep/gsoap/soapStub.h
+++ b/dep/gsoap/soapStub.h
@@ -1,13 +1,20 @@
/* soapStub.h
- Generated by gSOAP 2.8.2 from stub.h
- Copyright(C) 2000-2011, Robert van Engelen, Genivia Inc. All Rights Reserved.
- The generated code is released under one of the following licenses:
- GPL OR Genivia's license for commercial use.
+ Generated by gSOAP 2.8.10 from gsoap.stub
+
+Copyright(C) 2000-2012, Robert van Engelen, Genivia Inc. All Rights Reserved.
+The generated code is released under one of the following licenses:
+1) GPL or 2) Genivia's license for commercial use.
+This program is released under the GPL with the additional exemption that
+compiling, linking, and/or using OpenSSL is allowed.
*/
#ifndef soapStub_H
#define soapStub_H
#include "stdsoap2.h"
+#if GSOAP_VERSION != 20810
+# error "GSOAP VERSION MISMATCH IN GENERATED CODE: PLEASE REINSTALL PACKAGE"
+#endif
+
/******************************************************************************\
* *
diff --git a/dep/gsoap/stdsoap2.cpp b/dep/gsoap/stdsoap2.cpp
index ed0922d86f2..36a8901dcab 100644
--- a/dep/gsoap/stdsoap2.cpp
+++ b/dep/gsoap/stdsoap2.cpp
@@ -1,17 +1,17 @@
/*
- stdsoap2.c[pp] 2.8.2
+ stdsoap2.c[pp] 2.8.10
gSOAP runtime engine
gSOAP XML Web services tools
-Copyright (C) 2000-2011, Robert van Engelen, Genivia Inc., All Rights Reserved.
+Copyright (C) 2000-2012, Robert van Engelen, Genivia Inc., All Rights Reserved.
This part of the software is released under ONE of the following licenses:
GPL, or the gSOAP public license, or Genivia's license for commercial use.
--------------------------------------------------------------------------------
Contributors:
Wind River Systems Inc., for the following additions under gSOAP public license:
- - vxWorks compatible
+ - vxWorks compatible options
--------------------------------------------------------------------------------
gSOAP public license.
@@ -24,7 +24,7 @@ WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
for the specific language governing rights and limitations under the License.
The Initial Developer of the Original Code is Robert A. van Engelen.
-Copyright (C) 2000-2011, Robert van Engelen, Genivia Inc., All Rights Reserved.
+Copyright (C) 2000-2012, Robert van Engelen, Genivia Inc., All Rights Reserved.
--------------------------------------------------------------------------------
GPL license.
@@ -49,25 +49,18 @@ compiling, linking, and/or using OpenSSL is allowed.
--------------------------------------------------------------------------------
A commercial use license is available from Genivia, Inc., contact@genivia.com
--------------------------------------------------------------------------------
-
-Installation note:
-
-Win32 build needs "ws2_32.lib"
-To do this in Visual C++ 6.0, go to "Project", "settings", select the "Link"
-tab (the project file needs to be selected in the file view) and add
-"ws2_32.lib" to the "Object/library modules" entry
-
-On Mac OS X with gcc (GCC) 3.1 20020420 (prerelease) you MUST compile with
--fstack_check when using -O2 because gcc 3.1 has a bug that smashes the stack
-when locally allocated data exceeds 64K.
-
*/
+#define GSOAP_LIB_VERSION 20810
+
#ifdef AS400
# pragma convert(819) /* EBCDIC to ASCII */
#endif
#include "stdsoap2.h"
+#if GSOAP_VERSION != GSOAP_LIB_VERSION
+# error "GSOAP VERSION MISMATCH IN LIBRARY: PLEASE REINSTALL PACKAGE"
+#endif
#ifdef __BORLANDC__
# pragma warn -8060
@@ -83,10 +76,10 @@ when locally allocated data exceeds 64K.
#endif
#ifdef __cplusplus
-SOAP_SOURCE_STAMP("@(#) stdsoap2.cpp ver 2.8.2 2011-04-17 00:00:00 GMT")
+SOAP_SOURCE_STAMP("@(#) stdsoap2.cpp ver 2.8.10 2012-08-16 00:00:00 GMT")
extern "C" {
#else
-SOAP_SOURCE_STAMP("@(#) stdsoap2.c ver 2.8.2 2011-04-17 00:00:00 GMT")
+SOAP_SOURCE_STAMP("@(#) stdsoap2.c ver 2.8.10 2012-08-16 00:00:00 GMT")
#endif
/* 8bit character representing unknown/nonrepresentable character data (e.g. not supported by current locale with multibyte support enabled) */
@@ -101,7 +94,7 @@ SOAP_SOURCE_STAMP("@(#) stdsoap2.c ver 2.8.2 2011-04-17 00:00:00 GMT")
#define SOAP_QT (soap_wchar)(-5) /* XML-specific '"' */
#define SOAP_AP (soap_wchar)(-6) /* XML-specific ''' */
-#define soap_blank(c) ((c) >= 0 && (c) <= 32)
+#define soap_blank(c) ((c)+1 > 0 && (c) <= 32)
#define soap_notblank(c) ((c) > 32)
#if defined(WIN32) && !defined(UNDER_CE)
@@ -138,8 +131,10 @@ static int soap_isxdigit(int);
static void *fplugin(struct soap*, const char*);
static size_t soap_count_attachments(struct soap *soap);
static int soap_try_connect_command(struct soap*, int http_command, const char *endpoint, const char *action);
+#ifdef WITH_NTLM
+static int soap_ntlm_handshake(struct soap *soap, int command, const char *endpoint, const char *host, int port);
+#endif
#ifndef WITH_NOIDREF
-static void soap_update_ptrs(struct soap*, char*, char*, char*, char*);
static int soap_has_copies(struct soap*, const char*, const char*);
static void soap_init_iht(struct soap*);
static void soap_free_iht(struct soap*);
@@ -152,7 +147,7 @@ static void soap_free_pht(struct soap*);
static const char *soap_set_validation_fault(struct soap*, const char*, const char*);
static int soap_isnumeric(struct soap*, const char*);
static struct soap_nlist *soap_push_ns(struct soap *soap, const char *id, const char *ns, short utilized);
-static void soap_utilize_ns(struct soap *soap, const char *tag, size_t n);
+static void soap_utilize_ns(struct soap *soap, const char *tag);
#endif
#ifndef WITH_LEANER
@@ -208,9 +203,9 @@ static const char *soap_decode(char*, size_t, const char*, const char*);
#ifndef PALM_1
static soap_wchar soap_getchunkchar(struct soap*);
static const char *http_error(struct soap*, int);
-static int http_put(struct soap*);
static int http_get(struct soap*);
static int http_405(struct soap*);
+static int http_200(struct soap*);
static int http_post(struct soap*, const char*, const char*, int, const char*, const char*, size_t);
static int http_send_header(struct soap*, const char*);
static int http_post_header(struct soap*, const char*, const char*);
@@ -538,6 +533,7 @@ extern int h_errno;
static int
fsend(struct soap *soap, const char *s, size_t n)
{ register int nwritten, err;
+ SOAP_SOCKET sk;
#if defined(__cplusplus) && !defined(WITH_LEAN) && !defined(WITH_COMPAT)
if (soap->os)
{ soap->os->write(s, (std::streamsize)n);
@@ -547,23 +543,26 @@ fsend(struct soap *soap, const char *s, size_t n)
return SOAP_EOF;
}
#endif
+ sk = soap->sendsk;
+ if (!soap_valid_socket(sk))
+ sk = soap->socket;
while (n)
- { if (soap_valid_socket(soap->socket))
+ { if (soap_valid_socket(sk))
{
if (soap->send_timeout)
{ for (;;)
{ register int r;
#ifdef WITH_OPENSSL
if (soap->ssl)
- r = tcp_select(soap, soap->socket, SOAP_TCP_SELECT_ALL, soap->send_timeout);
+ r = tcp_select(soap, sk, SOAP_TCP_SELECT_ALL, soap->send_timeout);
else
#endif
#ifdef WITH_GNUTLS
if (soap->session)
- r = tcp_select(soap, soap->socket, SOAP_TCP_SELECT_ALL, soap->send_timeout);
+ r = tcp_select(soap, sk, SOAP_TCP_SELECT_ALL, soap->send_timeout);
else
#endif
- r = tcp_select(soap, soap->socket, SOAP_TCP_SELECT_SND | SOAP_TCP_SELECT_ERR, soap->send_timeout);
+ r = tcp_select(soap, sk, SOAP_TCP_SELECT_SND | SOAP_TCP_SELECT_ERR, soap->send_timeout);
if (r > 0)
break;
if (!r)
@@ -590,25 +589,25 @@ fsend(struct soap *soap, const char *s, size_t n)
#ifndef WITH_LEAN
if ((soap->omode & SOAP_IO_UDP))
{ if (soap->peerlen)
- nwritten = sendto(soap->socket, (char*)s, (SOAP_WINSOCKINT)n, soap->socket_flags, (struct sockaddr*)&soap->peer, (SOAP_WINSOCKINT)soap->peerlen);
+ nwritten = sendto(sk, (char*)s, (SOAP_WINSOCKINT)n, soap->socket_flags, (struct sockaddr*)&soap->peer, (SOAP_WINSOCKINT)soap->peerlen);
else
- nwritten = send(soap->socket, s, (SOAP_WINSOCKINT)n, soap->socket_flags);
+ nwritten = send(sk, s, (SOAP_WINSOCKINT)n, soap->socket_flags);
/* retry and back-off algorithm */
/* TODO: this is not very clear from specs so verify and limit conditions under which we should loop (e.g. ENOBUFS) */
if (nwritten < 0)
{ int udp_repeat;
int udp_delay;
if ((soap->connect_flags & SO_BROADCAST))
- udp_repeat = 3; /* SOAP-over-UDP MULTICAST_UDP_REPEAT - 1 */
+ udp_repeat = 2; /* SOAP-over-UDP MULTICAST_UDP_REPEAT - 1 */
else
udp_repeat = 1; /* SOAP-over-UDP UNICAST_UDP_REPEAT - 1 */
udp_delay = ((unsigned int)soap_random % 201) + 50; /* UDP_MIN_DELAY .. UDP_MAX_DELAY */
do
- { tcp_select(soap, soap->socket, SOAP_TCP_SELECT_ERR, -1000 * udp_delay);
+ { tcp_select(soap, sk, SOAP_TCP_SELECT_ERR, -1000 * udp_delay);
if (soap->peerlen)
- nwritten = sendto(soap->socket, (char*)s, (SOAP_WINSOCKINT)n, soap->socket_flags, (struct sockaddr*)&soap->peer, (SOAP_WINSOCKINT)soap->peerlen);
+ nwritten = sendto(sk, (char*)s, (SOAP_WINSOCKINT)n, soap->socket_flags, (struct sockaddr*)&soap->peer, (SOAP_WINSOCKINT)soap->peerlen);
else
- nwritten = send(soap->socket, s, (SOAP_WINSOCKINT)n, soap->socket_flags);
+ nwritten = send(sk, s, (SOAP_WINSOCKINT)n, soap->socket_flags);
udp_delay <<= 1;
if (udp_delay > 500) /* UDP_UPPER_DELAY */
udp_delay = 500;
@@ -619,14 +618,14 @@ fsend(struct soap *soap, const char *s, size_t n)
else
#endif
#if !defined(PALM) && !defined(AS400)
- nwritten = send(soap->socket, s, (int)n, soap->socket_flags);
+ nwritten = send(sk, s, (int)n, soap->socket_flags);
#else
- nwritten = send(soap->socket, (void*)s, n, soap->socket_flags);
+ nwritten = send(sk, (void*)s, n, soap->socket_flags);
#endif
if (nwritten <= 0)
{
register int r = 0;
- err = soap_socket_errno(soap->socket);
+ err = soap_socket_errno(sk);
#ifdef WITH_OPENSSL
if (soap->ssl && (r = SSL_get_error(soap->ssl, nwritten)) != SSL_ERROR_NONE && r != SSL_ERROR_WANT_READ && r != SSL_ERROR_WANT_WRITE)
{ soap->errnum = err;
@@ -645,14 +644,14 @@ fsend(struct soap *soap, const char *s, size_t n)
{
#if defined(WITH_OPENSSL)
if (soap->ssl && r == SSL_ERROR_WANT_READ)
- r = tcp_select(soap, soap->socket, SOAP_TCP_SELECT_RCV | SOAP_TCP_SELECT_ERR, soap->send_timeout ? soap->send_timeout : -10000);
+ r = tcp_select(soap, sk, SOAP_TCP_SELECT_RCV | SOAP_TCP_SELECT_ERR, soap->send_timeout ? soap->send_timeout : -10000);
else
#elif defined(WITH_GNUTLS)
if (soap->session && !gnutls_record_get_direction(soap->session))
- r = tcp_select(soap, soap->socket, SOAP_TCP_SELECT_RCV | SOAP_TCP_SELECT_ERR, soap->send_timeout ? soap->send_timeout : -10000);
+ r = tcp_select(soap, sk, SOAP_TCP_SELECT_RCV | SOAP_TCP_SELECT_ERR, soap->send_timeout ? soap->send_timeout : -10000);
else
#endif
- r = tcp_select(soap, soap->socket, SOAP_TCP_SELECT_SND | SOAP_TCP_SELECT_ERR, soap->send_timeout ? soap->send_timeout : -10000);
+ r = tcp_select(soap, sk, SOAP_TCP_SELECT_SND | SOAP_TCP_SELECT_ERR, soap->send_timeout ? soap->send_timeout : -10000);
if (!r && soap->send_timeout)
return SOAP_EOF;
if (r < 0 && soap->errnum != SOAP_EINTR)
@@ -775,7 +774,7 @@ soap_flush(struct soap *soap)
do
{ DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Deflating %u bytes\n", soap->d_stream->avail_in));
if (deflate(soap->d_stream, Z_NO_FLUSH) != Z_OK)
- { DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Unable to deflate: %s\n", soap->d_stream->msg?soap->d_stream->msg:SOAP_STR_EOS));
+ { DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Unable to deflate: %s\n", soap->d_stream->msg ? soap->d_stream->msg : SOAP_STR_EOS));
return soap->error = SOAP_ZLIB_ERROR;
}
if (!soap->d_stream->avail_out)
@@ -870,6 +869,7 @@ static size_t
frecv(struct soap *soap, char *s, size_t n)
{ register int r;
register int retries = 100; /* max 100 retries with non-blocking sockets */
+ SOAP_SOCKET sk;
soap->errnum = 0;
#if defined(__cplusplus) && !defined(WITH_LEAN) && !defined(WITH_COMPAT)
if (soap->is)
@@ -878,7 +878,10 @@ frecv(struct soap *soap, char *s, size_t n)
return 0;
}
#endif
- if (soap_valid_socket(soap->socket))
+ sk = soap->recvsk;
+ if (!soap_valid_socket(sk))
+ sk = soap->socket;
+ if (soap_valid_socket(sk))
{ for (;;)
{
#ifdef WITH_OPENSSL
@@ -890,7 +893,7 @@ frecv(struct soap *soap, char *s, size_t n)
if (soap->recv_timeout)
#endif
{ for (;;)
- { r = tcp_select(soap, soap->socket, SOAP_TCP_SELECT_RCV | SOAP_TCP_SELECT_ERR, soap->recv_timeout);
+ { r = tcp_select(soap, sk, SOAP_TCP_SELECT_RCV | SOAP_TCP_SELECT_ERR, soap->recv_timeout);
if (r > 0)
break;
if (!r)
@@ -930,7 +933,7 @@ frecv(struct soap *soap, char *s, size_t n)
if ((soap->omode & SOAP_IO_UDP))
{ SOAP_SOCKLEN_T k = (SOAP_SOCKLEN_T)sizeof(soap->peer);
memset((void*)&soap->peer, 0, sizeof(soap->peer));
- r = recvfrom(soap->socket, s, (SOAP_WINSOCKINT)n, soap->socket_flags, (struct sockaddr*)&soap->peer, &k); /* portability note: see SOAP_SOCKLEN_T definition in stdsoap2.h */
+ r = recvfrom(sk, s, (SOAP_WINSOCKINT)n, soap->socket_flags, (struct sockaddr*)&soap->peer, &k); /* portability note: see SOAP_SOCKLEN_T definition in stdsoap2.h */
soap->peerlen = (size_t)k;
#ifndef WITH_IPV6
soap->ip = ntohl(soap->peer.sin_addr.s_addr);
@@ -938,13 +941,13 @@ frecv(struct soap *soap, char *s, size_t n)
}
else
#endif
- r = recv(soap->socket, s, (int)n, soap->socket_flags);
+ r = recv(sk, s, (int)n, soap->socket_flags);
#ifdef PALM
/* CycleSyncDisplay(curStatusMsg); */
#endif
if (r >= 0)
return (size_t)r;
- r = soap_socket_errno(soap->socket);
+ r = soap_socket_errno(sk);
if (r != SOAP_EINTR && r != SOAP_EAGAIN && r != SOAP_EWOULDBLOCK)
{ soap->errnum = r;
return 0;
@@ -952,14 +955,14 @@ frecv(struct soap *soap, char *s, size_t n)
}
#if defined(WITH_OPENSSL)
if (soap->ssl && err == SSL_ERROR_WANT_WRITE)
- r = tcp_select(soap, soap->socket, SOAP_TCP_SELECT_SND | SOAP_TCP_SELECT_ERR, soap->recv_timeout ? soap->recv_timeout : 5);
+ r = tcp_select(soap, sk, SOAP_TCP_SELECT_SND | SOAP_TCP_SELECT_ERR, soap->recv_timeout ? soap->recv_timeout : 5);
else
#elif defined(WITH_GNUTLS)
if (soap->session && gnutls_record_get_direction(soap->session))
- r = tcp_select(soap, soap->socket, SOAP_TCP_SELECT_SND | SOAP_TCP_SELECT_ERR, soap->recv_timeout ? soap->recv_timeout : 5);
+ r = tcp_select(soap, sk, SOAP_TCP_SELECT_SND | SOAP_TCP_SELECT_ERR, soap->recv_timeout ? soap->recv_timeout : 5);
else
#endif
- r = tcp_select(soap, soap->socket, SOAP_TCP_SELECT_RCV | SOAP_TCP_SELECT_ERR, soap->recv_timeout ? soap->recv_timeout : 5);
+ r = tcp_select(soap, sk, SOAP_TCP_SELECT_RCV | SOAP_TCP_SELECT_ERR, soap->recv_timeout ? soap->recv_timeout : 5);
if (!r && soap->recv_timeout)
return 0;
if (r < 0)
@@ -970,7 +973,7 @@ frecv(struct soap *soap, char *s, size_t n)
if (retries-- <= 0)
return 0;
#ifdef PALM
- r = soap_socket_errno(soap->socket);
+ r = soap_socket_errno(sk);
if (r != SOAP_EINTR && retries-- <= 0)
{ soap->errnum = r;
return 0;
@@ -1076,10 +1079,9 @@ soap_recv_raw(struct soap *soap)
}
}
else if (r != Z_BUF_ERROR)
- { DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Inflate error: %s\n", soap->d_stream->msg?soap->d_stream->msg:SOAP_STR_EOS));
+ { DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Inflate error: %s\n", soap->d_stream->msg ? soap->d_stream->msg : SOAP_STR_EOS));
soap->d_stream->next_out = Z_NULL;
- soap->error = SOAP_ZLIB_ERROR;
- return EOF;
+ return soap->error = SOAP_ZLIB_ERROR;
}
}
zlib_again:
@@ -1110,7 +1112,9 @@ zlib_again:
DBGMSG(RECV, soap->buf, ret);
soap->bufidx = 0;
if (!ret)
- return soap->ahead = EOF;
+ { soap->ahead = EOF;
+ return EOF;
+ }
}
else
soap->bufidx = soap->buflen;
@@ -1118,7 +1122,9 @@ zlib_again:
DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Getting chunk size (idx=%u len=%u)\n", (unsigned int)soap->bufidx, (unsigned int)soap->buflen));
while (!soap_isxdigit((int)(c = soap_getchunkchar(soap))))
{ if ((int)c == EOF)
- return soap->ahead = EOF;
+ { soap->ahead = EOF;
+ return EOF;
+ }
}
do
*t++ = (char)c;
@@ -1126,7 +1132,9 @@ zlib_again:
while ((int)c != EOF && c != '\n')
c = soap_getchunkchar(soap);
if ((int)c == EOF)
- return soap->ahead = EOF;
+ { soap->ahead = EOF;
+ return EOF;
+ }
*t = '\0';
DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Chunk size = %s (hex)\n", tmp));
soap->chunksize = (size_t)soap_strtoul(tmp, &t, 16);
@@ -1194,10 +1202,9 @@ zlib_again:
#endif
}
else
- { DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Unable to inflate: (%d) %s\n", r, soap->d_stream->msg?soap->d_stream->msg:SOAP_STR_EOS));
+ { DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Unable to inflate: (%d) %s\n", r, soap->d_stream->msg ? soap->d_stream->msg : SOAP_STR_EOS));
soap->d_stream->next_out = Z_NULL;
- soap->error = SOAP_ZLIB_ERROR;
- return EOF;
+ return soap->error = SOAP_ZLIB_ERROR;
}
}
#endif
@@ -1283,19 +1290,22 @@ soap_recv(struct soap *soap)
}
}
while (soap->ffilterrecv)
- { int err = soap->filterstop;
- if (err)
+ { int err, last = soap->filterstop;
+ if (last)
soap->bufidx = soap->buflen = 0;
- else
- err = soap_recv_raw(soap); /* do not call again after EOF */
- if ((soap->error = soap->ffilterrecv(soap, soap->buf, &soap->buflen, sizeof(soap->buf))))
- return soap->error;
+ if ((err = soap->ffilterrecv(soap, soap->buf, &soap->buflen, sizeof(soap->buf))))
+ return soap->error = err;
if (soap->buflen)
- { soap->filterstop = err;
+ { soap->bufidx = 0;
+ soap->filterstop = last;
return SOAP_OK;
}
- if (err)
- return err;
+ if (last)
+ { DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Returning postponed error %d\n", last));
+ soap->filterstop = SOAP_OK;
+ return last;
+ }
+ soap->filterstop = soap_recv_raw(soap); /* do not call again after EOF */
}
#endif
return soap_recv_raw(soap);
@@ -1505,7 +1515,7 @@ soap_get(struct soap *soap)
{ c = soap_get0(soap);
if (c == '>')
{ soap->cdata = 0;
- soap_get1(soap);
+ c = soap_get1(soap);
c = soap_get1(soap);
}
else
@@ -1702,12 +1712,11 @@ SOAP_FMAC2
soap_getutf8(struct soap *soap)
{ register soap_wchar c, c1, c2, c3, c4;
c = soap->ahead;
- if (c > 0x7F)
- { soap->ahead = 0;
- return c;
- }
- c = soap_get(soap);
- if (c < 0x80 || (soap->mode & SOAP_ENC_LATIN))
+ if (c)
+ soap->ahead = 0;
+ else
+ c = soap_get(soap);
+ if (c < 0x80 || c > 0xFF || (soap->mode & SOAP_ENC_LATIN))
return c;
c1 = soap_get1(soap);
if (c1 < 0x80)
@@ -1896,7 +1905,7 @@ SOAP_FMAC1
unsigned char*
SOAP_FMAC2
soap_getbase64(struct soap *soap, int *n, int malloc_flag)
-{
+{ (void)malloc_flag;
#ifdef WITH_DOM
if ((soap->mode & SOAP_XML_DOM) && soap->dom)
{ soap->dom->data = soap_string_in(soap, 0, -1, -1);
@@ -1921,6 +1930,8 @@ soap_getbase64(struct soap *soap, int *n, int malloc_flag)
register int j = 0;
do
{ register soap_wchar c = soap_get(soap);
+ if (c < SOAP_AP)
+ c &= 0x7FFFFFFF;
if (c == '=' || c < 0)
{ unsigned char *p;
switch (j)
@@ -2037,14 +2048,13 @@ SOAP_FMAC2
soap_xop_forward(struct soap *soap, unsigned char **ptr, int *size, char **id, char **type, char **options)
{ /* Check MTOM xop:Include element (within hex/base64Binary) */
/* TODO: this code to be obsoleted with new import/xop.h conventions */
- int body = soap->body; /* should save type too? */
+ short body = soap->body; /* should save type too? */
if (!soap_peek_element(soap))
{ if (!soap_element_begin_in(soap, "xop:Include", 0, NULL))
- { if (soap_dime_forward(soap, ptr, size, id, type, options))
+ { if (soap_dime_forward(soap, ptr, size, id, type, options)
+ || (soap->body && soap_element_end_in(soap, "xop:Include")))
return soap->error;
}
- if (soap->body && soap_element_end_in(soap, NULL))
- return soap->error;
}
soap->body = body;
return SOAP_OK;
@@ -2176,11 +2186,14 @@ soap_pop_block(struct soap *soap, struct soap_blist *b)
#endif
/******************************************************************************/
-#ifndef WITH_NOIDREF
#ifndef PALM_1
-static void
-soap_update_ptrs(struct soap *soap, char *start, char *end, char *p1, char *p2)
-{ int i;
+SOAP_FMAC1
+void
+SOAP_FMAC2
+soap_update_pointers(struct soap *soap, char *start, char *end, char *p1, char *p2)
+{
+#ifndef WITH_NOIDREF
+ int i;
register struct soap_ilist *ip = NULL;
register struct soap_flist *fp = NULL;
#ifndef WITH_LEANER
@@ -2218,7 +2231,7 @@ soap_update_ptrs(struct soap *soap, char *start, char *end, char *p1, char *p2)
#ifndef WITH_LEANER
for (xp = soap->xlist; xp; xp = xp->next)
{ if (xp->ptr && (char*)xp->ptr >= start && (char*)xp->ptr < end)
- { DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Update id='%s' %p -> %p\n", xp->id?xp->id:SOAP_STR_EOS, xp->ptr, (char*)xp->ptr + (p1-p2)));
+ { DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Update id='%s' %p -> %p\n", xp->id ? xp->id : SOAP_STR_EOS, xp->ptr, (char*)xp->ptr + (p1-p2)));
xp->ptr = (unsigned char**)((char*)xp->ptr + (p1-p2));
xp->size = (int*)((char*)xp->size + (p1-p2));
xp->type = (char**)((char*)xp->type + (p1-p2));
@@ -2226,8 +2239,10 @@ soap_update_ptrs(struct soap *soap, char *start, char *end, char *p1, char *p2)
}
}
#endif
-}
+#else
+ (void)soap; (void)start; (void)end; (void)p1; (void)p2;
#endif
+}
#endif
/******************************************************************************/
@@ -2469,11 +2484,11 @@ soap_save_block(struct soap *soap, struct soap_blist *b, char *p, int flag)
if (p)
{ for (s = p, q = soap_first_block(soap, b); q; q = soap_next_block(soap, b))
{ n = soap_block_size(soap, b);
+ DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Copy %u bytes from %p to %p\n", (unsigned int)n, q, s));
#ifndef WITH_NOIDREF
if (flag)
- soap_update_ptrs(soap, q, q + n, s, q);
+ soap_update_pointers(soap, q, q + n, s, q);
#endif
- DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Copy %u bytes from %p to %p\n", (unsigned int)n, q, s));
memcpy(s, q, n);
s += n;
}
@@ -2701,12 +2716,7 @@ soap_push_namespace(struct soap *soap, const char *id, const char *ns)
if (p)
{ for (i = 0; p->id; p++, i++)
{ if (p->ns && !strcmp(ns, p->ns))
- { if (p->out)
- { SOAP_FREE(soap, p->out);
- p->out = NULL;
- }
break;
- }
if (p->out)
{ if (!strcmp(ns, p->out))
break;
@@ -2733,10 +2743,10 @@ soap_push_namespace(struct soap *soap, const char *id, const char *ns)
soap->nlist = np;
np->level = soap->level;
np->index = i;
- strcpy(np->id, id);
+ strcpy((char*)np->id, id);
DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Push namespace binding (level=%u) '%s' '%s'\n", soap->level, id, ns));
if (i < 0)
- { np->ns = strcpy(np->id + n + 1, ns);
+ { np->ns = strcpy((char*)np->id + n + 1, ns);
DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Push NOT OK: no match found for '%s' in namespace mapping table (added to stack anyway)\n", ns));
}
else
@@ -3067,6 +3077,7 @@ soap_ssl_init()
#ifdef WITH_OPENSSL
SSL_library_init();
OpenSSL_add_all_algorithms(); /* 2.8.1 change (wsseapi.c) */
+ OpenSSL_add_all_digests();
#ifndef WITH_LEAN
SSL_load_error_strings();
#endif
@@ -3122,7 +3133,11 @@ soap_ssl_error(struct soap *soap, int ret)
strcpy(soap->msgbuf, "EOF was observed that violates the protocol. The client probably provided invalid authentication information.");
break;
case -1:
+#ifdef HAVE_SNPRINTF
+ soap_snprintf(soap->msgbuf, sizeof(soap->msgbuf), "Error observed by underlying BIO: %s", strerror(errno));
+#else
sprintf(soap->msgbuf, "Error observed by underlying BIO: %s", strerror(errno));
+#endif
break;
}
}
@@ -3333,12 +3348,22 @@ ssl_verify_callback(int ok, X509_STORE_CTX *store)
#ifdef SOAP_DEBUG
if (!ok)
{ char buf[1024];
+ int err = X509_STORE_CTX_get_error(store);
X509 *cert = X509_STORE_CTX_get_current_cert(store);
- fprintf(stderr, "SSL verify error or warning with certificate at depth %d: %s\n", X509_STORE_CTX_get_error_depth(store), X509_verify_cert_error_string(X509_STORE_CTX_get_error(store)));
+ fprintf(stderr, "SSL verify error or warning with certificate at depth %d: %s\n", X509_STORE_CTX_get_error_depth(store), X509_verify_cert_error_string(err));
X509_NAME_oneline(X509_get_issuer_name(cert), buf, sizeof(buf));
fprintf(stderr, "certificate issuer %s\n", buf);
X509_NAME_oneline(X509_get_subject_name(cert), buf, sizeof(buf));
fprintf(stderr, "certificate subject %s\n", buf);
+ /* accept self signed certificates and certificates out of date */
+ switch (err)
+ { case X509_V_ERR_CERT_NOT_YET_VALID:
+ case X509_V_ERR_CERT_HAS_EXPIRED:
+ case X509_V_ERR_DEPTH_ZERO_SELF_SIGNED_CERT:
+ case X509_V_ERR_SELF_SIGNED_CERT_IN_CHAIN:
+ X509_STORE_CTX_set_error(store, X509_V_OK);
+ ok = 1;
+ }
}
#endif
/* Note: return 1 to continue, but unsafe progress will be terminated by OpenSSL */
@@ -3353,13 +3378,16 @@ ssl_verify_callback(int ok, X509_STORE_CTX *store)
static int
ssl_verify_callback_allow_expired_certificate(int ok, X509_STORE_CTX *store)
{ ok = ssl_verify_callback(ok, store);
- if (ok == 0 && X509_STORE_CTX_get_error(store) == X509_V_ERR_CERT_HAS_EXPIRED)
- {
-#ifdef SOAP_DEBUG
- fprintf(stderr, "ignoring certificate expiration\n");
-#endif
- X509_STORE_CTX_set_error(store, X509_V_OK);
- ok = 1;
+ if (!ok)
+ { /* accept self signed certificates and certificates out of date */
+ switch (X509_STORE_CTX_get_error(store))
+ { case X509_V_ERR_CERT_NOT_YET_VALID:
+ case X509_V_ERR_CERT_HAS_EXPIRED:
+ case X509_V_ERR_DEPTH_ZERO_SELF_SIGNED_CERT:
+ case X509_V_ERR_SELF_SIGNED_CERT_IN_CHAIN:
+ X509_STORE_CTX_set_error(store, X509_V_OK);
+ ok = 1;
+ }
}
/* Note: return 1 to continue, but unsafe progress will be terminated by SSL */
return ok;
@@ -3414,11 +3442,11 @@ SOAP_FMAC1
int
SOAP_FMAC2
soap_ssl_accept(struct soap *soap)
-{ SOAP_SOCKET fd = soap->socket;
+{ SOAP_SOCKET sk = soap->socket;
#ifdef WITH_OPENSSL
BIO *bio;
int retries, r, s;
- if (!soap_valid_socket(fd))
+ if (!soap_valid_socket(sk))
return soap_set_receiver_error(soap, "SSL/TLS error", "No socket in soap_ssl_accept()", SOAP_SSL_ERROR);
soap->ssl_flags &= ~SOAP_SSL_CLIENT;
if (!soap->ctx && (soap->error = soap->fsslauth(soap)))
@@ -3430,12 +3458,12 @@ soap_ssl_accept(struct soap *soap)
}
else
SSL_clear(soap->ssl);
- bio = BIO_new_socket((int)fd, BIO_NOCLOSE);
+ bio = BIO_new_socket((int)sk, BIO_NOCLOSE);
SSL_set_bio(soap->ssl, bio, bio);
/* Set SSL sockets to non-blocking */
retries = 0;
if (soap->accept_timeout)
- { SOAP_SOCKNONBLOCK(fd)
+ { SOAP_SOCKNONBLOCK(sk)
retries = 10*soap->accept_timeout;
}
if (retries <= 0)
@@ -3447,14 +3475,14 @@ soap_ssl_accept(struct soap *soap)
err = SSL_get_error(soap->ssl, r);
if (err == SSL_ERROR_WANT_ACCEPT || err == SSL_ERROR_WANT_READ || err == SSL_ERROR_WANT_WRITE)
{ if (err == SSL_ERROR_WANT_READ)
- s = tcp_select(soap, fd, SOAP_TCP_SELECT_RCV | SOAP_TCP_SELECT_ERR, -100000);
+ s = tcp_select(soap, sk, SOAP_TCP_SELECT_RCV | SOAP_TCP_SELECT_ERR, -100000);
else
- s = tcp_select(soap, fd, SOAP_TCP_SELECT_SND | SOAP_TCP_SELECT_ERR, -100000);
+ s = tcp_select(soap, sk, SOAP_TCP_SELECT_SND | SOAP_TCP_SELECT_ERR, -100000);
if (s < 0 && soap->errnum != SOAP_EINTR)
break;
}
else
- { soap->errnum = soap_socket_errno(fd);
+ { soap->errnum = soap_socket_errno(sk);
break;
}
}
@@ -3480,17 +3508,17 @@ soap_ssl_accept(struct soap *soap)
#endif
#ifdef WITH_GNUTLS
int retries = 0, r;
- if (!soap_valid_socket(fd))
+ if (!soap_valid_socket(sk))
return soap_set_receiver_error(soap, "SSL/TLS error", "No socket in soap_ssl_accept()", SOAP_SSL_ERROR);
soap->ssl_flags &= ~SOAP_SSL_CLIENT;
if (!soap->session && (soap->error = soap->fsslauth(soap)))
{ soap_closesock(soap);
return soap->error;
}
- gnutls_transport_set_ptr(soap->session, (gnutls_transport_ptr_t)(long)fd);
+ gnutls_transport_set_ptr(soap->session, (gnutls_transport_ptr_t)(long)sk);
/* Set SSL sockets to non-blocking */
if (soap->accept_timeout)
- { SOAP_SOCKNONBLOCK(fd)
+ { SOAP_SOCKNONBLOCK(sk)
retries = 10*soap->accept_timeout;
}
if (retries <= 0)
@@ -3502,14 +3530,14 @@ soap_ssl_accept(struct soap *soap)
break;
if (r == GNUTLS_E_AGAIN || r == GNUTLS_E_INTERRUPTED)
{ if (!gnutls_record_get_direction(soap->session))
- s = tcp_select(soap, fd, SOAP_TCP_SELECT_RCV | SOAP_TCP_SELECT_ERR, -100000);
+ s = tcp_select(soap, sk, SOAP_TCP_SELECT_RCV | SOAP_TCP_SELECT_ERR, -100000);
else
- s = tcp_select(soap, fd, SOAP_TCP_SELECT_SND | SOAP_TCP_SELECT_ERR, -100000);
+ s = tcp_select(soap, sk, SOAP_TCP_SELECT_SND | SOAP_TCP_SELECT_ERR, -100000);
if (s < 0 && soap->errnum != SOAP_EINTR)
break;
}
else
- { soap->errnum = soap_socket_errno(fd);
+ { soap->errnum = soap_socket_errno(sk);
break;
}
}
@@ -3526,9 +3554,9 @@ soap_ssl_accept(struct soap *soap)
}
#endif
if (soap->recv_timeout || soap->send_timeout)
- SOAP_SOCKNONBLOCK(fd)
+ SOAP_SOCKNONBLOCK(sk)
else
- SOAP_SOCKBLOCK(fd)
+ SOAP_SOCKBLOCK(sk)
soap->imode |= SOAP_ENC_SSL;
soap->omode |= SOAP_ENC_SSL;
return SOAP_OK;
@@ -3672,7 +3700,7 @@ tcp_connect(struct soap *soap, const char *endpoint, const char *host, int port)
#ifdef WITH_IPV6
struct addrinfo hints, *res, *ressave;
#endif
- SOAP_SOCKET fd;
+ SOAP_SOCKET sk;
int err = 0;
#ifndef WITH_LEAN
#ifndef WIN32
@@ -3714,7 +3742,7 @@ tcp_connect(struct soap *soap, const char *endpoint, const char *host, int port)
}
ressave = res;
again:
- fd = socket(res->ai_family, res->ai_socktype, res->ai_protocol);
+ sk = socket(res->ai_family, res->ai_socktype, res->ai_protocol);
soap->errmode = 0;
#else
#ifndef WITH_LEAN
@@ -3722,12 +3750,12 @@ again:
#endif
#ifndef WITH_LEAN
if ((soap->omode & SOAP_IO_UDP))
- fd = socket(AF_INET, SOCK_DGRAM, 0);
+ sk = socket(AF_INET, SOCK_DGRAM, 0);
else
#endif
- fd = socket(AF_INET, SOCK_STREAM, 0);
+ sk = socket(AF_INET, SOCK_STREAM, 0);
#endif
- if (!soap_valid_socket(fd))
+ if (!soap_valid_socket(sk))
{
#ifdef WITH_IPV6
if (res->ai_next)
@@ -3735,7 +3763,7 @@ again:
goto again;
}
#endif
- soap->errnum = soap_socket_errno(fd);
+ soap->errnum = soap_socket_errno(sk);
soap_set_sender_error(soap, tcp_error(soap), "socket failed in tcp_connect()", SOAP_TCP_ERROR);
#ifdef WITH_IPV6
freeaddrinfo(ressave);
@@ -3745,10 +3773,10 @@ again:
#ifdef SOCKET_CLOSE_ON_EXEC
#ifdef WIN32
#ifndef UNDER_CE
- SetHandleInformation((HANDLE)fd, HANDLE_FLAG_INHERIT, 0);
+ SetHandleInformation((HANDLE)sk, HANDLE_FLAG_INHERIT, 0);
#endif
#else
- fcntl(fd, F_SETFD, 1);
+ fcntl(sk, F_SETFD, 1);
#endif
#endif
#ifndef WITH_LEAN
@@ -3757,57 +3785,57 @@ again:
memset((void*)&linger, 0, sizeof(linger));
linger.l_onoff = 1;
linger.l_linger = soap->linger_time;
- if (setsockopt(fd, SOL_SOCKET, SO_LINGER, (char*)&linger, sizeof(struct linger)))
- { soap->errnum = soap_socket_errno(fd);
+ if (setsockopt(sk, SOL_SOCKET, SO_LINGER, (char*)&linger, sizeof(struct linger)))
+ { soap->errnum = soap_socket_errno(sk);
soap_set_sender_error(soap, tcp_error(soap), "setsockopt SO_LINGER failed in tcp_connect()", SOAP_TCP_ERROR);
- soap->fclosesocket(soap, fd);
+ soap->fclosesocket(soap, sk);
#ifdef WITH_IPV6
freeaddrinfo(ressave);
#endif
return SOAP_INVALID_SOCKET;
}
}
- else if (soap->connect_flags && setsockopt(fd, SOL_SOCKET, soap->connect_flags, (char*)&set, sizeof(int)))
- { soap->errnum = soap_socket_errno(fd);
+ else if (soap->connect_flags && setsockopt(sk, SOL_SOCKET, soap->connect_flags, (char*)&set, sizeof(int)))
+ { soap->errnum = soap_socket_errno(sk);
soap_set_sender_error(soap, tcp_error(soap), "setsockopt failed in tcp_connect()", SOAP_TCP_ERROR);
- soap->fclosesocket(soap, fd);
+ soap->fclosesocket(soap, sk);
#ifdef WITH_IPV6
freeaddrinfo(ressave);
#endif
return SOAP_INVALID_SOCKET;
}
- if ((soap->keep_alive || soap->tcp_keep_alive) && setsockopt(fd, SOL_SOCKET, SO_KEEPALIVE, (char*)&set, sizeof(int)))
- { soap->errnum = soap_socket_errno(fd);
+ if ((soap->keep_alive || soap->tcp_keep_alive) && setsockopt(sk, SOL_SOCKET, SO_KEEPALIVE, (char*)&set, sizeof(int)))
+ { soap->errnum = soap_socket_errno(sk);
soap_set_sender_error(soap, tcp_error(soap), "setsockopt SO_KEEPALIVE failed in tcp_connect()", SOAP_TCP_ERROR);
- soap->fclosesocket(soap, fd);
+ soap->fclosesocket(soap, sk);
#ifdef WITH_IPV6
freeaddrinfo(ressave);
#endif
return SOAP_INVALID_SOCKET;
}
- if (setsockopt(fd, SOL_SOCKET, SO_SNDBUF, (char*)&len, sizeof(int)))
- { soap->errnum = soap_socket_errno(fd);
+ if (setsockopt(sk, SOL_SOCKET, SO_SNDBUF, (char*)&len, sizeof(int)))
+ { soap->errnum = soap_socket_errno(sk);
soap_set_sender_error(soap, tcp_error(soap), "setsockopt SO_SNDBUF failed in tcp_connect()", SOAP_TCP_ERROR);
- soap->fclosesocket(soap, fd);
+ soap->fclosesocket(soap, sk);
#ifdef WITH_IPV6
freeaddrinfo(ressave);
#endif
return SOAP_INVALID_SOCKET;
}
- if (setsockopt(fd, SOL_SOCKET, SO_RCVBUF, (char*)&len, sizeof(int)))
- { soap->errnum = soap_socket_errno(fd);
+ if (setsockopt(sk, SOL_SOCKET, SO_RCVBUF, (char*)&len, sizeof(int)))
+ { soap->errnum = soap_socket_errno(sk);
soap_set_sender_error(soap, tcp_error(soap), "setsockopt SO_RCVBUF failed in tcp_connect()", SOAP_TCP_ERROR);
- soap->fclosesocket(soap, fd);
+ soap->fclosesocket(soap, sk);
#ifdef WITH_IPV6
freeaddrinfo(ressave);
#endif
return SOAP_INVALID_SOCKET;
}
#ifdef TCP_KEEPIDLE
- if (soap->tcp_keep_idle && setsockopt((SOAP_SOCKET)fd, IPPROTO_TCP, TCP_KEEPIDLE, (char*)&(soap->tcp_keep_idle), sizeof(int)))
- { soap->errnum = soap_socket_errno(fd);
+ if (soap->tcp_keep_idle && setsockopt((SOAP_SOCKET)sk, IPPROTO_TCP, TCP_KEEPIDLE, (char*)&(soap->tcp_keep_idle), sizeof(int)))
+ { soap->errnum = soap_socket_errno(sk);
soap_set_sender_error(soap, tcp_error(soap), "setsockopt TCP_KEEPIDLE failed in tcp_connect()", SOAP_TCP_ERROR);
- soap->fclosesocket(soap, (SOAP_SOCKET)fd);
+ soap->fclosesocket(soap, (SOAP_SOCKET)sk);
#ifdef WITH_IPV6
freeaddrinfo(ressave);
#endif
@@ -3815,10 +3843,10 @@ again:
}
#endif
#ifdef TCP_KEEPINTVL
- if (soap->tcp_keep_intvl && setsockopt((SOAP_SOCKET)fd, IPPROTO_TCP, TCP_KEEPINTVL, (char*)&(soap->tcp_keep_intvl), sizeof(int)))
- { soap->errnum = soap_socket_errno(fd);
+ if (soap->tcp_keep_intvl && setsockopt((SOAP_SOCKET)sk, IPPROTO_TCP, TCP_KEEPINTVL, (char*)&(soap->tcp_keep_intvl), sizeof(int)))
+ { soap->errnum = soap_socket_errno(sk);
soap_set_sender_error(soap, tcp_error(soap), "setsockopt TCP_KEEPINTVL failed in tcp_connect()", SOAP_TCP_ERROR);
- soap->fclosesocket(soap, (SOAP_SOCKET)fd);
+ soap->fclosesocket(soap, (SOAP_SOCKET)sk);
#ifdef WITH_IPV6
freeaddrinfo(ressave);
#endif
@@ -3826,10 +3854,10 @@ again:
}
#endif
#ifdef TCP_KEEPCNT
- if (soap->tcp_keep_cnt && setsockopt((SOAP_SOCKET)fd, IPPROTO_TCP, TCP_KEEPCNT, (char*)&(soap->tcp_keep_cnt), sizeof(int)))
- { soap->errnum = soap_socket_errno(fd);
+ if (soap->tcp_keep_cnt && setsockopt((SOAP_SOCKET)sk, IPPROTO_TCP, TCP_KEEPCNT, (char*)&(soap->tcp_keep_cnt), sizeof(int)))
+ { soap->errnum = soap_socket_errno(sk);
soap_set_sender_error(soap, tcp_error(soap), "setsockopt TCP_KEEPCNT failed in tcp_connect()", SOAP_TCP_ERROR);
- soap->fclosesocket(soap, (SOAP_SOCKET)fd);
+ soap->fclosesocket(soap, (SOAP_SOCKET)sk);
#ifdef WITH_IPV6
freeaddrinfo(ressave);
#endif
@@ -3837,10 +3865,10 @@ again:
}
#endif
#ifdef TCP_NODELAY
- if (!(soap->omode & SOAP_IO_UDP) && setsockopt(fd, IPPROTO_TCP, TCP_NODELAY, (char*)&set, sizeof(int)))
- { soap->errnum = soap_socket_errno(fd);
+ if (!(soap->omode & SOAP_IO_UDP) && setsockopt(sk, IPPROTO_TCP, TCP_NODELAY, (char*)&set, sizeof(int)))
+ { soap->errnum = soap_socket_errno(sk);
soap_set_sender_error(soap, tcp_error(soap), "setsockopt TCP_NODELAY failed in tcp_connect()", SOAP_TCP_ERROR);
- soap->fclosesocket(soap, fd);
+ soap->fclosesocket(soap, sk);
#ifdef WITH_IPV6
freeaddrinfo(ressave);
#endif
@@ -3857,29 +3885,29 @@ again:
if ((soap->omode & SOAP_IO_UDP))
{ if (soap->ipv4_multicast_ttl)
{ unsigned char ttl = soap->ipv4_multicast_ttl;
- if (setsockopt(fd, IPPROTO_IP, IP_MULTICAST_TTL, (char*)&ttl, sizeof(ttl)))
- { soap->errnum = soap_socket_errno(fd);
+ if (setsockopt(sk, IPPROTO_IP, IP_MULTICAST_TTL, (char*)&ttl, sizeof(ttl)))
+ { soap->errnum = soap_socket_errno(sk);
soap_set_sender_error(soap, tcp_error(soap), "setsockopt IP_MULTICAST_TTL failed in tcp_connect()", SOAP_TCP_ERROR);
- soap->fclosesocket(soap, fd);
+ soap->fclosesocket(soap, sk);
return SOAP_INVALID_SOCKET;
}
}
if ((soap->omode & SOAP_IO_UDP) && soap->ipv4_multicast_if && !soap->ipv6_multicast_if)
- { if (setsockopt(fd, IPPROTO_IP, IP_MULTICAST_IF, (char*)soap->ipv4_multicast_if, sizeof(struct in_addr)))
+ { if (setsockopt(sk, IPPROTO_IP, IP_MULTICAST_IF, (char*)soap->ipv4_multicast_if, sizeof(struct in_addr)))
#ifndef WINDOWS
- { soap->errnum = soap_socket_errno(fd);
+ { soap->errnum = soap_socket_errno(sk);
soap_set_sender_error(soap, tcp_error(soap), "setsockopt IP_MULTICAST_IF failed in tcp_connect()", SOAP_TCP_ERROR);
- soap->fclosesocket(soap, fd);
+ soap->fclosesocket(soap, sk);
return SOAP_INVALID_SOCKET;
}
#else
#ifndef IP_MULTICAST_IF
#define IP_MULTICAST_IF 2
#endif
- if (setsockopt(fd, IPPROTO_IP, IP_MULTICAST_IF, (char*)soap->ipv4_multicast_if, sizeof(struct in_addr)))
- { soap->errnum = soap_socket_errno(fd);
+ if (setsockopt(sk, IPPROTO_IP, IP_MULTICAST_IF, (char*)soap->ipv4_multicast_if, sizeof(struct in_addr)))
+ { soap->errnum = soap_socket_errno(sk);
soap_set_sender_error(soap, tcp_error(soap), "setsockopt IP_MULTICAST_IF failed in tcp_connect()", SOAP_TCP_ERROR);
- soap->fclosesocket(soap, fd);
+ soap->fclosesocket(soap, sk);
return SOAP_INVALID_SOCKET;
}
#endif
@@ -3887,7 +3915,7 @@ again:
}
#endif
#endif
- DBGLOG(TEST,SOAP_MESSAGE(fdebug, "Opening socket %d to host='%s' port=%d\n", fd, host, port));
+ DBGLOG(TEST,SOAP_MESSAGE(fdebug, "Opening socket %d to host='%s' port=%d\n", sk, host, port));
#ifndef WITH_IPV6
soap->peerlen = sizeof(soap->peer);
memset((void*)&soap->peer, 0, sizeof(soap->peer));
@@ -3896,7 +3924,7 @@ again:
if (soap->proxy_host)
{ if (soap->fresolve(soap, soap->proxy_host, &soap->peer.sin_addr))
{ soap_set_sender_error(soap, tcp_error(soap), "get proxy host by name failed in tcp_connect()", SOAP_TCP_ERROR);
- soap->fclosesocket(soap, fd);
+ soap->fclosesocket(soap, sk);
return SOAP_INVALID_SOCKET;
}
soap->peer.sin_port = htons((short)soap->proxy_port);
@@ -3904,7 +3932,7 @@ again:
else
{ if (soap->fresolve(soap, host, &soap->peer.sin_addr))
{ soap_set_sender_error(soap, tcp_error(soap), "get host by name failed in tcp_connect()", SOAP_TCP_ERROR);
- soap->fclosesocket(soap, fd);
+ soap->fclosesocket(soap, sk);
return SOAP_INVALID_SOCKET;
}
soap->peer.sin_port = htons((short)port);
@@ -3912,34 +3940,34 @@ again:
soap->errmode = 0;
#ifndef WITH_LEAN
if ((soap->omode & SOAP_IO_UDP))
- return fd;
+ return sk;
#endif
#else
if ((soap->omode & SOAP_IO_UDP))
{ memcpy(&soap->peer, res->ai_addr, res->ai_addrlen);
soap->peerlen = res->ai_addrlen;
freeaddrinfo(ressave);
- return fd;
+ return sk;
}
#endif
#ifndef WITH_LEAN
if (soap->connect_timeout)
- SOAP_SOCKNONBLOCK(fd)
+ SOAP_SOCKNONBLOCK(sk)
else
- SOAP_SOCKBLOCK(fd)
+ SOAP_SOCKBLOCK(sk)
retries = 10;
#endif
for (;;)
{
#ifdef WITH_IPV6
- if (connect(fd, res->ai_addr, (int)res->ai_addrlen))
+ if (connect(sk, res->ai_addr, (int)res->ai_addrlen))
#else
- if (connect(fd, (struct sockaddr*)&soap->peer, sizeof(soap->peer)))
+ if (connect(sk, (struct sockaddr*)&soap->peer, sizeof(soap->peer)))
#endif
- { err = soap_socket_errno(fd);
+ { err = soap_socket_errno(sk);
#ifndef WITH_LEAN
if (err == SOAP_EADDRINUSE)
- { soap->fclosesocket(soap, fd);
+ { soap->fclosesocket(soap, sk);
if (retries-- > 0)
goto again;
}
@@ -3948,13 +3976,13 @@ again:
SOAP_SOCKLEN_T k;
for (;;)
{ register int r;
- r = tcp_select(soap, fd, SOAP_TCP_SELECT_SND, soap->connect_timeout);
+ r = tcp_select(soap, sk, SOAP_TCP_SELECT_SND, soap->connect_timeout);
if (r > 0)
break;
if (!r)
{ DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Connect timeout\n"));
soap_set_sender_error(soap, "Timeout", "connect failed in tcp_connect()", SOAP_TCP_ERROR);
- soap->fclosesocket(soap, fd);
+ soap->fclosesocket(soap, sk);
#ifdef WITH_IPV6
freeaddrinfo(ressave);
#endif
@@ -3964,7 +3992,7 @@ again:
if (r != SOAP_EINTR)
{ DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Could not connect to host\n"));
soap_set_sender_error(soap, tcp_error(soap), "connect failed in tcp_connect()", SOAP_TCP_ERROR);
- soap->fclosesocket(soap, fd);
+ soap->fclosesocket(soap, sk);
#ifdef WITH_IPV6
freeaddrinfo(ressave);
#endif
@@ -3972,13 +4000,13 @@ again:
}
}
k = (SOAP_SOCKLEN_T)sizeof(soap->errnum);
- if (!getsockopt(fd, SOL_SOCKET, SO_ERROR, (char*)&soap->errnum, &k) && !soap->errnum) /* portability note: see SOAP_SOCKLEN_T definition in stdsoap2.h */
+ if (!getsockopt(sk, SOL_SOCKET, SO_ERROR, (char*)&soap->errnum, &k) && !soap->errnum) /* portability note: see SOAP_SOCKLEN_T definition in stdsoap2.h */
break;
DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Could not connect to host\n"));
if (!soap->errnum)
- soap->errnum = soap_socket_errno(fd);
+ soap->errnum = soap_socket_errno(sk);
soap_set_sender_error(soap, tcp_error(soap), "connect failed in tcp_connect()", SOAP_TCP_ERROR);
- soap->fclosesocket(soap, fd);
+ soap->fclosesocket(soap, sk);
#ifdef WITH_IPV6
freeaddrinfo(ressave);
#endif
@@ -3988,7 +4016,7 @@ again:
#ifdef WITH_IPV6
if (res->ai_next)
{ res = res->ai_next;
- soap->fclosesocket(soap, fd);
+ soap->fclosesocket(soap, sk);
goto again;
}
#endif
@@ -3996,7 +4024,7 @@ again:
{ soap->errnum = err;
DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Could not connect to host\n"));
soap_set_sender_error(soap, tcp_error(soap), "connect failed in tcp_connect()", SOAP_TCP_ERROR);
- soap->fclosesocket(soap, fd);
+ soap->fclosesocket(soap, sk);
#ifdef WITH_IPV6
freeaddrinfo(ressave);
#endif
@@ -4010,7 +4038,7 @@ again:
soap->peerlen = 0; /* IPv6: already connected so use send() */
freeaddrinfo(ressave);
#endif
- soap->socket = fd;
+ soap->socket = sk;
soap->imode &= ~SOAP_ENC_SSL;
soap->omode &= ~SOAP_ENC_SSL;
if (!soap_tag_cmp(endpoint, "https:*"))
@@ -4025,46 +4053,45 @@ again:
soap_mode om = soap->omode; /* make sure we only parse HTTP */
size_t n = soap->count; /* save the content length */
const char *userid, *passwd;
+ int status = soap->status; /* save the current status/command */
+ short keep_alive = soap->keep_alive; /* save the KA status */
soap->omode &= ~SOAP_ENC; /* mask IO and ENC */
soap->omode |= SOAP_IO_BUFFER;
DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Connecting to %s proxy server\n", soap->proxy_http_version));
- sprintf(soap->tmpbuf, "CONNECT %s:%d HTTP/%s", host, port, soap->proxy_http_version);
- if (soap_begin_send(soap)
- || (soap->error = soap->fposthdr(soap, soap->tmpbuf, NULL)))
- { soap->fclosesocket(soap, fd);
- return SOAP_INVALID_SOCKET;
- }
-#ifndef WITH_LEAN
- if (soap->proxy_userid && soap->proxy_passwd && strlen(soap->proxy_userid) + strlen(soap->proxy_passwd) < 761)
- { sprintf(soap->tmpbuf + 262, "%s:%s", soap->proxy_userid, soap->proxy_passwd);
- strcpy(soap->tmpbuf, "Basic ");
- soap_s2base64(soap, (const unsigned char*)(soap->tmpbuf + 262), soap->tmpbuf + 6, (int)strlen(soap->tmpbuf + 262));
- if ((soap->error = soap->fposthdr(soap, "Proxy-Authorization", soap->tmpbuf)))
- { soap->fclosesocket(soap, fd);
+#ifdef WITH_NTLM
+ if (soap->ntlm_challenge)
+ { if (soap_ntlm_handshake(soap, SOAP_CONNECT, endpoint, host, port))
return soap->error;
- }
}
#endif
- if ((soap->error = soap->fposthdr(soap, NULL, NULL))
- || soap_flush(soap))
- { soap->fclosesocket(soap, fd);
+ if (soap_begin_send(soap))
+ { soap->fclosesocket(soap, sk);
+ return SOAP_INVALID_SOCKET;
+ }
+ soap->status = SOAP_CONNECT;
+ soap->keep_alive = 1;
+ if ((soap->error = soap->fpost(soap, endpoint, host, port, NULL, NULL, 0))
+ || soap_end_send(soap))
+ { soap->fclosesocket(soap, sk);
return SOAP_INVALID_SOCKET;
}
+ soap->keep_alive = keep_alive;
soap->omode = om;
om = soap->imode;
soap->imode &= ~SOAP_ENC; /* mask IO and ENC */
userid = soap->userid; /* preserve */
passwd = soap->passwd; /* preserve */
if ((soap->error = soap->fparse(soap)))
- { soap->fclosesocket(soap, fd);
+ { soap->fclosesocket(soap, sk);
return SOAP_INVALID_SOCKET;
}
+ soap->status = status; /* restore */
soap->userid = userid; /* restore */
soap->passwd = passwd; /* restore */
soap->imode = om; /* restore */
soap->count = n; /* restore */
if (soap_begin_send(soap))
- { soap->fclosesocket(soap, fd);
+ { soap->fclosesocket(soap, sk);
return SOAP_INVALID_SOCKET;
}
if (endpoint)
@@ -4074,13 +4101,15 @@ again:
#ifdef WITH_OPENSSL
soap->ssl_flags |= SOAP_SSL_CLIENT;
if (!soap->ctx && (soap->error = soap->fsslauth(soap)))
- { soap->fclosesocket(soap, fd);
+ { DBGLOG(TEST, SOAP_MESSAGE(fdebug, "SSL required, but no ctx set\n"));
+ soap->fclosesocket(soap, sk);
+ soap->error = SOAP_SSL_ERROR;
return SOAP_INVALID_SOCKET;
}
if (!soap->ssl)
{ soap->ssl = SSL_new(soap->ctx);
if (!soap->ssl)
- { soap->fclosesocket(soap, fd);
+ { soap->fclosesocket(soap, sk);
soap->error = SOAP_SSL_ERROR;
return SOAP_INVALID_SOCKET;
}
@@ -4095,16 +4124,16 @@ again:
}
soap->imode |= SOAP_ENC_SSL;
soap->omode |= SOAP_ENC_SSL;
- bio = BIO_new_socket((int)fd, BIO_NOCLOSE);
+ bio = BIO_new_socket((int)sk, BIO_NOCLOSE);
SSL_set_bio(soap->ssl, bio, bio);
/* Connect timeout: set SSL sockets to non-blocking */
retries = 0;
if (soap->connect_timeout)
- { SOAP_SOCKNONBLOCK(fd)
+ { SOAP_SOCKNONBLOCK(sk)
retries = 10*soap->connect_timeout;
}
else
- SOAP_SOCKBLOCK(fd)
+ SOAP_SOCKBLOCK(sk)
if (retries <= 0)
retries = 100; /* timeout: 10 sec retries, 100 times 0.1 sec */
/* Try connecting until success or timeout (when nonblocking) */
@@ -4114,37 +4143,37 @@ again:
if (err == SSL_ERROR_WANT_CONNECT || err == SSL_ERROR_WANT_READ || err == SSL_ERROR_WANT_WRITE)
{ register int s;
if (err == SSL_ERROR_WANT_READ)
- s = tcp_select(soap, fd, SOAP_TCP_SELECT_RCV | SOAP_TCP_SELECT_ERR, -100000);
+ s = tcp_select(soap, sk, SOAP_TCP_SELECT_RCV | SOAP_TCP_SELECT_ERR, -100000);
else
- s = tcp_select(soap, fd, SOAP_TCP_SELECT_SND | SOAP_TCP_SELECT_ERR, -100000);
+ s = tcp_select(soap, sk, SOAP_TCP_SELECT_SND | SOAP_TCP_SELECT_ERR, -100000);
if (s < 0 && soap->errnum != SOAP_EINTR)
{ DBGLOG(TEST, SOAP_MESSAGE(fdebug, "SSL_connect/select error in tcp_connect\n"));
soap_set_sender_error(soap, soap_ssl_error(soap, r), "SSL_connect failed in tcp_connect()", SOAP_TCP_ERROR);
- soap->fclosesocket(soap, fd);
+ soap->fclosesocket(soap, sk);
return SOAP_INVALID_SOCKET;
}
if (s == 0 && retries-- <= 0)
{ DBGLOG(TEST, SOAP_MESSAGE(fdebug, "SSL/TLS connect timeout\n"));
soap_set_sender_error(soap, "Timeout", "SSL_connect failed in tcp_connect()", SOAP_TCP_ERROR);
- soap->fclosesocket(soap, fd);
+ soap->fclosesocket(soap, sk);
return SOAP_INVALID_SOCKET;
}
}
else
{ soap_set_sender_error(soap, soap_ssl_error(soap, r), "SSL_connect error in tcp_connect()", SOAP_SSL_ERROR);
- soap->fclosesocket(soap, fd);
+ soap->fclosesocket(soap, sk);
return SOAP_INVALID_SOCKET;
}
}
} while (!SSL_is_init_finished(soap->ssl));
/* Set SSL sockets to nonblocking */
- SOAP_SOCKNONBLOCK(fd)
+ SOAP_SOCKNONBLOCK(sk)
/* Check server credentials when required */
if ((soap->ssl_flags & SOAP_SSL_REQUIRE_SERVER_AUTHENTICATION))
{ int err;
if ((err = SSL_get_verify_result(soap->ssl)) != X509_V_OK)
{ soap_set_sender_error(soap, X509_verify_cert_error_string(err), "SSL/TLS certificate presented by peer cannot be verified in tcp_connect()", SOAP_SSL_ERROR);
- soap->fclosesocket(soap, fd);
+ soap->fclosesocket(soap, sk);
return SOAP_INVALID_SOCKET;
}
if (!(soap->ssl_flags & SOAP_SSL_SKIP_HOST_CHECK))
@@ -4155,7 +4184,7 @@ again:
peer = SSL_get_peer_certificate(soap->ssl);
if (!peer)
{ soap_set_sender_error(soap, "SSL/TLS error", "No SSL/TLS certificate was presented by the peer in tcp_connect()", SOAP_SSL_ERROR);
- soap->fclosesocket(soap, fd);
+ soap->fclosesocket(soap, sk);
return SOAP_INVALID_SOCKET;
}
ext_count = X509_get_ext_count(peer);
@@ -4249,7 +4278,7 @@ again:
X509_free(peer);
if (!ok)
{ soap_set_sender_error(soap, "SSL/TLS error", "SSL/TLS certificate host name mismatch in tcp_connect()", SOAP_SSL_ERROR);
- soap->fclosesocket(soap, fd);
+ soap->fclosesocket(soap, sk);
return SOAP_INVALID_SOCKET;
}
}
@@ -4258,17 +4287,17 @@ again:
#ifdef WITH_GNUTLS
soap->ssl_flags |= SOAP_SSL_CLIENT;
if (!soap->session && (soap->error = soap->fsslauth(soap)))
- { soap->fclosesocket(soap, fd);
+ { soap->fclosesocket(soap, sk);
return SOAP_INVALID_SOCKET;
}
- gnutls_transport_set_ptr(soap->session, (gnutls_transport_ptr_t)(long)fd);
+ gnutls_transport_set_ptr(soap->session, (gnutls_transport_ptr_t)(long)sk);
/* Set SSL sockets to non-blocking */
if (soap->connect_timeout)
- { SOAP_SOCKNONBLOCK(fd)
+ { SOAP_SOCKNONBLOCK(sk)
retries = 10*soap->connect_timeout;
}
else
- SOAP_SOCKBLOCK(fd)
+ SOAP_SOCKBLOCK(sk)
if (retries <= 0)
retries = 100; /* timeout: 10 sec retries, 100 times 0.1 sec */
while ((r = gnutls_handshake(soap->session)))
@@ -4278,42 +4307,42 @@ again:
break;
if (r == GNUTLS_E_AGAIN || r == GNUTLS_E_INTERRUPTED)
{ if (!gnutls_record_get_direction(soap->session))
- s = tcp_select(soap, fd, SOAP_TCP_SELECT_RCV | SOAP_TCP_SELECT_ERR, -100000);
+ s = tcp_select(soap, sk, SOAP_TCP_SELECT_RCV | SOAP_TCP_SELECT_ERR, -100000);
else
- s = tcp_select(soap, fd, SOAP_TCP_SELECT_SND | SOAP_TCP_SELECT_ERR, -100000);
+ s = tcp_select(soap, sk, SOAP_TCP_SELECT_SND | SOAP_TCP_SELECT_ERR, -100000);
if (s < 0 && soap->errnum != SOAP_EINTR)
break;
}
else
- { soap->errnum = soap_socket_errno(fd);
+ { soap->errnum = soap_socket_errno(sk);
break;
}
}
if (r)
{ soap_set_sender_error(soap, soap_ssl_error(soap, r), "SSL/TLS handshake failed", SOAP_SSL_ERROR);
- soap->fclosesocket(soap, fd);
+ soap->fclosesocket(soap, sk);
return SOAP_INVALID_SOCKET;
}
if ((soap->ssl_flags & SOAP_SSL_REQUIRE_SERVER_AUTHENTICATION))
{ const char *err = ssl_verify(soap, host);
if (err)
- { soap->fclosesocket(soap, fd);
+ { soap->fclosesocket(soap, sk);
soap->error = soap_set_sender_error(soap, "SSL/TLS error", err, SOAP_SSL_ERROR);
return SOAP_INVALID_SOCKET;
}
}
#endif
#else
- soap->fclosesocket(soap, fd);
+ soap->fclosesocket(soap, sk);
soap->error = SOAP_SSL_ERROR;
return SOAP_INVALID_SOCKET;
#endif
}
if (soap->recv_timeout || soap->send_timeout)
- SOAP_SOCKNONBLOCK(fd)
+ SOAP_SOCKNONBLOCK(sk)
else
- SOAP_SOCKBLOCK(fd)
- return fd;
+ SOAP_SOCKBLOCK(sk)
+ return sk;
}
#endif
#endif
@@ -4322,7 +4351,7 @@ again:
#ifndef WITH_NOIO
#ifndef PALM_1
static int
-tcp_select(struct soap *soap, SOAP_SOCKET s, int flags, int timeout)
+tcp_select(struct soap *soap, SOAP_SOCKET sk, int flags, int timeout)
{ register int r;
struct timeval tv;
fd_set fd[3], *rfd, *sfd, *efd;
@@ -4333,12 +4362,12 @@ tcp_select(struct soap *soap, SOAP_SOCKET s, int flags, int timeout)
if (1)
#else
/* if fd max set size exceeded, use poll() */
- if ((int)s >= (int)FD_SETSIZE)
+ if ((int)sk >= (int)FD_SETSIZE)
#endif
#ifdef HAVE_POLL
{ struct pollfd pollfd;
int retries = 0;
- pollfd.fd = (int)s;
+ pollfd.fd = (int)sk;
pollfd.events = 0;
if (flags & SOAP_TCP_SELECT_RCV)
pollfd.events |= POLLIN;
@@ -4379,17 +4408,17 @@ tcp_select(struct soap *soap, SOAP_SOCKET s, int flags, int timeout)
if (flags & SOAP_TCP_SELECT_RCV)
{ rfd = &fd[0];
FD_ZERO(rfd);
- FD_SET(s, rfd);
+ FD_SET(sk, rfd);
}
if (flags & SOAP_TCP_SELECT_SND)
{ sfd = &fd[1];
FD_ZERO(sfd);
- FD_SET(s, sfd);
+ FD_SET(sk, sfd);
}
if (flags & SOAP_TCP_SELECT_ERR)
{ efd = &fd[2];
FD_ZERO(efd);
- FD_SET(s, efd);
+ FD_SET(sk, efd);
}
if (timeout >= 0)
{ tv.tv_sec = timeout;
@@ -4399,14 +4428,14 @@ tcp_select(struct soap *soap, SOAP_SOCKET s, int flags, int timeout)
{ tv.tv_sec = -timeout / 1000000;
tv.tv_usec = -timeout % 1000000;
}
- r = select((int)s + 1, rfd, sfd, efd, &tv);
+ r = select((int)sk + 1, rfd, sfd, efd, &tv);
if (r > 0)
{ r = 0;
- if ((flags & SOAP_TCP_SELECT_RCV) && FD_ISSET(s, rfd))
+ if ((flags & SOAP_TCP_SELECT_RCV) && FD_ISSET(sk, rfd))
r |= SOAP_TCP_SELECT_RCV;
- if ((flags & SOAP_TCP_SELECT_SND) && FD_ISSET(s, sfd))
+ if ((flags & SOAP_TCP_SELECT_SND) && FD_ISSET(sk, sfd))
r |= SOAP_TCP_SELECT_SND;
- if ((flags & SOAP_TCP_SELECT_ERR) && FD_ISSET(s, efd))
+ if ((flags & SOAP_TCP_SELECT_ERR) && FD_ISSET(sk, efd))
r |= SOAP_TCP_SELECT_ERR;
}
else if (r < 0)
@@ -4421,18 +4450,19 @@ tcp_select(struct soap *soap, SOAP_SOCKET s, int flags, int timeout)
#ifndef PALM_1
static SOAP_SOCKET
tcp_accept(struct soap *soap, SOAP_SOCKET s, struct sockaddr *a, int *n)
-{ SOAP_SOCKET fd;
- fd = accept(s, a, (SOAP_SOCKLEN_T*)n); /* portability note: see SOAP_SOCKLEN_T definition in stdsoap2.h */
+{ SOAP_SOCKET sk;
+ (void)soap;
+ sk = accept(s, a, (SOAP_SOCKLEN_T*)n); /* portability note: see SOAP_SOCKLEN_T definition in stdsoap2.h */
#ifdef SOCKET_CLOSE_ON_EXEC
#ifdef WIN32
#ifndef UNDER_CE
- SetHandleInformation((HANDLE)fd, HANDLE_FLAG_INHERIT, 0);
+ SetHandleInformation((HANDLE)sk, HANDLE_FLAG_INHERIT, 0);
#endif
#else
- fcntl(fd, F_SETFD, FD_CLOEXEC);
+ fcntl(sk, F_SETFD, FD_CLOEXEC);
#endif
#endif
- return fd;
+ return sk;
}
#endif
#endif
@@ -4533,9 +4563,10 @@ tcp_disconnect(struct soap *soap)
#ifndef WITH_NOIO
#ifndef PALM_1
static int
-tcp_closesocket(struct soap *soap, SOAP_SOCKET fd)
-{ DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Close socket %d\n", (int)fd));
- return soap_closesocket(fd);
+tcp_closesocket(struct soap *soap, SOAP_SOCKET sk)
+{ (void)soap;
+ DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Close socket %d\n", (int)sk));
+ return soap_closesocket(sk);
}
#endif
#endif
@@ -4544,9 +4575,10 @@ tcp_closesocket(struct soap *soap, SOAP_SOCKET fd)
#ifndef WITH_NOIO
#ifndef PALM_1
static int
-tcp_shutdownsocket(struct soap *soap, SOAP_SOCKET fd, int how)
-{ DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Shutdown socket %d how=%d\n", (int)fd, how));
- return shutdown(fd, how);
+tcp_shutdownsocket(struct soap *soap, SOAP_SOCKET sk, int how)
+{ (void)soap;
+ DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Shutdown socket %d how=%d\n", (int)sk, how));
+ return shutdown(sk, how);
}
#endif
#endif
@@ -4569,7 +4601,7 @@ soap_bind(struct soap *soap, const char *host, int port, int backlog)
#endif
#endif
#ifndef WITH_LEAN
-#ifndef WITH_WIN32
+#ifndef WIN32
int len = SOAP_BUFLEN;
#else
int len = SOAP_BUFLEN + 1; /* speeds up windows xfer */
@@ -4623,6 +4655,7 @@ soap_bind(struct soap *soap, const char *host, int port, int backlog)
soap_set_receiver_error(soap, tcp_error(soap), "socket failed in soap_bind()", SOAP_TCP_ERROR);
return SOAP_INVALID_SOCKET;
}
+ soap->port = port;
#ifndef WITH_LEAN
if ((soap->omode & SOAP_IO_UDP))
soap->socket = soap->master;
@@ -4642,7 +4675,7 @@ soap_bind(struct soap *soap, const char *host, int port, int backlog)
soap_set_receiver_error(soap, tcp_error(soap), "setsockopt failed in soap_bind()", SOAP_TCP_ERROR);
return SOAP_INVALID_SOCKET;
}
- if (((soap->imode | soap->omode) & SOAP_IO_KEEPALIVE) && setsockopt(soap->master, SOL_SOCKET, SO_KEEPALIVE, (char*)&set, sizeof(int)))
+ if (((soap->imode | soap->omode) & SOAP_IO_KEEPALIVE) && (!((soap->imode | soap->omode) & SOAP_IO_UDP)) && setsockopt(soap->master, SOL_SOCKET, SO_KEEPALIVE, (char*)&set, sizeof(int)))
{ soap->errnum = soap_socket_errno(soap->master);
soap_set_receiver_error(soap, tcp_error(soap), "setsockopt SO_KEEPALIVE failed in soap_bind()", SOAP_TCP_ERROR);
return SOAP_INVALID_SOCKET;
@@ -4669,14 +4702,14 @@ soap_bind(struct soap *soap, const char *host, int port, int backlog)
#ifdef WITH_IPV6_V6ONLY
if (setsockopt(soap->master, IPPROTO_IPV6, IPV6_V6ONLY, (char*)&set, sizeof(int)))
{ soap->errnum = soap_socket_errno(soap->master);
- soap_set_receiver_error(soap, tcp_error(soap), "setsockopt IPV6_V6ONLY failed in soap_bind()", SOAP_TCP_ERROR);
+ soap_set_receiver_error(soap, tcp_error(soap), "setsockopt set IPV6_V6ONLY failed in soap_bind()", SOAP_TCP_ERROR);
return SOAP_INVALID_SOCKET;
}
#endif
#ifdef WITH_NO_IPV6_V6ONLY
if (setsockopt(soap->master, IPPROTO_IPV6, IPV6_V6ONLY, (char*)&unset, sizeof(int)))
{ soap->errnum = soap_socket_errno(soap->master);
- soap_set_receiver_error(soap, tcp_error(soap), "setsockopt IPV6_V6ONLY failed in soap_bind()", SOAP_TCP_ERROR);
+ soap_set_receiver_error(soap, tcp_error(soap), "setsockopt unset IPV6_V6ONLY failed in soap_bind()", SOAP_TCP_ERROR);
return SOAP_INVALID_SOCKET;
}
#endif
@@ -4784,8 +4817,9 @@ SOAP_SOCKET
SOAP_FMAC2
soap_accept(struct soap *soap)
{ int n = (int)sizeof(soap->peer);
+ register int err;
#ifndef WITH_LEAN
-#ifndef WITH_WIN32
+#ifndef WIN32
int len = SOAP_BUFLEN;
#else
int len = SOAP_BUFLEN + 1; /* speeds up windows xfer */
@@ -4793,124 +4827,123 @@ soap_accept(struct soap *soap)
int set = 1;
#endif
soap->error = SOAP_OK;
-#ifndef WITH_LEAN
- if ((soap->omode & SOAP_IO_UDP))
- return soap->socket = soap->master;
-#endif
memset((void*)&soap->peer, 0, sizeof(soap->peer));
soap->socket = SOAP_INVALID_SOCKET;
soap->errmode = 0;
soap->keep_alive = 0;
- if (soap_valid_socket(soap->master))
- { register int err;
- for (;;)
- { if (soap->accept_timeout || soap->send_timeout || soap->recv_timeout)
- { for (;;)
- { register int r;
- r = tcp_select(soap, soap->master, SOAP_TCP_SELECT_ALL, soap->accept_timeout ? soap->accept_timeout : 60);
- if (r > 0)
- break;
- if (!r && soap->accept_timeout)
- { soap_set_receiver_error(soap, "Timeout", "accept failed in soap_accept()", SOAP_TCP_ERROR);
+ if (!soap_valid_socket(soap->master))
+ { soap->errnum = 0;
+ soap_set_receiver_error(soap, tcp_error(soap), "no master socket in soap_accept()", SOAP_TCP_ERROR);
+ return SOAP_INVALID_SOCKET;
+ }
+#ifndef WITH_LEAN
+ if ((soap->omode & SOAP_IO_UDP))
+ return soap->socket = soap->master;
+#endif
+ for (;;)
+ { if (soap->accept_timeout || soap->send_timeout || soap->recv_timeout)
+ { for (;;)
+ { register int r;
+ r = tcp_select(soap, soap->master, SOAP_TCP_SELECT_ALL, soap->accept_timeout ? soap->accept_timeout : 60);
+ if (r > 0)
+ break;
+ if (!r && soap->accept_timeout)
+ { soap_set_receiver_error(soap, "Timeout", "accept failed in soap_accept()", SOAP_TCP_ERROR);
+ return SOAP_INVALID_SOCKET;
+ }
+ if (r < 0)
+ { r = soap->errnum;
+ if (r != SOAP_EINTR)
+ { soap_closesock(soap);
+ soap_set_sender_error(soap, tcp_error(soap), "accept failed in soap_accept()", SOAP_TCP_ERROR);
return SOAP_INVALID_SOCKET;
}
- if (r < 0)
- { r = soap->errnum;
- if (r != SOAP_EINTR)
- { soap_closesock(soap);
- soap_set_sender_error(soap, tcp_error(soap), "accept failed in soap_accept()", SOAP_TCP_ERROR);
- return SOAP_INVALID_SOCKET;
- }
- }
}
}
- if (soap->accept_timeout)
- SOAP_SOCKNONBLOCK(soap->master)
- else
- SOAP_SOCKBLOCK(soap->master)
- soap->socket = soap->faccept(soap, soap->master, (struct sockaddr*)&soap->peer, &n);
- soap->peerlen = (size_t)n;
- if (soap_valid_socket(soap->socket))
- {
+ }
+ if (soap->accept_timeout)
+ SOAP_SOCKNONBLOCK(soap->master)
+ else
+ SOAP_SOCKBLOCK(soap->master)
+ soap->socket = soap->faccept(soap, soap->master, (struct sockaddr*)&soap->peer, &n);
+ soap->peerlen = (size_t)n;
+ if (soap_valid_socket(soap->socket))
+ {
#ifdef WITH_IPV6
-/* Use soap->host to store the numeric form of the remote host */
- getnameinfo((struct sockaddr*)&soap->peer, n, soap->host, sizeof(soap->host), NULL, 0, NI_NUMERICHOST | NI_NUMERICSERV);
- DBGLOG(TEST,SOAP_MESSAGE(fdebug, "Accept socket %d from %s\n", soap->socket, soap->host));
- soap->ip = 0; /* info stored in soap->peer and soap->host */
- soap->port = 0; /* info stored in soap->peer and soap->host */
+ unsigned int ip1, ip2, ip3, ip4;
+ char port[16];
+ getnameinfo((struct sockaddr*)&soap->peer, n, soap->host, sizeof(soap->host), port, 16, NI_NUMERICHOST | NI_NUMERICSERV);
+ sscanf(soap->host, "%u.%u.%u.%u", &ip1, &ip2, &ip3, &ip4);
+ soap->ip = (unsigned long)ip1 << 24 | (unsigned long)ip2 << 16 | (unsigned long)ip3 << 8 | (unsigned long)ip4;
+ soap->port = soap_strtol(port, NULL, 10);
#else
- soap->ip = ntohl(soap->peer.sin_addr.s_addr);
- soap->port = (int)ntohs(soap->peer.sin_port); /* does not return port number on some systems */
- DBGLOG(TEST,SOAP_MESSAGE(fdebug, "Accept socket %d at port %d from IP %d.%d.%d.%d\n", soap->socket, soap->port, (int)(soap->ip>>24)&0xFF, (int)(soap->ip>>16)&0xFF, (int)(soap->ip>>8)&0xFF, (int)soap->ip&0xFF));
+ soap->ip = ntohl(soap->peer.sin_addr.s_addr);
+ sprintf(soap->host, "%u.%u.%u.%u", (int)(soap->ip>>24)&0xFF, (int)(soap->ip>>16)&0xFF, (int)(soap->ip>>8)&0xFF, (int)soap->ip&0xFF);
+ soap->port = (int)ntohs(soap->peer.sin_port); /* does not return port number on some systems */
#endif
+ DBGLOG(TEST,SOAP_MESSAGE(fdebug, "Accept socket %d at port %d from IP %s\n", soap->socket, soap->port, soap->host));
#ifndef WITH_LEAN
- if (soap->accept_flags == SO_LINGER)
- { struct linger linger;
- memset((void*)&linger, 0, sizeof(linger));
- linger.l_onoff = 1;
- linger.l_linger = soap->linger_time;
- if (setsockopt(soap->socket, SOL_SOCKET, SO_LINGER, (char*)&linger, sizeof(struct linger)))
- { soap->errnum = soap_socket_errno(soap->socket);
- soap_set_receiver_error(soap, tcp_error(soap), "setsockopt SO_LINGER failed in soap_accept()", SOAP_TCP_ERROR);
- soap_closesock(soap);
- return SOAP_INVALID_SOCKET;
- }
- }
- else if (soap->accept_flags && setsockopt(soap->socket, SOL_SOCKET, soap->accept_flags, (char*)&set, sizeof(int)))
+ if (soap->accept_flags == SO_LINGER)
+ { struct linger linger;
+ memset((void*)&linger, 0, sizeof(linger));
+ linger.l_onoff = 1;
+ linger.l_linger = soap->linger_time;
+ if (setsockopt(soap->socket, SOL_SOCKET, SO_LINGER, (char*)&linger, sizeof(struct linger)))
{ soap->errnum = soap_socket_errno(soap->socket);
- soap_set_receiver_error(soap, tcp_error(soap), "setsockopt failed in soap_accept()", SOAP_TCP_ERROR);
- soap_closesock(soap);
- return SOAP_INVALID_SOCKET;
- }
- if (((soap->imode | soap->omode) & SOAP_IO_KEEPALIVE) && setsockopt(soap->socket, SOL_SOCKET, SO_KEEPALIVE, (char*)&set, sizeof(int)))
- { soap->errnum = soap_socket_errno(soap->socket);
- soap_set_receiver_error(soap, tcp_error(soap), "setsockopt SO_KEEPALIVE failed in soap_accept()", SOAP_TCP_ERROR);
- soap_closesock(soap);
- return SOAP_INVALID_SOCKET;
- }
- if (setsockopt(soap->socket, SOL_SOCKET, SO_SNDBUF, (char*)&len, sizeof(int)))
- { soap->errnum = soap_socket_errno(soap->socket);
- soap_set_receiver_error(soap, tcp_error(soap), "setsockopt SO_SNDBUF failed in soap_accept()", SOAP_TCP_ERROR);
- soap_closesock(soap);
- return SOAP_INVALID_SOCKET;
- }
- if (setsockopt(soap->socket, SOL_SOCKET, SO_RCVBUF, (char*)&len, sizeof(int)))
- { soap->errnum = soap_socket_errno(soap->socket);
- soap_set_receiver_error(soap, tcp_error(soap), "setsockopt SO_RCVBUF failed in soap_accept()", SOAP_TCP_ERROR);
+ soap_set_receiver_error(soap, tcp_error(soap), "setsockopt SO_LINGER failed in soap_accept()", SOAP_TCP_ERROR);
soap_closesock(soap);
return SOAP_INVALID_SOCKET;
}
+ }
+ else if (soap->accept_flags && setsockopt(soap->socket, SOL_SOCKET, soap->accept_flags, (char*)&set, sizeof(int)))
+ { soap->errnum = soap_socket_errno(soap->socket);
+ soap_set_receiver_error(soap, tcp_error(soap), "setsockopt failed in soap_accept()", SOAP_TCP_ERROR);
+ soap_closesock(soap);
+ return SOAP_INVALID_SOCKET;
+ }
+ if (((soap->imode | soap->omode) & SOAP_IO_KEEPALIVE) && setsockopt(soap->socket, SOL_SOCKET, SO_KEEPALIVE, (char*)&set, sizeof(int)))
+ { soap->errnum = soap_socket_errno(soap->socket);
+ soap_set_receiver_error(soap, tcp_error(soap), "setsockopt SO_KEEPALIVE failed in soap_accept()", SOAP_TCP_ERROR);
+ soap_closesock(soap);
+ return SOAP_INVALID_SOCKET;
+ }
+ if (setsockopt(soap->socket, SOL_SOCKET, SO_SNDBUF, (char*)&len, sizeof(int)))
+ { soap->errnum = soap_socket_errno(soap->socket);
+ soap_set_receiver_error(soap, tcp_error(soap), "setsockopt SO_SNDBUF failed in soap_accept()", SOAP_TCP_ERROR);
+ soap_closesock(soap);
+ return SOAP_INVALID_SOCKET;
+ }
+ if (setsockopt(soap->socket, SOL_SOCKET, SO_RCVBUF, (char*)&len, sizeof(int)))
+ { soap->errnum = soap_socket_errno(soap->socket);
+ soap_set_receiver_error(soap, tcp_error(soap), "setsockopt SO_RCVBUF failed in soap_accept()", SOAP_TCP_ERROR);
+ soap_closesock(soap);
+ return SOAP_INVALID_SOCKET;
+ }
#ifdef TCP_NODELAY
- if (!(soap->omode & SOAP_IO_UDP) && setsockopt(soap->socket, IPPROTO_TCP, TCP_NODELAY, (char*)&set, sizeof(int)))
- { soap->errnum = soap_socket_errno(soap->socket);
- soap_set_receiver_error(soap, tcp_error(soap), "setsockopt TCP_NODELAY failed in soap_accept()", SOAP_TCP_ERROR);
- soap_closesock(soap);
- return SOAP_INVALID_SOCKET;
- }
-#endif
-#endif
- soap->keep_alive = (((soap->imode | soap->omode) & SOAP_IO_KEEPALIVE) != 0);
- if (soap->send_timeout || soap->recv_timeout)
- SOAP_SOCKNONBLOCK(soap->socket)
- else
- SOAP_SOCKBLOCK(soap->socket)
- return soap->socket;
- }
- err = soap_socket_errno(soap->socket);
- if (err != 0 && err != SOAP_EINTR && err != SOAP_EAGAIN && err != SOAP_EWOULDBLOCK)
- { DBGLOG(TEST,SOAP_MESSAGE(fdebug, "Accept failed from %s\n", soap->host));
- soap->errnum = err;
- soap_set_receiver_error(soap, tcp_error(soap), "accept failed in soap_accept()", SOAP_TCP_ERROR);
+ if (setsockopt(soap->socket, IPPROTO_TCP, TCP_NODELAY, (char*)&set, sizeof(int)))
+ { soap->errnum = soap_socket_errno(soap->socket);
+ soap_set_receiver_error(soap, tcp_error(soap), "setsockopt TCP_NODELAY failed in soap_accept()", SOAP_TCP_ERROR);
soap_closesock(soap);
return SOAP_INVALID_SOCKET;
}
+#endif
+#endif
+ soap->keep_alive = (((soap->imode | soap->omode) & SOAP_IO_KEEPALIVE) != 0);
+ if (soap->send_timeout || soap->recv_timeout)
+ SOAP_SOCKNONBLOCK(soap->socket)
+ else
+ SOAP_SOCKBLOCK(soap->socket)
+ return soap->socket;
+ }
+ err = soap_socket_errno(soap->socket);
+ if (err != 0 && err != SOAP_EINTR && err != SOAP_EAGAIN && err != SOAP_EWOULDBLOCK)
+ { DBGLOG(TEST,SOAP_MESSAGE(fdebug, "Accept failed from %s\n", soap->host));
+ soap->errnum = err;
+ soap_set_receiver_error(soap, tcp_error(soap), "accept failed in soap_accept()", SOAP_TCP_ERROR);
+ soap_closesock(soap);
+ return SOAP_INVALID_SOCKET;
}
}
- else
- { soap->errnum = 0;
- soap_set_receiver_error(soap, tcp_error(soap), "no master socket in soap_accept()", SOAP_TCP_ERROR);
- return SOAP_INVALID_SOCKET;
- }
}
#endif
#endif
@@ -4949,6 +4982,19 @@ soap_closesock(struct soap *soap)
#endif
/******************************************************************************/
+#ifndef PALM_1
+SOAP_FMAC1
+int
+SOAP_FMAC2
+soap_force_closesock(struct soap *soap)
+{ soap->keep_alive = 0;
+ if (soap_valid_socket(soap->socket))
+ return soap_closesocket(soap->socket);
+ return SOAP_OK;
+}
+#endif
+
+/******************************************************************************/
#ifndef WITH_NOIO
#ifndef PALM_2
SOAP_FMAC1
@@ -5004,11 +5050,11 @@ soap_done(struct soap *soap)
soap->fmalloc = NULL;
#ifndef WITH_NOHTTP
soap->fpost = http_post;
- soap->fput = http_put;
soap->fget = http_get;
+ soap->fput = http_405;
soap->fdel = http_405;
- soap->fopt = http_405;
- soap->fhead = http_405;
+ soap->fopt = http_200;
+ soap->fhead = http_200;
soap->fform = NULL;
soap->fposthdr = http_post_header;
soap->fresponse = http_response;
@@ -5106,7 +5152,11 @@ soap_done(struct soap *soap)
}
#endif
#ifdef WITH_C_LOCALE
+# ifdef WIN32
+ _free_locale(soap->c_locale);
+# else
freelocale(soap->c_locale);
+# endif
#endif
#ifdef WITH_ZLIB
if (soap->d_stream)
@@ -5147,16 +5197,24 @@ soap_done(struct soap *soap)
int
http_parse(struct soap *soap)
{ char header[SOAP_HDRLEN], *s;
- unsigned short httpcmd = 0, status = 0;
+ unsigned short httpcmd = 0;
+ int status = 0;
DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Waiting for HTTP request/response...\n"));
*soap->endpoint = '\0';
soap->length = 0;
- soap->userid = NULL;
- soap->passwd = NULL;
- soap->action = NULL;
- soap->authrealm = NULL;
+#ifdef WITH_NTLM
+ if (!soap->ntlm_challenge)
+#endif
+ { soap->userid = NULL;
+ soap->passwd = NULL;
+ soap->authrealm = NULL;
+ }
+#ifdef WITH_NTLM
+ soap->ntlm_challenge = NULL;
+#endif
soap->proxy_from = NULL;
soap->http_content = NULL;
+ soap->action = NULL;
soap->status = 0;
do
{ if (soap_getline(soap, soap->msgbuf, sizeof(soap->msgbuf)))
@@ -5245,6 +5303,8 @@ http_parse(struct soap *soap)
n = sizeof(soap->endpoint) - 1;
strncpy(soap->path, soap->msgbuf + l, n - m);
soap->path[n - m] = '\0';
+ if (*soap->path && *soap->path != '/')
+ *soap->endpoint = '\0';
strcat(soap->endpoint, soap->path);
DBGLOG(TEST,SOAP_MESSAGE(fdebug, "Target endpoint='%s'\n", soap->endpoint));
if (httpcmd > 1)
@@ -5277,7 +5337,7 @@ http_parse(struct soap *soap)
may not have a body. When content length, content type, or chunking is
used assume there is a message to parse, either XML or HTTP.
*/
- if (soap->length > 0 || (soap->http_content && soap->recv_timeout) || (soap->imode & SOAP_IO) == SOAP_IO_CHUNK)
+ if (soap->length > 0 || (soap->http_content && (!soap->keep_alive || soap->recv_timeout)) || (soap->imode & SOAP_IO) == SOAP_IO_CHUNK)
{ if ((soap->status > 200 && soap->status <= 299)
|| soap->status == 400
|| soap->status == 500)
@@ -5392,8 +5452,14 @@ http_parse_header(struct soap *soap, const char *key, const char *val)
}
}
}
- else if (!soap_tag_cmp(key, "WWW-Authenticate"))
- { soap->authrealm = soap_strdup(soap, soap_get_header_attribute(soap, val + 6, "realm"));
+ else if (!soap_tag_cmp(key, "WWW-Authenticate") || !soap_tag_cmp(key, "Proxy-Authenticate"))
+ {
+#ifdef WITH_NTLM
+ if (!soap_tag_cmp(val, "NTLM*"))
+ soap->ntlm_challenge = soap_strdup(soap, val + 4);
+ else
+#endif
+ soap->authrealm = soap_strdup(soap, soap_get_header_attribute(soap, val + 6, "realm"));
}
else if (!soap_tag_cmp(key, "Expect"))
{ if (!soap_tag_cmp(val, "100-continue"))
@@ -5522,6 +5588,7 @@ soap_decode(char *buf, size_t len, const char *val, const char *sep)
static const char*
http_error(struct soap *soap, int status)
{ register const char *msg = SOAP_STR_EOS;
+ (void)soap;
#ifndef WITH_LEAN
msg = soap_code_str(h_http_error_codes, status);
if (!msg)
@@ -5533,21 +5600,25 @@ http_error(struct soap *soap, int status)
#endif
/******************************************************************************/
+
#ifndef WITH_NOHTTP
#ifndef PALM_1
static int
-http_put(struct soap *soap)
-{ return http_parse(soap);
+http_get(struct soap *soap)
+{ (void)soap;
+ DBGLOG(TEST, SOAP_MESSAGE(fdebug, "HTTP GET request\n"));
+ return SOAP_GET_METHOD;
}
#endif
#endif
-/******************************************************************************/
+/******************************************************************************/
#ifndef WITH_NOHTTP
#ifndef PALM_1
static int
-http_get(struct soap *soap)
-{ return SOAP_GET_METHOD;
+http_405(struct soap *soap)
+{ return 405;
+ (void)soap;
}
#endif
#endif
@@ -5556,8 +5627,8 @@ http_get(struct soap *soap)
#ifndef WITH_NOHTTP
#ifndef PALM_1
static int
-http_405(struct soap *soap)
-{ return 405;
+http_200(struct soap *soap)
+{ return soap_send_empty_response(soap, 200);
}
#endif
#endif
@@ -5569,10 +5640,23 @@ static int
http_post(struct soap *soap, const char *endpoint, const char *host, int port, const char *path, const char *action, size_t count)
{ register const char *s;
register int err;
- if (soap->status == SOAP_GET)
- s = "GET";
- else
- s = "POST";
+ switch (soap->status)
+ { case SOAP_GET:
+ s = "GET";
+ break;
+ case SOAP_PUT:
+ s = "PUT";
+ break;
+ case SOAP_DEL:
+ s = "DELETE";
+ break;
+ case SOAP_CONNECT:
+ s = "CONNECT";
+ break;
+ default:
+ s = "POST";
+ }
+ DBGLOG(TEST, SOAP_MESSAGE(fdebug, "HTTP %s to %s\n", s, endpoint ? endpoint : "(null)"));
#ifdef PALM
if (!endpoint || (soap_tag_cmp(endpoint, "http:*") && soap_tag_cmp(endpoint, "https:*") && strncmp(endpoint, "httpg:", 6)) && strncmp(endpoint, "_beam:", 6) && strncmp(endpoint, "_local:", 7) && strncmp(endpoint, "_btobex:", 8))
#else
@@ -5580,24 +5664,30 @@ http_post(struct soap *soap, const char *endpoint, const char *host, int port, c
#endif
return SOAP_OK;
if (strlen(endpoint) + strlen(soap->http_version) > sizeof(soap->tmpbuf) - 80)
- return soap->error = SOAP_EOM;
- if (soap->proxy_host && soap_tag_cmp(endpoint, "https:*"))
+ return soap->error = SOAP_EOM; /* prevent overrun */
+ if (soap->status == SOAP_CONNECT)
+ sprintf(soap->tmpbuf, "%s %s:%d HTTP/%s", s, soap->host, soap->port, soap->http_version);
+ else if (soap->proxy_host && endpoint)
sprintf(soap->tmpbuf, "%s %s HTTP/%s", s, endpoint, soap->http_version);
else
sprintf(soap->tmpbuf, "%s /%s HTTP/%s", s, (*path == '/' ? path + 1 : path), soap->http_version);
if ((err = soap->fposthdr(soap, soap->tmpbuf, NULL)))
return err;
#ifdef WITH_OPENSSL
- if ((soap->ssl && soap->port != 443) || (!soap->ssl && soap->port != 80))
- sprintf(soap->tmpbuf, "%s:%d", host, port);
- else
- strcpy(soap->tmpbuf, host);
+ if ((soap->ssl && port != 443) || (!soap->ssl && port != 80))
#else
if (port != 80)
- sprintf(soap->tmpbuf, "%s:%d", host, port);
+#endif
+ {
+#ifdef WITH_IPV6
+ if (*host != '[' && strchr(host, ':'))
+ sprintf(soap->tmpbuf, "[%s]:%d", host, port); /* RFC 2732 */
+ else
+#endif
+ sprintf(soap->tmpbuf, "%s:%d", host, port);
+ }
else
strcpy(soap->tmpbuf, host);
-#endif
if ((err = soap->fposthdr(soap, "Host", soap->tmpbuf)))
return err;
if ((err = soap->fposthdr(soap, "User-Agent", "gSOAP/2.8")))
@@ -5614,16 +5704,30 @@ http_post(struct soap *soap, const char *endpoint, const char *host, int port, c
#endif
#ifndef WITH_LEAN
if (soap->userid && soap->passwd && strlen(soap->userid) + strlen(soap->passwd) < 761)
- { sprintf(soap->tmpbuf + 262, "%s:%s", soap->userid, soap->passwd);
- strcpy(soap->tmpbuf, "Basic ");
- soap_s2base64(soap, (const unsigned char*)(soap->tmpbuf + 262), soap->tmpbuf + 6, (int)strlen(soap->tmpbuf + 262));
+ {
+#ifdef WITH_NTLM
+ if (soap->ntlm_challenge && strlen(soap->ntlm_challenge) + 6 < sizeof(soap->tmpbuf))
+ sprintf(soap->tmpbuf, "NTLM %s", soap->ntlm_challenge);
+ else
+#endif
+ { strcpy(soap->tmpbuf, "Basic ");
+ sprintf(soap->tmpbuf + 262, "%s:%s", soap->userid, soap->passwd);
+ soap_s2base64(soap, (const unsigned char*)(soap->tmpbuf + 262), soap->tmpbuf + 6, (int)strlen(soap->tmpbuf + 262));
+ }
if ((err = soap->fposthdr(soap, "Authorization", soap->tmpbuf)))
return err;
}
if (soap->proxy_userid && soap->proxy_passwd && strlen(soap->proxy_userid) + strlen(soap->proxy_passwd) < 761)
- { sprintf(soap->tmpbuf + 262, "%s:%s", soap->proxy_userid, soap->proxy_passwd);
- strcpy(soap->tmpbuf, "Basic ");
- soap_s2base64(soap, (const unsigned char*)(soap->tmpbuf + 262), soap->tmpbuf + 6, (int)strlen(soap->tmpbuf + 262));
+ {
+#ifdef WITH_NTLM
+ if (soap->ntlm_challenge && strlen(soap->ntlm_challenge) + 6 < sizeof(soap->tmpbuf))
+ sprintf(soap->tmpbuf, "NTLM %s", soap->ntlm_challenge);
+ else
+#endif
+ { strcpy(soap->tmpbuf, "Basic ");
+ sprintf(soap->tmpbuf + 262, "%s:%s", soap->proxy_userid, soap->proxy_passwd);
+ soap_s2base64(soap, (const unsigned char*)(soap->tmpbuf + 262), soap->tmpbuf + 6, (int)strlen(soap->tmpbuf + 262));
+ }
if ((err = soap->fposthdr(soap, "Proxy-Authorization", soap->tmpbuf)))
return err;
}
@@ -5637,7 +5741,7 @@ http_post(struct soap *soap, const char *endpoint, const char *host, int port, c
return soap->error;
#endif
#endif
- if (soap->status != SOAP_GET && soap->version == 1)
+ if (action && soap->status != SOAP_GET && soap->status != SOAP_DEL)
{ sprintf(soap->tmpbuf, "\"%s\"", action && strlen(action) < sizeof(soap->tmpbuf) - 3 ? action : SOAP_STR_EOS);
if ((err = soap->fposthdr(soap, "SOAPAction", soap->tmpbuf)))
return err;
@@ -5699,7 +5803,7 @@ http_response(struct soap *soap, int status, size_t count)
if (count || ((soap->omode & SOAP_IO) == SOAP_IO_CHUNK))
s = "200 OK";
else
- s = "202 ACCEPTED";
+ s = "202 Accepted";
DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Status = %s\n", s));
#ifdef WMW_RPM_IO
if (soap->rpmreqid || soap_valid_socket(soap->master) || soap_valid_socket(soap->socket)) /* RPM behaves as if standalone */
@@ -5842,9 +5946,9 @@ soap_cookie(struct soap *soap, const char *name, const char *domain, const char
path = SOAP_STR_EOS;
else if (*path == '/')
path++;
- DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Search cookie %s domain=%s path=%s\n", name, domain?domain:"(null)", path?path:"(null)"));
+ DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Search cookie %s domain=%s path=%s\n", name, domain ? domain : "(null)", path ? path : "(null)"));
for (p = soap->cookies; p; p = p->next)
- { DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Cookie in database: %s=%s domain=%s path=%s env=%hd\n", p->name, p->value?p->value:"(null)", p->domain?p->domain:"(null)", p->path?p->path:"(null)", p->env));
+ { DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Cookie in database: %s=%s domain=%s path=%s env=%hd\n", p->name, p->value ? p->value : "(null)", p->domain ? p->domain : "(null)", p->path ? p->path : "(null)", p->env));
if (!strcmp(p->name, name)
&& p->domain
&& p->path
@@ -5871,7 +5975,7 @@ soap_set_cookie(struct soap *soap, const char *name, const char *value, const ch
else if (*path == '/')
path++;
q = soap_cookie(soap, name, domain, path);
- DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Set %scookie: %s=%s domain=%s path=%s\n", q ? SOAP_STR_EOS : "new ", name, value?value:"(null)", domain?domain:"(null)", path?path:"(null)"));
+ DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Set %scookie: %s=%s domain=%s path=%s\n", q ? SOAP_STR_EOS : "new ", name, value ? value : "(null)", domain ? domain : "(null)", path ? path : "(null)"));
if (!q)
{ if ((q = (struct soap_cookie*)SOAP_MALLOC(soap, sizeof(struct soap_cookie))))
{ if ((q->name = (char*)SOAP_MALLOC(soap, strlen(name)+1)))
@@ -5940,13 +6044,13 @@ soap_clr_cookie(struct soap *soap, const char *name, const char *domain, const c
if (!domain)
domain = soap->cookie_domain;
if (!domain)
- { DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Error in clear cookie %s: cookie domain not set\n", name?name:"(null)"));
+ { DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Error in clear cookie %s: cookie domain not set\n", name ? name : "(null)"));
return;
}
if (!path)
path = soap->cookie_path;
if (!path)
- { DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Error in clear cookie %s: cookie path not set\n", name?name:"(null)"));
+ { DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Error in clear cookie %s: cookie path not set\n", name ? name : "(null)"));
return;
}
if (*path == '/')
@@ -6006,7 +6110,7 @@ int
SOAP_FMAC2
soap_set_cookie_expire(struct soap *soap, const char *name, long expire, const char *domain, const char *path)
{ struct soap_cookie *p;
- DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Set cookie expiration max-age %ld: %s domain=%s path=%s\n", expire, name, domain?domain:"(null)", path?path:"(null)"));
+ DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Set cookie expiration max-age %ld: %s domain=%s path=%s\n", expire, name, domain ? domain : "(null)", path ? path : "(null)"));
if ((p = soap_cookie(soap, name, domain, path)))
{ p->maxage = expire;
p->modified = 1;
@@ -6123,6 +6227,9 @@ soap_putcookies(struct soap *soap, const char *domain, const char *path, int sec
unsigned int version = 0;
time_t now = time(NULL);
char *s, tmp[4096];
+ if (!domain || !path)
+ return SOAP_OK;
+ s = tmp;
p = &soap->cookies;
DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Sending cookies for domain=%s path=%s\n", domain, path));
if (*path == '/')
@@ -6169,30 +6276,53 @@ soap_putcookies(struct soap *soap, const char *domain, const char *path, int sec
if (flag
&& (!q->path || !strncmp(q->path, path, strlen(q->path)))
&& (!q->secure || secure))
- { s = tmp;
+ { size_t n = 12;
+ if (q->name)
+ n += 3*strlen(q->name);
+ if (q->value && *q->value)
+ n += 3*strlen(q->value) + 1;
+ if (q->path && *q->path)
+ n += strlen(q->path) + 9;
+ if (q->domain)
+ n += strlen(q->domain) + 11;
+ if (tmp - s + n > sizeof(tmp))
+ { if (s == tmp)
+ return SOAP_OK; /* HTTP header size overflow */
+ DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Cookie: %s\n", tmp));
+ if ((soap->error = soap->fposthdr(soap, "Cookie", tmp)))
+ return soap->error;
+ s = tmp;
+ }
+ else if (s != tmp)
+ { strcat(s, " ");
+ s++;
+ }
if (q->version != version)
{ sprintf(s, "$Version=%u;", q->version);
version = q->version;
+ s += strlen(s);
}
if (q->name)
- s += soap_encode_cookie(q->name, s, tmp-s+4080);
+ s += soap_encode_cookie(q->name, s, tmp+sizeof(tmp)-s-16);
if (q->value && *q->value)
{ *s++ = '=';
- s += soap_encode_cookie(q->value, s, tmp-s+4080);
+ s += soap_encode_cookie(q->value, s, tmp+sizeof(tmp)-s-16);
}
- if (q->path && *q->path && (int)strlen(q->path) < tmp-s+4080)
+ if (q->path)
{ sprintf(s, ";$Path=\"/%s\"", (*q->path == '/' ? q->path + 1 : q->path));
s += strlen(s);
}
- if (q->domain && (int)strlen(q->domain) < tmp-s+4080)
- sprintf(s, ";$Domain=\"%s\"", q->domain);
- DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Cookie: %s\n", tmp));
- if ((soap->error = soap->fposthdr(soap, "Cookie", tmp)))
- return soap->error;
+ if (q->domain)
+ { sprintf(s, ";$Domain=\"%s\"", q->domain);
+ s += strlen(s);
+ }
}
p = &q->next;
}
}
+ if (s != tmp)
+ if ((soap->error = soap->fposthdr(soap, "Cookie", tmp)))
+ return soap->error;
return SOAP_OK;
}
@@ -6322,7 +6452,7 @@ soap_getcookies(struct soap *soap, const char *val)
p->secure = 1;
else
{ if (p)
- { DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Got environment cookie %s=%s domain=%s path=%s expire=%ld secure=%d\n", p->name, p->value?p->value:"(null)", p->domain?p->domain:"(null)", p->path?p->path:"(null)", p->expire, p->secure));
+ { DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Got environment cookie %s=%s domain=%s path=%s expire=%ld secure=%d\n", p->name, p->value ? p->value : "(null)", p->domain ? p->domain : "(null)", p->path ? p->path : "(null)", p->expire, p->secure));
if ((q = soap_set_cookie(soap, p->name, p->value, p->domain, p->path)))
{ q->version = p->version;
q->expire = p->expire;
@@ -6374,7 +6504,7 @@ soap_getcookies(struct soap *soap, const char *val)
}
}
if (p)
- { DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Got environment cookie %s=%s domain=%s path=%s expire=%ld secure=%d\n", p->name, p->value?p->value:"(null)", p->domain?p->domain:"(null)", p->path?p->path:"(null)", p->expire, p->secure));
+ { DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Got environment cookie %s=%s domain=%s path=%s expire=%ld secure=%d\n", p->name, p->value ? p->value : "(null)", p->domain ? p->domain : "(null)", p->path ? p->path : "(null)", p->expire, p->secure));
if ((q = soap_set_cookie(soap, p->name, p->value, p->domain, p->path)))
{ q->version = p->version;
q->expire = p->expire;
@@ -6506,30 +6636,10 @@ soap_init_pht(struct soap *soap)
SOAP_FMAC1
struct soap*
SOAP_FMAC2
-soap_new1(soap_mode mode)
-{ return soap_new2(mode, mode);
-}
-#endif
-
-/******************************************************************************/
-#ifndef PALM_1
-SOAP_FMAC1
-struct soap*
-SOAP_FMAC2
-soap_new()
-{ return soap_new2(SOAP_IO_DEFAULT, SOAP_IO_DEFAULT);
-}
-#endif
-
-/******************************************************************************/
-#ifndef PALM_1
-SOAP_FMAC1
-struct soap*
-SOAP_FMAC2
-soap_new2(soap_mode imode, soap_mode omode)
+soap_versioning(soap_new)(soap_mode imode, soap_mode omode)
{ struct soap *soap = (struct soap*)malloc(sizeof(struct soap));
if (soap)
- soap_init2(soap, imode, omode);
+ soap_versioning(soap_init)(soap, imode, omode);
return soap;
}
#endif
@@ -6597,6 +6707,7 @@ soap_embed(struct soap *soap, const void *p, const struct soap_array *a, int n,
soap_set_embedded(soap, pp);
}
return i;
+ (void)soap;
}
#endif
#endif
@@ -6649,7 +6760,7 @@ soap_pointer_enter(struct soap *soap, const void *p, const struct soap_array *a,
h = soap_hash_ptr(a->__ptr);
else
h = soap_hash_ptr(p);
- DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Pointer enter location=%p array=%p size=%d dim=%d type=%d id=%d\n", p, a?a->__ptr:NULL, a?a->__size:0, n, type, soap->idnum+1));
+ DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Pointer enter location=%p array=%p size=%d dim=%d type=%d id=%d\n", p, a ? a->__ptr : NULL, a ? a->__size : 0, n, type, soap->idnum+1));
pp->next = soap->pht[h];
pp->type = type;
pp->mark1 = 0;
@@ -6659,6 +6770,7 @@ soap_pointer_enter(struct soap *soap, const void *p, const struct soap_array *a,
soap->pht[h] = pp;
pp->id = ++soap->idnum;
return pp->id;
+ (void)n;
}
#endif
#endif
@@ -6747,6 +6859,7 @@ soap_begin_count(struct soap *soap)
soap->encoding = 0;
soap->part = SOAP_BEGIN;
soap->event = 0;
+ soap->evlev = 0;
soap->idnum = 0;
soap_clr_attr(soap);
soap_set_local_namespaces(soap);
@@ -6829,7 +6942,7 @@ soap_begin_send(struct soap *soap)
#ifdef WIN32
#ifndef UNDER_CE
#ifndef WITH_FASTCGI
- if (!soap_valid_socket(soap->socket)) /* Set win32 stdout or soap->sendfd to BINARY, e.g. to support DIME */
+ if (!soap_valid_socket(soap->socket) && !soap->os) /* Set win32 stdout or soap->sendfd to BINARY, e.g. to support DIME */
#ifdef __BORLANDC__
setmode(soap->sendfd, _O_BINARY);
#else
@@ -7084,7 +7197,7 @@ soap_attachment(struct soap *soap, const char *tag, int id, const void *p, const
int i;
if (!p || !a->__ptr || (!aid && !atype))
return soap_element_id(soap, tag, id, p, a, n, type, t);
- DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Attachment tag='%s' id='%s' (%d) type='%s'\n", tag, aid?aid:SOAP_STR_EOS, id, atype?atype:SOAP_STR_EOS));
+ DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Attachment tag='%s' id='%s' (%d) type='%s'\n", tag, aid ? aid : SOAP_STR_EOS, id, atype ? atype : SOAP_STR_EOS));
i = soap_array_pointer_lookup(soap, p, a, n, t, &pp);
if (!i)
{ i = soap_pointer_enter(soap, p, a, n, t, &pp);
@@ -7213,7 +7326,7 @@ soap_enter(struct soap *soap, const char *id)
ip = (struct soap_ilist*)SOAP_MALLOC(soap, sizeof(struct soap_ilist) + strlen(id));
if (ip)
{ h = soap_hash(id);
- strcpy(ip->id, id);
+ strcpy((char*)ip->id, id);
ip->next = soap->iht[h];
soap->iht[h] = ip;
}
@@ -7400,13 +7513,16 @@ soap_dealloc(struct soap *soap, void *p)
SOAP_FREE(soap, q);
}
/* we must assume these were deallocated: */
+ soap->http_content = NULL;
soap->action = NULL;
soap->fault = NULL;
soap->header = NULL;
soap->userid = NULL;
soap->passwd = NULL;
soap->authrealm = NULL;
- soap->http_content = NULL;
+#ifdef WITH_NTLM
+ soap->ntlm_challenge = NULL;
+#endif
#ifndef WITH_LEANER
soap_clr_mime(soap);
#endif
@@ -7537,32 +7653,33 @@ soap_link(struct soap *soap, void *p, int t, int n, int (*fdelete)(struct soap_c
/******************************************************************************/
#ifndef PALM_2
SOAP_FMAC1
-void
+int
SOAP_FMAC2
soap_unlink(struct soap *soap, const void *p)
{ register char **q;
register struct soap_clist **cp;
- if (!soap || !p)
- return;
- for (q = (char**)&soap->alist; *q; q = *(char***)q)
- { if (p == (void*)(*q - *(size_t*)(*q + sizeof(void*))))
- { *q = **(char***)q;
- DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Unlinked data %p\n", p));
+ if (soap && p)
+ { for (q = (char**)&soap->alist; *q; q = *(char***)q)
+ { if (p == (void*)(*q - *(size_t*)(*q + sizeof(void*))))
+ { *q = **(char***)q;
+ DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Unlinked data %p\n", p));
#ifdef SOAP_MEM_DEBUG
- soap_track_unlink(soap, p);
+ soap_track_unlink(soap, p);
#endif
- return;
+ return SOAP_OK; /* found and removed from dealloc chain */
+ }
}
- }
- for (cp = &soap->clist; *cp; cp = &(*cp)->next)
- { if (p == (*cp)->ptr)
- { DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Unlinked class instance %p\n", p));
- q = (char**)*cp;
- *cp = (*cp)->next;
- SOAP_FREE(soap, q);
- return;
+ for (cp = &soap->clist; *cp; cp = &(*cp)->next)
+ { if (p == (*cp)->ptr)
+ { DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Unlinked class instance %p\n", p));
+ q = (char**)*cp;
+ *cp = (*cp)->next;
+ SOAP_FREE(soap, q);
+ return SOAP_OK; /* found and removed from dealloc chain */
+ }
}
}
+ return SOAP_ERR;
}
#endif
@@ -7802,6 +7919,7 @@ SOAP_FMAC2
soap_fcopy(struct soap *soap, int st, int tt, void *p, size_t len, const void *q, size_t n)
{ DBGLOG(TEST,SOAP_MESSAGE(fdebug, "Copying data type=%d (target type=%d) %p -> %p (%lu bytes)\n", st, tt, q, p, (unsigned long)n));
memcpy(p, q, n);
+ (void)soap; (void)st; (void)tt; (void)len;
}
#endif
@@ -7867,7 +7985,7 @@ soap_end_send(struct soap *soap)
soap->mode &= ~SOAP_ENC_ZLIB;
soap->zlib_state = SOAP_ZLIB_NONE;
if (deflateEnd(soap->d_stream) != Z_OK || r != Z_STREAM_END)
- { DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Unable to end deflate: %s\n", soap->d_stream->msg?soap->d_stream->msg:SOAP_STR_EOS));
+ { DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Unable to end deflate: %s\n", soap->d_stream->msg ? soap->d_stream->msg : SOAP_STR_EOS));
return soap->error = SOAP_ZLIB_ERROR;
}
#ifdef WITH_GZIP
@@ -8004,7 +8122,7 @@ soap_end_recv(struct soap *soap)
for (i = 0; i < 8; i++)
{ if ((int)(c = soap_get1(soap)) == EOF)
{ DBGLOG(TEST,SOAP_MESSAGE(fdebug, "Gzip error: unable to read crc value\n"));
- return soap->error = SOAP_EOF;
+ return soap->error = SOAP_ZLIB_ERROR;
}
soap->z_buf[i] = (char)c;
}
@@ -8232,6 +8350,7 @@ soap_copy_context(struct soap *copy, const struct soap *soap)
return NULL;
if (copy)
{ register struct soap_plugin *p = NULL;
+ DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Copying context\n"));
#ifdef __cplusplus
*copy = *soap;
#else
@@ -8241,6 +8360,9 @@ soap_copy_context(struct soap *copy, const struct soap *soap)
copy->error = SOAP_OK;
copy->userid = NULL;
copy->passwd = NULL;
+#ifdef WITH_NTLM
+ copy->ntlm_challenge = NULL;
+#endif
copy->nlist = NULL;
copy->blist = NULL;
copy->clist = NULL;
@@ -8260,8 +8382,18 @@ soap_copy_context(struct soap *copy, const struct soap *soap)
soap_set_sent_logfile(copy, soap->logfile[SOAP_INDEX_SENT]);
soap_set_recv_logfile(copy, soap->logfile[SOAP_INDEX_RECV]);
#endif
+ copy->namespaces = NULL;
+ copy->local_namespaces = NULL;
+ if (soap->local_namespaces)
+ soap_set_namespaces(copy, soap->local_namespaces);
+ else
+ soap_set_namespaces(copy, soap->namespaces);
#ifdef WITH_C_LOCALE
+# ifdef WIN32
+ copy->c_locale = _create_locale(LC_ALL, "C");
+# else
copy->c_locale = duplocale(soap->c_locale);
+# endif
#else
copy->c_locale = NULL;
#endif
@@ -8326,7 +8458,10 @@ soap_copy_stream(struct soap *copy, struct soap *soap)
copy->mode = soap->mode;
copy->imode = soap->imode;
copy->omode = soap->omode;
+ copy->master = soap->master;
copy->socket = soap->socket;
+ copy->sendsk = soap->sendsk;
+ copy->recvsk = soap->recvsk;
copy->recv_timeout = soap->recv_timeout;
copy->send_timeout = soap->send_timeout;
#if defined(__cplusplus) && !defined(WITH_LEAN)
@@ -8350,23 +8485,27 @@ soap_copy_stream(struct soap *copy, struct soap *soap)
#ifndef WITH_NOIO
copy->peer = soap->peer;
copy->peerlen = soap->peerlen;
+ copy->ip = soap->ip;
+ copy->port = soap->port;
+ memcpy(copy->host, soap->host, sizeof(soap->host));
+ memcpy(copy->endpoint, soap->endpoint, sizeof(soap->endpoint));
#endif
#ifdef WITH_OPENSSL
- copy->bio = NULL;
- copy->ctx = NULL;
- copy->ssl = NULL;
- if (soap->ssl)
- copy->ssl = SSL_dup(soap->ssl);
+ copy->bio = soap->bio;
+ copy->ctx = soap->ctx;
+ copy->ssl = soap->ssl;
#endif
#ifdef WITH_GNUTLS
- copy->session = soap->session; /* TODO: Oops, GNUTLS provides a dup? */
+ copy->session = soap->session;
#endif
#ifdef WITH_ZLIB
copy->zlib_state = soap->zlib_state;
copy->zlib_in = soap->zlib_in;
copy->zlib_out = soap->zlib_out;
- copy->d_stream = (z_stream*)SOAP_MALLOC(copy, sizeof(z_stream));
- memcpy(copy->d_stream, soap->d_stream, sizeof(z_stream));
+ if (!copy->d_stream)
+ copy->d_stream = (z_stream*)SOAP_MALLOC(copy, sizeof(z_stream));
+ if (copy->d_stream)
+ memcpy(copy->d_stream, soap->d_stream, sizeof(z_stream));
copy->z_crc = soap->z_crc;
copy->z_ratio_in = soap->z_ratio_in;
copy->z_ratio_out = soap->z_ratio_out;
@@ -8375,7 +8514,8 @@ soap_copy_stream(struct soap *copy, struct soap *soap)
copy->z_level = soap->z_level;
if (soap->z_buf && soap->zlib_state != SOAP_ZLIB_NONE)
{ copy->z_buf = (char*)SOAP_MALLOC(copy, SOAP_BUFLEN);
- memcpy(copy->z_buf, soap->z_buf, sizeof(soap->z_buf));
+ if (copy->z_buf)
+ memcpy(copy->z_buf, soap->z_buf, SOAP_BUFLEN);
}
copy->z_dict = soap->z_dict;
copy->z_dict_len = soap->z_dict_len;
@@ -8411,10 +8551,18 @@ soap_copy_stream(struct soap *copy, struct soap *soap)
SOAP_FREE(copy, nq);
}
}
- copy->level = soap->level;
+ memcpy(copy->tag, soap->tag, sizeof(copy->tag));
+ memcpy(copy->id, soap->id, sizeof(copy->id));
+ memcpy(copy->href, soap->href, sizeof(copy->href));
+ memcpy(copy->type, soap->type, sizeof(copy->type));
+ copy->other = soap->other;
+ copy->root = soap->root;
+ copy->null = soap->null;
copy->body = soap->body;
+ copy->part = soap->part;
+ copy->mustUnderstand = soap->mustUnderstand;
+ copy->level = soap->level;
copy->peeked = soap->peeked;
- memcpy(copy->tag, soap->tag, sizeof(copy->tag));
/* copy attributes */
for (tq = soap->attributes; tq; tq = tq->next)
{ struct soap_attribute *tr = tp;
@@ -8440,24 +8588,22 @@ void
SOAP_FMAC2
soap_free_stream(struct soap *soap)
{ soap->socket = SOAP_INVALID_SOCKET;
+ soap->sendsk = SOAP_INVALID_SOCKET;
+ soap->recvsk = SOAP_INVALID_SOCKET;
#ifdef WITH_OPENSSL
soap->bio = NULL;
- if (soap->ssl)
- SSL_free(soap->ssl);
+ soap->ctx = NULL;
soap->ssl = NULL;
#endif
#ifdef WITH_GNUTLS
soap->xcred = NULL;
soap->acred = NULL;
soap->cache = NULL;
- soap->session = NULL; /* TODO: GNUTLS free here when dupped */
+ soap->session = NULL;
soap->dh_params = NULL;
soap->rsa_params = NULL;
#endif
#ifdef WITH_ZLIB
- if (soap->d_stream)
- SOAP_FREE(soap, soap->d_stream);
- soap->d_stream = NULL;
if (soap->z_buf)
SOAP_FREE(soap, soap->z_buf);
soap->z_buf = NULL;
@@ -8470,7 +8616,7 @@ soap_free_stream(struct soap *soap)
SOAP_FMAC1
void
SOAP_FMAC2
-soap_init(struct soap *soap)
+soap_versioning(soap_init)(struct soap *soap, soap_mode imode, soap_mode omode)
{ size_t i;
soap->state = SOAP_INIT;
#ifdef SOAP_MEM_DEBUG
@@ -8480,7 +8626,7 @@ soap_init(struct soap *soap)
soap_init_logs(soap);
#endif
#ifdef SOAP_DEBUG
-#ifdef TANDEM
+#ifdef TANDEM_NONSTOP
soap_set_test_logfile(soap, "TESTLOG");
soap_set_sent_logfile(soap, "SENTLOG");
soap_set_recv_logfile(soap, "RECVLOG");
@@ -8491,21 +8637,26 @@ soap_init(struct soap *soap)
#endif
#endif
soap->version = 0;
- soap_imode(soap, SOAP_IO_DEFAULT);
- soap_omode(soap, SOAP_IO_DEFAULT);
+ soap_mode(soap, imode);
+ soap_imode(soap, imode);
+ soap_omode(soap, omode);
soap->plugins = NULL;
soap->user = NULL;
for (i = 0; i < sizeof(soap->data)/sizeof(*soap->data); i++)
soap->data[i] = NULL;
soap->userid = NULL;
soap->passwd = NULL;
+ soap->authrealm = NULL;
+#ifdef WITH_NTLM
+ soap->ntlm_challenge = NULL;
+#endif
#ifndef WITH_NOHTTP
soap->fpost = http_post;
- soap->fput = http_put;
soap->fget = http_get;
+ soap->fput = http_405;
soap->fdel = http_405;
- soap->fopt = http_405;
- soap->fhead = http_405;
+ soap->fopt = http_200;
+ soap->fhead = http_200;
soap->fform = NULL;
soap->fposthdr = http_post_header;
soap->fresponse = http_response;
@@ -8611,6 +8762,8 @@ soap_init(struct soap *soap)
soap->fault = NULL;
soap->master = SOAP_INVALID_SOCKET;
soap->socket = SOAP_INVALID_SOCKET;
+ soap->sendsk = SOAP_INVALID_SOCKET;
+ soap->recvsk = SOAP_INVALID_SOCKET;
soap->os = NULL;
soap->is = NULL;
#ifndef WITH_LEANER
@@ -8639,7 +8792,6 @@ soap_init(struct soap *soap)
soap->proxy_port = 8080;
soap->proxy_userid = NULL;
soap->proxy_passwd = NULL;
- soap->authrealm = NULL;
soap->prolog = NULL;
#ifdef WITH_ZLIB
soap->zlib_state = SOAP_ZLIB_NONE;
@@ -8709,7 +8861,11 @@ soap_init(struct soap *soap)
soap->rsa_params = NULL;
#endif
#ifdef WITH_C_LOCALE
+# ifdef WIN32
+ soap->c_locale = _create_locale(LC_ALL, "C");
+# else
soap->c_locale = newlocale(LC_ALL_MASK, "C", NULL);
+# endif
#else
soap->c_locale = NULL;
#endif
@@ -8726,6 +8882,7 @@ soap_init(struct soap *soap)
soap->ns = 0;
soap->part = SOAP_END;
soap->event = 0;
+ soap->evlev = 0;
soap->alloced = 0;
soap->count = 0;
soap->length = 0;
@@ -8740,28 +8897,6 @@ soap_init(struct soap *soap)
#endif
/******************************************************************************/
-#ifndef PALM_1
-SOAP_FMAC1
-void
-SOAP_FMAC2
-soap_init1(struct soap *soap, soap_mode mode)
-{ soap_init2(soap, mode, mode);
-}
-#endif
-
-/******************************************************************************/
-#ifndef PALM_1
-SOAP_FMAC1
-void
-SOAP_FMAC2
-soap_init2(struct soap *soap, soap_mode imode, soap_mode omode)
-{ soap_init(soap);
- soap_imode(soap, imode);
- soap_omode(soap, omode);
-}
-#endif
-
-/******************************************************************************/
#ifndef PALM_2
SOAP_FMAC1
void
@@ -8772,7 +8907,6 @@ soap_begin(struct soap *soap)
{ soap->buflen = 0;
soap->bufidx = 0;
}
- soap->keep_alive = (((soap->imode | soap->omode) & SOAP_IO_KEEPALIVE) != 0);
soap->null = 0;
soap->position = 0;
soap->encoding = 0;
@@ -8781,6 +8915,7 @@ soap_begin(struct soap *soap)
soap->ns = 0;
soap->part = SOAP_END;
soap->event = 0;
+ soap->evlev = 0;
soap->alloced = 0;
soap->count = 0;
soap->length = 0;
@@ -8903,6 +9038,8 @@ soap_set_local_namespaces(struct soap *soap)
soap->version = 2;
}
soap->local_namespaces = ns2;
+ for (; ns2->id; ns2++)
+ ns2->out = NULL;
}
}
}
@@ -8976,7 +9113,7 @@ soap_push_ns(struct soap *soap, const char *id, const char *ns, short utilized)
return NULL;
}
}
- DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Adding namespace binding (level=%u) '%s' '%s' utilized=%d\n", soap->level, id, ns?ns:"(null)", utilized));
+ DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Adding namespace binding (level=%u) '%s' '%s' utilized=%d\n", soap->level, id, ns ? ns : "(null)", utilized));
n = strlen(id);
if (ns)
k = strlen(ns);
@@ -8989,9 +9126,9 @@ soap_push_ns(struct soap *soap, const char *id, const char *ns, short utilized)
}
np->next = soap->nlist;
soap->nlist = np;
- strcpy(np->id, id);
+ strcpy((char*)np->id, id);
if (ns)
- np->ns = strcpy(np->id + n + 1, ns);
+ np->ns = strcpy((char*)np->id + n + 1, ns);
else
np->ns = NULL;
np->level = soap->level;
@@ -9003,8 +9140,13 @@ soap_push_ns(struct soap *soap, const char *id, const char *ns, short utilized)
/******************************************************************************/
#ifndef WITH_LEAN
static void
-soap_utilize_ns(struct soap *soap, const char *tag, size_t n)
-{ register struct soap_nlist *np = soap_lookup_ns(soap, tag, n);
+soap_utilize_ns(struct soap *soap, const char *tag)
+{ register struct soap_nlist *np;
+ size_t n = 0;
+ const char *t = strchr(tag, ':');
+ if (t)
+ n = t - tag;
+ np = soap_lookup_ns(soap, tag, n);
DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Utilizing namespace of '%s'\n", tag));
if (np)
{ if (np->index == 0)
@@ -9028,7 +9170,8 @@ soap_element(struct soap *soap, const char *tag, int id, const char *type)
#ifndef WITH_LEAN
register const char *s;
#endif
- DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Element begin tag='%s' id='%d' type='%s'\n", tag, id, type?type:SOAP_STR_EOS));
+ DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Element begin tag='%s' level='%u' id='%d' type='%s'\n", tag, soap->level, id, type ? type : SOAP_STR_EOS));
+ soap->level++;
#ifdef WITH_DOM
#ifndef WITH_LEAN
if (soap->wsuid && soap_tagsearch(soap->wsuid, tag))
@@ -9039,12 +9182,20 @@ soap_element(struct soap *soap, const char *tag, int id, const char *type)
if (soap_set_attr(soap, "wsu:Id", soap->tag, 1))
return soap->error;
}
- if (soap->event == SOAP_SEC_BEGIN && (soap->mode & SOAP_XML_CANONICAL) && !(soap->mode & SOAP_DOM_ASIS))
- { register struct soap_nlist *np;
- /* wsu:Id found: clear xmlns renderings, so re-emit them for exc-c14n */
- for (np = soap->nlist; np; np = np->next)
- { if (np->index == 2)
- np->index = 0;
+ if ((soap->mode & SOAP_XML_CANONICAL) && !(soap->mode & SOAP_DOM_ASIS))
+ { if (soap->evlev >= soap->level)
+ soap->evlev = 0;
+ if (soap->event == SOAP_SEC_BEGIN && !soap->evlev)
+ { register struct soap_nlist *np;
+ /* non-nested wsu:Id found: clear xmlns, re-emit them for exc-c14n */
+ for (np = soap->nlist; np; np = np->next)
+ { if (np->index == 2)
+ { struct soap_nlist *np1 = soap_push_ns(soap, np->id, np->ns, 1);
+ if (np1)
+ np1->index = 0;
+ }
+ }
+ soap->evlev = soap->level;
}
}
#endif
@@ -9080,7 +9231,6 @@ soap_element(struct soap *soap, const char *tag, int id, const char *type)
else
{
#endif
- soap->level++;
#ifndef WITH_LEAN
if (!soap->ns)
{ if (!(soap->mode & SOAP_XML_CANONICAL)
@@ -9135,26 +9285,30 @@ soap_element(struct soap *soap, const char *tag, int id, const char *type)
soap->ns = 1; /* namespace table control: ns = 0 or 2 to start, then 1 to stop dumping the table */
#ifndef WITH_LEAN
if (soap->mode & SOAP_XML_CANONICAL)
- { const char *t = strchr(tag, ':');
- if (t)
- soap_utilize_ns(soap, tag, t - tag);
- }
+ soap_utilize_ns(soap, tag);
#endif
if (id > 0)
{ sprintf(soap->tmpbuf, "_%d", id);
if (soap_attribute(soap, "id", soap->tmpbuf))
return soap->error;
}
- if (type && *type && soap->part != SOAP_IN_HEADER) /* TODO: filter Header? */
- { if (soap_attribute(soap, "xsi:type", type))
- return soap->error;
+ if (type && *type && !(soap->mode & SOAP_XML_NOTYPE) && soap->part != SOAP_IN_HEADER)
+ { const char *t = type;
#ifndef WITH_LEAN
- if (soap->mode & SOAP_XML_CANONICAL)
- { const char *t = strchr(type, ':');
+ if (soap->mode & SOAP_XML_DEFAULTNS)
+ { t = strchr(type, ':');
if (t)
- soap_utilize_ns(soap, type, t - type);
+ t++;
+ else
+ t = type;
}
#endif
+ if (soap->attributes ? soap_set_attr(soap, "xsi:type", t, 1) : soap_attribute(soap, "xsi:type", t))
+ return soap->error;
+#ifndef WITH_LEAN
+ if (soap->mode & SOAP_XML_CANONICAL)
+ soap_utilize_ns(soap, type);
+#endif
}
if (soap->null && soap->position > 0)
{ register int i;
@@ -9189,8 +9343,8 @@ soap_element(struct soap *soap, const char *tag, int id, const char *type)
}
soap->null = 0;
soap->position = 0;
- if (soap->event == SOAP_SEC_BEGIN && (soap->mode & SOAP_XML_CANONICAL))
- soap->event = SOAP_SEC_SIGN;
+ if (soap->event == SOAP_SEC_BEGIN)
+ soap->event = 0;
return SOAP_OK;
}
#endif
@@ -9358,10 +9512,7 @@ soap_array_begin_out(struct soap *soap, const char *tag, int id, const char *typ
}
#ifndef WITH_LEAN
if ((soap->mode & SOAP_XML_CANONICAL))
- { const char *s = strchr(type, ':');
- if (s)
- soap_utilize_ns(soap, type, s - type);
- }
+ soap_utilize_ns(soap, type);
#endif
return soap_element_start_end_out(soap, NULL);
}
@@ -9379,14 +9530,11 @@ soap_element_start_end_out(struct soap *soap, const char *tag)
{ struct soap_nlist *np;
for (tp = soap->attributes; tp; tp = tp->next)
{ if (tp->visible && tp->name)
- { const char *s = strchr(tp->name, ':');
- if (s)
- soap_utilize_ns(soap, tp->name, s - tp->name);
- }
+ soap_utilize_ns(soap, tp->name);
}
for (np = soap->nlist; np; np = np->next)
{ if (np->index == 1 && np->ns)
- { sprintf(soap->tmpbuf, "xmlns:%s", np->id);
+ { sprintf(soap->tmpbuf, *(np->id) ? "xmlns:%s" : "xmlns", np->id);
DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Enabling utilized binding (level=%u) %s='%s'\n", np->level, soap->tmpbuf, np->ns));
soap_set_attr(soap, soap->tmpbuf, np->ns, 1);
np->index = 2;
@@ -9636,6 +9784,7 @@ soap_check_result(struct soap *soap, const char *tag)
{ soap_instring(soap, ":result", NULL, NULL, 0, 2, -1, -1);
/* just ignore content for compliance reasons, but should compare tag to element's QName value? */
}
+ (void)tag;
}
#endif
@@ -9664,16 +9813,9 @@ soap_attribute(struct soap *soap, const char *name, const char *value)
#endif
#ifndef WITH_LEAN
if (soap->mode & SOAP_XML_CANONICAL)
- { /* TODO: consider using this code to handle default namespace bindings
+ { /* push namespace */
if (!strncmp(name, "xmlns", 5) && (name[5] == ':' || name[5] == '\0'))
- { if (name[5] == ':')
- soap_push_ns(soap, name + 6, value, 0);
- else
- soap_push_ns(soap, "", value, 0);
- }
- */
- if (!strncmp(name, "xmlns:", 6))
- soap_push_ns(soap, name + 6, value, 0);
+ soap_push_ns(soap, name + 5 + (name[5] == ':'), value, 0);
else if (soap_set_attr(soap, name, value, 1))
return soap->error;
}
@@ -9710,7 +9852,8 @@ soap_element_begin_in(struct soap *soap, const char *tag, int nillable, const ch
return soap->error = SOAP_NULL;
if (soap->body)
soap->level++;
- DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Begin element found (level=%u) '%s'='%s'\n", soap->level, soap->tag, tag?tag:SOAP_STR_EOS ));
+ DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Begin element found (level=%u) '%s'='%s'\n", soap->level, soap->tag, tag ? tag : SOAP_STR_EOS ));
+ soap->error = SOAP_OK;
}
}
else if (soap->error == SOAP_NO_TAG && tag && *tag == '-')
@@ -9749,7 +9892,7 @@ soap_element_end_in(struct soap *soap, const char *tag)
do
{ while (((c = soap_get(soap)) != SOAP_TT))
{ if ((int)c == EOF)
- return soap->error = SOAP_EOF;
+ return soap->error = SOAP_CHK_EOF;
if (c == SOAP_LT)
n++;
else if (c == '/')
@@ -9769,7 +9912,7 @@ soap_element_end_in(struct soap *soap, const char *tag)
}
*s = '\0';
if ((int)c == EOF)
- return soap->error = SOAP_EOF;
+ return soap->error = SOAP_CHK_EOF;
while (soap_blank(c))
c = soap_get(soap);
if (c != SOAP_GT)
@@ -9784,12 +9927,12 @@ soap_element_end_in(struct soap *soap, const char *tag)
if (tag && (soap->mode & SOAP_XML_STRICT))
{ soap_pop_namespace(soap);
if (soap_match_tag(soap, soap->tag, tag))
- { DBGLOG(TEST, SOAP_MESSAGE(fdebug, "End element tag '%s' does not match '%s'\n", soap->tag, tag?tag:SOAP_STR_EOS));
+ { DBGLOG(TEST, SOAP_MESSAGE(fdebug, "End element tag '%s' does not match '%s'\n", soap->tag, tag ? tag : SOAP_STR_EOS));
return soap->error = SOAP_SYNTAX_ERROR;
}
}
#endif
- DBGLOG(TEST, SOAP_MESSAGE(fdebug, "End element found (level=%u) '%s'='%s'\n", soap->level, soap->tag, tag?tag:SOAP_STR_EOS));
+ DBGLOG(TEST, SOAP_MESSAGE(fdebug, "End element found (level=%u) '%s'='%s'\n", soap->level, soap->tag, tag ? tag : SOAP_STR_EOS));
soap->level--;
return SOAP_OK;
}
@@ -9831,7 +9974,7 @@ soap_set_attr(struct soap *soap, const char *name, const char *value, int flag)
{ register struct soap_attribute *tp;
if (*name == '-')
return SOAP_OK;
- DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Set attribute %s='%s'\n", name, value?value:SOAP_STR_EOS));
+ DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Set attribute %s='%s'\n", name, value ? value : SOAP_STR_EOS));
for (tp = soap->attributes; tp; tp = tp->next)
{ if (!strcmp(tp->name, name))
break;
@@ -9883,7 +10026,7 @@ soap_set_attr(struct soap *soap, const char *name, const char *value, int flag)
{ tp->next = soap->attributes;
soap->attributes = tp;
}
- strcpy(tp->name, name);
+ strcpy((char*)tp->name, name);
tp->value = NULL;
}
else if (tp->visible)
@@ -9906,9 +10049,9 @@ soap_set_attr(struct soap *soap, const char *name, const char *value, int flag)
if (!strncmp(tp->name, "xmlns:", 6))
tp->ns = tp->value;
tp->visible = 2;
- tp->flag = flag;
+ tp->flag = (short)flag;
#ifndef WITH_LEAN
- if (soap->event != SOAP_SEC_SIGN && !strcmp(name, "wsu:Id"))
+ if (!strcmp(name, "wsu:Id"))
{ soap->event = SOAP_SEC_BEGIN;
strncpy(soap->id, value, sizeof(soap->id));
soap->id[sizeof(soap->id)-1] = '\0';
@@ -9996,7 +10139,7 @@ soap_getattrval(struct soap *soap, char *s, size_t n, soap_wchar d)
}
default:
if ((int)c == EOF)
- return soap->error = SOAP_EOF;
+ return soap->error = SOAP_CHK_EOF;
*s++ = (char)c;
}
}
@@ -10085,8 +10228,19 @@ soap_peek_element(struct soap *soap)
soap->position = 0;
soap->null = 0;
soap->mustUnderstand = 0;
- /* skip BOM */
- if ((c = soap_getchar(soap)) != 0xEF || (c = soap_get1(soap)) != 0xBB || (c = soap_get1(soap)) != 0xBF)
+ /* UTF-8 BOM? */
+ c = soap_getchar(soap);
+ if (c == 0xEF && soap_get0(soap) == 0xBB)
+ { c = soap_get1(soap);
+ if ((c = soap_get1(soap)) == 0xBF)
+ soap->mode &= ~SOAP_ENC_LATIN;
+ else
+ soap_unget(soap, (0x0F << 12) | (0xBB << 6) | (c & 0x3F)); /* UTF-8 */
+ }
+ else if ((c == 0xFE && soap_get0(soap) == 0xFF) /* UTF-16 BE */
+ || (c == 0xFF && soap_get0(soap) == 0xFE)) /* UTF-16 LE */
+ return soap->error = SOAP_UTF_ERROR;
+ else
soap_unget(soap, c);
c = soap_get(soap);
#ifdef WITH_DOM
@@ -10116,7 +10270,7 @@ soap_peek_element(struct soap *soap)
if (c != SOAP_LT)
{ *soap->tag = '\0';
if ((int)c == EOF)
- return soap->error = SOAP_EOF;
+ return soap->error = SOAP_CHK_EOF;
soap_unget(soap, c > 0 ? c | 0x80000000 : c);
#ifdef WITH_DOM
/* whitespace leading to end tag is significant for DOM */
@@ -10221,7 +10375,7 @@ soap_peek_element(struct soap *soap)
{ tp = (struct soap_attribute*)SOAP_MALLOC(soap, sizeof(struct soap_attribute) + strlen(soap->tmpbuf));
if (!tp)
return soap->error = SOAP_EOM;
- strcpy(tp->name, soap->tmpbuf);
+ strcpy((char*)tp->name, soap->tmpbuf);
tp->value = NULL;
tp->size = 0;
tp->ns = NULL;
@@ -10254,6 +10408,7 @@ soap_peek_element(struct soap *soap)
return soap->error;
if (tp->value)
SOAP_FREE(soap, tp->value);
+ tp->value = NULL;
for (;;)
{ if (soap_getattrval(soap, soap->labbuf + soap->labidx, soap->lablen - soap->labidx, c))
{ if (soap->error != SOAP_EOM)
@@ -10333,7 +10488,7 @@ soap_peek_element(struct soap *soap)
}
#endif
if ((int)c == EOF)
- return soap->error = SOAP_EOF;
+ return soap->error = SOAP_CHK_EOF;
if (!(soap->body = (c != '/')))
do c = soap_get1(soap);
while (soap_blank(c));
@@ -10342,8 +10497,6 @@ soap_peek_element(struct soap *soap)
{ if (!soap->body && soap->dom->prnt)
soap->dom = soap->dom->prnt;
}
- if (soap->feltbegin)
- return soap->error = soap->feltbegin(soap, soap->tag);
#endif
for (tp = soap->attributes; tp; tp = tp->next)
{ if (tp->visible && tp->value)
@@ -10436,6 +10589,10 @@ soap_peek_element(struct soap *soap)
}
}
}
+#ifdef WITH_DOM
+ if (soap->feltbegin)
+ return soap->error = soap->feltbegin(soap, soap->tag);
+#endif
return soap->error = SOAP_OK;
}
#endif
@@ -10536,7 +10693,7 @@ soap_string_out(struct soap *soap, const char *s, int flag)
if (soap->mode & SOAP_C_MBSTRING)
{ wchar_t wc;
register int m = mbtowc(&wc, t - 1, MB_CUR_MAX);
- if (m > 0 && (soap_wchar)wc != c)
+ if (m > 0 && !((soap_wchar)wc == c && m == 1 && c < 0x80))
{ if (soap_send_raw(soap, s, t - s - 1) || soap_pututf8(soap, wc))
return soap->error;
s = t += m - 1;
@@ -10649,11 +10806,11 @@ soap_string_in(struct soap *soap, int flag, long minlen, long maxlen)
if ((int)c == EOF)
goto end;
if ((c >= 0x80 || c < SOAP_AP) && state != 1 && !(soap->mode & SOAP_ENC_LATIN))
- { if (c >= 0x80)
+ { if ((c & 0x7FFFFFFF) >= 0x80)
{ soap_unget(soap, c);
c = soap_getutf8(soap);
}
- if (soap->mode & SOAP_C_UTFSTRING)
+ if ((c & 0x7FFFFFFF) >= 0x80 && (soap->mode & SOAP_C_UTFSTRING))
{ c &= 0x7FFFFFFF;
t = buf;
if (c < 0x0800)
@@ -10688,17 +10845,17 @@ soap_string_in(struct soap *soap, int flag, long minlen, long maxlen)
{ case 1:
if (c == ']')
state = 4;
- *s++ = c;
+ *s++ = (char)c;
continue;
case 2:
if (c == '-')
state = 6;
- *s++ = c;
+ *s++ = (char)c;
continue;
case 3:
if (c == '?')
state = 8;
- *s++ = c;
+ *s++ = (char)c;
continue;
/* CDATA */
case 4:
@@ -10706,14 +10863,14 @@ soap_string_in(struct soap *soap, int flag, long minlen, long maxlen)
state = 5;
else
state = 1;
- *s++ = c;
+ *s++ = (char)c;
continue;
case 5:
if (c == '>')
state = 0;
else
state = 1;
- *s++ = c;
+ *s++ = (char)c;
continue;
/* comment */
case 6:
@@ -10721,14 +10878,14 @@ soap_string_in(struct soap *soap, int flag, long minlen, long maxlen)
state = 7;
else
state = 2;
- *s++ = c;
+ *s++ = (char)c;
continue;
case 7:
if (c == '>')
state = 0;
else
state = 2;
- *s++ = c;
+ *s++ = (char)c;
continue;
/* PI */
case 8:
@@ -10736,7 +10893,7 @@ soap_string_in(struct soap *soap, int flag, long minlen, long maxlen)
state = 0;
else
state = 3;
- *s++ = c;
+ *s++ = (char)c;
continue;
}
switch (c)
@@ -10830,7 +10987,7 @@ soap_string_in(struct soap *soap, int flag, long minlen, long maxlen)
#ifndef WITH_LEANER
#ifdef HAVE_WCTOMB
if (soap->mode & SOAP_C_MBSTRING)
- { m = wctomb(buf, c & 0x7FFFFFFF);
+ { m = wctomb(buf, (wchar_t)(c & 0x7FFFFFFF));
if (m >= 1 && m <= (int)MB_CUR_MAX)
{ t = buf;
*s++ = *t++;
@@ -11001,7 +11158,7 @@ soap_string_in(struct soap *soap, int flag, long minlen, long maxlen)
#ifndef WITH_LEANER
#ifdef HAVE_WCTOMB
if (soap->mode & SOAP_C_MBSTRING)
- { m = wctomb(buf, c & 0x7FFFFFFF);
+ { m = wctomb(buf, (wchar_t)(c & 0x7FFFFFFF));
if (m >= 1 && m <= (int)MB_CUR_MAX)
{ t = buf;
*s++ = *t++;
@@ -11266,7 +11423,7 @@ soap_wstring_in(struct soap *soap, int flag, long minlen, long maxlen)
if ((int)c == EOF)
goto end;
if (sizeof(wchar_t) < 4 && c > 0xFFFF)
- { wchar_t c1, c2;
+ { soap_wchar c1, c2;
/* http://unicode.org/faq/utf_bom.html#utf16-2 */
c1 = 0xD800 - (0x10000 >> 10) + (c >> 10);
c2 = 0xDC00 + (c & 0x3FF);
@@ -11511,7 +11668,7 @@ soap_s2LONG64(struct soap *soap, const char *s, LONG64 *p)
soap_reset_errno;
#endif
#endif
- *p = strtoll(s, &r, 10);
+ *p = soap_strtoll(s, &r, 10);
if (s == r || *r
#ifndef WITH_NOIO
#ifndef WITH_LEAN
@@ -11726,7 +11883,11 @@ soap_float2s(struct soap *soap, float n)
return "-INF";
s = soap->tmpbuf;
#if defined(HAVE_SPRINTF_L)
+# ifdef WIN32
+ _sprintf_s_l(s, _countof(soap->tmpbuf), soap->float_format, soap->c_locale, n);
+# else
sprintf_l(s, soap->c_locale, soap->float_format, n);
+# endif
#else
sprintf(s, soap->float_format, n);
s = strchr(s, ','); /* convert decimal comma to DP */
@@ -11772,7 +11933,11 @@ soap_s2float(struct soap *soap, const char *s, float *p)
/* On some systems strtof requires -std=c99 or does not even link: so we try to use strtod first */
#if defined(HAVE_STRTOD_L)
char *r;
+# ifdef WIN32
+ *p = (float)_strtod_l(s, &r, soap->c_locale);
+# else
*p = (float)strtod_l(s, &r, soap->c_locale);
+# endif
if (*r)
#elif defined(HAVE_STRTOD)
char *r;
@@ -11872,7 +12037,11 @@ soap_double2s(struct soap *soap, double n)
return "-INF";
s = soap->tmpbuf;
#if defined(HAVE_SPRINTF_L)
+# ifdef WIN32
+ _sprintf_s_l(s, _countof(soap->tmpbuf), soap->double_format, soap->c_locale, n);
+# else
sprintf_l(s, soap->c_locale, soap->double_format, n);
+# endif
#else
sprintf(s, soap->double_format, n);
s = strchr(s, ','); /* convert decimal comma to DP */
@@ -11917,7 +12086,11 @@ soap_s2double(struct soap *soap, const char *s, double *p)
{
#if defined(HAVE_STRTOD_L)
char *r;
+# ifdef WIN32
+ *p = _strtod_l(s, &r, soap->c_locale);
+# else
*p = strtod_l(s, &r, soap->c_locale);
+# endif
if (*r)
#elif defined(HAVE_STRTOD)
char *r;
@@ -12313,7 +12486,7 @@ soap_s2ULONG64(struct soap *soap, const char *s, ULONG64 *p)
soap_reset_errno;
#endif
#endif
- *p = strtoull(s, &r, 10);
+ *p = soap_strtoull(s, &r, 10);
if ((s == r && (soap->mode & SOAP_XML_STRICT)) || *r
#ifndef WITH_NOIO
#ifndef WITH_LEAN
@@ -12414,7 +12587,7 @@ soap_s2QName(struct soap *soap, const char *s, char **t, long minlen, long maxle
break;
/* find next QName */
n = 1;
- while (s[n] && !soap_blank(s[n]))
+ while (s[n] && !soap_blank((soap_wchar)s[n]))
n++;
np = soap->nlist;
/* if there is no namespace stack, or prefix is "xml" then copy string */
@@ -12455,7 +12628,7 @@ soap_s2QName(struct soap *soap, const char *s, char **t, long minlen, long maxle
soap_append_lab(soap, "\"", 1);
}
else
- { DBGLOG(TEST, SOAP_MESSAGE(fdebug, "\nNamespace prefix of '%s' not defined (index=%d, URI=%s)\n", s, np->index, np->ns?np->ns:SOAP_STR_EOS));
+ { DBGLOG(TEST, SOAP_MESSAGE(fdebug, "\nNamespace prefix of '%s' not defined (index=%d, URI=%s)\n", s, np->index, np->ns ? np->ns : SOAP_STR_EOS));
return soap->error = SOAP_NAMESPACE;
}
}
@@ -12506,10 +12679,7 @@ soap_QName2s(struct soap *soap, const char *s)
{ soap_append_lab(soap, s, n);
#ifndef WITH_LEAN
if ((soap->mode & SOAP_XML_CANONICAL))
- { const char *r = strchr(s, ':');
- if (r)
- soap_utilize_ns(soap, s, r - s);
- }
+ soap_utilize_ns(soap, s);
#endif
}
else /* URL-based string prefix */
@@ -12688,7 +12858,8 @@ SOAP_FMAC1
char **
SOAP_FMAC2
soap_instring(struct soap *soap, const char *tag, char **p, const char *type, int t, int flag, long minlen, long maxlen)
-{ if (soap_element_begin_in(soap, tag, 1, NULL))
+{ (void)type;
+ if (soap_element_begin_in(soap, tag, 1, NULL))
{ if (!tag || *tag != '-' || soap->error != SOAP_NO_TAG)
return NULL;
soap->error = SOAP_OK;
@@ -12754,7 +12925,8 @@ SOAP_FMAC1
wchar_t **
SOAP_FMAC2
soap_inwstring(struct soap *soap, const char *tag, wchar_t **p, const char *type, int t, long minlen, long maxlen)
-{ if (soap_element_begin_in(soap, tag, 1, NULL))
+{ (void)type;
+ if (soap_element_begin_in(soap, tag, 1, NULL))
{ if (!tag || *tag != '-' || soap->error != SOAP_NO_TAG)
return NULL;
soap->error = SOAP_OK;
@@ -13217,7 +13389,7 @@ soap_getline(struct soap *soap, char *s, int len)
if (c == '\r' || c == '\n')
break;
if ((int)c == EOF)
- return soap->error = SOAP_EOF;
+ return soap->error = SOAP_CHK_EOF;
*s++ = (char)c;
}
if (c != '\n')
@@ -13231,7 +13403,7 @@ soap_getline(struct soap *soap, char *s, int len)
break;
}
else if ((int)c == EOF)
- return soap->error = SOAP_EOF;
+ return soap->error = SOAP_CHK_EOF;
if (i < 0)
return soap->error = SOAP_HDR;
}
@@ -13346,7 +13518,7 @@ SOAP_FMAC2
soap_putdimehdr(struct soap *soap)
{ unsigned char tmp[12];
size_t optlen = 0, idlen = 0, typelen = 0;
- DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Put DIME header id='%s'\n", soap->dime.id?soap->dime.id:SOAP_STR_EOS));
+ DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Put DIME header id='%s'\n", soap->dime.id ? soap->dime.id : SOAP_STR_EOS));
if (soap->dime.options)
optlen = (((unsigned char)soap->dime.options[2] << 8) | ((unsigned char)soap->dime.options[3])) + 4;
if (soap->dime.id)
@@ -13442,7 +13614,7 @@ soap_putdime(struct soap *soap)
bufsize = sizeof(soap->tmpbuf);
if (!(bufsize = soap->fdimeread(soap, handle, soap->tmpbuf, bufsize)))
{ DBGLOG(TEST, SOAP_MESSAGE(fdebug, "fdimeread failed: insufficient data (%lu bytes remaining from %lu bytes)\n", (unsigned long)size, (unsigned long)content->size));
- soap->error = SOAP_EOF;
+ soap->error = SOAP_CHK_EOF;
break;
}
if (soap_send_raw(soap, soap->tmpbuf, bufsize))
@@ -13484,7 +13656,7 @@ soap_getdimefield(struct soap *soap, size_t n)
{ s = p;
for (i = n; i > 0; i--)
{ if ((int)(c = soap_get1(soap)) == EOF)
- { soap->error = SOAP_EOF;
+ { soap->error = SOAP_CHK_EOF;
return NULL;
}
*s++ = (char)c;
@@ -13518,7 +13690,7 @@ soap_getdimehdr(struct soap *soap)
DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Get DIME header\n"));
if (soap->dime.buflen || soap->dime.chunksize)
{ if (soap_move(soap, (long)(soap->dime.size - soap_tell(soap))))
- return soap->error = SOAP_EOF;
+ return soap->error = SOAP_CHK_EOF;
soap_unget(soap, soap_getchar(soap)); /* skip padding and get hdr */
DBGLOG(TEST, SOAP_MESSAGE(fdebug, "... From chunked\n"));
return SOAP_OK;
@@ -13526,7 +13698,7 @@ soap_getdimehdr(struct soap *soap)
s = (char*)tmp;
for (i = 12; i > 0; i--)
{ if ((int)(c = soap_getchar(soap)) == EOF)
- return soap->error = SOAP_EOF;
+ return soap->error = SOAP_CHK_EOF;
*s++ = (char)c;
}
if ((tmp[0] & 0xF8) != SOAP_DIME_VERSION)
@@ -13543,7 +13715,7 @@ soap_getdimehdr(struct soap *soap)
return soap->error;
if (!(soap->dime.type = soap_getdimefield(soap, typelen)) && soap->error)
return soap->error;
- DBGLOG(TEST, SOAP_MESSAGE(fdebug, "DIME id=%s, type=%s, options=%s\n", soap->dime.id?soap->dime.id:SOAP_STR_EOS, soap->dime.type?soap->dime.type:"", soap->dime.options?soap->dime.options+4:SOAP_STR_EOS));
+ DBGLOG(TEST, SOAP_MESSAGE(fdebug, "DIME id=%s, type=%s, options=%s\n", soap->dime.id ? soap->dime.id : SOAP_STR_EOS, soap->dime.type ? soap->dime.type : "", soap->dime.options ? soap->dime.options+4 : SOAP_STR_EOS));
if (soap->dime.flags & SOAP_DIME_ME)
soap->mode &= ~SOAP_ENC_DIME;
return SOAP_OK;
@@ -13795,7 +13967,7 @@ soap_get_mime_attachment(struct soap *soap, void *handle)
return NULL;
}
}
- DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Parsing MIME content id=%s type=%s\n", content->id?content->id:SOAP_STR_EOS, content->type?content->type:SOAP_STR_EOS));
+ DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Parsing MIME content id=%s type=%s\n", content->id ? content->id : SOAP_STR_EOS, content->type ? content->type : SOAP_STR_EOS));
if (!content->ptr && soap_new_block(soap) == NULL)
{ soap->error = SOAP_EOM;
return NULL;
@@ -13816,7 +13988,7 @@ soap_get_mime_attachment(struct soap *soap, void *handle)
{ if (!flag)
{ c = soap_get1(soap);
if ((int)c == EOF)
- { soap->error = SOAP_EOF;
+ { soap->error = SOAP_CHK_EOF;
return NULL;
}
}
@@ -13829,7 +14001,7 @@ soap_get_mime_attachment(struct soap *soap, void *handle)
do c = soap_getchar(soap);
while (c == *t++);
if ((int)c == EOF)
- { soap->error = SOAP_EOF;
+ { soap->error = SOAP_CHK_EOF;
return NULL;
}
if (!*--t)
@@ -13954,7 +14126,7 @@ int
SOAP_FMAC2
soap_putmimehdr(struct soap *soap, struct soap_multipart *content)
{ const char *s;
- DBGLOG(TEST, SOAP_MESSAGE(fdebug, "MIME attachment type=%s\n", content->type?content->type:SOAP_STR_EOS));
+ DBGLOG(TEST, SOAP_MESSAGE(fdebug, "MIME attachment type=%s\n", content->type ? content->type : SOAP_STR_EOS));
if (soap_send3(soap, "\r\n--", soap->mime.boundary, "\r\n"))
return soap->error;
if (content->type && soap_send3(soap, "Content-Type: ", content->type, "\r\n"))
@@ -14245,7 +14417,7 @@ soap_getgziphdr(struct soap *soap)
DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Get gzip header\n"));
for (i = 0; i < 9; i++)
{ if ((int)(c = soap_get1(soap) == EOF))
- return soap->error = SOAP_EOF;
+ return soap->error = SOAP_ZLIB_ERROR;
if (i == 1 && c == 8)
soap->z_dict = 0;
if (i == 2)
@@ -14254,7 +14426,7 @@ soap_getgziphdr(struct soap *soap)
if (f & 0x04) /* FEXTRA */
{ for (i = soap_get1(soap) | (soap_get1(soap) << 8); i; i--)
{ if ((int)soap_get1(soap) == EOF)
- return soap->error = SOAP_EOF;
+ return soap->error = SOAP_ZLIB_ERROR;
}
}
if (f & 0x08) /* skip FNAME */
@@ -14272,7 +14444,7 @@ soap_getgziphdr(struct soap *soap)
c = soap_get1(soap);
}
if ((int)c == EOF)
- return soap->error = SOAP_EOF;
+ return soap->error = SOAP_ZLIB_ERROR;
return SOAP_OK;
}
#endif
@@ -14292,7 +14464,10 @@ soap_begin_serve(struct soap *soap)
}
#endif
soap_begin(soap);
- if (soap_begin_recv(soap))
+ if (soap_begin_recv(soap)
+ || soap_envelope_begin_in(soap)
+ || soap_recv_header(soap)
+ || soap_body_begin_in(soap))
{ if (soap->error < SOAP_STOP)
{
#ifdef WITH_FASTCGI
@@ -14303,10 +14478,6 @@ soap_begin_serve(struct soap *soap)
}
return soap_closesock(soap);
}
- if (soap_envelope_begin_in(soap)
- || soap_recv_header(soap)
- || soap_body_begin_in(soap))
- return soap->error;
return SOAP_OK;
}
#endif
@@ -14317,7 +14488,7 @@ SOAP_FMAC1
int
SOAP_FMAC2
soap_begin_recv(struct soap *soap)
-{ soap_wchar c;
+{ register soap_wchar c;
DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Initializing for input\n"));
soap->error = SOAP_OK;
soap->filterstop = SOAP_OK;
@@ -14350,6 +14521,7 @@ soap_begin_recv(struct soap *soap)
soap->header = NULL;
soap->fault = NULL;
soap->status = 0;
+ soap->fform = NULL;
#ifndef WITH_LEANER
soap->dom = NULL;
soap->dime.chunksize = 0;
@@ -14366,7 +14538,7 @@ soap_begin_recv(struct soap *soap)
#ifdef WIN32
#ifndef UNDER_CE
#ifndef WITH_FASTCGI
- if (!soap_valid_socket(soap->socket))
+ if (!soap_valid_socket(soap->socket) && !soap->is) /* Set win32 stdout or soap->sendfd to BINARY, e.g. to support DIME */
#ifdef __BORLANDC__
setmode(soap->recvfd, _O_BINARY);
#else
@@ -14433,14 +14605,24 @@ soap_begin_recv(struct soap *soap)
else
#endif
{ /* skip BOM */
- if (c == 0xEF && (c = soap_getchar(soap)) == 0xBB && (c = soap_getchar(soap)) == 0xBF)
- c = soap_getchar(soap);
+ if (c == 0xEF && soap_get0(soap) == 0xBB)
+ { c = soap_get1(soap);
+ if ((c = soap_get1(soap)) == 0xBF)
+ { soap->mode &= ~SOAP_ENC_LATIN;
+ c = soap_getchar(soap);
+ }
+ else
+ c = (0x0F << 12) | (0xBB << 6) | (c & 0x3F); /* UTF-8 */
+ }
+ else if ((c == 0xFE && soap_get0(soap) == 0xFF) /* UTF-16 BE */
+ || (c == 0xFF && soap_get0(soap) == 0xFE)) /* UTF-16 LE */
+ return soap->error = SOAP_UTF_ERROR;
/* skip space */
while (soap_blank(c))
c = soap_getchar(soap);
}
if ((int)c == EOF)
- return soap->error = SOAP_EOF;
+ return soap->error = SOAP_CHK_EOF;
soap_unget(soap, c);
#ifndef WITH_NOHTTP
/* if not XML or MIME/DIME/ZLIB, assume HTTP header */
@@ -14453,7 +14635,13 @@ soap_begin_recv(struct soap *soap)
return soap->error;
}
if (soap->error == SOAP_STOP)
+ { if (soap->fform)
+ { soap->error = soap->fform(soap);
+ if (soap->error == SOAP_OK)
+ soap->error = SOAP_STOP; /* prevents further processing */
+ }
return soap->error;
+ }
soap->mode = soap->imode; /* if imode is changed, effectuate */
soap->imode = m; /* restore imode */
#ifdef WITH_ZLIB
@@ -14532,7 +14720,7 @@ soap_begin_recv(struct soap *soap)
if (soap->mode & SOAP_ENC_MIME)
{ do /* skip preamble */
{ if ((int)(c = soap_getchar(soap)) == EOF)
- return soap->error = SOAP_EOF;
+ return soap->error = SOAP_CHK_EOF;
} while (c != '-' || soap_get0(soap) != '-');
soap_unget(soap, c);
if (soap_getmimehdr(soap))
@@ -14614,7 +14802,8 @@ SOAP_FMAC1
int
SOAP_FMAC2
soap_envelope_end_out(struct soap *soap)
-{ if (soap_element_end_out(soap, "SOAP-ENV:Envelope") || soap_send_raw(soap, "\r\n", 2)) /* 2.8: always emit \r\n after SOAP Envelope */
+{ if (soap_element_end_out(soap, "SOAP-ENV:Envelope")
+ || soap_send_raw(soap, "\r\n", 2)) /* 2.8: always emit \r\n */
return soap->error;
#ifndef WITH_LEANER
if ((soap->mode & SOAP_IO_LENGTH) && (soap->mode & SOAP_ENC_DIME) && !(soap->mode & SOAP_ENC_MTOM))
@@ -14959,23 +15148,32 @@ soap_try_connect_command(struct soap *soap, int http_command, const char *endpoi
}
else
#endif
+ soap->action = soap_strdup(soap, action);
if (soap->fopen && *soap->host)
{ if (!soap->keep_alive || !soap_valid_socket(soap->socket) || strcmp(soap->host, host) || soap->port != port || !soap->fpoll || soap->fpoll(soap))
{ soap->error = SOAP_OK;
- soap->keep_alive = 0; /* to force close */
- soap->omode &= ~SOAP_IO_UDP; /* to force close */
- soap_closesock(soap);
- DBGLOG(TEST,SOAP_MESSAGE(fdebug, "Connect/reconnect to host='%s' path='%s' port=%d\n", soap->host, soap->path, soap->port));
#ifndef WITH_LEAN
if (!strncmp(endpoint, "soap.udp:", 9))
soap->omode |= SOAP_IO_UDP;
+ else
#endif
- soap->socket = soap->fopen(soap, endpoint, soap->host, soap->port);
- if (soap->error)
- return soap->error;
- soap->keep_alive = ((soap->omode & SOAP_IO_KEEPALIVE) != 0);
+ { soap->keep_alive = 0; /* to force close */
+ soap->omode &= ~SOAP_IO_UDP; /* to force close */
+ }
+ soap_closesock(soap);
+ DBGLOG(TEST,SOAP_MESSAGE(fdebug, "Connect/reconnect to '%s' host='%s' path='%s' port=%d\n", endpoint?endpoint:"(null)", soap->host, soap->path, soap->port));
+ if (!soap->keep_alive || !soap_valid_socket(soap->socket))
+ { soap->socket = soap->fopen(soap, endpoint, soap->host, soap->port);
+ if (soap->error)
+ return soap->error;
+ soap->keep_alive = ((soap->omode & SOAP_IO_KEEPALIVE) != 0);
+ }
}
}
+#ifdef WITH_NTLM
+ if (soap_ntlm_handshake(soap, SOAP_GET, endpoint, soap->host, soap->port))
+ return soap->error;
+#endif
count = soap_count_attachments(soap);
if (soap_begin_send(soap))
return soap->error;
@@ -14984,7 +15182,6 @@ soap_try_connect_command(struct soap *soap, int http_command, const char *endpoi
soap->mode |= SOAP_IO_BUFFER;
}
#ifndef WITH_NOHTTP
- soap->action = soap_strdup(soap, action);
if ((soap->mode & SOAP_IO) != SOAP_IO_STORE && !(soap->mode & SOAP_ENC_XML) && endpoint)
{ unsigned int k = soap->mode;
soap->mode &= ~(SOAP_IO | SOAP_ENC_ZLIB);
@@ -15000,7 +15197,7 @@ soap_try_connect_command(struct soap *soap, int http_command, const char *endpoi
#endif
soap->mode = k;
}
- if (http_command == SOAP_GET)
+ if (http_command == SOAP_GET || http_command == SOAP_DEL)
return soap_end_send(soap);
#endif
return SOAP_OK;
@@ -15008,6 +15205,80 @@ soap_try_connect_command(struct soap *soap, int http_command, const char *endpoi
#endif
/******************************************************************************/
+#ifdef WITH_NTLM
+#ifndef PALM_1
+static int
+soap_ntlm_handshake(struct soap *soap, int command, const char *endpoint, const char *host, int port)
+{ /* requires libntlm from http://www.nongnu.org/libntlm/ */
+ const char *userid = (soap->proxy_userid ? soap->proxy_userid : soap->userid);
+ const char *passwd = (soap->proxy_passwd ? soap->proxy_passwd : soap->passwd);
+ struct SOAP_ENV__Header *oldheader;
+ if (soap->ntlm_challenge && userid && passwd && soap->authrealm)
+ { tSmbNtlmAuthRequest req;
+ tSmbNtlmAuthResponse res;
+ tSmbNtlmAuthChallenge ch;
+ short k = soap->keep_alive;
+ size_t l = soap->length;
+ size_t c = soap->count;
+ soap_mode m = soap->mode, o = soap->omode;
+ int s = soap->status;
+ DBGLOG(TEST,SOAP_MESSAGE(fdebug, "NTLM '%s'\n", soap->ntlm_challenge));
+ if (!*soap->ntlm_challenge)
+ { DBGLOG(TEST,SOAP_MESSAGE(fdebug, "NTLM S->C Type 1: received NTLM authentication challenge from server\n"));
+ /* S -> C 401 Unauthorized
+ WWW-Authenticate: NTLM
+ */
+ buildSmbNtlmAuthRequest(&req, userid, soap->authrealm);
+ soap->ntlm_challenge = soap_s2base64(soap, (unsigned char*)&req, NULL, SmbLength(&req));
+ DBGLOG(TEST,SOAP_MESSAGE(fdebug, "NTLM C->S Type 2: sending NTLM authorization to server\nAuthorization: NTLM %s\n", soap->ntlm_challenge));
+ /* C -> S GET ...
+ Authorization: NTLM TlRMTVNTUAABAAAAA7IAAAoACgApAAAACQAJACAAAABMSUdIVENJVFlVUlNBLU1JTk9S
+ */
+ soap->omode = SOAP_IO_BUFFER;
+ if (soap_begin_send(soap))
+ return soap->error;
+ soap->keep_alive = 1;
+ soap->status = command;
+ if (soap->fpost(soap, endpoint, host, port, soap->path, soap->action, 0)
+ || soap_end_send(soap))
+ return soap->error;
+ soap->mode = m;
+ soap->keep_alive = k;
+ DBGLOG(TEST,SOAP_MESSAGE(fdebug, "NTLM S->C Type 2: waiting on server NTLM response\n"));
+ oldheader = soap->header;
+ if (soap_begin_recv(soap))
+ if (soap->error == SOAP_EOF)
+ return soap->error;
+ soap_end_recv(soap);
+ soap->header = oldheader;
+ soap->length = l;
+ if (soap->status != 401 && soap->status != 407)
+ return soap->error = SOAP_NTLM_ERROR;
+ soap->error = SOAP_OK;
+ }
+ /* S -> C 401 Unauthorized
+ WWW-Authenticate: NTLM TlRMTVNTUAACAAAAAAAAACgAAAABggAAU3J2Tm9uY2UAAAAAAAAAAA==
+ */
+ soap_base642s(soap, soap->ntlm_challenge, (char*)&ch, sizeof(tSmbNtlmAuthChallenge), NULL);
+ buildSmbNtlmAuthResponse(&ch, &res, userid, passwd);
+ soap->ntlm_challenge = soap_s2base64(soap, (unsigned char*)&res, NULL, SmbLength(&res));
+ DBGLOG(TEST,SOAP_MESSAGE(fdebug, "NTLM C->S Type 3: sending NTLM authorization to server\nAuthorization: NTLM %s\n", soap->ntlm_challenge));
+ /* C -> S GET ...
+ Authorization: NTLM TlRMTVNTUAADAAAAGAAYAHIAAAAYABgAigAAABQAFABAAAAADAAMAFQAAAASABIAYAAAAAAAAACiAAAAAYIAAFUAUgBTAEEALQBNAEkATgBPAFIAWgBhAHAAaABvAGQATABJAEcASABUAEMASQBUAFkArYfKbe/jRoW5xDxHeoxC1gBmfWiS5+iX4OAN4xBKG/IFPwfH3agtPEia6YnhsADT
+ */
+ soap->keep_alive = k;
+ soap->length = l;
+ soap->count = c;
+ soap->mode = m;
+ soap->omode = o;
+ soap->status = s;
+ }
+ return SOAP_OK;
+}
+#endif
+#endif
+
+/******************************************************************************/
#ifndef WITH_LEAN
SOAP_FMAC1
char*
@@ -15055,7 +15326,8 @@ SOAP_FMAC1
const char*
SOAP_FMAC2
soap_base642s(struct soap *soap, const char *s, char *t, size_t l, int *n)
-{ register int i, j, c;
+{ register size_t i, j;
+ register soap_wchar c;
register unsigned long m;
register const char *p;
if (!s || !*s)
@@ -15066,7 +15338,7 @@ soap_base642s(struct soap *soap, const char *s, char *t, size_t l, int *n)
return SOAP_NON_NULL;
}
if (!t)
- { l = (strlen(s) + 3) / 4 * 3;
+ { l = (strlen(s) + 3) / 4 * 3 + 1; /* make sure enough space for \0 */
t = (char*)soap_malloc(soap, l);
}
if (!t)
@@ -15093,7 +15365,9 @@ soap_base642s(struct soap *soap, const char *s, char *t, size_t l, int *n)
i += 2;
}
if (n)
- *n += i;
+ *n += (int)i;
+ if (l >= j)
+ *t = '\0';
return p;
}
c -= '+';
@@ -15111,14 +15385,15 @@ soap_base642s(struct soap *soap, const char *s, char *t, size_t l, int *n)
return NULL;
}
}
- *t++ = (char)((m >> 16) & 0xFF);
- *t++ = (char)((m >> 8) & 0xFF);
- *t++ = (char)(m & 0xFF);
if (l < 3)
{ if (n)
- *n += i;
+ *n += (int)i;
+ *t = '\0';
return p;
}
+ *t++ = (char)((m >> 16) & 0xFF);
+ *t++ = (char)((m >> 8) & 0xFF);
+ *t++ = (char)(m & 0xFF);
l -= 3;
}
if (n)
@@ -15168,7 +15443,7 @@ soap_hex2s(struct soap *soap, const char *s, char *t, size_t l, int *n)
return SOAP_NON_NULL;
}
if (!t)
- { l = strlen(s) / 2;
+ { l = strlen(s) / 2 + 1; /* make sure enough space for \0 */
t = (char*)soap_malloc(soap, l);
}
if (!t)
@@ -15182,11 +15457,13 @@ soap_hex2s(struct soap *soap, const char *s, char *t, size_t l, int *n)
d2 = *s++;
if (!d2)
break;
- *t++ = ((d1 >= 'A' ? (d1 & 0x7) + 9 : d1 - '0') << 4) + (d2 >= 'A' ? (d2 & 0x7) + 9 : d2 - '0');
+ *t++ = (char)(((d1 >= 'A' ? (d1 & 0x7) + 9 : d1 - '0') << 4) + (d2 >= 'A' ? (d2 & 0x7) + 9 : d2 - '0'));
l--;
}
if (n)
*n = (int)(t - p);
+ if (l)
+ *t = '\0';
return p;
}
#endif
@@ -15198,13 +15475,13 @@ SOAP_FMAC1
int
SOAP_FMAC2
soap_puthttphdr(struct soap *soap, int status, size_t count)
-{ if (soap->status != SOAP_GET)
+{ if (soap->status != SOAP_GET && soap->status != SOAP_DEL && soap->status != SOAP_CONNECT)
{ register const char *s = "text/xml; charset=utf-8";
register int err = SOAP_OK;
#ifndef WITH_LEANER
register const char *r = NULL;
#endif
- if ((status == SOAP_FILE || soap->status == SOAP_POST_FILE) && soap->http_content)
+ if ((status == SOAP_FILE || soap->status == SOAP_PUT || soap->status == SOAP_POST_FILE) && soap->http_content)
s = soap->http_content;
else if (status == SOAP_HTML)
s = "text/html; charset=utf-8";
@@ -15245,12 +15522,12 @@ soap_puthttphdr(struct soap *soap, int status, size_t count)
}
s = soap->tmpbuf;
}
- if (status == SOAP_OK && soap->version == 2 && soap->action && strlen(soap->action) < sizeof(soap->tmpbuf) - 80)
- { sprintf(soap->tmpbuf, "%s; action=\"%s\"", s, soap->action);
- s = soap->tmpbuf;
- }
+ else
+ s = strcpy(soap->tmpbuf, s);
+ if (status == SOAP_OK && soap->version == 2 && soap->action && strlen(soap->action) + strlen(s) < sizeof(soap->tmpbuf) - 80)
+ sprintf(soap->tmpbuf + strlen(s), "; action=\"%s\"", soap->action);
#endif
- if (s && (err = soap->fposthdr(soap, "Content-Type", s)))
+ if ((err = soap->fposthdr(soap, "Content-Type", s)))
return err;
#ifdef WITH_ZLIB
if ((soap->omode & SOAP_ENC_ZLIB))
@@ -15286,9 +15563,17 @@ soap_puthttphdr(struct soap *soap, int status, size_t count)
static const char*
soap_set_validation_fault(struct soap *soap, const char *s, const char *t)
{ if (*soap->tag)
- sprintf(soap->msgbuf, "Validation constraint violation: %s%s in element '%s'", s, t?t:SOAP_STR_EOS, soap->tag);
+#ifdef HAVE_SNPRINTF
+ soap_snprintf(soap->msgbuf, sizeof(soap->msgbuf), "Validation constraint violation: %s%s in element '%s'", s, t ? t : SOAP_STR_EOS, soap->tag);
+#else
+ sprintf(soap->msgbuf, "Validation constraint violation: %s%s in element '%s'", s, t ? t : SOAP_STR_EOS, soap->tag);
+#endif
else
- sprintf(soap->msgbuf, "Validation constraint violation: %s%s", s, t?t:SOAP_STR_EOS);
+#ifdef HAVE_SNPRINTF
+ soap_snprintf(soap->msgbuf, sizeof(soap->msgbuf), "Validation constraint violation: %s%s", s, t ? t : SOAP_STR_EOS);
+#else
+ sprintf(soap->msgbuf, "Validation constraint violation: %s%s", s, t ? t : SOAP_STR_EOS);
+#endif
return soap->msgbuf;
}
#endif
@@ -15330,11 +15615,15 @@ soap_set_fault(struct soap *soap)
*s = "Well-formedness violation";
break;
case SOAP_NO_TAG:
- *s = "No XML root element";
+ *s = "No tag: no XML root element or missing SOAP message body element";
break;
case SOAP_MUSTUNDERSTAND:
*c = "SOAP-ENV:MustUnderstand";
+#ifdef HAVE_SNPRINTF
+ soap_snprintf(soap->msgbuf, sizeof(soap->msgbuf), "The data in element '%s' must be understood but cannot be handled", soap->tag);
+#else
sprintf(soap->msgbuf, "The data in element '%s' must be understood but cannot be handled", soap->tag);
+#endif
*s = soap->msgbuf;
break;
case SOAP_VERSIONMISMATCH:
@@ -15355,7 +15644,11 @@ soap_set_fault(struct soap *soap)
*s = "Fatal error";
break;
case SOAP_NO_METHOD:
+#ifdef HAVE_SNPRINTF
+ soap_snprintf(soap->msgbuf, sizeof(soap->msgbuf), "Method '%s' not implemented: method name or namespace not recognized", soap->tag);
+#else
sprintf(soap->msgbuf, "Method '%s' not implemented: method name or namespace not recognized", soap->tag);
+#endif
*s = soap->msgbuf;
break;
case SOAP_NO_DATA:
@@ -15386,7 +15679,7 @@ soap_set_fault(struct soap *soap)
*s = soap_set_validation_fault(soap, "nil not allowed", NULL);
break;
case SOAP_DUPLICATE_ID:
- *s = soap_set_validation_fault(soap, "multiple definitions of id ", soap->id);
+ *s = soap_set_validation_fault(soap, "multiple definitions (use the SOAP_XML_TREE flag) of the same id ", soap->id);
if (soap->version == 2)
*soap_faultsubcode(soap) = "SOAP-ENC:DuplicateID";
break;
@@ -15411,6 +15704,9 @@ soap_set_fault(struct soap *soap)
case SOAP_HTTP_ERROR:
*s = "An HTTP processing error occurred";
break;
+ case SOAP_NTLM_ERROR:
+ *s = "An HTTP NTLM authentication error occurred";
+ break;
case SOAP_SSL_ERROR:
#ifdef WITH_OPENSSL
*s = "SSL/TLS error";
@@ -15444,7 +15740,11 @@ soap_set_fault(struct soap *soap)
break;
case SOAP_ZLIB_ERROR:
#ifdef WITH_ZLIB
- sprintf(soap->msgbuf, "Zlib/gzip error: '%s'", soap->d_stream->msg?soap->d_stream->msg:SOAP_STR_EOS);
+#ifdef HAVE_SNPRINTF
+ soap_snprintf(soap->msgbuf, sizeof(soap->msgbuf), "Zlib/gzip error: '%s'", soap->d_stream->msg ? soap->d_stream->msg : SOAP_STR_EOS);
+#else
+ sprintf(soap->msgbuf, "Zlib/gzip error: '%s'", soap->d_stream->msg ? soap->d_stream->msg : SOAP_STR_EOS);
+#endif
*s = soap->msgbuf;
#else
*s = "Zlib/gzip not installed for (de)compression: recompile with -DWITH_GZIP";
@@ -15465,8 +15765,11 @@ soap_set_fault(struct soap *soap)
case SOAP_FD_EXCEEDED:
*s = "Maximum number of open connections was reached (no define HAVE_POLL): increase FD_SETSIZE";
break;
+ case SOAP_UTF_ERROR:
+ *s = "UTF content encoding error";
+ break;
case SOAP_STOP:
- *s = "Stopped: no response to be sent or received (informative)";
+ *s = "Stopped: no response sent or received (informative)";
break;
#endif
case SOAP_EOF:
@@ -15488,7 +15791,12 @@ soap_set_fault(struct soap *soap)
#ifndef WITH_NOHTTP
#ifndef WITH_LEAN
if (soap->error > 200 && soap->error < 600)
- { sprintf(soap->msgbuf, "HTTP Error: %d %s", soap->error, http_error(soap, soap->error));
+ {
+#ifdef HAVE_SNPRINTF
+ soap_snprintf(soap->msgbuf, sizeof(soap->msgbuf), "HTTP Error: %d %s", soap->error, http_error(soap, soap->error));
+#else
+ sprintf(soap->msgbuf, "HTTP Error: %d %s", soap->error, http_error(soap, soap->error));
+#endif
*s = soap->msgbuf;
}
else
@@ -15617,12 +15925,14 @@ int
SOAP_FMAC2
soap_send_empty_response(struct soap *soap, int httpstatuscode)
{ register soap_mode m = soap->omode;
- soap->count = 0;
- if ((m & SOAP_IO) == SOAP_IO_CHUNK)
- soap->omode = (m & ~SOAP_IO) | SOAP_IO_BUFFER;
- if (!soap_response(soap, httpstatuscode) && !soap_end_send(soap))
- soap->error = SOAP_STOP; /* stops the server's response */
- soap->omode = m;
+ if (!(m & SOAP_IO_UDP))
+ { soap->count = 0;
+ if ((m & SOAP_IO) == SOAP_IO_CHUNK)
+ soap->omode = (m & ~SOAP_IO) | SOAP_IO_BUFFER;
+ if (!soap_response(soap, httpstatuscode) && !soap_end_send(soap))
+ soap->error = SOAP_STOP; /* stops the server's processing of request */
+ soap->omode = m;
+ }
return soap_closesock(soap);
}
#endif
@@ -15635,10 +15945,12 @@ SOAP_FMAC1
int
SOAP_FMAC2
soap_recv_empty_response(struct soap *soap)
-{ if (!soap_begin_recv(soap))
- soap_end_recv(soap);
- else if (soap->error == SOAP_NO_DATA || soap->error == 202)
- soap->error = SOAP_OK;
+{ if (!(soap->omode & SOAP_IO_UDP))
+ { if (!soap_begin_recv(soap))
+ soap_end_recv(soap);
+ else if (soap->error == SOAP_NO_DATA || soap->error == 202)
+ soap->error = SOAP_OK;
+ }
return soap_closesock(soap);
}
#endif
@@ -15805,16 +16117,15 @@ soap_print_fault(struct soap *soap, FILE *fd)
{ if (soap_check_state(soap))
fprintf(fd, "Error: soap struct state not initialized\n");
else if (soap->error)
- { const char *c, *v = NULL, *s, **d;
- d = soap_faultcode(soap);
- if (!*d)
+ { const char **c, *v = NULL, *s, *d;
+ c = soap_faultcode(soap);
+ if (!*c)
soap_set_fault(soap);
- c = *d;
if (soap->version == 2)
- v = *soap_faultsubcode(soap);
+ v = soap_check_faultsubcode(soap);
s = *soap_faultstring(soap);
- d = soap_faultdetail(soap);
- fprintf(fd, "%s%d fault: %s [%s]\n\"%s\"\nDetail: %s\n", soap->version ? "SOAP 1." : "Error ", soap->version ? (int)soap->version : soap->error, c, v ? v : "no subcode", s ? s : "[no reason]", d && *d ? *d : "[no detail]");
+ d = soap_check_faultdetail(soap);
+ fprintf(fd, "%s%d fault: %s [%s]\n\"%s\"\nDetail: %s\n", soap->version ? "SOAP 1." : "Error ", soap->version ? (int)soap->version : soap->error, *c, v ? v : "no subcode", s ? s : "[no reason]", d ? d : "[no detail]");
}
}
#endif
@@ -15824,6 +16135,7 @@ soap_print_fault(struct soap *soap, FILE *fd)
#ifdef __cplusplus
#ifndef WITH_LEAN
#ifndef WITH_NOSTDLIB
+#ifndef WITH_COMPAT
SOAP_FMAC1
void
SOAP_FMAC2
@@ -15831,29 +16143,29 @@ soap_stream_fault(struct soap *soap, std::ostream& os)
{ if (soap_check_state(soap))
os << "Error: soap struct state not initialized\n";
else if (soap->error)
- { const char *c, *v = NULL, *s, **d;
- d = soap_faultcode(soap);
- if (!*d)
+ { const char **c, *v = NULL, *s, *d;
+ c = soap_faultcode(soap);
+ if (!*c)
soap_set_fault(soap);
- c = *d;
if (soap->version == 2)
- v = *soap_faultsubcode(soap);
+ v = soap_check_faultsubcode(soap);
s = *soap_faultstring(soap);
- d = soap_faultdetail(soap);
+ d = soap_check_faultdetail(soap);
os << (soap->version ? "SOAP 1." : "Error ")
<< (soap->version ? (int)soap->version : soap->error)
- << " fault: " << c
+ << " fault: " << *c
<< "[" << (v ? v : "no subcode") << "]"
<< std::endl
<< "\"" << (s ? s : "[no reason]") << "\""
<< std::endl
- << "Detail: " << (d && *d ? *d : "[no detail]")
+ << "Detail: " << (d ? d : "[no detail]")
<< std::endl;
}
}
#endif
#endif
#endif
+#endif
/******************************************************************************/
#ifndef WITH_LEAN
@@ -15865,27 +16177,21 @@ soap_sprint_fault(struct soap *soap, char *buf, size_t len)
{ if (soap_check_state(soap))
strncpy(buf, "Error: soap struct not initialized", len);
else if (soap->error)
- { const char *c, *v = NULL, *s, **d;
- d = soap_faultcode(soap);
- if (!*d)
+ { const char **c, *v = NULL, *s, *d;
+ c = soap_faultcode(soap);
+ if (!*c)
soap_set_fault(soap);
- c = *d;
if (soap->version == 2)
v = *soap_faultsubcode(soap);
s = *soap_faultstring(soap);
- d = soap_faultdetail(soap);
+ d = soap_check_faultdetail(soap);
#ifdef HAVE_SNPRINTF
-# ifdef WIN32
- _snprintf
-# else
- snprintf
-# endif
- (buf, len, "%s%d fault: %s [%s]\n\"%s\"\nDetail: %s\n", soap->version ? "SOAP 1." : "Error ", soap->version ? (int)soap->version : soap->error, c, v ? v : "no subcode", s ? s : "[no reason]", d && *d ? *d : "[no detail]");
+ soap_snprintf(buf, len, "%s%d fault: %s [%s]\n\"%s\"\nDetail: %s\n", soap->version ? "SOAP 1." : "Error ", soap->version ? (int)soap->version : soap->error, *c, v ? v : "no subcode", s ? s : "[no reason]", d ? d : "[no detail]");
#else
- if (len > 40 + (v ? strlen(v) : 0) + (s ? strlen(s) : 0) + (d && *d ? strlen(*d) : 0))
- sprintf(buf, "%s%d fault: %s [%s]\n\"%s\"\nDetail: %s\n", soap->version ? "SOAP 1." : "Error ", soap->version ? (int)soap->version : soap->error, c, v ? v : "no subcode", s ? s : "[no reason]", d && *d ? *d : "[no detail]");
+ if (len > 40 + (v ? strlen(v) : 0) + (s ? strlen(s) : 0) + (d ? strlen(d) : 0))
+ sprintf(buf, "%s%d fault: %s [%s]\n\"%s\"\nDetail: %s\n", soap->version ? "SOAP 1." : "Error ", soap->version ? (int)soap->version : soap->error, *c, v ? v : "no subcode", s ? s : "[no reason]", d ? d : "[no detail]");
else if (len > 40)
- sprintf(buf, "%s%d fault: %s\n", soap->version ? "SOAP 1." : "Error ", soap->version ? (int)soap->version : soap->error, c);
+ sprintf(buf, "%s%d fault: %s\n", soap->version ? "SOAP 1." : "Error ", soap->version ? (int)soap->version : soap->error, *c);
else
buf[0] = '\0';
#endif
@@ -15920,8 +16226,8 @@ soap_print_fault_location(struct soap *soap, FILE *fd)
fprintf(fd, "%s%c\n<!-- ** HERE ** -->\n", soap->buf, c1);
if (soap->bufidx < soap->buflen)
fprintf(fd, "%s\n", soap->buf + soap->bufidx);
- soap->buf[i] = c1;
- soap->buf[j] = c2;
+ soap->buf[i] = (char)c1;
+ soap->buf[j] = (char)c2;
}
#endif
}
@@ -15949,7 +16255,7 @@ soap_register_plugin_arg(struct soap *soap, int (*fcreate)(struct soap*, struct
DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Registered '%s' plugin\n", p->id));
return SOAP_OK;
}
- DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Could not register plugin '%s': plugin returned error %d (or fdelete callback not set)\n", p->id?p->id:"?", r));
+ DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Could not register plugin '%s': plugin returned error %d (or fdelete callback not set)\n", p->id ? p->id : "?", r));
SOAP_FREE(soap, p);
return r;
}
diff --git a/dep/gsoap/stdsoap2.h b/dep/gsoap/stdsoap2.h
index 238b7f175ac..87185924135 100644
--- a/dep/gsoap/stdsoap2.h
+++ b/dep/gsoap/stdsoap2.h
@@ -1,10 +1,10 @@
/*
- stdsoap2.h 2.8.2
+ stdsoap2.h 2.8.10
gSOAP runtime engine
gSOAP XML Web services tools
-Copyright (C) 2000-2011, Robert van Engelen, Genivia Inc., All Rights Reserved.
+Copyright (C) 2000-2012, Robert van Engelen, Genivia Inc., All Rights Reserved.
This part of the software is released under ONE of the following licenses:
GPL, or the gSOAP public license, or Genivia's license for commercial use.
--------------------------------------------------------------------------------
@@ -24,7 +24,7 @@ WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
for the specific language governing rights and limitations under the License.
The Initial Developer of the Original Code is Robert A. van Engelen.
-Copyright (C) 2000-2011, Robert van Engelen, Genivia Inc., All Rights Reserved.
+Copyright (C) 2000-2012, Robert van Engelen, Genivia Inc., All Rights Reserved.
--------------------------------------------------------------------------------
GPL license.
@@ -51,6 +51,8 @@ A commercial use license is available from Genivia, Inc., contact@genivia.com
--------------------------------------------------------------------------------
*/
+#define GSOAP_VERSION 20810
+
#ifdef WITH_SOAPDEFS_H
# include "soapdefs.h" /* include user-defined stuff */
#endif
@@ -129,6 +131,13 @@ A commercial use license is available from Genivia, Inc., contact@genivia.com
# endif
#endif
+/* for legacy purposes we use WIN32 macro even though 64 bit is supported */
+#ifdef _WIN64
+# ifndef WIN32
+# define WIN32
+# endif
+#endif
+
#ifdef _WIN32_WCE
# ifndef UNDER_CE
# define UNDER_CE _WIN32_WCE
@@ -211,8 +220,14 @@ A commercial use license is available from Genivia, Inc., contact@genivia.com
# define HAVE_STRRCHR
# define HAVE_STRTOD
# define HAVE_SSCANF
+# define HAVE_STRTOD_L
+# define HAVE_SPRINTF_L
# define HAVE_STRTOL
# define HAVE_STRTOUL
+# if _MSC_VER >= 1300
+# define HAVE_STRTOLL // use _strtoi64
+# define HAVE_STRTOULL // use _strtoui64
+# endif
# define HAVE_SYS_TIMEB_H
# define HAVE_FTIME
# define HAVE_GMTIME
@@ -293,7 +308,6 @@ A commercial use license is available from Genivia, Inc., contact@genivia.com
# define HAVE_WCTOMB
# define HAVE_MBTOWC
# define HAVE_ISNAN
-# define HAVE_ISINF
# elif defined(FREEBSD) || defined(__FreeBSD__) || defined(OPENBSD)
# define HAVE_POLL
# define HAVE_SNPRINTF
@@ -472,6 +486,19 @@ A commercial use license is available from Genivia, Inc., contact@genivia.com
# define ULONG64 unsigned LONG64
# define SOAP_LONG_FORMAT "%ld"
# define SOAP_ULONG_FORMAT "%lu"
+# elif defined(SUN_OS)
+# define HAVE_SNPRINTF
+# define HAVE_STRRCHR
+# define HAVE_STRTOD
+# define HAVE_SSCANF
+# define HAVE_STRTOL
+# define HAVE_STRTOUL
+# define HAVE_SYS_TIMEB_H
+# define HAVE_FTIME
+# define HAVE_RAND_R
+# define HAVE_GETHOSTBYNAME_R
+# define HAVE_GMTIME_R
+# define HAVE_LOCALTIME_R
# else
/* Default assumptions for supported functions */
# define HAVE_SNPRINTF
@@ -515,11 +542,17 @@ A commercial use license is available from Genivia, Inc., contact@genivia.com
# endif
#endif
-/* native Win and HP-UX compilers don't like empty structs */
+/* native Win, HP-UX, and AIX compilers don't like empty structs */
#if defined(WIN32) || defined(HP_UX) || defined(_AIX41) || defined(_AIX43) || defined(VXWORKS)
# define WITH_NOEMPTYSTRUCT
#endif
+#ifdef WITH_PURE_VIRTUAL
+# define SOAP_PURE_VIRTUAL = 0
+#else
+# define SOAP_PURE_VIRTUAL
+#endif
+
#ifdef HP_UX
# undef HAVE_STRTOLL
# undef HAVE_STRTOULL
@@ -534,8 +567,11 @@ A commercial use license is available from Genivia, Inc., contact@genivia.com
/* if we have xlocale.h we use it to avoid decimal point conversion issues */
#ifdef WITH_C_LOCALE
-# include <locale.h>
-# include <xlocale.h>
+# ifdef WIN32
+# include <locale.h>
+# else
+# include <xlocale.h>
+# endif
#else
# undef HAVE_STRTOF_L
# undef HAVE_STRTOD_L
@@ -543,7 +579,7 @@ A commercial use license is available from Genivia, Inc., contact@genivia.com
# undef HAVE_SPRINTF_L
#endif
-#ifdef TANDEM
+#ifdef TANDEM_NONSTOP
# define SOAP_BUFLEN (32767)
/*# define WITH_NOSTDLIB */ /* uncommment to remove stdlib dependences */
# define WITH_NOIO /* no IO dependences, e.g. remove TCP/IP */
@@ -586,6 +622,10 @@ A commercial use license is available from Genivia, Inc., contact@genivia.com
# include <limits.h>
#endif
+#ifdef WITH_NTLM
+# include <ntlm.h>
+#endif
+
#ifdef HAVE_POLL
# include <poll.h>
#endif
@@ -672,14 +712,6 @@ A commercial use license is available from Genivia, Inc., contact@genivia.com
# define SOAP_WINSOCKINT size_t
#endif
-#ifdef WITH_IPV6
-# ifdef IPV6_V6ONLY
-# if !defined(WITH_NO_IPV6_V6ONLY) && !defined(WITH_IPV6_V6ONLY)
-# define WITH_NO_IPV6_V6ONLY /* turn on IPv6-IPv4 switching */
-# endif
-# endif
-#endif
-
#if defined(WITH_IPV6_V6ONLY) || defined(WITH_NO_IPV6_V6ONLY)
# ifndef WITH_IPV6
# define WITH_IPV6
@@ -691,9 +723,17 @@ A commercial use license is available from Genivia, Inc., contact@genivia.com
# include <io.h>
# include <fcntl.h>
# endif
-# include <winsock2.h> /* Visual Studio 2005 users: you must install the Platform SDK (R2) */
-# include <ws2tcpip.h>
-# include <wspiapi.h>
+// When you get macro redefinition errors when compiling the code below:
+// try arrange your include list that <windows.h> is included after "stdsoap2.h"
+// or define _WINSOCKAPI_ first:
+// #define _WINSOCKAPI_ // stops windows.h including winsock.h
+// #include <windows.h>
+// #include "stdsoap2.h"
+# include <winsock2.h> /* Visual Studio 2005 users: install Platform SDK (R2) */
+# include <ws2tcpip.h>
+// # define _WSPIAPI_COUNTOF /* DEV NOTE: enble to fix problems with VC6 */
+// # include <wspiapi.h>
+# include <ws2spi.h> /* DEV NOTE: replaces older wspiapi.h above */
# ifdef WITH_IPV6
# define SOAP_GAI_STRERROR gai_strerrorA
# endif
@@ -790,9 +830,9 @@ extern "C" {
# endif
#elif defined(SOCKLEN_T)
# define SOAP_SOCKLEN_T SOCKLEN_T
-#elif defined(__socklen_t_defined) || defined(_SOCKLEN_T) || defined(CYGWIN) || defined(FREEBSD) || defined(__FreeBSD__) || defined(OPENBSD) || defined(__QNX__) || defined(QNX) || defined(OS390) || defined(HP_UX)
+#elif defined(__socklen_t_defined) || defined(_SOCKLEN_T) || defined(CYGWIN) || defined(FREEBSD) || defined(__FreeBSD__) || defined(OPENBSD) || defined(__QNX__) || defined(QNX) || defined(OS390)
# define SOAP_SOCKLEN_T socklen_t
-#elif defined(IRIX) || defined(WIN32) || defined(__APPLE__) || defined(SUN_OS) || defined(OPENSERVER) || defined(TRU64) || defined(VXWORKS)
+#elif defined(IRIX) || defined(WIN32) || defined(__APPLE__) || defined(SUN_OS) || defined(OPENSERVER) || defined(TRU64) || defined(VXWORKS) || defined(HP_UX)
# define SOAP_SOCKLEN_T int
#else
# define SOAP_SOCKLEN_T size_t
@@ -822,6 +862,12 @@ extern "C" {
# define FD_SETSIZE (1024)
#endif
+#ifdef WITH_LEAN
+# define SOAP_CHK_EOF SOAP_EOF
+#else
+# define SOAP_CHK_EOF (soap->error ? soap->error : SOAP_EOF)
+#endif
+
#if defined(SYMBIAN)
# define LONG64 long
# define ULONG64 unsigned LONG64
@@ -874,7 +920,6 @@ extern "C" {
#elif defined(PALM)
# define soap_int32 Int32
#elif defined(_AIX)
-# define SOAP_NEW(type) new type /* AIX compilers don't like new (t) */
# if defined(_AIX43)
# define soap_int32 int32_t
# else
@@ -1133,6 +1178,14 @@ extern const char soap_base64o[], soap_base64i[];
#define soap_isninfd(n) ((n) < 0 && soap_isinf(n))
#define soap_isninff(n) ((n) < 0 && soap_isinf(n))
+#ifdef HAVE_SNPRINTF
+# ifdef WIN32
+# define soap_snprintf _snprintf
+# else
+# define soap_snprintf snprintf
+# endif
+#endif
+
/* gSOAP error codes */
#define SOAP_EOF EOF
@@ -1184,6 +1237,8 @@ extern const char soap_base64o[], soap_base64i[];
#define SOAP_OCCURS 44
#define SOAP_LENGTH 45
#define SOAP_FD_EXCEEDED 46
+#define SOAP_UTF_ERROR 47
+#define SOAP_NTLM_ERROR 48
#define soap_xml_error_check(e) ((e) == SOAP_TAG_MISMATCH || (e) == SOAP_NO_TAG || (e) == SOAP_SYNTAX_ERROR || (e) == SOAP_NAMESPACE || (e) == SOAP_DUPLICATE_ID || (e) == SOAP_MISSING_ID || (e) == SOAP_REQUIRED || (e) == SOAP_PROHIBITED || (e) == SOAP_OCCURS || (e) == SOAP_LENGTH || (e) == SOAP_NULL || (e) == SOAP_HREF)
#define soap_soap_error_check(e) ((e) == SOAP_CLI_FAULT || (e) == SOAP_SVR_FAULT || (e) == SOAP_VERSIONMISMATCH || (e) == SOAP_MUSTUNDERSTAND || (e) == SOAP_FAULT || (e) == SOAP_NO_METHOD)
@@ -1199,7 +1254,7 @@ extern const char soap_base64o[], soap_base64i[];
/* Exceptional gSOAP HTTP server response status codes >= 1000 */
#define SOAP_STOP 1000 /* No HTTP response */
-#define SOAP_FORM 1001 /* Form request/response */
+#define SOAP_FORM 1001 /* Request (form) data is present, no HTTP response */
#define SOAP_HTML 1002 /* Custom HTML response */
#define SOAP_FILE 1003 /* Custom file-based response */
@@ -1208,6 +1263,9 @@ extern const char soap_base64o[], soap_base64i[];
#define SOAP_POST 2000 /* POST request */
#define SOAP_POST_FILE 2001 /* Custom file-based POST request */
#define SOAP_GET 2002 /* GET request */
+#define SOAP_PUT 2003 /* PUT request */
+#define SOAP_DEL 2004 /* DELETE request */
+#define SOAP_CONNECT 2005 /* CONNECT request */
/* gSOAP DIME */
@@ -1254,21 +1312,22 @@ typedef soap_int32 soap_mode;
#define SOAP_XML_DEFAULTNS 0x00008000 /* out: emit xmlns="..." */
#define SOAP_XML_CANONICAL 0x00010000 /* out: excC14N canonical XML */
#define SOAP_XML_TREE 0x00020000 /* out: XML tree (no id/ref) */
-#define SOAP_XML_GRAPH 0x00040000 /* see DOM manual */
-#define SOAP_XML_NIL 0x00080000 /* out: NULLs as xsi:nil */
+#define SOAP_XML_NIL 0x00040000 /* out: NULLs as xsi:nil */
+#define SOAP_XML_NOTYPE 0x00080000 /* out: NULLs as xsi:nil */
-#define SOAP_C_NOIOB 0x00100000 /* don't fault on array index out of bounds (just ignore) */
-#define SOAP_C_UTFSTRING 0x00200000 /* (de)serialize strings with UTF8 content */
-#define SOAP_C_MBSTRING 0x00400000 /* (de)serialize strings with multi-byte content */
-#define SOAP_C_NILSTRING 0x00800000 /* serialize empty strings as nil (omitted) */
+#define SOAP_DOM_TREE 0x00100000 /* see DOM manual */
+#define SOAP_DOM_NODE 0x00200000
+#define SOAP_DOM_ASIS 0x00400000
-#define SOAP_XML_DOM 0x01000000
+#define SOAP_C_NOIOB 0x01000000 /* don't fault on array index out of bounds (just ignore) */
+#define SOAP_C_UTFSTRING 0x02000000 /* (de)serialize strings with UTF8 content */
+#define SOAP_C_MBSTRING 0x04000000 /* (de)serialize strings with multi-byte content */
+#define SOAP_C_NILSTRING 0x08000000 /* serialize empty strings as nil (omitted) */
-#define SOAP_DOM_TREE 0x02000000
-#define SOAP_DOM_NODE 0x04000000
-#define SOAP_DOM_ASIS 0x08000000
+#define SOAP_XML_DOM 0x10000000 /* enable internal DOM */
+#define SOAP_XML_GRAPH 0x20000000 /* id-ref graph in DOM */
-#define SOAP_MIME_POSTCHECK 0x10000000 /* MIME flag (internal) */
+#define SOAP_MIME_POSTCHECK 0x40000000 /* MIME flag (internal) */
#define SOAP_SEC_WSUID 0x80000000 /* Add Body wsu:Id */
@@ -1303,7 +1362,7 @@ typedef soap_int32 soap_mode;
#define soap_check_state(soap) (!(soap) || ((soap)->state != SOAP_INIT && (soap)->state != SOAP_COPY))
-/* parts, states, and events */
+/* parts */
#define SOAP_BEGIN 0
#define SOAP_IN_ENVELOPE 2
@@ -1315,8 +1374,11 @@ typedef soap_int32 soap_mode;
#define SOAP_END_ENVELOPE 8
#define SOAP_END 9
-#define SOAP_SEC_BEGIN 10
-#define SOAP_SEC_SIGN 11
+/* events */
+
+#define SOAP_SEC_BEGIN 1
+#define SOAP_SEC_SIGN 2
+#define SOAP_SEC_DECRYPT 3
/* DEBUG macros */
@@ -1349,13 +1411,17 @@ typedef soap_int32 soap_mode;
#endif
#ifndef SOAP_NEW /* use C++ new operator */
-# if (__GNUC__ <= 2) && !defined(__BORLANDC__) /* Borland uses GNU C? */
+# if (defined(__GNUC__) && (__GNUC__ <= 2) && !defined(__BORLANDC__)) || defined(__clang__) || defined(_AIX)
# define SOAP_NEW(type) new type /* old form w/o parenthesis */
# else
# define SOAP_NEW(type) new (type) /* prefer with parenthesis */
# endif
#endif
+#ifndef SOAP_PLACEMENT_NEW
+# define SOAP_PLACEMENT_NEW(buf, type) new (buf) type
+#endif
+
#ifndef SOAP_NEW_COPY /* use C++ new operator for ::copy() */
# define SOAP_NEW_COPY(clas) new clas /* prefer w/o parenthesis */
#endif
@@ -1792,9 +1858,15 @@ struct SOAP_STD_API soap
struct soap_plugin *plugins; /* linked list of plug-in data */
const char *userid; /* HTTP Basic authorization userid */
const char *passwd; /* HTTP Basic authorization passwd */
+ const char *authrealm; /* HTTP authentication realm (NTLM domain) */
+#if !defined(WITH_LEAN) || defined(WITH_NTLM)
+ const char *ntlm_challenge; /* HTTP NTLM challenge key string */
+ short ntlm_auth; /* HTTP NTLM authentication type */
+ short ntlm_stage; /* HTTP NTLM stage 0..3 */
+#endif
int (*fpost)(struct soap*, const char*, const char*, int, const char*, const char*, size_t);
int (*fget)(struct soap*); /* HTTP GET hook (not set by default) */
- int (*fput)(struct soap*); /* HTTP PUT hook (handled as POST) */
+ int (*fput)(struct soap*); /* HTTP PUT hook (handled as POST by default) */
int (*fdel)(struct soap*); /* HTTP DELETE hook (not set by default) */
int (*fopt)(struct soap*); /* HTTP OPTIONS hook (not set by default) */
int (*fhead)(struct soap*); /* HTTP HEAD hook (not set by default) */
@@ -1847,11 +1919,13 @@ struct SOAP_STD_API soap
size_t (*fmimeread)(struct soap*, void*, char*, size_t);
int (*fmimewrite)(struct soap*, void*, const char*, size_t);
#endif
- SOAP_SOCKET master;
- SOAP_SOCKET socket;
+ SOAP_SOCKET master; /* socket bound to TCP/IP port */
+ SOAP_SOCKET socket; /* socket to send and receive */
+ SOAP_SOCKET sendsk; /* socket to send (overrides ::socket) */
+ SOAP_SOCKET recvsk; /* socket to receive (overrides ::socket) */
#if defined(__cplusplus) && !defined(WITH_LEAN) && !defined(WITH_COMPAT)
- std::ostream *os;
- std::istream *is;
+ std::ostream *os; /* stream to send */
+ std::istream *is; /* stream to receive */
#else
void *os; /* preserve struct size */
void *is; /* preserve struct size */
@@ -1860,8 +1934,8 @@ struct SOAP_STD_API soap
int sendfd; /* WinCE FD to send */
int recvfd; /* WinCE FD to receive */
#else
- FILE *sendfd;
- FILE *recvfd;
+ FILE *sendfd; /* FD to send */
+ FILE *recvfd; /* FD to receive */
#endif
size_t bufidx; /* index in soap.buf[] */
size_t buflen; /* length of soap.buf[] content */
@@ -1885,9 +1959,9 @@ struct SOAP_STD_API soap
char arraySize[SOAP_TAGLEN];
char arrayOffset[SOAP_TAGLEN];
short other;
- short position;
- int positions[SOAP_MAXDIMS];
short root;
+ int position;
+ int positions[SOAP_MAXDIMS];
struct soap_attribute *attributes; /* attribute list */
short encoding; /* when set, output encodingStyle */
short mustUnderstand; /* a mustUnderstand element was parsed or is output */
@@ -1895,6 +1969,7 @@ struct SOAP_STD_API soap
short ns; /* when not set, output full xmlns bindings */
short part; /* SOAP part state (header or body) */
short event; /* engine events and states for use by plugins */
+ unsigned int evlev; /* event level */
short alloced;
short peeked;
size_t chunksize;
@@ -1903,7 +1978,6 @@ struct SOAP_STD_API soap
char path[SOAP_TAGLEN];
char host[SOAP_TAGLEN];
char *action;
- char *authrealm; /* HTTP authentication realm */
char *prolog; /* XML declaration prolog */
unsigned long ip; /* IP number */
int port; /* port number */
@@ -1990,7 +2064,11 @@ struct SOAP_STD_API soap
char session_host[SOAP_TAGLEN];
int session_port;
#ifdef WITH_C_LOCALE
+# ifdef WIN32
+ _locale_t c_locale; /* set to C locale by default */
+# else
locale_t c_locale; /* set to C locale by default */
+# endif
#else
void *c_locale;
#endif
@@ -2073,13 +2151,26 @@ soap_wchar soap_get0(struct soap*);
soap_wchar soap_get1(struct soap*);
#endif
+#define soap_versioning_paste(name, ext) name##_LIBRARY_VERSION_REQUIRED_##ext
+#define soap_versioning_ext(name, ext) soap_versioning_paste(name, ext)
+#define soap_versioning(name) soap_versioning_ext(name, GSOAP_VERSION)
+
+#define soap_init(soap) soap_init1(soap, SOAP_IO_DEFAULT)
+#define soap_init1(soap, mode) soap_init2(soap, mode, mode)
+#define soap_init2(soap, imode, omode) soap_versioning(soap_init)(soap, imode, omode)
+
+#define soap_new() soap_new1(SOAP_IO_DEFAULT)
+#define soap_new1(mode) soap_new2(mode, mode)
+#define soap_new2(imode, omode) soap_versioning(soap_new)(imode, omode)
+
#define soap_revget1(soap) ((soap)->bufidx--)
#define soap_unget(soap, c) ((soap)->ahead = c)
#define soap_register_plugin(soap, plugin) soap_register_plugin_arg(soap, plugin, NULL)
-#define soap_imode(soap, n) ((soap)->mode = (soap)->imode = (n))
+#define soap_mode(soap, n) ((soap)->mode = (soap)->imode = (soap)->omode = (n))
+#define soap_imode(soap, n) ((soap)->imode = (n))
+#define soap_omode(soap, n) ((soap)->omode = (n))
#define soap_set_imode(soap, n) ((soap)->imode |= (n))
#define soap_clr_imode(soap, n) ((soap)->imode &= ~(n))
-#define soap_omode(soap, n) ((soap)->mode = (soap)->omode = (n))
#define soap_set_omode(soap, n) ((soap)->omode |= (n))
#define soap_clr_omode(soap, n) ((soap)->omode &= ~(n))
#define soap_set_mode(soap, n) ((soap)->imode |= (n), (soap)->omode |= (n))
@@ -2104,6 +2195,18 @@ soap_wchar soap_get1(struct soap*);
SOAP_FMAC1 unsigned long SOAP_FMAC2 soap_strtoul(const char *s, char **t, int b);
#endif
+#ifdef WIN32
+# define soap_strtoll _strtoi64
+#else
+# define soap_strtoll strtoll
+#endif
+
+#ifdef WIN32
+# define soap_strtoull _strtoui64
+#else
+# define soap_strtoull strtoull
+#endif
+
#if defined(WITH_OPENSSL)
# define soap_random soap_rand()
SOAP_FMAC1 int SOAP_FMAC2 soap_rand(void);
@@ -2131,18 +2234,29 @@ SOAP_FMAC1 int SOAP_FMAC2 soap_rand(void);
# define soap_markelement(s, p, n) (0)
#endif
-SOAP_FMAC1 void SOAP_FMAC2 soap_header(struct soap*);
-SOAP_FMAC1 void SOAP_FMAC2 soap_fault(struct soap*);
-SOAP_FMAC1 const char** SOAP_FMAC2 soap_faultcode(struct soap*);
-SOAP_FMAC1 const char** SOAP_FMAC2 soap_faultsubcode(struct soap*);
-SOAP_FMAC1 const char** SOAP_FMAC2 soap_faultstring(struct soap*);
-SOAP_FMAC1 const char** SOAP_FMAC2 soap_faultdetail(struct soap*);
+/* soap_traverse() traversal/walker routines take walker function arguments */
+typedef void soap_walker(struct soap*, void*, int, const char*, const char*);
+
+SOAP_FMAC5 int SOAP_FMAC6 soap_serve(struct soap *soap);
+SOAP_FMAC5 int SOAP_FMAC6 soap_serve_request(struct soap *soap);
+
+#ifndef WITH_NOGLOBAL
+SOAP_FMAC3 void SOAP_FMAC4 soap_header(struct soap*);
+SOAP_FMAC3 void SOAP_FMAC4 soap_fault(struct soap*);
+SOAP_FMAC3 const char** SOAP_FMAC4 soap_faultcode(struct soap*);
+SOAP_FMAC3 const char** SOAP_FMAC4 soap_faultsubcode(struct soap*);
+SOAP_FMAC3 const char** SOAP_FMAC4 soap_faultstring(struct soap*);
+SOAP_FMAC3 const char** SOAP_FMAC4 soap_faultdetail(struct soap*);
+SOAP_FMAC3 const char* SOAP_FMAC4 soap_check_faultsubcode(struct soap*);
+SOAP_FMAC3 const char* SOAP_FMAC4 soap_check_faultdetail(struct soap*);
+SOAP_FMAC3 void SOAP_FMAC4 soap_serializefault(struct soap*);
+#endif
+
SOAP_FMAC1 void SOAP_FMAC2 soap_serializeheader(struct soap*);
-SOAP_FMAC1 int SOAP_FMAC2 soap_putheader(struct soap*);
SOAP_FMAC1 int SOAP_FMAC2 soap_getheader(struct soap*);
-SOAP_FMAC1 void SOAP_FMAC2 soap_serializefault(struct soap*);
-SOAP_FMAC1 int SOAP_FMAC2 soap_putfault(struct soap*);
+SOAP_FMAC1 int SOAP_FMAC2 soap_putheader(struct soap*);
SOAP_FMAC1 int SOAP_FMAC2 soap_getfault(struct soap*);
+SOAP_FMAC1 int SOAP_FMAC2 soap_putfault(struct soap*);
SOAP_FMAC1 void SOAP_FMAC2 soap_ssl_init(void);
SOAP_FMAC1 int SOAP_FMAC2 soap_poll(struct soap*);
@@ -2234,7 +2348,7 @@ SOAP_FMAC1 int SOAP_FMAC2 soap_end_recv(struct soap*);
SOAP_FMAC1 void* SOAP_FMAC2 soap_malloc(struct soap*, size_t);
SOAP_FMAC1 void SOAP_FMAC2 soap_dealloc(struct soap*, void*);
SOAP_FMAC1 struct soap_clist * SOAP_FMAC2 soap_link(struct soap*, void*, int, int, int (*fdelete)(struct soap_clist*));
-SOAP_FMAC1 void SOAP_FMAC2 soap_unlink(struct soap*, const void*);
+SOAP_FMAC1 int SOAP_FMAC2 soap_unlink(struct soap*, const void*);
SOAP_FMAC1 void SOAP_FMAC2 soap_free_temp(struct soap*);
SOAP_FMAC1 void SOAP_FMAC2 soap_del(struct soap*);
@@ -2262,18 +2376,15 @@ SOAP_FMAC1 char* SOAP_FMAC2 soap_putoffset(struct soap*, int);
SOAP_FMAC1 char* SOAP_FMAC2 soap_putoffsets(struct soap*, const int *, int);
SOAP_FMAC1 int SOAP_FMAC2 soap_closesock(struct soap*);
+SOAP_FMAC1 int SOAP_FMAC2 soap_force_closesock(struct soap*);
-SOAP_FMAC1 struct soap *SOAP_FMAC2 soap_new(void);
-SOAP_FMAC1 struct soap *SOAP_FMAC2 soap_new1(soap_mode);
-SOAP_FMAC1 struct soap *SOAP_FMAC2 soap_new2(soap_mode, soap_mode);
+SOAP_FMAC1 struct soap *SOAP_FMAC2 soap_versioning(soap_new)(soap_mode, soap_mode);
SOAP_FMAC1 void SOAP_FMAC2 soap_free(struct soap*);
SOAP_FMAC1 struct soap *SOAP_FMAC2 soap_copy(const struct soap*);
SOAP_FMAC1 struct soap *SOAP_FMAC2 soap_copy_context(struct soap*, const struct soap*);
SOAP_FMAC1 void SOAP_FMAC2 soap_copy_stream(struct soap*, struct soap*);
SOAP_FMAC1 void SOAP_FMAC2 soap_free_stream(struct soap*);
-SOAP_FMAC1 void SOAP_FMAC2 soap_init(struct soap*);
-SOAP_FMAC1 void SOAP_FMAC2 soap_init1(struct soap*, soap_mode);
-SOAP_FMAC1 void SOAP_FMAC2 soap_init2(struct soap*, soap_mode, soap_mode);
+SOAP_FMAC1 void SOAP_FMAC2 soap_versioning(soap_init)(struct soap*, soap_mode, soap_mode);
SOAP_FMAC1 void SOAP_FMAC2 soap_done(struct soap*);
SOAP_FMAC1 void SOAP_FMAC2 soap_cleanup(struct soap*);
SOAP_FMAC1 void SOAP_FMAC2 soap_begin(struct soap*);
@@ -2353,6 +2464,7 @@ SOAP_FMAC1 char* SOAP_FMAC2 soap_next_block(struct soap*, struct soap_blist*);
SOAP_FMAC1 size_t SOAP_FMAC2 soap_block_size(struct soap*, struct soap_blist*);
SOAP_FMAC1 char* SOAP_FMAC2 soap_save_block(struct soap*, struct soap_blist*, char*, int);
SOAP_FMAC1 void SOAP_FMAC2 soap_end_block(struct soap*, struct soap_blist*);
+SOAP_FMAC1 void SOAP_FMAC2 soap_update_pointers(struct soap *soap, char *start, char *end, char *p1, char *p2);
SOAP_FMAC1 int SOAP_FMAC2 soap_envelope_begin_out(struct soap*);
SOAP_FMAC1 int soap_envelope_end_out(struct soap*);
@@ -2382,8 +2494,10 @@ SOAP_FMAC1 int SOAP_FMAC2 soap_recv_fault(struct soap*, int check);
SOAP_FMAC1 void SOAP_FMAC2 soap_print_fault(struct soap*, FILE*);
SOAP_FMAC1 void SOAP_FMAC2 soap_print_fault_location(struct soap*, FILE*);
# ifndef WITH_LEAN
-# ifdef __cplusplus
+# ifndef WITH_COMPAT
+# ifdef __cplusplus
SOAP_FMAC1 void SOAP_FMAC2 soap_stream_fault(struct soap*, std::ostream&);
+# endif
# endif
SOAP_FMAC1 char* SOAP_FMAC2 soap_sprint_fault(struct soap*, char*, size_t);
# endif
diff --git a/dep/gsoap/tc_upgrades.txt b/dep/gsoap/tc_upgrades.txt
new file mode 100644
index 00000000000..04298b2ae82
--- /dev/null
+++ b/dep/gsoap/tc_upgrades.txt
@@ -0,0 +1,12 @@
+* Generate new headers based on TrinityCore soap-services stub:
+gsoap/bin/linux386/soapcpp2 -1 -S -L -w -x -y soap.stub
+
+* Copy the following files from the gsoap package:
+gsoap/stdsoap2.h
+gsoap/stdsoap2.cpp
+
+* Remove the following files after generation:
+ns1.nsmap
+soapObject.h
+
+* Test compile and see if SOAP works...
diff --git a/dep/utf8cpp/utf8/checked.h b/dep/utf8cpp/utf8/checked.h
index a1d2035364d..3b00644444c 100644
--- a/dep/utf8cpp/utf8/checked.h
+++ b/dep/utf8cpp/utf8/checked.h
@@ -34,7 +34,7 @@ DEALINGS IN THE SOFTWARE.
namespace utf8
{
// Base for the exceptions that may be thrown from the library
- class exception : public std::exception {
+ class exception : public ::std::exception {
};
// Exceptions that may be thrown from the library functions.
@@ -69,12 +69,38 @@ namespace utf8
/// The library API - functions intended to be called by the users
+ template <typename octet_iterator>
+ octet_iterator append(uint32_t cp, octet_iterator result)
+ {
+ if (!utf8::internal::is_code_point_valid(cp))
+ throw invalid_code_point(cp);
+
+ if (cp < 0x80) // one octet
+ *(result++) = static_cast<uint8_t>(cp);
+ else if (cp < 0x800) { // two octets
+ *(result++) = static_cast<uint8_t>((cp >> 6) | 0xc0);
+ *(result++) = static_cast<uint8_t>((cp & 0x3f) | 0x80);
+ }
+ else if (cp < 0x10000) { // three octets
+ *(result++) = static_cast<uint8_t>((cp >> 12) | 0xe0);
+ *(result++) = static_cast<uint8_t>(((cp >> 6) & 0x3f) | 0x80);
+ *(result++) = static_cast<uint8_t>((cp & 0x3f) | 0x80);
+ }
+ else { // four octets
+ *(result++) = static_cast<uint8_t>((cp >> 18) | 0xf0);
+ *(result++) = static_cast<uint8_t>(((cp >> 12) & 0x3f) | 0x80);
+ *(result++) = static_cast<uint8_t>(((cp >> 6) & 0x3f) | 0x80);
+ *(result++) = static_cast<uint8_t>((cp & 0x3f) | 0x80);
+ }
+ return result;
+ }
+
template <typename octet_iterator, typename output_iterator>
output_iterator replace_invalid(octet_iterator start, octet_iterator end, output_iterator out, uint32_t replacement)
{
while (start != end) {
octet_iterator sequence_start = start;
- internal::utf_error err_code = internal::validate_next(start, end);
+ internal::utf_error err_code = utf8::internal::validate_next(start, end);
switch (err_code) {
case internal::UTF8_OK :
for (octet_iterator it = sequence_start; it != start; ++it)
@@ -83,16 +109,16 @@ namespace utf8
case internal::NOT_ENOUGH_ROOM:
throw not_enough_room();
case internal::INVALID_LEAD:
- append (replacement, out);
+ utf8::append (replacement, out);
++start;
break;
case internal::INCOMPLETE_SEQUENCE:
case internal::OVERLONG_SEQUENCE:
case internal::INVALID_CODE_POINT:
- append (replacement, out);
+ utf8::append (replacement, out);
++start;
// just one replacement mark for the sequence
- while (internal::is_trail(*start) && start != end)
+ while (start != end && utf8::internal::is_trail(*start))
++start;
break;
}
@@ -103,41 +129,15 @@ namespace utf8
template <typename octet_iterator, typename output_iterator>
inline output_iterator replace_invalid(octet_iterator start, octet_iterator end, output_iterator out)
{
- static const uint32_t replacement_marker = internal::mask16(0xfffd);
- return replace_invalid(start, end, out, replacement_marker);
- }
-
- template <typename octet_iterator>
- octet_iterator append(uint32_t cp, octet_iterator result)
- {
- if (!internal::is_code_point_valid(cp))
- throw invalid_code_point(cp);
-
- if (cp < 0x80) // one octet
- *(result++) = static_cast<uint8_t>(cp);
- else if (cp < 0x800) { // two octets
- *(result++) = static_cast<uint8_t>((cp >> 6) | 0xc0);
- *(result++) = static_cast<uint8_t>((cp & 0x3f) | 0x80);
- }
- else if (cp < 0x10000) { // three octets
- *(result++) = static_cast<uint8_t>((cp >> 12) | 0xe0);
- *(result++) = static_cast<uint8_t>(((cp >> 6) & 0x3f) | 0x80);
- *(result++) = static_cast<uint8_t>((cp & 0x3f) | 0x80);
- }
- else { // four octets
- *(result++) = static_cast<uint8_t>((cp >> 18) | 0xf0);
- *(result++) = static_cast<uint8_t>(((cp >> 12) & 0x3f) | 0x80);
- *(result++) = static_cast<uint8_t>(((cp >> 6) & 0x3f) | 0x80);
- *(result++) = static_cast<uint8_t>((cp & 0x3f) | 0x80);
- }
- return result;
+ static const uint32_t replacement_marker = utf8::internal::mask16(0xfffd);
+ return utf8::replace_invalid(start, end, out, replacement_marker);
}
template <typename octet_iterator>
uint32_t next(octet_iterator& it, octet_iterator end)
{
uint32_t cp = 0;
- internal::utf_error err_code = internal::validate_next(it, end, &cp);
+ internal::utf_error err_code = utf8::internal::validate_next(it, end, cp);
switch (err_code) {
case internal::UTF8_OK :
break;
@@ -156,18 +156,22 @@ namespace utf8
template <typename octet_iterator>
uint32_t peek_next(octet_iterator it, octet_iterator end)
{
- return next(it, end);
+ return utf8::next(it, end);
}
template <typename octet_iterator>
uint32_t prior(octet_iterator& it, octet_iterator start)
{
+ // can't do much if it == start
+ if (it == start)
+ throw not_enough_room();
+
octet_iterator end = it;
- while (internal::is_trail(*(--it)))
- if (it < start)
+ // Go back until we hit either a lead octet or start
+ while (utf8::internal::is_trail(*(--it)))
+ if (it == start)
throw invalid_utf8(*it); // error - no lead byte in the sequence
- octet_iterator temp = it;
- return next(temp, end);
+ return utf8::peek_next(it, end);
}
/// Deprecated in versions that include "prior"
@@ -175,18 +179,18 @@ namespace utf8
uint32_t previous(octet_iterator& it, octet_iterator pass_start)
{
octet_iterator end = it;
- while (internal::is_trail(*(--it)))
+ while (utf8::internal::is_trail(*(--it)))
if (it == pass_start)
throw invalid_utf8(*it); // error - no lead byte in the sequence
octet_iterator temp = it;
- return next(temp, end);
+ return utf8::next(temp, end);
}
template <typename octet_iterator, typename distance_type>
void advance (octet_iterator& it, distance_type n, octet_iterator end)
{
for (distance_type i = 0; i < n; ++i)
- next(it, end);
+ utf8::next(it, end);
}
template <typename octet_iterator>
@@ -195,7 +199,7 @@ namespace utf8
{
typename std::iterator_traits<octet_iterator>::difference_type dist;
for (dist = 0; first < last; ++dist)
- next(first, last);
+ utf8::next(first, last);
return dist;
}
@@ -203,12 +207,12 @@ namespace utf8
octet_iterator utf16to8 (u16bit_iterator start, u16bit_iterator end, octet_iterator result)
{
while (start != end) {
- uint32_t cp = internal::mask16(*start++);
+ uint32_t cp = utf8::internal::mask16(*start++);
// Take care of surrogate pairs first
- if (internal::is_lead_surrogate(cp)) {
+ if (utf8::internal::is_lead_surrogate(cp)) {
if (start != end) {
- uint32_t trail_surrogate = internal::mask16(*start++);
- if (internal::is_trail_surrogate(trail_surrogate))
+ uint32_t trail_surrogate = utf8::internal::mask16(*start++);
+ if (utf8::internal::is_trail_surrogate(trail_surrogate))
cp = (cp << 10) + trail_surrogate + internal::SURROGATE_OFFSET;
else
throw invalid_utf16(static_cast<uint16_t>(trail_surrogate));
@@ -218,10 +222,10 @@ namespace utf8
}
// Lone trail surrogate
- else if (internal::is_trail_surrogate(cp))
+ else if (utf8::internal::is_trail_surrogate(cp))
throw invalid_utf16(static_cast<uint16_t>(cp));
- result = append(cp, result);
+ result = utf8::append(cp, result);
}
return result;
}
@@ -230,7 +234,7 @@ namespace utf8
u16bit_iterator utf8to16 (octet_iterator start, octet_iterator end, u16bit_iterator result)
{
while (start != end) {
- uint32_t cp = next(start, end);
+ uint32_t cp = utf8::next(start, end);
if (cp > 0xffff) { //make a surrogate pair
*result++ = static_cast<uint16_t>((cp >> 10) + internal::LEAD_OFFSET);
*result++ = static_cast<uint16_t>((cp & 0x3ff) + internal::TRAIL_SURROGATE_MIN);
@@ -245,7 +249,7 @@ namespace utf8
octet_iterator utf32to8 (u32bit_iterator start, u32bit_iterator end, octet_iterator result)
{
while (start != end)
- result = append(*(start++), result);
+ result = utf8::append(*(start++), result);
return result;
}
@@ -254,7 +258,7 @@ namespace utf8
u32bit_iterator utf8to32 (octet_iterator start, octet_iterator end, u32bit_iterator result)
{
while (start != end)
- (*result++) = next(start, end);
+ (*result++) = utf8::next(start, end);
return result;
}
@@ -280,7 +284,7 @@ namespace utf8
uint32_t operator * () const
{
octet_iterator temp = it;
- return next(temp, range_end);
+ return utf8::next(temp, range_end);
}
bool operator == (const iterator& rhs) const
{
@@ -294,24 +298,24 @@ namespace utf8
}
iterator& operator ++ ()
{
- next(it, range_end);
+ utf8::next(it, range_end);
return *this;
}
iterator operator ++ (int)
{
iterator temp = *this;
- next(it, range_end);
+ utf8::next(it, range_end);
return temp;
}
iterator& operator -- ()
{
- prior(it, range_start);
+ utf8::prior(it, range_start);
return *this;
}
iterator operator -- (int)
{
iterator temp = *this;
- prior(it, range_start);
+ utf8::prior(it, range_start);
return temp;
}
}; // class iterator
diff --git a/dep/utf8cpp/utf8/core.h b/dep/utf8cpp/utf8/core.h
index ec709f12006..693d388c078 100644
--- a/dep/utf8cpp/utf8/core.h
+++ b/dep/utf8cpp/utf8/core.h
@@ -68,7 +68,7 @@ namespace internal
template<typename octet_type>
inline bool is_trail(octet_type oc)
{
- return ((mask8(oc) >> 6) == 0x2);
+ return ((utf8::internal::mask8(oc) >> 6) == 0x2);
}
template <typename u16>
@@ -92,14 +92,14 @@ namespace internal
template <typename u32>
inline bool is_code_point_valid(u32 cp)
{
- return (cp <= CODE_POINT_MAX && !is_surrogate(cp) && cp != 0xfffe && cp != 0xffff);
+ return (cp <= CODE_POINT_MAX && !utf8::internal::is_surrogate(cp));
}
template <typename octet_iterator>
inline typename std::iterator_traits<octet_iterator>::difference_type
sequence_length(octet_iterator lead_it)
{
- uint8_t lead = mask8(*lead_it);
+ uint8_t lead = utf8::internal::mask8(*lead_it);
if (lead < 0x80)
return 1;
else if ((lead >> 5) == 0x6)
@@ -133,123 +133,94 @@ namespace internal
enum utf_error {UTF8_OK, NOT_ENOUGH_ROOM, INVALID_LEAD, INCOMPLETE_SEQUENCE, OVERLONG_SEQUENCE, INVALID_CODE_POINT};
- /// get_sequence_x functions decode utf-8 sequences of the length x
+ /// Helper for get_sequence_x
+ template <typename octet_iterator>
+ utf_error increase_safely(octet_iterator& it, octet_iterator end)
+ {
+ if (++it == end)
+ return NOT_ENOUGH_ROOM;
+
+ if (!utf8::internal::is_trail(*it))
+ return INCOMPLETE_SEQUENCE;
+
+ return UTF8_OK;
+ }
+ #define UTF8_CPP_INCREASE_AND_RETURN_ON_ERROR(IT, END) {utf_error ret = increase_safely(IT, END); if (ret != UTF8_OK) return ret;}
+
+ /// get_sequence_x functions decode utf-8 sequences of the length x
template <typename octet_iterator>
- utf_error get_sequence_1(octet_iterator& it, octet_iterator end, uint32_t* code_point)
+ utf_error get_sequence_1(octet_iterator& it, octet_iterator end, uint32_t& code_point)
{
- if (it != end) {
- if (code_point)
- *code_point = mask8(*it);
- return UTF8_OK;
- }
- return NOT_ENOUGH_ROOM;
+ if (it == end)
+ return NOT_ENOUGH_ROOM;
+
+ code_point = utf8::internal::mask8(*it);
+
+ return UTF8_OK;
}
template <typename octet_iterator>
- utf_error get_sequence_2(octet_iterator& it, octet_iterator end, uint32_t* code_point)
+ utf_error get_sequence_2(octet_iterator& it, octet_iterator end, uint32_t& code_point)
{
- utf_error ret_code = NOT_ENOUGH_ROOM;
+ if (it == end)
+ return NOT_ENOUGH_ROOM;
+
+ code_point = utf8::internal::mask8(*it);
- if (it != end) {
- uint32_t cp = mask8(*it);
- if (++it != end) {
- if (is_trail(*it)) {
- cp = ((cp << 6) & 0x7ff) + ((*it) & 0x3f);
+ UTF8_CPP_INCREASE_AND_RETURN_ON_ERROR(it, end)
- if (code_point)
- *code_point = cp;
- ret_code = UTF8_OK;
- }
- else
- ret_code = INCOMPLETE_SEQUENCE;
- }
- else
- ret_code = NOT_ENOUGH_ROOM;
- }
+ code_point = ((code_point << 6) & 0x7ff) + ((*it) & 0x3f);
- return ret_code;
+ return UTF8_OK;
}
template <typename octet_iterator>
- utf_error get_sequence_3(octet_iterator& it, octet_iterator end, uint32_t* code_point)
+ utf_error get_sequence_3(octet_iterator& it, octet_iterator end, uint32_t& code_point)
{
- utf_error ret_code = NOT_ENOUGH_ROOM;
-
- if (it != end) {
- uint32_t cp = mask8(*it);
- if (++it != end) {
- if (is_trail(*it)) {
- cp = ((cp << 12) & 0xffff) + ((mask8(*it) << 6) & 0xfff);
- if (++it != end) {
- if (is_trail(*it)) {
- cp += (*it) & 0x3f;
-
- if (code_point)
- *code_point = cp;
- ret_code = UTF8_OK;
- }
- else
- ret_code = INCOMPLETE_SEQUENCE;
- }
- else
- ret_code = NOT_ENOUGH_ROOM;
- }
- else
- ret_code = INCOMPLETE_SEQUENCE;
- }
- else
- ret_code = NOT_ENOUGH_ROOM;
- }
+ if (it == end)
+ return NOT_ENOUGH_ROOM;
+
+ code_point = utf8::internal::mask8(*it);
+
+ UTF8_CPP_INCREASE_AND_RETURN_ON_ERROR(it, end)
+
+ code_point = ((code_point << 12) & 0xffff) + ((utf8::internal::mask8(*it) << 6) & 0xfff);
+
+ UTF8_CPP_INCREASE_AND_RETURN_ON_ERROR(it, end)
- return ret_code;
+ code_point += (*it) & 0x3f;
+
+ return UTF8_OK;
}
template <typename octet_iterator>
- utf_error get_sequence_4(octet_iterator& it, octet_iterator end, uint32_t* code_point)
+ utf_error get_sequence_4(octet_iterator& it, octet_iterator end, uint32_t& code_point)
{
- utf_error ret_code = NOT_ENOUGH_ROOM;
-
- if (it != end) {
- uint32_t cp = mask8(*it);
- if (++it != end) {
- if (is_trail(*it)) {
- cp = ((cp << 18) & 0x1fffff) + ((mask8(*it) << 12) & 0x3ffff);
- if (++it != end) {
- if (is_trail(*it)) {
- cp += (mask8(*it) << 6) & 0xfff;
- if (++it != end) {
- if (is_trail(*it)) {
- cp += (*it) & 0x3f;
-
- if (code_point)
- *code_point = cp;
- ret_code = UTF8_OK;
- }
- else
- ret_code = INCOMPLETE_SEQUENCE;
- }
- else
- ret_code = NOT_ENOUGH_ROOM;
- }
- else
- ret_code = INCOMPLETE_SEQUENCE;
- }
- else
- ret_code = NOT_ENOUGH_ROOM;
- }
- else
- ret_code = INCOMPLETE_SEQUENCE;
- }
- else
- ret_code = NOT_ENOUGH_ROOM;
- }
+ if (it == end)
+ return NOT_ENOUGH_ROOM;
- return ret_code;
+ code_point = utf8::internal::mask8(*it);
+
+ UTF8_CPP_INCREASE_AND_RETURN_ON_ERROR(it, end)
+
+ code_point = ((code_point << 18) & 0x1fffff) + ((utf8::internal::mask8(*it) << 12) & 0x3ffff);
+
+ UTF8_CPP_INCREASE_AND_RETURN_ON_ERROR(it, end)
+
+ code_point += (utf8::internal::mask8(*it) << 6) & 0xfff;
+
+ UTF8_CPP_INCREASE_AND_RETURN_ON_ERROR(it, end)
+
+ code_point += (*it) & 0x3f;
+
+ return UTF8_OK;
}
+ #undef UTF8_CPP_INCREASE_AND_RETURN_ON_ERROR
+
template <typename octet_iterator>
- utf_error validate_next(octet_iterator& it, octet_iterator end, uint32_t* code_point)
+ utf_error validate_next(octet_iterator& it, octet_iterator end, uint32_t& code_point)
{
// Save the original value of it so we can go back in case of failure
// Of course, it does not make much sense with i.e. stream iterators
@@ -258,34 +229,33 @@ namespace internal
uint32_t cp = 0;
// Determine the sequence length based on the lead octet
typedef typename std::iterator_traits<octet_iterator>::difference_type octet_difference_type;
- octet_difference_type length = sequence_length(it);
- if (length == 0)
- return INVALID_LEAD;
+ const octet_difference_type length = utf8::internal::sequence_length(it);
- // Now that we have a valid sequence length, get trail octets and calculate the code point
+ // Get trail octets and calculate the code point
utf_error err = UTF8_OK;
switch (length) {
+ case 0:
+ return INVALID_LEAD;
case 1:
- err = get_sequence_1(it, end, &cp);
+ err = utf8::internal::get_sequence_1(it, end, cp);
break;
case 2:
- err = get_sequence_2(it, end, &cp);
+ err = utf8::internal::get_sequence_2(it, end, cp);
break;
case 3:
- err = get_sequence_3(it, end, &cp);
+ err = utf8::internal::get_sequence_3(it, end, cp);
break;
case 4:
- err = get_sequence_4(it, end, &cp);
+ err = utf8::internal::get_sequence_4(it, end, cp);
break;
}
if (err == UTF8_OK) {
// Decoding succeeded. Now, security checks...
- if (is_code_point_valid(cp)) {
- if (!is_overlong_sequence(cp, length)){
+ if (utf8::internal::is_code_point_valid(cp)) {
+ if (!utf8::internal::is_overlong_sequence(cp, length)){
// Passed! Return here.
- if (code_point)
- *code_point = cp;
+ code_point = cp;
++it;
return UTF8_OK;
}
@@ -303,7 +273,8 @@ namespace internal
template <typename octet_iterator>
inline utf_error validate_next(octet_iterator& it, octet_iterator end) {
- return validate_next(it, end, 0);
+ uint32_t ignored;
+ return utf8::internal::validate_next(it, end, ignored);
}
} // namespace internal
@@ -318,7 +289,7 @@ namespace internal
{
octet_iterator result = start;
while (result != end) {
- internal::utf_error err_code = internal::validate_next(result, end);
+ utf8::internal::utf_error err_code = utf8::internal::validate_next(result, end);
if (err_code != internal::UTF8_OK)
return result;
}
@@ -328,27 +299,27 @@ namespace internal
template <typename octet_iterator>
inline bool is_valid(octet_iterator start, octet_iterator end)
{
- return (find_invalid(start, end) == end);
+ return (utf8::find_invalid(start, end) == end);
}
template <typename octet_iterator>
inline bool starts_with_bom (octet_iterator it, octet_iterator end)
{
return (
- ((it != end) && (internal::mask8(*it++)) == bom[0]) &&
- ((it != end) && (internal::mask8(*it++)) == bom[1]) &&
- ((it != end) && (internal::mask8(*it)) == bom[2])
+ ((it != end) && (utf8::internal::mask8(*it++)) == bom[0]) &&
+ ((it != end) && (utf8::internal::mask8(*it++)) == bom[1]) &&
+ ((it != end) && (utf8::internal::mask8(*it)) == bom[2])
);
}
- //Deprecated in release 2.3
+ //Deprecated in release 2.3
template <typename octet_iterator>
inline bool is_bom (octet_iterator it)
{
return (
- (internal::mask8(*it++)) == bom[0] &&
- (internal::mask8(*it++)) == bom[1] &&
- (internal::mask8(*it)) == bom[2]
+ (utf8::internal::mask8(*it++)) == bom[0] &&
+ (utf8::internal::mask8(*it++)) == bom[1] &&
+ (utf8::internal::mask8(*it)) == bom[2]
);
}
} // namespace utf8
diff --git a/dep/utf8cpp/utf8/unchecked.h b/dep/utf8cpp/utf8/unchecked.h
index 2f3eb4d1d02..b4547fad945 100644
--- a/dep/utf8cpp/utf8/unchecked.h
+++ b/dep/utf8cpp/utf8/unchecked.h
@@ -60,7 +60,7 @@ namespace utf8
template <typename octet_iterator>
uint32_t next(octet_iterator& it)
{
- uint32_t cp = internal::mask8(*it);
+ uint32_t cp = utf8::internal::mask8(*it);
typename std::iterator_traits<octet_iterator>::difference_type length = utf8::internal::sequence_length(it);
switch (length) {
case 1:
@@ -71,15 +71,15 @@ namespace utf8
break;
case 3:
++it;
- cp = ((cp << 12) & 0xffff) + ((internal::mask8(*it) << 6) & 0xfff);
+ cp = ((cp << 12) & 0xffff) + ((utf8::internal::mask8(*it) << 6) & 0xfff);
++it;
cp += (*it) & 0x3f;
break;
case 4:
++it;
- cp = ((cp << 18) & 0x1fffff) + ((internal::mask8(*it) << 12) & 0x3ffff);
+ cp = ((cp << 18) & 0x1fffff) + ((utf8::internal::mask8(*it) << 12) & 0x3ffff);
++it;
- cp += (internal::mask8(*it) << 6) & 0xfff;
+ cp += (utf8::internal::mask8(*it) << 6) & 0xfff;
++it;
cp += (*it) & 0x3f;
break;
@@ -91,29 +91,29 @@ namespace utf8
template <typename octet_iterator>
uint32_t peek_next(octet_iterator it)
{
- return next(it);
+ return utf8::unchecked::next(it);
}
template <typename octet_iterator>
uint32_t prior(octet_iterator& it)
{
- while (internal::is_trail(*(--it))) ;
+ while (utf8::internal::is_trail(*(--it))) ;
octet_iterator temp = it;
- return next(temp);
+ return utf8::unchecked::next(temp);
}
// Deprecated in versions that include prior, but only for the sake of consistency (see utf8::previous)
template <typename octet_iterator>
inline uint32_t previous(octet_iterator& it)
{
- return prior(it);
+ return utf8::unchecked::prior(it);
}
template <typename octet_iterator, typename distance_type>
void advance (octet_iterator& it, distance_type n)
{
for (distance_type i = 0; i < n; ++i)
- next(it);
+ utf8::unchecked::next(it);
}
template <typename octet_iterator>
@@ -122,7 +122,7 @@ namespace utf8
{
typename std::iterator_traits<octet_iterator>::difference_type dist;
for (dist = 0; first < last; ++dist)
- next(first);
+ utf8::unchecked::next(first);
return dist;
}
@@ -130,13 +130,13 @@ namespace utf8
octet_iterator utf16to8 (u16bit_iterator start, u16bit_iterator end, octet_iterator result)
{
while (start != end) {
- uint32_t cp = internal::mask16(*start++);
+ uint32_t cp = utf8::internal::mask16(*start++);
// Take care of surrogate pairs first
- if (internal::is_lead_surrogate(cp)) {
- uint32_t trail_surrogate = internal::mask16(*start++);
+ if (utf8::internal::is_lead_surrogate(cp)) {
+ uint32_t trail_surrogate = utf8::internal::mask16(*start++);
cp = (cp << 10) + trail_surrogate + internal::SURROGATE_OFFSET;
}
- result = append(cp, result);
+ result = utf8::unchecked::append(cp, result);
}
return result;
}
@@ -145,7 +145,7 @@ namespace utf8
u16bit_iterator utf8to16 (octet_iterator start, octet_iterator end, u16bit_iterator result)
{
while (start < end) {
- uint32_t cp = next(start);
+ uint32_t cp = utf8::unchecked::next(start);
if (cp > 0xffff) { //make a surrogate pair
*result++ = static_cast<uint16_t>((cp >> 10) + internal::LEAD_OFFSET);
*result++ = static_cast<uint16_t>((cp & 0x3ff) + internal::TRAIL_SURROGATE_MIN);
@@ -160,7 +160,7 @@ namespace utf8
octet_iterator utf32to8 (u32bit_iterator start, u32bit_iterator end, octet_iterator result)
{
while (start != end)
- result = append(*(start++), result);
+ result = utf8::unchecked::append(*(start++), result);
return result;
}
@@ -169,7 +169,7 @@ namespace utf8
u32bit_iterator utf8to32 (octet_iterator start, octet_iterator end, u32bit_iterator result)
{
while (start < end)
- (*result++) = next(start);
+ (*result++) = utf8::unchecked::next(start);
return result;
}
@@ -186,7 +186,7 @@ namespace utf8
uint32_t operator * () const
{
octet_iterator temp = it;
- return next(temp);
+ return utf8::unchecked::next(temp);
}
bool operator == (const iterator& rhs) const
{
@@ -198,24 +198,24 @@ namespace utf8
}
iterator& operator ++ ()
{
- std::advance(it, internal::sequence_length(it));
+ ::std::advance(it, utf8::internal::sequence_length(it));
return *this;
}
iterator operator ++ (int)
{
iterator temp = *this;
- std::advance(it, internal::sequence_length(it));
+ ::std::advance(it, utf8::internal::sequence_length(it));
return temp;
}
iterator& operator -- ()
{
- prior(it);
+ utf8::unchecked::prior(it);
return *this;
}
iterator operator -- (int)
{
iterator temp = *this;
- prior(it);
+ utf8::unchecked::prior(it);
return temp;
}
}; // class iterator
diff --git a/dep/zlib/adler32.c b/dep/zlib/adler32.c
index 65ad6a5adc4..a868f073d8a 100644
--- a/dep/zlib/adler32.c
+++ b/dep/zlib/adler32.c
@@ -1,5 +1,5 @@
/* adler32.c -- compute the Adler-32 checksum of a data stream
- * Copyright (C) 1995-2007 Mark Adler
+ * Copyright (C) 1995-2011 Mark Adler
* For conditions of distribution and use, see copyright notice in zlib.h
*/
@@ -9,9 +9,9 @@
#define local static
-local uLong adler32_combine_(uLong adler1, uLong adler2, z_off64_t len2);
+local uLong adler32_combine_ OF((uLong adler1, uLong adler2, z_off64_t len2));
-#define BASE 65521UL /* largest prime smaller than 65536 */
+#define BASE 65521 /* largest prime smaller than 65536 */
#define NMAX 5552
/* NMAX is the largest n such that 255n(n+1)/2 + (n+1)(BASE-1) <= 2^32-1 */
@@ -21,39 +21,44 @@ local uLong adler32_combine_(uLong adler1, uLong adler2, z_off64_t len2);
#define DO8(buf,i) DO4(buf,i); DO4(buf,i+4);
#define DO16(buf) DO8(buf,0); DO8(buf,8);
-/* use NO_DIVIDE if your processor does not do division in hardware */
+/* use NO_DIVIDE if your processor does not do division in hardware --
+ try it both ways to see which is faster */
#ifdef NO_DIVIDE
-# define MOD(a) \
+/* note that this assumes BASE is 65521, where 65536 % 65521 == 15
+ (thank you to John Reiser for pointing this out) */
+# define CHOP(a) \
+ do { \
+ unsigned long tmp = a >> 16; \
+ a &= 0xffffUL; \
+ a += (tmp << 4) - tmp; \
+ } while (0)
+# define MOD28(a) \
do { \
- if (a >= (BASE << 16)) a -= (BASE << 16); \
- if (a >= (BASE << 15)) a -= (BASE << 15); \
- if (a >= (BASE << 14)) a -= (BASE << 14); \
- if (a >= (BASE << 13)) a -= (BASE << 13); \
- if (a >= (BASE << 12)) a -= (BASE << 12); \
- if (a >= (BASE << 11)) a -= (BASE << 11); \
- if (a >= (BASE << 10)) a -= (BASE << 10); \
- if (a >= (BASE << 9)) a -= (BASE << 9); \
- if (a >= (BASE << 8)) a -= (BASE << 8); \
- if (a >= (BASE << 7)) a -= (BASE << 7); \
- if (a >= (BASE << 6)) a -= (BASE << 6); \
- if (a >= (BASE << 5)) a -= (BASE << 5); \
- if (a >= (BASE << 4)) a -= (BASE << 4); \
- if (a >= (BASE << 3)) a -= (BASE << 3); \
- if (a >= (BASE << 2)) a -= (BASE << 2); \
- if (a >= (BASE << 1)) a -= (BASE << 1); \
+ CHOP(a); \
if (a >= BASE) a -= BASE; \
} while (0)
-# define MOD4(a) \
+# define MOD(a) \
do { \
- if (a >= (BASE << 4)) a -= (BASE << 4); \
- if (a >= (BASE << 3)) a -= (BASE << 3); \
- if (a >= (BASE << 2)) a -= (BASE << 2); \
- if (a >= (BASE << 1)) a -= (BASE << 1); \
+ CHOP(a); \
+ MOD28(a); \
+ } while (0)
+# define MOD63(a) \
+ do { /* this assumes a is not negative */ \
+ z_off64_t tmp = a >> 32; \
+ a &= 0xffffffffL; \
+ a += (tmp << 8) - (tmp << 5) + tmp; \
+ tmp = a >> 16; \
+ a &= 0xffffL; \
+ a += (tmp << 4) - tmp; \
+ tmp = a >> 16; \
+ a &= 0xffffL; \
+ a += (tmp << 4) - tmp; \
if (a >= BASE) a -= BASE; \
} while (0)
#else
# define MOD(a) a %= BASE
-# define MOD4(a) a %= BASE
+# define MOD28(a) a %= BASE
+# define MOD63(a) a %= BASE
#endif
/* ========================================================================= */
@@ -92,7 +97,7 @@ uLong ZEXPORT adler32(adler, buf, len)
}
if (adler >= BASE)
adler -= BASE;
- MOD4(sum2); /* only added so many BASE's */
+ MOD28(sum2); /* only added so many BASE's */
return adler | (sum2 << 16);
}
@@ -137,8 +142,13 @@ local uLong adler32_combine_(adler1, adler2, len2)
unsigned long sum2;
unsigned rem;
+ /* for negative len, return invalid adler32 as a clue for debugging */
+ if (len2 < 0)
+ return 0xffffffffUL;
+
/* the derivation of this formula is left as an exercise for the reader */
- rem = (unsigned)(len2 % BASE);
+ MOD63(len2); /* assumes len2 >= 0 */
+ rem = (unsigned)len2;
sum1 = adler1 & 0xffff;
sum2 = rem * sum1;
MOD(sum2);
diff --git a/dep/zlib/crc32.c b/dep/zlib/crc32.c
index 91be372d224..979a7190a3c 100644
--- a/dep/zlib/crc32.c
+++ b/dep/zlib/crc32.c
@@ -1,5 +1,5 @@
/* crc32.c -- compute the CRC-32 of a data stream
- * Copyright (C) 1995-2006, 2010 Mark Adler
+ * Copyright (C) 1995-2006, 2010, 2011, 2012 Mark Adler
* For conditions of distribution and use, see copyright notice in zlib.h
*
* Thanks to Rodney Brown <rbrown64@csc.com.au> for his contribution of faster
@@ -17,6 +17,8 @@
of the crc tables. Therefore, if you #define DYNAMIC_CRC_TABLE, you should
first call get_crc_table() to initialize the tables before allowing more than
one thread to use crc32().
+
+ DYNAMIC_CRC_TABLE and MAKECRCH can be #defined to write out crc32.h.
*/
#ifdef MAKECRCH
@@ -30,31 +32,11 @@
#define local static
-/* Find a four-byte integer type for crc32_little() and crc32_big(). */
-#ifndef NOBYFOUR
-# ifdef STDC /* need ANSI C limits.h to determine sizes */
-# include <limits.h>
-# define BYFOUR
-# if (UINT_MAX == 0xffffffffUL)
- typedef unsigned int u4;
-# else
-# if (ULONG_MAX == 0xffffffffUL)
- typedef unsigned long u4;
-# else
-# if (USHRT_MAX == 0xffffffffUL)
- typedef unsigned short u4;
-# else
-# undef BYFOUR /* can't find a four-byte integer type! */
-# endif
-# endif
-# endif
-# endif /* STDC */
-#endif /* !NOBYFOUR */
-
/* Definitions for doing the crc four data bytes at a time. */
+#if !defined(NOBYFOUR) && defined(Z_U4)
+# define BYFOUR
+#endif
#ifdef BYFOUR
-# define REV(w) ((((w)>>24)&0xff)+(((w)>>8)&0xff00)+ \
- (((w)&0xff00)<<8)+(((w)&0xff)<<24))
local unsigned long crc32_little OF((unsigned long,
const unsigned char FAR *, unsigned));
local unsigned long crc32_big OF((unsigned long,
@@ -68,16 +50,16 @@
local unsigned long gf2_matrix_times OF((unsigned long *mat,
unsigned long vec));
local void gf2_matrix_square OF((unsigned long *square, unsigned long *mat));
-local uLong crc32_combine_(uLong crc1, uLong crc2, z_off64_t len2);
+local uLong crc32_combine_ OF((uLong crc1, uLong crc2, z_off64_t len2));
#ifdef DYNAMIC_CRC_TABLE
local volatile int crc_table_empty = 1;
-local unsigned long FAR crc_table[TBLS][256];
+local z_crc_t FAR crc_table[TBLS][256];
local void make_crc_table OF((void));
#ifdef MAKECRCH
- local void write_table OF((FILE *, const unsigned long FAR *));
+ local void write_table OF((FILE *, const z_crc_t FAR *));
#endif /* MAKECRCH */
/*
Generate tables for a byte-wise 32-bit CRC calculation on the polynomial:
@@ -107,9 +89,9 @@ local void make_crc_table OF((void));
*/
local void make_crc_table()
{
- unsigned long c;
+ z_crc_t c;
int n, k;
- unsigned long poly; /* polynomial exclusive-or pattern */
+ z_crc_t poly; /* polynomial exclusive-or pattern */
/* terms of polynomial defining this crc (except x^32): */
static volatile int first = 1; /* flag to limit concurrent making */
static const unsigned char p[] = {0,1,2,4,5,7,8,10,11,12,16,22,23,26};
@@ -121,13 +103,13 @@ local void make_crc_table()
first = 0;
/* make exclusive-or pattern from polynomial (0xedb88320UL) */
- poly = 0UL;
- for (n = 0; n < sizeof(p)/sizeof(unsigned char); n++)
- poly |= 1UL << (31 - p[n]);
+ poly = 0;
+ for (n = 0; n < (int)(sizeof(p)/sizeof(unsigned char)); n++)
+ poly |= (z_crc_t)1 << (31 - p[n]);
/* generate a crc for every 8-bit value */
for (n = 0; n < 256; n++) {
- c = (unsigned long)n;
+ c = (z_crc_t)n;
for (k = 0; k < 8; k++)
c = c & 1 ? poly ^ (c >> 1) : c >> 1;
crc_table[0][n] = c;
@@ -138,11 +120,11 @@ local void make_crc_table()
and then the byte reversal of those as well as the first table */
for (n = 0; n < 256; n++) {
c = crc_table[0][n];
- crc_table[4][n] = REV(c);
+ crc_table[4][n] = ZSWAP32(c);
for (k = 1; k < 4; k++) {
c = crc_table[0][c & 0xff] ^ (c >> 8);
crc_table[k][n] = c;
- crc_table[k + 4][n] = REV(c);
+ crc_table[k + 4][n] = ZSWAP32(c);
}
}
#endif /* BYFOUR */
@@ -164,7 +146,7 @@ local void make_crc_table()
if (out == NULL) return;
fprintf(out, "/* crc32.h -- tables for rapid CRC calculation\n");
fprintf(out, " * Generated automatically by crc32.c\n */\n\n");
- fprintf(out, "local const unsigned long FAR ");
+ fprintf(out, "local const z_crc_t FAR ");
fprintf(out, "crc_table[TBLS][256] =\n{\n {\n");
write_table(out, crc_table[0]);
# ifdef BYFOUR
@@ -184,12 +166,13 @@ local void make_crc_table()
#ifdef MAKECRCH
local void write_table(out, table)
FILE *out;
- const unsigned long FAR *table;
+ const z_crc_t FAR *table;
{
int n;
for (n = 0; n < 256; n++)
- fprintf(out, "%s0x%08lxUL%s", n % 5 ? "" : " ", table[n],
+ fprintf(out, "%s0x%08lxUL%s", n % 5 ? "" : " ",
+ (unsigned long)(table[n]),
n == 255 ? "\n" : (n % 5 == 4 ? ",\n" : ", "));
}
#endif /* MAKECRCH */
@@ -204,13 +187,13 @@ local void write_table(out, table)
/* =========================================================================
* This function can be used by asm versions of crc32()
*/
-const unsigned long FAR * ZEXPORT get_crc_table()
+const z_crc_t FAR * ZEXPORT get_crc_table()
{
#ifdef DYNAMIC_CRC_TABLE
if (crc_table_empty)
make_crc_table();
#endif /* DYNAMIC_CRC_TABLE */
- return (const unsigned long FAR *)crc_table;
+ return (const z_crc_t FAR *)crc_table;
}
/* ========================================================================= */
@@ -232,7 +215,7 @@ unsigned long ZEXPORT crc32(crc, buf, len)
#ifdef BYFOUR
if (sizeof(void *) == sizeof(ptrdiff_t)) {
- u4 endian;
+ z_crc_t endian;
endian = 1;
if (*((unsigned char *)(&endian)))
@@ -266,17 +249,17 @@ local unsigned long crc32_little(crc, buf, len)
const unsigned char FAR *buf;
unsigned len;
{
- register u4 c;
- register const u4 FAR *buf4;
+ register z_crc_t c;
+ register const z_crc_t FAR *buf4;
- c = (u4)crc;
+ c = (z_crc_t)crc;
c = ~c;
while (len && ((ptrdiff_t)buf & 3)) {
c = crc_table[0][(c ^ *buf++) & 0xff] ^ (c >> 8);
len--;
}
- buf4 = (const u4 FAR *)(const void FAR *)buf;
+ buf4 = (const z_crc_t FAR *)(const void FAR *)buf;
while (len >= 32) {
DOLIT32;
len -= 32;
@@ -306,17 +289,17 @@ local unsigned long crc32_big(crc, buf, len)
const unsigned char FAR *buf;
unsigned len;
{
- register u4 c;
- register const u4 FAR *buf4;
+ register z_crc_t c;
+ register const z_crc_t FAR *buf4;
- c = REV((u4)crc);
+ c = ZSWAP32((z_crc_t)crc);
c = ~c;
while (len && ((ptrdiff_t)buf & 3)) {
c = crc_table[4][(c >> 24) ^ *buf++] ^ (c << 8);
len--;
}
- buf4 = (const u4 FAR *)(const void FAR *)buf;
+ buf4 = (const z_crc_t FAR *)(const void FAR *)buf;
buf4--;
while (len >= 32) {
DOBIG32;
@@ -333,7 +316,7 @@ local unsigned long crc32_big(crc, buf, len)
c = crc_table[4][(c >> 24) ^ *buf++] ^ (c << 8);
} while (--len);
c = ~c;
- return (unsigned long)(REV(c));
+ return (unsigned long)(ZSWAP32(c));
}
#endif /* BYFOUR */
diff --git a/dep/zlib/crc32.h b/dep/zlib/crc32.h
index 8053b6117c0..9e0c7781025 100644
--- a/dep/zlib/crc32.h
+++ b/dep/zlib/crc32.h
@@ -2,7 +2,7 @@
* Generated automatically by crc32.c
*/
-local const unsigned long FAR crc_table[TBLS][256] =
+local const z_crc_t FAR crc_table[TBLS][256] =
{
{
0x00000000UL, 0x77073096UL, 0xee0e612cUL, 0x990951baUL, 0x076dc419UL,
diff --git a/dep/zlib/deflate.c b/dep/zlib/deflate.c
index 5c4022f3d47..9e4c2cbc8af 100644
--- a/dep/zlib/deflate.c
+++ b/dep/zlib/deflate.c
@@ -1,5 +1,5 @@
/* deflate.c -- compress data using the deflation algorithm
- * Copyright (C) 1995-2010 Jean-loup Gailly and Mark Adler
+ * Copyright (C) 1995-2012 Jean-loup Gailly and Mark Adler
* For conditions of distribution and use, see copyright notice in zlib.h
*/
@@ -37,7 +37,7 @@
* REFERENCES
*
* Deutsch, L.P.,"DEFLATE Compressed Data Format Specification".
- * Available in http://www.ietf.org/rfc/rfc1951.txt
+ * Available in http://tools.ietf.org/html/rfc1951
*
* A description of the Rabin and Karp algorithm is given in the book
* "Algorithms" by R. Sedgewick, Addison-Wesley, p252.
@@ -52,7 +52,7 @@
#include "deflate.h"
const char deflate_copyright[] =
- " deflate 1.2.5 Copyright 1995-2010 Jean-loup Gailly and Mark Adler ";
+ " deflate 1.2.7 Copyright 1995-2012 Jean-loup Gailly and Mark Adler ";
/*
If you use the zlib library in a product, an acknowledgment is welcome
in the documentation of your product. If for some reason you cannot
@@ -155,6 +155,9 @@ local const config configuration_table[10] = {
struct static_tree_desc_s {int dummy;}; /* for buggy compilers */
#endif
+/* rank Z_BLOCK between Z_NO_FLUSH and Z_PARTIAL_FLUSH */
+#define RANK(f) (((f) << 1) - ((f) > 4 ? 9 : 0))
+
/* ===========================================================================
* Update a hash value with the given input byte
* IN assertion: all calls to to UPDATE_HASH are made with consecutive
@@ -235,10 +238,19 @@ int ZEXPORT deflateInit2_(strm, level, method, windowBits, memLevel, strategy,
strm->msg = Z_NULL;
if (strm->zalloc == (alloc_func)0) {
+#ifdef Z_SOLO
+ return Z_STREAM_ERROR;
+#else
strm->zalloc = zcalloc;
strm->opaque = (voidpf)0;
+#endif
}
- if (strm->zfree == (free_func)0) strm->zfree = zcfree;
+ if (strm->zfree == (free_func)0)
+#ifdef Z_SOLO
+ return Z_STREAM_ERROR;
+#else
+ strm->zfree = zcfree;
+#endif
#ifdef FASTEST
if (level != 0) level = 1;
@@ -314,43 +326,70 @@ int ZEXPORT deflateSetDictionary (strm, dictionary, dictLength)
uInt dictLength;
{
deflate_state *s;
- uInt length = dictLength;
- uInt n;
- IPos hash_head = 0;
+ uInt str, n;
+ int wrap;
+ unsigned avail;
+ unsigned char *next;
- if (strm == Z_NULL || strm->state == Z_NULL || dictionary == Z_NULL ||
- strm->state->wrap == 2 ||
- (strm->state->wrap == 1 && strm->state->status != INIT_STATE))
+ if (strm == Z_NULL || strm->state == Z_NULL || dictionary == Z_NULL)
return Z_STREAM_ERROR;
-
s = strm->state;
- if (s->wrap)
- strm->adler = adler32(strm->adler, dictionary, dictLength);
+ wrap = s->wrap;
+ if (wrap == 2 || (wrap == 1 && s->status != INIT_STATE) || s->lookahead)
+ return Z_STREAM_ERROR;
- if (length < MIN_MATCH) return Z_OK;
- if (length > s->w_size) {
- length = s->w_size;
- dictionary += dictLength - length; /* use the tail of the dictionary */
+ /* when using zlib wrappers, compute Adler-32 for provided dictionary */
+ if (wrap == 1)
+ strm->adler = adler32(strm->adler, dictionary, dictLength);
+ s->wrap = 0; /* avoid computing Adler-32 in read_buf */
+
+ /* if dictionary would fill window, just replace the history */
+ if (dictLength >= s->w_size) {
+ if (wrap == 0) { /* already empty otherwise */
+ CLEAR_HASH(s);
+ s->strstart = 0;
+ s->block_start = 0L;
+ s->insert = 0;
+ }
+ dictionary += dictLength - s->w_size; /* use the tail */
+ dictLength = s->w_size;
}
- zmemcpy(s->window, dictionary, length);
- s->strstart = length;
- s->block_start = (long)length;
- /* Insert all strings in the hash table (except for the last two bytes).
- * s->lookahead stays null, so s->ins_h will be recomputed at the next
- * call of fill_window.
- */
- s->ins_h = s->window[0];
- UPDATE_HASH(s, s->ins_h, s->window[1]);
- for (n = 0; n <= length - MIN_MATCH; n++) {
- INSERT_STRING(s, n, hash_head);
+ /* insert dictionary into window and hash */
+ avail = strm->avail_in;
+ next = strm->next_in;
+ strm->avail_in = dictLength;
+ strm->next_in = (Bytef *)dictionary;
+ fill_window(s);
+ while (s->lookahead >= MIN_MATCH) {
+ str = s->strstart;
+ n = s->lookahead - (MIN_MATCH-1);
+ do {
+ UPDATE_HASH(s, s->ins_h, s->window[str + MIN_MATCH-1]);
+#ifndef FASTEST
+ s->prev[str & s->w_mask] = s->head[s->ins_h];
+#endif
+ s->head[s->ins_h] = (Pos)str;
+ str++;
+ } while (--n);
+ s->strstart = str;
+ s->lookahead = MIN_MATCH-1;
+ fill_window(s);
}
- if (hash_head) hash_head = 0; /* to make compiler happy */
+ s->strstart += s->lookahead;
+ s->block_start = (long)s->strstart;
+ s->insert = s->lookahead;
+ s->lookahead = 0;
+ s->match_length = s->prev_length = MIN_MATCH-1;
+ s->match_available = 0;
+ strm->next_in = next;
+ strm->avail_in = avail;
+ s->wrap = wrap;
return Z_OK;
}
/* ========================================================================= */
-int ZEXPORT deflateReset (strm)
+int ZEXPORT deflateResetKeep (strm)
z_streamp strm;
{
deflate_state *s;
@@ -380,12 +419,23 @@ int ZEXPORT deflateReset (strm)
s->last_flush = Z_NO_FLUSH;
_tr_init(s);
- lm_init(s);
return Z_OK;
}
/* ========================================================================= */
+int ZEXPORT deflateReset (strm)
+ z_streamp strm;
+{
+ int ret;
+
+ ret = deflateResetKeep(strm);
+ if (ret == Z_OK)
+ lm_init(strm->state);
+ return ret;
+}
+
+/* ========================================================================= */
int ZEXPORT deflateSetHeader (strm, head)
z_streamp strm;
gz_headerp head;
@@ -397,14 +447,42 @@ int ZEXPORT deflateSetHeader (strm, head)
}
/* ========================================================================= */
+int ZEXPORT deflatePending (strm, pending, bits)
+ unsigned *pending;
+ int *bits;
+ z_streamp strm;
+{
+ if (strm == Z_NULL || strm->state == Z_NULL) return Z_STREAM_ERROR;
+ if (pending != Z_NULL)
+ *pending = strm->state->pending;
+ if (bits != Z_NULL)
+ *bits = strm->state->bi_valid;
+ return Z_OK;
+}
+
+/* ========================================================================= */
int ZEXPORT deflatePrime (strm, bits, value)
z_streamp strm;
int bits;
int value;
{
+ deflate_state *s;
+ int put;
+
if (strm == Z_NULL || strm->state == Z_NULL) return Z_STREAM_ERROR;
- strm->state->bi_valid = bits;
- strm->state->bi_buf = (ush)(value & ((1 << bits) - 1));
+ s = strm->state;
+ if ((Bytef *)(s->d_buf) < s->pending_out + ((Buf_size + 7) >> 3))
+ return Z_BUF_ERROR;
+ do {
+ put = Buf_size - s->bi_valid;
+ if (put > bits)
+ put = bits;
+ s->bi_buf |= (ush)((value & ((1 << put) - 1)) << s->bi_valid);
+ s->bi_valid += put;
+ _tr_flush_bits(s);
+ value >>= put;
+ bits -= put;
+ } while (bits);
return Z_OK;
}
@@ -562,19 +640,22 @@ local void putShortMSB (s, b)
local void flush_pending(strm)
z_streamp strm;
{
- unsigned len = strm->state->pending;
+ unsigned len;
+ deflate_state *s = strm->state;
+ _tr_flush_bits(s);
+ len = s->pending;
if (len > strm->avail_out) len = strm->avail_out;
if (len == 0) return;
- zmemcpy(strm->next_out, strm->state->pending_out, len);
+ zmemcpy(strm->next_out, s->pending_out, len);
strm->next_out += len;
- strm->state->pending_out += len;
+ s->pending_out += len;
strm->total_out += len;
strm->avail_out -= len;
- strm->state->pending -= len;
- if (strm->state->pending == 0) {
- strm->state->pending_out = strm->state->pending_buf;
+ s->pending -= len;
+ if (s->pending == 0) {
+ s->pending_out = s->pending_buf;
}
}
@@ -801,7 +882,7 @@ int ZEXPORT deflate (strm, flush)
* flushes. For repeated and useless calls with Z_FINISH, we keep
* returning Z_STREAM_END instead of Z_BUF_ERROR.
*/
- } else if (strm->avail_in == 0 && flush <= old_flush &&
+ } else if (strm->avail_in == 0 && RANK(flush) <= RANK(old_flush) &&
flush != Z_FINISH) {
ERR_RETURN(strm, Z_BUF_ERROR);
}
@@ -850,6 +931,7 @@ int ZEXPORT deflate (strm, flush)
if (s->lookahead == 0) {
s->strstart = 0;
s->block_start = 0L;
+ s->insert = 0;
}
}
}
@@ -945,12 +1027,12 @@ int ZEXPORT deflateCopy (dest, source)
ss = source->state;
- zmemcpy(dest, source, sizeof(z_stream));
+ zmemcpy((voidpf)dest, (voidpf)source, sizeof(z_stream));
ds = (deflate_state *) ZALLOC(dest, 1, sizeof(deflate_state));
if (ds == Z_NULL) return Z_MEM_ERROR;
dest->state = (struct internal_state FAR *) ds;
- zmemcpy(ds, ss, sizeof(deflate_state));
+ zmemcpy((voidpf)ds, (voidpf)ss, sizeof(deflate_state));
ds->strm = dest;
ds->window = (Bytef *) ZALLOC(dest, ds->w_size, 2*sizeof(Byte));
@@ -966,8 +1048,8 @@ int ZEXPORT deflateCopy (dest, source)
}
/* following zmemcpy do not work for 16-bit MSDOS */
zmemcpy(ds->window, ss->window, ds->w_size * 2 * sizeof(Byte));
- zmemcpy(ds->prev, ss->prev, ds->w_size * sizeof(Pos));
- zmemcpy(ds->head, ss->head, ds->hash_size * sizeof(Pos));
+ zmemcpy((voidpf)ds->prev, (voidpf)ss->prev, ds->w_size * sizeof(Pos));
+ zmemcpy((voidpf)ds->head, (voidpf)ss->head, ds->hash_size * sizeof(Pos));
zmemcpy(ds->pending_buf, ss->pending_buf, (uInt)ds->pending_buf_size);
ds->pending_out = ds->pending_buf + (ss->pending_out - ss->pending_buf);
@@ -1001,15 +1083,15 @@ local int read_buf(strm, buf, size)
strm->avail_in -= len;
+ zmemcpy(buf, strm->next_in, len);
if (strm->state->wrap == 1) {
- strm->adler = adler32(strm->adler, strm->next_in, len);
+ strm->adler = adler32(strm->adler, buf, len);
}
#ifdef GZIP
else if (strm->state->wrap == 2) {
- strm->adler = crc32(strm->adler, strm->next_in, len);
+ strm->adler = crc32(strm->adler, buf, len);
}
#endif
- zmemcpy(buf, strm->next_in, len);
strm->next_in += len;
strm->total_in += len;
@@ -1036,6 +1118,7 @@ local void lm_init (s)
s->strstart = 0;
s->block_start = 0L;
s->lookahead = 0;
+ s->insert = 0;
s->match_length = s->prev_length = MIN_MATCH-1;
s->match_available = 0;
s->ins_h = 0;
@@ -1310,6 +1393,8 @@ local void fill_window(s)
unsigned more; /* Amount of free space at the end of the window. */
uInt wsize = s->w_size;
+ Assert(s->lookahead < MIN_LOOKAHEAD, "already enough lookahead");
+
do {
more = (unsigned)(s->window_size -(ulg)s->lookahead -(ulg)s->strstart);
@@ -1362,7 +1447,7 @@ local void fill_window(s)
#endif
more += wsize;
}
- if (s->strm->avail_in == 0) return;
+ if (s->strm->avail_in == 0) break;
/* If there was no sliding:
* strstart <= WSIZE+MAX_DIST-1 && lookahead <= MIN_LOOKAHEAD - 1 &&
@@ -1381,12 +1466,24 @@ local void fill_window(s)
s->lookahead += n;
/* Initialize the hash value now that we have some input: */
- if (s->lookahead >= MIN_MATCH) {
- s->ins_h = s->window[s->strstart];
- UPDATE_HASH(s, s->ins_h, s->window[s->strstart+1]);
+ if (s->lookahead + s->insert >= MIN_MATCH) {
+ uInt str = s->strstart - s->insert;
+ s->ins_h = s->window[str];
+ UPDATE_HASH(s, s->ins_h, s->window[str + 1]);
#if MIN_MATCH != 3
Call UPDATE_HASH() MIN_MATCH-3 more times
#endif
+ while (s->insert) {
+ UPDATE_HASH(s, s->ins_h, s->window[str + MIN_MATCH-1]);
+#ifndef FASTEST
+ s->prev[str & s->w_mask] = s->head[s->ins_h];
+#endif
+ s->head[s->ins_h] = (Pos)str;
+ str++;
+ s->insert--;
+ if (s->lookahead + s->insert < MIN_MATCH)
+ break;
+ }
}
/* If the whole input has less than MIN_MATCH bytes, ins_h is garbage,
* but this is not important since only literal bytes will be emitted.
@@ -1427,6 +1524,9 @@ local void fill_window(s)
s->high_water += init;
}
}
+
+ Assert((ulg)s->strstart <= s->window_size - MIN_LOOKAHEAD,
+ "not enough room for search");
}
/* ===========================================================================
@@ -1506,8 +1606,14 @@ local block_state deflate_stored(s, flush)
FLUSH_BLOCK(s, 0);
}
}
- FLUSH_BLOCK(s, flush == Z_FINISH);
- return flush == Z_FINISH ? finish_done : block_done;
+ s->insert = 0;
+ if (flush == Z_FINISH) {
+ FLUSH_BLOCK(s, 1);
+ return finish_done;
+ }
+ if ((long)s->strstart > s->block_start)
+ FLUSH_BLOCK(s, 0);
+ return block_done;
}
/* ===========================================================================
@@ -1603,8 +1709,14 @@ local block_state deflate_fast(s, flush)
}
if (bflush) FLUSH_BLOCK(s, 0);
}
- FLUSH_BLOCK(s, flush == Z_FINISH);
- return flush == Z_FINISH ? finish_done : block_done;
+ s->insert = s->strstart < MIN_MATCH-1 ? s->strstart : MIN_MATCH-1;
+ if (flush == Z_FINISH) {
+ FLUSH_BLOCK(s, 1);
+ return finish_done;
+ }
+ if (s->last_lit)
+ FLUSH_BLOCK(s, 0);
+ return block_done;
}
#ifndef FASTEST
@@ -1728,8 +1840,14 @@ local block_state deflate_slow(s, flush)
_tr_tally_lit(s, s->window[s->strstart-1], bflush);
s->match_available = 0;
}
- FLUSH_BLOCK(s, flush == Z_FINISH);
- return flush == Z_FINISH ? finish_done : block_done;
+ s->insert = s->strstart < MIN_MATCH-1 ? s->strstart : MIN_MATCH-1;
+ if (flush == Z_FINISH) {
+ FLUSH_BLOCK(s, 1);
+ return finish_done;
+ }
+ if (s->last_lit)
+ FLUSH_BLOCK(s, 0);
+ return block_done;
}
#endif /* FASTEST */
@@ -1749,11 +1867,11 @@ local block_state deflate_rle(s, flush)
for (;;) {
/* Make sure that we always have enough lookahead, except
* at the end of the input file. We need MAX_MATCH bytes
- * for the longest encodable run.
+ * for the longest run, plus one for the unrolled loop.
*/
- if (s->lookahead < MAX_MATCH) {
+ if (s->lookahead <= MAX_MATCH) {
fill_window(s);
- if (s->lookahead < MAX_MATCH && flush == Z_NO_FLUSH) {
+ if (s->lookahead <= MAX_MATCH && flush == Z_NO_FLUSH) {
return need_more;
}
if (s->lookahead == 0) break; /* flush the current block */
@@ -1776,6 +1894,7 @@ local block_state deflate_rle(s, flush)
if (s->match_length > s->lookahead)
s->match_length = s->lookahead;
}
+ Assert(scan <= s->window+(uInt)(s->window_size-1), "wild scan");
}
/* Emit match if have run of MIN_MATCH or longer, else emit literal */
@@ -1796,8 +1915,14 @@ local block_state deflate_rle(s, flush)
}
if (bflush) FLUSH_BLOCK(s, 0);
}
- FLUSH_BLOCK(s, flush == Z_FINISH);
- return flush == Z_FINISH ? finish_done : block_done;
+ s->insert = 0;
+ if (flush == Z_FINISH) {
+ FLUSH_BLOCK(s, 1);
+ return finish_done;
+ }
+ if (s->last_lit)
+ FLUSH_BLOCK(s, 0);
+ return block_done;
}
/* ===========================================================================
@@ -1829,6 +1954,12 @@ local block_state deflate_huff(s, flush)
s->strstart++;
if (bflush) FLUSH_BLOCK(s, 0);
}
- FLUSH_BLOCK(s, flush == Z_FINISH);
- return flush == Z_FINISH ? finish_done : block_done;
+ s->insert = 0;
+ if (flush == Z_FINISH) {
+ FLUSH_BLOCK(s, 1);
+ return finish_done;
+ }
+ if (s->last_lit)
+ FLUSH_BLOCK(s, 0);
+ return block_done;
}
diff --git a/dep/zlib/deflate.h b/dep/zlib/deflate.h
index cbf0d1ea5d9..fbac44d908e 100644
--- a/dep/zlib/deflate.h
+++ b/dep/zlib/deflate.h
@@ -1,5 +1,5 @@
/* deflate.h -- internal compression state
- * Copyright (C) 1995-2010 Jean-loup Gailly
+ * Copyright (C) 1995-2012 Jean-loup Gailly
* For conditions of distribution and use, see copyright notice in zlib.h
*/
@@ -48,6 +48,9 @@
#define MAX_BITS 15
/* All codes must not exceed MAX_BITS bits */
+#define Buf_size 16
+/* size of bit buffer in bi_buf */
+
#define INIT_STATE 42
#define EXTRA_STATE 69
#define NAME_STATE 73
@@ -188,7 +191,7 @@ typedef struct internal_state {
int nice_match; /* Stop searching when current match exceeds this */
/* used by trees.c: */
- /* Didn't use ct_data typedef below to supress compiler warning */
+ /* Didn't use ct_data typedef below to suppress compiler warning */
struct ct_data_s dyn_ltree[HEAP_SIZE]; /* literal and length tree */
struct ct_data_s dyn_dtree[2*D_CODES+1]; /* distance tree */
struct ct_data_s bl_tree[2*BL_CODES+1]; /* Huffman tree for bit lengths */
@@ -244,7 +247,7 @@ typedef struct internal_state {
ulg opt_len; /* bit length of current block with optimal trees */
ulg static_len; /* bit length of current block with static trees */
uInt matches; /* number of string matches in current block */
- int last_eob_len; /* bit length of EOB code for last block */
+ uInt insert; /* bytes at end of window left to insert */
#ifdef DEBUG
ulg compressed_len; /* total bit length of compressed file mod 2^32 */
@@ -294,6 +297,7 @@ void ZLIB_INTERNAL _tr_init OF((deflate_state *s));
int ZLIB_INTERNAL _tr_tally OF((deflate_state *s, unsigned dist, unsigned lc));
void ZLIB_INTERNAL _tr_flush_block OF((deflate_state *s, charf *buf,
ulg stored_len, int last));
+void ZLIB_INTERNAL _tr_flush_bits OF((deflate_state *s));
void ZLIB_INTERNAL _tr_align OF((deflate_state *s));
void ZLIB_INTERNAL _tr_stored_block OF((deflate_state *s, charf *buf,
ulg stored_len, int last));
diff --git a/dep/zlib/gzguts.h b/dep/zlib/gzguts.h
index 0f8fb79f87d..ee3f281aa57 100644
--- a/dep/zlib/gzguts.h
+++ b/dep/zlib/gzguts.h
@@ -1,5 +1,5 @@
/* gzguts.h -- zlib internal header definitions for gz* operations
- * Copyright (C) 2004, 2005, 2010 Mark Adler
+ * Copyright (C) 2004, 2005, 2010, 2011, 2012 Mark Adler
* For conditions of distribution and use, see copyright notice in zlib.h
*/
@@ -12,7 +12,7 @@
# endif
#endif
-#if ((__GNUC__-0) * 10 + __GNUC_MINOR__-0 >= 33) && !defined(NO_VIZ)
+#ifdef HAVE_HIDDEN
# define ZLIB_INTERNAL __attribute__((visibility ("hidden")))
#else
# define ZLIB_INTERNAL
@@ -27,13 +27,65 @@
#endif
#include <fcntl.h>
+#ifdef _WIN32
+# include <stddef.h>
+#endif
+
+#if defined(__TURBOC__) || defined(_MSC_VER) || defined(_WIN32)
+# include <io.h>
+#endif
+
#ifdef NO_DEFLATE /* for compatibility with old definition */
# define NO_GZCOMPRESS
#endif
-#ifdef _MSC_VER
-# include <io.h>
-# define vsnprintf _vsnprintf
+#if defined(STDC99) || (defined(__TURBOC__) && __TURBOC__ >= 0x550)
+# ifndef HAVE_VSNPRINTF
+# define HAVE_VSNPRINTF
+# endif
+#endif
+
+#if defined(__CYGWIN__)
+# ifndef HAVE_VSNPRINTF
+# define HAVE_VSNPRINTF
+# endif
+#endif
+
+#if defined(MSDOS) && defined(__BORLANDC__) && (BORLANDC > 0x410)
+# ifndef HAVE_VSNPRINTF
+# define HAVE_VSNPRINTF
+# endif
+#endif
+
+#ifndef HAVE_VSNPRINTF
+# ifdef MSDOS
+/* vsnprintf may exist on some MS-DOS compilers (DJGPP?),
+ but for now we just assume it doesn't. */
+# define NO_vsnprintf
+# endif
+# ifdef __TURBOC__
+# define NO_vsnprintf
+# endif
+# ifdef WIN32
+/* In Win32, vsnprintf is available as the "non-ANSI" _vsnprintf. */
+# if !defined(vsnprintf) && !defined(NO_vsnprintf)
+# if !defined(_MSC_VER) || ( defined(_MSC_VER) && _MSC_VER < 1500 )
+# define vsnprintf _vsnprintf
+# endif
+# endif
+# endif
+# ifdef __SASC
+# define NO_vsnprintf
+# endif
+# ifdef VMS
+# define NO_vsnprintf
+# endif
+# ifdef __OS400__
+# define NO_vsnprintf
+# endif
+# ifdef __MVS__
+# define NO_vsnprintf
+# endif
#endif
#ifndef local
@@ -52,7 +104,7 @@
# include <windows.h>
# define zstrerror() gz_strwinerror((DWORD)GetLastError())
#else
-# ifdef STDC
+# ifndef NO_STRERROR
# include <errno.h>
# define zstrerror() strerror(errno)
# else
@@ -68,6 +120,13 @@
ZEXTERN z_off64_t ZEXPORT gzoffset64 OF((gzFile));
#endif
+/* default memLevel */
+#if MAX_MEM_LEVEL >= 8
+# define DEF_MEM_LEVEL 8
+#else
+# define DEF_MEM_LEVEL MAX_MEM_LEVEL
+#endif
+
/* default i/o buffer size -- double this for output when reading */
#define GZBUFSIZE 8192
@@ -84,23 +143,25 @@
/* internal gzip file state data structure */
typedef struct {
+ /* exposed contents for gzgetc() macro */
+ struct gzFile_s x; /* "x" for exposed */
+ /* x.have: number of bytes available at x.next */
+ /* x.next: next output data to deliver or write */
+ /* x.pos: current position in uncompressed data */
/* used for both reading and writing */
int mode; /* see gzip modes above */
int fd; /* file descriptor */
char *path; /* path or fd for error messages */
- z_off64_t pos; /* current position in uncompressed data */
unsigned size; /* buffer size, zero if not allocated yet */
unsigned want; /* requested buffer size, default is GZBUFSIZE */
unsigned char *in; /* input buffer */
unsigned char *out; /* output buffer (double-sized when reading) */
- unsigned char *next; /* next output data to deliver or write */
+ int direct; /* 0 if processing gzip, 1 if transparent */
/* just for reading */
- unsigned have; /* amount of output data unused at next */
- int eof; /* true if end of input file reached */
- z_off64_t start; /* where the gzip data started, for rewinding */
- z_off64_t raw; /* where the raw data started, for seeking */
int how; /* 0: get header, 1: copy, 2: decompress */
- int direct; /* true if last read direct, false if gzip */
+ z_off64_t start; /* where the gzip data started, for rewinding */
+ int eof; /* true if end of input file reached */
+ int past; /* true if read requested past end */
/* just for writing */
int level; /* compression level */
int strategy; /* compression strategy */
diff --git a/dep/zlib/gzlib.c b/dep/zlib/gzlib.c
index 603e60ed544..ca55c6ea926 100644
--- a/dep/zlib/gzlib.c
+++ b/dep/zlib/gzlib.c
@@ -1,19 +1,23 @@
/* gzlib.c -- zlib functions common to reading and writing gzip files
- * Copyright (C) 2004, 2010 Mark Adler
+ * Copyright (C) 2004, 2010, 2011, 2012 Mark Adler
* For conditions of distribution and use, see copyright notice in zlib.h
*/
#include "gzguts.h"
+#if defined(_WIN32) && !defined(__BORLANDC__)
+# define LSEEK _lseeki64
+#else
#if defined(_LARGEFILE64_SOURCE) && _LFS64_LARGEFILE-0
# define LSEEK lseek64
#else
# define LSEEK lseek
#endif
+#endif
/* Local functions */
local void gz_reset OF((gz_statep));
-local gzFile gz_open OF((const char *, int, const char *));
+local gzFile gz_open OF((const void *, int, const char *));
#if defined UNDER_CE
@@ -71,25 +75,37 @@ char ZLIB_INTERNAL *gz_strwinerror (error)
local void gz_reset(state)
gz_statep state;
{
+ state->x.have = 0; /* no output data available */
if (state->mode == GZ_READ) { /* for reading ... */
- state->have = 0; /* no output data available */
state->eof = 0; /* not at end of file */
+ state->past = 0; /* have not read past end yet */
state->how = LOOK; /* look for gzip header */
- state->direct = 1; /* default for empty file */
}
state->seek = 0; /* no seek request pending */
gz_error(state, Z_OK, NULL); /* clear error */
- state->pos = 0; /* no uncompressed data yet */
+ state->x.pos = 0; /* no uncompressed data yet */
state->strm.avail_in = 0; /* no input data yet */
}
/* Open a gzip file either by name or file descriptor. */
local gzFile gz_open(path, fd, mode)
- const char *path;
+ const void *path;
int fd;
const char *mode;
{
gz_statep state;
+ size_t len;
+ int oflag;
+#ifdef O_CLOEXEC
+ int cloexec = 0;
+#endif
+#ifdef O_EXCL
+ int exclusive = 0;
+#endif
+
+ /* check input */
+ if (path == NULL)
+ return NULL;
/* allocate gzFile structure to return */
state = malloc(sizeof(gz_state));
@@ -103,6 +119,7 @@ local gzFile gz_open(path, fd, mode)
state->mode = GZ_NONE;
state->level = Z_DEFAULT_COMPRESSION;
state->strategy = Z_DEFAULT_STRATEGY;
+ state->direct = 0;
while (*mode) {
if (*mode >= '0' && *mode <= '9')
state->level = *mode - '0';
@@ -124,6 +141,16 @@ local gzFile gz_open(path, fd, mode)
return NULL;
case 'b': /* ignore -- will request binary anyway */
break;
+#ifdef O_CLOEXEC
+ case 'e':
+ cloexec = 1;
+ break;
+#endif
+#ifdef O_EXCL
+ case 'x':
+ exclusive = 1;
+ break;
+#endif
case 'f':
state->strategy = Z_FILTERED;
break;
@@ -135,6 +162,8 @@ local gzFile gz_open(path, fd, mode)
break;
case 'F':
state->strategy = Z_FIXED;
+ case 'T':
+ state->direct = 1;
default: /* could consider as an error, but just ignore */
;
}
@@ -147,30 +176,67 @@ local gzFile gz_open(path, fd, mode)
return NULL;
}
+ /* can't force transparent read */
+ if (state->mode == GZ_READ) {
+ if (state->direct) {
+ free(state);
+ return NULL;
+ }
+ state->direct = 1; /* for empty file */
+ }
+
/* save the path name for error messages */
- state->path = malloc(strlen(path) + 1);
+#ifdef _WIN32
+ if (fd == -2) {
+ len = wcstombs(NULL, path, 0);
+ if (len == (size_t)-1)
+ len = 0;
+ }
+ else
+#endif
+ len = strlen(path);
+ state->path = malloc(len + 1);
if (state->path == NULL) {
free(state);
return NULL;
}
- strcpy(state->path, path);
+#ifdef _WIN32
+ if (fd == -2)
+ if (len)
+ wcstombs(state->path, path, len + 1);
+ else
+ *(state->path) = 0;
+ else
+#endif
+ strcpy(state->path, path);
- /* open the file with the appropriate mode (or just use fd) */
- state->fd = fd != -1 ? fd :
- open(path,
+ /* compute the flags for open() */
+ oflag =
#ifdef O_LARGEFILE
- O_LARGEFILE |
+ O_LARGEFILE |
#endif
#ifdef O_BINARY
- O_BINARY |
+ O_BINARY |
+#endif
+#ifdef O_CLOEXEC
+ (cloexec ? O_CLOEXEC : 0) |
#endif
- (state->mode == GZ_READ ?
- O_RDONLY :
- (O_WRONLY | O_CREAT | (
- state->mode == GZ_WRITE ?
- O_TRUNC :
- O_APPEND))),
- 0666);
+ (state->mode == GZ_READ ?
+ O_RDONLY :
+ (O_WRONLY | O_CREAT |
+#ifdef O_EXCL
+ (exclusive ? O_EXCL : 0) |
+#endif
+ (state->mode == GZ_WRITE ?
+ O_TRUNC :
+ O_APPEND)));
+
+ /* open the file with the appropriate flags (or just use fd) */
+ state->fd = fd > -1 ? fd : (
+#ifdef _WIN32
+ fd == -2 ? _wopen(path, oflag, 0666) :
+#endif
+ open(path, oflag, 0666));
if (state->fd == -1) {
free(state->path);
free(state);
@@ -225,6 +291,16 @@ gzFile ZEXPORT gzdopen(fd, mode)
}
/* -- see zlib.h -- */
+#ifdef _WIN32
+gzFile ZEXPORT gzopen_w(path, mode)
+ const wchar_t *path;
+ const char *mode;
+{
+ return gz_open(path, -2, mode);
+}
+#endif
+
+/* -- see zlib.h -- */
int ZEXPORT gzbuffer(file, size)
gzFile file;
unsigned size;
@@ -243,8 +319,8 @@ int ZEXPORT gzbuffer(file, size)
return -1;
/* check and set requested size */
- if (size == 0)
- return -1;
+ if (size < 2)
+ size = 2; /* need two bytes to check magic header */
state->want = size;
return 0;
}
@@ -261,7 +337,8 @@ int ZEXPORT gzrewind(file)
state = (gz_statep)file;
/* check that we're reading and that there's no error */
- if (state->mode != GZ_READ || state->err != Z_OK)
+ if (state->mode != GZ_READ ||
+ (state->err != Z_OK && state->err != Z_BUF_ERROR))
return -1;
/* back up and start over */
@@ -289,7 +366,7 @@ z_off64_t ZEXPORT gzseek64(file, offset, whence)
return -1;
/* check that there's no error */
- if (state->err != Z_OK)
+ if (state->err != Z_OK && state->err != Z_BUF_ERROR)
return -1;
/* can only seek from start or relative to current position */
@@ -298,31 +375,32 @@ z_off64_t ZEXPORT gzseek64(file, offset, whence)
/* normalize offset to a SEEK_CUR specification */
if (whence == SEEK_SET)
- offset -= state->pos;
+ offset -= state->x.pos;
else if (state->seek)
offset += state->skip;
state->seek = 0;
/* if within raw area while reading, just go there */
if (state->mode == GZ_READ && state->how == COPY &&
- state->pos + offset >= state->raw) {
- ret = LSEEK(state->fd, offset - state->have, SEEK_CUR);
+ state->x.pos + offset >= 0) {
+ ret = LSEEK(state->fd, offset - state->x.have, SEEK_CUR);
if (ret == -1)
return -1;
- state->have = 0;
+ state->x.have = 0;
state->eof = 0;
+ state->past = 0;
state->seek = 0;
gz_error(state, Z_OK, NULL);
state->strm.avail_in = 0;
- state->pos += offset;
- return state->pos;
+ state->x.pos += offset;
+ return state->x.pos;
}
/* calculate skip amount, rewinding if needed for back seek when reading */
if (offset < 0) {
if (state->mode != GZ_READ) /* writing -- can't go backwards */
return -1;
- offset += state->pos;
+ offset += state->x.pos;
if (offset < 0) /* before start of file! */
return -1;
if (gzrewind(file) == -1) /* rewind, then skip to offset */
@@ -331,11 +409,11 @@ z_off64_t ZEXPORT gzseek64(file, offset, whence)
/* if reading, skip what's in output buffer (one less gzgetc() check) */
if (state->mode == GZ_READ) {
- n = GT_OFF(state->have) || (z_off64_t)state->have > offset ?
- (unsigned)offset : state->have;
- state->have -= n;
- state->next += n;
- state->pos += n;
+ n = GT_OFF(state->x.have) || (z_off64_t)state->x.have > offset ?
+ (unsigned)offset : state->x.have;
+ state->x.have -= n;
+ state->x.next += n;
+ state->x.pos += n;
offset -= n;
}
@@ -344,7 +422,7 @@ z_off64_t ZEXPORT gzseek64(file, offset, whence)
state->seek = 1;
state->skip = offset;
}
- return state->pos + offset;
+ return state->x.pos + offset;
}
/* -- see zlib.h -- */
@@ -373,7 +451,7 @@ z_off64_t ZEXPORT gztell64(file)
return -1;
/* return position */
- return state->pos + (state->seek ? state->skip : 0);
+ return state->x.pos + (state->seek ? state->skip : 0);
}
/* -- see zlib.h -- */
@@ -433,8 +511,7 @@ int ZEXPORT gzeof(file)
return 0;
/* return end-of-file state */
- return state->mode == GZ_READ ?
- (state->eof && state->strm.avail_in == 0 && state->have == 0) : 0;
+ return state->mode == GZ_READ ? state->past : 0;
}
/* -- see zlib.h -- */
@@ -471,8 +548,10 @@ void ZEXPORT gzclearerr(file)
return;
/* clear error and end-of-file */
- if (state->mode == GZ_READ)
+ if (state->mode == GZ_READ) {
state->eof = 0;
+ state->past = 0;
+ }
gz_error(state, Z_OK, NULL);
}
@@ -494,6 +573,10 @@ void ZLIB_INTERNAL gz_error(state, err, msg)
state->msg = NULL;
}
+ /* if fatal, set state->x.have to 0 so that the gzgetc() macro fails */
+ if (err != Z_OK && err != Z_BUF_ERROR)
+ state->x.have = 0;
+
/* set error code, and if no message, then done */
state->err = err;
if (msg == NULL)
diff --git a/dep/zlib/gzread.c b/dep/zlib/gzread.c
index 548201ab009..3493d34d4ea 100644
--- a/dep/zlib/gzread.c
+++ b/dep/zlib/gzread.c
@@ -1,5 +1,5 @@
/* gzread.c -- zlib functions for reading gzip files
- * Copyright (C) 2004, 2005, 2010 Mark Adler
+ * Copyright (C) 2004, 2005, 2010, 2011, 2012 Mark Adler
* For conditions of distribution and use, see copyright notice in zlib.h
*/
@@ -8,10 +8,9 @@
/* Local functions */
local int gz_load OF((gz_statep, unsigned char *, unsigned, unsigned *));
local int gz_avail OF((gz_statep));
-local int gz_next4 OF((gz_statep, unsigned long *));
-local int gz_head OF((gz_statep));
+local int gz_look OF((gz_statep));
local int gz_decomp OF((gz_statep));
-local int gz_make OF((gz_statep));
+local int gz_fetch OF((gz_statep));
local int gz_skip OF((gz_statep, z_off64_t));
/* Use read() to load a buffer -- return -1 on error, otherwise 0. Read from
@@ -46,67 +45,47 @@ local int gz_load(state, buf, len, have)
error, 0 otherwise. Note that the eof flag is set when the end of the input
file is reached, even though there may be unused data in the buffer. Once
that data has been used, no more attempts will be made to read the file.
- gz_avail() assumes that strm->avail_in == 0. */
+ If strm->avail_in != 0, then the current data is moved to the beginning of
+ the input buffer, and then the remainder of the buffer is loaded with the
+ available data from the input file. */
local int gz_avail(state)
gz_statep state;
{
+ unsigned got;
z_streamp strm = &(state->strm);
- if (state->err != Z_OK)
+ if (state->err != Z_OK && state->err != Z_BUF_ERROR)
return -1;
if (state->eof == 0) {
- if (gz_load(state, state->in, state->size,
- (unsigned *)&(strm->avail_in)) == -1)
+ if (strm->avail_in) { /* copy what's there to the start */
+ unsigned char *p = state->in, *q = strm->next_in;
+ unsigned n = strm->avail_in;
+ do {
+ *p++ = *q++;
+ } while (--n);
+ }
+ if (gz_load(state, state->in + strm->avail_in,
+ state->size - strm->avail_in, &got) == -1)
return -1;
+ strm->avail_in += got;
strm->next_in = state->in;
}
return 0;
}
-/* Get next byte from input, or -1 if end or error. */
-#define NEXT() ((strm->avail_in == 0 && gz_avail(state) == -1) ? -1 : \
- (strm->avail_in == 0 ? -1 : \
- (strm->avail_in--, *(strm->next_in)++)))
-
-/* Get a four-byte little-endian integer and return 0 on success and the value
- in *ret. Otherwise -1 is returned and *ret is not modified. */
-local int gz_next4(state, ret)
- gz_statep state;
- unsigned long *ret;
-{
- int ch;
- unsigned long val;
- z_streamp strm = &(state->strm);
-
- val = NEXT();
- val += (unsigned)NEXT() << 8;
- val += (unsigned long)NEXT() << 16;
- ch = NEXT();
- if (ch == -1)
- return -1;
- val += (unsigned long)ch << 24;
- *ret = val;
- return 0;
-}
-
-/* Look for gzip header, set up for inflate or copy. state->have must be zero.
+/* Look for gzip header, set up for inflate or copy. state->x.have must be 0.
If this is the first time in, allocate required memory. state->how will be
left unchanged if there is no more input data available, will be set to COPY
if there is no gzip header and direct copying will be performed, or it will
- be set to GZIP for decompression, and the gzip header will be skipped so
- that the next available input data is the raw deflate stream. If direct
- copying, then leftover input data from the input buffer will be copied to
- the output buffer. In that case, all further file reads will be directly to
- either the output buffer or a user buffer. If decompressing, the inflate
- state and the check value will be initialized. gz_head() will return 0 on
- success or -1 on failure. Failures may include read errors or gzip header
- errors. */
-local int gz_head(state)
+ be set to GZIP for decompression. If direct copying, then leftover input
+ data from the input buffer will be copied to the output buffer. In that
+ case, all further file reads will be directly to either the output buffer or
+ a user buffer. If decompressing, the inflate state will be initialized.
+ gz_look() will return 0 on success or -1 on failure. */
+local int gz_look(state)
gz_statep state;
{
z_streamp strm = &(state->strm);
- int flags;
- unsigned len;
/* allocate read buffers and inflate memory */
if (state->size == 0) {
@@ -129,7 +108,7 @@ local int gz_head(state)
state->strm.opaque = Z_NULL;
state->strm.avail_in = 0;
state->strm.next_in = Z_NULL;
- if (inflateInit2(&(state->strm), -15) != Z_OK) { /* raw inflate */
+ if (inflateInit2(&(state->strm), 15 + 16) != Z_OK) { /* gunzip */
free(state->out);
free(state->in);
state->size = 0;
@@ -138,83 +117,45 @@ local int gz_head(state)
}
}
- /* get some data in the input buffer */
- if (strm->avail_in == 0) {
+ /* get at least the magic bytes in the input buffer */
+ if (strm->avail_in < 2) {
if (gz_avail(state) == -1)
return -1;
if (strm->avail_in == 0)
return 0;
}
- /* look for the gzip magic header bytes 31 and 139 */
- if (strm->next_in[0] == 31) {
- strm->avail_in--;
- strm->next_in++;
- if (strm->avail_in == 0 && gz_avail(state) == -1)
- return -1;
- if (strm->avail_in && strm->next_in[0] == 139) {
- /* we have a gzip header, woo hoo! */
- strm->avail_in--;
- strm->next_in++;
-
- /* skip rest of header */
- if (NEXT() != 8) { /* compression method */
- gz_error(state, Z_DATA_ERROR, "unknown compression method");
- return -1;
- }
- flags = NEXT();
- if (flags & 0xe0) { /* reserved flag bits */
- gz_error(state, Z_DATA_ERROR, "unknown header flags set");
- return -1;
- }
- NEXT(); /* modification time */
- NEXT();
- NEXT();
- NEXT();
- NEXT(); /* extra flags */
- NEXT(); /* operating system */
- if (flags & 4) { /* extra field */
- len = (unsigned)NEXT();
- len += (unsigned)NEXT() << 8;
- while (len--)
- if (NEXT() < 0)
- break;
- }
- if (flags & 8) /* file name */
- while (NEXT() > 0)
- ;
- if (flags & 16) /* comment */
- while (NEXT() > 0)
- ;
- if (flags & 2) { /* header crc */
- NEXT();
- NEXT();
- }
- /* an unexpected end of file is not checked for here -- it will be
- noticed on the first request for uncompressed data */
-
- /* set up for decompression */
- inflateReset(strm);
- strm->adler = crc32(0L, Z_NULL, 0);
- state->how = GZIP;
- state->direct = 0;
- return 0;
- }
- else {
- /* not a gzip file -- save first byte (31) and fall to raw i/o */
- state->out[0] = 31;
- state->have = 1;
- }
+ /* look for gzip magic bytes -- if there, do gzip decoding (note: there is
+ a logical dilemma here when considering the case of a partially written
+ gzip file, to wit, if a single 31 byte is written, then we cannot tell
+ whether this is a single-byte file, or just a partially written gzip
+ file -- for here we assume that if a gzip file is being written, then
+ the header will be written in a single operation, so that reading a
+ single byte is sufficient indication that it is not a gzip file) */
+ if (strm->avail_in > 1 &&
+ strm->next_in[0] == 31 && strm->next_in[1] == 139) {
+ inflateReset(strm);
+ state->how = GZIP;
+ state->direct = 0;
+ return 0;
+ }
+
+ /* no gzip header -- if we were decoding gzip before, then this is trailing
+ garbage. Ignore the trailing garbage and finish. */
+ if (state->direct == 0) {
+ strm->avail_in = 0;
+ state->eof = 1;
+ state->x.have = 0;
+ return 0;
}
- /* doing raw i/o, save start of raw data for seeking, copy any leftover
- input to output -- this assumes that the output buffer is larger than
- the input buffer, which also assures space for gzungetc() */
- state->raw = state->pos;
- state->next = state->out;
+ /* doing raw i/o, copy any leftover input to output -- this assumes that
+ the output buffer is larger than the input buffer, which also assures
+ space for gzungetc() */
+ state->x.next = state->out;
if (strm->avail_in) {
- memcpy(state->next + state->have, strm->next_in, strm->avail_in);
- state->have += strm->avail_in;
+ memcpy(state->x.next, strm->next_in, strm->avail_in);
+ state->x.have = strm->avail_in;
strm->avail_in = 0;
}
state->how = COPY;
@@ -223,19 +164,15 @@ local int gz_head(state)
}
/* Decompress from input to the provided next_out and avail_out in the state.
- If the end of the compressed data is reached, then verify the gzip trailer
- check value and length (modulo 2^32). state->have and state->next are set
- to point to the just decompressed data, and the crc is updated. If the
- trailer is verified, state->how is reset to LOOK to look for the next gzip
- stream or raw data, once state->have is depleted. Returns 0 on success, -1
- on failure. Failures may include invalid compressed data or a failed gzip
- trailer verification. */
+ On return, state->x.have and state->x.next point to the just decompressed
+ data. If the gzip stream completes, state->how is reset to LOOK to look for
+ the next gzip stream or raw data, once state->x.have is depleted. Returns 0
+ on success, -1 on failure. */
local int gz_decomp(state)
gz_statep state;
{
- int ret;
+ int ret = Z_OK;
unsigned had;
- unsigned long crc, len;
z_streamp strm = &(state->strm);
/* fill output buffer up to end of deflate stream */
@@ -245,15 +182,15 @@ local int gz_decomp(state)
if (strm->avail_in == 0 && gz_avail(state) == -1)
return -1;
if (strm->avail_in == 0) {
- gz_error(state, Z_DATA_ERROR, "unexpected end of file");
- return -1;
+ gz_error(state, Z_BUF_ERROR, "unexpected end of file");
+ break;
}
/* decompress and handle errors */
ret = inflate(strm, Z_NO_FLUSH);
if (ret == Z_STREAM_ERROR || ret == Z_NEED_DICT) {
gz_error(state, Z_STREAM_ERROR,
- "internal error: inflate stream corrupt");
+ "internal error: inflate stream corrupt");
return -1;
}
if (ret == Z_MEM_ERROR) {
@@ -262,67 +199,55 @@ local int gz_decomp(state)
}
if (ret == Z_DATA_ERROR) { /* deflate stream invalid */
gz_error(state, Z_DATA_ERROR,
- strm->msg == NULL ? "compressed data error" : strm->msg);
+ strm->msg == NULL ? "compressed data error" : strm->msg);
return -1;
}
} while (strm->avail_out && ret != Z_STREAM_END);
- /* update available output and crc check value */
- state->have = had - strm->avail_out;
- state->next = strm->next_out - state->have;
- strm->adler = crc32(strm->adler, state->next, state->have);
+ /* update available output */
+ state->x.have = had - strm->avail_out;
+ state->x.next = strm->next_out - state->x.have;
- /* check gzip trailer if at end of deflate stream */
- if (ret == Z_STREAM_END) {
- if (gz_next4(state, &crc) == -1 || gz_next4(state, &len) == -1) {
- gz_error(state, Z_DATA_ERROR, "unexpected end of file");
- return -1;
- }
- if (crc != strm->adler) {
- gz_error(state, Z_DATA_ERROR, "incorrect data check");
- return -1;
- }
- if (len != (strm->total_out & 0xffffffffL)) {
- gz_error(state, Z_DATA_ERROR, "incorrect length check");
- return -1;
- }
- state->how = LOOK; /* ready for next stream, once have is 0 (leave
- state->direct unchanged to remember how) */
- }
+ /* if the gzip stream completed successfully, look for another */
+ if (ret == Z_STREAM_END)
+ state->how = LOOK;
/* good decompression */
return 0;
}
-/* Make data and put in the output buffer. Assumes that state->have == 0.
+/* Fetch data and put it in the output buffer. Assumes state->x.have is 0.
Data is either copied from the input file or decompressed from the input
file depending on state->how. If state->how is LOOK, then a gzip header is
- looked for (and skipped if found) to determine wither to copy or decompress.
- Returns -1 on error, otherwise 0. gz_make() will leave state->have as COPY
- or GZIP unless the end of the input file has been reached and all data has
- been processed. */
-local int gz_make(state)
+ looked for to determine whether to copy or decompress. Returns -1 on error,
+ otherwise 0. gz_fetch() will leave state->how as COPY or GZIP unless the
+ end of the input file has been reached and all data has been processed. */
+local int gz_fetch(state)
gz_statep state;
{
z_streamp strm = &(state->strm);
- if (state->how == LOOK) { /* look for gzip header */
- if (gz_head(state) == -1)
- return -1;
- if (state->have) /* got some data from gz_head() */
+ do {
+ switch(state->how) {
+ case LOOK: /* -> LOOK, COPY (only if never GZIP), or GZIP */
+ if (gz_look(state) == -1)
+ return -1;
+ if (state->how == LOOK)
+ return 0;
+ break;
+ case COPY: /* -> COPY */
+ if (gz_load(state, state->out, state->size << 1, &(state->x.have))
+ == -1)
+ return -1;
+ state->x.next = state->out;
return 0;
- }
- if (state->how == COPY) { /* straight copy */
- if (gz_load(state, state->out, state->size << 1, &(state->have)) == -1)
- return -1;
- state->next = state->out;
- }
- else if (state->how == GZIP) { /* decompress */
- strm->avail_out = state->size << 1;
- strm->next_out = state->out;
- if (gz_decomp(state) == -1)
- return -1;
- }
+ case GZIP: /* -> GZIP or LOOK (if end of gzip stream) */
+ strm->avail_out = state->size << 1;
+ strm->next_out = state->out;
+ if (gz_decomp(state) == -1)
+ return -1;
+ }
+ } while (state->x.have == 0 && (!state->eof || strm->avail_in));
return 0;
}
@@ -336,12 +261,12 @@ local int gz_skip(state, len)
/* skip over len bytes or reach end-of-file, whichever comes first */
while (len)
/* skip over whatever is in output buffer */
- if (state->have) {
- n = GT_OFF(state->have) || (z_off64_t)state->have > len ?
- (unsigned)len : state->have;
- state->have -= n;
- state->next += n;
- state->pos += n;
+ if (state->x.have) {
+ n = GT_OFF(state->x.have) || (z_off64_t)state->x.have > len ?
+ (unsigned)len : state->x.have;
+ state->x.have -= n;
+ state->x.next += n;
+ state->x.pos += n;
len -= n;
}
@@ -352,7 +277,7 @@ local int gz_skip(state, len)
/* need more data to skip -- load up output buffer */
else {
/* get more output, looking for header if required */
- if (gz_make(state) == -1)
+ if (gz_fetch(state) == -1)
return -1;
}
return 0;
@@ -374,14 +299,15 @@ int ZEXPORT gzread(file, buf, len)
state = (gz_statep)file;
strm = &(state->strm);
- /* check that we're reading and that there's no error */
- if (state->mode != GZ_READ || state->err != Z_OK)
+ /* check that we're reading and that there's no (serious) error */
+ if (state->mode != GZ_READ ||
+ (state->err != Z_OK && state->err != Z_BUF_ERROR))
return -1;
/* since an int is returned, make sure len fits in one, otherwise return
with an error (this avoids the flaw in the interface) */
if ((int)len < 0) {
- gz_error(state, Z_BUF_ERROR, "requested length does not fit in int");
+ gz_error(state, Z_DATA_ERROR, "requested length does not fit in int");
return -1;
}
@@ -400,24 +326,26 @@ int ZEXPORT gzread(file, buf, len)
got = 0;
do {
/* first just try copying data from the output buffer */
- if (state->have) {
- n = state->have > len ? len : state->have;
- memcpy(buf, state->next, n);
- state->next += n;
- state->have -= n;
+ if (state->x.have) {
+ n = state->x.have > len ? len : state->x.have;
+ memcpy(buf, state->x.next, n);
+ state->x.next += n;
+ state->x.have -= n;
}
/* output buffer empty -- return if we're at the end of the input */
- else if (state->eof && strm->avail_in == 0)
+ else if (state->eof && strm->avail_in == 0) {
+ state->past = 1; /* tried to read past end */
break;
+ }
/* need output data -- for small len or new stream load up our output
buffer */
else if (state->how == LOOK || len < (state->size << 1)) {
/* get more output, looking for header if required */
- if (gz_make(state) == -1)
+ if (gz_fetch(state) == -1)
return -1;
- continue; /* no progress yet -- go back to memcpy() above */
+ continue; /* no progress yet -- go back to copy above */
/* the copy above assures that we will leave with space in the
output buffer, allowing at least one gzungetc() to succeed */
}
@@ -434,15 +362,15 @@ int ZEXPORT gzread(file, buf, len)
strm->next_out = buf;
if (gz_decomp(state) == -1)
return -1;
- n = state->have;
- state->have = 0;
+ n = state->x.have;
+ state->x.have = 0;
}
/* update progress */
len -= n;
buf = (char *)buf + n;
got += n;
- state->pos += n;
+ state->x.pos += n;
} while (len);
/* return number of bytes read into user buffer (will fit in int) */
@@ -450,6 +378,7 @@ int ZEXPORT gzread(file, buf, len)
}
/* -- see zlib.h -- */
+#undef gzgetc
int ZEXPORT gzgetc(file)
gzFile file;
{
@@ -462,15 +391,16 @@ int ZEXPORT gzgetc(file)
return -1;
state = (gz_statep)file;
- /* check that we're reading and that there's no error */
- if (state->mode != GZ_READ || state->err != Z_OK)
+ /* check that we're reading and that there's no (serious) error */
+ if (state->mode != GZ_READ ||
+ (state->err != Z_OK && state->err != Z_BUF_ERROR))
return -1;
/* try output buffer (no need to check for skip request) */
- if (state->have) {
- state->have--;
- state->pos++;
- return *(state->next)++;
+ if (state->x.have) {
+ state->x.have--;
+ state->x.pos++;
+ return *(state->x.next)++;
}
/* nothing there -- try gzread() */
@@ -478,6 +408,12 @@ int ZEXPORT gzgetc(file)
return ret < 1 ? -1 : buf[0];
}
+int ZEXPORT gzgetc_(file)
+gzFile file;
+{
+ return gzgetc(file);
+}
+
/* -- see zlib.h -- */
int ZEXPORT gzungetc(c, file)
int c;
@@ -490,8 +426,9 @@ int ZEXPORT gzungetc(c, file)
return -1;
state = (gz_statep)file;
- /* check that we're reading and that there's no error */
- if (state->mode != GZ_READ || state->err != Z_OK)
+ /* check that we're reading and that there's no (serious) error */
+ if (state->mode != GZ_READ ||
+ (state->err != Z_OK && state->err != Z_BUF_ERROR))
return -1;
/* process a skip request */
@@ -506,32 +443,34 @@ int ZEXPORT gzungetc(c, file)
return -1;
/* if output buffer empty, put byte at end (allows more pushing) */
- if (state->have == 0) {
- state->have = 1;
- state->next = state->out + (state->size << 1) - 1;
- state->next[0] = c;
- state->pos--;
+ if (state->x.have == 0) {
+ state->x.have = 1;
+ state->x.next = state->out + (state->size << 1) - 1;
+ state->x.next[0] = c;
+ state->x.pos--;
+ state->past = 0;
return c;
}
/* if no room, give up (must have already done a gzungetc()) */
- if (state->have == (state->size << 1)) {
- gz_error(state, Z_BUF_ERROR, "out of room to push characters");
+ if (state->x.have == (state->size << 1)) {
+ gz_error(state, Z_DATA_ERROR, "out of room to push characters");
return -1;
}
/* slide output data if needed and insert byte before existing data */
- if (state->next == state->out) {
- unsigned char *src = state->out + state->have;
+ if (state->x.next == state->out) {
+ unsigned char *src = state->out + state->x.have;
unsigned char *dest = state->out + (state->size << 1);
while (src > state->out)
*--dest = *--src;
- state->next = dest;
+ state->x.next = dest;
}
- state->have++;
- state->next--;
- state->next[0] = c;
- state->pos--;
+ state->x.have++;
+ state->x.next--;
+ state->x.next[0] = c;
+ state->x.pos--;
+ state->past = 0;
return c;
}
@@ -551,8 +490,9 @@ char * ZEXPORT gzgets(file, buf, len)
return NULL;
state = (gz_statep)file;
- /* check that we're reading and that there's no error */
- if (state->mode != GZ_READ || state->err != Z_OK)
+ /* check that we're reading and that there's no (serious) error */
+ if (state->mode != GZ_READ ||
+ (state->err != Z_OK && state->err != Z_BUF_ERROR))
return NULL;
/* process a skip request */
@@ -569,32 +509,31 @@ char * ZEXPORT gzgets(file, buf, len)
left = (unsigned)len - 1;
if (left) do {
/* assure that something is in the output buffer */
- if (state->have == 0) {
- if (gz_make(state) == -1)
- return NULL; /* error */
- if (state->have == 0) { /* end of file */
- if (buf == str) /* got bupkus */
- return NULL;
- break; /* got something -- return it */
- }
+ if (state->x.have == 0 && gz_fetch(state) == -1)
+ return NULL; /* error */
+ if (state->x.have == 0) { /* end of file */
+ state->past = 1; /* read past end */
+ break; /* return what we have */
}
/* look for end-of-line in current output buffer */
- n = state->have > left ? left : state->have;
- eol = memchr(state->next, '\n', n);
+ n = state->x.have > left ? left : state->x.have;
+ eol = memchr(state->x.next, '\n', n);
if (eol != NULL)
- n = (unsigned)(eol - state->next) + 1;
+ n = (unsigned)(eol - state->x.next) + 1;
/* copy through end-of-line, or remainder if not found */
- memcpy(buf, state->next, n);
- state->have -= n;
- state->next += n;
- state->pos += n;
+ memcpy(buf, state->x.next, n);
+ state->x.have -= n;
+ state->x.next += n;
+ state->x.pos += n;
left -= n;
buf += n;
} while (left && eol == NULL);
- /* found end-of-line or out of space -- terminate string and return it */
+ /* return terminated string, or if nothing, end of file */
+ if (buf == str)
+ return NULL;
buf[0] = 0;
return str;
}
@@ -610,16 +549,12 @@ int ZEXPORT gzdirect(file)
return 0;
state = (gz_statep)file;
- /* check that we're reading */
- if (state->mode != GZ_READ)
- return 0;
-
/* if the state is not known, but we can find out, then do so (this is
mainly for right after a gzopen() or gzdopen()) */
- if (state->how == LOOK && state->have == 0)
- (void)gz_head(state);
+ if (state->mode == GZ_READ && state->how == LOOK && state->x.have == 0)
+ (void)gz_look(state);
- /* return 1 if reading direct, 0 if decompressing a gzip stream */
+ /* return 1 if transparent, 0 if processing a gzip stream */
return state->direct;
}
@@ -627,7 +562,7 @@ int ZEXPORT gzdirect(file)
int ZEXPORT gzclose_r(file)
gzFile file;
{
- int ret;
+ int ret, err;
gz_statep state;
/* get internal structure */
@@ -645,9 +580,10 @@ int ZEXPORT gzclose_r(file)
free(state->out);
free(state->in);
}
+ err = state->err == Z_BUF_ERROR ? Z_BUF_ERROR : Z_OK;
gz_error(state, Z_OK, NULL);
free(state->path);
ret = close(state->fd);
free(state);
- return ret ? Z_ERRNO : Z_OK;
+ return ret ? Z_ERRNO : err;
}
diff --git a/dep/zlib/gzwrite.c b/dep/zlib/gzwrite.c
index e8defc6887a..27cb3428e32 100644
--- a/dep/zlib/gzwrite.c
+++ b/dep/zlib/gzwrite.c
@@ -1,5 +1,5 @@
/* gzwrite.c -- zlib functions for writing gzip files
- * Copyright (C) 2004, 2005, 2010 Mark Adler
+ * Copyright (C) 2004, 2005, 2010, 2011, 2012 Mark Adler
* For conditions of distribution and use, see copyright notice in zlib.h
*/
@@ -18,44 +18,55 @@ local int gz_init(state)
int ret;
z_streamp strm = &(state->strm);
- /* allocate input and output buffers */
+ /* allocate input buffer */
state->in = malloc(state->want);
- state->out = malloc(state->want);
- if (state->in == NULL || state->out == NULL) {
- if (state->out != NULL)
- free(state->out);
- if (state->in != NULL)
- free(state->in);
+ if (state->in == NULL) {
gz_error(state, Z_MEM_ERROR, "out of memory");
return -1;
}
- /* allocate deflate memory, set up for gzip compression */
- strm->zalloc = Z_NULL;
- strm->zfree = Z_NULL;
- strm->opaque = Z_NULL;
- ret = deflateInit2(strm, state->level, Z_DEFLATED,
- 15 + 16, 8, state->strategy);
- if (ret != Z_OK) {
- free(state->in);
- gz_error(state, Z_MEM_ERROR, "out of memory");
- return -1;
+ /* only need output buffer and deflate state if compressing */
+ if (!state->direct) {
+ /* allocate output buffer */
+ state->out = malloc(state->want);
+ if (state->out == NULL) {
+ free(state->in);
+ gz_error(state, Z_MEM_ERROR, "out of memory");
+ return -1;
+ }
+
+ /* allocate deflate memory, set up for gzip compression */
+ strm->zalloc = Z_NULL;
+ strm->zfree = Z_NULL;
+ strm->opaque = Z_NULL;
+ ret = deflateInit2(strm, state->level, Z_DEFLATED,
+ MAX_WBITS + 16, DEF_MEM_LEVEL, state->strategy);
+ if (ret != Z_OK) {
+ free(state->out);
+ free(state->in);
+ gz_error(state, Z_MEM_ERROR, "out of memory");
+ return -1;
+ }
}
/* mark state as initialized */
state->size = state->want;
- /* initialize write buffer */
- strm->avail_out = state->size;
- strm->next_out = state->out;
- state->next = strm->next_out;
+ /* initialize write buffer if compressing */
+ if (!state->direct) {
+ strm->avail_out = state->size;
+ strm->next_out = state->out;
+ state->x.next = strm->next_out;
+ }
return 0;
}
/* Compress whatever is at avail_in and next_in and write to the output file.
Return -1 if there is an error writing to the output file, otherwise 0.
flush is assumed to be a valid deflate() flush value. If flush is Z_FINISH,
- then the deflate() state is reset to start a new gzip stream. */
+ then the deflate() state is reset to start a new gzip stream. If gz->direct
+ is true, then simply write to the output file without compressing, and
+ ignore flush. */
local int gz_comp(state, flush)
gz_statep state;
int flush;
@@ -68,6 +79,17 @@ local int gz_comp(state, flush)
if (state->size == 0 && gz_init(state) == -1)
return -1;
+ /* write directly if requested */
+ if (state->direct) {
+ got = write(state->fd, strm->next_in, strm->avail_in);
+ if (got < 0 || (unsigned)got != strm->avail_in) {
+ gz_error(state, Z_ERRNO, zstrerror());
+ return -1;
+ }
+ strm->avail_in = 0;
+ return 0;
+ }
+
/* run deflate() on provided input until it produces no more output */
ret = Z_OK;
do {
@@ -75,8 +97,8 @@ local int gz_comp(state, flush)
doing Z_FINISH then don't write until we get to Z_STREAM_END */
if (strm->avail_out == 0 || (flush != Z_NO_FLUSH &&
(flush != Z_FINISH || ret == Z_STREAM_END))) {
- have = (unsigned)(strm->next_out - state->next);
- if (have && ((got = write(state->fd, state->next, have)) < 0 ||
+ have = (unsigned)(strm->next_out - state->x.next);
+ if (have && ((got = write(state->fd, state->x.next, have)) < 0 ||
(unsigned)got != have)) {
gz_error(state, Z_ERRNO, zstrerror());
return -1;
@@ -85,7 +107,7 @@ local int gz_comp(state, flush)
strm->avail_out = state->size;
strm->next_out = state->out;
}
- state->next = strm->next_out;
+ state->x.next = strm->next_out;
}
/* compress */
@@ -131,7 +153,7 @@ local int gz_zero(state, len)
}
strm->avail_in = n;
strm->next_in = state->in;
- state->pos += n;
+ state->x.pos += n;
if (gz_comp(state, Z_NO_FLUSH) == -1)
return -1;
len -= n;
@@ -163,7 +185,7 @@ int ZEXPORT gzwrite(file, buf, len)
/* since an int is returned, make sure len fits in one, otherwise return
with an error (this avoids the flaw in the interface) */
if ((int)len < 0) {
- gz_error(state, Z_BUF_ERROR, "requested length does not fit in int");
+ gz_error(state, Z_DATA_ERROR, "requested length does not fit in int");
return 0;
}
@@ -193,7 +215,7 @@ int ZEXPORT gzwrite(file, buf, len)
n = len;
memcpy(strm->next_in + strm->avail_in, buf, n);
strm->avail_in += n;
- state->pos += n;
+ state->x.pos += n;
buf = (char *)buf + n;
len -= n;
if (len && gz_comp(state, Z_NO_FLUSH) == -1)
@@ -208,7 +230,7 @@ int ZEXPORT gzwrite(file, buf, len)
/* directly compress user buffer to file */
strm->avail_in = len;
strm->next_in = (voidp)buf;
- state->pos += len;
+ state->x.pos += len;
if (gz_comp(state, Z_NO_FLUSH) == -1)
return 0;
}
@@ -249,15 +271,15 @@ int ZEXPORT gzputc(file, c)
if (strm->avail_in == 0)
strm->next_in = state->in;
strm->next_in[strm->avail_in++] = c;
- state->pos++;
- return c;
+ state->x.pos++;
+ return c & 0xff;
}
/* no room in buffer or not initialized, use gz_write() */
buf[0] = c;
if (gzwrite(file, buf, 1) != 1)
return -1;
- return c;
+ return c & 0xff;
}
/* -- see zlib.h -- */
@@ -274,7 +296,7 @@ int ZEXPORT gzputs(file, str)
return ret == 0 && len != 0 ? -1 : ret;
}
-#ifdef STDC
+#if defined(STDC) || defined(Z_HAVE_STDARG_H)
#include <stdarg.h>
/* -- see zlib.h -- */
@@ -316,19 +338,19 @@ int ZEXPORTVA gzprintf (gzFile file, const char *format, ...)
va_start(va, format);
#ifdef NO_vsnprintf
# ifdef HAS_vsprintf_void
- (void)vsprintf(state->in, format, va);
+ (void)vsprintf((char *)(state->in), format, va);
va_end(va);
for (len = 0; len < size; len++)
if (state->in[len] == 0) break;
# else
- len = vsprintf(state->in, format, va);
+ len = vsprintf((char *)(state->in), format, va);
va_end(va);
# endif
#else
# ifdef HAS_vsnprintf_void
- (void)vsnprintf(state->in, size, format, va);
+ (void)vsnprintf((char *)(state->in), size, format, va);
va_end(va);
- len = strlen(state->in);
+ len = strlen((char *)(state->in));
# else
len = vsnprintf((char *)(state->in), size, format, va);
va_end(va);
@@ -342,11 +364,11 @@ int ZEXPORTVA gzprintf (gzFile file, const char *format, ...)
/* update buffer and position, defer compression until needed */
strm->avail_in = (unsigned)len;
strm->next_in = state->in;
- state->pos += len;
+ state->x.pos += len;
return len;
}
-#else /* !STDC */
+#else /* !STDC && !Z_HAVE_STDARG_H */
/* -- see zlib.h -- */
int ZEXPORTVA gzprintf (file, format, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10,
@@ -366,6 +388,10 @@ int ZEXPORTVA gzprintf (file, format, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10,
state = (gz_statep)file;
strm = &(state->strm);
+ /* check that can really pass pointer in ints */
+ if (sizeof(int) != sizeof(void *))
+ return 0;
+
/* check that we're writing and that there's no error */
if (state->mode != GZ_WRITE || state->err != Z_OK)
return 0;
@@ -390,22 +416,23 @@ int ZEXPORTVA gzprintf (file, format, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10,
state->in[size - 1] = 0;
#ifdef NO_snprintf
# ifdef HAS_sprintf_void
- sprintf(state->in, format, a1, a2, a3, a4, a5, a6, a7, a8,
+ sprintf((char *)(state->in), format, a1, a2, a3, a4, a5, a6, a7, a8,
a9, a10, a11, a12, a13, a14, a15, a16, a17, a18, a19, a20);
for (len = 0; len < size; len++)
if (state->in[len] == 0) break;
# else
- len = sprintf(state->in, format, a1, a2, a3, a4, a5, a6, a7, a8,
- a9, a10, a11, a12, a13, a14, a15, a16, a17, a18, a19, a20);
+ len = sprintf((char *)(state->in), format, a1, a2, a3, a4, a5, a6, a7, a8,
+ a9, a10, a11, a12, a13, a14, a15, a16, a17, a18, a19, a20);
# endif
#else
# ifdef HAS_snprintf_void
- snprintf(state->in, size, format, a1, a2, a3, a4, a5, a6, a7, a8,
+ snprintf((char *)(state->in), size, format, a1, a2, a3, a4, a5, a6, a7, a8,
a9, a10, a11, a12, a13, a14, a15, a16, a17, a18, a19, a20);
- len = strlen(state->in);
+ len = strlen((char *)(state->in));
# else
- len = snprintf(state->in, size, format, a1, a2, a3, a4, a5, a6, a7, a8,
- a9, a10, a11, a12, a13, a14, a15, a16, a17, a18, a19, a20);
+ len = snprintf((char *)(state->in), size, format, a1, a2, a3, a4, a5, a6,
+ a7, a8, a9, a10, a11, a12, a13, a14, a15, a16, a17, a18,
+ a19, a20);
# endif
#endif
@@ -416,7 +443,7 @@ int ZEXPORTVA gzprintf (file, format, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10,
/* update buffer and position, defer compression until needed */
strm->avail_in = (unsigned)len;
strm->next_in = state->in;
- state->pos += len;
+ state->x.pos += len;
return len;
}
@@ -500,7 +527,7 @@ int ZEXPORT gzsetparams(file, level, strategy)
int ZEXPORT gzclose_w(file)
gzFile file;
{
- int ret = 0;
+ int ret = Z_OK;
gz_statep state;
/* get internal structure */
@@ -515,17 +542,24 @@ int ZEXPORT gzclose_w(file)
/* check for seek request */
if (state->seek) {
state->seek = 0;
- ret += gz_zero(state, state->skip);
+ if (gz_zero(state, state->skip) == -1)
+ ret = state->err;
}
/* flush, free memory, and close file */
- ret += gz_comp(state, Z_FINISH);
- (void)deflateEnd(&(state->strm));
- free(state->out);
- free(state->in);
+ if (state->size) {
+ if (gz_comp(state, Z_FINISH) == -1)
+ ret = state->err;
+ if (!state->direct) {
+ (void)deflateEnd(&(state->strm));
+ free(state->out);
+ }
+ free(state->in);
+ }
gz_error(state, Z_OK, NULL);
free(state->path);
- ret += close(state->fd);
+ if (close(state->fd) == -1)
+ ret = Z_ERRNO;
free(state);
- return ret ? Z_ERRNO : Z_OK;
+ return ret;
}
diff --git a/dep/zlib/infback.c b/dep/zlib/infback.c
index af3a8c965d5..981aff17c2d 100644
--- a/dep/zlib/infback.c
+++ b/dep/zlib/infback.c
@@ -1,5 +1,5 @@
/* infback.c -- inflate using a call-back interface
- * Copyright (C) 1995-2009 Mark Adler
+ * Copyright (C) 1995-2011 Mark Adler
* For conditions of distribution and use, see copyright notice in zlib.h
*/
@@ -42,10 +42,19 @@ int stream_size;
return Z_STREAM_ERROR;
strm->msg = Z_NULL; /* in case we return an error */
if (strm->zalloc == (alloc_func)0) {
+#ifdef Z_SOLO
+ return Z_STREAM_ERROR;
+#else
strm->zalloc = zcalloc;
strm->opaque = (voidpf)0;
+#endif
}
- if (strm->zfree == (free_func)0) strm->zfree = zcfree;
+ if (strm->zfree == (free_func)0)
+#ifdef Z_SOLO
+ return Z_STREAM_ERROR;
+#else
+ strm->zfree = zcfree;
+#endif
state = (struct inflate_state FAR *)ZALLOC(strm, 1,
sizeof(struct inflate_state));
if (state == Z_NULL) return Z_MEM_ERROR;
@@ -394,7 +403,6 @@ void FAR *out_desc;
PULLBYTE();
}
if (here.val < 16) {
- NEEDBITS(here.bits);
DROPBITS(here.bits);
state->lens[state->have++] = here.val;
}
diff --git a/dep/zlib/inffixed.h b/dep/zlib/inffixed.h
index 75ed4b5978d..d6283277694 100644
--- a/dep/zlib/inffixed.h
+++ b/dep/zlib/inffixed.h
@@ -2,9 +2,9 @@
* Generated automatically by makefixed().
*/
- /* WARNING: this file should *not* be used by applications. It
- is part of the implementation of the compression library and
- is subject to change. Applications should only use zlib.h.
+ /* WARNING: this file should *not* be used by applications.
+ It is part of the implementation of this library and is
+ subject to change. Applications should only use zlib.h.
*/
static const code lenfix[512] = {
diff --git a/dep/zlib/inflate.c b/dep/zlib/inflate.c
index a8431abeacf..47418a1e1e1 100644
--- a/dep/zlib/inflate.c
+++ b/dep/zlib/inflate.c
@@ -1,5 +1,5 @@
/* inflate.c -- zlib decompression
- * Copyright (C) 1995-2010 Mark Adler
+ * Copyright (C) 1995-2012 Mark Adler
* For conditions of distribution and use, see copyright notice in zlib.h
*/
@@ -100,7 +100,7 @@ local int updatewindow OF((z_streamp strm, unsigned out));
local unsigned syncsearch OF((unsigned FAR *have, unsigned char FAR *buf,
unsigned len));
-int ZEXPORT inflateReset(strm)
+int ZEXPORT inflateResetKeep(strm)
z_streamp strm;
{
struct inflate_state FAR *state;
@@ -109,15 +109,13 @@ z_streamp strm;
state = (struct inflate_state FAR *)strm->state;
strm->total_in = strm->total_out = state->total = 0;
strm->msg = Z_NULL;
- strm->adler = 1; /* to support ill-conceived Java test suite */
+ if (state->wrap) /* to support ill-conceived Java test suite */
+ strm->adler = state->wrap & 1;
state->mode = HEAD;
state->last = 0;
state->havedict = 0;
state->dmax = 32768U;
state->head = Z_NULL;
- state->wsize = 0;
- state->whave = 0;
- state->wnext = 0;
state->hold = 0;
state->bits = 0;
state->lencode = state->distcode = state->next = state->codes;
@@ -127,6 +125,19 @@ z_streamp strm;
return Z_OK;
}
+int ZEXPORT inflateReset(strm)
+z_streamp strm;
+{
+ struct inflate_state FAR *state;
+
+ if (strm == Z_NULL || strm->state == Z_NULL) return Z_STREAM_ERROR;
+ state = (struct inflate_state FAR *)strm->state;
+ state->wsize = 0;
+ state->whave = 0;
+ state->wnext = 0;
+ return inflateResetKeep(strm);
+}
+
int ZEXPORT inflateReset2(strm, windowBits)
z_streamp strm;
int windowBits;
@@ -180,10 +191,19 @@ int stream_size;
if (strm == Z_NULL) return Z_STREAM_ERROR;
strm->msg = Z_NULL; /* in case we return an error */
if (strm->zalloc == (alloc_func)0) {
+#ifdef Z_SOLO
+ return Z_STREAM_ERROR;
+#else
strm->zalloc = zcalloc;
strm->opaque = (voidpf)0;
+#endif
}
- if (strm->zfree == (free_func)0) strm->zfree = zcfree;
+ if (strm->zfree == (free_func)0)
+#ifdef Z_SOLO
+ return Z_STREAM_ERROR;
+#else
+ strm->zfree = zcfree;
+#endif
state = (struct inflate_state FAR *)
ZALLOC(strm, 1, sizeof(struct inflate_state));
if (state == Z_NULL) return Z_MEM_ERROR;
@@ -321,8 +341,8 @@ void makefixed()
low = 0;
for (;;) {
if ((low % 7) == 0) printf("\n ");
- printf("{%u,%u,%d}", state.lencode[low].op, state.lencode[low].bits,
- state.lencode[low].val);
+ printf("{%u,%u,%d}", (low & 127) == 99 ? 64 : state.lencode[low].op,
+ state.lencode[low].bits, state.lencode[low].val);
if (++low == size) break;
putchar(',');
}
@@ -499,11 +519,6 @@ unsigned out;
bits -= bits & 7; \
} while (0)
-/* Reverse the bytes in a 32-bit value */
-#define REVERSE(q) \
- ((((q) >> 24) & 0xff) + (((q) >> 8) & 0xff00) + \
- (((q) & 0xff00) << 8) + (((q) & 0xff) << 24))
-
/*
inflate() uses a state machine to process as much input data and generate as
much output data as possible before returning. The state machine is
@@ -797,7 +812,7 @@ int flush;
#endif
case DICTID:
NEEDBITS(32);
- strm->adler = state->check = REVERSE(hold);
+ strm->adler = state->check = ZSWAP32(hold);
INITBITS();
state->mode = DICT;
case DICT:
@@ -925,7 +940,6 @@ int flush;
PULLBYTE();
}
if (here.val < 16) {
- NEEDBITS(here.bits);
DROPBITS(here.bits);
state->lens[state->have++] = here.val;
}
@@ -1170,7 +1184,7 @@ int flush;
#ifdef GUNZIP
state->flags ? hold :
#endif
- REVERSE(hold)) != state->check) {
+ ZSWAP32(hold)) != state->check) {
strm->msg = (char *)"incorrect data check";
state->mode = BAD;
break;
@@ -1214,7 +1228,8 @@ int flush;
*/
inf_leave:
RESTORE();
- if (state->wsize || (state->mode < CHECK && out != strm->avail_out))
+ if (state->wsize || (out != strm->avail_out && state->mode < BAD &&
+ (state->mode < CHECK || flush != Z_FINISH)))
if (updatewindow(strm, out)) {
state->mode = MEM;
return Z_MEM_ERROR;
@@ -1255,7 +1270,10 @@ const Bytef *dictionary;
uInt dictLength;
{
struct inflate_state FAR *state;
- unsigned long id;
+ unsigned long dictid;
+ unsigned char *next;
+ unsigned avail;
+ int ret;
/* check state */
if (strm == Z_NULL || strm->state == Z_NULL) return Z_STREAM_ERROR;
@@ -1263,29 +1281,27 @@ uInt dictLength;
if (state->wrap != 0 && state->mode != DICT)
return Z_STREAM_ERROR;
- /* check for correct dictionary id */
+ /* check for correct dictionary identifier */
if (state->mode == DICT) {
- id = adler32(0L, Z_NULL, 0);
- id = adler32(id, dictionary, dictLength);
- if (id != state->check)
+ dictid = adler32(0L, Z_NULL, 0);
+ dictid = adler32(dictid, dictionary, dictLength);
+ if (dictid != state->check)
return Z_DATA_ERROR;
}
- /* copy dictionary to window */
- if (updatewindow(strm, strm->avail_out)) {
+ /* copy dictionary to window using updatewindow(), which will amend the
+ existing dictionary if appropriate */
+ next = strm->next_out;
+ avail = strm->avail_out;
+ strm->next_out = (Bytef *)dictionary + dictLength;
+ strm->avail_out = 0;
+ ret = updatewindow(strm, dictLength);
+ strm->avail_out = avail;
+ strm->next_out = next;
+ if (ret) {
state->mode = MEM;
return Z_MEM_ERROR;
}
- if (dictLength > state->wsize) {
- zmemcpy(state->window, dictionary + dictLength - state->wsize,
- state->wsize);
- state->whave = state->wsize;
- }
- else {
- zmemcpy(state->window + state->wsize - dictLength, dictionary,
- dictLength);
- state->whave = dictLength;
- }
state->havedict = 1;
Tracev((stderr, "inflate: dictionary set\n"));
return Z_OK;
@@ -1433,8 +1449,8 @@ z_streamp source;
}
/* copy state */
- zmemcpy(dest, source, sizeof(z_stream));
- zmemcpy(copy, state, sizeof(struct inflate_state));
+ zmemcpy((voidpf)dest, (voidpf)source, sizeof(z_stream));
+ zmemcpy((voidpf)copy, (voidpf)state, sizeof(struct inflate_state));
if (state->lencode >= state->codes &&
state->lencode <= state->codes + ENOUGH - 1) {
copy->lencode = copy->codes + (state->lencode - state->codes);
diff --git a/dep/zlib/inftrees.c b/dep/zlib/inftrees.c
index 11e9c52accb..abcd7c45ed3 100644
--- a/dep/zlib/inftrees.c
+++ b/dep/zlib/inftrees.c
@@ -1,5 +1,5 @@
/* inftrees.c -- generate Huffman trees for efficient decoding
- * Copyright (C) 1995-2010 Mark Adler
+ * Copyright (C) 1995-2012 Mark Adler
* For conditions of distribution and use, see copyright notice in zlib.h
*/
@@ -9,7 +9,7 @@
#define MAXBITS 15
const char inflate_copyright[] =
- " inflate 1.2.5 Copyright 1995-2010 Mark Adler ";
+ " inflate 1.2.7 Copyright 1995-2012 Mark Adler ";
/*
If you use the zlib library in a product, an acknowledgment is welcome
in the documentation of your product. If for some reason you cannot
@@ -62,7 +62,7 @@ unsigned short FAR *work;
35, 43, 51, 59, 67, 83, 99, 115, 131, 163, 195, 227, 258, 0, 0};
static const unsigned short lext[31] = { /* Length codes 257..285 extra */
16, 16, 16, 16, 16, 16, 16, 16, 17, 17, 17, 17, 18, 18, 18, 18,
- 19, 19, 19, 19, 20, 20, 20, 20, 21, 21, 21, 21, 16, 73, 195};
+ 19, 19, 19, 19, 20, 20, 20, 20, 21, 21, 21, 21, 16, 78, 68};
static const unsigned short dbase[32] = { /* Distance codes 0..29 base */
1, 2, 3, 4, 5, 7, 9, 13, 17, 25, 33, 49, 65, 97, 129, 193,
257, 385, 513, 769, 1025, 1537, 2049, 3073, 4097, 6145,
@@ -289,38 +289,14 @@ unsigned short FAR *work;
}
}
- /*
- Fill in rest of table for incomplete codes. This loop is similar to the
- loop above in incrementing huff for table indices. It is assumed that
- len is equal to curr + drop, so there is no loop needed to increment
- through high index bits. When the current sub-table is filled, the loop
- drops back to the root table to fill in any remaining entries there.
- */
- here.op = (unsigned char)64; /* invalid code marker */
- here.bits = (unsigned char)(len - drop);
- here.val = (unsigned short)0;
- while (huff != 0) {
- /* when done with sub-table, drop back to root table */
- if (drop != 0 && (huff & mask) != low) {
- drop = 0;
- len = root;
- next = *table;
- here.bits = (unsigned char)len;
- }
-
- /* put invalid code marker in table */
- next[huff >> drop] = here;
-
- /* backwards increment the len-bit code huff */
- incr = 1U << (len - 1);
- while (huff & incr)
- incr >>= 1;
- if (incr != 0) {
- huff &= incr - 1;
- huff += incr;
- }
- else
- huff = 0;
+ /* fill in remaining table entry if code is incomplete (guaranteed to have
+ at most one remaining entry, since if the code is incomplete, the
+ maximum code length that was allowed to get this far is one bit) */
+ if (huff != 0) {
+ here.op = (unsigned char)64; /* invalid code marker */
+ here.bits = (unsigned char)(len - drop);
+ here.val = (unsigned short)0;
+ next[huff] = here;
}
/* set return parameters */
diff --git a/dep/zlib/trees.c b/dep/zlib/trees.c
index 56e9bb1c115..8c32b214b1d 100644
--- a/dep/zlib/trees.c
+++ b/dep/zlib/trees.c
@@ -1,5 +1,5 @@
/* trees.c -- output deflated data using Huffman coding
- * Copyright (C) 1995-2010 Jean-loup Gailly
+ * Copyright (C) 1995-2012 Jean-loup Gailly
* detect_data_type() function provided freely by Cosmin Truta, 2006
* For conditions of distribution and use, see copyright notice in zlib.h
*/
@@ -74,11 +74,6 @@ local const uch bl_order[BL_CODES]
* probability, to avoid transmitting the lengths for unused bit length codes.
*/
-#define Buf_size (8 * 2*sizeof(char))
-/* Number of bits used within bi_buf. (bi_buf might be implemented on
- * more than 16 bits on some systems.)
- */
-
/* ===========================================================================
* Local data. These are initialized only once.
*/
@@ -399,7 +394,6 @@ void ZLIB_INTERNAL _tr_init(s)
s->bi_buf = 0;
s->bi_valid = 0;
- s->last_eob_len = 8; /* enough lookahead for inflate */
#ifdef DEBUG
s->compressed_len = 0L;
s->bits_sent = 0L;
@@ -883,15 +877,17 @@ void ZLIB_INTERNAL _tr_stored_block(s, buf, stored_len, last)
}
/* ===========================================================================
+ * Flush the bits in the bit buffer to pending output (leaves at most 7 bits)
+ */
+void ZLIB_INTERNAL _tr_flush_bits(s)
+ deflate_state *s;
+{
+ bi_flush(s);
+}
+
+/* ===========================================================================
* Send one empty static block to give enough lookahead for inflate.
* This takes 10 bits, of which 7 may remain in the bit buffer.
- * The current inflate code requires 9 bits of lookahead. If the
- * last two codes for the previous block (real code plus EOB) were coded
- * on 5 bits or less, inflate may have only 5+3 bits of lookahead to decode
- * the last real code. In this case we send two empty static blocks instead
- * of one. (There are no problems if the previous block is stored or fixed.)
- * To simplify the code, we assume the worst case of last real code encoded
- * on one bit only.
*/
void ZLIB_INTERNAL _tr_align(s)
deflate_state *s;
@@ -902,20 +898,6 @@ void ZLIB_INTERNAL _tr_align(s)
s->compressed_len += 10L; /* 3 for block type, 7 for EOB */
#endif
bi_flush(s);
- /* Of the 10 bits for the empty block, we have already sent
- * (10 - bi_valid) bits. The lookahead for the last real code (before
- * the EOB of the previous block) was thus at least one plus the length
- * of the EOB plus what we have just sent of the empty static block.
- */
- if (1 + s->last_eob_len + 10 - s->bi_valid < 9) {
- send_bits(s, STATIC_TREES<<1, 3);
- send_code(s, END_BLOCK, static_ltree);
-#ifdef DEBUG
- s->compressed_len += 10L;
-#endif
- bi_flush(s);
- }
- s->last_eob_len = 7;
}
/* ===========================================================================
@@ -1118,7 +1100,6 @@ local void compress_block(s, ltree, dtree)
} while (lx < s->last_lit);
send_code(s, END_BLOCK, ltree);
- s->last_eob_len = ltree[END_BLOCK].Len;
}
/* ===========================================================================
@@ -1226,7 +1207,6 @@ local void copy_block(s, buf, len, header)
int header; /* true if block header must be written */
{
bi_windup(s); /* align on byte boundary */
- s->last_eob_len = 8; /* enough lookahead for inflate */
if (header) {
put_short(s, (ush)len);
diff --git a/dep/zlib/zconf.h b/dep/zlib/zconf.h
index 02ce56c4313..8a46a58b30c 100644
--- a/dep/zlib/zconf.h
+++ b/dep/zlib/zconf.h
@@ -1,5 +1,5 @@
/* zconf.h -- configuration of the zlib compression library
- * Copyright (C) 1995-2010 Jean-loup Gailly.
+ * Copyright (C) 1995-2012 Jean-loup Gailly.
* For conditions of distribution and use, see copyright notice in zlib.h
*/
@@ -15,6 +15,7 @@
* this permanently in zconf.h using "./configure --zprefix".
*/
#ifdef Z_PREFIX /* may be set to #if 1 by ./configure */
+# define Z_PREFIX_SET
/* all linked symbols */
# define _dist_code z__dist_code
@@ -27,9 +28,11 @@
# define adler32 z_adler32
# define adler32_combine z_adler32_combine
# define adler32_combine64 z_adler32_combine64
-# define compress z_compress
-# define compress2 z_compress2
-# define compressBound z_compressBound
+# ifndef Z_SOLO
+# define compress z_compress
+# define compress2 z_compress2
+# define compressBound z_compressBound
+# endif
# define crc32 z_crc32
# define crc32_combine z_crc32_combine
# define crc32_combine64 z_crc32_combine64
@@ -40,44 +43,52 @@
# define deflateInit2_ z_deflateInit2_
# define deflateInit_ z_deflateInit_
# define deflateParams z_deflateParams
+# define deflatePending z_deflatePending
# define deflatePrime z_deflatePrime
# define deflateReset z_deflateReset
+# define deflateResetKeep z_deflateResetKeep
# define deflateSetDictionary z_deflateSetDictionary
# define deflateSetHeader z_deflateSetHeader
# define deflateTune z_deflateTune
# define deflate_copyright z_deflate_copyright
# define get_crc_table z_get_crc_table
-# define gz_error z_gz_error
-# define gz_intmax z_gz_intmax
-# define gz_strwinerror z_gz_strwinerror
-# define gzbuffer z_gzbuffer
-# define gzclearerr z_gzclearerr
-# define gzclose z_gzclose
-# define gzclose_r z_gzclose_r
-# define gzclose_w z_gzclose_w
-# define gzdirect z_gzdirect
-# define gzdopen z_gzdopen
-# define gzeof z_gzeof
-# define gzerror z_gzerror
-# define gzflush z_gzflush
-# define gzgetc z_gzgetc
-# define gzgets z_gzgets
-# define gzoffset z_gzoffset
-# define gzoffset64 z_gzoffset64
-# define gzopen z_gzopen
-# define gzopen64 z_gzopen64
-# define gzprintf z_gzprintf
-# define gzputc z_gzputc
-# define gzputs z_gzputs
-# define gzread z_gzread
-# define gzrewind z_gzrewind
-# define gzseek z_gzseek
-# define gzseek64 z_gzseek64
-# define gzsetparams z_gzsetparams
-# define gztell z_gztell
-# define gztell64 z_gztell64
-# define gzungetc z_gzungetc
-# define gzwrite z_gzwrite
+# ifndef Z_SOLO
+# define gz_error z_gz_error
+# define gz_intmax z_gz_intmax
+# define gz_strwinerror z_gz_strwinerror
+# define gzbuffer z_gzbuffer
+# define gzclearerr z_gzclearerr
+# define gzclose z_gzclose
+# define gzclose_r z_gzclose_r
+# define gzclose_w z_gzclose_w
+# define gzdirect z_gzdirect
+# define gzdopen z_gzdopen
+# define gzeof z_gzeof
+# define gzerror z_gzerror
+# define gzflush z_gzflush
+# define gzgetc z_gzgetc
+# define gzgetc_ z_gzgetc_
+# define gzgets z_gzgets
+# define gzoffset z_gzoffset
+# define gzoffset64 z_gzoffset64
+# define gzopen z_gzopen
+# define gzopen64 z_gzopen64
+# ifdef _WIN32
+# define gzopen_w z_gzopen_w
+# endif
+# define gzprintf z_gzprintf
+# define gzputc z_gzputc
+# define gzputs z_gzputs
+# define gzread z_gzread
+# define gzrewind z_gzrewind
+# define gzseek z_gzseek
+# define gzseek64 z_gzseek64
+# define gzsetparams z_gzsetparams
+# define gztell z_gztell
+# define gztell64 z_gztell64
+# define gzungetc z_gzungetc
+# define gzwrite z_gzwrite
+# endif
# define inflate z_inflate
# define inflateBack z_inflateBack
# define inflateBackEnd z_inflateBackEnd
@@ -95,13 +106,18 @@
# define inflateSync z_inflateSync
# define inflateSyncPoint z_inflateSyncPoint
# define inflateUndermine z_inflateUndermine
+# define inflateResetKeep z_inflateResetKeep
# define inflate_copyright z_inflate_copyright
# define inflate_fast z_inflate_fast
# define inflate_table z_inflate_table
-# define uncompress z_uncompress
+# ifndef Z_SOLO
+# define uncompress z_uncompress
+# endif
# define zError z_zError
-# define zcalloc z_zcalloc
-# define zcfree z_zcfree
+# ifndef Z_SOLO
+# define zcalloc z_zcalloc
+# define zcfree z_zcfree
+# endif
# define zlibCompileFlags z_zlibCompileFlags
# define zlibVersion z_zlibVersion
@@ -111,7 +127,9 @@
# define alloc_func z_alloc_func
# define charf z_charf
# define free_func z_free_func
-# define gzFile z_gzFile
+# ifndef Z_SOLO
+# define gzFile z_gzFile
+# endif
# define gz_header z_gz_header
# define gz_headerp z_gz_headerp
# define in_func z_in_func
@@ -197,6 +215,12 @@
# endif
#endif
+#if defined(ZLIB_CONST) && !defined(z_const)
+# define z_const const
+#else
+# define z_const
+#endif
+
/* Some Mac compilers merge all .h files incorrectly: */
#if defined(__MWERKS__)||defined(applec)||defined(THINK_C)||defined(__SC__)
# define NO_DUMMY_DECL
@@ -243,6 +267,14 @@
# endif
#endif
+#ifndef Z_ARG /* function prototypes for stdarg */
+# if defined(STDC) || defined(Z_HAVE_STDARG_H)
+# define Z_ARG(args) args
+# else
+# define Z_ARG(args) ()
+# endif
+#endif
+
/* The following definitions for FAR are needed only for MSDOS mixed
* model programming (small or medium model with some far allocations).
* This was tested only with MSC; for other MSDOS compilers you may have
@@ -356,12 +388,45 @@ typedef uLong FAR uLongf;
typedef Byte *voidp;
#endif
+/* ./configure may #define Z_U4 here */
+
+#if !defined(Z_U4) && !defined(Z_SOLO) && defined(STDC)
+# include <limits.h>
+# if (UINT_MAX == 0xffffffffUL)
+# define Z_U4 unsigned
+# else
+# if (ULONG_MAX == 0xffffffffUL)
+# define Z_U4 unsigned long
+# else
+# if (USHRT_MAX == 0xffffffffUL)
+# define Z_U4 unsigned short
+# endif
+# endif
+# endif
+#endif
+
+#ifdef Z_U4
+ typedef Z_U4 z_crc_t;
+#else
+ typedef unsigned long z_crc_t;
+#endif
+
#ifdef HAVE_UNISTD_H /* may be set to #if 1 by ./configure */
# define Z_HAVE_UNISTD_H
#endif
+#ifdef HAVE_STDARG_H /* may be set to #if 1 by ./configure */
+# define Z_HAVE_STDARG_H
+#endif
+
#ifdef STDC
-# include <sys/types.h> /* for off_t */
+# ifndef Z_SOLO
+# include <sys/types.h> /* for off_t */
+# endif
+#endif
+
+#ifdef _WIN32
+# include <stddef.h> /* for wchar_t */
#endif
/* a little trick to accommodate both "#define _LARGEFILE64_SOURCE" and
@@ -370,21 +435,38 @@ typedef uLong FAR uLongf;
* both "#undef _LARGEFILE64_SOURCE" and "#define _LARGEFILE64_SOURCE 0" as
* equivalently requesting no 64-bit operations
*/
-#if -_LARGEFILE64_SOURCE - -1 == 1
+#if defined(LARGEFILE64_SOURCE) && -_LARGEFILE64_SOURCE - -1 == 1
# undef _LARGEFILE64_SOURCE
#endif
-#if defined(Z_HAVE_UNISTD_H) || defined(_LARGEFILE64_SOURCE)
-# include <unistd.h> /* for SEEK_* and off_t */
-# ifdef VMS
-# include <unixio.h> /* for off_t */
-# endif
-# ifndef z_off_t
-# define z_off_t off_t
+#if defined(__WATCOMC__) && !defined(Z_HAVE_UNISTD_H)
+# define Z_HAVE_UNISTD_H
+#endif
+#ifndef Z_SOLO
+# if defined(Z_HAVE_UNISTD_H) || defined(LARGEFILE64_SOURCE)
+# include <unistd.h> /* for SEEK_*, off_t, and _LFS64_LARGEFILE */
+# ifdef VMS
+# include <unixio.h> /* for off_t */
+# endif
+# ifndef z_off_t
+# define z_off_t off_t
+# endif
# endif
#endif
-#ifndef SEEK_SET
+#if defined(_LFS64_LARGEFILE) && _LFS64_LARGEFILE-0
+# define Z_LFS64
+#endif
+
+#if defined(_LARGEFILE64_SOURCE) && defined(Z_LFS64)
+# define Z_LARGE64
+#endif
+
+#if defined(_FILE_OFFSET_BITS) && _FILE_OFFSET_BITS-0 == 64 && defined(Z_LFS64)
+# define Z_WANT64
+#endif
+
+#if !defined(SEEK_SET) && !defined(Z_SOLO)
# define SEEK_SET 0 /* Seek from beginning of file. */
# define SEEK_CUR 1 /* Seek from current position. */
# define SEEK_END 2 /* Set file pointer to EOF plus "offset" */
@@ -394,18 +476,14 @@ typedef uLong FAR uLongf;
# define z_off_t long
#endif
-#if defined(_LARGEFILE64_SOURCE) && _LFS64_LARGEFILE-0
+#if !defined(_WIN32) && defined(Z_LARGE64)
# define z_off64_t off64_t
#else
-# define z_off64_t z_off_t
-#endif
-
-#if defined(__OS400__)
-# define NO_vsnprintf
-#endif
-
-#if defined(__MVS__)
-# define NO_vsnprintf
+# if defined(_WIN32) && !defined(__GNUC__) && !defined(Z_SOLO)
+# define z_off64_t __int64
+# else
+# define z_off64_t z_off_t
+# endif
#endif
/* MVS linker does not support external names larger than 8 bytes */
diff --git a/dep/zlib/zlib.h b/dep/zlib/zlib.h
index bfbba83e8ee..3edf3acdb57 100644
--- a/dep/zlib/zlib.h
+++ b/dep/zlib/zlib.h
@@ -1,7 +1,7 @@
/* zlib.h -- interface of the 'zlib' general purpose compression library
- version 1.2.5, April 19th, 2010
+ version 1.2.7, May 2nd, 2012
- Copyright (C) 1995-2010 Jean-loup Gailly and Mark Adler
+ Copyright (C) 1995-2012 Jean-loup Gailly and Mark Adler
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages
@@ -24,8 +24,8 @@
The data format used by the zlib library is described by RFCs (Request for
- Comments) 1950 to 1952 in the files http://www.ietf.org/rfc/rfc1950.txt
- (zlib format), rfc1951.txt (deflate format) and rfc1952.txt (gzip format).
+ Comments) 1950 to 1952 in the files http://tools.ietf.org/html/rfc1950
+ (zlib format), rfc1951 (deflate format) and rfc1952 (gzip format).
*/
#ifndef ZLIB_H
@@ -37,11 +37,11 @@
extern "C" {
#endif
-#define ZLIB_VERSION "1.2.5"
-#define ZLIB_VERNUM 0x1250
+#define ZLIB_VERSION "1.2.7"
+#define ZLIB_VERNUM 0x1270
#define ZLIB_VER_MAJOR 1
#define ZLIB_VER_MINOR 2
-#define ZLIB_VER_REVISION 5
+#define ZLIB_VER_REVISION 7
#define ZLIB_VER_SUBREVISION 0
/*
@@ -83,15 +83,15 @@ typedef void (*free_func) OF((voidpf opaque, voidpf address));
struct internal_state;
typedef struct z_stream_s {
- Bytef *next_in; /* next input byte */
+ z_const Bytef *next_in; /* next input byte */
uInt avail_in; /* number of bytes available at next_in */
- uLong total_in; /* total nb of input bytes read so far */
+ uLong total_in; /* total number of input bytes read so far */
Bytef *next_out; /* next output byte should be put there */
uInt avail_out; /* remaining free space at next_out */
- uLong total_out; /* total nb of bytes output so far */
+ uLong total_out; /* total number of bytes output so far */
- char *msg; /* last error message, NULL if no error */
+ z_const char *msg; /* last error message, NULL if no error */
struct internal_state FAR *state; /* not visible by applications */
alloc_func zalloc; /* used to allocate the internal state */
@@ -327,8 +327,9 @@ ZEXTERN int ZEXPORT deflate OF((z_streamp strm, int flush));
Z_FINISH can be used immediately after deflateInit if all the compression
is to be done in a single step. In this case, avail_out must be at least the
- value returned by deflateBound (see below). If deflate does not return
- Z_STREAM_END, then it must be called again as described above.
+ value returned by deflateBound (see below). Then deflate is guaranteed to
+ return Z_STREAM_END. If not enough output space is provided, deflate will
+ not return Z_STREAM_END, and it must be called again as described above.
deflate() sets strm->adler to the adler32 checksum of all input read
so far (that is, total_in bytes).
@@ -451,23 +452,29 @@ ZEXTERN int ZEXPORT inflate OF((z_streamp strm, int flush));
error. However if all decompression is to be performed in a single step (a
single call of inflate), the parameter flush should be set to Z_FINISH. In
this case all pending input is processed and all pending output is flushed;
- avail_out must be large enough to hold all the uncompressed data. (The size
- of the uncompressed data may have been saved by the compressor for this
- purpose.) The next operation on this stream must be inflateEnd to deallocate
- the decompression state. The use of Z_FINISH is never required, but can be
- used to inform inflate that a faster approach may be used for the single
- inflate() call.
+ avail_out must be large enough to hold all of the uncompressed data for the
+ operation to complete. (The size of the uncompressed data may have been
+ saved by the compressor for this purpose.) The use of Z_FINISH is not
+ required to perform an inflation in one step. However it may be used to
+ inform inflate that a faster approach can be used for the single inflate()
+ call. Z_FINISH also informs inflate to not maintain a sliding window if the
+ stream completes, which reduces inflate's memory footprint. If the stream
+ does not complete, either because not all of the stream is provided or not
+ enough output space is provided, then a sliding window will be allocated and
+ inflate() can be called again to continue the operation as if Z_NO_FLUSH had
+ been used.
In this implementation, inflate() always flushes as much output as
possible to the output buffer, and always uses the faster approach on the
- first call. So the only effect of the flush parameter in this implementation
- is on the return value of inflate(), as noted below, or when it returns early
- because Z_BLOCK or Z_TREES is used.
+ first call. So the effects of the flush parameter in this implementation are
+ on the return value of inflate() as noted below, when inflate() returns early
+ when Z_BLOCK or Z_TREES is used, and when inflate() avoids the allocation of
+ memory for a sliding window when Z_FINISH is used.
If a preset dictionary is needed after this call (see inflateSetDictionary
- below), inflate sets strm->adler to the adler32 checksum of the dictionary
+ below), inflate sets strm->adler to the Adler-32 checksum of the dictionary
chosen by the compressor and returns Z_NEED_DICT; otherwise it sets
- strm->adler to the adler32 checksum of all output produced so far (that is,
+ strm->adler to the Adler-32 checksum of all output produced so far (that is,
total_out bytes) and returns Z_OK, Z_STREAM_END or an error code as described
below. At the end of the stream, inflate() checks that its computed adler32
checksum is equal to that saved by the compressor and returns Z_STREAM_END
@@ -478,7 +485,9 @@ ZEXTERN int ZEXPORT inflate OF((z_streamp strm, int flush));
initializing with inflateInit2(). Any information contained in the gzip
header is not retained, so applications that need that information should
instead use raw inflate, see inflateInit2() below, or inflateBack() and
- perform their own processing of the gzip header and trailer.
+ perform their own processing of the gzip header and trailer. When processing
+ gzip-wrapped deflate data, strm->adler32 is set to the CRC-32 of the output
+ producted so far. The CRC-32 is checked against the gzip trailer.
inflate() returns Z_OK if some progress has been made (more input processed
or more output produced), Z_STREAM_END if the end of the compressed data has
@@ -580,10 +589,15 @@ ZEXTERN int ZEXPORT deflateSetDictionary OF((z_streamp strm,
uInt dictLength));
/*
Initializes the compression dictionary from the given byte sequence
- without producing any compressed output. This function must be called
- immediately after deflateInit, deflateInit2 or deflateReset, before any call
- of deflate. The compressor and decompressor must use exactly the same
- dictionary (see inflateSetDictionary).
+ without producing any compressed output. When using the zlib format, this
+ function must be called immediately after deflateInit, deflateInit2 or
+ deflateReset, and before any call of deflate. When doing raw deflate, this
+ function must be called either before any call of deflate, or immediately
+ after the completion of a deflate block, i.e. after all input has been
+ consumed and all output has been delivered when using any of the flush
+ options Z_BLOCK, Z_PARTIAL_FLUSH, Z_SYNC_FLUSH, or Z_FULL_FLUSH. The
+ compressor and decompressor must use exactly the same dictionary (see
+ inflateSetDictionary).
The dictionary should consist of strings (byte sequences) that are likely
to be encountered later in the data to be compressed, with the most commonly
@@ -610,8 +624,8 @@ ZEXTERN int ZEXPORT deflateSetDictionary OF((z_streamp strm,
deflateSetDictionary returns Z_OK if success, or Z_STREAM_ERROR if a
parameter is invalid (e.g. dictionary being Z_NULL) or the stream state is
inconsistent (for example if deflate has already been called for this stream
- or if the compression method is bsort). deflateSetDictionary does not
- perform any compression: this will be done by deflate().
+ or if not at a block boundary for raw deflate). deflateSetDictionary does
+ not perform any compression: this will be done by deflate().
*/
ZEXTERN int ZEXPORT deflateCopy OF((z_streamp dest,
@@ -688,8 +702,28 @@ ZEXTERN uLong ZEXPORT deflateBound OF((z_streamp strm,
deflation of sourceLen bytes. It must be called after deflateInit() or
deflateInit2(), and after deflateSetHeader(), if used. This would be used
to allocate an output buffer for deflation in a single pass, and so would be
- called before deflate().
-*/
+ called before deflate(). If that first deflate() call is provided the
+ sourceLen input bytes, an output buffer allocated to the size returned by
+ deflateBound(), and the flush value Z_FINISH, then deflate() is guaranteed
+ to return Z_STREAM_END. Note that it is possible for the compressed size to
+ be larger than the value returned by deflateBound() if flush options other
+ than Z_FINISH or Z_NO_FLUSH are used.
+*/
+
+ZEXTERN int ZEXPORT deflatePending OF((z_streamp strm,
+ unsigned *pending,
+ int *bits));
+/*
+ deflatePending() returns the number of bytes and bits of output that have
+ been generated, but not yet provided in the available output. The bytes not
+ provided would be due to the available output space having being consumed.
+ The number of bits of output not provided are between 0 and 7, where they
+ await more bits to join them in order to fill out a full byte. If pending
+ or bits are Z_NULL, then those values are not set.
+
+ deflatePending returns Z_OK if success, or Z_STREAM_ERROR if the source
+ stream state was inconsistent.
+ */
ZEXTERN int ZEXPORT deflatePrime OF((z_streamp strm,
int bits,
@@ -703,8 +737,9 @@ ZEXTERN int ZEXPORT deflatePrime OF((z_streamp strm,
than or equal to 16, and that many of the least significant bits of value
will be inserted in the output.
- deflatePrime returns Z_OK if success, or Z_STREAM_ERROR if the source
- stream state was inconsistent.
+ deflatePrime returns Z_OK if success, Z_BUF_ERROR if there was not enough
+ room in the internal buffer to insert the bits, or Z_STREAM_ERROR if the
+ source stream state was inconsistent.
*/
ZEXTERN int ZEXPORT deflateSetHeader OF((z_streamp strm,
@@ -790,10 +825,11 @@ ZEXTERN int ZEXPORT inflateSetDictionary OF((z_streamp strm,
if that call returned Z_NEED_DICT. The dictionary chosen by the compressor
can be determined from the adler32 value returned by that call of inflate.
The compressor and decompressor must use exactly the same dictionary (see
- deflateSetDictionary). For raw inflate, this function can be called
- immediately after inflateInit2() or inflateReset() and before any call of
- inflate() to set the dictionary. The application must insure that the
- dictionary that was used for compression is provided.
+ deflateSetDictionary). For raw inflate, this function can be called at any
+ time to set the dictionary. If the provided dictionary is smaller than the
+ window and there is already data in the window, then the provided dictionary
+ will amend what's there. The application must insure that the dictionary
+ that was used for compression is provided.
inflateSetDictionary returns Z_OK if success, Z_STREAM_ERROR if a
parameter is invalid (e.g. dictionary being Z_NULL) or the stream state is
@@ -805,17 +841,21 @@ ZEXTERN int ZEXPORT inflateSetDictionary OF((z_streamp strm,
ZEXTERN int ZEXPORT inflateSync OF((z_streamp strm));
/*
- Skips invalid compressed data until a full flush point (see above the
- description of deflate with Z_FULL_FLUSH) can be found, or until all
+ Skips invalid compressed data until a possible full flush point (see above
+ for the description of deflate with Z_FULL_FLUSH) can be found, or until all
available input is skipped. No output is provided.
- inflateSync returns Z_OK if a full flush point has been found, Z_BUF_ERROR
- if no more input was provided, Z_DATA_ERROR if no flush point has been
- found, or Z_STREAM_ERROR if the stream structure was inconsistent. In the
- success case, the application may save the current current value of total_in
- which indicates where valid compressed data was found. In the error case,
- the application may repeatedly call inflateSync, providing more input each
- time, until success or end of the input data.
+ inflateSync searches for a 00 00 FF FF pattern in the compressed data.
+ All full flush points have this pattern, but not all occurences of this
+ pattern are full flush points.
+
+ inflateSync returns Z_OK if a possible full flush point has been found,
+ Z_BUF_ERROR if no more input was provided, Z_DATA_ERROR if no flush point
+ has been found, or Z_STREAM_ERROR if the stream structure was inconsistent.
+ In the success case, the application may save the current current value of
+ total_in which indicates where valid compressed data was found. In the
+ error case, the application may repeatedly call inflateSync, providing more
+ input each time, until success or end of the input data.
*/
ZEXTERN int ZEXPORT inflateCopy OF((z_streamp dest,
@@ -962,7 +1002,7 @@ ZEXTERN int ZEXPORT inflateBackInit OF((z_streamp strm, int windowBits,
See inflateBack() for the usage of these routines.
inflateBackInit will return Z_OK on success, Z_STREAM_ERROR if any of
- the paramaters are invalid, Z_MEM_ERROR if the internal state could not be
+ the parameters are invalid, Z_MEM_ERROR if the internal state could not be
allocated, or Z_VERSION_ERROR if the version of the library does not match
the version of the header file.
*/
@@ -1088,6 +1128,7 @@ ZEXTERN uLong ZEXPORT zlibCompileFlags OF((void));
27-31: 0 (reserved)
*/
+#ifndef Z_SOLO
/* utility functions */
@@ -1149,10 +1190,11 @@ ZEXTERN int ZEXPORT uncompress OF((Bytef *dest, uLongf *destLen,
uncompress returns Z_OK if success, Z_MEM_ERROR if there was not
enough memory, Z_BUF_ERROR if there was not enough room in the output
- buffer, or Z_DATA_ERROR if the input data was corrupted or incomplete.
+ buffer, or Z_DATA_ERROR if the input data was corrupted or incomplete. In
+ the case where there is not enough room, uncompress() will fill the output
+ buffer with the uncompressed data up to that point.
*/
-
/* gzip file access functions */
/*
@@ -1162,7 +1204,7 @@ ZEXTERN int ZEXPORT uncompress OF((Bytef *dest, uLongf *destLen,
wrapper, documented in RFC 1952, wrapped around a deflate stream.
*/
-typedef voidp gzFile; /* opaque gzip file descriptor */
+typedef struct gzFile_s *gzFile; /* semi-opaque gzip file descriptor */
/*
ZEXTERN gzFile ZEXPORT gzopen OF((const char *path, const char *mode));
@@ -1172,13 +1214,28 @@ ZEXTERN gzFile ZEXPORT gzopen OF((const char *path, const char *mode));
a strategy: 'f' for filtered data as in "wb6f", 'h' for Huffman-only
compression as in "wb1h", 'R' for run-length encoding as in "wb1R", or 'F'
for fixed code compression as in "wb9F". (See the description of
- deflateInit2 for more information about the strategy parameter.) Also "a"
- can be used instead of "w" to request that the gzip stream that will be
- written be appended to the file. "+" will result in an error, since reading
- and writing to the same gzip file is not supported.
+ deflateInit2 for more information about the strategy parameter.) 'T' will
+ request transparent writing or appending with no compression and not using
+ the gzip format.
+
+ "a" can be used instead of "w" to request that the gzip stream that will
+ be written be appended to the file. "+" will result in an error, since
+ reading and writing to the same gzip file is not supported. The addition of
+ "x" when writing will create the file exclusively, which fails if the file
+ already exists. On systems that support it, the addition of "e" when
+ reading or writing will set the flag to close the file on an execve() call.
+
+ These functions, as well as gzip, will read and decode a sequence of gzip
+ streams in a file. The append function of gzopen() can be used to create
+ such a file. (Also see gzflush() for another way to do this.) When
+ appending, gzopen does not test whether the file begins with a gzip stream,
+ nor does it look for the end of the gzip streams to begin appending. gzopen
+ will simply append a gzip stream to the existing file.
gzopen can be used to read a file which is not in gzip format; in this
- case gzread will directly read from the file without decompression.
+ case gzread will directly read from the file without decompression. When
+ reading, this will be detected automatically by looking for the magic two-
+ byte gzip header.
gzopen returns NULL if the file could not be opened, if there was
insufficient memory to allocate the gzFile state, or if an invalid mode was
@@ -1197,7 +1254,11 @@ ZEXTERN gzFile ZEXPORT gzdopen OF((int fd, const char *mode));
descriptor fd, just like fclose(fdopen(fd, mode)) closes the file descriptor
fd. If you want to keep fd open, use fd = dup(fd_keep); gz = gzdopen(fd,
mode);. The duplicated descriptor should be saved to avoid a leak, since
- gzdopen does not close fd if it fails.
+ gzdopen does not close fd if it fails. If you are using fileno() to get the
+ file descriptor from a FILE *, then you will have to use dup() to avoid
+ double-close()ing the file descriptor. Both gzclose() and fclose() will
+ close the associated file descriptor, so they need to have different file
+ descriptors.
gzdopen returns NULL if there was insufficient memory to allocate the
gzFile state, if an invalid mode was specified (an 'r', 'w', or 'a' was not
@@ -1235,14 +1296,26 @@ ZEXTERN int ZEXPORT gzsetparams OF((gzFile file, int level, int strategy));
ZEXTERN int ZEXPORT gzread OF((gzFile file, voidp buf, unsigned len));
/*
Reads the given number of uncompressed bytes from the compressed file. If
- the input file was not in gzip format, gzread copies the given number of
- bytes into the buffer.
+ the input file is not in gzip format, gzread copies the given number of
+ bytes into the buffer directly from the file.
After reaching the end of a gzip stream in the input, gzread will continue
- to read, looking for another gzip stream, or failing that, reading the rest
- of the input file directly without decompression. The entire input file
- will be read if gzread is called until it returns less than the requested
- len.
+ to read, looking for another gzip stream. Any number of gzip streams may be
+ concatenated in the input file, and will all be decompressed by gzread().
+ If something other than a gzip stream is encountered after a gzip stream,
+ that remaining trailing garbage is ignored (and no error is returned).
+
+ gzread can be used to read a gzip file that is being concurrently written.
+ Upon reaching the end of the input, gzread will return with the available
+ data. If the error code returned by gzerror is Z_OK or Z_BUF_ERROR, then
+ gzclearerr can be used to clear the end of file indicator in order to permit
+ gzread to be tried again. Z_OK indicates that a gzip stream was completed
+ on the last gzread. Z_BUF_ERROR indicates that the input file ended in the
+ middle of a gzip stream. Note that gzread does not return -1 in the event
+ of an incomplete gzip stream. This error is deferred until gzclose(), which
+ will return Z_BUF_ERROR if the last gzread ended in the middle of a gzip
+ stream. Alternatively, gzerror can be used before gzclose to detect this
+ case.
gzread returns the number of uncompressed bytes actually read, less than
len for end of file, or -1 for error.
@@ -1256,7 +1329,7 @@ ZEXTERN int ZEXPORT gzwrite OF((gzFile file,
error.
*/
-ZEXTERN int ZEXPORTVA gzprintf OF((gzFile file, const char *format, ...));
+ZEXTERN int ZEXPORTVA gzprintf Z_ARG((gzFile file, const char *format, ...));
/*
Converts, formats, and writes the arguments to the compressed file under
control of the format string, as in fprintf. gzprintf returns the number of
@@ -1301,7 +1374,10 @@ ZEXTERN int ZEXPORT gzputc OF((gzFile file, int c));
ZEXTERN int ZEXPORT gzgetc OF((gzFile file));
/*
Reads one byte from the compressed file. gzgetc returns this byte or -1
- in case of end of file or error.
+ in case of end of file or error. This is implemented as a macro for speed.
+ As such, it does not do all of the checking the other functions do. I.e.
+ it does not check to see if file is NULL, nor whether the structure file
+ points to has been clobbered or not.
*/
ZEXTERN int ZEXPORT gzungetc OF((int c, gzFile file));
@@ -1397,9 +1473,7 @@ ZEXTERN int ZEXPORT gzeof OF((gzFile file));
ZEXTERN int ZEXPORT gzdirect OF((gzFile file));
/*
Returns true (1) if file is being copied directly while reading, or false
- (0) if file is a gzip stream being decompressed. This state can change from
- false to true while reading the input file if the end of a gzip stream is
- reached, but is followed by data that is not another gzip stream.
+ (0) if file is a gzip stream being decompressed.
If the input file is empty, gzdirect() will return true, since the input
does not contain a gzip stream.
@@ -1408,6 +1482,13 @@ ZEXTERN int ZEXPORT gzdirect OF((gzFile file));
cause buffers to be allocated to allow reading the file to determine if it
is a gzip file. Therefore if gzbuffer() is used, it should be called before
gzdirect().
+
+ When writing, gzdirect() returns true (1) if transparent writing was
+ requested ("wT" for the gzopen() mode), or false (0) otherwise. (Note:
+ gzdirect() is not needed when writing. Transparent writing must be
+ explicitly requested, so the application already knows the answer. When
+ linking statically, using gzdirect() will include all of the zlib code for
+ gzip file reading and decompression, which may not be desired.)
*/
ZEXTERN int ZEXPORT gzclose OF((gzFile file));
@@ -1419,7 +1500,8 @@ ZEXTERN int ZEXPORT gzclose OF((gzFile file));
must not be called more than once on the same allocation.
gzclose will return Z_STREAM_ERROR if file is not valid, Z_ERRNO on a
- file operation error, or Z_OK on success.
+ file operation error, Z_MEM_ERROR if out of memory, Z_BUF_ERROR if the
+ last read ended in the middle of a gzip stream, or Z_OK on success.
*/
ZEXTERN int ZEXPORT gzclose_r OF((gzFile file));
@@ -1457,6 +1539,7 @@ ZEXTERN void ZEXPORT gzclearerr OF((gzFile file));
file that is being written concurrently.
*/
+#endif /* !Z_SOLO */
/* checksum functions */
@@ -1492,16 +1575,17 @@ ZEXTERN uLong ZEXPORT adler32_combine OF((uLong adler1, uLong adler2,
Combine two Adler-32 checksums into one. For two sequences of bytes, seq1
and seq2 with lengths len1 and len2, Adler-32 checksums were calculated for
each, adler1 and adler2. adler32_combine() returns the Adler-32 checksum of
- seq1 and seq2 concatenated, requiring only adler1, adler2, and len2.
+ seq1 and seq2 concatenated, requiring only adler1, adler2, and len2. Note
+ that the z_off_t type (like off_t) is a signed integer. If len2 is
+ negative, the result has no meaning or utility.
*/
ZEXTERN uLong ZEXPORT crc32 OF((uLong crc, const Bytef *buf, uInt len));
/*
Update a running CRC-32 with the bytes buf[0..len-1] and return the
updated CRC-32. If buf is Z_NULL, this function returns the required
- initial value for the for the crc. Pre- and post-conditioning (one's
- complement) is performed within this function so it shouldn't be done by the
- application.
+ initial value for the crc. Pre- and post-conditioning (one's complement) is
+ performed within this function so it shouldn't be done by the application.
Usage example:
@@ -1544,17 +1628,42 @@ ZEXTERN int ZEXPORT inflateBackInit_ OF((z_streamp strm, int windowBits,
const char *version,
int stream_size));
#define deflateInit(strm, level) \
- deflateInit_((strm), (level), ZLIB_VERSION, sizeof(z_stream))
+ deflateInit_((strm), (level), ZLIB_VERSION, (int)sizeof(z_stream))
#define inflateInit(strm) \
- inflateInit_((strm), ZLIB_VERSION, sizeof(z_stream))
+ inflateInit_((strm), ZLIB_VERSION, (int)sizeof(z_stream))
#define deflateInit2(strm, level, method, windowBits, memLevel, strategy) \
deflateInit2_((strm),(level),(method),(windowBits),(memLevel),\
- (strategy), ZLIB_VERSION, sizeof(z_stream))
+ (strategy), ZLIB_VERSION, (int)sizeof(z_stream))
#define inflateInit2(strm, windowBits) \
- inflateInit2_((strm), (windowBits), ZLIB_VERSION, sizeof(z_stream))
+ inflateInit2_((strm), (windowBits), ZLIB_VERSION, \
+ (int)sizeof(z_stream))
#define inflateBackInit(strm, windowBits, window) \
inflateBackInit_((strm), (windowBits), (window), \
- ZLIB_VERSION, sizeof(z_stream))
+ ZLIB_VERSION, (int)sizeof(z_stream))
+
+#ifndef Z_SOLO
+
+/* gzgetc() macro and its supporting function and exposed data structure. Note
+ * that the real internal state is much larger than the exposed structure.
+ * This abbreviated structure exposes just enough for the gzgetc() macro. The
+ * user should not mess with these exposed elements, since their names or
+ * behavior could change in the future, perhaps even capriciously. They can
+ * only be used by the gzgetc() macro. You have been warned.
+ */
+struct gzFile_s {
+ unsigned have;
+ unsigned char *next;
+ z_off64_t pos;
+};
+ZEXTERN int ZEXPORT gzgetc_ OF((gzFile file)); /* backward compatibility */
+#ifdef Z_PREFIX_SET
+# undef z_gzgetc
+# define z_gzgetc(g) \
+ ((g)->have ? ((g)->have--, (g)->pos++, *((g)->next)++) : gzgetc(g))
+#else
+# define gzgetc(g) \
+ ((g)->have ? ((g)->have--, (g)->pos++, *((g)->next)++) : gzgetc(g))
+#endif
/* provide 64-bit offset functions if _LARGEFILE64_SOURCE defined, and/or
* change the regular functions to 64 bits if _FILE_OFFSET_BITS is 64 (if
@@ -1562,7 +1671,7 @@ ZEXTERN int ZEXPORT inflateBackInit_ OF((z_streamp strm, int windowBits,
* functions are changed to 64 bits) -- in case these are set on systems
* without large file support, _LFS64_LARGEFILE must also be true
*/
-#if defined(_LARGEFILE64_SOURCE) && _LFS64_LARGEFILE-0
+#ifdef Z_LARGE64
ZEXTERN gzFile ZEXPORT gzopen64 OF((const char *, const char *));
ZEXTERN z_off64_t ZEXPORT gzseek64 OF((gzFile, z_off64_t, int));
ZEXTERN z_off64_t ZEXPORT gztell64 OF((gzFile));
@@ -1571,14 +1680,23 @@ ZEXTERN int ZEXPORT inflateBackInit_ OF((z_streamp strm, int windowBits,
ZEXTERN uLong ZEXPORT crc32_combine64 OF((uLong, uLong, z_off64_t));
#endif
-#if !defined(ZLIB_INTERNAL) && _FILE_OFFSET_BITS-0 == 64 && _LFS64_LARGEFILE-0
-# define gzopen gzopen64
-# define gzseek gzseek64
-# define gztell gztell64
-# define gzoffset gzoffset64
-# define adler32_combine adler32_combine64
-# define crc32_combine crc32_combine64
-# ifdef _LARGEFILE64_SOURCE
+#if !defined(ZLIB_INTERNAL) && defined(Z_WANT64)
+# ifdef Z_PREFIX_SET
+# define z_gzopen z_gzopen64
+# define z_gzseek z_gzseek64
+# define z_gztell z_gztell64
+# define z_gzoffset z_gzoffset64
+# define z_adler32_combine z_adler32_combine64
+# define z_crc32_combine z_crc32_combine64
+# else
+# define gzopen gzopen64
+# define gzseek gzseek64
+# define gztell gztell64
+# define gzoffset gzoffset64
+# define adler32_combine adler32_combine64
+# define crc32_combine crc32_combine64
+# endif
+# ifndef Z_LARGE64
ZEXTERN gzFile ZEXPORT gzopen64 OF((const char *, const char *));
ZEXTERN z_off_t ZEXPORT gzseek64 OF((gzFile, z_off_t, int));
ZEXTERN z_off_t ZEXPORT gztell64 OF((gzFile));
@@ -1595,6 +1713,13 @@ ZEXTERN int ZEXPORT inflateBackInit_ OF((z_streamp strm, int windowBits,
ZEXTERN uLong ZEXPORT crc32_combine OF((uLong, uLong, z_off_t));
#endif
+#else /* Z_SOLO */
+
+ ZEXTERN uLong ZEXPORT adler32_combine OF((uLong, uLong, z_off_t));
+ ZEXTERN uLong ZEXPORT crc32_combine OF((uLong, uLong, z_off_t));
+
+#endif /* !Z_SOLO */
+
/* hack for buggy compilers */
#if !defined(ZUTIL_H) && !defined(NO_DUMMY_DECL)
struct internal_state {int dummy;};
@@ -1603,8 +1728,14 @@ ZEXTERN int ZEXPORT inflateBackInit_ OF((z_streamp strm, int windowBits,
/* undocumented functions */
ZEXTERN const char * ZEXPORT zError OF((int));
ZEXTERN int ZEXPORT inflateSyncPoint OF((z_streamp));
-ZEXTERN const uLongf * ZEXPORT get_crc_table OF((void));
+ZEXTERN const z_crc_t FAR * ZEXPORT get_crc_table OF((void));
ZEXTERN int ZEXPORT inflateUndermine OF((z_streamp, int));
+ZEXTERN int ZEXPORT inflateResetKeep OF((z_streamp));
+ZEXTERN int ZEXPORT deflateResetKeep OF((z_streamp));
+#if defined(_WIN32) && !defined(Z_SOLO)
+ZEXTERN gzFile ZEXPORT gzopen_w OF((const wchar_t *path,
+ const char *mode));
+#endif
#ifdef __cplusplus
}
diff --git a/dep/zlib/zutil.c b/dep/zlib/zutil.c
index 898ed345b0e..65e0d3b72b0 100644
--- a/dep/zlib/zutil.c
+++ b/dep/zlib/zutil.c
@@ -1,11 +1,14 @@
/* zutil.c -- target dependent utility functions for the compression library
- * Copyright (C) 1995-2005, 2010 Jean-loup Gailly.
+ * Copyright (C) 1995-2005, 2010, 2011, 2012 Jean-loup Gailly.
* For conditions of distribution and use, see copyright notice in zlib.h
*/
/* @(#) $Id$ */
#include "zutil.h"
+#ifndef Z_SOLO
+# include "gzguts.h"
+#endif
#ifndef NO_DUMMY_DECL
struct internal_state {int dummy;}; /* for buggy compilers */
@@ -85,27 +88,27 @@ uLong ZEXPORT zlibCompileFlags()
#ifdef FASTEST
flags += 1L << 21;
#endif
-#ifdef STDC
+#if defined(STDC) || defined(Z_HAVE_STDARG_H)
# ifdef NO_vsnprintf
- flags += 1L << 25;
+ flags += 1L << 25;
# ifdef HAS_vsprintf_void
- flags += 1L << 26;
+ flags += 1L << 26;
# endif
# else
# ifdef HAS_vsnprintf_void
- flags += 1L << 26;
+ flags += 1L << 26;
# endif
# endif
#else
- flags += 1L << 24;
+ flags += 1L << 24;
# ifdef NO_snprintf
- flags += 1L << 25;
+ flags += 1L << 25;
# ifdef HAS_sprintf_void
- flags += 1L << 26;
+ flags += 1L << 26;
# endif
# else
# ifdef HAS_snprintf_void
- flags += 1L << 26;
+ flags += 1L << 26;
# endif
# endif
#endif
@@ -181,6 +184,7 @@ void ZLIB_INTERNAL zmemzero(dest, len)
}
#endif
+#ifndef Z_SOLO
#ifdef SYS16BIT
@@ -316,3 +320,5 @@ void ZLIB_INTERNAL zcfree (opaque, ptr)
}
#endif /* MY_ZCALLOC */
+
+#endif /* !Z_SOLO */
diff --git a/dep/zlib/zutil.h b/dep/zlib/zutil.h
index 258fa88799a..4e3dcc6ae9f 100644
--- a/dep/zlib/zutil.h
+++ b/dep/zlib/zutil.h
@@ -1,5 +1,5 @@
/* zutil.h -- internal interface and configuration of the compression library
- * Copyright (C) 1995-2010 Jean-loup Gailly.
+ * Copyright (C) 1995-2012 Jean-loup Gailly.
* For conditions of distribution and use, see copyright notice in zlib.h
*/
@@ -13,7 +13,7 @@
#ifndef ZUTIL_H
#define ZUTIL_H
-#if ((__GNUC__-0) * 10 + __GNUC_MINOR__-0 >= 33) && !defined(NO_VIZ)
+#ifdef HAVE_HIDDEN
# define ZLIB_INTERNAL __attribute__((visibility ("hidden")))
#else
# define ZLIB_INTERNAL
@@ -21,7 +21,7 @@
#include "zlib.h"
-#ifdef STDC
+#if defined(STDC) && !defined(Z_SOLO)
# if !(defined(_WIN32_WCE) && defined(_MSC_VER))
# include <stddef.h>
# endif
@@ -29,6 +29,10 @@
# include <stdlib.h>
#endif
+#ifdef Z_SOLO
+ typedef long ptrdiff_t; /* guess -- will be caught if guess is wrong */
+#endif
+
#ifndef local
# define local static
#endif
@@ -78,16 +82,18 @@ extern const char * const z_errmsg[10]; /* indexed by 2-zlib_error */
#if defined(MSDOS) || (defined(WINDOWS) && !defined(WIN32))
# define OS_CODE 0x00
-# if defined(__TURBOC__) || defined(__BORLANDC__)
-# if (__STDC__ == 1) && (defined(__LARGE__) || defined(__COMPACT__))
- /* Allow compilation with ANSI keywords only enabled */
- void _Cdecl farfree( void *block );
- void *_Cdecl farmalloc( unsigned long nbytes );
-# else
-# include <alloc.h>
+# ifndef Z_SOLO
+# if defined(__TURBOC__) || defined(__BORLANDC__)
+# if (__STDC__ == 1) && (defined(__LARGE__) || defined(__COMPACT__))
+ /* Allow compilation with ANSI keywords only enabled */
+ void _Cdecl farfree( void *block );
+ void *_Cdecl farmalloc( unsigned long nbytes );
+# else
+# include <alloc.h>
+# endif
+# else /* MSC or DJGPP */
+# include <malloc.h>
# endif
-# else /* MSC or DJGPP */
-# include <malloc.h>
# endif
#endif
@@ -107,18 +113,20 @@ extern const char * const z_errmsg[10]; /* indexed by 2-zlib_error */
#ifdef OS2
# define OS_CODE 0x06
-# ifdef M_I86
+# if defined(M_I86) && !defined(Z_SOLO)
# include <malloc.h>
# endif
#endif
#if defined(MACOS) || defined(TARGET_OS_MAC)
# define OS_CODE 0x07
-# if defined(__MWERKS__) && __dest_os != __be_os && __dest_os != __win32_os
-# include <unix.h> /* for fdopen */
-# else
-# ifndef fdopen
-# define fdopen(fd,mode) NULL /* No fdopen() */
+# ifndef Z_SOLO
+# if defined(__MWERKS__) && __dest_os != __be_os && __dest_os != __win32_os
+# include <unix.h> /* for fdopen */
+# else
+# ifndef fdopen
+# define fdopen(fd,mode) NULL /* No fdopen() */
+# endif
# endif
# endif
#endif
@@ -153,14 +161,14 @@ extern const char * const z_errmsg[10]; /* indexed by 2-zlib_error */
# endif
#endif
-#if defined(__BORLANDC__)
+#if defined(__BORLANDC__) && !defined(MSDOS)
#pragma warn -8004
#pragma warn -8008
#pragma warn -8066
#endif
/* provide prototypes for these when building zlib without LFS */
-#if !defined(_LARGEFILE64_SOURCE) || _LFS64_LARGEFILE-0 == 0
+#if !defined(_WIN32) && (!defined(_LARGEFILE64_SOURCE) || _LFS64_LARGEFILE-0 == 0)
ZEXTERN uLong ZEXPORT adler32_combine64 OF((uLong, uLong, z_off_t));
ZEXTERN uLong ZEXPORT crc32_combine64 OF((uLong, uLong, z_off_t));
#endif
@@ -177,42 +185,7 @@ extern const char * const z_errmsg[10]; /* indexed by 2-zlib_error */
/* functions */
-#if defined(STDC99) || (defined(__TURBOC__) && __TURBOC__ >= 0x550)
-# ifndef HAVE_VSNPRINTF
-# define HAVE_VSNPRINTF
-# endif
-#endif
-#if defined(__CYGWIN__)
-# ifndef HAVE_VSNPRINTF
-# define HAVE_VSNPRINTF
-# endif
-#endif
-#ifndef HAVE_VSNPRINTF
-# ifdef MSDOS
- /* vsnprintf may exist on some MS-DOS compilers (DJGPP?),
- but for now we just assume it doesn't. */
-# define NO_vsnprintf
-# endif
-# ifdef __TURBOC__
-# define NO_vsnprintf
-# endif
-# ifdef WIN32
- /* In Win32, vsnprintf is available as the "non-ANSI" _vsnprintf. */
-# if !defined(vsnprintf) && !defined(NO_vsnprintf)
-# if !defined(_MSC_VER) || ( defined(_MSC_VER) && _MSC_VER < 1500 )
-# define vsnprintf _vsnprintf
-# endif
-# endif
-# endif
-# ifdef __SASC
-# define NO_vsnprintf
-# endif
-#endif
-#ifdef VMS
-# define NO_vsnprintf
-#endif
-
-#if defined(pyr)
+#if defined(pyr) || defined(Z_SOLO)
# define NO_MEMCPY
#endif
#if defined(SMALL_MEDIUM) && !defined(_MSC_VER) && !defined(__SC__)
@@ -261,14 +234,19 @@ extern const char * const z_errmsg[10]; /* indexed by 2-zlib_error */
# define Tracecv(c,x)
#endif
-
-voidpf ZLIB_INTERNAL zcalloc OF((voidpf opaque, unsigned items,
- unsigned size));
-void ZLIB_INTERNAL zcfree OF((voidpf opaque, voidpf ptr));
+#ifndef Z_SOLO
+ voidpf ZLIB_INTERNAL zcalloc OF((voidpf opaque, unsigned items,
+ unsigned size));
+ void ZLIB_INTERNAL zcfree OF((voidpf opaque, voidpf ptr));
+#endif
#define ZALLOC(strm, items, size) \
(*((strm)->zalloc))((strm)->opaque, (items), (size))
#define ZFREE(strm, addr) (*((strm)->zfree))((strm)->opaque, (voidpf)(addr))
#define TRY_FREE(s, p) {if (p) ZFREE(s, p);}
+/* Reverse the bytes in a 32-bit value */
+#define ZSWAP32(q) ((((q) >> 24) & 0xff) + (((q) >> 8) & 0xff00) + \
+ (((q) & 0xff00) << 8) + (((q) & 0xff) << 24))
+
#endif /* ZUTIL_H */
diff --git a/doc/gpl-2.0.txt b/doc/GPL-2.0.txt
index d159169d105..d159169d105 100644
--- a/doc/gpl-2.0.txt
+++ b/doc/GPL-2.0.txt
diff --git a/doc/LoggingHOWTO.txt b/doc/LoggingHOWTO.txt
new file mode 100644
index 00000000000..79b03d3dd2f
--- /dev/null
+++ b/doc/LoggingHOWTO.txt
@@ -0,0 +1,274 @@
+Logging system "log4j-like"
+
+--- LOGGERS AND APPENDERS ---
+
+Logging system has two components: loggers and appenders. These types of
+components enable users to log messages according to message type and level and
+control at runtime where they are reported.
+
+LOGGERS
+
+The first and foremost advantage of this system resided in the ability to
+disable certain log statements while allowing others to print unhindered.
+This capability assumes that the loggers are categorized according to some
+developer-chosen criteria.
+
+Loggers follow hierarchy, if a logger is not defined a root logger will be used
+
+Loggers may be assigned levels. The set of possible levels are TRACE, DEBUG,
+INFO, WARN, ERROR AND FATAL, or be disabled using level DISABLED.
+
+By definition the printing method determines the level of a logging request.
+For example, sLog->outInfo(...) is a logging request of level INFO.
+
+A logging request is said to be enabled if its level is higher than or equal to
+the level of its logger. Otherwise, the request is said to be disabled. A logger
+without an assigned level will inherit one from the hierarchy
+
+Example
+Logger Name Assigned Level Inherited Level
+root Proot Proot
+Network None Proot
+
+As Network is not defined, it uses the root logger and it's log level.
+TRACE < DEBUG < INFO < WARN < ERROR < FATAL.
+
+
+APPENDERS
+
+The ability to selectively enable of dissable logging request based on their
+loggers is only part of the picture. This system allows logging requests to
+print to multiple destinations. An output destination is called an appender.
+Current system defines appenders for Console, files and Database, but can be
+easily extended to remote socket server, NT event loggers, syslog daemons or
+any other system.
+
+More than one appender can be attached to one logger. Each enabled logging
+request for a given logger will be forwarded to all the appenders in that
+logger
+
+
+CONFIGURATION
+
+System will read "Loggers" and "Appenders" to know the list of loggers and
+appenders to read from config file. Both are a list of elements separated
+by space.
+
+Once we have the list of appenders to read, system will try to configure a new
+appender from its config line. Appender config line follows the format:
+
+ Type,LogLevel,Flags,optional1,optional2
+
+Its a list of elements separated by comma where each element has its own meaning
+ Type: Type of the appender
+ 1 - (Console)
+ 2 - (File)
+ 3 - (DB)
+ LogLevel: Log level
+ 0 - (Disabled)
+ 1 - (Trace)
+ 2 - (Debug)
+ 3 - (Info)
+ 4 - (Warn)
+ 5 - (Error)
+ 6 - (Fatal)
+ Flags: Define some extra modifications to do to logging message
+ 1 - Prefix Timestamp to the text
+ 2 - Prefix Log Level to the text
+ 4 - Prefix Log Filter type to the text
+ 8 - Append timestamp to the log file name. Format: YYYY-MM-DD_HH-MM-SS
+ (Only used with Type = 2)
+ 16 - Make a backup of existing file before overwrite
+ (Only used with Mode = w)
+
+Depending on the type, elements optional1 and optional2 will take different
+
+ Colors (read as optional1 if Type = Console)
+ Format: "fatal error warn info debug trace"
+ 0 - BLACK
+ 1 - RED
+ 2 - GREEN
+ 3 - BROWN
+ 4 - BLUE
+ 5 - MAGENTA
+ 6 - CYAN
+ 7 - GREY
+ 8 - YELLOW
+ 9 - LRED
+ 10 - LGREEN
+ 11 - LBLUE
+ 12 - LMAGENTA
+ 13 - LCYAN
+ 14 - WHITE
+ Example: "13 11 9 5 3 1"
+
+ File: Name of the file (read as optional1 if Type = File)
+ Allows to use one "%u" to create dynamic files
+
+ Mode: Mode to open the file (read as optional2 if Type = File)
+ a - (Append)
+ w - (Overwrite)
+
+Example:
+ Appender.Console1=1,2,6
+
+ Creates new appender to log to console any message with log level DEBUG
+ or higher and prefixes log type and level to the message.
+
+ Appender.Console2=1,5,1,13 11 9 5 3 1
+
+ Creates new appender to log to console any message with log level ERROR
+ or higher and prefixes timestamp to the message using colored text.
+
+ Appender.File=2,2,7,Auth.log,w
+
+ Creates new appender to log to file "Auth.log" any message with log level
+ DEBUG or higher and prefixes timestamp, type and level to message
+
+In the example, having two different loggers to log to console is perfectly
+legal but redundant.
+
+Once we have the list of loggers to read, system will try to configure a new
+logger from its config line. Logger config line follows the format:
+
+ Type,LogLevel,AppenderList
+
+Its a list of elements separated by comma where each element has its own meaning
+ Type: Type of the logger (
+ 0 - Default. Each type that has no config will
+ rely on this one. Core will create this logger
+ (disabled) if it's not configured
+ 1 - Units that doesn't fit in other categories
+ 2 - Pets
+ 3 - Vehicles
+ 4 - C++ AI, instance scripts, etc.
+ 5 - DB AI, such as SAI, EAI, CreatureAI
+ 6 - DB map scripts
+ 7 - Network input/output,
+ such as packet handlers and netcode logs
+ 8 - Spellsystem and aurasystem
+ 9 - Achievement system
+ 10 - Condition system
+ 11 - Pool system
+ 12 - Auction house
+ 13 - Arena's and battlegrounds
+ 14 - Outdoor PVP
+ 15 - Chat system
+ 16 - LFG system
+ 17 - Maps, instances (not scripts),
+ grids, cells, visibility, etc.
+ 18 - Player that doesn't fit in other categories.
+ 19 - Player loading from DB
+ (Player::_LoadXXX functions)
+ 20 - Items
+ 21 - Player skills (do not confuse with spells)
+ 22 - Player chat logs
+ 23 - loot
+ 24 - guilds
+ 25 - transports
+ 26 - SQL. DB errors
+ 27 - GM Commands
+ 28 - Remote Access Commands
+ 29 - Warden
+ 30 - Authserver
+ 31 - Worldserver
+ 32 - Game Events
+ 33 - Calendar
+ 34 - Character (Exclusive to login, logout, create, rename and delete)
+ 35 - Arenas
+ 36 - SQL Driver
+ 37 - SQL Dev
+ LogLevel
+ 0 - (Disabled)
+ 1 - (Trace)
+ 2 - (Debug)
+ 3 - (Info)
+ 4 - (Warn)
+ 5 - (Error)
+ 6 - (Fatal)
+ AppenderList: List of appenders linked to logger
+ (Using spaces as separator).
+
+--- EXAMPLES ---
+
+EXAMPLE 1
+
+Log errors to console and a file called server.log that only contain
+logs for this server run. File should prefix timestamp, type and log level to
+the messages. Console should prefix type and log level.
+
+ Appenders=Console Server
+ Loggers=Root
+ Appender.Console=1,5,6
+ Appender.Server=2,5,7,Server.log,w
+ Logger.Root=0,5,Console Server
+
+Lets trace how system will log two different messages:
+ 1) sLog->outError(LOG_FILTER_GUILD, "Guild 1 created");
+ System will try to find logger of type GUILD, as no logger is configured
+ for GUILD it will use Root logger. As message Log Level is equal or higher
+ than the Log level of logger the message is sent to the Appenders
+ configured in the Logger. "Console" and "Server".
+ Console will write: "ERROR [GUILD ] Guild 1 created"
+ Server will write to file "2012-08-15 ERROR [GUILD ] Guild 1 created"
+
+ 2) sLog->outInfo(LOG_FILTER_CHARACTER, "Player Name Logged in");
+ System will try to find logger of type CHARACTER, as no logger is
+ configured for CHARACTER it will use Root logger. As message Log Level is
+ not equal or higher than the Log level of logger the message its discarted.
+
+EXAMPLE 2
+
+Same example that above, but now i want to see all messages of level INFO on
+file and server file should add timestamp on creation.
+
+ Appenders=Console Server
+ Loggers=Root
+ Appender.Console=1,5,6
+ Appender.Server=2,4,15,Server.log
+ Logger.Root=0,4,Console Server
+
+Lets trace how system will log two different messages:
+ 1) sLog->outError(LOG_FILTER_GUILD, "Guild 1 created");
+ Performs exactly as example 1.
+ 2) sLog->outInfo(LOG_FILTER_CHARACTER, "Player Name Logged in");
+ System will try to find logger of type CHARACTER, as no logger is
+ configured for CHARACTER it will use Root logger. As message Log Level is
+ equal or higher than the Log level of logger the message is sent to the
+ Appenders configured in the Logger. "Console" and "Server".
+ Console will discard msg as Log Level is not higher or equal to this
+ appender
+ Server will write to file
+ "2012-08-15 INFO [CHARACTER ] Player Name Logged in"
+
+EXAMPLE 3
+As a dev, i may be interested in logging just a particular part of the core
+while i'm trying to fix something. So... i want to debug GUILDS to maximum
+and also some CHARACTER events to some point. Also im checking some Waypoints
+so i want SQLDEV to be logged to file without prefixes. All other messages
+should only be logged to console, GUILD to TRACE and CHARACTER to INFO
+
+ Appenders=Console SQLDev
+ Loggers=Guild Characters SQLDev
+ Appender.Console=1,1
+ Appender.SQLDev=2,2,0,SQLDev.log
+ Logger.Guild=24,1,Console
+ Logger.Characters=34,3,Console
+ Logger.SQLDev=37,3,SQLDev
+
+With this config, any message logger with a Log type different to GUILD,
+CHARACTER or SQLDEV will be ignored, as we didn't define a logger Root and
+system created a default Root disabled. Appender Console, log level should be
+defined to allow all possible messages of its loggers, in this case GUILD uses
+TRACE (1), so Appender should allow it. Logger Characters will limit it's own
+messages to INFO (3)
+
+--- SOME EXTRA COMMENTS ---
+why this system is better than previous one?
+- Can be extended: Anyone can easily create new appenders to log to new
+ systems as syslog or IRC, having all code related to that system in particular
+ files
+- It's asyncronous: Uses threads to write messages, so core performance wont be
+ affected by IO operations
+- Lets us select "What to log" and "Where to log" on the fly. You can log to a
+ dozen of files without having to change a single line of code
diff --git a/sql/base/auth_database.sql b/sql/base/auth_database.sql
index 14aaa4658e9..a052a74c837 100644
--- a/sql/base/auth_database.sql
+++ b/sql/base/auth_database.sql
@@ -143,6 +143,7 @@ CREATE TABLE `logs` (
`time` int(10) unsigned NOT NULL,
`realm` int(10) unsigned NOT NULL,
`type` tinyint(3) unsigned NOT NULL,
+ `level` tinyint(3) unsigned NOT NULL DEFAULT '0',
`string` text CHARACTER SET latin1
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */;
diff --git a/sql/base/characters_database.sql b/sql/base/characters_database.sql
index b4a3af6e8ff..d2ec0a94a2b 100644
--- a/sql/base/characters_database.sql
+++ b/sql/base/characters_database.sql
@@ -1129,7 +1129,7 @@ DROP TABLE IF EXISTS `characters`;
CREATE TABLE `characters` (
`guid` int(10) unsigned NOT NULL DEFAULT '0' COMMENT 'Global Unique Identifier',
`account` int(10) unsigned NOT NULL DEFAULT '0' COMMENT 'Account Identifier',
- `name` varchar(12) NOT NULL DEFAULT '',
+ `name` varchar(12) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL,
`race` tinyint(3) unsigned NOT NULL DEFAULT '0',
`class` tinyint(3) unsigned NOT NULL DEFAULT '0',
`gender` tinyint(3) unsigned NOT NULL DEFAULT '0',
@@ -1177,7 +1177,7 @@ CREATE TABLE `characters` (
`chosenTitle` int(10) unsigned NOT NULL DEFAULT '0',
`knownCurrencies` bigint(20) unsigned NOT NULL DEFAULT '0',
`watchedFaction` int(10) unsigned NOT NULL DEFAULT '0',
- `drunk` smallint(5) unsigned NOT NULL DEFAULT '0',
+ `drunk` tinyint(3) unsigned NOT NULL DEFAULT '0',
`health` int(10) unsigned NOT NULL DEFAULT '0',
`power1` int(10) unsigned NOT NULL DEFAULT '0',
`power2` int(10) unsigned NOT NULL DEFAULT '0',
@@ -2276,4 +2276,4 @@ UNLOCK TABLES;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
--- Dump completed on 2012-03-25 21:14:19
+-- Dump completed on 2012-09-08 15:27:29
diff --git a/sql/updates/characters/2012_06_13_00_characters_character_equipmentsets.sql b/sql/old/3.3.5a/2012_06_13_00_characters_character_equipmentsets.sql
index ebf12062be3..ebf12062be3 100644
--- a/sql/updates/characters/2012_06_13_00_characters_character_equipmentsets.sql
+++ b/sql/old/3.3.5a/2012_06_13_00_characters_character_equipmentsets.sql
diff --git a/sql/updates/world/2012_07_12_00_world_version.sql b/sql/old/3.3.5a/2012_07_12_00_world_version.sql
index ce24fa54614..ce24fa54614 100644
--- a/sql/updates/world/2012_07_12_00_world_version.sql
+++ b/sql/old/3.3.5a/2012_07_12_00_world_version.sql
diff --git a/sql/updates/world/2012_07_13_00_world_spell_proc_event.sql b/sql/old/3.3.5a/2012_07_13_00_world_spell_proc_event.sql
index 952a4502b30..952a4502b30 100644
--- a/sql/updates/world/2012_07_13_00_world_spell_proc_event.sql
+++ b/sql/old/3.3.5a/2012_07_13_00_world_spell_proc_event.sql
diff --git a/sql/updates/world/2012_07_13_00_world_spell_script_names.sql b/sql/old/3.3.5a/2012_07_13_00_world_spell_script_names.sql
index 64500418871..64500418871 100644
--- a/sql/updates/world/2012_07_13_00_world_spell_script_names.sql
+++ b/sql/old/3.3.5a/2012_07_13_00_world_spell_script_names.sql
diff --git a/sql/updates/world/2012_07_14_00_world_creature_loot_template.sql b/sql/old/3.3.5a/2012_07_14_00_world_creature_loot_template.sql
index f76e5519594..f76e5519594 100644
--- a/sql/updates/world/2012_07_14_00_world_creature_loot_template.sql
+++ b/sql/old/3.3.5a/2012_07_14_00_world_creature_loot_template.sql
diff --git a/sql/updates/world/2012_07_14_01_world_creature_loot_template.sql b/sql/old/3.3.5a/2012_07_14_01_world_creature_loot_template.sql
index 1b9c4f4448c..1b9c4f4448c 100644
--- a/sql/updates/world/2012_07_14_01_world_creature_loot_template.sql
+++ b/sql/old/3.3.5a/2012_07_14_01_world_creature_loot_template.sql
diff --git a/sql/updates/world/2012_07_16_00_world_creature_template.sql b/sql/old/3.3.5a/2012_07_16_00_world_creature_template.sql
index 7ce7c546592..7ce7c546592 100644
--- a/sql/updates/world/2012_07_16_00_world_creature_template.sql
+++ b/sql/old/3.3.5a/2012_07_16_00_world_creature_template.sql
diff --git a/sql/updates/world/2012_07_16_01_world_reference_loot_template.sql b/sql/old/3.3.5a/2012_07_16_01_world_reference_loot_template.sql
index e56dff3b0ea..e56dff3b0ea 100644
--- a/sql/updates/world/2012_07_16_01_world_reference_loot_template.sql
+++ b/sql/old/3.3.5a/2012_07_16_01_world_reference_loot_template.sql
diff --git a/sql/updates/world/2012_07_22_00_world_spelldifficulty_dbc.sql b/sql/old/3.3.5a/2012_07_22_00_world_spelldifficulty_dbc.sql
index c90c42692b9..c90c42692b9 100644
--- a/sql/updates/world/2012_07_22_00_world_spelldifficulty_dbc.sql
+++ b/sql/old/3.3.5a/2012_07_22_00_world_spelldifficulty_dbc.sql
diff --git a/sql/updates/world/2012_07_22_01_world_conditions.sql b/sql/old/3.3.5a/2012_07_22_01_world_conditions.sql
index 333ae7f997f..333ae7f997f 100644
--- a/sql/updates/world/2012_07_22_01_world_conditions.sql
+++ b/sql/old/3.3.5a/2012_07_22_01_world_conditions.sql
diff --git a/sql/updates/world/2012_07_22_02_world_creature_loot_template.sql b/sql/old/3.3.5a/2012_07_22_02_world_creature_loot_template.sql
index e4bc61b6fa4..e4bc61b6fa4 100644
--- a/sql/updates/world/2012_07_22_02_world_creature_loot_template.sql
+++ b/sql/old/3.3.5a/2012_07_22_02_world_creature_loot_template.sql
diff --git a/sql/updates/world/2012_07_22_03_world_gossip.sql b/sql/old/3.3.5a/2012_07_22_03_world_gossip.sql
index d1aa7e50747..d1aa7e50747 100644
--- a/sql/updates/world/2012_07_22_03_world_gossip.sql
+++ b/sql/old/3.3.5a/2012_07_22_03_world_gossip.sql
diff --git a/sql/updates/world/2012_07_22_04_world_gossip.sql b/sql/old/3.3.5a/2012_07_22_04_world_gossip.sql
index 0fbf2e7508f..0fbf2e7508f 100644
--- a/sql/updates/world/2012_07_22_04_world_gossip.sql
+++ b/sql/old/3.3.5a/2012_07_22_04_world_gossip.sql
diff --git a/sql/updates/world/2012_07_22_05_world_script_texts.sql b/sql/old/3.3.5a/2012_07_22_05_world_script_texts.sql
index 2ecb1b8f130..2ecb1b8f130 100644
--- a/sql/updates/world/2012_07_22_05_world_script_texts.sql
+++ b/sql/old/3.3.5a/2012_07_22_05_world_script_texts.sql
diff --git a/sql/updates/world/2012_07_22_06_world_gossip.sql b/sql/old/3.3.5a/2012_07_22_06_world_gossip.sql
index 0cb41937d3c..0cb41937d3c 100644
--- a/sql/updates/world/2012_07_22_06_world_gossip.sql
+++ b/sql/old/3.3.5a/2012_07_22_06_world_gossip.sql
diff --git a/sql/updates/world/2012_07_22_07_world_sai.sql b/sql/old/3.3.5a/2012_07_22_07_world_sai.sql
index f8f42ef07da..f8f42ef07da 100644
--- a/sql/updates/world/2012_07_22_07_world_sai.sql
+++ b/sql/old/3.3.5a/2012_07_22_07_world_sai.sql
diff --git a/sql/updates/world/2012_07_22_08_world_sai.sql b/sql/old/3.3.5a/2012_07_22_08_world_sai.sql
index 62b5a95f532..62b5a95f532 100644
--- a/sql/updates/world/2012_07_22_08_world_sai.sql
+++ b/sql/old/3.3.5a/2012_07_22_08_world_sai.sql
diff --git a/sql/updates/world/2012_07_22_09_world_creature_template.sql b/sql/old/3.3.5a/2012_07_22_09_world_creature_template.sql
index 909b4cc238b..909b4cc238b 100644
--- a/sql/updates/world/2012_07_22_09_world_creature_template.sql
+++ b/sql/old/3.3.5a/2012_07_22_09_world_creature_template.sql
diff --git a/sql/updates/world/2012_07_22_10_world_creature_onkill_rep.sql b/sql/old/3.3.5a/2012_07_22_10_world_creature_onkill_rep.sql
index 22d81bca548..22d81bca548 100644
--- a/sql/updates/world/2012_07_22_10_world_creature_onkill_rep.sql
+++ b/sql/old/3.3.5a/2012_07_22_10_world_creature_onkill_rep.sql
diff --git a/sql/updates/world/2012_07_22_11_world_conditions.sql b/sql/old/3.3.5a/2012_07_22_11_world_conditions.sql
index 9ecb28307ba..9ecb28307ba 100644
--- a/sql/updates/world/2012_07_22_11_world_conditions.sql
+++ b/sql/old/3.3.5a/2012_07_22_11_world_conditions.sql
diff --git a/sql/updates/world/2012_07_22_12_world_creature_template.sql b/sql/old/3.3.5a/2012_07_22_12_world_creature_template.sql
index 51e2b36d15d..51e2b36d15d 100644
--- a/sql/updates/world/2012_07_22_12_world_creature_template.sql
+++ b/sql/old/3.3.5a/2012_07_22_12_world_creature_template.sql
diff --git a/sql/updates/world/2012_07_22_13_world_conditions.sql b/sql/old/3.3.5a/2012_07_22_13_world_conditions.sql
index 896257d3f92..896257d3f92 100644
--- a/sql/updates/world/2012_07_22_13_world_conditions.sql
+++ b/sql/old/3.3.5a/2012_07_22_13_world_conditions.sql
diff --git a/sql/updates/world/2012_07_22_14_world_gameobject.sql b/sql/old/3.3.5a/2012_07_22_14_world_gameobject.sql
index bf77d1a625f..bf77d1a625f 100644
--- a/sql/updates/world/2012_07_22_14_world_gameobject.sql
+++ b/sql/old/3.3.5a/2012_07_22_14_world_gameobject.sql
diff --git a/sql/updates/world/2012_07_22_15_world_sai.sql b/sql/old/3.3.5a/2012_07_22_15_world_sai.sql
index 218eb9a3399..218eb9a3399 100644
--- a/sql/updates/world/2012_07_22_15_world_sai.sql
+++ b/sql/old/3.3.5a/2012_07_22_15_world_sai.sql
diff --git a/sql/updates/world/2012_07_29_00_world_factionchange.sql b/sql/old/3.3.5a/2012_07_29_00_world_factionchange.sql
index ca6c36630bc..ca6c36630bc 100644
--- a/sql/updates/world/2012_07_29_00_world_factionchange.sql
+++ b/sql/old/3.3.5a/2012_07_29_00_world_factionchange.sql
diff --git a/sql/updates/world/2012_07_29_01_world_pool_quest.sql b/sql/old/3.3.5a/2012_07_29_01_world_pool_quest.sql
index 0e0f192c8d7..0e0f192c8d7 100644
--- a/sql/updates/world/2012_07_29_01_world_pool_quest.sql
+++ b/sql/old/3.3.5a/2012_07_29_01_world_pool_quest.sql
diff --git a/sql/updates/world/2012_07_29_02_world_sai.sql b/sql/old/3.3.5a/2012_07_29_02_world_sai.sql
index 1a452576139..1a452576139 100644
--- a/sql/updates/world/2012_07_29_02_world_sai.sql
+++ b/sql/old/3.3.5a/2012_07_29_02_world_sai.sql
diff --git a/sql/updates/world/2012_07_29_03_world_sai.sql b/sql/old/3.3.5a/2012_07_29_03_world_sai.sql
index d8ca1b12390..d8ca1b12390 100644
--- a/sql/updates/world/2012_07_29_03_world_sai.sql
+++ b/sql/old/3.3.5a/2012_07_29_03_world_sai.sql
diff --git a/sql/updates/world/2012_07_29_04_world_sai.sql b/sql/old/3.3.5a/2012_07_29_04_world_sai.sql
index ef46c72f42c..ef46c72f42c 100644
--- a/sql/updates/world/2012_07_29_04_world_sai.sql
+++ b/sql/old/3.3.5a/2012_07_29_04_world_sai.sql
diff --git a/sql/updates/world/2012_07_29_05_world_sai.sql b/sql/old/3.3.5a/2012_07_29_05_world_sai.sql
index e1fd032eaca..e1fd032eaca 100644
--- a/sql/updates/world/2012_07_29_05_world_sai.sql
+++ b/sql/old/3.3.5a/2012_07_29_05_world_sai.sql
diff --git a/sql/updates/world/2012_07_29_06_world_sai.sql b/sql/old/3.3.5a/2012_07_29_06_world_sai.sql
index 03ebdfc6d0a..03ebdfc6d0a 100644
--- a/sql/updates/world/2012_07_29_06_world_sai.sql
+++ b/sql/old/3.3.5a/2012_07_29_06_world_sai.sql
diff --git a/sql/updates/world/2012_07_29_07_world_sai.sql b/sql/old/3.3.5a/2012_07_29_07_world_sai.sql
index 18de6d15c0a..18de6d15c0a 100644
--- a/sql/updates/world/2012_07_29_07_world_sai.sql
+++ b/sql/old/3.3.5a/2012_07_29_07_world_sai.sql
diff --git a/sql/updates/world/2012_07_29_08_world_sai.sql b/sql/old/3.3.5a/2012_07_29_08_world_sai.sql
index 796578d3f00..796578d3f00 100644
--- a/sql/updates/world/2012_07_29_08_world_sai.sql
+++ b/sql/old/3.3.5a/2012_07_29_08_world_sai.sql
diff --git a/sql/updates/world/2012_07_29_09_world_gossip_menu_option.sql b/sql/old/3.3.5a/2012_07_29_09_world_gossip_menu_option.sql
index 66474bdb5e4..66474bdb5e4 100644
--- a/sql/updates/world/2012_07_29_09_world_gossip_menu_option.sql
+++ b/sql/old/3.3.5a/2012_07_29_09_world_gossip_menu_option.sql
diff --git a/sql/updates/world/2012_07_29_10_world_sai.sql b/sql/old/3.3.5a/2012_07_29_10_world_sai.sql
index c5513bf2f25..c5513bf2f25 100644
--- a/sql/updates/world/2012_07_29_10_world_sai.sql
+++ b/sql/old/3.3.5a/2012_07_29_10_world_sai.sql
diff --git a/sql/updates/world/2012_08_01_00_world_sai.sql b/sql/old/3.3.5a/2012_08_01_00_world_sai.sql
index bf214cbfa9c..bf214cbfa9c 100644
--- a/sql/updates/world/2012_08_01_00_world_sai.sql
+++ b/sql/old/3.3.5a/2012_08_01_00_world_sai.sql
diff --git a/sql/updates/world/2012_08_01_01_world_creature.sql b/sql/old/3.3.5a/2012_08_01_01_world_creature.sql
index 875a956fbd1..875a956fbd1 100644
--- a/sql/updates/world/2012_08_01_01_world_creature.sql
+++ b/sql/old/3.3.5a/2012_08_01_01_world_creature.sql
diff --git a/sql/updates/world/2012_08_01_02_world_loot.sql b/sql/old/3.3.5a/2012_08_01_02_world_loot.sql
index a27bd274acf..a27bd274acf 100644
--- a/sql/updates/world/2012_08_01_02_world_loot.sql
+++ b/sql/old/3.3.5a/2012_08_01_02_world_loot.sql
diff --git a/sql/updates/world/2012_08_02_00_world_spell_script_names.sql b/sql/old/3.3.5a/2012_08_02_00_world_spell_script_names.sql
index f14e44e35ff..f14e44e35ff 100644
--- a/sql/updates/world/2012_08_02_00_world_spell_script_names.sql
+++ b/sql/old/3.3.5a/2012_08_02_00_world_spell_script_names.sql
diff --git a/sql/old/3.3.5a/2012_08_04_00_world_disables.sql b/sql/old/3.3.5a/2012_08_04_00_world_disables.sql
new file mode 100644
index 00000000000..f3f197ba23a
--- /dev/null
+++ b/sql/old/3.3.5a/2012_08_04_00_world_disables.sql
@@ -0,0 +1,219 @@
+DELETE FROM `disables` WHERE `sourceType`=1 AND `entry` IN (73,108,241,242,259,326,327,352,390,406,462,490,497,534,548,612,636,740,774,796,797,798,799,800,801,802,803,810,811,814,820,839,856,859,904,946,987,988,989,1128,1129,1155,1156,1157,1158,1161,1162,1163,1165,1263,1272,1277,1278,1279,1280,1281,1283,1289,1290,1291,1292,1293,1294,1295,1296,1297,1298,1299,1300,1390,1397,1441,1443,1460,1461,1533,1537,1538,1659,1660,1662,1663,1664,2020,2971,3023,3064,3241,3383,3401,3403,3404,3405,3422,3423,3424,3425,3515,3516,3529,3530,3531,3622,3623,3624,3885,3910,4323,4541,4905,5053,5205,5207,5208,5209,5303,5304,5506,5512,5516,5520,5523,5532,5653,5659,5664,5665,5666,5667,5668,5669,5670,5671,5681,5682,5683,5684,5685,5686,5687,5688,5689,5690,5691,5692,5693,5694,5695,5696,5697,5698,5699,5700,5701,5702,5703,5704,5705,5706,5707,5708,5709,5710,5711,5712,6003,6165,6202,6702,6703,6704,6705,6706,6707,6708,6709,6710,6711,6841,6842,7069,7904,8002,8244,8245,8247,8248,8337,8339,8340,8444,8445,8448,8449,8450,8451,8452,8453,8454,8458,8459,8571,9031,9306,9307,9445,9596,9597,9599,9679,9745,10370,10402,10616,10743,10890,11127);
+INSERT INTO `disables` (`sourceType`,`entry`,`flags`,`params_0`,`params_1`,`comment`) VALUES
+(1,73,0,'','','Deprecated quest: <TXT> No Reward'),
+(1,108,0,'','','Deprecated quest: <TXT> Mystery Reward'),
+(1,241,0,'','','Deprecated quest: <TEST> HEY MISTER WILSON!'),
+(1,242,0,'','','Deprecated quest: <UNUSED>'),
+(1,259,0,'','','Deprecated quest: <UNUSED>'),
+(1,326,0,'','','Deprecated quest: <UNUSED>'),
+(1,327,0,'','','Deprecated quest: <UNUSED>'),
+(1,352,0,'','','Deprecated quest: <UNUSED>'),
+(1,390,0,'','','Deprecated quest: <UNUSED>'),
+(1,406,0,'','','Deprecated quest: <UNUSED>'),
+(1,462,0,'','','Deprecated quest: <UNUSED>'),
+(1,490,0,'','','Deprecated quest: <UNUSED>'),
+(1,497,0,'','','Deprecated quest: <UNUSED>'),
+(1,534,0,'','','Deprecated quest: <UNUSED>'),
+(1,548,0,'','','Deprecated quest: <NYI> <TXT> Bloodstone Pendant'),
+(1,612,0,'','','Deprecated quest: <UNUSED>'),
+(1,636,0,'','','Deprecated quest: Legends of the Earth <NYI>'),
+(1,740,0,'','','Deprecated quest: <UNUSED>'),
+(1,774,0,'','','Deprecated quest: <UNUSED>'),
+(1,796,0,'','','Deprecated quest: <UNUSED>'),
+(1,797,0,'','','Deprecated quest: <UNUSED>'),
+(1,798,0,'','','Deprecated quest: <UNUSED>'),
+(1,799,0,'','','Deprecated quest: <UNUSED>'),
+(1,800,0,'','','Deprecated quest: <UNUSED>'),
+(1,801,0,'','','Deprecated quest: <UNUSED>'),
+(1,802,0,'','','Deprecated quest: <UNUSED>'),
+(1,803,0,'','','Deprecated quest: <UNUSED>'),
+(1,810,0,'','','Deprecated quest: <UNUSED>'),
+(1,811,0,'','','Deprecated quest: <UNUSED>'),
+(1,814,0,'','','Deprecated quest: <UNUSED>'),
+(1,820,0,'','','Deprecated quest: <UNUSED>'),
+(1,839,0,'','','Deprecated quest: <UNUSED>'),
+(1,856,0,'','','Deprecated quest: <UNUSED>'),
+(1,859,0,'','','Deprecated quest: <UNUSED>'),
+(1,904,0,'','','Deprecated quest: <UNUSED>'),
+(1,946,0,'','','Deprecated quest: <UNUSED>'),
+(1,987,0,'','','Deprecated quest: <UNUSED>'),
+(1,988,0,'','','Deprecated quest: <UNUSED>'),
+(1,989,0,'','','Deprecated quest: <UNUSED>'),
+(1,1128,0,'','','Deprecated quest: <NYI> The Gnome Pit Crew is Thirsty'),
+(1,1129,0,'','','Deprecated quest: <NYI> The Goblin Pit Crew is Thirsty'),
+(1,1155,0,'','','Deprecated quest: <NYI> <TXT> bug crystal side quest'),
+(1,1156,0,'','','Deprecated quest: <NYI> <TXT> speak to alchemist pestlezugg'),
+(1,1157,0,'','','Deprecated quest: <NYI> <TXT> pestlezugg needs items'),
+(1,1158,0,'','','Deprecated quest: <NYI> <TXT> speak to rabine saturna'),
+(1,1161,0,'','','Deprecated quest: <NYI> <TXT> gossip shade of ambermoon'),
+(1,1162,0,'','','Deprecated quest: <NYI> <TXT> speak to hamuul runetotem'),
+(1,1163,0,'','','Deprecated quest: <NYI> <TXT> speak to tyrande whisperwind'),
+(1,1165,0,'','','Deprecated quest: <NYI> Ore for the Races'),
+(1,1263,0,'','','Deprecated quest: The Burning Inn <CHANGE TO GOSSIP>'),
+(1,1272,0,'','','Deprecated quest: Finding Reethe <CHANGE INTO GOSSIP>'),
+(1,1277,0,'','','Deprecated quest: <nyi> <TXT> The Centaur Hoofprints'),
+(1,1278,0,'','','Deprecated quest: <nyi> <TXT> The Grim Totem Clan'),
+(1,1279,0,'','','Deprecated quest: <nyi> <TXT>The Centaur Hoofprints'),
+(1,1280,0,'','','Deprecated quest: <nyi> <TXT>The Centaur Hoofprints'),
+(1,1281,0,'','','Deprecated quest: Jim''s Song <CHANGE TO GOSSIP>'),
+(1,1283,0,'','','Deprecated quest: Fire at the Shady Rest <CHANGE TO GOSSIP>'),
+(1,1289,0,'','','Deprecated quest: <nyi> Vimes''s Report'),
+(1,1290,0,'','','Deprecated quest: <nyi> Investigating Mosarn'),
+(1,1291,0,'','','Deprecated quest: <nyi> <TXT> Centaur Hoofprints'),
+(1,1292,0,'','','Deprecated quest: <nyi><TXT> Centaur Hoofprints'),
+(1,1293,0,'','','Deprecated quest: <nyi> <TXT> Centaur Hoofprints'),
+(1,1294,0,'','','Deprecated quest: <nyi> <TXT>Centaur Sympathies'),
+(1,1295,0,'','','Deprecated quest: <nyi> <TXT> Course of Action'),
+(1,1296,0,'','','Deprecated quest: <nyi> <TXT> Course of Action'),
+(1,1297,0,'','','Deprecated quest: <nyi> <TXT> Course of Action'),
+(1,1298,0,'','','Deprecated quest: <nyi> <TXT> Thrall''s Dirty Work'),
+(1,1299,0,'','','Deprecated quest: <nyi> <TXT> Thrall''s Dirty Work'),
+(1,1300,0,'','','Deprecated quest: <nyi> <TXT> Lorn Grim Totem'),
+(1,1390,0,'','','Deprecated quest: <nyi> Oops, We Killed Them Again.'),
+(1,1397,0,'','','Deprecated quest: <nyi> Saved!'),
+(1,1441,0,'','','Deprecated quest: <UNUSED>'),
+(1,1443,0,'','','Deprecated quest: <nyi> The Shakedown'),
+(1,1460,0,'','','Deprecated quest: <UNUSED>'),
+(1,1461,0,'','','Deprecated quest: <UNUSED>'),
+(1,1533,0,'','','Deprecated quest: <NYI> Call of Air'),
+(1,1537,0,'','','Deprecated quest: <NYI> Call of Air'),
+(1,1538,0,'','','Deprecated quest: <NYI> Call of Air'),
+(1,1659,0,'','','Deprecated quest: <UNUSED>'),
+(1,1660,0,'','','Deprecated quest: <UNUSED>'),
+(1,1662,0,'','','Deprecated quest: <UNUSED>'),
+(1,1663,0,'','','Deprecated quest: <UNUSED>'),
+(1,1664,0,'','','Deprecated quest: <UNUSED>'),
+(1,2020,0,'','','Deprecated quest: <UNUSED>'),
+(1,2971,0,'','','Deprecated quest: <UNUSED>'),
+(1,3023,0,'','','Deprecated quest: <UNUSED>'),
+(1,3064,0,'','','Deprecated quest: <NYI> <TXT> Pirate Hats'),
+(1,3241,0,'','','Deprecated quest: <NYI> <TXT><redux> Dreadmist Peak'),
+(1,3383,0,'','','Deprecated quest: <UNUSED>'),
+(1,3401,0,'','','Deprecated quest: <UNUSED>'),
+(1,3403,0,'','','Deprecated quest: <UNUSED>'),
+(1,3404,0,'','','Deprecated quest: <UNUSED>'),
+(1,3405,0,'','','Deprecated quest: <UNUSED>'),
+(1,3422,0,'','','Deprecated quest: <UNUSED>'),
+(1,3423,0,'','','Deprecated quest: <UNUSED>'),
+(1,3424,0,'','','Deprecated quest: <UNUSED>'),
+(1,3425,0,'','','Deprecated quest: <UNUSED>'),
+(1,3515,0,'','','Deprecated quest: <UNUSED>'),
+(1,3516,0,'','','Deprecated quest: <UNUSED>'),
+(1,3529,0,'','','Deprecated quest: <UNUSED>'),
+(1,3530,0,'','','Deprecated quest: <UNUSED>'),
+(1,3531,0,'','','Deprecated quest: <UNUSED>'),
+(1,3622,0,'','','Deprecated quest: <UNUSED>'),
+(1,3623,0,'','','Deprecated quest: <UNUSED>'),
+(1,3624,0,'','','Deprecated quest: <UNUSED>'),
+(1,3885,0,'','','Deprecated quest: <NYI> <TXT> The Gadgetzan Run'),
+(1,3910,0,'','','Deprecated quest: <NYI> <TXT> The Un''Goro Run'),
+(1,4323,0,'','','Deprecated quest: <NYI> <TXT> Get those Hyenas!!!'),
+(1,4541,0,'','','Deprecated quest: <NYI> <TXT>'),
+(1,4905,0,'','','Deprecated quest: <UNUSED>'),
+(1,5053,0,'','','Deprecated quest: <UNUSED>'),
+(1,5205,0,'','','Deprecated quest: <UNUSED>'),
+(1,5207,0,'','','Deprecated quest: <NYI> <TXT> The True Summoner'),
+(1,5208,0,'','','Deprecated quest: <NYI> <TXT> The Blessing of Evil'),
+(1,5209,0,'','','Deprecated quest: <UNUSED>'),
+(1,5303,0,'','','Deprecated quest: <UNUSED>'),
+(1,5304,0,'','','Deprecated quest: <UNUSED>'),
+(1,5506,0,'','','Deprecated quest: <UNUSED>'),
+(1,5512,0,'','','Deprecated quest: <UNUSED>'),
+(1,5516,0,'','','Deprecated quest: <UNUSED>'),
+(1,5520,0,'','','Deprecated quest: <UNUSED>'),
+(1,5523,0,'','','Deprecated quest: <UNUSED>'),
+(1,5532,0,'','','Deprecated quest: <NYI> <TXT> Ring of the Dawn'),
+(1,5653,0,'','','Deprecated quest: <NYI> Hex of Weakness'),
+(1,5659,0,'','','Deprecated quest: <NYI> Touch of Weakness'),
+(1,5664,0,'','','Deprecated quest: <UNUSED>'),
+(1,5665,0,'','','Deprecated quest: <UNUSED>'),
+(1,5666,0,'','','Deprecated quest: <UNUSED>'),
+(1,5667,0,'','','Deprecated quest: <UNUSED>'),
+(1,5668,0,'','','Deprecated quest: <NYI> A Blessing of Light'),
+(1,5669,0,'','','Deprecated quest: <NYI> A Blessing of Light'),
+(1,5670,0,'','','Deprecated quest: <NYI> A Blessing of Light'),
+(1,5671,0,'','','Deprecated quest: <NYI> A Blessing of Light'),
+(1,5681,0,'','','Deprecated quest: <UNUSED>'),
+(1,5682,0,'','','Deprecated quest: <UNUSED>'),
+(1,5683,0,'','','Deprecated quest: <UNUSED>'),
+(1,5684,0,'','','Deprecated quest: <UNUSED>'),
+(1,5685,0,'','','Deprecated quest: <NYI> <TXT> The Light Protects You'),
+(1,5686,0,'','','Deprecated quest: <NYI> The Light Protects You'),
+(1,5687,0,'','','Deprecated quest: <NYI> The Light Protects You'),
+(1,5688,0,'','','Deprecated quest: <NYI> <TXT> A Touch of Voodoo'),
+(1,5689,0,'','','Deprecated quest: <NYI> A Touch of Voodoo'),
+(1,5690,0,'','','Deprecated quest: <NYI> <TXT> A Touch of Voodoo'),
+(1,5691,0,'','','Deprecated quest: <NYI> <TXT> In the Dark it was Created'),
+(1,5692,0,'','','Deprecated quest: <NYI> In the Dark It was Created'),
+(1,5693,0,'','','Deprecated quest: <NYI> In the Dark It was Created'),
+(1,5694,0,'','','Deprecated quest: <UNUSED>'),
+(1,5695,0,'','','Deprecated quest: <UNUSED>'),
+(1,5696,0,'','','Deprecated quest: <UNUSED>'),
+(1,5697,0,'','','Deprecated quest: <UNUSED>'),
+(1,5698,0,'','','Deprecated quest: <NYI> <TXT> A Small Amount of Hope'),
+(1,5699,0,'','','Deprecated quest: <NYI> A Small Amount of Hope'),
+(1,5700,0,'','','Deprecated quest: <NYI> A Small Amount of Hope'),
+(1,5701,0,'','','Deprecated quest: <NYI> <TXT> The Rites of Old'),
+(1,5702,0,'','','Deprecated quest: <NYI> The Rites of Old'),
+(1,5703,0,'','','Deprecated quest: <NYI> The Rites of Old'),
+(1,5704,0,'','','Deprecated quest: <NYI> <TXT> Undead Priest Robe'),
+(1,5705,0,'','','Deprecated quest: <NYI> No Longer a Shadow'),
+(1,5706,0,'','','Deprecated quest: <NYI> No Longer a Shadow'),
+(1,5707,0,'','','Deprecated quest: <NYI> <TXT> Flirting With Darkness'),
+(1,5708,0,'','','Deprecated quest: <NYI> Flirting With Darkness'),
+(1,5709,0,'','','Deprecated quest: <NYI> Flirting With Darkness'),
+(1,5710,0,'','','Deprecated quest: <NYI> <TXT> Troll Priest Robe'),
+(1,5711,0,'','','Deprecated quest: <NYI> The Lost Ways'),
+(1,5712,0,'','','Deprecated quest: <NYI> The Lost Ways'),
+(1,6003,0,'','','Deprecated quest: <nyi> <txt> Green With Envy'),
+(1,6165,0,'','','Deprecated quest: <NYI> <TXT> Archmage Timolain''s Remains'),
+(1,6202,0,'','','Deprecated quest: <UNUSED> Good and Evil'),
+(1,6702,0,'','','Deprecated quest: <TXT> SF,RFK,GNOMER,BF'),
+(1,6703,0,'','','Deprecated quest: <TXT> SF,RFK,GNOMER,BF - Repeatable'),
+(1,6704,0,'','','Deprecated quest: <TXT> SM,RFD,ULD'),
+(1,6705,0,'','','Deprecated quest: <TXT> SM,RFD,ULD - Repeatable'),
+(1,6706,0,'','','Deprecated quest: <TXT> ZUL,ST,MAR'),
+(1,6707,0,'','','Deprecated quest: <TXT> ZUL,ST,MAR - Repeatable'),
+(1,6708,0,'','','Deprecated quest: <TXT> BRD,DM,BRS'),
+(1,6709,0,'','','Deprecated quest: <TXT> BRD,DM,BRS - Repeatable'),
+(1,6710,0,'','','Deprecated quest: <TXT> UBRS,STRATH,SCHOL'),
+(1,6711,0,'','','Deprecated quest: <TXT> UBRS,STRATH,SCHOL - Repeatable'),
+(1,6841,0,'','','Deprecated quest: <UNUSED>'),
+(1,6842,0,'','','Deprecated quest: <UNUSED>'),
+(1,7069,0,'','','Deprecated quest: <UNUSED>'),
+(1,7904,0,'','','Deprecated quest: <UNUSED>'),
+(1,8002,0,'','','Deprecated quest: Silverwing Sentinels <NYI> <TXT>'),
+(1,8244,0,'','','Deprecated quest: <UNUSED>'),
+(1,8245,0,'','','Deprecated quest: <UNUSED>'),
+(1,8247,0,'','','Deprecated quest: <UNUSED>'),
+(1,8248,0,'','','Deprecated quest: <UNUSED>'),
+(1,8337,0,'','','Deprecated quest: <UNUSED>'),
+(1,8339,0,'','','Deprecated quest: Royalty of the Council <NYI> <TXT> UNUSED'),
+(1,8340,0,'','','Deprecated quest: Twilight Signet Ring <NYI> <TXT>'),
+(1,8444,0,'','','Deprecated quest: <NYI> <TXT> gossip shade of ambermoon'),
+(1,8445,0,'','','Deprecated quest: <NYI> <TXT> gossip shade of ambermoon'),
+(1,8448,0,'','','Deprecated quest: <TXT> Mystery Reward'),
+(1,8449,0,'','','Deprecated quest: <TXT> Mystery Reward'),
+(1,8450,0,'','','Deprecated quest: <TXT> Mystery Reward'),
+(1,8451,0,'','','Deprecated quest: <TXT> Mystery Reward'),
+(1,8452,0,'','','Deprecated quest: <TXT> Mystery Reward'),
+(1,8453,0,'','','Deprecated quest: <TXT> Mystery Reward'),
+(1,8454,0,'','','Deprecated quest: <TXT> Mystery Reward'),
+(1,8458,0,'','','Deprecated quest: <UNUSED>'),
+(1,8459,0,'','','Deprecated quest: <UNUSED>'),
+(1,8571,0,'','','Deprecated quest: <UNUSED> Armor Kits'),
+(1,9031,0,'','','Deprecated quest: <TXT>Anthion''s Parting Words'),
+(1,9306,0,'','','Deprecated quest: <DEPRECATED>Speak with Vindicator Aldar'),
+(1,9307,0,'','','Deprecated quest: <DEPRECATED>Compassion'),
+(1,9445,0,'','','Deprecated quest: <NYI><TXT>Placeholder: A Worthy Offering'),
+(1,9596,0,'','','Deprecated quest: <DEPRECATED>Control'),
+(1,9597,0,'','','Deprecated quest: <UNUSED>'),
+(1,9599,0,'','','Deprecated quest: <UNUSED>'),
+(1,9679,0,'','','Deprecated quest: <NYI>Return to Knight-Lord Bloodvalor'),
+(1,9745,0,'','','Deprecated quest: <DEPRECATED>Suppressing the Flame'),
+(1,10370,0,'','','Deprecated quest: Nazgrel''s Command <TXT>'),
+(1,10402,0,'','','Deprecated quest: <TXT>'),
+(1,10616,0,'','','Deprecated quest: <nyi>Breadcrumb'),
+(1,10743,0,'','','Deprecated quest: [DEPRECATED]<txt>Hero of the Mok''Nathal'),
+(1,10890,0,'','','Deprecated quest: [UNUSED] <NYI> '),
+(1,11127,0,'','','Deprecated quest: <NYI>Thunderbrew Secrets');
diff --git a/sql/old/3.3.5a/2012_08_04_01_world_disables.sql b/sql/old/3.3.5a/2012_08_04_01_world_disables.sql
new file mode 100644
index 00000000000..ca9f62564d5
--- /dev/null
+++ b/sql/old/3.3.5a/2012_08_04_01_world_disables.sql
@@ -0,0 +1,50 @@
+DELETE FROM `disables` WHERE `sourceType`=1 AND `entry` IN (3631,4487,4488,4489,4490,4183,4184,4185,4186,4223,4224,402,550,620,785,908,909,9662,11179,11461,12087,12103,12108,12156,12426,12682,12764,12765,24222,24227,10452,10453,11125,11179,11437,11438,11444,11445,11974,12179,12228,12233,12590,14119,14147,14148,14149,14150);
+INSERT INTO `disables` (`sourceType`,`entry`,`flags`,`params_0`,`params_1`,`comment`) VALUES
+(1, 402,0,'','','Deprecated quest: Sirra is Busy'),
+(1, 550,0,'','','Deprecated quest: Battle of Hillsbrad'),
+(1, 620,0,'','','Deprecated quest: The Monogrammed Sash'),
+(1, 785,0,'','','Deprecated quest: A Strategic Alliance'),
+(1, 908,0,'','','Deprecated quest: A Strategic Alliance'),
+(1, 909,0,'','','Deprecated quest: A Strategic Alliance'),
+(1,3631,0,'','','Deprecated quest: Summon Felsteed'),
+(1,4487,0,'','','Deprecated quest: Summon Felsteed'),
+(1,4488,0,'','','Deprecated quest: Summon Felsteed'),
+(1,4489,0,'','','Deprecated quest: Summon Felsteed'),
+(1,4490,0,'','','Deprecated quest: Summon Felsteed'),
+(1,4183,0,'','','Deprecated quest: The True Masters'),
+(1,4184,0,'','','Deprecated quest: The True Masters'),
+(1,4185,0,'','','Deprecated quest: The True Masters'),
+(1,4186,0,'','','Deprecated quest: The True Masters'),
+(1,4223,0,'','','Deprecated quest: The True Masters'),
+(1,4224,0,'','','Deprecated quest: The True Masters'),
+-- some random ones:
+(1, 9662,0,'','','Deprecated quest:Deprecated: Keanna''s Freedom'),
+(1,11179,0,'','','Deprecated quest:[Temporarily Deprecated Awaiting a New Mob]Finlay Is Gutless'),
+(1,11461,0,'','','Deprecated quest:DEPRECATED'),
+(1,12087,0,'','','Deprecated quest:A Little Help Here? DEPRECATED'),
+(1,12103,0,'','','Deprecated quest:DEPRECATED'),
+(1,12108,0,'','','Deprecated quest:DEPRECATED'),
+(1,12156,0,'','','Deprecated quest:DEPRECAED'),
+(1,12426,0,'','','Deprecated quest:DEPRECATED'),
+(1,12682,0,'','','Deprecated quest:Uncharted Territory (DEPRECATED)'),
+(1,12764,0,'','','Deprecated quest:The Secret to Kungaloosh (DEPRECATED)'),
+(1,12765,0,'','','Deprecated quest:Kungaloosh (DEPRECATED)'),
+(1,24222,0,'','','Deprecated quest:Call to Arms: Eye of the Storm DEPRECATED'),
+(1,24227,0,'','','Deprecated quest:DEPRECATED'),
+(1,10452,0,'','','Deprecated quest:DON''T USE [PH] Fel Orc 1'),
+(1,10453,0,'','','Deprecated quest:DON''T USE [PH] Fel Orc bread'),
+(1,11125,0,'','','Deprecated quest:[PH] New Hinterlands Quest'),
+(1,11437,0,'','','Deprecated quest:[PH] Beer Garden A'),
+(1,11438,0,'','','Deprecated quest:[PH] Beer Garden B'),
+(1,11444,0,'','','Deprecated quest:[PH] Beer Garden A'),
+(1,11445,0,'','','Deprecated quest:[PH] Beer Garden B'),
+(1,11974,0,'','','Deprecated quest:[ph] Now, When I Grow Up...'),
+(1,12179,0,'','','Deprecated quest:Specialization 1 [PH]'),
+(1,12228,0,'','','Deprecated quest:Reacquiring the Magic [PH]'),
+(1,12233,0,'','','Deprecated quest:[Depricated]Sewing Your Seed'),
+(1,12590,0,'','','Deprecated quest:Blahblah[PH]'),
+(1,14119,0,'','','Deprecated quest:Blank [PH]'),
+(1,14147,0,'','','Deprecated quest:Blank [PH]'),
+(1,14148,0,'','','Deprecated quest:Blank [PH]'),
+(1,14149,0,'','','Deprecated quest:Blank [PH]'),
+(1,14150,0,'','','Deprecated quest:Blank [PH]');
diff --git a/sql/old/3.3.5a/2012_08_04_02_world_disables.sql b/sql/old/3.3.5a/2012_08_04_02_world_disables.sql
new file mode 100644
index 00000000000..cccc7141d68
--- /dev/null
+++ b/sql/old/3.3.5a/2012_08_04_02_world_disables.sql
@@ -0,0 +1,23 @@
+DELETE FROM `disables` WHERE `sourceType`=1 AND `entry` IN (7790,8152,8237,8971,8972,8973,8974,8975,8976,9296,9750,10145,10207,10549,11493,11588,11589,11997,12313,13840,24797);
+INSERT INTO `disables` (`sourceType`,`entry`,`flags`,`params_0`,`params_1`,`comment`) VALUES
+(1,7790,0,'','','Deprecated quest: REUSE'),
+(1,8152,0,'','','Deprecated quest: REUSE'),
+(1,8237,0,'','','Deprecated quest: REUSE'),
+(1,8971,0,'','','Deprecated quest: REUSE'),
+(1,8972,0,'','','Deprecated quest: REUSE'),
+(1,8973,0,'','','Deprecated quest: REUSE'),
+(1,8974,0,'','','Deprecated quest: REUSE'),
+(1,8975,0,'','','Deprecated quest: REUSE'),
+(1,8976,0,'','','Deprecated quest: REUSE'),
+(1,9296,0,'','','Deprecated quest: reuse'),
+(1,9750,0,'','','Deprecated quest: UNUSED Urgent Delivery'),
+(1,10145,0,'','','Deprecated quest: Mission: Sever the Tie UNUSED'),
+(1,10207,0,'','','Deprecated quest: Forward Base: Reaver''s Fall REUSE'),
+(1,10549,0,'','','Deprecated quest: REUSE'),
+(1,11493,0,'','','Deprecated quest: UNUSED'),
+(1,11588,0,'','','Deprecated quest: REUSE'),
+(1,11589,0,'','','Deprecated quest: REUSE'),
+(1,11997,0,'','','Deprecated quest: REUSE'),
+(1,12313,0,'','','Deprecated quest: UNUSED Save Brewfest!'),
+(1,13840,0,'','','Deprecated quest: REUSE'),
+(1,24797,0,'','','Deprecated quest: REUSE');
diff --git a/sql/old/3.3.5a/2012_08_04_03_world_disables.sql b/sql/old/3.3.5a/2012_08_04_03_world_disables.sql
new file mode 100644
index 00000000000..e2d1ca1ff6b
--- /dev/null
+++ b/sql/old/3.3.5a/2012_08_04_03_world_disables.sql
@@ -0,0 +1,38 @@
+DELETE FROM `disables` WHERE `sourceType`=1 AND `entry` IN (9754,9755,10215,11522,12445,12731,12923,13541,7797,7869,7870,7906,9378,9611,9880,9881,9908,9909,9949,9950,10088,10181,10214,10454,11197,11226,11577,11874,11937,12485,12600,13123,13210,13317,13990);
+INSERT INTO `disables` (`sourceType`,`entry`,`flags`,`params_0`,`params_1`,`comment`) VALUES
+(1,9754,0,'','','Deprecated quest: '),
+(1,9755,0,'','','Deprecated quest: '),
+(1,10215,0,'','','Deprecated quest: '),
+(1,11522,0,'','','Deprecated quest: '),
+(1,12445,0,'','','Deprecated quest: '),
+(1,12731,0,'','','Deprecated quest: '),
+(1,12923,0,'','','Deprecated quest: '),
+(1,13541,0,'','','Deprecated quest: '),
+-- some others that contain a -
+(1,7797,0,'','','Deprecated quest: Dimensional Ripper - Everlook'),
+(1,7869,0,'','','Deprecated quest: test quest - do not use'),
+(1,7870,0,'','','Deprecated quest: test quest2 - do not use'),
+(1,7906,0,'','','Deprecated quest: Darkmoon Cards - Beasts'),
+(1,9378,0,'','','Deprecated quest: DND FLAG The Dread Citadel - Naxxramas'),
+(1,9611,0,'','','Deprecated quest: Azuremyst: aa - A - Quest Flag 000'),
+(1,9880,0,'','','Deprecated quest: Hellfire Penninsula: -pn - A - ToWoW - Hellfire Turnin Cap'),
+(1,9881,0,'','','Deprecated quest: Hellfire Penninsula: -pn - H - ToWoW - Hellfire Turnin Cap'),
+(1,9908,0,'','','Deprecated quest: Hellfire Penninsula: -pn - A - ToWoW - Hellfire Turnin'),
+(1,9909,0,'','','Deprecated quest: Hellfire Penninsula: -pn - H - ToWoW - Hellfire Turnin'),
+(1,9949,0,'','','Deprecated quest: A Bird''s-Eye View'),
+(1,9950,0,'','','Deprecated quest: A Bird''s-Eye View'),
+(1,10088,0,'','','Deprecated quest: When This Mine''s a-Rockin'''),
+(1,10181,0,'','','Deprecated quest: Collector''s Edition: -pn - E - FLAG'),
+(1,10214,0,'','','Deprecated quest: When This Mine''s a-Rockin'''),
+(1,10454,0,'','','Deprecated quest: FLAG - OFF THE RAILS'),
+(1,11197,0,'','','Deprecated quest: ZZOLD Upper Deck Promo - Ghost Wolf Mount OLD'),
+(1,11226,0,'','','Deprecated quest: Upper Deck Promo - Spectral Tiger Mount'),
+(1,11577,0,'','','Deprecated quest: WoW Collector''s Edition: - DEM - E - FLAG'),
+(1,11874,0,'','','Deprecated quest: Upper Deck Promo - Rocket Mount'),
+(1,11937,0,'','','Deprecated quest: FLAG - all torch return quests are complete'),
+(1,12485,0,'','','Deprecated quest: Howling Fjord: aa - A - LK FLAG'),
+(1,12600,0,'','','Deprecated quest: Upper Deck Promo - Bear Mount'),
+(1,13123,0,'','','Deprecated quest: WotLK Collector''s Edition: - DEM - E - FLAG'),
+(1,13210,0,'','','Deprecated quest: Blizzard Account: - DEM - E - FLAG'),
+(1,13317,0,'','','Deprecated quest: ----'),
+(1,13990,0,'','','Deprecated quest: Upper Deck Promo - Chicken Mount');
diff --git a/sql/old/3.3.5a/2012_08_04_04_world_disables.sql b/sql/old/3.3.5a/2012_08_04_04_world_disables.sql
new file mode 100644
index 00000000000..14a0d6f94aa
--- /dev/null
+++ b/sql/old/3.3.5a/2012_08_04_04_world_disables.sql
@@ -0,0 +1,34 @@
+DELETE FROM `disables` WHERE `sourceType`=1 AND `entry` IN (11335,11336,11337,11338,11339,11340,11341,11342,13405,13407,13427,13428,14163,14164,14178,14179,14180,14181,14182,14183,24216,24217,24218,24219,24220,24221,24223,24224,24225,24226,24426,24427);
+INSERT INTO `disables` (`sourceType`,`entry`,`flags`,`params_0`,`params_1`,`comment`) VALUES
+(1,11335,0,'','','Deprecated quest: Call to Arms: Arathi Basin'),
+(1,11336,0,'','','Deprecated quest: Call to Arms: Alterac Valley'),
+(1,11337,0,'','','Deprecated quest: Call to Arms: Eye of the Storm'),
+(1,11338,0,'','','Deprecated quest: Call to Arms: Warsong Gulch'),
+(1,11339,0,'','','Deprecated quest: Call to Arms: Arathi Basin'),
+(1,11340,0,'','','Deprecated quest: Call to Arms: Alterac Valley'),
+(1,11341,0,'','','Deprecated quest: Call to Arms: Eye of the Storm'),
+(1,11342,0,'','','Deprecated quest: Call to Arms: Warsong Gulch'),
+(1,13405,0,'','','Deprecated quest: Call to Arms: Strand of the Ancients'),
+(1,13407,0,'','','Deprecated quest: Call to Arms: Strand of the Ancients'),
+(1,13427,0,'','','Deprecated quest: Call to Arms: Alterac Valley'),
+(1,13428,0,'','','Deprecated quest: Call to Arms: Alterac Valley'),
+(1,14163,0,'','','Deprecated quest: Call to Arms: Isle of Conquest'),
+(1,14164,0,'','','Deprecated quest: Call to Arms: Isle of Conquest'),
+(1,14178,0,'','','Deprecated quest: Call to Arms: Arathi Basin'),
+(1,14179,0,'','','Deprecated quest: Call to Arms: Eye of the Storm'),
+(1,14180,0,'','','Deprecated quest: Call to Arms: Warsong Gulch'),
+(1,14181,0,'','','Deprecated quest: Call to Arms: Arathi Basin'),
+(1,14182,0,'','','Deprecated quest: Call to Arms: Eye of the Storm'),
+(1,14183,0,'','','Deprecated quest: Call to Arms: Warsong Gulch'),
+(1,24216,0,'','','Deprecated quest: Call to Arms: Warsong Gulch'),
+(1,24217,0,'','','Deprecated quest: Call to Arms: Warsong Gulch'),
+(1,24218,0,'','','Deprecated quest: Call to Arms: Warsong Gulch'),
+(1,24219,0,'','','Deprecated quest: Call to Arms: Warsong Gulch'),
+(1,24220,0,'','','Deprecated quest: Call to Arms: Arathi Basin'),
+(1,24221,0,'','','Deprecated quest: Call to Arms: Arathi Basin'),
+(1,24223,0,'','','Deprecated quest: Call to Arms: Arathi Basin'),
+(1,24224,0,'','','Deprecated quest: Call to Arms: Warsong Gulch'),
+(1,24225,0,'','','Deprecated quest: Call to Arms: Warsong Gulch'),
+(1,24226,0,'','','Deprecated quest: Call to Arms: Arathi Basin'),
+(1,24426,0,'','','Deprecated quest: Call to Arms: Alterac Valley'),
+(1,24427,0,'','','Deprecated quest: Call to Arms: Alterac Valley');
diff --git a/sql/old/3.3.5a/2012_08_04_05_world_disables.sql b/sql/old/3.3.5a/2012_08_04_05_world_disables.sql
new file mode 100644
index 00000000000..ce123e4e5be
--- /dev/null
+++ b/sql/old/3.3.5a/2012_08_04_05_world_disables.sql
@@ -0,0 +1,28 @@
+DELETE FROM `disables` WHERE `sourceType`=1 AND `entry` IN (8384,8386,8389,8390,8391,8392,8397,8398,8404,8405,8406,8407,8408,8431,8432,8433,8434,8435,8440,8441,8442,8443,8567,8568,8569,8570);
+INSERT INTO `disables` (`sourceType`,`entry`,`flags`,`params_0`,`params_1`,`comment`) VALUES
+(1,8384,0,'','','Deprecated quest: Claiming Arathi Basin'),
+(1,8386,0,'','','Deprecated quest: Fight for Warsong Gulch'),
+(1,8389,0,'','','Deprecated quest: Battle of Warsong Gulch'),
+(1,8390,0,'','','Deprecated quest: Conquering Arathi Basin'),
+(1,8391,0,'','','Deprecated quest: Claiming Arathi Basin'),
+(1,8392,0,'','','Deprecated quest: Claiming Arathi Basin'),
+(1,8397,0,'','','Deprecated quest: Claiming Arathi Basin'),
+(1,8398,0,'','','Deprecated quest: Claiming Arathi Basin'),
+(1,8404,0,'','','Deprecated quest: Fight for Warsong Gulch'),
+(1,8405,0,'','','Deprecated quest: Fight for Warsong Gulch'),
+(1,8406,0,'','','Deprecated quest: Fight for Warsong Gulch'),
+(1,8407,0,'','','Deprecated quest: Fight for Warsong Gulch'),
+(1,8408,0,'','','Deprecated quest: Fight for Warsong Gulch'),
+(1,8431,0,'','','Deprecated quest: Battle of Warsong Gulch'),
+(1,8432,0,'','','Deprecated quest: Battle of Warsong Gulch'),
+(1,8433,0,'','','Deprecated quest: Battle of Warsong Gulch'),
+(1,8434,0,'','','Deprecated quest: Battle of Warsong Gulch'),
+(1,8435,0,'','','Deprecated quest: Battle of Warsong Gulch'),
+(1,8440,0,'','','Deprecated quest: Conquering Arathi Basin'),
+(1,8441,0,'','','Deprecated quest: Conquering Arathi Basin'),
+(1,8442,0,'','','Deprecated quest: Conquering Arathi Basin'),
+(1,8443,0,'','','Deprecated quest: Conquering Arathi Basin'),
+(1,8567,0,'','','Deprecated quest: Past Victories in Warsong Gulch'),
+(1,8568,0,'','','Deprecated quest: Past Victories in Warsong Gulch'),
+(1,8569,0,'','','Deprecated quest: Past Efforts in Warsong Gulch'),
+(1,8570,0,'','','Deprecated quest: Past Efforts in Warsong Gulch');
diff --git a/sql/old/3.3.5a/2012_08_04_06_world_quest_template.sql b/sql/old/3.3.5a/2012_08_04_06_world_quest_template.sql
new file mode 100644
index 00000000000..fe48c887ae0
--- /dev/null
+++ b/sql/old/3.3.5a/2012_08_04_06_world_quest_template.sql
@@ -0,0 +1,10 @@
+UPDATE `quest_template` SET `specialflags`= `specialflags`|8 WHERE `id` IN (
+24889, -- Classic Random 5-15 (Nth)
+24890, -- Classic Random 15-25 (Nth)
+24891, -- Classic Random 24-34 (Nth)
+24892, -- Classic Random 35-45 (Nth)
+24893, -- Classic Random 46-55 (Nth)
+24894, -- Classic Random 56-60 (Nth)
+24895, -- Classic Random 60-64 (Nth)
+24896); -- Classic Random 65-70 (Nth)
+
diff --git a/sql/old/3.3.5a/2012_08_04_07_world_game_event_creature_quest.sql b/sql/old/3.3.5a/2012_08_04_07_world_game_event_creature_quest.sql
new file mode 100644
index 00000000000..b72f8edd46d
--- /dev/null
+++ b/sql/old/3.3.5a/2012_08_04_07_world_game_event_creature_quest.sql
@@ -0,0 +1,110 @@
+-- Hordes's Honor the Flame
+-- Add missing creature_quesrelation and involvedrealation that were blocking quests
+DELETE FROM `game_event_creature_quest` WHERE `quest` IN (11846,11845,11852,11839,11859,11841,11851,11855,11835,11858,11863,13500,13493,13494,13495,13496,13497,13498,13499,11850,11848,11853,11857,11837,11844,11860,11584,11862,11842,11840);
+INSERT INTO `game_event_creature_quest` (`eventEntry`,`id`, `quest`) VALUES
+-- Flame Keeper of Eastern Kingdom? {Achievement=1025}
+(1,25933, 11850), -- Ghostland
+(1,25931, 11848), -- Eversong woods
+(1,25935, 11853), -- Hillsbrad Foothills
+(1,25941, 11857), -- Swamp of sorrows
+(1,25920, 11837), -- Cape of Stranglethorn
+(1,25927, 11844), -- Burning Steppes
+(1,25944, 11860), -- The Hinterlands
+(1,25939, 11584), -- Silverpine Forest
+(1,25946, 11862), -- Tirisfal Glades
+(1,25925, 11842), -- Badlands
+(1,25923, 11840), -- Arathi Highlands
+-- The Flame Keeper of Kalimdore - {Achievement=1026}
+(1,25929, 11846), -- Durotar
+(1,25928, 11845), -- Desolace
+(1,25936, 11852), -- Mulgore
+(1,25922, 11839), -- Winterspring
+(1,25943, 11859), -- Barrens
+(1,25884, 11841), -- Ashenvale
+-- The Flame Keeper of Outland - {Achievement=1027}
+(1,25934, 11851), -- Hellfire Peninsula
+(1,25938, 11855), -- Shadowmoon Valley
+(1,25918, 11835), -- Netherstorm
+(1,25942, 11858), -- Terokkar
+(1,25947, 11863), -- Terokkar
+-- Flame Keeper of Northrend - {Achievement=6009}
+(1,32816, 13500), -- Zul'Drak
+(1,32809, 13493), -- Borean Tundra
+(1,32810, 13494), -- Sholazar Basin
+(1,32811, 13495), -- Dragonblight
+(1,32815, 13499), -- Crystalsong Forest
+(1,32814, 13498), -- Storm Peaks
+(1,32813, 13497), -- Grizzly Hills
+(1,32812, 13496); -- Howling Fjords
+-- add missing quest-involved relations
+DELETE FROM `creature_involvedrelation` WHERE `quest` IN (11846,11845,11852,11839,11859,11841,11851,11855,11835,11858,11863,13500,13493,13494,13495,13496,13497,13498,13499,11850,11848,11853,11857,11837,11844,11860,11584,11862,11842,11840);
+INSERT INTO `creature_involvedrelation` (`id`, `quest`) VALUES
+(25929, 11846), -- Durotar
+(25928, 11845), -- Desolace
+(25936, 11852), -- Mulgore
+(25922, 11839), -- Winterspring
+(25943, 11859), -- Barrens
+(25884, 11841), -- Ashenvale
+(25934, 11851), -- Hellfire Peninsula
+(25938, 11855), -- Shadowmoon Valley
+(25918, 11835), -- Netherstorm
+(25942, 11858), -- Terokkar
+(25947, 11863), -- Terokkar
+(32816, 13500), -- Zul'Drak
+(32809, 13493), -- Borean Tundra
+(32810, 13494), -- Sholazar Basin
+(32811, 13495), -- Dragonblight
+(32815, 13499), -- Crystalsong Forest
+(32814, 13498), -- Storm Peaks
+(32813, 13497), -- Grizzly Hills
+(32812, 13496), -- Howling Fjords
+(25933, 11850), -- Ghostland
+(25931, 11848), -- Eversong woods
+(25935, 11853), -- Hillsbrad Foothills
+(25941, 11857), -- Swamp of sorrows
+(25920, 11837), -- Cape of Stranglethorn
+(25927, 11844), -- Burning Steppes
+(25944, 11860), -- The Hinterlands
+(25939, 11584), -- Silverpine Forest
+(25946, 11862), -- Tirisfal Glades
+(25925, 11842), -- Badlands
+(25923, 11840); -- Arathi Highlands
+-- update quest texts and rewardcash
+UPDATE `quest_template` SET `RewardOrRequiredMoney`=37000,`RewardMoneyMaxLevel`=66300, `OfferRewardText`='Honor the Durotar flame!' WHERE `Id`=11846;
+UPDATE `quest_template` SET `OfferRewardText`='Honor the Mulgore flame!' WHERE `Id`=11852;
+UPDATE `quest_template` SET `OfferRewardText`='Honor the Barrens flame!',`RewardOrRequiredMoney`=37000, `RewardMoneyMaxLevel`=66300 WHERE `Id`=11859; -- Barrens
+UPDATE `quest_template` SET `OfferRewardText`='Honor the Tanaris flame!',`RequestItemsText`='' WHERE `Id`=11838 LIMIT 1;
+UPDATE `quest_template` SET `OfferRewardText`='Honor the Ashenvale flame!' WHERE `Id`=11841;
+UPDATE `quest_template` SET `OfferRewardText`='Honor the Winterspring flame!' WHERE `Id`=11839;
+UPDATE `quest_template` SET `OfferRewardText`='Honor the Desolace flame!' WHERE `Id`=11845;
+UPDATE `quest_template` SET `OfferRewardText`='Honor the Thousand Needles flame!' WHERE `Id`=11861;
+UPDATE `quest_template` SET `OfferRewardText`='Honor the Feralas flame!' WHERE `Id`=11849;
+UPDATE `quest_template` SET `OfferRewardText`='Honor the Dustwallow Marsh flame!' WHERE `Id`=11847;
+UPDATE `quest_template` SET `OfferRewardText`='Honor the Silithus flame!' WHERE `Id`=11836;
+UPDATE `quest_template` SET `OfferRewardText`='Honor the Stonetalon Mountains flame!' WHERE `Id`=11856;
+UPDATE `quest_template` SET `OfferRewardText`='Honor the Hellfire Peninsula flame!' WHERE `Id`=11851;
+UPDATE `quest_template` SET `OfferRewardText`='Honor the Shadowmoon Valley flame!' WHERE `Id`=11855;
+UPDATE `quest_template` SET `OfferRewardText`='Honor the Nagrand flame!', `RequestItemsText`='' WHERE `Id`=11821;
+UPDATE `quest_template` SET `OfferRewardText`='Honor the Netherstorm flame!' WHERE `Id`=11835;
+UPDATE `quest_template` SET `OfferRewardText`='Honor the Blades Edge Mountains flame! ', `RequestItemsText`='' WHERE `Id`=11843;
+UPDATE `quest_template` SET `OfferRewardText`='Honor the Terokkar flame!' WHERE `Id`=11858;
+UPDATE `quest_template` SET `OfferRewardText`='Honor the Zangarmarsh flame!' WHERE `Id`=11863;
+UPDATE `quest_template` SET `OfferRewardText`='Honor the Zul''Drak flame!' WHERE `Id`=13500;
+UPDATE `quest_template` SET `OfferRewardText`='Honor the Borean Tundra flame!' WHERE `Id`=13493;
+UPDATE `quest_template` SET `OfferRewardText`='Honor the Sholazar Basin flame!' WHERE `Id`=13494;
+UPDATE `quest_template` SET `OfferRewardText`='Honor the Dragonblight flame!' WHERE `Id`=13495;
+UPDATE `quest_template` SET `OfferRewardText`='Honor the Crystalsong Forest flame!' WHERE `Id`=13499;
+UPDATE `quest_template` SET `OfferRewardText`='Honor the Storm Peaks flame!' WHERE `Id`=13498;
+UPDATE `quest_template` SET `OfferRewardText`='Honor the Grizzly Hills flame!' WHERE `Id`=13497;
+UPDATE `quest_template` SET `OfferRewardText`='Honor the Howling Fjords flame!' WHERE `Id`=13496;
+UPDATE `quest_template` SET `OfferRewardText`='Honor the Ghostland flame!' WHERE `Id`=11850;
+UPDATE `quest_template` SET `OfferRewardText`='Honor the Eversong woods flame!' WHERE `Id`=11848;
+UPDATE `quest_template` SET `OfferRewardText`='Honor the Hillsbrad Foothills flame!' WHERE `Id`=11853;
+UPDATE `quest_template` SET `OfferRewardText`='Honor the Swamp of sorrows flame!' WHERE `Id`=11857;
+UPDATE `quest_template` SET `OfferRewardText`='Honor the Cape of Stranglethorn flame!' WHERE `Id`=11837;
+UPDATE `quest_template` SET `OfferRewardText`='Honor the Burning Steppes flame!' WHERE `Id`=11844;
+UPDATE `quest_template` SET `OfferRewardText`='Honor the Hinterlands flame!' WHERE `Id`=11860;
+UPDATE `quest_template` SET `OfferRewardText`='Honor the Silverpine Forest flame!' WHERE `Id`=11584;
+UPDATE `quest_template` SET `OfferRewardText`='Honor the Tirisfal Glades flame!' WHERE `Id`=11862;
+UPDATE `quest_template` SET `OfferRewardText`='Honor the Badlands flame!' WHERE `Id`=11842;
+UPDATE `quest_template` SET `OfferRewardText`='Honor the Arathi Highlands flame!' WHERE `Id`=11840;
diff --git a/sql/old/3.3.5a/2012_08_04_08_world_disables.sql b/sql/old/3.3.5a/2012_08_04_08_world_disables.sql
new file mode 100644
index 00000000000..6944c45f1f4
--- /dev/null
+++ b/sql/old/3.3.5a/2012_08_04_08_world_disables.sql
@@ -0,0 +1,65 @@
+DELETE FROM `disables` WHERE `sourceType`=1 AND `entry` IN (9034,9036,9037,9038,9039,9040,9041,9042,9043,9044,9046,9047,9048,9049,9050,9054,9055,9056,9057,9058,9059,9060,9061,9068,9069,9070,9071,9072,9073,9074,9075,9077,9078,9079,9080,9081,9082,9083,9084,9086,9087,9088,9089,9090,9091,9092,9093,9095,9096,9097,9098,9099,9100,9101,9102,9103,9104,9105,9106,9107,9108,9109,9110);
+INSERT INTO `disables` (`sourceType`,`entry`,`flags`,`params_0`,`params_1`,`comment`) VALUES
+(1,9034,0,'','','Deprecated quest: Dreadnaught Breastplate'),
+(1,9036,0,'','','Deprecated quest: Dreadnaught Legplates'),
+(1,9037,0,'','','Deprecated quest: Dreadnaught Helmet'),
+(1,9038,0,'','','Deprecated quest: Dreadnaught Pauldrons'),
+(1,9039,0,'','','Deprecated quest: Dreadnaught Sabatons'),
+(1,9040,0,'','','Deprecated quest: Dreadnaught Gauntlets'),
+(1,9041,0,'','','Deprecated quest: Dreadnaught Waistguard'),
+(1,9042,0,'','','Deprecated quest: Dreadnaught Bracers'),
+(1,9043,0,'','','Deprecated quest: Redemption Tunic'),
+(1,9044,0,'','','Deprecated quest: Redemption Legguards'),
+(1,9046,0,'','','Deprecated quest: Redemption Spaulders'),
+(1,9047,0,'','','Deprecated quest: Redemption Boots'),
+(1,9048,0,'','','Deprecated quest: Redemption Handguards'),
+(1,9049,0,'','','Deprecated quest: Redemption Girdle'),
+(1,9050,0,'','','Deprecated quest: Redemption Wristguards'),
+(1,9054,0,'','','Deprecated quest: Cryptstalker Tunic'),
+(1,9055,0,'','','Deprecated quest: Cryptstalker Legguards'),
+(1,9056,0,'','','Deprecated quest: Cryptstalker Headpiece'),
+(1,9057,0,'','','Deprecated quest: Cryptstalker Spaulders'),
+(1,9058,0,'','','Deprecated quest: Cryptstalker Boots'),
+(1,9059,0,'','','Deprecated quest: Cryptstalker Handguards'),
+(1,9060,0,'','','Deprecated quest: Cryptstalker Girdle'),
+(1,9061,0,'','','Deprecated quest: Cryptstalker Wristguards'),
+(1,9068,0,'','','Deprecated quest: Earthshatter Tunic'),
+(1,9069,0,'','','Deprecated quest: Earthshatter Legguards'),
+(1,9070,0,'','','Deprecated quest: Earthshatter Headpiece'),
+(1,9071,0,'','','Deprecated quest: Earthshatter Spaulders'),
+(1,9072,0,'','','Deprecated quest: Earthshatter Boots'),
+(1,9073,0,'','','Deprecated quest: Earthshatter Handguards'),
+(1,9074,0,'','','Deprecated quest: Earthshatter Girdle'),
+(1,9075,0,'','','Deprecated quest: Earthshatter Wristguards'),
+(1,9077,0,'','','Deprecated quest: Bonescythe Breastplate'),
+(1,9078,0,'','','Deprecated quest: Bonescythe Legplates'),
+(1,9079,0,'','','Deprecated quest: Bonescythe Helmet'),
+(1,9080,0,'','','Deprecated quest: Bonescythe Pauldrons'),
+(1,9081,0,'','','Deprecated quest: Bonescythe Sabatons'),
+(1,9082,0,'','','Deprecated quest: Bonescythe Gauntlets'),
+(1,9083,0,'','','Deprecated quest: Bonescythe Waistguard'),
+(1,9084,0,'','','Deprecated quest: Bonescythe Bracers'),
+(1,9086,0,'','','Deprecated quest: Dreamwalker Tunic'),
+(1,9087,0,'','','Deprecated quest: Dreamwalker Legguards'),
+(1,9088,0,'','','Deprecated quest: Dreamwalker Headpiece'),
+(1,9089,0,'','','Deprecated quest: Dreamwalker Spaulders'),
+(1,9090,0,'','','Deprecated quest: Dreamwalker Boots'),
+(1,9091,0,'','','Deprecated quest: Dreamwalker Handguards'),
+(1,9092,0,'','','Deprecated quest: Dreamwalker Girdle'),
+(1,9093,0,'','','Deprecated quest: Dreamwalker Wristguards'),
+(1,9095,0,'','','Deprecated quest: Frostfire Robe'),
+(1,9096,0,'','','Deprecated quest: Frostfire Leggings'),
+(1,9097,0,'','','Deprecated quest: Frostfire Circlet'),
+(1,9098,0,'','','Deprecated quest: Frostfire Shoulderpads'),
+(1,9099,0,'','','Deprecated quest: Frostfire Sandals'),
+(1,9100,0,'','','Deprecated quest: Frostfire Gloves'),
+(1,9101,0,'','','Deprecated quest: Frostfire Belt'),
+(1,9102,0,'','','Deprecated quest: Frostfire Bindings'),
+(1,9103,0,'','','Deprecated quest: Plagueheart Robe'),
+(1,9104,0,'','','Deprecated quest: Plagueheart Leggings'),
+(1,9105,0,'','','Deprecated quest: Plagueheart Circlet'),
+(1,9106,0,'','','Deprecated quest: Plagueheart Shoulderpads'),
+(1,9107,0,'','','Deprecated quest: Plagueheart Sandals'),
+(1,9108,0,'','','Deprecated quest: Plagueheart Gloves'),
+(1,9109,0,'','','Deprecated quest: Plagueheart Belt'),
+(1,9110,0,'','','Deprecated quest: Plagueheart Bindings');
diff --git a/sql/old/3.3.5a/2012_08_04_09_world_disables.sql b/sql/old/3.3.5a/2012_08_04_09_world_disables.sql
new file mode 100644
index 00000000000..3023625410e
--- /dev/null
+++ b/sql/old/3.3.5a/2012_08_04_09_world_disables.sql
@@ -0,0 +1,10 @@
+DELETE FROM `disables` WHERE `sourceType`=1 AND `entry` IN (9111,9112,9113,9114,9115,9116,9117,9118);
+INSERT INTO `disables` (`sourceType`,`entry`,`flags`,`params_0`,`params_1`,`comment`) VALUES
+(1,9111,0,'','','Deprecated quest: Robe of Faith'),
+(1,9112,0,'','','Deprecated quest: Leggings of Faith'),
+(1,9113,0,'','','Deprecated quest: Circlet of Faith'),
+(1,9114,0,'','','Deprecated quest: Shoulderpads of Faith'),
+(1,9115,0,'','','Deprecated quest: Sandals of Faith'),
+(1,9116,0,'','','Deprecated quest: Gloves of Faith'),
+(1,9117,0,'','','Deprecated quest: Belt of Faith'),
+(1,9118,0,'','','Deprecated quest: Bindings of Faith');
diff --git a/sql/old/3.3.5a/2012_08_04_10_world_disables.sql b/sql/old/3.3.5a/2012_08_04_10_world_disables.sql
new file mode 100644
index 00000000000..1d991eafef5
--- /dev/null
+++ b/sql/old/3.3.5a/2012_08_04_10_world_disables.sql
@@ -0,0 +1,43 @@
+DELETE FROM `disables` WHERE `sourceType`=1 AND `entry` IN (2018,5101,7681,7682,8230,8270,8274,9284,9285,9286,9577,9583,11121,11994,12015,12493,12911,13649,14106,9713,9926,11087,11115,11116,11353,11518,12186,12187,12494,12845,13807,14185,14186,14187,24808,24809,24810,24811,25238);
+INSERT INTO `disables` (`sourceType`,`entry`,`flags`,`params_0`,`params_1`,`comment`) VALUES
+-- containing "test"
+(1,2018,0,'','','Deprecated quest: Rokar''s Test'),
+(1,5101,0,'','','Deprecated quest: Lee''s Ultimate Test Quest... of Doom!'),
+(1,7681,0,'','','Deprecated quest: Hunter test quest'),
+(1,7682,0,'','','Deprecated quest: Hunter test quest2'),
+(1,8230,0,'','','Deprecated quest: Collin''s Test Quest'),
+(1,8270,0,'','','Deprecated quest: test copy quest'),
+(1,8274,0,'','','Deprecated quest: Test Kill Quest'),
+(1,9284,0,'','','Deprecated quest: Aldor Faction Test'),
+(1,9285,0,'','','Deprecated quest: Consortium Faction Test'),
+(1,9286,0,'','','Deprecated quest: Scryers Faction Test'),
+(1,9577,0,'','','Deprecated quest: DAILY TEST QUEST (PVP)'),
+(1,9583,0,'','','Deprecated quest: Omar''s Test Quest'),
+(1,11121,0,'','','Deprecated quest: DAILY TEST QUEST (RAID)'),
+(1,11994,0,'','','Deprecated quest: Juno''s Flag Tester'),
+(1,12015,0,'','','Deprecated quest: Test Quest for Craig'),
+(1,12493,0,'','','Deprecated quest: PvP Test'),
+(1,12911,0,'','','Deprecated quest: Kill Credit Test'),
+(1,13649,0,'','','Deprecated quest: Justin''s Fun Test'),
+(1,14106,0,'','','Deprecated quest: Na Kada''s Quest Test'),
+-- containing "flag"
+(1,9713,0,'','','Deprecated quest: Glowcap Harvesting Enabling Flag'),
+(1,9926,0,'','','Deprecated quest: FLAG Shadow Council/Warmaul Questline'),
+(1,11087,0,'','','Deprecated quest: HYJAL FLAG'),
+(1,11115,0,'','','Deprecated quest: The Mark of Vashj (FLAG ONLY)'),
+(1,11116,0,'','','Deprecated quest: Trial of the Naaru: (QUEST FLAG)'),
+(1,11353,0,'','','Deprecated quest: FLAG: Got the work shirt'),
+(1,11518,0,'','','Deprecated quest: Sunwell Daily Portal Flag'),
+(1,12186,0,'','','Deprecated quest: FLAG: Winner'),
+(1,12187,0,'','','Deprecated quest: FLAG: Participant'),
+(1,12494,0,'','','Deprecated quest: FLAG: Riding Trainer Advertisement (20)'),
+(1,12845,0,'','','Deprecated quest: Dalaran Teleport Crystal Flag'),
+(1,13807,0,'','','Deprecated quest: FLAG: Tournament Invitation'),
+(1,14185,0,'','','Deprecated quest: FLAG: Riding Trainer Advertisement (40)'),
+(1,14186,0,'','','Deprecated quest: FLAG: Riding Trainer Advertisement (60)'),
+(1,14187,0,'','','Deprecated quest: FLAG: Riding Trainer Advertisement (70)'),
+(1,24808,0,'','','Deprecated quest: Tank Ring Flag'),
+(1,24809,0,'','','Deprecated quest: Healer Ring Flag'),
+(1,24810,0,'','','Deprecated quest: Melee Ring Flag'),
+(1,24811,0,'','','Deprecated quest: Caster Ring Flag'),
+(1,25238,0,'','','Deprecated quest: Strength Ring Flag');
diff --git a/sql/old/3.3.5a/2012_08_04_11_world_game_event_creature_quest.sql b/sql/old/3.3.5a/2012_08_04_11_world_game_event_creature_quest.sql
new file mode 100644
index 00000000000..224749c7e10
--- /dev/null
+++ b/sql/old/3.3.5a/2012_08_04_11_world_game_event_creature_quest.sql
@@ -0,0 +1,365 @@
+-- Add all quests connected with Midsummer Fire Festival that are to be reseted on each next year to game_event_seasonal_questrelation, so players can complete them on and on... /as of different festivals/.
+DELETE FROM `game_event_seasonal_questrelation` WHERE `questId` IN (11846,11845,11852,11839,11859,11841,11849,11861,11847,11836,11838,11856,11850,11848,11853,11857,11837,11844,11860,11584,11862,11842,11840,11851,11855,11835,11858,11863,11821,11854,11843,13500,13493,13494,13495,13496,13497,13498,13499,11805,11812,11815,11834,11833,11831,11817,11811,11806,11809,11826,11824,11826,11827,11819,11583,11828,11816,11810,11808,11804,11832,11813,11814,11820,11822,11823,11821,11830,11818,11825,11807,11829,13485,13487,13489,13488,13490,13486,13491,13492,11770,11769,11777,11803,11783,11773,11765,11771,11785,11800,11780,11802,11774,11772,11776,11781,11801,11768,11784,11580,11786,11766,11764,11775,11779,11799,11782,11787,11767,11778,13458,13441,13450,13451,13457,13455,13454,13453,11734,11741,11744,11763,11762,11760,11746,11740,11735,11738,11753,11755,11756,11748,11581,11757,11745,11739,11737,11732,11761,11742,11743,11749,11751,11752,11750,11759,11747,11754,11736,11758,13440,13443,13445,13444,13449,13446,13442,13447,13431,9324,11935,9326,9325,9332,9331,9330,11933,11972);
+INSERT INTO `game_event_seasonal_questrelation` (`questId`, `eventEntry`) VALUES
+(11846,1), -- Durotar // Honor the Flame (Horde) - Kalimdor
+(11845,1), -- Desolace
+(11852,1), -- Mulgore
+(11839,1), -- Winterspring
+(11859,1), -- Barrens
+(11849,1), -- Feralas
+(11841,1), -- Ashenvale
+(11847,1), -- Dustwallow marsh
+(11861,1), -- Thousand Needles
+(11856,1), -- Stonetalon Mountains
+(11836,1), -- Silithus
+(11838,1), -- Tanaris
+(11850,1), -- Ghostland // Honor the Flame (Horde) - Eeastern Kingdoms
+(11848,1), -- Eversong woods
+(11853,1), -- Hillsbrad Foothills
+(11857,1), -- Swamp of sorrows
+(11837,1), -- Cape of Stranglethorn
+(11844,1), -- Burning Steppes
+(11860,1), -- The Hinterlands
+(11584,1), -- Silverpine Forest
+(11862,1), -- Tirisfal Glades
+(11842,1), -- Badlands
+(11840,1), -- Arathi Highlands
+(11851,1), -- Hellfire Peninsula // Honor the Flame (Horde) - Outland
+(11855,1), -- Shadowmoon Valley
+(11835,1), -- Netherstorm
+(11858,1), -- Terokkar
+(11863,1), -- Zangarmarsh
+(11854,1), -- Nagrand
+(11843,1), -- Blade''s Edge Mountains
+(13500,1), -- Zul'Drak // Honor the Flame (Horde) - Northrend
+(13493,1), -- Borean Tundra
+(13494,1), -- Sholazar Basin
+(13495,1), -- Dragonblight
+(13499,1), -- Crystalsong Forest
+(13498,1), -- Storm Peaks
+(13497,1), -- Grizzly Hills
+(13496,1), -- Howling Fjords
+(11805,1), -- Ashenvale // Honor the Flame (Alliance) - Kalimdor
+(11812,1), -- Desolace
+(11815,1), -- Dustwallow Marsh
+(11834,1), -- Winterspring
+(11833,1), -- Tanaris
+(11831,1), -- Silithus
+(11817,1), -- Feralas
+(11811,1), -- Darkshore
+(11806,1), -- Azuremyst Isle
+(11809,1), -- Bloodmyst Isle
+(11824,1), -- Teldrassil
+(11826,1), -- The Hinterlands // Honor the Flame (Alliance) - Eeastern Kingdoms
+(11827,1), -- The Western Plaguelands
+(11819,1), -- Hillsbrad Foothills
+(11583,1), -- Westfall
+(11828,1), -- Wetlands
+(11816,1), -- Elwynn Forest
+(11810,1), -- Burning Steppes
+(11808,1), -- Blasted Lands
+(11804,1), -- Arathi Highlands
+(11832,1), -- Cape of Stranglethorn
+(11813,1), -- Dun Morogh
+(11814,1), -- Duskwood
+(11820,1), -- Loch Modan
+(11822,1), -- Redridge Mountains
+(11823,1), -- Shadowmoon Valley // Honor the Flame (Alliance) - Outland
+(11821,1), -- Nagrand
+(11830,1), -- Netherstorm
+(11818,1), -- Hellfire Peninsula
+(11825,1), -- Terokkar
+(11807,1), -- Blade's Edge
+(11829,1), -- Zangarmarsh
+(13485,1), -- Borean Tundra // Honor the Flame (Alliance) - Northrend
+(13487,1), -- Dragonblight
+(13489,1), -- Grizzly Hills
+(13488,1), -- Howling Fjord
+(13492,1), -- Zul'Drak
+(13490,1), -- The Storm Peaks
+(13486,1), -- Sholazar Basin
+(13491,1), -- Crystalsong Forest
+(11770,1), -- Durotar // Desecrate the Flame (Alliance) - Kalimdor
+(11769,1), -- Desolace
+(11777,1), -- Mulgore
+(11803,1), -- Winterspring
+(11783,1), -- Barrens
+(11773,1), -- Feralas
+(11765,1), -- Ashenvale
+(11771,1), -- Dustwallow marsh
+(11785,1), -- Thousand Needles
+(11800,1), -- Silithus
+(11780,1), -- Stonetalon Mountains
+(11802,1), -- Tanaris
+(11774,1), -- Ghostland // Desecrate the Flame (Alliance) - Eastern Kingdoms
+(11772,1), -- Eversong woods
+(11776,1), -- Hillsbrad Foothills
+(11781,1), -- Swamp of sorrows
+(11801,1), -- Cape of Stranglethorn
+(11768,1), -- Burning Steppes
+(11784,1), -- The Hinterlands
+(11580,1), -- Silverpine Forest
+(11786,1), -- Tirisfal Glades
+(11766,1), -- Badlands
+(11764,1), -- Arathi Highlands
+(11775,1), -- Hellfire Peninsula // Desecrate the Flame (Alliance) - Outland
+(11779,1), -- Shadowmoon Valley
+(11799,1), -- Netherstorm
+(11782,1), -- Terokkar
+(11787,1), -- Zangarmarsh
+(11767,1), -- Blade' Edge
+(11778,1), -- Nagrand
+(13458,1), -- Zul'Drak // Desecrate the Flame (Alliance) - Northrend
+(13441,1), -- Borean Tundra
+(13450,1), -- Sholazar Basin
+(13451,1), -- Dragonblight
+(13457,1), -- Crystalsong Forest
+(13455,1), -- Storm Peaks
+(13454,1), -- Grizzly Hills
+(13453,1), -- Howling Fjords
+(11734,1), -- Ashenvale // Desecrate the Flame (Horde) - Kalimdor
+(11741,1), -- Desolace
+(11744,1), -- Dustwallow Marsh
+(11763,1), -- Winterspring
+(11762,1), -- Tanaris
+(11760,1), -- Silithus
+(11746,1), -- Feralas
+(11740,1), -- Darkshore
+(11735,1), -- Azuremyst Isle
+(11738,1), -- Bloodmyst Isle
+(11753,1), -- Teldrassil
+(11755,1), -- The Hinterlands // Desecrate the Flame (Horde) - Eastern Kingdoms
+(11756,1), -- The Western Plaguelands
+(11748,1), -- Hillsbrad Foothills
+(11581,1), -- Westfall
+(11757,1), -- Wetlands
+(11745,1), -- Elwynn Forest
+(11739,1), -- Burning Steppes
+(11737,1), -- Blasted Lands
+(11732,1), -- Arathi Highlands
+(11761,1), -- Cape of Stranglethorn
+(11742,1), -- Dun Morogh
+(11743,1), -- Duskwood
+(11749,1), -- Loch Modan
+(11751,1), -- Redridge Mountains
+(11752,1), -- Shadowmoon Valley // Desecrate the Flame (Horde) - Outland
+(11750,1), -- Nagrand
+(11759,1), -- Netherstorm
+(11747,1), -- Hellfire Peninsula
+(11754,1), -- Terokkar
+(11736,1), -- Blade's Edge
+(11758,1), -- Zangarmarsh
+(13440,1), -- Borean Tundra // Desecrate the Flame (Horde) - Northrend
+(13443,1), -- Dragonblight
+(13445,1), -- Grizzly
+(13444,1), -- Howling Fjord
+(13449,1), -- Zul'Drak
+(13446,1), -- The Storm Peaks
+(13442,1), -- Sholazar Basin
+(13447,1), -- Crystalsong Forest
+(11972,1), -- Shards of Ahune
+(9324,1), -- Stealing Orgrimmar''s Flame
+(11935,1), -- Stealing Silvermoon''s Flame
+(9326,1), -- Stealing the Undercity''s Flame
+(9325,1), -- Stealing Thunder Bluff''s Flame
+(9332,1), -- Stealing Darnassus''s Flame
+(9331,1), -- Stealing Ironforge''s Flame
+(9330,1), -- Stealing Stormwind''s Flame
+(11933,1); -- Stealing the Exodar''s Flame
+-- Add quest relations to game_event_gameobject_quest and game_event_creature_quest
+DELETE FROM `game_event_creature_quest` WHERE `quest` IN (11846,11845,11852,11839,11859,11841,11849,11861,11847,11836,11838,11856,11850,11848,11853,11857,11837,11844,11860,11584,11862,11842,11840,11851,11855,11835,11858,11863,11821,11854,11843,13500,13493,13494,13495,13496,13497,13498,13499,11805,11812,11815,11834,11833,11831,11817,11811,11806,11809,11826,11824,11826,11827,11819,11583,11828,11816,11810,11808,11804,11832,11813,11814,11820,11822,11823,11821,11830,11818,11825,11807,11829,13485,13487,13489,13488,13490,13486,13491,13492,11805,11812,11815,11834,11833,11831,11817,11811,11806,11809,11824,11826,11827,11819,11583,11828,11816,11810,11808,11804,11832,11813,11814,11820,11822,13485,13487,13489,13488,13490,13486,13491,13490,11823,11821,11830,11818,11825,11807,11829,11775,11917,11947,11948,11952,11953,11954,11886,11891,12012,11955,11696,11691,11971,11970,11966,11964,11922,11923,11926,11925,11731,11657,11921,11924,9339,9365);
+INSERT INTO `game_event_creature_quest` (`eventEntry`,`id`, `quest`) VALUES
+(1,25929, 11846), -- Durotar // Honor the Flame (Horde) - Kalimdor
+(1,25928, 11845), -- Desolace
+(1,25936, 11852), -- Mulgore
+(1,25922, 11839), -- Winterspring
+(1,25943, 11859), -- Barrens
+(1,25932, 11849), -- Feralas
+(1,25884, 11841), -- Ashenvale
+(1,25930, 11847), -- Dustwallow marsh
+(1,25945, 11861), -- Thousand Needles
+(1,25919, 11836), -- Silithus
+(1,25921, 11838), -- Tanaris
+(1,25940, 11856), -- Stonetalon Mountains
+(1,25934, 11851), -- Hellfire Peninsula // Honor the Flame (Horde) - Outland
+(1,25938, 11855), -- Shadowmoon Valley
+(1,25918, 11835), -- Netherstorm
+(1,25942, 11858), -- Terokkar
+(1,25947, 11863), -- Zangarmarsh
+(1,25937, 11854), -- Nagrand
+(1,25926, 11843), -- Blade''s Edge Mountains
+(1,32816, 13500), -- Zul'Drak // Honor the Flame (Horde) - Northrend
+(1,32809, 13493), -- Borean Tundra
+(1,32810, 13494), -- Sholazar Basin
+(1,32811, 13495), -- Dragonblight
+(1,32815, 13499), -- Crystalsong Forest
+(1,32814, 13498), -- Storm Peaks
+(1,32813, 13497), -- Grizzly Hills
+(1,32812, 13496), -- Howling Fjords
+(1,25933, 11850), -- Ghostland // Honor the Flame (Horde) - Eastern Kingdoms
+(1,25931, 11848), -- Eversong woods
+(1,25935, 11853), -- Hillsbrad Foothills
+(1,25941, 11857), -- Swamp of sorrows
+(1,25920, 11837), -- Cape of Stranglethorn
+(1,25927, 11844), -- Burning Steppes
+(1,25944, 11860), -- The Hinterlands
+(1,25939, 11584), -- Silverpine Forest
+(1,25946, 11862), -- Tirisfal Glades
+(1,25925, 11842), -- Badlands
+(1,25923, 11840), -- Arathi Highlands
+(1,25883, 11805), -- Ashenvale // Honor the Flame (Alliance) - Kalimdor
+(1,25894, 11812), -- Desolace
+(1,25897, 11815), -- Dustwallow Marsh
+(1,25917, 11834), -- Winterspring
+(1,25916, 11833), -- Tanaris
+(1,25914, 11831), -- Silithus
+(1,25899, 11817), -- Feralas
+(1,25893, 11811), -- Darkshore
+(1,25888, 11806), -- Azuremyst Isle
+(1,25891, 11809), -- Bloodmyst Isle
+(1,25906, 11824), -- Teldrassil
+(1,25908, 11826), -- The Hinterlands // Honor the Flame (Alliance) - Eeastern Kingdoms
+(1,25909, 11827), -- The Western Plaguelands
+(1,25901, 11819), -- Hillsbrad Foothills
+(1,25910, 11583), -- Westfall
+(1,25911, 11828), -- Wetlands
+(1,25898, 11816), -- Elwynn Forest
+(1,25892, 11810), -- Burning Steppes
+(1,25890, 11808), -- Blasted Lands
+(1,25887, 11804), -- Arathi Highlands
+(1,25915, 11832), -- Cape of Stranglethorn
+(1,25895, 11813), -- Dun Morogh
+(1,25896, 11814), -- Duskwood
+(1,25902, 11820), -- Loch Modan
+(1,25904, 11822), -- Redridge Mountains
+(1,32801, 13485), -- Borean Tundra // Honor the Flame (Alliance) - Northrend
+(1,32803, 13487), -- Dragonblight
+(1,32805, 13489), -- Grizzly
+(1,32804, 13488), -- Howling Fjord
+(1,32808, 13492), -- Zul'Drak
+(1,32806, 13490), -- The Storm Peaks
+(1,32802, 13486), -- Sholazar Basin
+(1,32807, 13491), -- Crystalsong Forest
+(1,25905, 11823), -- Shadowmoon Valley // Honor the Flame (Alliance) - Outland
+(1,25903, 11821), -- Nagrand
+(1,25913, 11830), -- Netherstorm
+(1,25900, 11818), -- Hellfire Peninsula
+(1,25907, 11825), -- Terokkar
+(1,25889, 11807), -- Blade's Edge
+(1,25912, 11829), -- Zangarmarsh
+(1,26221, 11917), -- Striking Back
+(1,26221, 11947), -- Striking Back
+(1,26221, 11948), -- Striking Back
+(1,26221, 11952), -- Striking Back
+(1,26221, 11953), -- Striking Back
+(1,26221, 11954), -- Striking Back
+(1,26221, 11886), -- Unusual Activity
+(1,25324, 11891), -- An Innocent Disguise
+(1,25324, 12012), -- Inform the Elder
+(1,26221, 11955), -- Ahune, the Frost Lord
+(1,25710, 11696), -- Ahune is Here!
+(1,25697, 11691), -- Summon Ahune
+(1,19169, 11971), -- The Spinner of Summer Tales /Horde/
+(1,19178, 11971), -- The Spinner of Summer Tales
+(1,19175, 11971), -- The Spinner of Summer Tales
+(1,19176, 11971), -- The Spinner of Summer Tales
+(1,19177, 11971), -- The Spinner of Summer Tales
+(1,20102, 11971), -- The Spinner of Summer Tales
+(1,19171, 11970), -- The Master of Summer Lore /Alliance/
+(1,19148, 11970), -- The Master of Summer Lore
+(1,19172, 11970), -- The Master of Summer Lore
+(1,18927, 11970), -- The Master of Summer Lore
+(1,19173, 11970), -- The Master of Summer Lore
+(1,20102, 11970), -- The Master of Summer Lore
+(1,16818, 11966), -- Incense for the Festival Scorchlings
+(1,16817, 11964), -- Incense for the Summer Scorchlings
+(1,26113, 11922), -- Torch Tossing /H/
+(1,26113, 11923), -- Torch Catching /H/
+(1,26113, 11926), -- More Torch Tossing /H/
+(1,26113, 11925), -- More Torch Catching /H/
+(1,25975, 11731), -- Torch Tossing /A/
+(1,25975, 11657), -- Torch Catching /A/
+(1,25975, 11921), -- More Torch Tossing /A/
+(1,25975, 11924), -- More Torch Catching /A/
+(1,16818, 9339), -- A Thief''s Reward /H/
+(1,16817, 9365); -- A Thief''s Reward /A/
+DELETE FROM `game_event_gameobject_quest` WHERE `quest` IN (11767,11778,11787,11782,11799,11779,11775,11734,11741,11744,11763,11762,11760,11746,11740,11735,11738,11753,11755,11756,11748,11581,11757,11745,11739,11737,11732,11761,11742,11743,11749,11751,13440,13443,13445,13444,13449,13446,13442,13447,11752,11750,11759,11747,11754,11736,11758,11770,11769,11777,11803,11783,11773,11765,11771,11785,11800,11780,11802,11774,11772,11776,11781,11801,11768,11784,11580,11786,11766,11764,13458,13441,13450,13451,13457,13455,13454,13453);
+INSERT INTO `game_event_gameobject_quest` (`eventEntry`,`id`, `quest`) VALUES
+(1,187916, 11734), -- Ashenvale // Desecrate the Flame (Horde) - Kalimdor
+(1,187924, 11741), -- Desolace
+(1,187927, 11744), -- Dustwallow Marsh
+(1,187946, 11763), -- Winterspring
+(1,187945, 11762), -- Tanaris
+(1,187943, 11760), -- Silithus
+(1,187929, 11746), -- Feralas
+(1,187923, 11740), -- Darkshore
+(1,187917, 11735), -- Azuremyst Isle
+(1,187921, 11738), -- Bloodmyst Isle
+(1,187936, 11753), -- Teldrassil
+(1,187938, 11755), -- The Hinterlands // Desecrate the Flame (Horde) - Eeastern Kingdoms
+(1,187939, 11756), -- The Western Plaguelands
+(1,187931, 11748), -- Hillsbrad Foothills
+(1,187564, 11581), -- Westfall
+(1,187940, 11757), -- Wetlands
+(1,187928, 11745), -- Elwynn Forest
+(1,187922, 11739), -- Burning Steppes
+(1,187920, 11737), -- Blasted Lands
+(1,187914, 11732), -- Arathi Highlands
+(1,187944, 11761), -- Cape of Stranglethorn
+(1,187925, 11742), -- Dun Morogh
+(1,187926, 11743), -- Duskwood
+(1,187932, 11749), -- Loch Modan
+(1,187934, 11751), -- Redridge Mountains
+(1,194032, 13440), -- Borean Tundra // Desecrate the Flame (Horde) - Northrend
+(1,194036, 13443), -- Dragonblight
+(1,194040, 13445), -- Grizzly
+(1,194038, 13444), -- Howling Fjord
+(1,194049, 13449), -- Zul'Drak
+(1,194044, 13446), -- The Storm Peaks
+(1,194035, 13442), -- Sholazar Basin
+(1,194045, 13447), -- Crystalsong Forest
+(1,187935, 11752), -- Shadowmoon Valley // Desecrate the Flame (Horde) - Outland
+(1,187933, 11750), -- Nagrand
+(1,187942, 11759), -- Netherstorm
+(1,187930, 11747), -- Hellfire Peninsula
+(1,187937, 11754), -- Terokkar
+(1,187919, 11736), -- Blade's Edge
+(1,187941, 11758), -- Zangarmarsh
+(1,187958, 11770), -- Durotar // Desecrate the Flame (Alliance) - Kalimdor
+(1,187957, 11769), -- Desolace
+(1,187965, 11777), -- Mulgore
+(1,187953, 11803), -- Winterspring
+(1,187971, 11783), -- Barrens
+(1,187961, 11773), -- Feralas
+(1,187948, 11765), -- Ashenvale
+(1,187959, 11771), -- Dustwallow marsh
+(1,187973, 11785), -- Thousand Needles
+(1,187950, 11800), -- Silithus
+(1,187968, 11780), -- Stonetalon Mountains
+(1,187952, 11802), -- Tanaris
+(1,187962, 11774), -- Ghostland // Desecrate the Flame (Alliance) - Eeastern Kingdoms
+(1,187960, 11772), -- Eversong woods
+(1,187964, 11776), -- Hillsbrad Foothills
+(1,187969, 11781), -- Swamp of sorrows
+(1,187951, 11801), -- Cape of Stranglethorn
+(1,187956, 11768), -- Burning Steppes
+(1,187972, 11784), -- The Hinterlands
+(1,187559, 11580), -- Silverpine Forest
+(1,187974, 11786), -- Tirisfal Glades
+(1,187954, 11766), -- Badlands
+(1,187947, 11764), -- Arathi Highlands
+(1,187963, 11775), -- Hellfire Peninsula // Desecrate the Flame (Alliance) - Outland
+(1,187967, 11779), -- Shadowmoon Valley
+(1,187949, 11799), -- Netherstorm
+(1,187970, 11782), -- Terokkar
+(1,187975, 11787), -- Zangarmarsh
+(1,187955, 11767), -- Blade' Edge
+(1,187966, 11778), -- Nagrand
+(1,194048, 13458), -- Zul'Drak // Desecrate the Flame (Alliance) - Northend
+(1,194033, 13441), -- Borean Tundra
+(1,194034, 13450), -- Sholazar Basin
+(1,194037, 13451), -- Dragonblight
+(1,194046, 13457), -- Crystalsong Forest
+(1,194043, 13455), -- Storm Peaks
+(1,194042, 13454), -- Grizzly Hills
+(1,194039, 13453); -- Howling Fjords
diff --git a/sql/old/3.3.5a/2012_08_05_00_world_trinity_string.sql b/sql/old/3.3.5a/2012_08_05_00_world_trinity_string.sql
new file mode 100644
index 00000000000..e432f598c02
--- /dev/null
+++ b/sql/old/3.3.5a/2012_08_05_00_world_trinity_string.sql
@@ -0,0 +1,5 @@
+DELETE FROM `trinity_string` WHERE `entry` IN (5032,5033,5034);
+INSERT INTO `trinity_string` (`entry`,`content_default`,`content_loc1`,`content_loc2`,`content_loc3`,`content_loc4`,`content_loc5`,`content_loc6`,`content_loc7`,`content_loc8`) VALUES
+(5032,'No battleground found!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL),
+(5033,'No achievement criteria found!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL),
+(5034,'No outdoor PvP found!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL);
diff --git a/sql/old/3.3.5a/2012_08_05_01_world_command.sql b/sql/old/3.3.5a/2012_08_05_01_world_command.sql
new file mode 100644
index 00000000000..f19bfe1c0d0
--- /dev/null
+++ b/sql/old/3.3.5a/2012_08_05_01_world_command.sql
@@ -0,0 +1,19 @@
+DELETE FROM `command` WHERE `name` IN (
+'disable add quest','disable add map','disable add battleground','disable add achievement_criteria','disable add spell','disable add outdoorpvp','disable add vmap',
+'disable remove quest','disable remove map','disable remove battleground','disable remove achievement_criteria','disable remove spell','disable remove outdoorpvp','disable remove vmap'
+);
+INSERT INTO `command` (`name`,`security`,`help`) VALUES
+('disable add quest',3,'Syntax: .disable add quest $entry $flag $comment'),
+('disable add map',3,'Syntax: .disable add map $entry $flag $comment'),
+('disable add battleground',3,'Syntax: .disable add battleground $entry $flag $comment'),
+('disable add achievement_criteria',3,'Syntax: .disable add achievement_criteria $entry $flag $comment'),
+('disable add spell',3,'Syntax: .disable add spell $entry $flag $comment'),
+('disable add outdoorpvp',3,'Syntax: .disable add outdoorpvp $entry $flag $comment'),
+('disable add vmap',3,'Syntax: .disable add vmap $entry $flag $comment'),
+('disable remove quest',3,'Syntax: .disable remove quest $entry'),
+('disable remove map',3,'Syntax: .disable remove map $entry'),
+('disable remove battleground',3,'Syntax: .disable remove battleground $entry'),
+('disable remove achievement_criteria',3,'Syntax: .disable remove achievement_criteria $entry'),
+('disable remove spell',3,'Syntax: .disable remove spell $entry'),
+('disable remove outdoorpvp',3,'Syntax: .disable remove outdoorpvp $entry'),
+('disable remove vmap',3,'Syntax: .disable remove vmap $entry');
diff --git a/sql/old/3.3.5a/2012_08_06_00_auth_logs.sql b/sql/old/3.3.5a/2012_08_06_00_auth_logs.sql
new file mode 100644
index 00000000000..04e90e7d208
--- /dev/null
+++ b/sql/old/3.3.5a/2012_08_06_00_auth_logs.sql
@@ -0,0 +1,2 @@
+ALTER TABLE `logs` ADD COLUMN `level` TINYINT(3) UNSIGNED NOT NULL DEFAULT 0 AFTER `type`;
+
diff --git a/sql/old/3.3.5a/2012_08_06_00_world_command.sql b/sql/old/3.3.5a/2012_08_06_00_world_command.sql
new file mode 100644
index 00000000000..50628aaa589
--- /dev/null
+++ b/sql/old/3.3.5a/2012_08_06_00_world_command.sql
@@ -0,0 +1,4 @@
+DELETE FROM `command` WHERE `name` IN ('server togglequerylog', 'server set loglevel');
+
+INSERT INTO `command` (`name`,`security`,`help`) VALUES
+('server set loglevel',4,'Syntax: .server set loglevel $facility $name $loglevel. $facility can take the values: appender (a) or logger (l). $loglevel can take the values: disabled (0), trace (1), debug (2), info (3), warn (4), error (5) or fatal (6)');
diff --git a/sql/old/3.3.5a/2012_08_07_00_characters_characters.sql b/sql/old/3.3.5a/2012_08_07_00_characters_characters.sql
new file mode 100644
index 00000000000..e9bea82ad4b
--- /dev/null
+++ b/sql/old/3.3.5a/2012_08_07_00_characters_characters.sql
@@ -0,0 +1,2 @@
+UPDATE characters SET drunk = (drunk / 256) & 0xFF;
+ALTER TABLE characters CHANGE drunk drunk tinyint(3) unsigned NOT NULL DEFAULT '0';
diff --git a/sql/old/3.3.5a/2012_08_09_00_world_creature_template.sql b/sql/old/3.3.5a/2012_08_09_00_world_creature_template.sql
new file mode 100644
index 00000000000..8d04c13dc87
--- /dev/null
+++ b/sql/old/3.3.5a/2012_08_09_00_world_creature_template.sql
@@ -0,0 +1,6 @@
+UPDATE `creature_template` SET `npcflag`=`npcflag` |2 WHERE `entry` IN (25918,25929,25931,25933,25936,25938,25946,32811,32812,32813,32816);
+
+DELETE FROM `creature_loot_template` WHERE `entry` IN(17465,20583) AND `item`=22554;
+INSERT INTO `creature_loot_template` (`entry`,`item`,`ChanceOrQuestChance`,`lootmode`,`groupid`,`mincountOrRef`,`maxcount`) VALUES
+(17465,22554,15,1,0,1,1), -- Formula: Enchant 2H Weapon - Savagery
+(20583,22554,15,1,0,1,1); -- Formula: Enchant 2H Weapon - Savagery
diff --git a/sql/old/3.3.5a/2012_08_09_01_world_sai.sql b/sql/old/3.3.5a/2012_08_09_01_world_sai.sql
new file mode 100644
index 00000000000..94dce1bcc2c
--- /dev/null
+++ b/sql/old/3.3.5a/2012_08_09_01_world_sai.sql
@@ -0,0 +1,48 @@
+-- Territorial Trespass (13051)
+
+SET @NPC_VERANUS := 30461;
+SET @QUEST := 13051;
+SET @EVENT := 19714;
+SET @NPC_THORIM := 30462;
+SET @SPELL_MOUNT := 43671;
+
+UPDATE `creature_template` SET `HoverHeight`=10.8,`speed_walk`=3.2,`speed_run`=1.42857146263123,`VehicleId`=237,`minlevel`=80,`faction_A`=14,`faction_H`=14,`unit_flags`=0x8140,`InhabitType`=5 WHERE `entry`=@NPC_VERANUS;
+
+DELETE FROM `creature_template_addon` WHERE `entry`=@NPC_VERANUS;
+INSERT INTO `creature_template_addon` (`entry`,`mount`,`bytes1`,`bytes2`,`auras`) VALUES
+(@NPC_VERANUS,0,0x3000000,0x1,'');
+
+DELETE FROM `creature_text` WHERE `entry` IN (@NPC_VERANUS,@NPC_THORIM);
+INSERT INTO `creature_text` (`entry`,`groupid`,`id`,`text`,`type`,`language`,`probability`,`emote`,`duration`,`sound`,`comment`) VALUES
+(@NPC_VERANUS,0,0,'%s lets out a bellowing roar as she descends upon the nest.',16,0,100,15,0,0,'Veranus'),
+(@NPC_THORIM,0,0,'Look out below!',14,0,100,0,0,0,'Thorim'),
+(@NPC_THORIM,1,0,'Easy there, girl! Don''t you recognize your old master?',12,0,100,0,0,0,'Thorim'),
+(@NPC_THORIM,2,0,'I will see you at the Temple of Storms. Looks like I''m going to have to break her in again.',12,0,100,0,0,0,'Thorim');
+
+-- Veranus SAI
+UPDATE `creature_template` SET `AIName`='SmartAI' WHERE `entry` IN (@NPC_VERANUS,@NPC_THORIM);
+DELETE FROM `smart_scripts` WHERE (`entryorguid` IN (@NPC_VERANUS,@NPC_THORIM) AND `source_type`=0) OR (`entryorguid`=@NPC_THORIM*100 AND `source_type`=9);
+INSERT INTO `smart_scripts` (`entryorguid`,`source_type`,`id`,`link`,`event_type`,`event_phase_mask`,`event_chance`,`event_flags`,`event_param1`,`event_param2`,`event_param3`,`event_param4`,`action_type`,`action_param1`,`action_param2`,`action_param3`,`action_param4`,`action_param5`,`action_param6`,`target_type`,`target_param1`,`target_param2`,`target_param3`,`target_x`,`target_y`,`target_z`,`target_o`,`comment`) VALUES
+(@NPC_VERANUS,0,0,0,54,0,100,0,0,0,0,0,53,1,@NPC_VERANUS,0,@QUEST,0,0,1,0,0,0,0,0,0,0,'Veranus - On Summoned - Start WP-Movement'),
+(@NPC_VERANUS,0,1,2,58,0,100,0,1,0,0,0,1,0,0,0,0,0,0,1,0,0,0,0,0,0,0,'Veranus - On WP-End - Talk(emote)'),
+(@NPC_VERANUS,0,2,3,61,0,100,0,1,0,0,0,33,@NPC_VERANUS,0,0,0,0,0,7,0,0,0,0,0,0,0,'Veranus - On WP-End - Give quest credit'),
+(@NPC_VERANUS,0,3,0,61,0,100,0,0,0,0,0,12,@NPC_THORIM,8,0,0,0,0,8,0,0,0,7096.863,-904.658,1119.904,2.338741,'Veranus - On WP-End - Summon Thorim'),
+(@NPC_VERANUS,0,4,5,38,0,100,0,1,1,0,0,46,100,0,0,0,0,0,1,0,0,0,0,0,0,0,'Veranus - On data - Move forward'),
+(@NPC_VERANUS,0,5,0,61,0,100,0,0,0,0,0,41,10000,0,0,0,0,0,1,0,0,0,0,0,0,0,'Veranus - On data - despawn'),
+--
+(@NPC_THORIM,0,0,0,54,0,100,0,0,0,0,0,80,@NPC_THORIM*100,2,0,0,0,0,1,0,0,0,0,0,0,0,'Thorim - On Summoned - Start script'),
+(@NPC_THORIM,0,1,0,38,0,100,0,1,1,0,0,41,10000,0,0,0,0,0,1,0,0,0,0,0,0,0,'Thorim - On data - despawn'),
+(@NPC_THORIM*100,9,0,0,0,0,100,0,0,0,0,0,1,0,0,0,0,0,0,1,0,0,0,0,0,0,0,'Thorim - On Script - Talk(yell)'),
+(@NPC_THORIM*100,9,1,0,0,0,100,0,0,0,0,0,11,@SPELL_MOUNT,0,0,0,0,0,7,0,0,0,0,0,0,0,'Thorim - On Script - Cast spell mount'),
+(@NPC_THORIM*100,9,2,0,0,0,100,0,10000,10000,0,0,1,1,0,0,0,0,0,1,0,0,0,0,0,0,0,'Thorim - On Script - Talk(say)'),
+(@NPC_THORIM*100,9,3,0,0,0,100,0,5000,5000,0,0,1,2,1000,0,0,0,0,1,0,0,0,0,0,0,0,'Thorim - On Script - Talk(say)'),
+(@NPC_THORIM*100,9,4,0,0,0,100,0,0,0,0,0,45,1,1,0,0,0,0,7,0,0,0,0,0,0,0,'Thorim - On Script - Set data'),
+(@NPC_THORIM*100,9,5,0,0,0,100,0,0,0,0,0,45,1,1,0,0,0,0,1,0,0,0,0,0,0,0,'Thorim - On Script - Set data');
+
+DELETE FROM `waypoints` WHERE `entry`=@NPC_VERANUS;
+INSERT INTO `waypoints` (`entry`,`pointid`,`position_x`,`position_y`,`position_z`,`point_comment`) VALUES
+(@NPC_VERANUS,1,7083.224,-912.2372,1090.213,'Veranus - WP1');
+
+DELETE FROM `event_scripts` WHERE `id`=@EVENT;
+INSERT INTO `event_scripts` (`id`,`delay`,`command`,`datalong`,`datalong2`,`dataint`,`x`,`y`,`z`,`o`) VALUES
+(@EVENT,0,10,@NPC_VERANUS,600000,0,6947.481,-859.5176,1147.604,5.674867);
diff --git a/sql/old/3.3.5a/2012_08_10_00_world_conditions.sql b/sql/old/3.3.5a/2012_08_10_00_world_conditions.sql
new file mode 100644
index 00000000000..14c5c570b6e
--- /dev/null
+++ b/sql/old/3.3.5a/2012_08_10_00_world_conditions.sql
@@ -0,0 +1,7 @@
+SET @ENTRY := 27482; -- Wounded Westfall Infantry npc
+SET @SPELL := 48845; -- Renew Infantry spell
+SET @ITEM := 37576; -- Renewing Bandage item
+DELETE FROM `conditions` WHERE `SourceTypeOrReferenceId`=18 AND `SourceEntry`=@ITEM;
+DELETE FROM `conditions` WHERE `SourceTypeOrReferenceId`=17 AND `SourceEntry`=@SPELL;
+INSERT INTO `conditions` (`SourceTypeOrReferenceId`,`SourceGroup`,`SourceEntry`,`ElseGroup`,`ConditionTypeOrReference`,`ConditionTarget`,`ConditionValue1`,`ConditionValue2`,`ConditionValue3`,`NegativeCondition`,`ErrorTextId`,`ScriptName`,`Comment`) VALUES
+(17,0,@SPELL,0,31,1,3,@ENTRY,0,0,0,'', "Item Renewing Bandage target Wounded Westfall Infantry");
diff --git a/sql/old/3.3.5a/2012_08_10_01_world_loot_template.sql b/sql/old/3.3.5a/2012_08_10_01_world_loot_template.sql
new file mode 100644
index 00000000000..07d400dc0d7
--- /dev/null
+++ b/sql/old/3.3.5a/2012_08_10_01_world_loot_template.sql
@@ -0,0 +1,25 @@
+-- Emperor Vek'nilash update loot chance based on http://old.wowhead.com/npc=15275#drops:0+1-15 by nelegalno
+UPDATE `creature_loot_template` SET `ChanceOrQuestChance`=11 WHERE `entry`=15275 AND `item`=21606; -- Belt of the Fallen Emperor
+UPDATE `creature_loot_template` SET `ChanceOrQuestChance`=12 WHERE `entry`=15275 AND `item`=21604; -- Bracelets of Royal Redemption
+UPDATE `creature_loot_template` SET `ChanceOrQuestChance`=11 WHERE `entry`=15275 AND `item`=21605; -- Gloves of the Hidden Temple
+UPDATE `creature_loot_template` SET `ChanceOrQuestChance`=11 WHERE `entry`=15275 AND `item`=21607; -- Grasp of the Fallen Emperor
+UPDATE `creature_loot_template` SET `ChanceOrQuestChance`= 7 WHERE `entry`=15275 AND `item`=21679; -- Kalimdor's Revenge
+UPDATE `creature_loot_template` SET `ChanceOrQuestChance`=11 WHERE `entry`=15275 AND `item`=21609; -- Regenerating Belt of Vek'nilash
+UPDATE `creature_loot_template` SET `ChanceOrQuestChance`=63 WHERE `entry`=15275 AND `item`=20726; -- Formula: Enchant Gloves - Threat
+
+-- Emperor Vek'lor update loot chance based on http://old.wowhead.com/npc=15276#drops:0+1-15 by nelegalno
+UPDATE `creature_loot_template` SET `ChanceOrQuestChance`=11 WHERE `entry`=15276 AND `item`=21600; -- Boots of Epiphany
+UPDATE `creature_loot_template` SET `ChanceOrQuestChance`=13 WHERE `entry`=15276 AND `item`=21602; -- Qiraji Execution Bracers
+UPDATE `creature_loot_template` SET `ChanceOrQuestChance`=13 WHERE `entry`=15276 AND `item`=21601; -- Ring of Emperor Vek'lor
+UPDATE `creature_loot_template` SET `ChanceOrQuestChance`=14 WHERE `entry`=15276 AND `item`=21598; -- Royal Qiraji Belt
+UPDATE `creature_loot_template` SET `ChanceOrQuestChance`= 7 WHERE `entry`=15276 AND `item`=21597; -- Royal Scepter of Vek'lor
+UPDATE `creature_loot_template` SET `ChanceOrQuestChance`=13 WHERE `entry`=15276 AND `item`=21599; -- Vek'lor's Gloves of Devastation
+UPDATE `creature_loot_template` SET `ChanceOrQuestChance`=64 WHERE `entry`=15276 AND `item`=20735; -- Formula: Enchant Cloak - Subtlety
+
+-- Princess Huhuran update loot chance based on http://old.wowhead.com/npc=15509#drops:0+1-15 by nelegalno
+UPDATE `creature_loot_template` SET `ChanceOrQuestChance`=15 WHERE `entry`=15509 AND `item`=21621; -- Cloak of the Golden Hive
+UPDATE `creature_loot_template` SET `ChanceOrQuestChance`=15 WHERE `entry`=15509 AND `item`=21619; -- Gloves of the Messiah
+UPDATE `creature_loot_template` SET `ChanceOrQuestChance`=16 WHERE `entry`=15509 AND `item`=21618; -- Hive Defiler Wristguards
+UPDATE `creature_loot_template` SET `ChanceOrQuestChance`= 8 WHERE `entry`=15509 AND `item`=21616; -- Huhuran's Stinger
+UPDATE `creature_loot_template` SET `ChanceOrQuestChance`=17 WHERE `entry`=15509 AND `item`=21620; -- Ring of the Martyr
+UPDATE `creature_loot_template` SET `ChanceOrQuestChance`=14 WHERE `entry`=15509 AND `item`=21617; -- Wasphide Gauntlets
diff --git a/sql/old/3.3.5a/2012_08_10_02_world_script_texts.sql b/sql/old/3.3.5a/2012_08_10_02_world_script_texts.sql
new file mode 100644
index 00000000000..0b97df592e1
--- /dev/null
+++ b/sql/old/3.3.5a/2012_08_10_02_world_script_texts.sql
@@ -0,0 +1,6 @@
+UPDATE `script_texts` SET `sound`=14036 WHERE `entry` = -1619015;
+UPDATE `script_texts` SET `sound`=14037 WHERE `entry` = -1619016;
+UPDATE `script_texts` SET `sound`=14038 WHERE `entry` = -1619017;
+UPDATE `script_texts` SET `sound`=14039 WHERE `entry` = -1619018;
+UPDATE `script_texts` SET `sound`=14034 WHERE `entry` = -1619019;
+UPDATE `script_texts` SET `sound`=14035 WHERE `entry` = -1619020;
diff --git a/sql/old/3.3.5a/2012_08_10_03_world_quest_template.sql b/sql/old/3.3.5a/2012_08_10_03_world_quest_template.sql
new file mode 100644
index 00000000000..c4aebf5ba16
--- /dev/null
+++ b/sql/old/3.3.5a/2012_08_10_03_world_quest_template.sql
@@ -0,0 +1,18 @@
+-- Zandalar Tribe Quests Required Class/Race fix by nelegalno
+
+-- Maywiki of Zuldazar Quests Required Class
+UPDATE `quest_template` SET `RequiredClasses` = 64 WHERE `Id` IN (8056,8074,8075,8116,8117,8118,8119); -- Shaman
+UPDATE `quest_template` SET `RequiredClasses` = 1024 WHERE `Id` IN (8057,8064,8065,8110,8111,8112,8113); -- Druid
+
+-- Al'tabim the All-Seeing Quests Required Class
+UPDATE `quest_template` SET `RequiredClasses` = 16 WHERE `Id` IN (8049,8050,8051,8052,8061,8070,8071); -- Priest
+UPDATE `quest_template` SET `RequiredClasses` = 128 WHERE `Id` IN (8060,8068,8069,8101,8102,8103,8104); -- Mage
+UPDATE `quest_template` SET `RequiredClasses` = 256 WHERE `Id` IN (8059,8076,8077,8106,8107,8108,8109); -- Warlock
+
+-- Falthir the Sightless Quests Required Class
+UPDATE `quest_template` SET `RequiredClasses` = 4 WHERE `Id` IN (8062,8066,8067,8145,8146,8147,8148); -- Hunter
+UPDATE `quest_template` SET `RequiredClasses` = 8 WHERE `Id` IN (8063,8072,8073,8141,8142,8143,8144); -- Rogue
+UPDATE `quest_template` SET `RequiredRaces` = 152 WHERE `Id` = 8144; -- Night Elf, Undead and Troll
+
+-- Jin'rokh the Breaker
+UPDATE `quest_template` SET `RequiredRaces` = 513 WHERE `Id` = 8048; -- Human and Blood Elf
diff --git a/sql/old/3.3.5a/2012_08_10_04_world_gossip.sql b/sql/old/3.3.5a/2012_08_10_04_world_gossip.sql
new file mode 100644
index 00000000000..a2082447dfc
--- /dev/null
+++ b/sql/old/3.3.5a/2012_08_10_04_world_gossip.sql
@@ -0,0 +1,5 @@
+-- -18754 Barim Splithoof Leather working trainer
+DELETE FROM `gossip_menu_option` WHERE `menu_id`=7816;
+INSERT INTO `gossip_menu_option` VALUES
+(7816,0,3, 'I would like to train.', 5,16,0,0,0,0,NULL),
+(7816,1,1, 'Let me browse your goods.', 3,128,0,0,0,0,NULL);
diff --git a/sql/old/3.3.5a/2012_08_10_05_world_quest_template.sql b/sql/old/3.3.5a/2012_08_10_05_world_quest_template.sql
new file mode 100644
index 00000000000..a65e7e76a44
--- /dev/null
+++ b/sql/old/3.3.5a/2012_08_10_05_world_quest_template.sql
@@ -0,0 +1,2 @@
+-- Change $B$$B at end of details text to $B$B
+UPDATE `quest_template` SET `Details`='Brave traveler, the centaurs have increased their attacks in this area. Freewind Post must know about this renewed harassment immediately! Seek Cliffwatcher Longhorn at Freewind Post to the southeast and give him this urgent message.$b$bBe warned, avoid the Grimtotem Clan nearby... they have been acting strange toward us lately.$B$B' WHERE `Id`=4542;
diff --git a/sql/old/3.3.5a/2012_08_10_06_world_creature.sql b/sql/old/3.3.5a/2012_08_10_06_world_creature.sql
new file mode 100644
index 00000000000..3d59f06db78
--- /dev/null
+++ b/sql/old/3.3.5a/2012_08_10_06_world_creature.sql
@@ -0,0 +1,16 @@
+SET @CGUID:=42571; -- Need 2
+DELETE FROM `creature` WHERE `id` IN (30395,30469);
+INSERT INTO `creature` (`guid`,`id`,`map`,`spawnMask`,`phaseMask`,`modelid`,`equipment_id`,`position_x`,`position_y`,`position_z`,`orientation`,`spawntimesecs`,`spawndist`,`currentwaypoint`,`curhealth`,`curmana`,`MovementType`,`npcflag`,`unit_flags`,`dynamicflags`) VALUES
+(@CGUID+0,30395,571,1,1,0,0,8348.886,-2509.476,1147.369,3.700098,120,0,0,12600,0,0,0,0,0),
+(@CGUID+1,30469,571,1,1,0,0,7620.369,-1609.421,969.6507,0.767944,120,0,0,12600,0,0,0,0,0);
+
+-- Template updates
+UPDATE `creature_template` SET `npcflag`=`npcflag`|3 WHERE `entry`=30395; -- Chieftain Swiftspear
+UPDATE `creature_template` SET `faction_A`=1978,`faction_H`=1978 WHERE `entry`=30469; -- Tracker Val'zij
+-- Model data
+UPDATE `creature_model_info` SET `bounding_radius`=0.6076385,`combat_reach`=2.625,`gender`=0 WHERE `modelid`=27004; -- Chieftain Swiftspear
+-- Addon data
+DELETE FROM `creature_template_addon` WHERE `entry`IN (30395,30469);
+INSERT INTO `creature_template_addon` (`entry`,`mount`,`bytes1`,`bytes2`,`emote`,`auras`) VALUES
+(30395,0,0,1,0, NULL), -- Chieftain Swiftspear
+(30469,0,8,1,0, NULL); -- Tracker Val'zij
diff --git a/sql/old/3.3.5a/2012_08_11_00_world_creature_template.sql b/sql/old/3.3.5a/2012_08_11_00_world_creature_template.sql
new file mode 100644
index 00000000000..972b125d247
--- /dev/null
+++ b/sql/old/3.3.5a/2012_08_11_00_world_creature_template.sql
@@ -0,0 +1 @@
+UPDATE `creature_template` SET `lootid`=`entry` WHERE `entry` IN (17465,20583);
diff --git a/sql/old/3.3.5a/2012_08_11_01_world_quest_poi.sql b/sql/old/3.3.5a/2012_08_11_01_world_quest_poi.sql
new file mode 100644
index 00000000000..6672df2bc98
--- /dev/null
+++ b/sql/old/3.3.5a/2012_08_11_01_world_quest_poi.sql
@@ -0,0 +1,60 @@
+-- PK and new index for quest_poi
+ALTER TABLE `quest_poi` DROP INDEX `questId`;
+ALTER TABLE `quest_poi` DROP INDEX `id`;
+ALTER TABLE `quest_poi` ADD PRIMARY KEY (`questId`, `id`);
+ALTER TABLE `quest_poi` ADD INDEX `idx` (`questId`, `id`);
+
+-- Correct data for quest_poi_points that violate the PK
+UPDATE `quest_poi_points` SET `idx`=0 WHERE `questId`=25446 AND `id`=0 AND `x`=-1041 AND `y`=-5585;
+UPDATE `quest_poi_points` SET `idx`=1 WHERE `questId`=25446 AND `id`=0 AND `x`=-1062 AND `y`=-5631;
+UPDATE `quest_poi_points` SET `idx`=2 WHERE `questId`=25446 AND `id`=0 AND `x`=-1066 AND `y`=-5375;
+UPDATE `quest_poi_points` SET `idx`=3 WHERE `questId`=25446 AND `id`=0 AND `x`=-1189 AND `y`=-5343;
+UPDATE `quest_poi_points` SET `idx`=4 WHERE `questId`=25446 AND `id`=0 AND `x`=-1195 AND `y`=-5618;
+UPDATE `quest_poi_points` SET `idx`=5 WHERE `questId`=25446 AND `id`=0 AND `x`=-1269 AND `y`=-5386;
+UPDATE `quest_poi_points` SET `idx`=6 WHERE `questId`=25446 AND `id`=0 AND `x`=-1289 AND `y`=-5571;
+UPDATE `quest_poi_points` SET `idx`=7 WHERE `questId`=25446 AND `id`=0 AND `x`=-1320 AND `y`=-5477;
+UPDATE `quest_poi_points` SET `idx`=8 WHERE `questId`=25446 AND `id`=0 AND `x`=-1322 AND `y`=-5527;
+UPDATE `quest_poi_points` SET `idx`=0 WHERE `questId`=25446 AND `id`=1 AND `x`=-1502 AND `y`=-5263;
+UPDATE `quest_poi_points` SET `idx`=1 WHERE `questId`=25446 AND `id`=1 AND `x`=-1532 AND `y`=-5341;
+UPDATE `quest_poi_points` SET `idx`=2 WHERE `questId`=25446 AND `id`=1 AND `x`=-1589 AND `y`=-5340;
+UPDATE `quest_poi_points` SET `idx`=3 WHERE `questId`=25446 AND `id`=1 AND `x`=-1611 AND `y`=-5276;
+UPDATE `quest_poi_points` SET `idx`=4 WHERE `questId`=25446 AND `id`=2 AND `x`=-1020 AND `y`=-5153;
+UPDATE `quest_poi_points` SET `idx`=5 WHERE `questId`=25446 AND `id`=2 AND `x`=-1089 AND `y`=-5174;
+UPDATE `quest_poi_points` SET `idx`=6 WHERE `questId`=25446 AND `id`=2 AND `x`=-1128 AND `y`=-5131;
+UPDATE `quest_poi_points` SET `idx`=7 WHERE `questId`=25446 AND `id`=2 AND `x`=-0955 AND `y`=-5186;
+UPDATE `quest_poi_points` SET `idx`=0 WHERE `questId`=25446 AND `id`=3 AND `x`=-0654 AND `y`=-5627;
+UPDATE `quest_poi_points` SET `idx`=1 WHERE `questId`=25446 AND `id`=3 AND `x`=-0688 AND `y`=-5518;
+UPDATE `quest_poi_points` SET `idx`=2 WHERE `questId`=25446 AND `id`=3 AND `x`=-0730 AND `y`=-5656;
+UPDATE `quest_poi_points` SET `idx`=3 WHERE `questId`=25446 AND `id`=3 AND `x`=-0732 AND `y`=-5499;
+UPDATE `quest_poi_points` SET `idx`=4 WHERE `questId`=25446 AND `id`=3 AND `x`=-0795 AND `y`=-5544;
+UPDATE `quest_poi_points` SET `idx`=5 WHERE `questId`=25446 AND `id`=3 AND `x`=-0806 AND `y`=-5674;
+UPDATE `quest_poi_points` SET `idx`=6 WHERE `questId`=25446 AND `id`=3 AND `x`=-0835 AND `y`=-5606;
+UPDATE `quest_poi_points` SET `idx`=0 WHERE `questId`=25446 AND `id`=4 AND `x`=-0747 AND `y`=-5004;
+
+UPDATE `quest_poi_points` SET `idx`=0 WHERE `questId`=25461 AND `x`=246 AND `y`=-4715;
+UPDATE `quest_poi_points` SET `idx`=1 WHERE `questId`=25461 AND `x`=247 AND `y`=-4675;
+UPDATE `quest_poi_points` SET `idx`=2 WHERE `questId`=25461 AND `x`=248 AND `y`=-4673;
+UPDATE `quest_poi_points` SET `idx`=3 WHERE `questId`=25461 AND `x`=266 AND `y`=-4830;
+UPDATE `quest_poi_points` SET `idx`=4 WHERE `questId`=25461 AND `x`=284 AND `y`=-4628;
+UPDATE `quest_poi_points` SET `idx`=5 WHERE `questId`=25461 AND `x`=302 AND `y`=-4612;
+UPDATE `quest_poi_points` SET `idx`=6 WHERE `questId`=25461 AND `x`=343 AND `y`=-4831;
+UPDATE `quest_poi_points` SET `idx`=7 WHERE `questId`=25461 AND `x`=345 AND `y`=-4831;
+UPDATE `quest_poi_points` SET `idx`=8 WHERE `questId`=25461 AND `x`=376 AND `y`=-4778;
+UPDATE `quest_poi_points` SET `idx`=9 WHERE `questId`=25461 AND `x`=380 AND `y`=-4661;
+UPDATE `quest_poi_points` SET `idx`=10 WHERE `questId`=25461 AND `x`=411 AND `y`=-4704;
+
+UPDATE `quest_poi_points` SET `idx`=0 WHERE `questId`=25444 AND `x`=-1014 AND `y`=-4911;
+UPDATE `quest_poi_points` SET `idx`=1 WHERE `questId`=25444 AND `x`=-0644 AND `y`=-4999;
+UPDATE `quest_poi_points` SET `idx`=2 WHERE `questId`=25444 AND `x`=-0673 AND `y`=-4932;
+UPDATE `quest_poi_points` SET `idx`=3 WHERE `questId`=25444 AND `x`=-0673 AND `y`=-5062;
+UPDATE `quest_poi_points` SET `idx`=4 WHERE `questId`=25444 AND `x`=-0736 AND `y`=-5100;
+UPDATE `quest_poi_points` SET `idx`=5 WHERE `questId`=25444 AND `x`=-0740 AND `y`=-4873;
+UPDATE `quest_poi_points` SET `idx`=6 WHERE `questId`=25444 AND `x`=-0808 AND `y`=-4831;
+UPDATE `quest_poi_points` SET `idx`=7 WHERE `questId`=25444 AND `x`=-0808 AND `y`=-5100;
+UPDATE `quest_poi_points` SET `idx`=8 WHERE `questId`=25444 AND `x`=-0887 AND `y`=-5062;
+UPDATE `quest_poi_points` SET `idx`=9 WHERE `questId`=25444 AND `x`=-0892 AND `y`=-4776;
+UPDATE `quest_poi_points` SET `idx`=10 WHERE `questId`=25444 AND `x`=-0959 AND `y`=-4995;
+UPDATE `quest_poi_points` SET `idx`=11 WHERE `questId`=25444 AND `x`=-0984 AND `y`=-4785;
+
+-- PK for quest_poi_points
+ALTER TABLE `quest_poi_points` ADD PRIMARY KEY (`questId`, `id`, `idx`);
diff --git a/sql/old/3.3.5a/2012_08_12_00_world_conditions.sql b/sql/old/3.3.5a/2012_08_12_00_world_conditions.sql
new file mode 100644
index 00000000000..6e1fd0ac1db
--- /dev/null
+++ b/sql/old/3.3.5a/2012_08_12_00_world_conditions.sql
@@ -0,0 +1,3 @@
+DELETE FROM `conditions` WHERE `SourceTypeOrReferenceId`=13 AND `SourceEntry`=58124;
+INSERT INTO `conditions` (`SourceTypeOrReferenceId`,`SourceGroup`,`SourceEntry`,`SourceId`,`ElseGroup`,`ConditionTypeOrReference`,`ConditionTarget`,`ConditionValue1`,`ConditionValue2`,`ConditionValue3`,`NegativeCondition`,`ErrorTextId`,`ScriptName`,`Comment`) VALUES
+(13,1,58124,0,0,32,0,0x90,0,0,0,0,'','Mal''Ganis Kill Credit - Player target');
diff --git a/sql/old/3.3.5a/2012_08_12_01_world_spell_script_names.sql b/sql/old/3.3.5a/2012_08_12_01_world_spell_script_names.sql
new file mode 100644
index 00000000000..980aceff519
--- /dev/null
+++ b/sql/old/3.3.5a/2012_08_12_01_world_spell_script_names.sql
@@ -0,0 +1,3 @@
+DELETE FROM `spell_script_names` WHERE `spell_id`=36554;
+INSERT INTO `spell_script_names` (`spell_id`,`ScriptName`) VALUES
+(36554,'spell_rog_shadowstep');
diff --git a/sql/updates/world/2012_02_02_01_world_spell_script_names.sql b/sql/old/3.3.5a/2012_08_12_02_world_spell_script_names.sql
index 15ca9c43cc5..15ca9c43cc5 100644
--- a/sql/updates/world/2012_02_02_01_world_spell_script_names.sql
+++ b/sql/old/3.3.5a/2012_08_12_02_world_spell_script_names.sql
diff --git a/sql/old/3.3.5a/2012_08_13_00_world_creature_text.sql b/sql/old/3.3.5a/2012_08_13_00_world_creature_text.sql
new file mode 100644
index 00000000000..aeb24dbfe90
--- /dev/null
+++ b/sql/old/3.3.5a/2012_08_13_00_world_creature_text.sql
@@ -0,0 +1,133 @@
+DELETE FROM `script_texts` WHERE `entry` BETWEEN -1649999 AND -1649000;
+DELETE FROM `creature_text` WHERE `entry` IN (34996,34990,34995,36095,34796,35144,34799,34797,34780,35458,34496,34497,16980,35877,34564,34660);
+INSERT INTO `creature_text` (`entry`, `groupid`, `id`, `text`, `type`, `language`, `probability`, `emote`, `duration`, `sound`, `comment`) VALUES
+-- Highlord Tirion Fordring
+ -- Northrend Beasts
+(34996, 0, 0, 'Welcome, champions! You have heard the call of the Argent Crusade and you have boldly answered! It is here, in the Crusaders'' Coliseum, that you will face your greatest challenges. Those of you who survive the rigors of the coliseum will join the Argent Crusade on its march to Icecrown Citadel.', 14, 0, 100, 0, 0, 16036, 'Highlord Tirion Fordring - Welcome'),
+(34996, 1, 0, 'Hailing from the deepest, darkest caverns of the Storm Peaks, Gormok the Impaler! Battle on, heroes!', 14, 0, 100, 0, 0, 16038, 'Highlord Tirion Fordring - Summing Gormok the Impaler'),
+(34996, 2, 0, 'Steel yourselves, heroes, for the twin terrors, Acidmaw and Dreadscale, enter the arena!', 14, 0, 100, 0, 0, 16039, 'Highlord Tirion Fordring - Summing Acidmaw and Dreadscale'),
+(34996, 3, 0, 'The air itself freezes with the introduction of our next combatant, Icehowl! Kill or be killed, champions!', 14, 0, 100, 0, 0, 16040, 'Highlord Tirion Fordring Summing Icehowl'),
+(34996, 4, 0, 'The monstrous menagerie has been vanquished!', 14, 0, 100, 0, 0, 16041, 'Highlord Tirion Fordring - Northrend Beasts Done'),
+(34996, 5, 0, 'Tragic... They fought valiantly, but the beasts of Northrend triumphed. Let us observe a moment of silence for our fallen heroes.', 14, 0, 0, 0, 0, 16042, 'Highlord Tirion Fordring - Northrend Beasts FAIL'),
+ -- Lord Jaraxxus
+(34996, 6, 0, 'Grand Warlock Wilfred Fizzlebang will summon forth your next challenge. Stand by for his entry.', 14, 0, 100, 0, 0, 16043, 'Highlord Tirion Fordring - Summing Wilfred Fizzlebang'),
+(34996, 7, 0, 'Quickly, heroes, destroy the demon lord before it can open a portal to its twisted demonic realm!', 14, 0, 100, 5, 0, 16044, 'Highlord Tirion Fordring to Wilfred Fizzlebang - Lord Jaraxxus Intro'),
+(34996, 8, 0, 'The loss of Wilfred Fizzlebang, while unfortunate, should be a lesson to those that dare dabble in dark magic. Alas, you are victorious and must now face the next challenge.', 14, 0, 100, 0, 0, 16045, 'Highlord Tirion Fordring - Lord Jaraxxus Outro'),
+(34996, 9, 0, 'Everyone calm down! Compose yourselves! There is no conspiracy at play here! The warlock acted on his own volition, outside of influences from the Alliance. The tournament must go on!', 14, 0, 100, 5, 0, 16046, 'Highlord Tirion Fordring - Lord Jaraxxus Outro'),
+ -- Faction Champions
+(34996, 10, 0, 'The next battle will be against the Argent Crusade''s most powerful knights! Only by defeating them will you be deemed worthy...', 14, 0, 100, 0, 0, 16047, 'Highlord Tirion Fordring - Faction Champions Intro'),
+(34996, 11, 0, 'Very well. I will allow it. Fight with honor!', 14, 0, 100, 1, 0, 16048, 'Highlord Tirion Fordring - Faction Champions Intro'),
+(34996, 12, 0, 'A shallow and tragic victory. We are weaker as a whole from the losses suffered today. Who but the Lich King could benefit from such foolishness? Great warriors have lost their lives. And for what? The true threat looms ahead - the Lich King awaits us all in death.', 14, 0, 100, 0, 0, 16049, 'Highlord Tirion Fordring - Faction Champions Outro'),
+ -- Twin Val'kyr
+(34996, 13, 0, 'Only by working together will you overcome the final challenge. From the depths of Icecrown come two of the Scourge''s most powerful lieutenants: fearsome val''kyr, winged harbingers of the Lich King!', 14, 0, 100, 0, 0, 16050, 'Highlord Tirion Fordring - Twin Val''kyr Intro'),
+(34996, 14, 0, 'Let the games begin!', 14, 0, 100, 0, 0, 16037, 'Highlord Tirion Fordring - Twin Val''kyr Intro'),
+ -- Anub''arak
+(34996, 15, 0, 'A mighty blow has been dealt to the Lich King! You have proven yourselves as able bodied champions of the Argent Crusade. Together we will strike against Icecrown Citadel and destroy what remains of the Scourge! There is no challenge that we cannot face united!', 14, 0, 100, 5, 0, 16051, 'Highlord Tirion Fordring - Anub''arak Intro'),
+(34996, 16, 0, 'Arthas! You are hopelessly outnumbered! Lay down Frostmourne and I will grant you a just death.', 14, 0, 100, 25, 0, 16052, 'Highlord Tirion Fordring'),
+
+-- King Varian Wrynn
+(34990, 0, 0, 'Your beasts will be no match for my champions, Tirion!', 14, 0, 0, 0, 0, 16069, 'King Varian Wrynn'),
+(34990, 1, 0, 'The Alliance doesn''t need the help of a demon lord to deal with Horde filth! Come, pig!', 14, 0, 100, 5, 0, 16064, 'King Varian Wrynn'),
+(34990, 2, 0, 'Our honor has been besmirched! They make wild claims and false accusations against us. I demand justice! Allow my champions to fight in place of your knights, Tirion. We challenge the Horde!', 14, 0, 100, 5, 0, 16066, 'King Varian Wrynn'),
+(34990, 3, 0, 'Fight for the glory of the Alliance, heroes! Honor your king and your people!', 14, 0, 100, 5, 0, 16065, 'King Varian Wrynn'),
+(34990, 4, 0, 'GLORY TO THE ALLIANCE!', 14, 0, 0, 0, 0, 16067, 'King Varian Wrynn'),
+(34990, 5, 0, 'Not even the Lich King most powerful minions can stand against the Alliance! All hail our victors!', 14, 0, 0, 0, 0, 16068, 'King Varian Wrynn'),
+(34990, 6, 0, 'Hardly a challenge.', 14, 0, 100, 274, 0, 16061, 'King Varian Wrynn - Faction Champions Kill Player'),
+(34990, 6, 1, 'HAH!', 14, 0, 100, 5, 0, 16060, 'King Varian Wrynn - Faction Champions Kill Player'),
+(34990, 6, 2, 'Is this the best the Horde has to offer?', 14, 0, 100, 6, 0, 16063, 'King Varian Wrynn - Faction Champions Kill Player'),
+(34990, 6, 3, 'Worthless scrub.', 14, 0, 100, 25, 0, 16062, 'King Varian Wrynn - Faction Champions Kill Player'),
+
+-- Garrosh Hellscream
+(34995, 0, 0, 'The Horde demands justice! We challenge the Alliance. Allow us to battle in place of your knights, paladin. We will show these dogs what it means to insult the Horde!', 14, 0, 100, 1, 0, 16023, 'Garrosh Hellscream'),
+(34995, 1, 0, 'I''ve seen more worthy challenges in the Ring of Blood. You waste our time, paladin.', 14, 0, 100, 1, 0, 16026, 'Garrosh Hellscream'),
+(34995, 2, 0, 'Treacherous Alliance dogs! You summon a demon lord against warriors of the Horde? Your deaths will be swift!', 14, 0, 100, 5, 0, 16021, 'Garrosh Hellscream'),
+(34995, 3, 0, 'That was just a taste of what the future brings. FOR THE HORDE!', 14, 0, 100, 1, 0, 16024, 'Garrosh Hellscream'),
+(34995, 4, 0, 'Show them no mercy, Horde champions! LOK''TAR OGAR!', 14, 0, 0, 0, 0, 16022, 'Garrosh - Faction Champions Intro'),
+(34995, 5, 0, 'Do you still question the might of the Horde, paladin? We will take on all comers!', 14, 0, 100, 1, 0, 16025, 'Garrosh Hellscream'),
+(34995, 6, 0, 'Weakling!', 14, 0, 0, 0, 0, 16017, 'Garrosh Hellscream - Faction Champions Kill Player'),
+(34995, 6, 1, 'Pathetic!', 14, 0, 0, 0, 0, 16018, 'Garrosh Hellscream - Faction Champions Kill Player'),
+(34995, 6, 2, 'Overpowered.', 14, 0, 0, 0, 0, 16019, 'Garrosh Hellscream - Faction Champions Kill Player'),
+(34995, 6, 3, 'Lok''tar!', 14, 0, 0, 0, 0, 16020, 'Garrosh Hellscream - Faction Champions Kill Player'),
+
+-- Highlord Tirion Fordring
+(36095, 0, 0, 'Champions, you''re alive! Not only have you defeated every challenge of the Trial of the Crusader, but also thwarted Arthas'' plans! Your skill and cunning will prove to be a powerful weapon against the Scourge. Well done! Allow one of the Crusade''s mages to transport you to the surface!', 14, 0, 100, 5, 0, 16053, 'Highlord Tirion Fordring'),
+(36095, 1, 0, 'Let me hand you the chests as a reward, and let its contents will serve you faithfully in the campaign against Arthas in the heart of the Icecrown Citadel!', 41, 0, 0, 0, 0, 0, 'Highlord Tirion Fordring'),
+
+-- Gormok
+(34796, 0, 0, 'My slaves! Destroy the enemy!', 41, 0, 0, 0, 0, 0, 'Gormok the Impaler - Snowball'),
+
+-- Acidmaw
+(35144, 0, 0, 'Upon seeing its companion perish, %s becomes enraged!', 41, 0, 100, 0, 0, 0, 'Acidmaw to Beasts Controller - Enrage'),
+
+-- Dreadscale
+(34799, 0, 0, 'Upon seeing its companion perish, %s becomes enraged!', 41, 0, 100, 0, 0, 0, 'Dreadscale to Beasts Controller - Enrage'),
+
+-- Icehowl
+(34797, 0, 0, '%s glares at $n and lets out a bellowing roar!', 41, 0, 100, 0, 0, 0, 'Icehowl - Start'),
+(34797, 1, 0, '%s crashes into the Coliseum wall and is stunned!', 41, 0, 100, 0, 0, 0, 'Icehowl - Crash'),
+(34797, 2, 0, 'Trampling combatants underfoot, %s goes into a frothing rage!', 41, 0, 100, 0, 0, 0, 'Icehowl - Fail'),
+
+-- Wilfred Fizzlebang
+(35458, 0, 0, 'Thank you, Highlord. Now, challengers, I will begin the ritual of summoning. When I am done a fearsome doomguard will appear!', 14, 0, 100, 2, 0, 16268, 'Wilfred Fizzlebang - Intro'),
+(35458, 1, 0, 'Prepare for oblivion!', 14, 0, 100, 0, 0, 16269, 'Wilfred Fizzlebang - Intro'),
+(35458, 2, 0, 'A-HA! I''ve done it! Behold the absolute power of Wilfred Fizzlebang, master summoner! You are bound to me, demon!', 14, 0, 100, 5, 0, 16270, 'Wilfred Fizzlebang to Wilfred Fizzlebang - Intro'),
+(35458, 3, 0, 'But I''m in charge here...', 14, 0, 100, 5, 0, 16271, 'Wilfred Fizzlebang to Wilfred Fizzlebang - Death'),
+
+-- Lord Jaraxxus
+(34780, 0, 0, 'Trifling gnome! Your arrogance will be your undoing!', 14, 0, 100, 397, 0, 16143, 'Lord Jaraxxus to Wilfred Fizzlebang - Intro'),
+(34780, 1, 0, 'You face Jaraxxus, Eredar Lord of the Burning Legion!', 14, 0, 100, 0, 0, 16144, 'Lord Jaraxxus - Aggro'),
+(34780, 2, 0, '$n has |cFFFF0000Legion Flames!|r', 41, 0, 100, 0, 0, 0, 'Lord Jaraxxus - Legion Flame'),
+(34780, 3, 0, '%s creates a Nether Portal!', 41, 0, 100, 0, 0, 16150, 'Lord Jaraxxus - Summing Nether Portal'),
+(34780, 4, 0, 'Come forth, sister! Your master calls!', 14, 0, 100, 0, 0, 16150, 'Lord Jaraxxus - Summoning Mistress of Pain'),
+(34780, 5, 0, '$n has |cFF00FFFFIncinerate Flesh!|r Heal $g him:her;!', 41, 0, 100, 0, 0, 16149, 'Lord Jaraxxus - Incinerate Flesh'),
+(34780, 6, 0, 'FLESH FROM BONE!', 14, 0, 100, 0, 0, 16149, 'Lord Jaraxxus - Incinerate Flesh'),
+(34780, 7, 0, '%s creates an |cFF00FF00Infernal Volcano!|r', 41, 0, 100, 0, 0, 16151, 'Lord Jaraxxus - Summoning Infernal Volcano emote'),
+(34780, 8, 0, 'IN-FER-NO!', 14, 0, 100, 0, 0, 16151, 'Lord Jaraxxus - Summoning Infernals'),
+(34780, 9, 0, 'Insignificant gnat!', 14, 0, 0, 0, 0, 16145, 'Lord Jaraxxus - Killing a player'),
+(34780, 9, 1, 'Banished to the Nether!', 14, 0, 0, 0, 0, 16146, 'Lord Jaraxxus - Killing a player'),
+(34780, 10, 0, 'Another will take my place. Your world is doomed...', 14, 0, 100, 0, 0, 16147, 'Lord Jaraxxus - Death'),
+(34780, 11, 0,'<Laughs>', 14, 0, 0, 0, 0, 16148, 'Lord Jaraxxus - Berserk'),
+
+-- Eydis Darkban
+(34496, 0, 0, 'In the name of our dark master. For the Lich King. You. Will. Die.', 14, 0, 100, 0, 0, 16272, 'Eydis Darkbane - Aggro'),
+(34496, 1, 0, 'Let the light consume you!', 14, 0, 100, 0, 0, 16279, 'Eydis Darkbane to Fjola Lightbane - Light Vortex'),
+(34496, 2, 0, 'Let the dark consume you!', 14, 0, 100, 0, 0, 16278, 'Eydis Darkbane to Fjola Lightbane - Dark Vortex'),
+(34496, 3, 0, '%s begins to cast |cFF9932CDDark Vortex!|r Switch to |cFF9932CDDark|r Essence!', 41, 0, 100, 0, 0, 16278, 'Eydis Darkbane to Fjola Lightbane - Dark Vortex emote'),
+(34496, 4, 0, '%s begins to cast |cFFFF0000Twin''s Pact!|r', 41, 0, 100, 0, 0, 16274, 'Eydis Darkbane to Fjola Lightbane - Twin''s Pact emote'),
+(34496, 5, 0, 'CHAOS!', 14, 0, 100, 0, 0, 16274, 'Eydis Darkbane to Fjola Lightbane - Twin''s Pact'),
+(34496, 6, 0, 'You have been measured and found wanting.', 14, 0, 100, 0, 0, 16276, 'Eydis Darkbane - Killing a player'),
+(34496, 6, 1, 'UNWORTHY!', 14, 0, 100, 0, 0, 16276, 'Eydis Darkbane - Killing a player'),
+(34496, 7, 0, 'YOU ARE FINISHED!', 14, 0, 0, 0, 0, 16273, 'Eydis Darkbane - Berserk'),
+(34496, 8, 0, 'The Scourge cannot be stopped...', 14, 0, 100, 0, 0, 16275, 'Eydis Darkbane - Death'),
+
+-- Fjola Lightbane
+(34497, 0, 0, 'In the name of our dark master. For the Lich King. You. Will. Die.', 14, 0, 100, 0, 0, 16272, 'Fjola Lightbane - Aggro'),
+(34497, 1, 0, 'Let the light consume you!', 14, 0, 100, 0, 0, 16279, 'Fjola Lightbane to Fjola Lightbane - Light Vortex'),
+(34497, 2, 0, 'Let the dark consume you!', 14, 0, 100, 0, 0, 16278, 'Fjola Lightbane to Fjola Lightbane - Dark Vortex'),
+(34497, 3, 0, '%s begins to cast |cFFFFFFFFLight Vortex!|r Switch to |cFFFFFFFFLight|r Essence!', 41, 0, 100, 0, 0, 16279, 'Fjola Lightbane to Fjola Lightbane - Light Vortex emote'),
+(34497, 4, 0, '%s begins to cast Twin''s Pact!', 41, 0, 100, 0, 0, 16274, 'Fjola Lightbane to Fjola Lightbane - Twin''s Pact emote'),
+(34497, 5, 0, 'CHAOS!', 14, 0, 100, 0, 0, 16274, 'Fjola Lightbane to Fjola Lightbane - Twin''s Pact'),
+(34497, 6, 0, 'You have been measured and found wanting.', 14, 0, 100, 0, 0, 16276, 'Fjola Lightbane - Killing a player'),
+(34497, 6, 1, 'UNWORTHY!', 14, 0, 100, 0, 0, 16276, 'Fjola Lightbane - Killing a player'),
+(34497, 7, 0, 'YOU ARE FINISHED!', 14, 0, 0, 0, 0, 16273, 'Fjola Lightbane - Berserk'),
+(34497, 8, 0, 'The Scourge cannot be stopped...', 14, 0, 100, 0, 0, 16275, 'Fjola Lightbane - Death'),
+
+-- The Lich King
+(35877, 0, 0, 'You will have your challenge, Fordring.', 14, 0, 100, 0, 0, 16321, 'The Lich King'),
+(35877, 1, 0, 'The souls of your fallen champions will be mine, Fordring.', 14, 0, 100, 0, 0, 16323, 'The Lich King'),
+(35877, 2, 0, 'The Nerubians built an empire beneath the frozen wastes of Northrend. An empire that you so foolishly built your structures upon. MY EMPIRE.', 14, 0, 100, 11, 0, 16322, 'The Lich King'),
+
+-- Anub''arak
+(34564, 0, 0, 'Ahhh, our guests have arrived, just as the master promised.', 14, 0, 100, 0, 0, 16235, 'Anub''arak - Intro'),
+(34564, 1, 0, 'This place will serve as your tomb!', 14, 0, 100, 0, 0, 16234, 'Anub''arak - Aggro'),
+(34564, 2, 0, 'Auum na-l ak-k-k-k, isshhh. Rise, minions. Devour...', 14, 0, 100, 0, 0, 16240, 'Anub''arak - Submerge'),
+(34564, 3, 0, '%s burrows into the ground!', 41, 0, 100, 0, 0, 16240, 'Anub''arak - Burrows'),
+(34564, 4, 0, '%s emerges from the ground!', 41, 0, 100, 0, 0, 0, 'Anub''arak - Emerge emote'),
+(34564, 5, 0, 'The swarm shall overtake you!', 14, 0, 100, 0, 0, 16241, 'Anub''arak - Leeching Swarm'),
+(34564, 6, 0, '%s unleashes a Leeching Swarm to heal himself!', 41, 0, 100, 0, 0, 16241, 'Anub''arak - Leeching Swarm emote'),
+(34564, 7, 0, 'F-lakkh shir!', 14, 0, 100, 0, 0, 16236, 'Anub''arak - Killing a player'),
+(34564, 7, 1, 'Another soul to sate the host.', 14, 0, 100, 0, 0, 16237, 'Anub''arak - Killing a player'),
+(34564, 8, 0, 'I have failed you, master...', 14, 0, 100, 0, 0, 16238, 'Anub''arak - Death'),
+
+-- Anub''arak Spike
+(34660, 0, 0, '%s''s spikes pursue $n!', 41, 0, 100, 0, 0, 0, 'Anub''arak - Spike target');
diff --git a/sql/old/3.3.5a/2012_08_13_01_world_creature.sql b/sql/old/3.3.5a/2012_08_13_01_world_creature.sql
new file mode 100644
index 00000000000..4d8544206dd
--- /dev/null
+++ b/sql/old/3.3.5a/2012_08_13_01_world_creature.sql
@@ -0,0 +1,10 @@
+SET @GUID := 42575;
+SET @ENTRY := 36095; -- Highlord Tirion Fordring
+
+DELETE FROM `creature` WHERE `id`=@ENTRY;
+INSERT INTO `creature` (`guid`,`id`,`map`,`spawnMask`,`phaseMask`,`position_x`,`position_y`,`position_z`,`orientation`,`spawntimesecs`,`spawndist`,`MovementType`) VALUES
+(@GUID,@ENTRY,649,15,1,648.9167,131.0208,141.6161,0,7200,0,0);
+
+DELETE FROM `creature_template_addon` WHERE `entry`=@ENTRY;
+INSERT INTO `creature_template_addon` (`entry`, `mount`, `bytes1`, `bytes2`, `auras`) VALUES
+(@ENTRY,0,0x0,0x1,'57545');
diff --git a/sql/old/3.3.5a/2012_08_14_00_world_creature_text.sql b/sql/old/3.3.5a/2012_08_14_00_world_creature_text.sql
new file mode 100644
index 00000000000..bd0f3531937
--- /dev/null
+++ b/sql/old/3.3.5a/2012_08_14_00_world_creature_text.sql
@@ -0,0 +1,24 @@
+DELETE FROM `creature_text` WHERE `entry` IN (34990,34995);
+INSERT INTO `creature_text` (`entry`, `groupid`, `id`, `text`, `type`, `language`, `probability`, `emote`, `duration`, `sound`, `comment`) VALUES
+-- King Varian Wrynn
+(34990, 0, 0, 'Your beasts will be no match for my champions, Tirion!', 14, 0, 0, 0, 0, 16069, 'King Varian Wrynn - Northrend Beasts Outro'),
+(34990, 1, 0, 'The Alliance doesn''t need the help of a demon lord to deal with Horde filth! Come, pig!', 14, 0, 100, 5, 0, 16064, 'King Varian Wrynn - Lord Jaraxxus Outro'),
+(34990, 2, 0, 'Our honor has been besmirched! They make wild claims and false accusations against us. I demand justice! Allow my champions to fight in place of your knights, Tirion. We challenge the Horde!', 14, 0, 100, 5, 0, 16066, 'King Varian Wrynn - Faction Champions Intro'),
+(34990, 3, 0, 'Fight for the glory of the Alliance, heroes! Honor your king and your people!', 14, 0, 100, 5, 0, 16065, 'King Varian Wrynn - Faction Champions Intro'),
+(34990, 4, 0, 'GLORY TO THE ALLIANCE!', 14, 0, 100, 0, 0, 16067, 'King Varian Wrynn - Victory'),
+(34990, 5, 0, 'Not even the Lich King most powerful minions can stand against the Alliance! All hail our victors!', 14, 0, 0, 0, 0, 16068, 'King Varian Wrynn - Faction Champions Outro'),
+(34990, 6, 0, 'Hardly a challenge.', 14, 0, 100, 274, 0, 16061, 'King Varian Wrynn - Faction Champions Kill Player'),
+(34990, 6, 1, 'HAH!', 14, 0, 100, 5, 0, 16060, 'King Varian Wrynn - Faction Champions Kill Player'),
+(34990, 6, 2, 'Is this the best the Horde has to offer?', 14, 0, 100, 6, 0, 16063, 'King Varian Wrynn - Faction Champions Kill Player'),
+(34990, 6, 3, 'Worthless scrub.', 14, 0, 100, 25, 0, 16062, 'King Varian Wrynn - Faction Champions Kill Player'),
+-- Garrosh Hellscream
+(34995, 0, 0, 'I''ve seen more worthy challenges in the Ring of Blood. You waste our time, paladin.', 14, 0, 100, 1, 0, 16026, 'Garrosh Hellscream - Northrend Beasts Outro'),
+(34995, 1, 0, 'Treacherous Alliance dogs! You summon a demon lord against warriors of the Horde? Your deaths will be swift!', 14, 0, 100, 5, 0, 16021, 'Garrosh Hellscream - Lord Jaraxxus Outro'),
+(34995, 2, 0, 'The Horde demands justice! We challenge the Alliance. Allow us to battle in place of your knights, paladin. We will show these dogs what it means to insult the Horde!', 14, 0, 100, 1, 0, 16023, 'Garrosh Hellscream - Faction Champions Intro'),
+(34995, 3, 0, 'Show them no mercy, Horde champions! LOK''TAR OGAR!', 14, 0, 0, 0, 0, 16022, 'Garrosh - Faction Champions Intro'),
+(34995, 4, 0, 'That was just a taste of what the future brings. FOR THE HORDE!', 14, 0, 100, 1, 0, 16024, 'Garrosh Hellscream - Faction Champions Victory'),
+(34995, 5, 0, 'Do you still question the might of the Horde, paladin? We will take on all comers!', 14, 0, 100, 1, 0, 16025, 'Garrosh Hellscream - Faction Champions Outro'),
+(34995, 6, 0, 'Weakling!', 14, 0, 100, 0, 0, 16017, 'Garrosh Hellscream - Faction Champions Kill Player'),
+(34995, 6, 1, 'Pathetic!', 14, 0, 100, 0, 0, 16018, 'Garrosh Hellscream - Faction Champions Kill Player'),
+(34995, 6, 2, 'Overpowered.', 14, 0, 100, 0, 0, 16019, 'Garrosh Hellscream - Faction Champions Kill Player'),
+(34995, 6, 3, 'Lok''tar!', 14, 0, 100, 0, 0, 16020, 'Garrosh Hellscream - Faction Champions Kill Player');
diff --git a/sql/old/3.3.5a/2012_08_14_01_world_creature_text.sql b/sql/old/3.3.5a/2012_08_14_01_world_creature_text.sql
new file mode 100644
index 00000000000..0f182ae098e
--- /dev/null
+++ b/sql/old/3.3.5a/2012_08_14_01_world_creature_text.sql
@@ -0,0 +1,8 @@
+DELETE FROM `script_texts` WHERE `npc_entry`=10184;
+DELETE FROM `creature_text` WHERE `entry`=10184;
+INSERT INTO `creature_text` (`entry`, `groupid`, `id`, `text`, `type`, `language`, `probability`, `emote`, `duration`, `sound`, `comment`) VALUES
+(10184, 0, 0, 'How fortuitous. Usually, I must leave my lair in order to feed.', 14, 0, 100, 0, 0, 0, 'Onyxia - Aggro'),
+(10184, 1, 0, 'Learn your place mortal!', 14, 0, 100, 0, 0, 0, 'Onyxia - Kill Player'),
+(10184, 2, 0, 'This meaningless exertion bores me. I''ll incinerate you all from above!', 14, 0, 100, 0, 0, 0, 'Onyxia - Phase 2'),
+(10184, 3, 0, 'It seems you''ll need another lesson, mortals!', 14, 0, 100, 0, 0, 0, 'Onyxia - Phase 3'),
+(10184, 4, 0, '%s takes in a deep breath...', 41, 0, 100, 0, 0, 0, 'Onyxia - Deep Breath Emote');
diff --git a/sql/old/3.3.5a/2012_08_14_02_world_creature.sql b/sql/old/3.3.5a/2012_08_14_02_world_creature.sql
new file mode 100644
index 00000000000..5096c7d6b49
--- /dev/null
+++ b/sql/old/3.3.5a/2012_08_14_02_world_creature.sql
@@ -0,0 +1,12 @@
+SET @GUID := 42613;
+SET @ENTRY := 28114; -- Mistcaller Soo-gan
+
+DELETE FROM `creature` WHERE `id`=@ENTRY;
+INSERT INTO `creature` (`guid`,`id`,`map`,`spawnMask`,`phaseMask`,`modelid`,`equipment_id`,`position_x`,`position_y`,`position_z`,`orientation`,`spawntimesecs`,`spawndist`,`currentwaypoint`,`curhealth`,`curmana`,`MovementType`) VALUES
+(@GUID,@ENTRY,571,1,1,0,0,6165.004,5092.975,-97.29356,0.7504916,120,0,0,117700,3809,0);
+
+DELETE FROM `creature_template_addon` WHERE `entry`=@ENTRY;
+INSERT INTO `creature_template_addon` (`entry`, `path_id`, `mount`, `bytes1`, `bytes2`, `emote`, `auras`) VALUES
+(@ENTRY,0,0,0x10000,0x1,0,'51589 52215');
+
+UPDATE `creature_template` SET `npcflag`=`npcflag` |1 WHERE `entry`=@ENTRY;
diff --git a/sql/old/3.3.5a/2012_08_16_00_world_creature_template.sql b/sql/old/3.3.5a/2012_08_16_00_world_creature_template.sql
new file mode 100644
index 00000000000..732f647d7b7
--- /dev/null
+++ b/sql/old/3.3.5a/2012_08_16_00_world_creature_template.sql
@@ -0,0 +1,3 @@
+-- Added trigger flags to triggers
+UPDATE `creature_template` SET `flags_extra` = flags_extra | 128 WHERE `entry` = 34862;
+UPDATE `creature_template` SET `unit_flags` = unit_flags | 256 WHERE `entry` = 34862;
diff --git a/sql/old/3.3.5a/2012_08_16_00_world_spell_dbc.sql b/sql/old/3.3.5a/2012_08_16_00_world_spell_dbc.sql
new file mode 100644
index 00000000000..248674d17a5
--- /dev/null
+++ b/sql/old/3.3.5a/2012_08_16_00_world_spell_dbc.sql
@@ -0,0 +1,3 @@
+DELETE FROM `spell_dbc` WHERE `Id`=35009;
+INSERT INTO `spell_dbc` (`Id`,`Attributes`,`AttributesEx`,`AttributesEx2`,`AttributesEx3`,`Targets`,`CastingTimeIndex`,`ProcCharges`,`SpellLevel`,`RangeIndex`,`Effect1`,`EffectDieSides1`,`EffectBasePoints1`,`EffectImplicitTargetA1`,`EffectImplicitTargetB1`,`EffectRadiusIndex1`,`SpellFamilyName`,`SpellFamilyFlags2`,`DmgMultiplier1`,`SchoolMask`,`Comment`) VALUES
+(35009,134545792,1024,268435460,65536,64,1,101,1,13,125,1,-11,22,16,27,10,4,1,6,'Invisibility - Reducing threat');
diff --git a/sql/old/3.3.5a/2012_08_17_00_world_spell_dbc.sql b/sql/old/3.3.5a/2012_08_17_00_world_spell_dbc.sql
new file mode 100644
index 00000000000..ee6d2d2f3b6
--- /dev/null
+++ b/sql/old/3.3.5a/2012_08_17_00_world_spell_dbc.sql
@@ -0,0 +1 @@
+UPDATE `spell_dbc` SET `ProcChance`=101,`ProcCharges`=0,`SpellFamilyName`=3,`SpellFamilyFlags2`=0 WHERE `Id`=35009;
diff --git a/sql/old/3.3.5a/2012_08_19_00_world_pickpocketing_loot_template.sql b/sql/old/3.3.5a/2012_08_19_00_world_pickpocketing_loot_template.sql
new file mode 100644
index 00000000000..773ad9b6ebc
--- /dev/null
+++ b/sql/old/3.3.5a/2012_08_19_00_world_pickpocketing_loot_template.sql
@@ -0,0 +1,11 @@
+-- Pickpocketing_loot_template
+UPDATE creature_template SET pickpocketloot=entry WHERE entry=28200;
+DELETE FROM `pickpocketing_loot_template` WHERE entry=28200;
+INSERT INTO `pickpocketing_loot_template` (`entry`,`item`,`ChanceorQuestChance`,`lootmode`,`groupid`,`mincountOrRef`,`maxcount`) VALUES
+-- Dark Necromance
+(28200,37467,100,1,0,1,1),-- A Steamy Romance Novel: Forbidden Love
+(28200,43575,100,1,0,1,1),-- Reinforced Junkbox
+(28200,35952,30,1,0,1,1),-- Briny Hardcheese
+(28200,33447,22,1,0,1,1),-- Runic Healing Potion
+(28200,35948,10,1,0,1,1),-- Savory Snowplum
+(28200,35950,10,1,0,1,1);-- Sweet Potato Bread
diff --git a/sql/old/3.3.5a/2012_08_19_01_world_spell_dbc.sql b/sql/old/3.3.5a/2012_08_19_01_world_spell_dbc.sql
new file mode 100644
index 00000000000..69a9c2a8336
--- /dev/null
+++ b/sql/old/3.3.5a/2012_08_19_01_world_spell_dbc.sql
@@ -0,0 +1,4 @@
+DELETE FROM `spell_dbc` WHERE `Id` IN (68184,68620);
+INSERT INTO `spell_dbc` (`Id`, `Dispel`, `Mechanic`, `Attributes`, `AttributesEx`, `AttributesEx2`, `AttributesEx3`, `AttributesEx4`, `AttributesEx5`, `AttributesEx6`, `AttributesEx7`, `Stances`, `StancesNot`, `Targets`, `CastingTimeIndex`, `AuraInterruptFlags`, `ProcFlags`, `ProcChance`, `ProcCharges`, `MaxLevel`, `BaseLevel`, `SpellLevel`, `DurationIndex`, `RangeIndex`, `StackAmount`, `EquippedItemClass`, `EquippedItemSubClassMask`, `EquippedItemInventoryTypeMask`, `Effect1`, `Effect2`, `Effect3`, `EffectDieSides1`, `EffectDieSides2`, `EffectDieSides3`, `EffectRealPointsPerLevel1`, `EffectRealPointsPerLevel2`, `EffectRealPointsPerLevel3`, `EffectBasePoints1`, `EffectBasePoints2`, `EffectBasePoints3`, `EffectMechanic1`, `EffectMechanic2`, `EffectMechanic3`, `EffectImplicitTargetA1`, `EffectImplicitTargetA2`, `EffectImplicitTargetA3`, `EffectImplicitTargetB1`, `EffectImplicitTargetB2`, `EffectImplicitTargetB3`, `EffectRadiusIndex1`, `EffectRadiusIndex2`, `EffectRadiusIndex3`, `EffectApplyAuraName1`, `EffectApplyAuraName2`, `EffectApplyAuraName3`, `EffectAmplitude1`, `EffectAmplitude2`, `EffectAmplitude3`, `EffectMultipleValue1`, `EffectMultipleValue2`, `EffectMultipleValue3`, `EffectMiscValue1`, `EffectMiscValue2`, `EffectMiscValue3`, `EffectMiscValueB1`, `EffectMiscValueB2`, `EffectMiscValueB3`, `EffectTriggerSpell1`, `EffectTriggerSpell2`, `EffectTriggerSpell3`, `EffectSpellClassMaskA1`, `EffectSpellClassMaskA2`, `EffectSpellClassMaskA3`, `EffectSpellClassMaskB1`, `EffectSpellClassMaskB2`, `EffectSpellClassMaskB3`, `EffectSpellClassMaskC1`, `EffectSpellClassMaskC2`, `EffectSpellClassMaskC3`, `MaxTargetLevel`, `SpellFamilyName`, `SpellFamilyFlags1`, `SpellFamilyFlags2`, `SpellFamilyFlags3`, `MaxAffectedTargets`, `DmgClass`, `PreventionType`, `DmgMultiplier1`, `DmgMultiplier2`, `DmgMultiplier3`, `AreaGroupId`, `SchoolMask`, `Comment`) VALUES
+(68184, 0, 0, 545259904, 0, 5, 268697856, 128, 0, 16777216, 0, 0, 0, 0, 1, 0, 0, 101, 0, 0, 0, 0, 0, 1, 0, -1, 0, 0, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 22, 0, 0, 7, 0, 0, 28, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 'Faction Champions - credit marker'),
+(68620, 0, 0, 545259904, 0, 5, 268697856, 128, 0, 16777216, 0, 0, 0, 0, 1, 0, 0, 101, 0, 0, 0, 0, 0, 1, 0, -1, 0, 0, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 22, 0, 0, 7, 0, 0, 28, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 'Resilience Will Fix It - achievement credit marker');
diff --git a/sql/old/3.3.5a/2012_08_20_00_world_spell_script_names.sql b/sql/old/3.3.5a/2012_08_20_00_world_spell_script_names.sql
new file mode 100644
index 00000000000..d0aa185ea3a
--- /dev/null
+++ b/sql/old/3.3.5a/2012_08_20_00_world_spell_script_names.sql
@@ -0,0 +1,3 @@
+DELETE FROM `spell_script_names` WHERE (`spell_id`='33695');
+INSERT INTO `spell_script_names` (`spell_id`,`ScriptName`) VALUES
+(33695, 'spell_pal_exorcism_and_holy_wrath_damage');
diff --git a/sql/old/3.3.5a/2012_08_20_01_world_wintergrasp_conditions.sql b/sql/old/3.3.5a/2012_08_20_01_world_wintergrasp_conditions.sql
new file mode 100644
index 00000000000..c97c753afa8
--- /dev/null
+++ b/sql/old/3.3.5a/2012_08_20_01_world_wintergrasp_conditions.sql
@@ -0,0 +1,31 @@
+-- Conditions
+-- Add gossip_menu condition for 9904 Horde
+DELETE FROM `conditions` WHERE `SourceTypeOrReferenceId` IN (14,15) AND `SourceGroup` IN (9904,9923);
+INSERT INTO `conditions` (`SourceTypeOrReferenceId`,`SourceGroup`,`SourceEntry`,`ElseGroup`,`ConditionTypeOrReference`,`ConditionValue1`) VALUES
+(14,9904,13759,0,1,33280), -- Must have Rank 1: Corporal
+(14,9904,13759,1,1,55629), -- Or must have Rank 2: First Lieutenant
+(14,9904,13761,0,11,33280), -- Must not have Rank 1: Corporal
+(14,9904,13761,0,11,55629), -- Must not have Rank 2: First Lieutenant
+-- Add gossip_menu condition for 9923 Alliance
+(14,9923,13798,0,1,33280), -- Must have Rank 1: Corporal
+(14,9923,13798,1,1,55629), -- Or must have Rank 2: First Lieutenant
+(14,9923,14172,0,11,33280), -- Must not have Rank 1: Corporal
+(14,9923,14172,0,11,55629), -- Must not have Rank 2: First Lieutenant
+-- Add conditions to gossip options horde
+(15,9904,0,0,1,33280), -- Must have reached Rank 1: Corporal
+(15,9904,0,1,1,55629), -- Or must have reached Rank 2: First Lieutenant
+(15,9904,1,0,1,55629), -- Must have reached Rank 2: First Lieutenant
+(15,9904,2,0,1,55629), -- Must have reached Rank 2: First Lieutenant
+-- Add conditions to gossip options alliance
+(15,9923,0,0,1,33280), -- Must have reached Rank 1: Corporal
+(15,9923,0,1,1,55629), -- Or must have reached Rank 2: First Lieutenant
+(15,9923,1,0,1,55629), -- Must have reached Rank 2: First Lieutenant
+(15,9923,2,0,1,55629); -- Must have reached Rank 2: First Lieutenant
+
+/* Spell target conditions for spawning WG siege machines in proper place while building it */
+DELETE FROM `conditions` WHERE `SourceTypeOrReferenceId`=13 AND `SourceEntry` IN (56575,56661,56663,61408);
+INSERT INTO `conditions` (`SourceTypeOrReferenceId`, `SourceGroup`, `SourceEntry`, `SourceId`, `ElseGroup`, `ConditionTypeOrReference`, `ConditionTarget`, `ConditionValue1`, `ConditionValue2`, `ConditionValue3`, `NegativeCondition`, `ErrorTextId`, `ScriptName`, `Comment`) VALUES
+(13, 1, 56575, 0, 0, 31, 0, 3, 27852, 0, 0, 0, '', NULL),
+(13, 1, 56661, 0, 0, 31, 0, 3, 27852, 0, 0, 0, '', NULL),
+(13, 1, 56663, 0, 0, 31, 0, 3, 27852, 0, 0, 0, '', NULL),
+(13, 1, 61408, 0, 0, 31, 0, 3, 27852, 0, 0, 0, '', NULL);
diff --git a/sql/old/3.3.5a/2012_08_20_02_world_wintergrasp_creatures.sql b/sql/old/3.3.5a/2012_08_20_02_world_wintergrasp_creatures.sql
new file mode 100644
index 00000000000..1e75f37d32f
--- /dev/null
+++ b/sql/old/3.3.5a/2012_08_20_02_world_wintergrasp_creatures.sql
@@ -0,0 +1,64 @@
+UPDATE `creature_template` SET `exp`=0, `ScriptName`= 'npc_wg_spirit_guide' WHERE `entry`=31841; -- Taunka Spirit Guide
+UPDATE `creature_template` SET `exp`=0, `ScriptName`= 'npc_wg_spirit_guide' WHERE `entry`=31842; -- Dwarven Spirit Guide
+UPDATE `creature_template` SET `exp`=0, `ScriptName`= 'npc_wg_quest_giver' WHERE `entry`=31052; -- Bowyer Randolph
+UPDATE `creature_template` SET `unit_flags`=`unit_flags`|768 WHERE `entry`=39172; -- Marshal Magruder
+UPDATE `creature_template` SET `npcflag`=`npcflag`|128 WHERE `entry`=30488; -- Travis Day
+UPDATE `creature_template` SET `exp`=0, `ScriptName`= 'npc_wg_quest_giver' WHERE `entry`=31053; -- Primalist Mulfort
+UPDATE `creature_template` SET `dynamicflags`=`dynamicflags`|4, `ScriptName`= 'npc_wg_quest_giver' WHERE `entry`=31107; -- Lieutenant Murp (?)
+UPDATE `creature_template` SET `baseattacktime`=2000,`unit_flags`=`unit_flags`|768 WHERE `entry`=39173; -- Champion Ros'slai
+UPDATE `creature_template` SET `unit_flags`=`unit_flags`|16 WHERE `entry`=30740; -- Valiance Expedition Champion (?)
+UPDATE `creature_template` SET `InhabitType`=7 WHERE `entry`=27852; -- Wintergrasp Control Arms
+UPDATE `creature_template` SET `faction_A`=1732,`faction_H`=1735,`npcflag`=16777216, `spell1`=51421, /* Fire Cannon */ `spell2`=0,`spell3`=0,`spell4`=0,`spell5`=0,`spell6`=0,`spell7`=0,`spell8`=0 WHERE `entry`=28366; -- Wintergrasp Tower Cannon
+UPDATE `creature_template` SET `faction_A`=1732,`faction_H`=1735,`npcflag`=16777216,`unit_flags`=16384,`unit_class`=4,`speed_walk`=1.2,`spell1`=57609, /* Fire Cannon */ `spell2`=0,`spell3`=0,`spell4`=0,`spell5`=0,`spell6`=0,`spell7`=0,`spell8`=0 WHERE `entry`=32629; -- Wintergrasp Siege Turret (H)
+UPDATE `creature_template` SET `faction_A`=1732,`faction_H`=1735,`npcflag`=16777216,`unit_flags`=16384,`unit_class`=4,`speed_walk`=1.2, `spell1`=57609, /* Fire Cannon */ `spell2`=0,`spell3`=0,`spell4`=0,`spell5`=0,`spell6`=0,`spell7`=0,`spell8`=0 WHERE `entry`=28319; -- Wintergrasp Siege Turret (A)
+UPDATE `creature_template` SET `faction_A`=1732,`faction_H`=1735,`npcflag`=16777216,`unit_flags`=16384,`unit_class`=4,`speed_walk`=1.2,`speed_run`=1, `spell1`=54109, /* Ram */ `spell2`=0,`spell3`=0,`spell4`=0,`spell5`=0,`spell6`=0,`spell7`=0,`spell8`=0 WHERE `entry`=32627; -- Wintergrasp Siege Engine (H)
+UPDATE `creature_template` SET `faction_A`=1732,`faction_H`=1735,`npcflag`=16777216,`unit_flags`=16384,`unit_class`=4,`speed_walk`=1.2,`speed_run`=1, `spell1`=54109, /* Ram */ `spell2`=0,`spell3`=0,`spell4`=0,`spell5`=0,`spell6`=0,`spell7`=0,`spell8`=0 WHERE `entry`=28312; -- Wintergrasp Siege Engine (A)
+UPDATE `creature_template` SET `faction_A`=1732,`faction_H`=1735,`npcflag`=16777216,`unit_flags`=16384,`speed_walk`=1.2,`speed_run`=1, `spell1`=54107, /* Ram */ `spell2`=50896, /* Hurl Boulder */ `spell3`=0,`spell4`=0,`spell5`=0,`spell6`=0,`spell7`=0,`spell8`=0 WHERE `entry`=28094; -- Wintergrasp Demolisher
+UPDATE `creature_template` SET `faction_A`=1732,`faction_H`=1735,`npcflag`=16777216,`unit_flags`=16384,`unit_class`=4,`speed_walk`=2.8,`speed_run`=1.71429, `spell1`=57606, /* Plague Barrel */ `spell2`=50989, /* Flame Breath */ `spell3`=0,`spell4`=0,`spell5`=0,`spell6`=0,`spell7`=0,`spell8`=0 WHERE `entry`=27881; -- Wintergrasp Catapult
+UPDATE `creature_template` SET `ScriptName`= 'npc_wg_queue' WHERE `entry` IN (32169,32170,35599,35596,35600,35601,35598,35603,35602,35597,35612,35611); -- <Wintergrasp Battle-Master>
+UPDATE `creature_template` SET `ScriptName`= 'npc_wg_demolisher_engineer' WHERE `entry` IN (30400,30499); -- Goblin Mechanic, Gnomish Engineer
+UPDATE `creature_template` SET `ScriptName`= 'npc_wg_quest_giver' WHERE `entry` IN (31054,31091,31036,31101,31051,31153,31151,31102,31106);
+UPDATE `creature_template` SET `gossip_menu_id`=9904 WHERE `entry`=30400;
+UPDATE `creature_template` SET `gossip_menu_id`=10229 WHERE `entry`=31091;
+
+UPDATE `creature_model_info` SET `bounding_radius`=0.3366,`combat_reach`=1.65,`gender`=0 WHERE `modelid`=27894; -- Knight Dameron
+UPDATE `creature_model_info` SET `bounding_radius`=0.3366,`combat_reach`=1.65,`gender`=0 WHERE `modelid`=31346; -- Marshal Magruder
+UPDATE `creature_model_info` SET `bounding_radius`=0.3366,`combat_reach`=1.65,`gender`=0 WHERE `modelid`=31347; -- Champion Ros'slai
+UPDATE `creature_model_info` SET `bounding_radius`=0.305,`combat_reach`=5,`gender`=2 WHERE `modelid`=25301; -- Wintergrasp Siege Turret
+
+DELETE FROM `creature_template_addon` WHERE `entry` IN (31841,31842,30400,30499,30489,30869,31036,31051,31052,31054,31108,31109,31153,32294,39172,30870,31053,31091,31101,31102,31106,31107,31151,32296,39173,30740,32629,28319,28366,32627,28312,28094,27881,30739);
+INSERT INTO `creature_template_addon` (`entry`,`mount`,`bytes1`,`bytes2`,`emote`,`auras`) VALUES
+(31841,0,0,1,0, '58729'), -- Taunka Spirit Guide (Spiritual Immunity, Spirit Heal Channel) FIX: Do we need the spell that revives players here (22011)? It has a duration (found in sniffs).
+(31842,0,0,1,0, '58729'), -- Dwarven Spirit Guide This spell (and the spell it triggers, are used in the "ressurect system" in Battleground.cpp
+(30400,0,0,1,0, NULL), -- Goblin Mechanic
+(30499,0,0,1,0, NULL), -- Gnomish Engineer
+(30489,0,0,1,0, NULL), -- Morgan Day
+(30869,0,0,1,0, NULL), -- Arzo Safeflight
+(31036,14337,0,257,0, NULL), -- Commander Zanneth
+(31051,0,0,1,0, NULL), -- Sorceress Kaylana
+(31052,0,0,257,0, NULL), -- Bowyer Randolph
+(31054,0,0,257,0, NULL), -- Anchorite Tessa
+(31108,0,0,257,0, NULL), -- Siege Master Stouthandle
+(31109,0,0,257,0, NULL), -- Senior Demolitionist Legoso
+(31153,6569,0,257,0, NULL), -- Tactical Officer Ahbramis
+(32294,27247,0,1,0, NULL), -- Knight Dameron
+(39172,28912,0,1,0, NULL), -- Marshal Magruder
+(30870,0,0,1,0, NULL), -- Herzo Safeflight
+(31053,0,0,257,0, '18950'), -- Primalist Mulfort (Invisibility and Stealth Detection ... why?)
+(31091,0,0,257,0, '18950'), -- Commander Dardosh (Invisibility and Stealth Detection)
+(31101,0,0,1,0, NULL), -- Hoodoo Master Fu'jin
+(31102,0,0,1,0, NULL), -- Vieron Blazefeather
+(31106,0,0,257,0, NULL), -- Siegesmith Stronghoof
+(31107,0,0,257,0, NULL), -- Lieutenant Murp
+(31151,0,0,257,0, NULL), -- Tactical Officer Kilrath
+(32296,27245,0,1,0, NULL), -- Stone Guard Mukar
+(39173,29261,0,1,0, NULL), -- Champion Ros'slai
+(30740,0,0,257,375, NULL), -- Valiance Expedition Champion
+(32629,0,0,257,0, NULL), -- Wintergrasp Siege Turret
+(28319,0,0,257,0, NULL), -- Wintergrasp Siege Turret
+(28366,0,0,257,0, NULL), -- Wintergrasp Tower Cannon
+(32627,0,0,257,0, NULL), -- Wintergrasp Siege Engine
+(28312,0,0,257,0, NULL), -- Wintergrasp Siege Engine
+(28094,0,0,257,0, NULL), -- Wintergrasp Demolisher
+(27881,0,0,257,0, NULL), -- Wintergrasp Catapult
+(30739,0,0,257,375, NULL); -- Warsong Champion
diff --git a/sql/old/3.3.5a/2012_08_20_03_world_wintergrasp_gameobjects.sql b/sql/old/3.3.5a/2012_08_20_03_world_wintergrasp_gameobjects.sql
new file mode 100644
index 00000000000..c309bf1d9dd
--- /dev/null
+++ b/sql/old/3.3.5a/2012_08_20_03_world_wintergrasp_gameobjects.sql
@@ -0,0 +1,86 @@
+UPDATE `gameobject_template` SET `faction`=114 WHERE `entry` IN (192310,192312,192313,192314,192316,192317,192318,192319,192320,192321,192322,192323,192324,192325,192326,192327,192328,192329,
+192330,192331,192332,192333,192334,192335,192286,192287,192292,192299,192304,192305,192306,192307,192308,192309); -- Alliance Banner
+
+UPDATE `gameobject_template` SET `faction`=114 WHERE `entry` IN (192269,192284,192285,192338,192339,192349,192350,192351,192352,192353,192354,192355,192356,192357,192358,192359,192360,192361,
+192362,192363,192364,192366,192367,192368,192369,192370,192371,192372,192373,192374,192375,192376,192377,192378,192379,192254,
+192255,192336); -- Horde Banner
+
+UPDATE `gameobject_template` SET `faction`=114 WHERE `entry` IN (193096,193097,193098,193099,193100,193101,193102,193103,193104,193105,193106,193107,193108,193109,193124,193125,193126,193127,
+193128,193129,193130,193131,193132,193133,193134,193135,193136,193137,193138,193139,193140,193141,193142,193143,193144,193145,
+193146,193147,193148,193149,193150,193151,193152,193153,193154,193155,193156,193157,193158,193159,193160,193161,193162,193163,
+193164,193165); -- nameless GOs
+
+UPDATE `gameobject_template` SET `ScriptName`= 'go_wg_vehicle_teleporter' WHERE `entry`=192951; -- Vehicle Teleporter
+
+-- Before pushing to master check if guids are free.
+-- Spawns Workshop Capture Points
+SET @GUID := 71385;
+DELETE FROM gameobject WHERE id IN (190475,190487,194959,194962);
+DELETE FROM gameobject WHERE guid BETWEEN @GUID AND @GUID+3;
+INSERT INTO gameobject (guid,id,position_x,position_y,position_z,orientation,map) VALUES
+(@GUID+0, 190475, 4949.344238, 2432.585693, 320.176971, 1.386214, 571), -- ne
+(@GUID+1, 190487, 4948.524414, 3342.337891, 376.875366, 4.400566, 571), -- nw
+(@GUID+2, 194959, 4398.076660, 2356.503662, 376.190491, 0.525406, 571), -- se
+(@GUID+3, 194962, 4390.776367, 3304.094482, 372.429077, 6.097023, 571); -- sw
+
+-- Misc objects in fortress phased properly
+SET @OGUID := 71389;
+DELETE FROM `gameobject` WHERE `id` IN (193096,193097,193098,193099,193100,193101,193102,193103,193104,193105,193106,193107,193108,193109,193124,193125,193126,193127,193128,193129,193130,193131,193132,193133,193134,193135,193136,193137,193138,193139,193140,193141,193142,193143,193144,193145,193146,193147,193148,193149,193150,193151,193152,193153,193154,193155,193156,193157,193158,193159,193160,193161,193162,193163,193164,193165);
+DELETE FROM `gameobject` WHERE `guid` BETWEEN @OGUID AND @OGUID+55;
+INSERT INTO `gameobject` (`guid`,`id`,`map`,`spawnMask`,`phaseMask`,`position_x`,`position_y`,`position_z`,`orientation`,`rotation0`,`rotation1`,`rotation2`,`rotation3`,`spawntimesecs`,`animprogress`,`state`) VALUES
+(@OGUID+0,193096,571,1,128,5379.885,3008.093,409.181915,-3.124123,0,0,0,0,120,0,1),
+(@OGUID+1,193097,571,1,128,5381.73975,3008.15454,409.181915,2.98449826,0,0,0,0,120,0,1),
+(@OGUID+2,193098,571,1,128,5383.672,3008.02783,409.181915,-3.115388,0,0,0,0,120,0,1),
+(@OGUID+3,193099,571,1,128,5386.25342,3007.79614,409.181915,2.932139,0,0,0,0,120,0,1),
+(@OGUID+4,193100,571,1,128,5387.354,3009.64941,409.181915,-1.30899549,0,0,0,0,120,0,1),
+(@OGUID+5,193101,571,1,128,5381.12744,3010.09717,409.181915,-2.72271276,0,0,0,0,120,0,1),
+(@OGUID+6,193102,571,1,128,5383.12061,3007.90967,410.8231,-2.530723,0,0,0,0,120,0,1),
+(@OGUID+7,193103,571,1,128,5381.105,3007.89575,410.8231,-3.09791875,0,0,0,0,120,0,1),
+(@OGUID+8,193104,571,1,128,5376.777,3010.619,409.191742,-2.60926127,0,0,0,0,120,0,1),
+(@OGUID+9,193105,571,1,128,5381.47559,3010.24731,410.8231,-2.80997539,0,0,0,0,120,0,1),
+(@OGUID+10,193106,571,1,128,5381.059,3009.85864,410.8231,2.66161919,0,0,0,0,120,0,1),
+(@OGUID+11,193107,571,1,128,5381.038,3010.44263,410.8157,-2.0507617,0,0,0,0,120,0,1),
+(@OGUID+12,193108,571,1,128,5379.83154,3007.82373,410.8161,-2.02457881,0,0,0,0,120,0,1),
+(@OGUID+13,193109,571,1,128,5379.99463,3008.40356,410.815918,-3.03687477,0,0,0,0,120,0,1),
+(@OGUID+14,193124,571,1,128,5293.65869,2924.44019,409.29306,1.20427489,0,0,0,0,120,0,1),
+(@OGUID+15,193125,571,1,1,5293.28,2932.32813,409.065247,-2.49581814,0,0,0,0,120,0,1),
+(@OGUID+16,193126,571,1,1,5292.30469,2930.5105,409.157135,-3.06302428,0,0,0,0,120,0,1),
+(@OGUID+17,193127,571,1,64,5293.349,2923.712,409.844757,-1.8762306,0,0,0,0,120,0,1),
+(@OGUID+18,193128,571,1,128,5293.12256,2895.22754,409.208771,-0.9861096,0,0,0,0,120,0,1),
+(@OGUID+19,193129,571,1,128,5292.913,2895.54346,410.419617,-0.122171074,0,0,0,0,120,0,1),
+(@OGUID+20,193130,571,1,128,5294.09473,2894.191,409.164063,-0.7330382,0,0,0,0,120,0,1),
+(@OGUID+21,193131,571,1,128,5295.1875,2895.382,409.143219,-0.349065244,0,0,0,0,120,0,1),
+(@OGUID+22,193132,571,1,128,5294.527,2895.57471,410.6591,-1.92858779,0,0,0,0,120,0,1),
+(@OGUID+23,193133,571,1,128,5295.3916,2895.05737,410.6686,0.6894028,0,0,0,0,120,0,1),
+(@OGUID+24,193134,571,1,128,5295.13525,2895.68481,410.618866,-2.22529364,0,0,0,0,120,0,1),
+(@OGUID+25,193135,571,1,128,5294.97559,2895.33521,410.657684,-2.73143482,0,0,0,0,120,0,1),
+(@OGUID+26,193136,571,1,128,5293.22559,2895.46436,410.413483,-0.802850962,0,0,0,0,120,0,1),
+(@OGUID+27,193137,571,1,128,5295.56,2895.24146,410.628052,-2.11184788,0,0,0,0,120,0,1),
+(@OGUID+28,193138,571,1,128,5293.741,2894.48169,409.183167,-2.72271276,0,0,0,0,120,0,1),
+(@OGUID+29,193139,571,1,64,5294.599,2786.85254,409.8877,-2.356195,0,0,0,0,120,0,1),
+(@OGUID+30,193140,571,1,64,5294.37939,2785.03833,409.175018,-2.33873963,0,0,0,0,120,0,1),
+(@OGUID+31,193141,571,1,64,5293.205,2787.03052,409.218872,3.03687477,0,0,0,0,120,0,1),
+(@OGUID+32,193142,571,1,64,5294.241,2786.42456,409.174347,0.0174524616,0,0,0,0,120,0,1),
+(@OGUID+33,193143,571,1,64,5291.705,2785.86646,409.282135,-2.03330517,0,0,0,0,120,0,1),
+(@OGUID+34,193144,571,1,64,5293.03369,2785.632,409.22522,-1.2915417,0,0,0,0,120,0,1),
+(@OGUID+35,193145,571,1,64,5295.866,2787.7666,409.1923,2.155478,0,0,0,0,120,0,1),
+(@OGUID+36,193146,571,1,64,5293.56445,2787.31079,410.55954,0.261798173,0,0,0,0,120,0,1),
+(@OGUID+37,193147,571,1,128,5233.12061,2920.362,409.163544,-0.7243115,0,0,0,0,120,0,1),
+(@OGUID+38,193148,571,1,128,5238.27539,2920.67358,409.256439,-0.418878615,0,0,0,0,120,0,1),
+(@OGUID+39,193149,571,1,128,5235.902,2920.751,409.224457,-0.951203167,0,0,0,0,120,0,1),
+(@OGUID+40,193150,571,1,128,5237.36963,2919.89771,409.556641,0.8202983,0,0,0,0,120,0,1),
+(@OGUID+41,193151,571,1,128,5234.19775,2918.99731,409.322754,-2.33873963,0,0,0,0,120,0,1),
+(@OGUID+42,193152,571,1,128,5234.52344,2921.76221,409.175781,-2.2165668,0,0,0,0,120,0,1),
+(@OGUID+43,193153,571,1,128,5234.119,2918.93921,409.1339,-3.098036,0,0,0,0,120,0,1),
+(@OGUID+44,193154,571,1,128,5234.26758,2919.40015,409.502869,-2.18166113,0,0,0,0,120,0,1),
+(@OGUID+45,193155,571,1,128,5293.37939,2746.05566,409.22052,-0.06981169,0,0,0,0,120,0,1),
+(@OGUID+46,193156,571,1,128,5293.65039,2755.67529,409.1913,-0.43633157,0,0,0,0,120,0,1),
+(@OGUID+47,193157,571,1,128,5292.23535,2753.59473,409.0867,-0.357789934,0,0,0,0,120,0,1),
+(@OGUID+48,193158,571,1,128,5292.42969,2748.62427,409.131042,0.253072351,0,0,0,0,120,0,1),
+(@OGUID+49,193159,571,1,128,5293.384,2750.90283,409.234924,-0.0610866137,0,0,0,0,120,0,1),
+(@OGUID+50,193160,571,1,64,5371.89746,2805.47583,409.3072,0.0610866137,0,0,0,0,120,0,1),
+(@OGUID+51,193161,571,1,64,5376.616,2875.105,409.254822,1.59697616,0,0,0,0,120,0,1),
+(@OGUID+52,193162,571,1,128,5377.54932,2870.92456,409.239166,-0.549776852,0,0,0,0,120,0,1),
+(@OGUID+53,193163,571,1,128,5378.068,2813.61719,409.239166,1.55334139,0,0,0,0,120,0,1),
+(@OGUID+54,193164,571,1,128,5378.921,2805.43677,409.239166,1.53588688,0,0,0,0,120,0,1),
+(@OGUID+55,193165,571,1,128,5378.452,2876.67456,409.239166,1.54461825,0,0,0,0,120,0,1);
diff --git a/sql/old/3.3.5a/2012_08_20_04_world_wintergrasp_gossips.sql b/sql/old/3.3.5a/2012_08_20_04_world_wintergrasp_gossips.sql
new file mode 100644
index 00000000000..87b96b765a6
--- /dev/null
+++ b/sql/old/3.3.5a/2012_08_20_04_world_wintergrasp_gossips.sql
@@ -0,0 +1,20 @@
+-- Gossip Menu
+DELETE FROM `gossip_menu` WHERE `entry`=9904 AND `text_id`=13759;
+DELETE FROM `gossip_menu` WHERE `entry`=9904 AND `text_id`=13761;
+DELETE FROM `gossip_menu` WHERE `entry`=9923 AND `text_id`=14172;
+DELETE FROM `gossip_menu` WHERE `entry`=10229 AND `text_id`=14221;
+INSERT INTO `gossip_menu` (`entry`,`text_id`) VALUES
+(9904,13759),
+(9904,13761),
+(9923,14172),
+(10229,14221);
+
+-- Gossip Menu Option
+DELETE FROM `gossip_menu_option` WHERE `menu_id`=9904;
+DELETE FROM `gossip_menu_option` WHERE `menu_id`=10129 AND `id` IN (2,4);
+INSERT INTO `gossip_menu_option` (`menu_id`,`id`,`option_icon`,`option_text`,`option_id`,`npc_option_npcflag`,`action_menu_id`,`action_poi_id`,`box_coded`,`box_money`,`box_text`) VALUES
+(9904,0,0, 'I would like to build a catapult.',1,1,0,0,0,0, ''),
+(9904,1,0, 'I would like to build a demolisher.',1,1,0,0,0,0, ''),
+(9904,2,0, 'I would like to build a siege engine.',1,1,0,0,0,0, ''),
+(10129,2,0, 'Guide me to the Broken Temple Graveyard.',1,1,0,0,0,0, ''),
+(10129,4,0, 'Guide me to the Eastspark Graveyard.',1,1,0,0,0,0, '');
diff --git a/sql/old/3.3.5a/2012_08_20_05_world_wintergrasp_quests.sql b/sql/old/3.3.5a/2012_08_20_05_world_wintergrasp_quests.sql
new file mode 100644
index 00000000000..d456f5d5e71
--- /dev/null
+++ b/sql/old/3.3.5a/2012_08_20_05_world_wintergrasp_quests.sql
@@ -0,0 +1,16 @@
+-- Wintergrasp Quests - Horde
+UPDATE `quest_template` SET `ExclusiveGroup`=13180 WHERE `id` IN (13180,13178); -- Slay them all!
+UPDATE `quest_template` SET `ExclusiveGroup`=13185 WHERE `id` IN (13185,13223); -- Stop/Defend the Siege
+UPDATE `quest_template` SET `ExclusiveGroup`=13201 WHERE `id` IN (13201,13194); -- Healing with Roses
+UPDATE `quest_template` SET `ExclusiveGroup`=13199 WHERE `id` IN (13193,13199); -- Bones and Arrows
+UPDATE `quest_template` SET `ExclusiveGroup`=13192 WHERE `id` IN (13192,13202); -- Warding/Jinxing the Walls
+UPDATE `quest_template` SET `ExclusiveGroup`=13200 WHERE `id` IN (13200,13191); -- Fueling the Demolishers
+
+-- Wintergrasp Quests - Alliance
+UPDATE `quest_template` SET `ExclusiveGroup`=13179 WHERE `id` IN (13179,13177); -- No Mercy for the Merciless
+UPDATE `quest_template` SET `ExclusiveGroup`=13186 WHERE `id` IN (13186,13222); -- Stop/Defend the Siege
+UPDATE `quest_template` SET `ExclusiveGroup`=13195 WHERE `id` IN (13195,13156); -- A Rare Herb
+UPDATE `quest_template` SET `ExclusiveGroup`=13196 WHERE `id` IN (13196,13154); -- Bones and Arrows
+UPDATE `quest_template` SET `ExclusiveGroup`=13198 WHERE `id` IN (13198,13153); -- Warding the Warriors
+
+-- Note: The offered quests (they are in pairs) depend on who controls the keep. npc_wg_quest_giver does that already?
diff --git a/sql/old/3.3.5a/2012_08_20_06_world_wintergrasp_spells.sql b/sql/old/3.3.5a/2012_08_20_06_world_wintergrasp_spells.sql
new file mode 100644
index 00000000000..cb2bd219e40
--- /dev/null
+++ b/sql/old/3.3.5a/2012_08_20_06_world_wintergrasp_spells.sql
@@ -0,0 +1,81 @@
+-- 54640 Teleport (Teleports defenders behind the walls on the Isle of Ulduran, Strand of the Ancients) - FIX THIS?
+DELETE FROM `spell_linked_spell` WHERE `spell_trigger`=54640;
+INSERT INTO `spell_linked_spell` (`spell_trigger`,`spell_effect`,`type`,`comment`) VALUES
+(54640,54643,0, 'WG teleporter');
+
+-- Spell area
+DELETE FROM `spell_area` WHERE `spell` IN (58730,57940);
+INSERT INTO `spell_area` (`spell`,`area`,`quest_start`,`quest_start_active`,`quest_end`,`aura_spell`,`racemask`,`gender`,`autocast`) VALUES
+(58730,4581,0,0,0,0,0,2,1), -- Restricted Flight Area (Wintergrasp Eject)
+(58730,4539,0,0,0,0,0,2,1),
+(58730,4197,0,0,0,0,0,2,1),
+(58730,4585,0,0,0,0,0,2,1),
+(58730,4612,0,0,0,0,0,2,1),
+(58730,4582,0,0,0,0,0,2,1),
+(58730,4583,0,0,0,0,0,2,1),
+(58730,4589,0,0,0,0,0,2,1),
+(58730,4575,0,0,0,0,0,2,1),
+(58730,4538,0,0,0,0,0,2,1),
+(58730,4577,0,0,0,0,0,2,1),
+(57940,65,0,0,0,0,0,2,1), -- Essence of Wintergrasp
+(57940,66,0,0,0,0,0,2,1),
+(57940,67,0,0,0,0,0,2,1),
+(57940,206,0,0,0,0,0,2,1),
+(57940,210,0,0,0,0,0,2,1),
+(57940,394,0,0,0,0,0,2,1),
+(57940,395,0,0,0,0,0,2,1),
+(57940,1196,0,0,0,0,0,2,1),
+(57940,2817,0,0,0,0,0,2,1),
+(57940,3456,0,0,0,0,0,2,1),
+(57940,3477,0,0,0,0,0,2,1),
+(57940,3537,0,0,0,0,0,2,1),
+(57940,3711,0,0,0,0,0,2,1),
+(57940,4100,0,0,0,0,0,2,1),
+(57940,4196,0,0,0,0,0,2,1),
+(57940,4228,0,0,0,0,0,2,1),
+(57940,4264,0,0,0,0,0,2,1),
+(57940,4265,0,0,0,0,0,2,1),
+(57940,4272,0,0,0,0,0,2,1),
+(57940,4273,0,0,0,0,0,2,1),
+(57940,4395,0,0,0,0,0,2,1),
+(57940,4415,0,0,0,0,0,2,1),
+(57940,4416,0,0,0,0,0,2,1),
+(57940,4493,0,0,0,0,0,2,1),
+(57940,4494,0,0,0,0,0,2,1),
+(57940,4603,0,0,0,0,0,2,1);
+
+DELETE FROM `spell_area` WHERE `spell` IN (56618, 56617);
+INSERT INTO `spell_area` (`spell`,`area`,`autocast`) VALUES
+(56618, 4538, 1),
+(56617, 4538, 1),
+(56618, 4539, 1),
+(56617, 4539, 1),
+(56618, 4611, 1),
+(56617, 4611, 1),
+(56618, 4612, 1),
+(56617, 4612, 1);
+
+-- Spell scripts. replace with SAI
+DELETE FROM `spell_scripts` WHERE `id`=49899;
+INSERT INTO `spell_scripts` (`id`,`delay`,`command`,`datalong`,`datalong2`,`dataint`,`x`,`y`,`z`,`o`) VALUES
+(49899,0,1,406,0,0,0,0,0,0); -- Activate Robotic Arms
+
+-- Spell Target position for Wintergrasp Graveyard spells
+DELETE FROM `spell_target_position` WHERE `id` IN (59760,59762,59763,59765,59766,59767,59769);
+INSERT INTO `spell_target_position` (`id`,`target_map`,`target_position_x`,`target_position_y`,`target_position_z`,`target_orientation`) VALUES
+(59760,571,5537.986,2897.493,517.057,4.819249), -- Teleport: Fortress Graveyard
+(59762,571,5104.750,2300.940,368.579,0.733038), -- Teleport: Sunken Ring "area 4538"
+(59763,571,5099.120,3466.036,368.484,5.317802), -- Teleport: Broken Temple "area 4539 & 4589"
+(59765,571,5032.454,3711.382,372.468,3.971623), -- Teleport: Horde Landing Zone
+(59766,571,4331.716,3235.695,390.251,0.008500), -- Teleport: Westspark Factory Graveyard "area 4611"
+(59767,571,4314.648,2408.522,392.642,6.268125), -- Teleport: Eastspark Factory Graveyard "area 4612"
+(59769,571,5140.790,2179.120,390.950,1.972220); -- Teleport: Alliance Landing Zone
+
+DELETE FROM `spell_script_names` WHERE `spell_id` IN (61409, 56662, 56664, 56659, 49899, 61178);
+INSERT INTO `spell_script_names` (`spell_id`, `ScriptName`) VALUES
+(61409, 'spell_wintergrasp_force_building'),
+(56659, 'spell_wintergrasp_force_building'),
+(56662, 'spell_wintergrasp_force_building'),
+(56664, 'spell_wintergrasp_force_building'),
+(49899, 'spell_wintergrasp_force_building'),
+(61178, 'spell_wintergrasp_grab_passenger');
diff --git a/sql/old/3.3.5a/2012_08_20_07_world_wintergrasp_texts.sql b/sql/old/3.3.5a/2012_08_20_07_world_wintergrasp_texts.sql
new file mode 100644
index 00000000000..090c5350c74
--- /dev/null
+++ b/sql/old/3.3.5a/2012_08_20_07_world_wintergrasp_texts.sql
@@ -0,0 +1,108 @@
+-- Unused yet:
+-- Wintergrasp is under attack!
+-- Wintergrasp Fortress is under attack!
+-- Winter's Edge Tower is under attack!
+-- Eastern Bridge is under attack!
+-- Western Bridge is under attack!
+-- Westspark Bridge is under attack!
+-- Flamewatch Tower is under attack!
+
+-- 'You have reached Rank 1: Corporal' Sent to player by raid leader
+-- 'You have reached Rank 2: First Lieutenant' Sent to player by raid leader
+
+-- Wintergrasp coreside texts
+DELETE FROM `trinity_string` WHERE `entry` BETWEEN 12050 AND 12072;
+INSERT INTO `trinity_string` (`entry`,`content_default`,`content_loc1`,`content_loc2`,`content_loc3`,`content_loc4`,`content_loc5`,`content_loc6`,`content_loc7`,`content_loc8`)VALUES
+(12050, '%s has been captured by %s ', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL),
+(12051, '%s is under attack by %s', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL),
+(12052, 'The Broken Temple siege workshop', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL),
+(12053, 'Eastspark siege workshop', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL),
+(12054, 'Westspark siege workshop', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL),
+(12055, 'The Sunken Ring siege workshop', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL),
+(12057, 'Alliance', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL),
+(12056, 'Horde', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL),
+(12058, 'The battle for Wintergrasp is about to begin!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL),
+(12059, 'You have reached Rank 1: Corporal', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL),
+(12060, 'You have reached Rank 2: First Lieutenant', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL),
+(12061, 'The south-eastern keep tower', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL),
+(12062, 'The north-eastern keep tower', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL),
+(12063, 'The south-western keep tower', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL),
+(12064, 'The north-western keep tower', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL),
+(12065, '%s has been damaged !', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL),
+(12066, '%s has been destroyed!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL),
+(12067, 'The battle for Wintergrasp begin!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL),
+(12068, '%s has successfully defended the Wintergrasp fortress!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL),
+(12069, 'The southern tower', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL),
+(12070, 'The eastern tower', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL),
+(12071, 'The western tower', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL),
+(12072, 'The Wintergrasp fortress has been captured by %s !', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
+
+-- Wintergrasp script texts
+DELETE FROM `script_texts` WHERE entry BETWEEN -1850507 AND -1850500;
+INSERT INTO `script_texts` (`npc_entry`,`entry`,`content_default`,`content_loc1`,`content_loc2`,`content_loc3`,`content_loc4`,`content_loc5`,`content_loc6`,`content_loc7`,`content_loc8`,`sound`,`type`,`language`,`emote`,`comment`)VALUES
+(0, -1850500, 'Guide me to the Fortress Graveyard.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, 0, 0, 0, ''),
+(0, -1850501, 'Guide me to the Sunken Ring Graveyard.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, 0, 0, 0, ''),
+(0, -1850502, 'Guide me to the Broken Temple Graveyard.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, 0, 0, 0, ''),
+(0, -1850503, 'Guide me to the Westspark Graveyard.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, 0, 0, 0, ''),
+(0, -1850504, 'Guide me to the Eastspark Graveyard.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, 0, 0, 0, ''),
+(0, -1850505, 'Guide me back to the Horde landing camp.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, 0, 0, 0, ''),
+(0, -1850506, 'Guide me back to the Alliance landing camp.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, 0, 0, 0, ''),
+(0, -1850507, 'Se mettre dans la file pour le Joug-d''hiver.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, 0, 0, 0, ''); -- (Needs proper english text, maybe "Get in the queue for Wintergrasp."?)
+
+-- New support-commands for battlefield class
+DELETE FROM `command` WHERE name IN ('bf start', 'bf stop', 'bf enable', 'bf switch', 'bf timer');
+INSERT INTO `command` (`name`,`security`,`help`) VALUES
+('bf start',3,'Syntax: .bf start #battleid'),
+('bf stop',3,'Syntax: .bf stop #battleid'),
+('bf enable',3,'Syntax: .bf enable #battleid'),
+('bf switch',3,'Syntax: .bf switch #battleid'),
+('bf timer',3,'Syntax: .bf timer #battleid #timer');
+
+-- NPC talk text insert from sniff
+DELETE FROM `creature_text` WHERE `entry`=15214 AND `groupid` BETWEEN 0 AND 30;
+DELETE FROM `creature_text` WHERE `entry` IN (31036,31091) AND `groupid` BETWEEN 0 AND 3;
+DELETE FROM `creature_text` WHERE `entry` IN (31108,31109,34924) AND `groupid`=0;
+INSERT INTO `creature_text` (`entry`,`groupid`,`id`,`text`,`type`,`language`,`probability`,`emote`,`duration`,`sound`,`comment`) VALUES
+(15214,0,0, 'Let the battle begin!',3,0,100,0,0,0, 'Invisible Stalker'),
+(15214,1,0, 'The southern tower has been damaged!',3,0,100,0,0,0, 'Invisible Stalker'),
+(15214,2,0, 'The southern tower has been destroyed!',3,0,100,0,0,0, 'Invisible Stalker'),
+(15214,3,0, 'The eastern tower has been damaged!',3,0,100,0,0,0, 'Invisible Stalker'),
+(15214,4,0, 'The eastern tower has been destroyed!',3,0,100,0,0,0, 'Invisible Stalker'),
+(15214,5,0, 'The western tower has been damaged!',3,0,100,0,0,0, 'Invisible Stalker'),
+(15214,6,0, 'The western tower has been destroyed!',3,0,100,0,0,0, 'Invisible Stalker'),
+(15214,7,0, 'The north-western keep tower has been damaged!',3,0,100,0,0,0, 'Invisible Stalker'),
+(15214,8,0, 'The north-western keep tower has been destroyed!',3,0,100,0,0,0, 'Invisible Stalker'),
+(15214,9,0, 'The south-eastern keep tower has been damaged!',3,0,100,0,0,0, 'Invisible Stalker'),
+(15214,10,0, 'The south-eastern keep tower has been destroyed!',3,0,100,0,0,0, 'Invisible Stalker'),
+(15214,11,0, 'The Broken Temple siege workshop has been attacked by the Alliance!',3,0,100,0,0,0, 'Invisible Stalker'),
+(15214,12,0, 'The Broken Temple siege workshop has been captured by the Alliance!',3,0,100,0,0,0, 'Invisible Stalker'),
+(15214,13,0, 'The Broken Temple siege workshop has been attacked by the Horde!',3,0,100,0,0,0, 'Invisible Stalker'),
+(15214,14,0, 'The Broken Temple siege workshop has been captured by the Horde!',3,0,100,0,0,0, 'Invisible Stalker'),
+(15214,15,0, 'The Eastspark siege workshop has been attacked by the Alliance!',3,0,100,0,0,0, 'Invisible Stalker'),
+(15214,16,0, 'The Eastspark siege workshop has been captured by the Alliance!',3,0,100,0,0,0, 'Invisible Stalker'),
+(15214,17,0, 'The Eastspark siege workshop has been attacked by the Horde!',3,0,100,0,0,0, 'Invisible Stalker'),
+(15214,18,0, 'The Eastspark siege workshop has been captured by the Horde!',3,0,100,0,0,0, 'Invisible Stalker'),
+(15214,19,0, 'The Sunken Ring siege workshop has been attacked by the Alliance!',3,0,100,0,0,0, 'Invisible Stalker'),
+(15214,20,0, 'The Sunken Ring siege workshop has been captured by the Alliance!',3,0,100,0,0,0, 'Invisible Stalker'),
+(15214,21,0, 'The Sunken Ring siege workshop has been attacked by the Horde!',3,0,100,0,0,0, 'Invisible Stalker'),
+(15214,22,0, 'The Sunken Ring siege workshop has been captured by the Horde!',3,0,100,0,0,0, 'Invisible Stalker'),
+(15214,23,0, 'The Westspark siege workshop has been attacked by the Alliance!',3,0,100,0,0,0, 'Invisible Stalker'),
+(15214,24,0, 'The Westspark siege workshop has been captured by the Alliance!',3,0,100,0,0,0, 'Invisible Stalker'),
+(15214,25,0, 'The Westspark siege workshop has been attacked by the Horde!',3,0,100,0,0,0, 'Invisible Stalker'),
+(15214,26,0, 'The Westspark siege workshop has been captured by the Horde!',3,0,100,0,0,0, 'Invisible Stalker'),
+(15214,27,0, 'The Alliance has defended Wintergrasp Fortress!',3,0,100,0,0,0, 'Invisible Stalker'),
+(15214,28,0, 'The Alliance has captured Wintergrasp Fortress!',3,0,100,0,0,0, 'Invisible Stalker'),
+(15214,29,0, 'The Horde has defended Wintergrasp Fortress!',3,0,100,0,0,0, 'Invisible Stalker'),
+(15214,30,0, 'The Horde has captured Wintergrasp Fortress!',3,0,100,0,0,0, 'Invisible Stalker'),
+-- Not sure if all Alliance text is here, need horde text
+(31036,0,0, 'The first of the Horde towers has fallen! Destroy all three and we will hasten their retreat!',1,7,100,0,0,0, 'Commander Zanneth'),
+(31036,1,0, 'The second tower has fallen! Destroy the final tower and we will hasten their retreat!',1,7,100,0,0,0, 'Commander Zanneth'),
+(31036,2,0, 'The Horde towers have fallen! We have forced their hand. Finish off the remaining forces!',1,7,100,0,0,0, 'Commander Zanneth'),
+(31036,3,0, 'Show those animals no mercy, $n!',0,7,100,0,0,0, 'Commander Zanneth'),
+(31091,0,0, 'The first of the Alliance towers has fallen! Destroy all three and we will hasten their retreat!',1,7,100,0,0,0, 'Commander Dardosh'),
+(31091,1,0, 'Lok''tar! The second tower falls! Destroy the final tower and we will hasten their retreat!',1,7,100,0,0,0, 'Commander Dardosh'),
+(31091,2,0, 'The Alliance towers have fallen! We have forced their hand. Finish off the remaining forces!',1,7,100,0,0,0, 'Commander Dardosh'),
+(31091,3,0, 'Show those animals no mercy, $n!',0,7,100,0,0,0, 'Commander Dardosh'), -- ???
+(31108,0,0, 'Stop the Horde from retrieving the embers, $n. We cannot risk them having the advantage when the battle resumes!',0,7,100,0,0,0, 'Siege Master Stouthandle'),
+(31109,0,0, 'Destroy their foul machines of war, $n!',0,7,100,0,0,0, 'Senior Demolitionist Legoso'),
+(34924,0,0, 'The gates have been breached! Defend the keep!',1,0,100,0,0,0, 'High Commander Halford Wyrmbane');
diff --git a/sql/old/3.3.5a/2012_08_20_08_world_achievement_criteria_data.sql b/sql/old/3.3.5a/2012_08_20_08_world_achievement_criteria_data.sql
new file mode 100644
index 00000000000..fa995e7804f
--- /dev/null
+++ b/sql/old/3.3.5a/2012_08_20_08_world_achievement_criteria_data.sql
@@ -0,0 +1,4 @@
+DELETE FROM `achievement_criteria_data` WHERE criteria_id = 7703;
+INSERT INTO `achievement_criteria_data` VALUES
+(7703, 6, 4197, 0, ''),
+(7703, 11, 0, 0, 'achievement_wg_didnt_stand_a_chance');
diff --git a/sql/old/3.3.5a/2012_08_20_09_world_disables.sql b/sql/old/3.3.5a/2012_08_20_09_world_disables.sql
new file mode 100644
index 00000000000..fa5010b669f
--- /dev/null
+++ b/sql/old/3.3.5a/2012_08_20_09_world_disables.sql
@@ -0,0 +1 @@
+DELETE FROM `disables` WHERE `entry` = 7703 AND `sourceType` = 4;
diff --git a/sql/old/3.3.5a/2012_08_21_00_world_spell_proc_event.sql b/sql/old/3.3.5a/2012_08_21_00_world_spell_proc_event.sql
new file mode 100644
index 00000000000..e1a8b59acae
--- /dev/null
+++ b/sql/old/3.3.5a/2012_08_21_00_world_spell_proc_event.sql
@@ -0,0 +1,3 @@
+DELETE FROM `spell_proc_event` WHERE `entry`=64752;
+INSERT INTO `spell_proc_event` (`entry`,`SchoolMask`,`SpellFamilyName`,`SpellFamilyMask0`,`SpellFamilyMask1`,`SpellFamilyMask2`,`procFlags`,`procEx`,`ppmRate`,`CustomChance`,`Cooldown`) VALUES
+(64752,0,7,8392704,256,2097152,0,0,0,0,0);
diff --git a/sql/old/3.3.5a/2012_08_21_01_world_command.sql b/sql/old/3.3.5a/2012_08_21_01_world_command.sql
new file mode 100644
index 00000000000..df833d2d246
--- /dev/null
+++ b/sql/old/3.3.5a/2012_08_21_01_world_command.sql
@@ -0,0 +1,3 @@
+DELETE FROM `command` WHERE name='quest reward';
+INSERT INTO `command` (`name`,`security`,`help`) VALUES
+('quest reward',3,'Syntax: .quest reward #questId\n\n\Grants quest reward to selected player and removes quest from his log (quest must be in completed state).');
diff --git a/sql/old/3.3.5a/2012_08_21_02_world_wintergrasp_conditions.sql b/sql/old/3.3.5a/2012_08_21_02_world_wintergrasp_conditions.sql
new file mode 100644
index 00000000000..caf8a0cc1e4
--- /dev/null
+++ b/sql/old/3.3.5a/2012_08_21_02_world_wintergrasp_conditions.sql
@@ -0,0 +1,23 @@
+-- Conditions
+-- Add gossip_menu condition for 9904 Horde
+DELETE FROM `conditions` WHERE `SourceTypeOrReferenceId` IN (14,15) AND `SourceGroup` IN (9904,9923);
+INSERT INTO `conditions` (`SourceTypeOrReferenceId`,`SourceGroup`,`SourceEntry`,`ElseGroup`,`ConditionTypeOrReference`,`ConditionValue1`,`NegativeCondition`) VALUES
+(14,9904,13759,0,1,33280,0), -- Must have Rank 1: Corporal
+(14,9904,13759,1,1,55629,0), -- Or must have Rank 2: First Lieutenant
+(14,9904,13761,0,1,33280,1), -- Must not have Rank 1: Corporal
+(14,9904,13761,0,1,55629,1), -- Must not have Rank 2: First Lieutenant
+-- Add gossip_menu condition for 9923 Alliance
+(14,9923,13798,0,1,33280,0), -- Must have Rank 1: Corporal
+(14,9923,13798,1,1,55629,0), -- Or must have Rank 2: First Lieutenant
+(14,9923,14172,0,1,33280,1), -- Must not have Rank 1: Corporal
+(14,9923,14172,0,1,55629,1), -- Must not have Rank 2: First Lieutenant
+-- Add conditions to gossip options horde
+(15,9904,0,0,1,33280,0), -- Must have reached Rank 1: Corporal
+(15,9904,0,1,1,55629,0), -- Or must have reached Rank 2: First Lieutenant
+(15,9904,1,0,1,55629,0), -- Must have reached Rank 2: First Lieutenant
+(15,9904,2,0,1,55629,0), -- Must have reached Rank 2: First Lieutenant
+-- Add conditions to gossip options alliance
+(15,9923,0,0,1,33280,0), -- Must have reached Rank 1: Corporal
+(15,9923,0,1,1,55629,0), -- Or must have reached Rank 2: First Lieutenant
+(15,9923,1,0,1,55629,0), -- Must have reached Rank 2: First Lieutenant
+(15,9923,2,0,1,55629,0); -- Must have reached Rank 2: First Lieutenant
diff --git a/sql/old/3.3.5a/2012_08_23_00_world_wintergrasp_spell_script_names.sql b/sql/old/3.3.5a/2012_08_23_00_world_wintergrasp_spell_script_names.sql
new file mode 100644
index 00000000000..a3dbf81d425
--- /dev/null
+++ b/sql/old/3.3.5a/2012_08_23_00_world_wintergrasp_spell_script_names.sql
@@ -0,0 +1,3 @@
+DELETE FROM `spell_script_names` WHERE `spell_id` = 54640;
+INSERT INTO `spell_script_names` (`spell_id`,`ScriptName`) VALUES
+(54640, 'spell_wintergrasp_defender_teleport');
diff --git a/sql/old/3.3.5a/2012_08_23_01_world_wintergrasp_gameobject.sql b/sql/old/3.3.5a/2012_08_23_01_world_wintergrasp_gameobject.sql
new file mode 100644
index 00000000000..27f7b4027f1
--- /dev/null
+++ b/sql/old/3.3.5a/2012_08_23_01_world_wintergrasp_gameobject.sql
@@ -0,0 +1 @@
+DELETE FROM `gameobject` WHERE `guid` IN (67259,67135,60476,66674,66675,67127,67128,66728,66731,67125,66730,66732,67126,67256,67132,67133,66733,67134,67251,67255,67129,67130,67131,67253,67258,67259,67260,75975,75976,76021,76022,66729,66718,66719,66720,66721,66722,66723,66724,66725,66726);
diff --git a/sql/old/3.3.5a/2012_08_25_00_world_creature_template.sql b/sql/old/3.3.5a/2012_08_25_00_world_creature_template.sql
new file mode 100644
index 00000000000..f7ec4c87fb9
--- /dev/null
+++ b/sql/old/3.3.5a/2012_08_25_00_world_creature_template.sql
@@ -0,0 +1,3 @@
+-- Wintergrasp Siege Turret
+UPDATE `creature_template` SET `faction_A`=1732,`faction_H`=1732 WHERE `entry`=28319; -- Alliance
+UPDATE `creature_template` SET `faction_A`=1735,`faction_H`=1735 WHERE `entry`=32629; -- Horde
diff --git a/sql/old/3.3.5a/2012_08_25_01_world_creature_template.sql b/sql/old/3.3.5a/2012_08_25_01_world_creature_template.sql
new file mode 100644
index 00000000000..ef8e5bdd8fc
--- /dev/null
+++ b/sql/old/3.3.5a/2012_08_25_01_world_creature_template.sql
@@ -0,0 +1 @@
+UPDATE `creature_template` SET `faction_A`=103,`faction_H`=103 WHERE `entry` IN (30890,31540); -- Twilight Whelp
diff --git a/sql/old/3.3.5a/2012_08_26_00_world_conditions.sql b/sql/old/3.3.5a/2012_08_26_00_world_conditions.sql
new file mode 100644
index 00000000000..c33d9bfc878
--- /dev/null
+++ b/sql/old/3.3.5a/2012_08_26_00_world_conditions.sql
@@ -0,0 +1,5 @@
+DELETE FROM `conditions` WHERE `SourceTypeOrReferenceId`=13 AND `SourceEntry`=61632;
+INSERT INTO `conditions` (`SourceTypeOrReferenceId`,`SourceGroup`,`SourceEntry`,`SourceId`,`ElseGroup`,`ConditionTypeOrReference`,`ConditionTarget`,`ConditionValue1`,`ConditionValue2`,`ConditionValue3`,`NegativeCondition`,`ErrorTextId`,`ScriptName`,`Comment`) VALUES
+(13,7,61632,0,0,31,0,3,30449,0,0,0,'','Sartharion Berserk - Only hit Tenebron, Shadron & Vesperon'),
+(13,7,61632,0,1,31,0,3,30451,0,0,0,'','Sartharion Berserk - Only hit Tenebron, Shadron & Vesperon'),
+(13,7,61632,0,2,31,0,3,30452,0,0,0,'','Sartharion Berserk - Only hit Tenebron, Shadron & Vesperon');
diff --git a/sql/old/3.3.5a/2012_08_26_01_world_creature.sql b/sql/old/3.3.5a/2012_08_26_01_world_creature.sql
new file mode 100644
index 00000000000..af14886850d
--- /dev/null
+++ b/sql/old/3.3.5a/2012_08_26_01_world_creature.sql
@@ -0,0 +1 @@
+UPDATE `creature` SET `phaseMask`=256 WHERE `id`=34300;
diff --git a/sql/old/3.3.5a/2012_08_26_02_world_spell_area.sql b/sql/old/3.3.5a/2012_08_26_02_world_spell_area.sql
new file mode 100644
index 00000000000..c4eae68e3c4
--- /dev/null
+++ b/sql/old/3.3.5a/2012_08_26_02_world_spell_area.sql
@@ -0,0 +1,3 @@
+DELETE FROM `spell_area` WHERE spell=58045;
+INSERT INTO `spell_area` (`spell`,`area`,`quest_start`,`quest_start_active`,`quest_end`,`aura_spell`,`racemask`,`gender`,`autocast`) VALUES
+(58045,4197,0,0,0,0,0,2,1);
diff --git a/sql/old/3.3.5a/2012_08_26_03_world_spell_area.sql b/sql/old/3.3.5a/2012_08_26_03_world_spell_area.sql
new file mode 100644
index 00000000000..65072d2b4a7
--- /dev/null
+++ b/sql/old/3.3.5a/2012_08_26_03_world_spell_area.sql
@@ -0,0 +1,3 @@
+DELETE FROM `spell_area` WHERE spell=74411 AND `area`=4197;
+INSERT INTO `spell_area` (`spell`,`area`,`quest_start`,`quest_start_active`,`quest_end`,`aura_spell`,`racemask`,`gender`,`autocast`) VALUES
+(74411,4197,0,0,0,0,0,2,1);
diff --git a/sql/old/3.3.5a/2012_08_27_00_world_creature_template.sql b/sql/old/3.3.5a/2012_08_27_00_world_creature_template.sql
new file mode 100644
index 00000000000..804d7b5c61d
--- /dev/null
+++ b/sql/old/3.3.5a/2012_08_27_00_world_creature_template.sql
@@ -0,0 +1,2 @@
+-- NPC script linking for Wyrmrest Defender ID: 27629
+UPDATE `creature_template` SET `ScriptName`='npc_wyrmrest_defender' WHERE `entry`=27629;
diff --git a/sql/old/3.3.5a/2012_08_27_00_world_spell_script_name.sql b/sql/old/3.3.5a/2012_08_27_00_world_spell_script_name.sql
new file mode 100644
index 00000000000..1d036df0a65
--- /dev/null
+++ b/sql/old/3.3.5a/2012_08_27_00_world_spell_script_name.sql
@@ -0,0 +1,4 @@
+-- Spell script name linking for Defending Wyrmrest Temple: Character Script Cast From Gossip ID: 49123
+DELETE FROM `spell_script_names` WHERE `spell_id`=49213;
+INSERT INTO `spell_script_names` (`spell_id`, `ScriptName`) VALUES
+(49213,'spell_q12372_cast_from_gossip_trigger');
diff --git a/sql/old/3.3.5a/2012_08_27_01_world_sai.sql b/sql/old/3.3.5a/2012_08_27_01_world_sai.sql
new file mode 100644
index 00000000000..302c3ac1942
--- /dev/null
+++ b/sql/old/3.3.5a/2012_08_27_01_world_sai.sql
@@ -0,0 +1,13 @@
+DELETE FROM `creature_ai_scripts` WHERE `creature_id`=17398;
+UPDATE `creature_template` SET `AIName`='SmartAI' WHERE `entry`=17398;
+
+DELETE FROM `smart_scripts` WHERE `entryorguid` IN (-85712,-85717,-85719,-85724);
+INSERT INTO `smart_scripts` (`entryorguid`, `source_type`, `id`, `link`, `event_type`, `event_phase_mask`, `event_chance`, `event_flags`, `event_param1`, `event_param2`, `event_param3`, `event_param4`, `action_type`, `action_param1`, `action_param2`, `action_param3`, `action_param4`, `action_param5`, `action_param6`, `target_type`, `target_param1`, `target_param2`, `target_param3`, `target_x`, `target_y`, `target_z`, `target_o`, `comment`) VALUES
+(-85724, 0, 0, 0, 6, 0, 100, 0, 0, 0, 0, 0, 9, 29607, 0, 0, 0, 0, 0, 14, 22299, 0, 0, 0, 0, 0, 0, 'Blood Furnace - First Cell'),
+(-85719, 0, 0, 0, 6, 0, 100, 0, 0, 0, 0, 0, 9, 29607, 0, 0, 0, 0, 0, 14, 22297, 0, 0, 0, 0, 0, 0, 'Blood Furnace - Second Cell'),
+(-85717, 0, 0, 0, 6, 0, 100, 0, 0, 0, 0, 0, 9, 29607, 0, 0, 0, 0, 0, 14, 22298, 0, 0, 0, 0, 0, 0, 'Blood Furnace - Third Cell'),
+(-85712, 0, 0, 0, 6, 0, 100, 0, 0, 0, 0, 0, 9, 29607, 0, 0, 0, 0, 0, 14, 22296, 0, 0, 0, 0, 0, 0, 'Blood Furnace - Fourth Cell');
+
+DELETE FROM `gameobject_scripts` WHERE `id`=150441;
+INSERT INTO `gameobject_scripts` (`id`, `delay`, `command`, `datalong`, `datalong2`, `dataint`, `x`, `y`, `z`, `o`) VALUES
+(150441, 3, 11, 22295, 0, 0, 0, 0, 0, 0);
diff --git a/sql/old/3.3.5a/2012_08_27_02_world_creature.sql b/sql/old/3.3.5a/2012_08_27_02_world_creature.sql
new file mode 100644
index 00000000000..3595ea7b576
--- /dev/null
+++ b/sql/old/3.3.5a/2012_08_27_02_world_creature.sql
@@ -0,0 +1,4 @@
+SET @GUID = 42638; -- Set by TDB team (need X)
+DELETE FROM `creature` WHERE `guid`=@GUID AND `id`=7172;
+INSERT INTO `creature` (`guid`, `id`, `map`, `spawnMask`, `phaseMask`, `modelid`, `equipment_id`, `position_x`, `position_y`, `position_z`, `orientation`, `spawntimesecs`, `spawndist`, `currentwaypoint`, `curhealth`, `curmana`, `MovementType`, `npcflag`, `unit_flags`, `dynamicflags`) VALUES
+(@GUID,7172,70,1,1,0,0,150.466,306.014,-49.543,5.2359,300,0,0,1,0,0,0,0,0);
diff --git a/sql/old/3.3.5a/2012_08_27_02_world_playercreateinfo_spell.sql b/sql/old/3.3.5a/2012_08_27_02_world_playercreateinfo_spell.sql
new file mode 100644
index 00000000000..9c664142bba
--- /dev/null
+++ b/sql/old/3.3.5a/2012_08_27_02_world_playercreateinfo_spell.sql
@@ -0,0 +1,9 @@
+DELETE FROM `playercreateinfo_spell` WHERE `Spell` IN (59221,59535,59536,59538,59539,59540,59541);
+INSERT INTO `playercreateinfo_spell` (`race`, `class`, `Spell`, `Note`) VALUES
+(11,1,59221,'Shadow Resistance'),
+(11,2,59535,'Shadow Resistance'),
+(11,3,59536,'Shadow Resistance'),
+(11,5,59538,'Shadow Resistance'),
+(11,6,59539,'Shadow Resistance'),
+(11,7,59540,'Shadow Resistance'),
+(11,8,59541,'Shadow Resistance');
diff --git a/sql/old/3.3.5a/2012_08_27_03_world_gameobject.sql b/sql/old/3.3.5a/2012_08_27_03_world_gameobject.sql
new file mode 100644
index 00000000000..1bf836c96e0
--- /dev/null
+++ b/sql/old/3.3.5a/2012_08_27_03_world_gameobject.sql
@@ -0,0 +1,6 @@
+-- Spawn Blackened Urn (194092) GO based on sniff by Aokromes
+SET @GUID := 334; -- Set by TDB team
+
+DELETE FROM `gameobject` WHERE `id`=194092;
+INSERT INTO `gameobject` (`guid`,`id`,`map`,`spawnMask`,`phaseMask`,`position_x`,`position_y`,`position_z`,`orientation`,`rotation0`,`rotation1`,`rotation2`,`rotation3`,`spawntimesecs`,`animprogress`,`state`) VALUES
+(@GUID,194092,532,1,1,-11126.87,-1874.455,91.47264,6.056293,0,0,-0.113203,0.9935719,180,100,1);
diff --git a/sql/old/3.3.5a/2012_08_27_04_world_quest_template.sql b/sql/old/3.3.5a/2012_08_27_04_world_quest_template.sql
new file mode 100644
index 00000000000..9169a6e5862
--- /dev/null
+++ b/sql/old/3.3.5a/2012_08_27_04_world_quest_template.sql
@@ -0,0 +1 @@
+UPDATE `quest_template` SET `NextQuestId`=12257 WHERE `ID`=12468;
diff --git a/sql/old/3.3.5a/2012_08_27_05_world_sai.sql b/sql/old/3.3.5a/2012_08_27_05_world_sai.sql
new file mode 100644
index 00000000000..3da0143e6e6
--- /dev/null
+++ b/sql/old/3.3.5a/2012_08_27_05_world_sai.sql
@@ -0,0 +1,56 @@
+-- A Race Against Time (11671)
+
+SET @NPC_SALRAND := 25584; -- Inquisitor Salrand
+SET @NPC_BERYL_INVISMAN := 25594; -- Beryl Point InvisMan
+SET @GOB_BERYL_SHIELD := 187773; -- Beryl Shield
+SET @GOB_BERYL_SHIELD_FOCUS := 300176; -- TEMP Beryl Force Shield
+SET @SPELL_BEAM := 45777; -- Salrand's Beam
+SET @SPELL_THROW_DETONATOR := 45780; -- Throw Beryl Shield Detonator
+SET @SPELL_SUMMON_DETONATOR := 45791; -- Summon Beryl Detonator
+SET @SPELL_EXPLOSION := 45796; -- Beryl Shield Explosion
+SET @SPELL_LOCKBOX := 45809; -- Summon Salrand's Lockbox
+SET @GUID := 60441; -- used for a wrong go spawn,will reuse
+
+UPDATE `gameobject_template` SET `data1`=80 WHERE `entry`=300176; -- spell focus radius
+UPDATE `gameobject_template` SET `flags`=32 WHERE `entry`=187773; -- shield:nodespawn flag
+
+-- missing spell focus
+DELETE FROM `gameobject` WHERE `guid`=@GUID;
+INSERT INTO `gameobject` (`guid`,`id`,`map`,`spawnMask`,`phaseMask`,`position_x`,`position_y`,`position_z`,`orientation`,`rotation0`,`rotation1`,`rotation2`,`rotation3`,`spawntimesecs`,`animprogress`,`state`) VALUES
+(@GUID,@GOB_BERYL_SHIELD_FOCUS,571,1,1,3392.85,6161.089,79.8313,0,0,0,0,0,300,0,1);
+
+UPDATE `creature_template` SET `InhabitType`=0x4,`unit_flags`=0x100,`AIName`='SmartAI' WHERE `entry`=@NPC_SALRAND;
+UPDATE `creature_template` SET `AIName`='SmartAI' WHERE `entry`=@NPC_BERYL_INVISMAN;
+
+DELETE FROM `creature_template_addon` WHERE `entry`=@NPC_SALRAND;
+INSERT INTO `creature_template_addon` (`entry`,`mount`,`bytes1`,`bytes2`,`auras`) VALUES
+(@NPC_SALRAND,0,0x0,0x1,'45775');
+
+DELETE FROM `creature_ai_scripts` WHERE `creature_id`=@NPC_SALRAND;
+DELETE FROM `smart_scripts` WHERE (`source_type`=0 AND `entryorguid` IN (@NPC_SALRAND,@NPC_BERYL_INVISMAN)) OR (`source_type`=9 AND `entryorguid` IN (@NPC_SALRAND*100,@NPC_BERYL_INVISMAN*100));
+INSERT INTO `smart_scripts` (`entryorguid`,`source_type`,`id`,`link`,`event_type`,`event_phase_mask`,`event_chance`,`event_flags`,`event_param1`,`event_param2`,`event_param3`,`event_param4`,`action_type`,`action_param1`,`action_param2`,`action_param3`,`action_param4`,`action_param5`,`action_param6`,`target_type`,`target_param1`,`target_param2`,`target_param3`,`target_x`,`target_y`,`target_z`,`target_o`,`comment`) VALUES
+(@NPC_SALRAND,0,0,0,38,0,100,1,1,1,0,0,1,0,0,0,0,0,0,1,0,0,0,0,0,0,0,'On data 1 1 - Say'),
+(@NPC_SALRAND,0,1,2,38,0,100,1,1,2,0,0,1,1,0,0,0,0,0,1,0,0,0,0,0,0,0,'On data 1 2 - Say'),
+(@NPC_SALRAND,0,2,0,61,0,100,1,0,0,0,0,80,@NPC_SALRAND*100,0,0,0,0,0,1,0,0,0,0,0,0,0,'On link - Run script'),
+(@NPC_SALRAND,0,3,4,6,0,100,1,0,0,0,0,11,@SPELL_LOCKBOX,0,0,0,0,0,1,0,0,0,0,0,0,0,'On death - Cast spell'),
+(@NPC_SALRAND,0,4,0,61,0,100,1,0,0,0,0,1,2,0,0,0,0,0,1,0,0,0,0,0,0,0,'On death - Say'),
+(@NPC_SALRAND,0,5,0,11,0,100,1,0,0,0,0,24,0,0,0,0,0,0,15,0,0,0,0,0,0,0,'On respawn - Evade'),
+(@NPC_SALRAND*100,9,0,0,0,0,100,0,0,0,0,0,60,0,0,0,0,0,0,1,0,0,0,0,0,0,0,'On script - set fly off'),
+(@NPC_SALRAND*100,9,1,0,0,0,100,0,0,0,0,0,69,0,0,0,0,0,0,8,0,0,0,3392.852,6161.092,79.83095,0,'On script - Move to pos'),
+(@NPC_SALRAND*100,9,2,0,0,0,100,0,3000,3000,0,0,19,256,0,0,0,0,0,1,0,0,0,0,0,0,0,'On script - Set unit flags'),
+--
+(@NPC_BERYL_INVISMAN,0,0,0,8,0,100,0,@SPELL_THROW_DETONATOR,0,0,0,80,@NPC_BERYL_INVISMAN*100,0,0,0,0,0,1,0,0,0,0,0,0,0,'On spellhit - Run Script'),
+(@NPC_BERYL_INVISMAN*100,9,0,0,0,0,100,0,0,0,0,0,11,@SPELL_SUMMON_DETONATOR,0,0,0,0,0,1,0,0,0,0,0,0,0,'On script - Cast Spell'),
+(@NPC_BERYL_INVISMAN*100,9,1,0,0,0,100,0,0,0,0,0,45,1,1,0,0,0,0,19,@NPC_SALRAND,100,0,0,0,0,0,'On script - Set Data'),
+(@NPC_BERYL_INVISMAN*100,9,2,0,0,0,100,0,8000,8000,0,0,45,1,2,0,0,0,0,19,@NPC_SALRAND,100,0,0,0,0,0,'On script - Set Data'),
+(@NPC_BERYL_INVISMAN*100,9,3,0,0,0,100,0,2000,2000,0,0,11,@SPELL_EXPLOSION,0,0,0,0,0,1,0,0,0,0,0,0,0,'On script - Cast Spell');
+
+DELETE FROM `creature_text` WHERE `entry`=@NPC_SALRAND;
+INSERT INTO `creature_text` (`entry`,`groupid`,`id`,`text`,`type`,`language`,`probability`,`emote`,`duration`,`sound`,`comment`) VALUES
+(@NPC_SALRAND,0,0,'What is the meaning of this disturbance?!',14,0,100,0,0,0,'Inquisitor Salrand to Beryl Point InvisMan'),
+(@NPC_SALRAND,1,0,'Who dares interrupt my work!? Show yourself, coward!',14,0,100,0,0,0,'Inquisitor Salrand to Beryl Point InvisMan'),
+(@NPC_SALRAND,2,0,'I''ve destroyed the key! Your cherished archmage belongs to Malygos!',12,0,100,0,0,0,'Inquisitor Salrand');
+
+DELETE FROM `conditions` WHERE `SourceTypeOrReferenceId`=13 AND `SourceEntry`=@SPELL_THROW_DETONATOR;
+INSERT INTO `conditions` (`SourceTypeOrReferenceId`,`SourceGroup`,`SourceEntry`,`SourceId`,`ElseGroup`,`ConditionTypeOrReference`,`ConditionTarget`,`ConditionValue1`,`ConditionValue2`,`ConditionValue3`,`NegativeCondition`,`ErrorTextId`,`ScriptName`,`Comment`) VALUES
+(13,1,@SPELL_THROW_DETONATOR,0,0,31,0,3,@NPC_BERYL_INVISMAN,0,0,0,'','Throw Beryl Shield Detonator target npc');
diff --git a/sql/old/3.3.5a/2012_08_27_06_world_sai.sql b/sql/old/3.3.5a/2012_08_27_06_world_sai.sql
new file mode 100644
index 00000000000..8b1aafd1558
--- /dev/null
+++ b/sql/old/3.3.5a/2012_08_27_06_world_sai.sql
@@ -0,0 +1,43 @@
+-- Fix {Q/A} The Shining Light ID: 11288
+-- Makes it blizzlike timed 10 minutes
+UPDATE `quest_template` SET `LimitTime`=600 WHERE `id`=11288;
+-- Decomposing Ghoul SAI
+SET @Ghoul := 24177;
+SET @SpellTrigger := 43202;
+SET @Spell := 43203;
+SET @Ares := 24189;
+UPDATE `creature_template` SET `AIname`='SmartAI' WHERE `entry`=@Ghoul;
+DELETE FROM `smart_scripts` WHERE `source_type`=0 AND `entryorguid`=@Ghoul;
+INSERT INTO `smart_scripts` (`entryorguid`,`source_type`,`id`,`link`,`event_type`,`event_phase_mask`,`event_chance`,`event_flags`,`event_param1`,`event_param2`,`event_param3`,`event_param4`,`action_type`,`action_param1`,`action_param2`,`action_param3`,`action_param4`,`action_param5`,`action_param6`,`target_type`,`target_param1`,`target_param2`,`target_param3`,`target_x`,`target_y`,`target_z`,`target_o`,`comment`) VALUES
+(@Ghoul,0,0,0,1,0,100,0,20000,300000,50000,350000,1,0,0,0,0,0,0,1,0,0,0,0,0,0,0,'Decomposing Ghoul - Occ - Say random text'),
+(@Ghoul,0,1,2,8,0,100,0,@Spell,0,0,0,18,33685506,0,0,0,0,0,1,0,0,0,0,0,0,0,'Decomposing Ghoul - On hit by spell - Set unit flag for not targetable'),
+(@Ghoul,0,2,3,61,0,100,0,0,0,0,0,2,35,0,0,0,0,0,1,0,0,0,0,0,0,0,'Decomposing Ghoul - Linked with previous event - Switch faction to clear aggro'),
+(@Ghoul,0,3,0,61,0,100,0,0,0,0,0,1,1,0,0,0,0,0,1,0,0,0,0,0,0,0,'Decomposing Ghoul - Linked with previous event - Say random text'),
+(@Ghoul,0,4,5,1,0,100,0,3500,3500,3500,3500,19,33685506,0,0,0,0,0,1,0,0,0,0,0,0,0,'Decomposing Ghoul - OOC for 3,5 sec - Remove unit flag'),
+(@Ghoul,0,5,0,61,0,100,0,0,0,0,0,2,14,0,0,0,0,0,1,0,0,0,0,0,0,0,'Decomposing Ghoul - Linked with previous event - Change faction back to 14');
+-- Add SAI for Ares - quest giver
+UPDATE `creature_template` SET `AIname`='SmartAI' WHERE `entry`=@Ares;
+DELETE FROM `smart_scripts` WHERE `source_type`=0 AND `entryorguid`=@Ares;
+INSERT INTO `smart_scripts` (`entryorguid`,`source_type`,`id`,`link`,`event_type`,`event_phase_mask`,`event_chance`,`event_flags`,`event_param1`,`event_param2`,`event_param3`,`event_param4`,`action_type`,`action_param1`,`action_param2`,`action_param3`,`action_param4`,`action_param5`,`action_param6`,`target_type`,`target_param1`,`target_param2`,`target_param3`,`target_x`,`target_y`,`target_z`,`target_o`,`comment`) VALUES
+(@Ares,0,0,0,19,0,100,0,11288,0,0,0,85,@SpellTrigger,0,0,0,0,0,7,0,0,0,0,0,0,0,'Ares - On target quest accepted 11288 - Cast spell Shining Light');
+-- Decomposing Ghoul texts
+DELETE FROM `creature_text` WHERE `entry`=@Ghoul;
+INSERT INTO `creature_text` (`entry`,`groupid`,`id`,`text`,`type`,`language`,`probability`,`emote`,`duration`,`sound`,`comment`) VALUES
+(@Ghoul,0,1,'Light... light so bright...',12,0,50,0,0,0,'Decomposing Ghoul - On spell hit'),
+(@Ghoul,0,2,'ARGHHHH...',12,0,50,0,0,0,'Decomposing Ghoul - On spell hit'),
+(@Ghoul,0,3,'Away... go...',12,0,50,0,0,0,'Decomposing Ghoul - On spell hit'),
+(@Ghoul,0,4,'Bad light... hurt...',12,0,50,0,0,0,'Decomposing Ghoul - On spell hit'),
+(@Ghoul,0,5,'BURNS! IT BURNS!',12,0,50,0,0,0,'Decomposing Ghoul - On spell hit'),
+(@Ghoul,1,1,'So... Hungry...',12,0,50,0,0,0,'Decomposing Ghoul - OOC'),
+(@Ghoul,1,2,'Closer... come closer...',12,0,50,0,0,0,'Decomposing Ghoul - OOC'),
+(@Ghoul,1,3,'FEED ME...',12,0,50,0,0,0,'Decomposing Ghoul - OOC'),
+(@Ghoul,1,4,'FOOD! EAT YOU!',12,0,50,0,0,0,'Decomposing Ghoul - OOC'),
+(@Ghoul,1,5,'BRAINNNS!',12,0,50,0,0,0,'Decomposing Ghoul - OOC');
+-- Add conditions for spell Shining Light to hit only Ghouls
+DELETE FROM `conditions` WHERE `SourceEntry`=@Spell AND `SourceTypeOrReferenceId`=13;
+INSERT INTO `conditions` (`SourceTypeOrReferenceId`, `SourceGroup`, `SourceEntry`, `SourceId`, `ElseGroup`, `ConditionTypeOrReference`, `ConditionTarget`, `ConditionValue1`, `ConditionValue2`, `ConditionValue3`, `NegativeCondition`, `ErrorTextId`, `ScriptName`, `Comment`) VALUES
+(13,1,@Spell,0,0,31,0,3,@Ghoul,0,0,0,'', 'Shinning Light can only hit Decomposing Ghouls');
+-- Add conditions for spell Shining Light to be available only, if on quest
+DELETE FROM `conditions` WHERE `SourceEntry`=@Spell AND `SourceTypeOrReferenceId`=17;
+INSERT INTO `conditions` (`SourceTypeOrReferenceId`, `SourceGroup`, `SourceEntry`, `SourceId`, `ElseGroup`, `ConditionTypeOrReference`, `ConditionTarget`, `ConditionValue1`, `ConditionValue2`, `ConditionValue3`, `NegativeCondition`, `ErrorTextId`, `ScriptName`, `Comment`) VALUES
+(17,0,@Spell,0,0,9,0,11288,0,0,0,0,'', 'Shinning Light can only hit targets on the quest');
diff --git a/sql/old/3.3.5a/2012_08_27_07_world_spell_area.sql b/sql/old/3.3.5a/2012_08_27_07_world_spell_area.sql
new file mode 100644
index 00000000000..18be6ff0dbe
--- /dev/null
+++ b/sql/old/3.3.5a/2012_08_27_07_world_spell_area.sql
@@ -0,0 +1,4 @@
+-- Fix quest - The Angry Gorloc ID: 12578
+DELETE FROM `spell_area` WHERE `spell`=54057;
+INSERT INTO `spell_area` (`spell`, `area`, `quest_start`, `quest_start_active`, `quest_end`, `aura_spell`, `racemask`, `gender`, `autocast`) VALUES
+(54057, 4297, 12578, 1, 12578, 0, 0, 2, 1);
diff --git a/sql/old/3.3.5a/2012_08_27_08_world_misc.sql b/sql/old/3.3.5a/2012_08_27_08_world_misc.sql
new file mode 100644
index 00000000000..62a57cd42de
--- /dev/null
+++ b/sql/old/3.3.5a/2012_08_27_08_world_misc.sql
@@ -0,0 +1,29 @@
+-- Fire Upon the Waters (12243) quest fix
+-- add Fire Upon the Waters Kill Credit Bunny at sail locations
+SET @GUID =42887;
+DELETE FROM `creature` WHERE `id`=28013;
+INSERT INTO `creature` (`guid`,`id`,`map`,`spawnMask`,`phaseMask`,`modelid`,`equipment_id`,`position_x`,`position_y`,`position_z`,`orientation`,`spawntimesecs`,`spawndist`,`currentwaypoint`,`curhealth`,`curmana`,`MovementType`,`npcflag`,`unit_flags`,`dynamicflags`) VALUES
+(@GUID+0,28013,571,1,1,0,0,2488.86,-400.017,19.0803,2.99498,300,0,0,42,0,0,0,33554432,0),
+(@GUID+1,28013,571,1,1,0,0,2458.96,-401.066,20.7778,0.108631,300,0,0,42,0,0,0,33554432,0);
+
+-- SAI
+UPDATE `creature_template` SET `AIName` = 'SmartAI' WHERE `entry` = 28013;
+DELETE FROM `smart_scripts` WHERE `entryorguid`=28013 AND `source_type`=0;
+INSERT INTO `smart_scripts` (`entryorguid`,`source_type`,`id`,`link`,`event_type`,`event_phase_mask`,`event_chance`,`event_flags`,`event_param1`,`event_param2`,`event_param3`,`event_param4`,`action_type`,`action_param1`,`action_param2`,`action_param3`,`action_param4`,`action_param5`,`action_param6`,`target_type`,`target_param1`,`target_param2`,`target_param3`,`target_x`,`target_y`,`target_z`,`target_o`,`comment`) VALUES
+(28013,0,0,0,8,0,100,0,48455,0,0,0,33,28013,0,0,0,0,0,7,0,0,0,0,0,0,0,"Fire Upon the Waters Kill Credit Bunny - On SpellHit Apothecary's Burning Water - Call KilledMonster Fire Upon the Waters Kill Credit Bunny");
+
+-- Ensure spell only works on Fire Upon the Waters Kill Credit Bunny
+DELETE FROM `conditions` WHERE `SourceTypeOrReferenceId`=13 AND `SourceEntry`=48455;
+INSERT INTO `conditions` (`SourceTypeOrReferenceId`,`SourceGroup`,`SourceEntry`,`SourceId`,`ElseGroup`,`ConditionTypeOrReference`,`ConditionTarget`,`ConditionValue1`,`ConditionValue2`,`ConditionValue3`,`NegativeCondition`,`ErrorTextId`,`ScriptName`,`Comment`) VALUES
+(13,1,48455,0,0,31,0,3,28013,0,0,0,'',"Fire Upon the Waters - spell to Fire Upon the Waters Kill Credit Bunny");
+
+-- add quest item loot to Captain Shely
+DELETE FROM `creature_loot_template` WHERE `entry`=27232;
+INSERT INTO `creature_loot_template` (`entry`,`item`,`ChanceOrQuestChance`,`lootmode`,`groupid`,`mincountOrRef`,`maxcount`) VALUES
+(27232,37305,-100,1,0,1,1), -- Captain Shely's Rutters
+(27232,43851,25,1,0,1,1), -- Fur Clothing Scraps
+(27232,33470,10,1,0,1,3), -- Frostweave Cloth
+(27232,33443,5,1,0,1,1), -- Sour Goat Cheese
+(27232,33444,2,1,0,1,1), -- Pungent Seal Whey
+(27232,22829,1,1,0,1,1), -- Super Healing Potion
+(27232,45912,0.05,1,0,1,1); -- Book Glyph of Mastery
diff --git a/sql/old/3.3.5a/2012_08_27_09_world_conditions.sql b/sql/old/3.3.5a/2012_08_27_09_world_conditions.sql
new file mode 100644
index 00000000000..6d536859060
--- /dev/null
+++ b/sql/old/3.3.5a/2012_08_27_09_world_conditions.sql
@@ -0,0 +1,8 @@
+DELETE FROM `conditions` WHERE `SourceTypeOrReferenceId`=13 AND `SourceEntry` IN (62973,62991);
+INSERT INTO `conditions` (`SourceTypeOrReferenceId`, `SourceGroup`, `SourceEntry`, `SourceId`, `ElseGroup`, `ConditionTypeOrReference`, `ConditionTarget`, `ConditionValue1`, `ConditionValue2`, `ConditionValue3`, `NegativeCondition`, `ErrorTextId`, `ScriptName`, `Comment`) VALUES
+(13,3,62973,0,0, 1,0,62972,0,0,0,0,'','Foam Sword Attack'),
+(13,3,62973,0,0,31,0,4,0,0,0,0,'','Foam Sword Attack'),
+(13,3,62973,0,0,33,0,1,0,0,1,0,'','Foam Sword Attack'),
+(13,3,62991,0,0, 1,0,62972,0,0,0,0,'','Bonked!'),
+(13,3,62991,0,0,31,0,4,0,0,0,0,'','Bonked!'),
+(13,3,62991,0,0,33,0,1,0,0,1,0,'','Bonked!');
diff --git a/sql/old/3.3.5a/2012_08_27_10_world_spell_script_names.sql b/sql/old/3.3.5a/2012_08_27_10_world_spell_script_names.sql
new file mode 100644
index 00000000000..9ffb153f498
--- /dev/null
+++ b/sql/old/3.3.5a/2012_08_27_10_world_spell_script_names.sql
@@ -0,0 +1,4 @@
+DELETE FROM `spell_script_names` WHERE `spell_id`IN (64142,62991);
+INSERT INTO `spell_script_names` (`spell_id`,`ScriptName`) VALUES
+(64142,'spell_gen_upper_deck_create_foam_sword'),
+(62991,'spell_gen_bonked');
diff --git a/sql/old/3.3.5a/2012_08_28_00_world_spell_script_name.sql b/sql/old/3.3.5a/2012_08_28_00_world_spell_script_name.sql
new file mode 100644
index 00000000000..01cfeb35f1f
--- /dev/null
+++ b/sql/old/3.3.5a/2012_08_28_00_world_spell_script_name.sql
@@ -0,0 +1,4 @@
+-- Spell script name linking for Defending Wyrmrest Temple: Destabilize Azure Dragonshrine Effect
+DELETE FROM `spell_script_names` WHERE `spell_id`=49370 ;
+INSERT INTO `spell_script_names` VALUES
+(49370,'spell_q12372_destabilize_azure_dragonshrine_dummy');
diff --git a/sql/old/3.3.5a/2012_08_28_01_world_achievement_criteria_data.sql b/sql/old/3.3.5a/2012_08_28_01_world_achievement_criteria_data.sql
new file mode 100644
index 00000000000..bf247399553
--- /dev/null
+++ b/sql/old/3.3.5a/2012_08_28_01_world_achievement_criteria_data.sql
@@ -0,0 +1,6 @@
+DELETE FROM `achievement_criteria_data` WHERE `criteria_id` IN (11478,11479,12827,12828);
+INSERT INTO `achievement_criteria_data` (`criteria_id`, `type`, `value1`, `value2`, `ScriptName`) VALUES
+(11478, 12, 0, 0, ''), -- Koralon the Flame Watcher (10 player)
+(11479, 12, 1, 0, ''), -- Koralon the Flame Watcher (25 player)
+(12827, 12, 0, 0, ''), -- Toravon the Ice Watcher (10 player)
+(12828, 12, 1, 0, ''); -- Toravon the Ice Watcher (25 player)
diff --git a/sql/old/3.3.5a/2012_08_29_00_world_blood_furnace.sql b/sql/old/3.3.5a/2012_08_29_00_world_blood_furnace.sql
new file mode 100644
index 00000000000..85b493da202
--- /dev/null
+++ b/sql/old/3.3.5a/2012_08_29_00_world_blood_furnace.sql
@@ -0,0 +1,290 @@
+SET @GUID := 138106; -- 149
+
+-- Delete old data before inserting new data. This could make trouble later on.
+DELETE `creature_addon` FROM `creature_addon` INNER JOIN `creature` ON `creature`.`guid`=`creature_addon`.`guid` WHERE `map`=542;
+DELETE `creature_formations` FROM `creature_formations` INNER JOIN `creature` ON `creature`.`guid`=`creature_formations`.`memberGUID` OR `creature`.`guid`=`creature_formations`.`leaderGUID` WHERE `map`=542;
+DELETE `linked_respawn` FROM `linked_respawn` INNER JOIN `creature` ON `creature`.`guid`=`linked_respawn`.`linkedGuid` WHERE `map`=542;
+
+
+-- CREATURE_TEMPLATE
+-- Trash
+UPDATE `creature_template` SET `speed_walk`=1.1 WHERE `entry`=17624;
+UPDATE `creature_template` SET `AIName`='' WHERE `entry`=17398;
+-- Broggok
+UPDATE `creature_template` SET `unit_flags`=`unit_flags`|256|512|2 WHERE `entry` IN(17380,18601);
+
+-- CREATURE
+DELETE FROM `creature` WHERE `guid` BETWEEN @GUID AND @GUID+148 OR `map`=542;
+INSERT INTO `creature`(`guid`,`id`,`map`,`spawnMask`,`position_x`,`position_y`,`position_z`,`orientation`,`spawntimesecs`,`curhealth`,`curmana`,`MovementType`) VALUES
+(@GUID+88,17414,542,3,317.15,189.009,10.0509,1.88412,7200,10472,5875,0),
+(@GUID+92,17414,542,3,436.311,198.522,11.4389,1.34468,7200,10472,5875,0),
+(@GUID+91,17414,542,3,345.706,198.519,11.139,1.6879,7200,10472,5875,0),
+(@GUID+96,17398,542,3,379.741,192.233,9.59787,3.36158,7200,7210,0,0),
+(@GUID+103,17414,542,3,448.428,190.764,9.6054,1.01795,7200,10472,5875,0),
+(@GUID+97,17395,542,3,373.636,184.777,9.59848,1.15697,7200,10472,17625,0),
+(@GUID+95,17371,542,3,371.98,194.243,9.59956,5.36434,7200,10472,5875,0),
+(@GUID+94,17491,542,3,480.502,180.017,9.61526,3.42991,7200,7479,0,0),
+(@GUID+26,17398,542,3,412.728,85.7323,9.65141,0.141552,7200,6963,0,0),
+(@GUID+125,17477,542,3,485.76,8.63405,9.54898,1.43024,7200,4126,9944,0),
+(@GUID+68,17371,542,3,327.262,30.5611,9.61686,4.68833,7200,10472,5875,2),
+(@GUID+124,17477,542,3,490.168,11.6964,9.54898,1.13336,7200,4126,9944,0),
+(@GUID+123,17477,542,3,489.518,5.51373,9.54353,1.96038,7200,4126,9944,0),
+(@GUID+122,17371,542,3,494.46,7.58925,9.54249,2.87616,7200,10472,5875,0),
+(@GUID+112,17414,542,3,479.898,98.2961,9.62183,6.09707,7200,10472,5875,0),
+(@GUID+120,17491,542,3,433.6,-18.2301,9.55216,0.450845,7200,7479,0,0),
+(@GUID+126,17477,542,3,484.202,13.9732,9.5505,6.25258,7200,4126,9944,0),
+(@GUID+128,17371,542,3,465.905,-19.9126,9.55319,5.19624,7200,10472,5875,2),
+(@GUID+129,17371,542,3,476.506,-63.3028,9.54636,0,7200,10472,5875,2),
+(@GUID+131,17491,542,3,495.566,-43.8895,9.5591,2.9343,7200,7479,0,0),
+(@GUID+46,17477,542,3,-10.8822,-85.2033,-41.3341,2.09342,7200,4126,9944,0),
+(@GUID+55,17397,542,3,224.587,-96.0037,9.61879,0.647748,7200,11965,2486,0),
+(@GUID+54,17397,542,3,231.512,-91.5716,9.62435,3.65189,7200,11965,2486,0),
+(@GUID+56,17477,542,3,227.94,-93.8952,9.61879,0.561355,7200,4126,9944,0),
+(@GUID+53,17491,542,3,234.022,-106.406,9.61037,1.88867,7200,7479,0,0),
+(@GUID+52,17477,542,3,28.2572,-85.4531,-41.0542,4.63284,7200,4126,9944,0),
+(@GUID+59,17477,542,3,241.827,-68.3783,9.61987,1.82585,7200,4126,9944,0),
+(@GUID+58,17397,542,3,242.883,-72.4289,9.61514,1.81799,7200,11965,2486,0),
+(@GUID+57,17397,542,3,240.674,-64.4904,9.62484,5.05383,7200,11965,2486,0),
+(@GUID+14,21174,542,3,320.912,-83.0625,-133.307,3.00197,7200,8338000,0,0),
+(@GUID+136,17477,542,3,412.944,-83.971,9.61695,5.1156,7200,4126,9944,0),
+(@GUID+137,17477,542,3,420.081,-88.5245,9.62061,0.206074,7200,4126,9944,0),
+(@GUID+139,17491,542,3,404.193,-62.5071,9.61827,5.54913,7200,7479,0,0),
+(@GUID+134,17477,542,3,432.656,-78.7667,9.62296,1.5821,7200,4126,9944,0),
+(@GUID+140,17477,542,3,419.961,-76.9838,9.62318,5.67087,7200,4126,9944,0),
+(@GUID+135,17477,542,3,427.911,-69.9011,9.61668,4.99622,7200,4126,9944,0),
+(@GUID+142,18894,542,3,355.194,-175.571,-25.5497,0.0701911,7200,14958,0,0),
+(@GUID+144,18894,542,3,325.278,-191.535,-25.5078,1.49412,7200,14958,0,0),
+(@GUID+145,17371,542,3,312.396,-174.925,-25.5082,6.21829,7200,10472,5875,0),
+(@GUID+146,18894,542,3,312.116,-179.382,-25.5071,6.20258,7200,14958,0,0),
+(@GUID+147,18894,542,3,313.392,-170.618,-25.5086,6.20651,7200,14958,0,0),
+(@GUID+78,17371,542,3,331.268,69.7599,9.61402,1.77024,7200,10472,5875,0),
+(@GUID+70,17397,542,3,313.949,13.7401,9.61652,4.38997,7200,11965,2486,0),
+(@GUID+69,17395,542,3,311.261,7.92634,9.62195,0.656179,7200,10472,17625,0),
+(@GUID+71,17397,542,3,317.184,8.72084,9.6192,2.67896,7200,11965,2486,0),
+(@GUID+75,17491,542,3,314.564,-7.67602,9.6169,2.30511,7200,7479,0,0),
+(@GUID+77,17370,542,3,331.076,28.8939,9.62118,4.2576,7200,14958,0,0),
+(@GUID+73,17395,542,3,338.84,8.10661,9.61679,5.05086,7200,10472,17625,0),
+(@GUID+72,17395,542,3,338.242,1.09978,9.61664,1.01391,7200,10472,17625,0),
+(@GUID+25,17398,542,3,413.285,81.8238,9.65038,0.154642,7200,6963,0,0),
+(@GUID+24,17398,542,3,500.076,84.7778,9.65474,3.08941,7200,6963,0,0),
+(@GUID+23,17398,542,3,502.724,82.8731,9.65935,3.08941,7200,6963,0,0),
+(@GUID+22,17398,542,3,498.962,83.0695,9.6524,3.08941,7200,6963,0,0),
+(@GUID+21,17398,542,3,498.393,86.641,9.65219,3.19309,7200,6963,0,0),
+(@GUID+104,17414,542,3,327.172,188.393,9.61882,1.09492,7200,10472,5875,0),
+(@GUID+27,17398,542,3,409.226,83.2983,9.65786,0.141552,7200,6963,0,0),
+(@GUID+28,17398,542,3,412.081,112.626,9.65613,6.1865,7200,6963,0,0),
+(@GUID+29,17398,542,3,412.462,116.555,9.65317,6.1865,7200,6963,0,0),
+(@GUID+30,17398,542,3,411.735,114.446,9.65571,0.00803471,7200,6963,0,0),
+(@GUID+31,17398,542,3,409.699,113.048,9.65731,0.0185067,7200,6963,0,0),
+(@GUID+32,17398,542,3,407.17,115.172,9.66061,0.0185067,7200,6963,0,0),
+(@GUID+33,17398,542,3,495.677,116.285,9.64388,3.14963,7200,6963,0,0),
+(@GUID+34,17398,542,3,495.696,113.877,9.64425,3.14963,7200,6963,0,0),
+(@GUID+35,17398,542,3,499.774,112.283,9.65334,3.14963,7200,6963,0,0),
+(@GUID+36,17398,542,3,503.042,114.321,9.65788,3.14963,7200,6963,0,0),
+(@GUID+37,17398,542,3,503.024,116.589,9.65788,3.14963,7200,6963,0,0),
+(@GUID+38,17398,542,3,499.499,118.085,9.65347,3.14963,7200,6963,0,0),
+(@GUID+111,17414,542,3,482.454,103.335,9.61156,5.27398,7200,10472,5875,0),
+(@GUID+110,17414,542,3,458.068,92.7015,9.61519,1.89206,7200,10472,5875,0),
+(@GUID+109,17414,542,3,452.317,94.5807,9.61519,0.545102,7200,10843,6015,0),
+(@GUID+108,17395,542,3,457.121,99.2828,9.61496,4.44777,7200,10472,17625,0),
+(@GUID+102,17370,542,3,466.171,176.663,9.6201,2.8927,7200,14958,0,2),
+(@GUID+98,17371,542,3,412.814,195.493,9.60144,3.55951,7200,10472,5875,0),
+(@GUID+100,17395,542,3,403.447,190.68,9.59739,0.0770466,7200,10472,17625,0),
+(@GUID+99,17398,542,3,411.319,185.388,9.60154,2.28952,7200,6963,0,0),
+(@GUID+101,17370,542,3,466.657,179.674,9.61915,2.88877,7200,14958,0,2),
+(@GUID+76,17370,542,3,323.216,28.6452,9.62206,4.92205,7200,14958,0,0),
+(@GUID+74,17397,542,3,344.219,5.00403,9.62297,3.2955,7200,11965,2486,0),
+(@GUID+67,17370,542,3,286.75,-7.12364,9.33158,3.50552,7200,14958,0,0),
+(@GUID+65,17370,542,3,258.511,-30.4009,6.95261,4.07258,7200,14958,0,0),
+(@GUID+63,17371,542,3,246.377,-85.311,9.61661,3.04947,7200,10472,5875,2),
+(@GUID+62,17477,542,3,226.371,-71.3008,9.61766,2.01394,7200,4126,9944,0),
+(@GUID+60,17397,542,3,224.497,-68.0896,9.62108,5.19786,7200,11965,2486,0),
+(@GUID+61,17397,542,3,227.979,-74.6894,9.61909,1.96987,7200,11965,2486,0),
+(@GUID+106,17626,542,3,458.614,116.989,9.61455,3.07559,7200,14958,0,0),
+(@GUID+43,17491,542,3,182.461,-68.9882,9.62108,3.98337,7200,7479,0,0),
+(@GUID+42,17491,542,3,107.083,-96.6171,-14.2289,0.930522,7200,7479,0,0),
+(@GUID+51,17397,542,3,27.6779,-90.5785,-40.7088,1.48496,7200,11965,2486,0),
+(@GUID+82,17414,542,3,304.249,103.356,9.62076,5.61477,7200,10843,6015,0),
+(@GUID+83,17371,542,3,308.919,100.519,9.62138,2.61455,7200,10472,5875,0),
+(@GUID+86,17626,542,3,356.154,108.175,9.62332,4.06125,7200,14958,0,0),
+(@GUID+85,17371,542,3,343.419,102.651,9.6201,5.16709,7200,10472,5875,0),
+(@GUID+93,17414,542,3,346.912,193.875,9.60419,1.74602,7200,10472,5875,0),
+(@GUID+115,17414,542,3,476.291,65.9018,9.60985,3.98357,7200,10472,5875,0),
+(@GUID+114,17414,542,3,469.409,65.9985,9.61271,5.036,7200,10843,6015,0),
+(@GUID+116,17371,542,3,472.66,59.4292,9.6097,1.58025,7200,10472,5875,0),
+(@GUID+105,17624,542,3,456.429,118.903,9.61496,3.16198,7200,16023,0,0),
+(@GUID+107,17626,542,3,458.704,120.842,9.61456,3.1619,7200,14958,0,2),
+(@GUID+127,18894,542,3,462.905,-19.9126,9.55215,5.18053,7200,14958,0,0),
+(@GUID+41,17377,542,3,325.862,-87.2087,-24.6512,5.87314,43200,34830,6156,0),
+(@GUID+143,18894,542,3,333.631,-192.252,-25.5027,1.51768,7200,14958,0,0),
+(@GUID+148,17371,542,3,329.584,-189.111,-25.5067,1.50511,7200,10472,5875,0),
+(@GUID+132,17371,542,3,424.675,-83.9057,9.6166,0.059993,7200,10472,5875,0),
+(@GUID+130,18894,542,3,475.417,-66.3289,9.54527,0,7200,14958,0,0),
+(@GUID+40,18894,542,3,455.566,-79.108,9.61164,0.09548,7200,14958,0,0),
+(@GUID+39,18894,542,3,455.793,-89.9999,9.60743,0.09548,7200,14958,0,0),
+(@GUID+121,17371,542,3,487.933,17.2848,9.55353,4.54905,7200,10472,5875,0),
+(@GUID+119,17414,542,3,445.422,63.6577,9.61209,3.54218,7200,10472,5875,0),
+(@GUID+118,17371,542,3,442.237,56.965,9.61104,1.84965,7200,10472,5875,0),
+(@GUID+117,17371,542,3,437.232,64.7644,9.60927,5.1656,7200,10472,5875,0),
+(@GUID+113,17414,542,3,483.48,91.8948,9.62303,1.14828,7200,10472,5875,0),
+(@GUID+20,17398,542,3,437.158,201.984,11.6815,4.639,7200,6963,0,0),
+(@GUID+19,17398,542,3,345.078,202.309,11.6826,4.90708,7200,6963,0,0),
+(@GUID+18,17398,542,3,314.478,195.642,11.6815,5.01966,7200,6963,0,0),
+(@GUID+17,17381,542,3,327.17,137.816,9.61546,4.72121,43200,38722,0,0),
+(@GUID+90,17370,542,3,372.443,187.252,9.59815,3.08144,7200,14958,0,2),
+(@GUID+87,17491,542,3,301.987,172.031,9.61921,0.398146,7200,7479,0,0),
+(@GUID+89,17370,542,3,372.443,191.252,9.59815,3.3214,7200,14958,0,2),
+(@GUID+80,17626,542,3,343.075,57.8455,9.6156,0,7200,14958,0,0),
+(@GUID+81,17624,542,3,327.255,54.8455,9.61645,0,7200,16023,0,2),
+(@GUID+15,17414,542,3,352.426,85.7746,9.6222,6.27838,7200,10472,5875,0),
+(@GUID+84,17414,542,3,346.54,96.449,9.6201,2.21792,7200,10472,5875,0),
+(@GUID+16,17414,542,3,302.425,61.1739,9.61642,3.14962,7200,10472,5875,0),
+(@GUID+79,17414,542,3,328.075,76.9842,9.61402,5.19851,7200,10472,5875,0),
+(@GUID+133,17477,542,3,433.797,-90.9604,9.62448,1.93317,7200,4126,9944,0),
+(@GUID+141,18894,542,3,355.299,-163.451,-25.5338,6.16881,7200,14958,0,0),
+(@GUID+138,17477,542,3,423.255,-96.3954,9.61869,1.21688,7200,4126,9944,0),
+(@GUID+66,17626,542,3,279.674,1.44232,8.11077,3.8723,7200,14958,0,0),
+(@GUID+64,17626,542,3,250.468,-24.7817,6.95538,4.23202,7200,14958,0,0),
+(@GUID+50,17397,542,3,29.672,-80.5135,-40.787,4.36738,7200,11965,2486,0),
+(@GUID+44,17397,542,3,-12.9018,-81.3588,-41.3358,5.36252,7200,11965,2486,0),
+(@GUID+47,17397,542,3,6.99569,-89.3037,-41.3305,1.28394,7200,11965,2486,0),
+(@GUID+45,17397,542,3,-9.04048,-88.5931,-41.3341,1.99081,7200,11965,2486,0),
+(@GUID+49,17477,542,3,8.90866,-85.0585,-41.3294,1.02944,7200,4126,9944,0),
+(@GUID+48,17397,542,3,10.3856,-81.342,-41.3294,4.24882,7200,11965,2486,0),
+(@GUID+9,17380,542,3,455.336,-1.82919,9.6299,1.43117,43200,30960,18468,0),
+(@GUID+8,17370,542,3,7.83757,-54.6224,-41.258,1.62316,7200,14958,0,0),
+(@GUID+7,17370,542,3,-4.06964,-56.7616,-41.258,1.41372,7200,14958,0,0),
+(@GUID+6,17370,542,3,49.3209,-93.3478,-40.1855,2.86234,7200,14958,0,0),
+(@GUID+5,17370,542,3,49.2232,-75.6242,-40.1856,2.98451,7200,14958,0,0),
+(@GUID+4,17256,542,3,369.461,-118.757,-137.368,2.54818,604800,152964,1016100,0),
+(@GUID+3,17256,542,3,369.15,-55.5658,-137.368,3.71755,604800,152964,1016100,0),
+(@GUID+2,17256,542,3,307.784,-31.8502,-137.368,4.95674,604800,152964,1016100,0),
+(@GUID+1,17256,542,3,274.133,-87.1647,-137.368,0.017453,604800,152964,1016100,0),
+(@GUID+0,17256,542,3,308.203,-141.769,-137.368,1.36136,604800,152964,1016100,0);
+
+-- GAMEOBJECT_TEMPLATE
+UPDATE `gameobject_template` SET `ScriptName`='go_broggok_lever' WHERE `entry`=181982;
+
+-- CREATURE_MODEL_INFO
+-- Old modelid_other_gender 12471. Need to do this because modelid in creature uses creature_model_info, too... so it would still bug.
+UPDATE `creature_model_info` SET `modelid_other_gender`=0 WHERE `modelid`=16332;
+
+-- CREATURE_ADDON
+DELETE FROM `creature_addon` WHERE `guid` BETWEEN @GUID AND @GUID+144;
+INSERT INTO `creature_addon`(`guid`,`path_id`,`bytes2`) VALUES
+(@GUID+0,0,4097),
+(@GUID+1,0,4097),
+(@GUID+2,0,4097),
+(@GUID+3,0,4097),
+(@GUID+4,0,4097),
+(@GUID+15,856820,0),
+(@GUID+63,(@GUID+63)*10,0),
+(@GUID+68,(@GUID+68)*10,0),
+(@GUID+81,(@GUID+81)*10,0),
+(@GUID+89,(@GUID+89)*10,0),
+(@GUID+90,(@GUID+90)*10,0),
+(@GUID+101,(@GUID+101)*10,0),
+(@GUID+102,(@GUID+102)*10,0),
+(@GUID+107,(@GUID+107)*10,0),
+(@GUID+128,(@GUID+128)*10,0),
+(@GUID+129,(@GUID+129)*10,0);
+
+-- CREATURE_FORMATIONS
+DELETE FROM `creature_formations` WHERE `leaderGUID` BETWEEN @GUID AND @GUID+148 OR `memberGUID` BETWEEN @GUID AND @GUID+148;
+INSERT INTO `creature_formations`(`leaderGUID`,`memberGUID`,`dist`,`angle`,`groupAI`) VALUES
+(@GUID+81,@GUID+81,0,0,2),
+(@GUID+81,@GUID+80,3,290,2),
+(@GUID+107,@GUID+107,0,0,2),
+(@GUID+107,@GUID+105,4,220,2),
+(@GUID+107,@GUID+106,3,285,2),
+(@GUID+129,@GUID+129,0,0,2),
+(@GUID+129,@GUID+130,3,90,2),
+(@GUID+143,@GUID+143,0,0,2),
+(@GUID+143,@GUID+148,3,120,2),
+(@GUID+143,@GUID+144,3,240,2),
+(@GUID+146,@GUID+146,0,0,2),
+(@GUID+146,@GUID+145,3,120,2),
+(@GUID+146,@GUID+147,3,240,2),
+(@GUID+128,@GUID+128,0,0,2),
+(@GUID+128,@GUID+127,4,45,2);
+
+-- WAYPOINT_DATA
+DELETE FROM `waypoint_data` WHERE `id` BETWEEN @GUID*10 AND (@GUID+148)*10;
+INSERT INTO `waypoint_data`(`id`,`point`,`position_x`,`position_y`,`position_z`) VALUES
+((@GUID+63 )*10,1,247.229,-66.59,9.62258),
+((@GUID+63 )*10,2,246.245,-85.1909,9.61548),
+((@GUID+63 )*10,3,219.765,-84.577,9.58612),
+((@GUID+63 )*10,4,246.377,-85.311,9.61661),
+((@GUID+68 )*10,1,328.417,-4.58593,9.61603),
+((@GUID+68 )*10,2,327.28,24.0565,9.61603),
+((@GUID+81 )*10,1,327.255,54.8455,9.61346),
+((@GUID+81 )*10,18,322.72,55.3961,9.6137),
+((@GUID+81 )*10,17,317.328,58.7127,9.6137),
+((@GUID+81 )*10,16,315.042,62.5956,9.61509),
+((@GUID+81 )*10,15,312.513,72.6059,9.6179),
+((@GUID+81 )*10,14,311.755,83.2112,9.6179),
+((@GUID+81 )*10,13,312.519,89.5342,9.6179),
+((@GUID+81 )*10,12,313.959,93.8532,9.61756),
+((@GUID+81 )*10,11,317.588,98.5635,9.61631),
+((@GUID+81 )*10,10,322.28,101.14,9.61572),
+((@GUID+81 )*10,9,328.8,102.991,9.61528),
+((@GUID+81 )*10,8,334.164,102.162,9.61808),
+((@GUID+81 )*10,7,339.203,99.0606,9.61948),
+((@GUID+81 )*10,6,342.812,94.2829,9.61948),
+((@GUID+81 )*10,5,345.611,85.8321,9.61948),
+((@GUID+81 )*10,4,344.882,74.8707,9.61869),
+((@GUID+81 )*10,3,343.069,64.3213,9.61614),
+((@GUID+81 )*10,2,340.959,59.932,9.61435),
+((@GUID+89 )*10,1,372.443,191.252,9.59815),
+((@GUID+89 )*10,2,329.021,185.273,9.61524),
+((@GUID+90 )*10,1,372.443,187.252,9.59815),
+((@GUID+90 )*10,2,329.021,181.273,9.61524),
+((@GUID+101)*10,1,416.026,191.714,9.59825),
+((@GUID+101)*10,2,466.657,179.674,9.61915),
+((@GUID+102)*10,1,415.314,187.668,9.59825),
+((@GUID+102)*10,2,466.171,176.663,9.6201),
+((@GUID+107)*10,18,464.47,117.962,9.62),
+((@GUID+107)*10,17,471.688,113.794,9.62),
+((@GUID+107)*10,16,477.046,107.409,9.62),
+((@GUID+107)*10,15,479.897,99.5768,9.62),
+((@GUID+107)*10,14,479.897,91.2417,9.62),
+((@GUID+107)*10,13,477.046,83.4093,9.62),
+((@GUID+107)*10,12,471.688,77.0242,9.62),
+((@GUID+107)*10,11,464.47,72.8567,9.62),
+((@GUID+107)*10,10,456.261,71.4093,9.62),
+((@GUID+107)*10,9,448.053,72.8567,9.62),
+((@GUID+107)*10,8,440.834,77.0242,9.62),
+((@GUID+107)*10,7,435.477,83.4093,9.62),
+((@GUID+107)*10,6,432.626,91.2417,9.62),
+((@GUID+107)*10,5,432.626,99.5768,9.62),
+((@GUID+107)*10,4,435.477,107.409,9.62),
+((@GUID+107)*10,3,440.834,113.794,9.62),
+((@GUID+107)*10,2,448.053,117.962,9.62),
+((@GUID+107)*10,1,456.261,119.409,9.62),
+((@GUID+128)*10,1,475.83,-58.5353,9.5419),
+((@GUID+128)*10,2,474.83,-54.6723,9.5419),
+((@GUID+128)*10,3,465.9,-19.9126,9.55319),
+((@GUID+128)*10,4,466.89,-23.7756,9.55319),
+((@GUID+129)*10,1,482.43,-67.1466,9.56),
+((@GUID+129)*10,2,486.942,-69.7513,9.56),
+((@GUID+129)*10,3,490.29,-73.742,9.56),
+((@GUID+129)*10,4,492.072,-78.6373,9.56),
+((@GUID+129)*10,5,492.072,-83.8467,9.56),
+((@GUID+129)*10,6,490.29,-88.742,9.56),
+((@GUID+129)*10,7,486.942,-92.7327,9.56),
+((@GUID+129)*10,8,482.43,-95.3374,9.56),
+((@GUID+129)*10,9,477.3,-96.242,9.56),
+((@GUID+129)*10,10,472.17,-95.3374,9.56),
+((@GUID+129)*10,11,467.658,-92.7327,9.56),
+((@GUID+129)*10,12,464.31,-88.742,9.56),
+((@GUID+129)*10,13,462.528,-83.8467,9.56),
+((@GUID+129)*10,14,462.528,-78.6373,9.56),
+((@GUID+129)*10,15,464.31,-73.742,9.56),
+((@GUID+129)*10,16,467.658,-69.7513,9.56),
+((@GUID+129)*10,17,472.17,-67.1466,9.56),
+((@GUID+129)*10,18,477.3,-66.242,9.56);
+
+-- Revert a previous bad fix
+DELETE FROM `creature_ai_scripts` WHERE `creature_id`=17398;
+DELETE FROM `smart_scripts` WHERE `entryorguid` IN (-85712,-85717,-85719,-85724) AND `source_type`=0;
+DELETE FROM `gameobject_scripts` WHERE `id`=150441;
diff --git a/sql/old/3.3.5a/2012_08_30_00_world_creature_template.sql b/sql/old/3.3.5a/2012_08_30_00_world_creature_template.sql
new file mode 100644
index 00000000000..27c1c1dedd4
--- /dev/null
+++ b/sql/old/3.3.5a/2012_08_30_00_world_creature_template.sql
@@ -0,0 +1 @@
+ALTER TABLE `creature_template` ADD `unit_flags2` int(10) UNSIGNED NOT NULL DEFAULT '0' AFTER `unit_flags`;
diff --git a/sql/old/3.3.5a/2012_08_30_00_world_spell_script_names.sql b/sql/old/3.3.5a/2012_08_30_00_world_spell_script_names.sql
new file mode 100644
index 00000000000..d7602dd8c79
--- /dev/null
+++ b/sql/old/3.3.5a/2012_08_30_00_world_spell_script_names.sql
@@ -0,0 +1,8 @@
+DELETE FROM `spell_script_names` WHERE `spell_id` IN (41054, 63418, 69893, 45205, 69896, 57594);
+INSERT INTO `spell_script_names` VALUES
+(41054, "spell_gen_clone_weapon_aura"),
+(63418, "spell_gen_clone_weapon_aura"),
+(69893, "spell_gen_clone_weapon_aura"),
+(45205, "spell_gen_clone_weapon_aura"),
+(69896, "spell_gen_clone_weapon_aura"),
+(57594, "spell_gen_clone_weapon_aura");
diff --git a/sql/old/3.3.5a/2012_08_31_00_world_command.sql b/sql/old/3.3.5a/2012_08_31_00_world_command.sql
new file mode 100644
index 00000000000..c0686d6d907
--- /dev/null
+++ b/sql/old/3.3.5a/2012_08_31_00_world_command.sql
@@ -0,0 +1,14 @@
+DELETE FROM `command` WHERE `name`='explorecheat';
+DELETE FROM `command` WHERE `name`='taxicheat';
+DELETE FROM `command` WHERE `name`='waterwalk';
+
+DELETE FROM `command` WHERE `name`='cheat' OR `name` LIKE 'cheat%';
+INSERT INTO `command` (`name`, `security`, `help`) VALUES
+('cheat', 2, 'Syntax: .cheat $subcommand\r\nType .cheat to see the list of possible subcommands or .help cheat $subcommand to see info on subcommands'),
+('cheat god', 2, 'Syntax: .cheat god [on/off]\r\nEnables or disables your character''s ability to take damage.'),
+('cheat casttime', 2, 'Syntax: .cheat casttime [on/off]\r\nEnables or disables your character''s spell cast times.'),
+('cheat cooldown', 2, 'Syntax: .cheat cooldown [on/off]\r\nEnables or disables your character''s spell cooldowns.'),
+('cheat power', 2, 'Syntax: .cheat power [on/off]\r\nEnables or disables your character''s spell cost (e.g mana).'),
+('cheat waterwalk', 2, 'Syntax: .cheat waterwalk on/off\r\nSet on/off waterwalk state for selected player or self if no player selected.'),
+('cheat explore', 2, 'Syntax: .cheat explore #flag\r\nReveal or hide all maps for the selected player. If no player is selected, hide or reveal maps to you.\r\nUse a #flag of value 1 to reveal, use a #flag value of 0 to hide all maps.'),
+('cheat taxi', 2, 'Syntax: .cheat taxi on/off\r\nTemporary grant access or remove to all taxi routes for the selected character.\r\n If no character is selected, hide or reveal all routes to you.Visited taxi nodes sill accessible after removing access.');
diff --git a/sql/old/3.3.5a/2012_08_31_00_world_sai.sql b/sql/old/3.3.5a/2012_08_31_00_world_sai.sql
new file mode 100644
index 00000000000..fd7e0d7810f
--- /dev/null
+++ b/sql/old/3.3.5a/2012_08_31_00_world_sai.sql
@@ -0,0 +1,50 @@
+-- Defending Your Title (13423)
+-- Taking on All Challengers (12971)
+
+SET @NPC_CHALLENGER := 30012; -- Victorious Challenger
+SET @QUEST1 := 12971;
+SET @QUEST2 := 13423;
+SET @GOSSIP_MENUID := 9865;
+SET @SPELL_SUNDER := 11971; -- Sunder Armor
+SET @SPELL_REND := 11977; -- Rend
+
+UPDATE `creature_template` SET `faction_A`=2109,`faction_H`=2109,`unit_flags`=0x8000,`npcflag`=0x1,`gossip_menu_id`=@GOSSIP_MENUID,`AIName`='SmartAI',`ScriptName`='' WHERE `entry`=@NPC_CHALLENGER;
+
+DELETE FROM `creature_template_addon` WHERE `entry`=@NPC_CHALLENGER;
+INSERT INTO `creature_template_addon` (`entry`,`mount`,`bytes1`,`bytes2`,`auras`) VALUES
+(@NPC_CHALLENGER,0,0x0,0x1,'');
+
+DELETE FROM `creature_text` WHERE `entry`=@NPC_CHALLENGER;
+INSERT INTO `creature_text` (`entry`,`groupid`,`id`,`text`,`type`,`language`,`probability`,`emote`,`duration`,`sound`,`comment`) VALUES
+(@NPC_CHALLENGER,0,0,'You will not defeat me!',12,0,100,0,0,0,'Victorious Challenger'),
+(@NPC_CHALLENGER,0,1,'You''re not worthy of Thorim!',12,0,100,0,0,0,'Victorious Challenger'),
+(@NPC_CHALLENGER,0,2,'Good luck... You''ll need it!',12,0,100,0,0,0,'Victorious Challenger'),
+(@NPC_CHALLENGER,0,3,'May the best win!',12,0,100,0,0,0,'Victorious Challenger');
+
+DELETE FROM `gossip_menu` WHERE `entry`=@GOSSIP_MENUID;
+INSERT INTO `gossip_menu` (`entry`,`text_id`) VALUES
+(@GOSSIP_MENUID,13660);
+
+DELETE FROM `gossip_menu_option` WHERE `menu_id`=@GOSSIP_MENUID;
+INSERT INTO `gossip_menu_option` (`menu_id`,`id`,`option_icon`,`option_text`,`option_id`,`npc_option_npcflag`,`action_menu_id`,`action_poi_id`,`box_coded`,`box_money`,`box_text`) VALUES
+(@GOSSIP_MENUID,0,0,'Let''s do this, sister.',1,1,0,0,0,0,'');
+
+DELETE FROM `creature_equip_template` WHERE `entry`=@NPC_CHALLENGER;
+INSERT INTO `creature_equip_template` (`entry`,`itemEntry1`,`itemEntry2`,`itemEntry3`) VALUES
+(@NPC_CHALLENGER,40542,39288,0);
+
+DELETE FROM `smart_scripts` WHERE (`source_type`=0 AND `entryorguid`=@NPC_CHALLENGER) OR (`source_type`=9 AND `entryorguid`=@NPC_CHALLENGER*100);
+INSERT INTO `smart_scripts` (`entryorguid`,`source_type`,`id`,`link`,`event_type`,`event_phase_mask`,`event_chance`,`event_flags`,`event_param1`,`event_param2`,`event_param3`,`event_param4`,`action_type`,`action_param1`,`action_param2`,`action_param3`,`action_param4`,`action_param5`,`action_param6`,`target_type`,`target_param1`,`target_param2`,`target_param3`,`target_x`,`target_y`,`target_z`,`target_o`,`comment`) VALUES
+(@NPC_CHALLENGER,0,0,0,25,0,100,0,0,0,0,0,2,0,0,0,0,0,0,1,0,0,0,0,0,0,0,'Victorious Challenger - On Reset - Set Default Faction'),
+(@NPC_CHALLENGER,0,1,2,62,0,100,0,@GOSSIP_MENUID,0,0,0,72,0,0,0,0,0,0,7,0,0,0,0,0,0,0,'Victorious Challenger - On Gossip - Close Gossip'),
+(@NPC_CHALLENGER,0,2,0,61,0,100,0,0,0,0,0,80,@NPC_CHALLENGER*100,0,0,0,0,0,1,0,0,0,0,0,0,0,'Victorious Challenger - On Gossip - Run Timed Script'),
+(@NPC_CHALLENGER,0,3,0,9,0,100,0,0,5,5000,10000,11,@SPELL_SUNDER,0,0,0,0,0,2,0,0,0,0,0,0,0,'Victorious Challenger - On Range - Cast Sunder Armor'),
+(@NPC_CHALLENGER,0,4,0,0,0,100,0,10000,15000,15000,20000,11,@SPELL_REND,0,0,0,0,0,2,0,0,0,0,0,0,0,'Victorious Challenger - IC - Cast Rend'),
+(@NPC_CHALLENGER*100,9,0,0,0,0,100,0,1000,1000,1000,1000,1,0,0,0,0,0,0,1,0,0,0,0,0,0,0,'Victorious Challenger - Timed - Talk'),
+(@NPC_CHALLENGER*100,9,1,0,0,0,100,0,3000,3000,3000,3000,2,14,0,0,0,0,0,1,0,0,0,0,0,0,0,'Victorious Challenger - Timed - Set Faction Hostile'),
+(@NPC_CHALLENGER*100,9,2,0,0,0,100,0,0,0,0,0,49,0,0,0,0,0,0,7,0,0,0,0,0,0,0,'Victorious Challenger - Timed - Attack Invoker');
+
+DELETE FROM `conditions` WHERE `SourceTypeOrReferenceId`=15 AND `SourceGroup`=@GOSSIP_MENUID;
+INSERT INTO `conditions` (`SourceTypeOrReferenceId`,`SourceGroup`,`SourceEntry`,`SourceId`,`ElseGroup`,`ConditionTypeOrReference`,`ConditionTarget`,`ConditionValue1`,`ConditionValue2`,`ConditionValue3`,`NegativeCondition`,`ErrorTextId`,`ScriptName`,`Comment`) VALUES
+(15,@GOSSIP_MENUID,0,0,0,9,0,@QUEST1,0,0,0,0,'','Show gossip option 0 if player has quest Taking on All Challengers'),
+(15,@GOSSIP_MENUID,0,0,1,9,0,@QUEST2,0,0,0,0,'','Show gossip option 0 if player has quest Defending Your Title');
diff --git a/sql/old/3.3.5a/2012_09_01_00_world_spell_script_names.sql b/sql/old/3.3.5a/2012_09_01_00_world_spell_script_names.sql
new file mode 100644
index 00000000000..add7621b74c
--- /dev/null
+++ b/sql/old/3.3.5a/2012_09_01_00_world_spell_script_names.sql
@@ -0,0 +1,4 @@
+-- Unlocking zuluhed chains
+DELETE FROM `spell_script_names` WHERE `spell_id`=38790;
+INSERT INTO `spell_script_names` (`spell_id`, `ScriptName`) VALUES
+(38790, 'spell_unlocking_zuluheds_chains');
diff --git a/sql/old/3.3.5a/2012_09_02_00_world_quest_template.sql b/sql/old/3.3.5a/2012_09_02_00_world_quest_template.sql
new file mode 100644
index 00000000000..d7e3948ef4f
--- /dev/null
+++ b/sql/old/3.3.5a/2012_09_02_00_world_quest_template.sql
@@ -0,0 +1,49 @@
+-- Kandrostrasz <Brood of Alexstrasza> (15503) quests RequiredClasses fix by nelegalno
+UPDATE `quest_template` SET `RequiredClasses` = 1 WHERE `Id` IN (8559,8560); -- Warrior
+UPDATE `quest_template` SET `RequiredClasses` = 2 WHERE `Id` IN (8629,8655); -- Paladin
+UPDATE `quest_template` SET `RequiredClasses` = 4 WHERE `Id` IN (8626,8658); -- Hunter
+UPDATE `quest_template` SET `RequiredClasses` = 8 WHERE `Id` IN (8637,8640); -- Rogue
+UPDATE `quest_template` SET `RequiredClasses` = 16 WHERE `Id` IN (8593,8596); -- Priest
+UPDATE `quest_template` SET `RequiredClasses` = 64 WHERE `Id` IN (8621,8624); -- Shaman
+UPDATE `quest_template` SET `RequiredClasses` = 128 WHERE `Id` IN (8631,8634); -- Mage
+UPDATE `quest_template` SET `RequiredClasses` = 256 WHERE `Id` IN (8660,8663); -- Warlock
+UPDATE `quest_template` SET `RequiredClasses` = 1024 WHERE `Id` IN (8665,8668); -- Druid
+
+-- Andorgos <Brood of Malygos> (15502) quests RequiredClasses fix by nelegalno
+UPDATE `quest_template` SET `RequiredClasses` = 1 WHERE `Id` IN (8544,8561); -- Warrior
+UPDATE `quest_template` SET `RequiredClasses` = 2 WHERE `Id` IN (8628,8630); -- Paladin
+UPDATE `quest_template` SET `RequiredClasses` = 4 WHERE `Id` IN (8657,8659); -- Hunter
+UPDATE `quest_template` SET `RequiredClasses` = 8 WHERE `Id` IN (8639,8641); -- Rogue
+UPDATE `quest_template` SET `RequiredClasses` = 16 WHERE `Id` IN (8592,8594); -- Priest
+UPDATE `quest_template` SET `RequiredClasses` = 64 WHERE `Id` IN (8602,8623); -- Shaman
+UPDATE `quest_template` SET `RequiredClasses` = 128 WHERE `Id` IN (8625,8632); -- Mage
+UPDATE `quest_template` SET `RequiredClasses` = 256 WHERE `Id` IN (8662,8664); -- Warlock
+UPDATE `quest_template` SET `RequiredClasses` = 1024 WHERE `Id` IN (8667,8669); -- Druid
+
+-- Craftsman Wilhelm <Brotherhood of the Light> (16376) NPCs quests
+UPDATE `quest_template` SET `RequiredClasses` = 3 WHERE `Id` IN (9234,9235,9236); -- Warrior, Paladin
+UPDATE `quest_template` SET `RequiredClasses` = 68 WHERE `Id` IN (9244,9245,9246); -- Hunter, Shaman
+UPDATE `quest_template` SET `RequiredClasses` = 400 WHERE `Id` IN (9238,9239,9240); -- Priest, Mage, Warlock
+UPDATE `quest_template` SET `RequiredClasses` = 1032 WHERE `Id` IN (9241,9242,9243); -- Rogue, Druid
+
+-- Zanza the Restless (15042) NPCs quests
+UPDATE `quest_template` SET `RequiredClasses` = 1 WHERE `Id` = 8184; -- Warrior
+UPDATE `quest_template` SET `RequiredClasses` = 2 WHERE `Id` = 8185; -- Paladin
+UPDATE `quest_template` SET `RequiredClasses` = 4 WHERE `Id` = 8187; -- Hunter
+UPDATE `quest_template` SET `RequiredClasses` = 8 WHERE `Id` = 8186; -- Rogue
+UPDATE `quest_template` SET `RequiredClasses` = 16 WHERE `Id` = 8191; -- Priest
+UPDATE `quest_template` SET `RequiredClasses` = 64 WHERE `Id` = 8188; -- Shaman
+UPDATE `quest_template` SET `RequiredClasses` = 128 WHERE `Id` = 8189; -- Mage
+UPDATE `quest_template` SET `RequiredClasses` = 256 WHERE `Id` = 8190; -- Warlock
+UPDATE `quest_template` SET `RequiredClasses` = 1024 WHERE `Id` = 8192; -- Druid
+
+-- Vethsera <Brood of Ysera> (15504) quests RequiredClasses fix by nelegalno
+UPDATE `quest_template` SET `RequiredClasses` = 1 WHERE `Id` = 8562; -- Warrior
+UPDATE `quest_template` SET `RequiredClasses` = 2 WHERE `Id` = 8627; -- Paladin
+UPDATE `quest_template` SET `RequiredClasses` = 4 WHERE `Id` = 8656; -- Hunter
+UPDATE `quest_template` SET `RequiredClasses` = 8 WHERE `Id` = 8638; -- Rogue
+UPDATE `quest_template` SET `RequiredClasses` = 16 WHERE `Id` = 8603; -- Priest
+UPDATE `quest_template` SET `RequiredClasses` = 64 WHERE `Id` = 8622; -- Shaman
+UPDATE `quest_template` SET `RequiredClasses` = 128 WHERE `Id` = 8633; -- Mage
+UPDATE `quest_template` SET `RequiredClasses` = 256 WHERE `Id` = 8661; -- Warlock
+UPDATE `quest_template` SET `RequiredClasses` = 1024 WHERE `Id` = 8666; -- Druid
diff --git a/sql/old/3.3.5a/2012_09_02_01_world_sai.sql b/sql/old/3.3.5a/2012_09_02_01_world_sai.sql
new file mode 100644
index 00000000000..971c50d9c05
--- /dev/null
+++ b/sql/old/3.3.5a/2012_09_02_01_world_sai.sql
@@ -0,0 +1,36 @@
+-- Lok'lira the Crone
+SET @ENTRY := 29975;
+UPDATE `creature_template` SET `AIName`='SmartAI', `ScriptName`='' WHERE `entry`=@ENTRY;
+DELETE FROM `smart_scripts` WHERE `entryorguid`=@ENTRY AND `source_type`=0;
+INSERT INTO `smart_scripts` (`entryorguid`,`source_type`,`id`,`link`,`event_type`,`event_phase_mask`,`event_chance`,`event_flags`,`event_param1`,`event_param2`,`event_param3`,`event_param4`,`action_type`,`action_param1`,`action_param2`,`action_param3`,`action_param4`,`action_param5`,`action_param6`,`target_type`,`target_param1`,`target_param2`,`target_param3`,`target_x`,`target_y`,`target_z`,`target_o`,`comment`) VALUES
+(@ENTRY,0,0,1,62,0,100,0,9910,0,0,0,33,30467,0,0,0,0,0,7,0,0,0,0,0,0,0,'Loklira - gossip select 4 - The Hyldsmeet Kill credit'),
+(@ENTRY,0,1,0,61,0,100,0,0,0,0,0,72,0,0,0,0,0,0,7,0,0,0,0,0,0,0,'Loklira - gossip select 4 - Close gossip');
+
+UPDATE `gossip_menu_option` SET `action_menu_id`=9908 WHERE `menu_id`=9907;
+UPDATE `gossip_menu_option` SET `action_menu_id`=9909 WHERE `menu_id`=9908;
+UPDATE `gossip_menu_option` SET `action_menu_id`=9910 WHERE `menu_id`=9909;
+
+DELETE FROM `conditions` WHERE `SourceTypeOrReferenceId`=15 AND `SourceGroup`=9907;
+INSERT INTO `conditions` (`SourceTypeOrReferenceId`,`SourceGroup`,`SourceEntry`,`ElseGroup`,`ConditionTypeOrReference`,`ConditionValue1`,`ConditionValue2`,`ConditionValue3`,`ErrorTextId`,`ScriptName`,`Comment`) VALUES
+(15,9907,0,0,9,12970,0,0,0,'','Loklira - Show gossip if quest accepted');
+
+-- Thorim
+SET @THORIM :=29445;
+UPDATE `creature` SET `modelid`=0 WHERE `id`=@THORIM;
+UPDATE `creature_template` SET `AIName`='SmartAI', `ScriptName`='' WHERE `entry`=@THORIM;
+DELETE FROM `creature_addon` WHERE `guid`=97128;
+DELETE FROM `creature_template_addon` WHERE `entry`=@THORIM;
+INSERT INTO `creature_template_addon` (`entry`,`path_id`,`mount`,`bytes1`,`bytes2`,`emote`,`auras`) VALUES
+(@THORIM,0,0,1,0,0,'');
+
+DELETE FROM `smart_scripts` WHERE `entryorguid`=@THORIM AND `source_type`=0;
+INSERT INTO `smart_scripts` (`entryorguid`,`source_type`,`id`,`link`,`event_type`,`event_phase_mask`,`event_chance`,`event_flags`,`event_param1`,`event_param2`,`event_param3`,`event_param4`,`action_type`,`action_param1`,`action_param2`,`action_param3`,`action_param4`,`action_param5`,`action_param6`,`target_type`,`target_param1`,`target_param2`,`target_param3`,`target_x`,`target_y`,`target_z`,`target_o`,`comment`) VALUES
+(@THORIM,0,0,0,62,0,100,0,9926,0,0,0,33,30514,0,0,0,0,0,7,0,0,0,0,0,0,0,'Thorim - gossip select - give quest credit');
+
+UPDATE `gossip_menu_option` SET `action_menu_id`=9927 WHERE `menu_id`=9924;
+UPDATE `gossip_menu_option` SET `action_menu_id`=9926 WHERE `menu_id`=9927;
+UPDATE `gossip_menu_option` SET `action_menu_id`=9925 WHERE `menu_id`=9926;
+
+DELETE FROM `conditions` WHERE `SourceTypeOrReferenceId`=15 AND `SourceGroup`=9924;
+INSERT INTO `conditions` (`SourceTypeOrReferenceId`,`SourceGroup`,`SourceEntry`,`ElseGroup`,`ConditionTypeOrReference`,`ConditionValue1`,`ConditionValue2`,`ConditionValue3`,`ErrorTextId`,`ScriptName`,`Comment`) VALUES
+(15,9924,0,0,9,13064,0,0,0,'','Thorim - Show gossip if quest accepted');
diff --git a/sql/old/3.3.5a/2012_09_03_00_world_misc.sql b/sql/old/3.3.5a/2012_09_03_00_world_misc.sql
new file mode 100644
index 00000000000..e8910c78b40
--- /dev/null
+++ b/sql/old/3.3.5a/2012_09_03_00_world_misc.sql
@@ -0,0 +1,36 @@
+-- Cold Hearted (12856)
+
+SET @NPC_CAPTIVE_DRAKE := 29708; -- Captive Proto-Drake
+SET @NPC_FREED_DRAKE := 29709; -- Freed Proto-Drake
+SET @NPC_PRISONER := 29639; -- Brunnhildar Prisoner
+SET @NPC_LIBERATED := 29734; -- Liberated Brunnhildar
+
+SET @SPELL_SUM_FREE_DRAKE := 55028; -- Summon Freed Proto-Drake
+SET @SPELL_ICE_SHARD := 55046; -- Ice Shard (Rank 3)
+SET @SPELL_FREE_PRISONER := 55048; -- Free Brunnhildar Prisoner
+SET @AURA_IMPRISONMENT := 54894; -- Icy Imprisonment
+
+
+UPDATE `creature_template` SET `speed_walk`=1,`speed_run`=1.14286,`spell1`=@SPELL_ICE_SHARD,`HoverHeight`=4,`unit_flags`=0x1000008,`InhabitType`=4,`ScriptName`='npc_freed_protodrake' WHERE `entry`=@NPC_FREED_DRAKE;
+UPDATE `creature_template` SET `unit_flags`=33554432,`AIName`='SmartAI' WHERE `entry`=@NPC_LIBERATED;
+
+DELETE FROM `npc_spellclick_spells` WHERE `npc_entry`=@NPC_CAPTIVE_DRAKE;
+INSERT INTO `npc_spellclick_spells` (`npc_entry`,`spell_id`,`cast_flags`,`user_type`) VALUES
+(@NPC_CAPTIVE_DRAKE,@SPELL_SUM_FREE_DRAKE,1,0);
+
+DELETE FROM `creature_template_addon` WHERE `entry`=@NPC_FREED_DRAKE;
+INSERT INTO `creature_template_addon` (`entry`,`mount`,`bytes1`,`bytes2`,`auras`) VALUES
+(@NPC_FREED_DRAKE,0,0x3000000,0x1,'55034 61183');
+
+DELETE FROM `creature_text` WHERE `entry`=@NPC_FREED_DRAKE;
+INSERT INTO `creature_text` (`entry`,`groupid`,`id`,`text`,`type`,`language`,`probability`,`emote`,`duration`,`sound`,`comment`) VALUES
+(@NPC_FREED_DRAKE,0,0,'Return to Brunnhildar Village!',42,0,100,0,0,0,'Freed Proto-Drake'),
+(@NPC_FREED_DRAKE,0,1,'The proto-drake smells freedom and flies homeward!',41,0,100,0,0,0,'Freed Proto-Drake');
+
+DELETE FROM `spell_scripts` WHERE `id`=@SPELL_FREE_PRISONER;
+INSERT INTO `spell_scripts` (`id`,`effIndex`,`delay`,`command`,`datalong`,`datalong2`,`dataint`,`x`,`y`,`z`,`o`) VALUES
+(@SPELL_FREE_PRISONER,0,0,14,@AURA_IMPRISONMENT,0,0,0,0,0,0);
+
+DELETE FROM `smart_scripts` WHERE `source_type`=0 AND `entryorguid`=@NPC_LIBERATED;
+INSERT INTO `smart_scripts` (`entryorguid`,`source_type`,`id`,`link`,`event_type`,`event_phase_mask`,`event_chance`,`event_flags`,`event_param1`,`event_param2`,`event_param3`,`event_param4`,`action_type`,`action_param1`,`action_param2`,`action_param3`,`action_param4`,`action_param5`,`action_param6`,`target_type`,`target_param1`,`target_param2`,`target_param3`,`target_x`,`target_y`,`target_z`,`target_o`,`comment`) VALUES
+(@NPC_LIBERATED,0,0,0,54,0,100,0,0,0,0,0,41,30000,0,0,0,0,0,1,0,0,0,0,0,0,0,'Liberated Brunnhildar - On Spawn - Despawn in 30 seconds');
diff --git a/sql/old/3.3.5a/2012_09_03_01_world_gameobject_template.sql b/sql/old/3.3.5a/2012_09_03_01_world_gameobject_template.sql
new file mode 100644
index 00000000000..ff0907eee6e
--- /dev/null
+++ b/sql/old/3.3.5a/2012_09_03_01_world_gameobject_template.sql
@@ -0,0 +1 @@
+UPDATE `gameobject_template` SET `flags`=40 WHERE `entry`=186371; -- Zeppelin
diff --git a/sql/old/3.3.5a/2012_09_03_02_world_quest_template.sql b/sql/old/3.3.5a/2012_09_03_02_world_quest_template.sql
new file mode 100644
index 00000000000..0c0a7ce4e40
--- /dev/null
+++ b/sql/old/3.3.5a/2012_09_03_02_world_quest_template.sql
@@ -0,0 +1,2 @@
+-- Stalk the Stalker (9719) quest requirements fix
+UPDATE `quest_template` SET `RequiredRaces` = 0 WHERE `Id` = 9719;
diff --git a/sql/old/3.3.5a/2012_09_07_00_characters_characters.sql b/sql/old/3.3.5a/2012_09_07_00_characters_characters.sql
new file mode 100644
index 00000000000..26ad904b4a0
--- /dev/null
+++ b/sql/old/3.3.5a/2012_09_07_00_characters_characters.sql
@@ -0,0 +1,2 @@
+ALTER TABLE `characters` MODIFY `name`
+ VARCHAR(12) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL;
diff --git a/sql/old/3.3.5a/2012_09_07_00_world_spell_bonus_data.sql b/sql/old/3.3.5a/2012_09_07_00_world_spell_bonus_data.sql
new file mode 100644
index 00000000000..3d39c06051a
--- /dev/null
+++ b/sql/old/3.3.5a/2012_09_07_00_world_spell_bonus_data.sql
@@ -0,0 +1,4 @@
+SET @Spell := 28715; -- Flamecap Fire
+DELETE FROM `spell_bonus_data` WHERE `entry`=@Spell;
+INSERT INTO `spell_bonus_data` (`entry`,`direct_bonus`,`dot_bonus`,`ap_bonus`,`ap_dot_bonus`,`comments`) VALUES
+(@Spell,0,0,0,0, 'Flamecap Fire');
diff --git a/sql/old/3.3.5a/2012_09_07_01_world_creature_template.sql b/sql/old/3.3.5a/2012_09_07_01_world_creature_template.sql
new file mode 100644
index 00000000000..16e4f670fd2
--- /dev/null
+++ b/sql/old/3.3.5a/2012_09_07_01_world_creature_template.sql
@@ -0,0 +1 @@
+UPDATE `creature_template` SET `unit_flags2`=`unit_flags2`|0x800; -- UNIT_FLAG2_REGENERATE_POWER
diff --git a/sql/old/3.3.5a/2012_09_07_02_world_spell_script_names.sql b/sql/old/3.3.5a/2012_09_07_02_world_spell_script_names.sql
new file mode 100644
index 00000000000..652d45543e3
--- /dev/null
+++ b/sql/old/3.3.5a/2012_09_07_02_world_spell_script_names.sql
@@ -0,0 +1,3 @@
+DELETE FROM spell_script_names WHERE spell_id = -755;
+INSERT IGNORE INTO `spell_script_names` (`spell_id`, `ScriptName`) VALUES
+(-755, 'spell_warl_health_funnel');
diff --git a/sql/old/3.3.5a/2012_09_08_00_world_achievement_criteria_data.sql b/sql/old/3.3.5a/2012_09_08_00_world_achievement_criteria_data.sql
new file mode 100644
index 00000000000..cce5745dee9
--- /dev/null
+++ b/sql/old/3.3.5a/2012_09_08_00_world_achievement_criteria_data.sql
@@ -0,0 +1,6 @@
+DELETE FROM `achievement_criteria_data` WHERE `criteria_id` IN (10304,10313);
+INSERT INTO `achievement_criteria_data` (`criteria_id`,`type`,`value1`,`value2`,`ScriptName`) VALUES
+(10304,5,62320,0,''),
+(10304,12,0,0,''),
+(10313,5,62320,0,''),
+(10313,12,1,0,'');
diff --git a/sql/old/3.3.5a/2012_09_08_01_world_creature_template.sql b/sql/old/3.3.5a/2012_09_08_01_world_creature_template.sql
new file mode 100644
index 00000000000..fb34f345f2d
--- /dev/null
+++ b/sql/old/3.3.5a/2012_09_08_01_world_creature_template.sql
@@ -0,0 +1 @@
+UPDATE `creature_template` SET `InhabitType`=4 WHERE `entry` IN (32930,33909); -- Kologarn
diff --git a/sql/old/3.3.5a/2012_09_08_02_world_achievement_criteria_data.sql b/sql/old/3.3.5a/2012_09_08_02_world_achievement_criteria_data.sql
new file mode 100644
index 00000000000..2f25f6f20fa
--- /dev/null
+++ b/sql/old/3.3.5a/2012_09_08_02_world_achievement_criteria_data.sql
@@ -0,0 +1,10 @@
+-- Criteria data for achievement 'Wrecking Ball'
+DELETE FROM `disables` WHERE `sourceType`=4 AND `entry` IN (3368, 3369, 3370, 12578, 7623, 3371);
+DELETE FROM `achievement_criteria_data` WHERE `criteria_id` IN (3368, 3369, 3370, 12578, 7623, 3371);
+INSERT INTO `achievement_criteria_data`(`criteria_id`,`type`,`value1`,`value2`,`ScriptName`) VALUES
+(3368,2,0,0,''),
+(3369,2,0,0,''),
+(3370,2,0,0,''),
+(12578,2,0,0,''),
+(7623,2,0,0,''),
+(3371,2,0,0,'');
diff --git a/sql/old/3.3.5a/2012_09_09_00_world_command.sql b/sql/old/3.3.5a/2012_09_09_00_world_command.sql
new file mode 100644
index 00000000000..1fb3247bfbb
--- /dev/null
+++ b/sql/old/3.3.5a/2012_09_09_00_world_command.sql
@@ -0,0 +1,4 @@
+DELETE FROM `command` WHERE `name` = 'start';
+DELETE FROM `command` WHERE `name` = 'unstuck';
+INSERT INTO `command` (`name`, `security`, `help`) VALUES
+('unstuck', 0, 'Syntax: .unstuck $playername [inn/graveyard/startzone]\n\nTeleports specified player to specified location. Default location is player\'s current hearth location.');
diff --git a/sql/old/3.3.5a/2012_09_09_01_world_trinity_string.sql b/sql/old/3.3.5a/2012_09_09_01_world_trinity_string.sql
new file mode 100644
index 00000000000..2f3c0aa1938
--- /dev/null
+++ b/sql/old/3.3.5a/2012_09_09_01_world_trinity_string.sql
@@ -0,0 +1,3 @@
+DELETE FROM `trinity_string` WHERE `entry`=63; -- Existing entry 63 is not present in Language.h. It's safe to remove it.
+INSERT INTO `trinity_string` (`entry`, `content_default`) VALUES
+(63, 'You can''t do that right now.');
diff --git a/sql/old/3.3.5a/2012_09_09_02_world_spell_script_names.sql b/sql/old/3.3.5a/2012_09_09_02_world_spell_script_names.sql
new file mode 100644
index 00000000000..36e5b08c36d
--- /dev/null
+++ b/sql/old/3.3.5a/2012_09_09_02_world_spell_script_names.sql
@@ -0,0 +1,10 @@
+-- Gift of the Naaru
+DELETE FROM `spell_script_names` WHERE `ScriptName`='spell_gen_gift_of_naaru';
+INSERT INTO `spell_script_names` (`spell_id`,`ScriptName`) VALUES
+(28880,'spell_gen_gift_of_naaru'), -- SPELLFAMILY_WARRIOR
+(59542,'spell_gen_gift_of_naaru'), -- SPELLFAMILY_PALADIN
+(59543,'spell_gen_gift_of_naaru'), -- SPELLFAMILY_HUNTER
+(59544,'spell_gen_gift_of_naaru'), -- SPELLFAMILY_PRIEST
+(59545,'spell_gen_gift_of_naaru'), -- SPELLFAMILY_DEATHKNIGHT
+(59547,'spell_gen_gift_of_naaru'), -- SPELLFAMILY_SHAMAN
+(59548,'spell_gen_gift_of_naaru'); -- SPELLFAMILY_MAGE
diff --git a/sql/old/3.3.5a/2012_09_09_03_world_spell_bonus_data.sql b/sql/old/3.3.5a/2012_09_09_03_world_spell_bonus_data.sql
new file mode 100644
index 00000000000..a08c494da1b
--- /dev/null
+++ b/sql/old/3.3.5a/2012_09_09_03_world_spell_bonus_data.sql
@@ -0,0 +1,9 @@
+DELETE FROM `spell_bonus_data` WHERE `entry` IN (28880,59542,59543,59544,59545,59547,59548);
+INSERT INTO `spell_bonus_data` (`entry`,`direct_bonus`,`dot_bonus`,`ap_bonus`,`ap_dot_bonus`,`comments`) VALUES
+(28880,0,0,0,0,'Warrior - Gift of the Naaru'),
+(59542,0,0,0,0,'Paladin - Gift of the Naaru'),
+(59543,0,0,0,0,'Hunter - Gift of the Naaru'),
+(59544,0,0,0,0,'Priest - Gift of the Naaru'),
+(59545,0,0,0,0,'Deathknight - Gift of the Naaru'),
+(59547,0,0,0,0,'Shaman - Gift of the Naaru'),
+(59548,0,0,0,0,'Mage - Gift of the Naaru');
diff --git a/sql/old/3.3.5a/2012_09_09_04_world_quest_template.sql b/sql/old/3.3.5a/2012_09_09_04_world_quest_template.sql
new file mode 100644
index 00000000000..418c5badb36
--- /dev/null
+++ b/sql/old/3.3.5a/2012_09_09_04_world_quest_template.sql
@@ -0,0 +1 @@
+UPDATE `quest_template` SET `OfferRewardText`='Excellent, $N. You''ve saved me a lot of work!$b$bBut don''t think that I''m not grateful!' WHERE `Id`=6571;
diff --git a/sql/old/3.3.5a/2012_09_10_00_world_game_event.sql b/sql/old/3.3.5a/2012_09_10_00_world_game_event.sql
new file mode 100644
index 00000000000..edd6413379c
--- /dev/null
+++ b/sql/old/3.3.5a/2012_09_10_00_world_game_event.sql
@@ -0,0 +1,3 @@
+UPDATE `game_event` SET `start_time`='2012-11-04 00:01:00' WHERE `eventEntry`=3; -- Darkmoon Faire - Terrokkar
+UPDATE `game_event` SET `start_time`='2012-12-02 00:01:00' WHERE `eventEntry`=4; -- Darkmoon Faire - Elwynn
+UPDATE `game_event` SET `start_time`='2012-10-07 00:01:00' WHERE `eventEntry`=5; -- Darkmoon Faire - Mulgore
diff --git a/sql/old/3.3.5a/2012_09_10_01_world_quest_template.sql b/sql/old/3.3.5a/2012_09_10_01_world_quest_template.sql
new file mode 100644
index 00000000000..2db8883d92c
--- /dev/null
+++ b/sql/old/3.3.5a/2012_09_10_01_world_quest_template.sql
@@ -0,0 +1 @@
+UPDATE `quest_template` SET `OfferRewardText`="What!? If I knew that Pao'ka Swiftmountain was going to snoop around Highperch, I would have chained him to a totem! His father was reluctant allowing him to come with me to Thousand Needles. We came here to study the different creatures that inhabit these beautiful lands.$b$bI appreciate the help you have shown Pao'ka. I hope this covers any misfortunes this deed has cost you." WHERE `Id`=4770;
diff --git a/sql/old/3.3.5a/2012_09_10_02_world_creature_text.sql b/sql/old/3.3.5a/2012_09_10_02_world_creature_text.sql
new file mode 100644
index 00000000000..7a3b1a2d86f
--- /dev/null
+++ b/sql/old/3.3.5a/2012_09_10_02_world_creature_text.sql
@@ -0,0 +1 @@
+UPDATE `creature_text` SET `text`='Good news, everyone! I think I''ve perfected a plague that will destroy all life on Azeroth!' WHERE `entry`=36678 AND `groupid`=4 AND `id`=0;
diff --git a/sql/old/3.3.5a/2012_09_10_03_world_quest_template.sql b/sql/old/3.3.5a/2012_09_10_03_world_quest_template.sql
new file mode 100644
index 00000000000..aae769ced71
--- /dev/null
+++ b/sql/old/3.3.5a/2012_09_10_03_world_quest_template.sql
@@ -0,0 +1,3 @@
+-- Grark Lorkrub should be available only when Kill On Sight: High Ranking Dark Iron Officials is complete
+UPDATE `quest_template` SET `NextQuestId`=4122 WHERE `Id`=4082;
+UPDATE `quest_template` SET `PrevQuestId`=4082 WHERE `Id`=4122;
diff --git a/sql/old/3.3.5a/2012_09_10_04_world_quest_template.sql b/sql/old/3.3.5a/2012_09_10_04_world_quest_template.sql
new file mode 100644
index 00000000000..5805debd094
--- /dev/null
+++ b/sql/old/3.3.5a/2012_09_10_04_world_quest_template.sql
@@ -0,0 +1,2 @@
+-- Fix some quest requirements
+UPDATE `quest_template` SET `PrevQuestId`=3906 WHERE `Id` IN (3907,7201); -- Disharmony of Fire and The Last Element are available only, if Disharmony of Flame is completed
diff --git a/sql/old/3.3.5a/2012_09_10_06_world_creature_template.sql b/sql/old/3.3.5a/2012_09_10_06_world_creature_template.sql
new file mode 100644
index 00000000000..24a60b107ec
--- /dev/null
+++ b/sql/old/3.3.5a/2012_09_10_06_world_creature_template.sql
@@ -0,0 +1 @@
+UPDATE `creature_template` SET `flags_extra`=`flags_extra`|256 WHERE `entry` IN (36897, 38138); -- Little Ooze
diff --git a/sql/old/3.3.5a/2012_09_10_07_world_go_loot_template.sql b/sql/old/3.3.5a/2012_09_10_07_world_go_loot_template.sql
new file mode 100644
index 00000000000..a5e30edfe2c
--- /dev/null
+++ b/sql/old/3.3.5a/2012_09_10_07_world_go_loot_template.sql
@@ -0,0 +1,2 @@
+-- Vic's Keys drop chance ( http://old.wowhead.com/object=190778 ) by nelegalno
+UPDATE `gameobject_loot_template` SET `ChanceOrQuestChance` = -100 WHERE `entry`=24861 AND `item`=39264;
diff --git a/sql/old/3.3.5a/2012_09_10_08_world_spell_area.sql b/sql/old/3.3.5a/2012_09_10_08_world_spell_area.sql
new file mode 100644
index 00000000000..4e4e36051c9
--- /dev/null
+++ b/sql/old/3.3.5a/2012_09_10_08_world_spell_area.sql
@@ -0,0 +1,5 @@
+-- Cast Armistice in front of the pavillions as well
+DELETE FROM `spell_area` WHERE `spell`=64373 AND `area` IN (4676, 4677);
+INSERT INTO `spell_area` (`spell`,`area`,`quest_start`,`quest_start_active`,`quest_end`,`aura_spell`,`racemask`,`gender`,`autocast`) VALUES
+(64373,4676,0,0,0,0,0,2,1), -- Sunreaver Pavillion
+(64373,4677,0,0,0,0,0,2,1); -- SIlver Covenant Pavillion
diff --git a/sql/old/3.3.5a/2012_09_10_09_world_creature_involvedrelation.sql b/sql/old/3.3.5a/2012_09_10_09_world_creature_involvedrelation.sql
new file mode 100644
index 00000000000..e30e1559c54
--- /dev/null
+++ b/sql/old/3.3.5a/2012_09_10_09_world_creature_involvedrelation.sql
@@ -0,0 +1,4 @@
+DELETE FROM creature_involvedrelation WHERE quest IN (25500, 25286);
+INSERT INTO creature_involvedrelation (id, quest) VALUES
+(39675, 25500),
+(39675, 25286);
diff --git a/sql/old/3.3.5a/2012_09_10_10_world_gossips.sql b/sql/old/3.3.5a/2012_09_10_10_world_gossips.sql
new file mode 100644
index 00000000000..042b05dc83a
--- /dev/null
+++ b/sql/old/3.3.5a/2012_09_10_10_world_gossips.sql
@@ -0,0 +1,111 @@
+-- gossip assignation from sniff
+UPDATE `creature_template` SET `gossip_menu_id`=4534 WHERE `entry`=3047; -- Archmage Shymm <Mage Trainer>
+UPDATE `creature_template` SET `gossip_menu_id`=4536 WHERE `entry`=3048; -- Ursyn Ghull <Mage Trainer>
+UPDATE `creature_template` SET `gossip_menu_id`=12670 WHERE `entry`=6328; -- Dannie Fizzwizzle <Demon Trainer>
+UPDATE `creature_template` SET `gossip_menu_id`=12670 WHERE `entry`=6373; -- Dane Winslow <Demon Trainer>
+UPDATE `creature_template` SET `gossip_menu_id`=12670 WHERE `entry`=6374; -- Cylina Darkheart <Demon Trainer>
+UPDATE `creature_template` SET `gossip_menu_id`=1622 WHERE `entry`=8965; -- Shawn
+UPDATE `creature_template` SET `gossip_menu_id`=4119 WHERE `entry`=11047; -- Kray <Apprentice Alchemist>
+UPDATE `creature_template` SET `gossip_menu_id`=4266 WHERE `entry`=11051; -- Vhan <Apprentice Tailor>
+UPDATE `creature_template` SET `gossip_menu_id`=4154 WHERE `entry`=11065; -- Thonys Pillarstone <Apprentice Enchanter>
+UPDATE `creature_template` SET `gossip_menu_id`=4158 WHERE `entry`=11071; -- Mot Dawnstrider <Apprentice Enchanter>
+UPDATE `creature_template` SET `gossip_menu_id`=4204 WHERE `entry`=11081; -- Faldron <Apprentice Leatherworker>
+UPDATE `creature_template` SET `gossip_menu_id`=4181 WHERE `entry`=11083; -- Darianna <Apprentice Leatherworker>
+UPDATE `creature_template` SET `gossip_menu_id`=4207 WHERE `entry`=11084; -- Tarn <Apprentice Leatherworker>
+UPDATE `creature_template` SET `gossip_menu_id`=5142 WHERE `entry`=13442; -- Arch Druid Renferal
+UPDATE `creature_template` SET `gossip_menu_id`=5141 WHERE `entry`=13443; -- Druid of the Grove
+UPDATE `creature_template` SET `gossip_menu_id`=5081 WHERE `entry`=13447; -- Corporal Noreg Stormpike
+UPDATE `creature_template` SET `gossip_menu_id`=5281 WHERE `entry`=13577; -- Stormpike Ram Rider Commander
+UPDATE `creature_template` SET `gossip_menu_id`=7993 WHERE `entry`=15991; -- Lady Dena Kennedy
+UPDATE `creature_template` SET `gossip_menu_id`=7471 WHERE `entry`=17421; -- Clopper Wizbang <Explorers' League>
+UPDATE `creature_template` SET `gossip_menu_id`=7455 WHERE `entry`=17424; -- Anchorite Paetheus <First Aid Trainer>
+UPDATE `creature_template` SET `gossip_menu_id`=7459 WHERE `entry`=17434; -- Morae <Herbalism Trainer>
+UPDATE `creature_template` SET `gossip_menu_id`=7461 WHERE `entry`=17599; -- Aonar
+UPDATE `creature_template` SET `gossip_menu_id`=7462 WHERE `entry`=17649; -- Kessel <Elekk Lord>
+UPDATE `creature_template` SET `gossip_menu_id`=9821 WHERE `entry`=17666; -- Astur <Stable Master>
+UPDATE `creature_template` SET `gossip_menu_id`=7463 WHERE `entry`=17676; -- Achelus
+UPDATE `creature_template` SET `gossip_menu_id`=7464 WHERE `entry`=17703; -- Messenger Hermesius
+UPDATE `creature_template` SET `gossip_menu_id`=8298 WHERE `entry`=17712; -- Captain Edward Hanes
+UPDATE `creature_template` SET `gossip_menu_id`=7835 WHERE `entry`=17927; -- Scout Jorli
+UPDATE `creature_template` SET `gossip_menu_id`=7738 WHERE `entry`=18252; -- Andarl
+UPDATE `creature_template` SET `gossip_menu_id`=7753 WHERE `entry`=18387; -- Bertelm
+UPDATE `creature_template` SET `gossip_menu_id`=7743 WHERE `entry`=18389; -- Thander
+UPDATE `creature_template` SET `gossip_menu_id`=7752 WHERE `entry`=18390; -- Ros'eleth
+UPDATE `creature_template` SET `gossip_menu_id`=7695 WHERE `entry`=18416; -- Huntress Kima
+UPDATE `creature_template` SET `gossip_menu_id`=7698 WHERE `entry`=18459; -- Jenai Starwhisper
+UPDATE `creature_template` SET `gossip_menu_id`=7745 WHERE `entry`=18704; -- Taela Everstride
+UPDATE `creature_template` SET `gossip_menu_id`=7773 WHERE `entry`=18713; -- Lieutenant Gravelhammer
+UPDATE `creature_template` SET `gossip_menu_id`=7814 WHERE `entry`=18745; -- Captain Auric Sunchaser
+UPDATE `creature_template` SET `gossip_menu_id`=7833 WHERE `entry`=18804; -- Prospector Nachlan <Explorers' League>
+UPDATE `creature_template` SET `gossip_menu_id`=7940 WHERE `entry`=19137; -- "Shotgun" Jones <Nesingwary Safari>
+UPDATE `creature_template` SET `gossip_menu_id`=8433 WHERE `entry`=19340; -- Mi'irku Farstep <Portal Trainer>
+UPDATE `creature_template` SET `gossip_menu_id`=7973 WHERE `entry`=19375; -- Eli Thunderstrike <Sky'ree's Keeper>
+UPDATE `creature_template` SET `gossip_menu_id`=8251 WHERE `entry`=21151; -- Borgrim Stouthammer <Explorers' League>
+UPDATE `creature_template` SET `gossip_menu_id`=8247 WHERE `entry`=21158; -- Commander Skyshadow
+UPDATE `creature_template` SET `gossip_menu_id`=8252 WHERE `entry`=21197; -- Bronwyn Stouthammer <Explorers' League>
+UPDATE `creature_template` SET `gossip_menu_id`=8566 WHERE `entry`=22832; -- Morthis Whisperwing <Druid of the Talon>
+
+-- gossip from sniff
+DELETE FROM `gossip_menu` WHERE (`entry`=1621 AND `text_id`=2273) OR (`entry`=1622 AND `text_id`=2276) OR (`entry`=4119 AND `text_id`=5040) OR (`entry`=4154 AND `text_id`=5184) OR (`entry`=4158 AND `text_id`=5196) OR (`entry`=4181 AND `text_id`=5273) OR (`entry`=4204 AND `text_id`=5325) OR (`entry`=4207 AND `text_id`=5340) OR (`entry`=4266 AND `text_id`=5428) OR (`entry`=4534 AND `text_id`=563) OR (`entry`=4536 AND `text_id`=563) OR (`entry`=5081 AND `text_id`=6288) OR (`entry`=5141 AND `text_id`=6173) OR (`entry`=5142 AND `text_id`=6174) OR (`entry`=5281 AND `text_id`=6313) OR (`entry`=7455 AND `text_id`=9029) OR (`entry`=7459 AND `text_id`=9034) OR (`entry`=7461 AND `text_id`=9037) OR (`entry`=7462 AND `text_id`=9041) OR (`entry`=7463 AND `text_id`=9042) OR (`entry`=7464 AND `text_id`=9043) OR (`entry`=7471 AND `text_id`=9054) OR (`entry`=7695 AND `text_id`=9389) OR (`entry`=7698 AND `text_id`=9393) OR (`entry`=7738 AND `text_id`=9471) OR (`entry`=7743 AND `text_id`=9481) OR (`entry`=7745 AND `text_id`=9484) OR (`entry`=7752 AND `text_id`=9492) OR (`entry`=7753 AND `text_id`=9493) OR (`entry`=7773 AND `text_id`=9521) OR (`entry`=7814 AND `text_id`=9566) OR (`entry`=7833 AND `text_id`=9586) OR (`entry`=7835 AND `text_id`=9591) OR (`entry`=7940 AND `text_id`=9733) OR (`entry`=7973 AND `text_id`=9805) OR (`entry`=7993 AND `text_id`=9845) OR (`entry`=8247 AND `text_id`=10264) OR (`entry`=8251 AND `text_id`=10270) OR (`entry`=8252 AND `text_id`=10271) OR (`entry`=8298 AND `text_id`=10352) OR (`entry`=8432 AND `text_id`=10538) OR (`entry`=8433 AND `text_id`=10291) OR (`entry`=8433 AND `text_id`=10292) OR (`entry`=8566 AND `text_id`=10735);
+INSERT INTO `gossip_menu` (`entry`, `text_id`) VALUES
+(1621, 2273), -- 8962
+(1622, 2276), -- 8965
+(4119, 5040), -- 11047
+(4154, 5184), -- 11065
+(4158, 5196), -- 11071
+(4181, 5273), -- 11083
+(4204, 5325), -- 11081
+(4207, 5340), -- 11084
+(4266, 5428), -- 11051
+(4534, 563), -- 3047
+(4536, 563), -- 3048
+(5081, 6288), -- 13447
+(5141, 6173), -- 13443
+(5142, 6174), -- 13442
+(5281, 6313), -- 13577
+(7455, 9029), -- 17424
+(7459, 9034), -- 17434
+(7461, 9037), -- 17599
+(7462, 9041), -- 17649
+(7463, 9042), -- 17676
+(7464, 9043), -- 17703
+(7471, 9054), -- 17421
+(7695, 9389), -- 18416
+(7698, 9393), -- 18459
+(7738, 9471), -- 18252
+(7743, 9481), -- 18389
+(7745, 9484), -- 18704
+(7752, 9492), -- 18390
+(7753, 9493), -- 18387
+(7773, 9521), -- 18713
+(7814, 9566), -- 18745
+(7833, 9586), -- 18804
+(7835, 9591), -- 17927
+(7940, 9733), -- 19137
+(7973, 9805), -- 19375
+(7993, 9845), -- 15991
+(8247, 10264), -- 21158
+(8251, 10270), -- 21151
+(8252, 10271), -- 21197
+(8298, 10352), -- 17712
+(8432, 10538), -- 21983
+(8433, 10291), -- 19340
+(8433, 10292), -- 19340
+(8566, 10735); -- 22832
+
+-- correct npc_flags for npc from sniff
+UPDATE `creature_template` SET `npcflag`=0 WHERE `entry`=3210; -- Brave Proudsnout
+UPDATE `creature_template` SET `npcflag`=0 WHERE `entry`=3211; -- Brave Lightninghorn
+UPDATE `creature_template` SET `npcflag`=0 WHERE `entry`=3213; -- Brave Running Wolf
+UPDATE `creature_template` SET `npcflag`=0 WHERE `entry`=3214; -- Brave Greathoof
+UPDATE `creature_template` SET `npcflag`=0 WHERE `entry`=3502; -- Ratchet Bruiser
+UPDATE `creature_template` SET `npcflag`=3 WHERE `entry`=21151; -- Borgrim Stouthammer <Explorers' League>
+UPDATE `creature_template` SET `npcflag`=3 WHERE `entry`=21197; -- Bronwyn Stouthammer <Explorers' League>
+UPDATE `creature_template` SET `npcflag`=2 WHERE `entry`=21469; -- Daranelle
+
+-- Add condition
+DELETE FROM `conditions` WHERE (`SourceTypeOrReferenceId`=14 AND `SourceGroup`=8433 AND `SourceEntry`=10291) OR (`SourceTypeOrReferenceId`=14 AND `SourceGroup`=8433 AND `SourceEntry`=10292) OR (`SourceTypeOrReferenceId`=14 AND `SourceGroup`=12670 AND `SourceEntry`=12549);
+INSERT INTO `conditions` (`SourceTypeOrReferenceId`, `SourceGroup`, `SourceEntry`, `SourceId`, `ElseGroup`, `ConditionTypeOrReference`, `ConditionTarget`, `ConditionValue1`, `ConditionValue2`, `ConditionValue3`, `NegativeCondition`, `ErrorTextId`, `ScriptName`, `Comment`) VALUES
+(14,8433,10291,0,0,15,0,128,0,0,1,0,'','Show gossip text if player is not a mage'),
+(14,8433,10292,0,0,15,0,128,0,0,0,0,'','Show gossip text if player is a mage'),
+(14,12670,12549,0,0,15,0,256,0,0,1,0,'','Show gossip text if player is not a Warlock');
diff --git a/sql/old/3.3.5a/2012_09_10_11_world_event_scripts.sql b/sql/old/3.3.5a/2012_09_10_11_world_event_scripts.sql
new file mode 100644
index 00000000000..e0b122ede05
--- /dev/null
+++ b/sql/old/3.3.5a/2012_09_10_11_world_event_scripts.sql
@@ -0,0 +1,7 @@
+-- Finding the Keymaster by nelegalno
+
+UPDATE `quest_template` SET `SpecialFlags` = 0, `RequiredSpellCast1` = 0 WHERE `ID` = 10256;
+DELETE FROM `event_scripts` WHERE id=12857;
+INSERT INTO `event_scripts` (`id`,`delay`,`command`,`datalong`,`datalong2`,`dataint`,`x`,`y`,`z`,`o`) VALUES
+(12857,0,10,19938,3000000,0,2248.43,2227.97,138.56,2.48121),
+(12857,1,8,19938,1,0,0,0,0,0);
diff --git a/sql/old/3.3.5a/2012_09_10_12_world_sai.sql b/sql/old/3.3.5a/2012_09_10_12_world_sai.sql
new file mode 100644
index 00000000000..99111fb5961
--- /dev/null
+++ b/sql/old/3.3.5a/2012_09_10_12_world_sai.sql
@@ -0,0 +1,4 @@
+UPDATE `creature_template` SET `AIName` = 'SmartAI' WHERE `entry`=20243;
+DELETE FROM `smart_scripts` WHERE `entryorguid`=20243 AND `id`=0 AND `source_type`=0;
+INSERT INTO `smart_scripts` (`entryorguid`,`source_type`,`id`,`link`,`event_type`,`event_phase_mask`,`event_chance`,`event_flags`,`event_param1`,`event_param2`,`event_param3`,`event_param4`,`action_type`,`action_param1`,`action_param2`,`action_param3`,`action_param4`,`action_param5`,`action_param6`,`target_type`,`target_param1`,`target_param2`,`target_param3`,`target_x`,`target_y`,`target_z`,`target_o`,`comment`) VALUES
+(20243,0,0,0,8,0,100,0,256,0,0,0,19,0,0,0,0,0,0,1,0,0,0,0.0,0.0,0.0,0.0,"Scrapped Fel Reaver - On Spellhit - Remove - OOC Not attackable - flags");
diff --git a/sql/old/3.3.5a/2012_09_10_13_world_creature_model_info.sql b/sql/old/3.3.5a/2012_09_10_13_world_creature_model_info.sql
new file mode 100644
index 00000000000..339072d0502
--- /dev/null
+++ b/sql/old/3.3.5a/2012_09_10_13_world_creature_model_info.sql
@@ -0,0 +1,4 @@
+UPDATE `creature_model_info` SET `modelid_other_gender`=4264 WHERE `modelid`=4261; -- Female orc grunt
+UPDATE `creature_model_info` SET `modelid_other_gender`=4263 WHERE `modelid`=4262; -- Female tauren
+UPDATE `creature_model_info` SET `modelid_other_gender`=4262 WHERE `modelid`=4263; -- Male tauren
+UPDATE `creature_model_info` SET `modelid_other_gender`=4261 WHERE `modelid`=4264; -- Male orc grunt
diff --git a/sql/old/3.3.5a/2012_09_11_00_world_misc.sql b/sql/old/3.3.5a/2012_09_11_00_world_misc.sql
new file mode 100644
index 00000000000..0f47f1bf2e9
--- /dev/null
+++ b/sql/old/3.3.5a/2012_09_11_00_world_misc.sql
@@ -0,0 +1,11 @@
+-- ToCr orbs
+
+SET @NPC_ORB1 := 34606; -- Frost Sphere
+SET @NPC_ORB2 := 34649; -- Frost Sphere
+
+UPDATE `creature_template` SET `speed_walk`=1.2,`speed_run`=1.42,`InhabitType`=7 WHERE `entry` IN (@NPC_ORB1,@NPC_ORB2);
+
+DELETE FROM `creature_template_addon` WHERE `entry` IN (@NPC_ORB1,@NPC_ORB2);
+INSERT INTO `creature_template_addon` (`entry`,`mount`,`bytes1`,`bytes2`,`auras`) VALUES
+(@NPC_ORB1,0,0x3000000,0x1,''),
+(@NPC_ORB2,0,0x3000000,0x1,'');
diff --git a/sql/old/3.3.5a/2012_09_12_00_world_misc.sql b/sql/old/3.3.5a/2012_09_12_00_world_misc.sql
new file mode 100644
index 00000000000..50896ce414c
--- /dev/null
+++ b/sql/old/3.3.5a/2012_09_12_00_world_misc.sql
@@ -0,0 +1,9 @@
+-- East Porticullis(195648): close and corrections
+UPDATE `gameobject` SET `phaseMask`=1,`rotation2`=0.7071065,`rotation3`=0.707107,`spawntimesecs`=7200,`animprogress`=255,`state`=0 WHERE `guid`=151176;
+
+-- North Portcullis(195650): delete extra spawn and corrections
+DELETE FROM `gameobject` WHERE `guid`=150080;
+UPDATE `gameobject` SET `phaseMask`=1,`rotation2`=0.7071065,`rotation3`=0.707107,`spawntimesecs`=7200,`animprogress`=255,`state`=1 WHERE `guid`=151178;
+
+-- Web Door(195485): corrections
+UPDATE `gameobject` SET `spawnMask`=15,`rotation2`=0.7071067,`rotation3`=0.7071068,`spawntimesecs`=7200,`animprogress`=255 WHERE `guid`=151192;
diff --git a/sql/old/3.3.5a/2012_09_12_01_world_creature.sql b/sql/old/3.3.5a/2012_09_12_01_world_creature.sql
new file mode 100644
index 00000000000..1b7fa2d78ef
--- /dev/null
+++ b/sql/old/3.3.5a/2012_09_12_01_world_creature.sql
@@ -0,0 +1 @@
+DELETE FROM `creature` WHERE `id`=36095;
diff --git a/sql/old/3.3.5a/2012_09_13_00_world_item_template.sql b/sql/old/3.3.5a/2012_09_13_00_world_item_template.sql
new file mode 100644
index 00000000000..48b9d3a107f
--- /dev/null
+++ b/sql/old/3.3.5a/2012_09_13_00_world_item_template.sql
@@ -0,0 +1 @@
+ALTER TABLE `item_template` CHANGE unk0 SoundOverrideSubclass tinyint(3) NOT NULL DEFAULT '-1';
diff --git a/sql/old/3.3.5a/2012_09_13_01_world_fires_over_skettis.sql b/sql/old/3.3.5a/2012_09_13_01_world_fires_over_skettis.sql
new file mode 100644
index 00000000000..de9ba5a78fe
--- /dev/null
+++ b/sql/old/3.3.5a/2012_09_13_01_world_fires_over_skettis.sql
@@ -0,0 +1,91 @@
+-- Add support for quest ID: 11008 - "Fires Over Skettis" based on Warpten fix and Nelegalno/shlomi1515 updates
+-- Also add support for achievement - http://www.wowhead.com/achievement=1275/bombs-away
+SET @TRIGGER := 22991;
+SET @EGG := 185549;
+SET @SKYBLAST := 39844;
+SET @SUMMEGG := 39843;
+-- Adds SAI support for Monstrous Kaliri Egg Trigger and the GO
+UPDATE `creature_template` SET `AIName`= 'SmartAI' WHERE `entry`=@TRIGGER;
+DELETE FROM `smart_scripts` WHERE `entryorguid`=@TRIGGER AND `source_type`=0;
+DELETE FROM `smart_scripts` WHERE `entryorguid`=@TRIGGER*100 AND `source_type`=9;
+INSERT INTO `smart_scripts` (`entryorguid`,`source_type`,`id`,`link`,`event_type`,`event_phase_mask`,`event_chance`,`event_flags`,`event_param1`,`event_param2`,`event_param3`,`event_param4`,`action_type`,`action_param1`,`action_param2`,`action_param3`,`action_param4`,`action_param5`,`action_param6`,`target_type`,`target_param1`,`target_param2`,`target_param3`,`target_x`,`target_y`,`target_z`,`target_o`,`comment`) VALUES
+(@TRIGGER,0,0,0,25,0,100,0,0,0,0,0,11,@SUMMEGG,0,0,0,0,0,1,0,0,0,0,0,0,0, 'Monstrous Kaliri Egg Trigger - On spawn/reset - Summon Monstrous Kaliri Egg (object wild)'),
+(@TRIGGER,0,1,2,8,0,100,0,@SKYBLAST,0,0,0,33,@TRIGGER,0,0,0,0,0,16,0,0,0,0,0,0,0, 'Monstrous Kaliri Egg Trigger - On Skyguard Blasting Charge hit - Give kill credit to invoker party'),
+(@TRIGGER,0,2,3,61,0,100,0,0,0,0,0,45,0,1,0,0,0,0,20,@EGG,1,0,0,0,0,0, 'Monstrous Kaliri Egg Trigger - Linked with previous event - Despawn'),
+(@TRIGGER,0,3,0,61,0,100,0,0,0,0,0,80,@TRIGGER*100,0,0,0,0,0,1,0,0,0,0,0,0,0, 'Monstrous Kaliri Egg Trigger - Linked with previous event - Start script 0'),
+(@TRIGGER*100,9,0,0,0,0,100,0,44000,44000,0,0,11,@SUMMEGG,0,0,0,0,0,1,0,0,0,0,0,0,0, 'Monstrous Kaliri Egg Trigger /On actionlist/ - Action 0 - Cast Summon Monstrous Kaliri Egg');
+-- Add SAI for Cannonball Stack
+UPDATE `gameobject_template` SET `AIName`='SmartGameObjectAI' WHERE `entry`=@EGG;
+DELETE FROM `smart_scripts` WHERE `source_type`=1 AND `entryorguid`=@EGG;
+INSERT INTO `smart_scripts` (`entryorguid`,`source_type`,`id`,`link`,`event_type`,`event_phase_mask`,`event_chance`,`event_flags`,`event_param1`,`event_param2`,`event_param3`,`event_param4`,`action_type`,`action_param1`,`action_param2`,`action_param3`,`action_param4`,`action_param5`,`action_param6`,`target_type`,`target_param1`,`target_param2`,`target_param3`,`target_x`,`target_y`,`target_z`,`target_o`,`comment`) VALUES
+(@EGG,1,0,0,38,0,100,0,0,1,0,0,70,45,0,0,0,0,0,1,0,0,0,0,0,0,0,' Monstrous Kaliri Egg - On data set 0 1 - Respawn object /make it reappear after 45 secs/');
+-- Remove achievement from disabled
+DELETE FROM `disables` WHERE `sourceType`=4 AND `entry`=3922;
+-- Insert GO spawns taken directly from already spawned triggers coordinates = no need to sniff them
+SET @guid := 74685;
+DELETE FROM `gameobject` WHERE `id`=@EGG;
+INSERT INTO `gameobject` (`guid`,`id`,`map`,`spawnMask`,`phaseMask`,`position_x`,`position_y`,`position_z`,`orientation`,`spawntimesecs`) VALUES
+(@guid+0,@EGG,530,1,1,-3857.69,3426.25,363.733,-0.087267,180),
+(@guid+1,@EGG,530,1,1,-3845.16,3332.2,338.59,2.9147,180),
+(@guid+2,@EGG,530,1,1,-3965.16,3232.7,347.552,-0.122173,180),
+(@guid+3,@EGG,530,1,1,-3955.86,3222.16,347.503,0.244346,180),
+(@guid+4,@EGG,530,1,1,-3953.3,3227.94,347.564,-0.244346,180),
+(@guid+5,@EGG,530,1,1,-4044.66,3287.29,348.362,0.349066,180),
+(@guid+6,@EGG,530,1,1,-4041.39,3271,346.642,-2.09439,180),
+(@guid+7,@EGG,530,1,1,-4049.31,3285.9,348.335,1.43117,180),
+(@guid+8,@EGG,530,1,1,-4076.99,3415.22,334.008,-2.33874,180),
+(@guid+9,@EGG,530,1,1,-4076.79,3412.91,334.617,-1.0821,180),
+(@guid+10,@EGG,530,1,1,-4077.92,3412.57,334.768,-0.733038,180),
+(@guid+11,@EGG,530,1,1,-4107.93,3121.5,357.427,1.01229,180),
+(@guid+12,@EGG,530,1,1,-4108.31,3123.66,357.633,-0.680679,180),
+(@guid+13,@EGG,530,1,1,-4110.19,3122.64,358.083,-0.034907,180),
+(@guid+14,@EGG,530,1,1,-3996.89,3142.12,372.729,3.05433,180),
+(@guid+15,@EGG,530,1,1,-4109.06,3019.1,352.24,0.261799,180),
+(@guid+16,@EGG,530,1,1,-4018.35,3076.7,375.29,-0.733038,180),
+(@guid+17,@EGG,530,1,1,-4184.98,3044.71,352.394,1.81514,180),
+(@guid+18,@EGG,530,1,1,-4187.52,3040.39,352.071,-0.017453,180),
+(@guid+19,@EGG,530,1,1,-4189.67,3039.9,352.247,-0.785398,180),
+(@guid+20,@EGG,530,1,1,-4192.61,3045.1,352.096,3.14159,180),
+(@guid+21,@EGG,530,1,1,-4192.02,3046.91,352.297,2.46091,180),
+(@guid+22,@EGG,530,1,1,-4186.47,3047.19,352.316,2.60054,180),
+(@guid+23,@EGG,530,1,1,-3915.67,2983.4,396.957,-1.91986,180),
+(@guid+24,@EGG,530,1,1,-3883.21,3004.11,399.738,-1.64061,180),
+(@guid+25,@EGG,530,1,1,-3883.26,3001.55,399.431,-2.3911,180),
+(@guid+26,@EGG,530,1,1,-3884.29,3003.3,400.063,-1.88496,180),
+(@guid+27,@EGG,530,1,1,-3903.02,3095.85,383.783,-2.28638,180),
+(@guid+28,@EGG,530,1,1,-3898.45,3093.06,383.667,2.53073,180),
+(@guid+29,@EGG,530,1,1,-3900.75,3100.75,383.795,-0.436333,180),
+(@guid+30,@EGG,530,1,1,-4107.81,3023.42,352.142,1.06465,180),
+(@guid+31,@EGG,530,1,1,-4113.58,3022.4,352.157,-0.645772,180),
+(@guid+32,@EGG,530,1,1,-3893.09,3677.17,374.516,-1.23918,180),
+(@guid+33,@EGG,530,1,1,-3892.47,3674,374.478,-2.14675,180),
+(@guid+34,@EGG,530,1,1,-4198.53,3168.91,355.847,-0.383972,180),
+(@guid+35,@EGG,530,1,1,-4197.01,3170.04,356.117,-1.15192,180),
+(@guid+36,@EGG,530,1,1,-4196.54,3167.69,356.348,-0.541052,180),
+(@guid+37,@EGG,530,1,1,-4020.07,3077.84,374.391,1.53589,180),
+(@guid+38,@EGG,530,1,1,-4019.32,3079.74,375.109,-1.25664,180),
+(@guid+39,@EGG,530,1,1,-3917.21,2981.62,396.483,0.733038,180),
+(@guid+40,@EGG,530,1,1,-3918.45,2982.44,397.24,-1.72788,180),
+(@guid+41,@EGG,530,1,1,-3839.35,3344.85,337.834,2.75762,180),
+(@guid+42,@EGG,530,1,1,-3835.3,3344.77,338.155,-0.767945,180),
+(@guid+43,@EGG,530,1,1,-3846.43,3430.29,363.729,0.488692,180),
+(@guid+44,@EGG,530,1,1,-3864.13,3439.06,363.679,-0.05236,180),
+(@guid+45,@EGG,530,1,1,-3863.24,3440.42,363.655,0.349066,180),
+(@guid+46,@EGG,530,1,1,-3846.35,3439.34,363.628,-0.122173,180),
+(@guid+47,@EGG,530,1,1,-3847.32,3441.39,363.648,0.453786,180),
+(@guid+48,@EGG,530,1,1,-3686.21,3301,320.513,0.837758,180),
+(@guid+49,@EGG,530,1,1,-3687.77,3299.85,320.307,2.75762,180),
+(@guid+50,@EGG,530,1,1,-3692.64,3302.07,320.396,-0.226893,180),
+(@guid+51,@EGG,530,1,1,-3661.91,3379.15,320.377,0.890118,180),
+(@guid+52,@EGG,530,1,1,-3660.65,3381.9,320.182,1.18682,180),
+(@guid+53,@EGG,530,1,1,-3665.48,3380.11,320.365,-0.471239,180),
+(@guid+54,@EGG,530,1,1,-3685.07,3305.97,320.198,-2.87979,180),
+(@guid+55,@EGG,530,1,1,-3688.3,3308.93,320.337,1.65806,180),
+(@guid+56,@EGG,530,1,1,-3690.65,3306.77,320.43,-2.79253,180),
+(@guid+57,@EGG,530,1,1,-3879.37,3665.22,374.393,-2.30383,180),
+(@guid+58,@EGG,530,1,1,-3990.42,3139.13,372.878,-2.61799,180),
+(@guid+59,@EGG,530,1,1,-3991.59,3134.33,372.703,-0.017453,180),
+(@guid+60,@EGG,530,1,1,-3884.89,3684.98,374.492,-2.53073,180),
+(@guid+61,@EGG,530,1,1,-3800.8,3789.62,314,6.0912,180),
+(@guid+62,@EGG,530,1,1,-3799.02,3788.06,314.158,3.19395,180),
+(@guid+63,@EGG,530,1,1,-3798.91,3790.61,313.852,3.63029,180);
diff --git a/sql/old/3.3.5a/2012_09_13_01_world_ogrila.sql b/sql/old/3.3.5a/2012_09_13_01_world_ogrila.sql
new file mode 100644
index 00000000000..4ccb02e02e5
--- /dev/null
+++ b/sql/old/3.3.5a/2012_09_13_01_world_ogrila.sql
@@ -0,0 +1,158 @@
+-- Quest support for http://www.wowhead.com/quest=11010 "Bombing Run", http://www.wowhead.com/quest=11102 "Bombing Run" /druid/ and http://www.wowhead.com/quest=11023 "Bomb Them Again!"
+-- Achievement support for http://www.wowhead.com/achievement=1282 and http://www.wowhead.com/achievement=1276,
+-- Based on Warpten Script
+SET @SKYGUARD_BOMB := 32456;
+SET @Run_Dummy := 23118;
+SET @Explosion_Bunny := 23119;
+SET @Flak_Cannon := 23076;
+SET @Flak_Cannon2 := 23082;
+SET @Fel_Cannon_Dummy := 23077;
+SET @RUN_MARK := 40196;
+SET @THROW_BOMB := 40160;
+SET @EXPLOSION_VISUAL := 40162;
+SET @See_Invisibility := 40195;
+SET @Invisibility := 40194;
+SET @CANNONBALL_STACK := 185861;
+-- Add class requirements for druid version of "Bombing Run"
+UPDATE `quest_template` SET `RequiredClasses`=1024 WHERE `Id`=11102;
+-- Add SAI support for Bombing Run Target Dummy
+UPDATE `creature_template` SET `AIName`='SmartAI',`flags_extra`=`flags_extra`|128 WHERE `entry`=@Run_Dummy;
+DELETE FROM `creature_ai_scripts` WHERE `creature_id`=@Run_Dummy;
+DELETE FROM `smart_scripts` WHERE `source_type`=0 AND `entryorguid`=@Run_Dummy;
+DELETE FROM `smart_scripts` WHERE `source_type`=9 AND `entryorguid`=@Run_Dummy*100;
+INSERT INTO `smart_scripts` (`entryorguid`,`source_type`,`id`,`link`,`event_type`,`event_phase_mask`,`event_chance`,`event_flags`,`event_param1`,`event_param2`,`event_param3`,`event_param4`,`action_type`,`action_param1`,`action_param2`,`action_param3`,`action_param4`,`action_param5`,`action_param6`,`target_type`,`target_param1`,`target_param2`,`target_param3`,`target_x`,`target_y`,`target_z`,`target_o`,`comment`) VALUES
+(@Run_Dummy,0,0,1,8,0,100,0,@THROW_BOMB,0,1000,1000,33,@Run_Dummy,0,0,0,0,0,16,0,0,0,0,0,0,0, 'Run Target Dummy - On spell Throw Bomb hit - Give kill credit to invoker party'),
+(@Run_Dummy,0,1,2,61,0,100,0,0,0,0,0,28,@RUN_MARK,0,0,0,0,0,1,0,0,0,0,0,0,0, 'Run Target Dummy - Linked with previous event - Remove auras from hunter mark'),
+(@Run_Dummy,0,2,3,61,0,100,0,0,0,0,0,45,0,1,0,0,0,0,20,@CANNONBALL_STACK,3,0,0,0,0,0, 'Run Target Dummy - Linked with previous event - Data set 0 1 on Cannonball Stack'),
+(@Run_Dummy,0,3,4,61,0,100,0,0,0,0,0,45,0,1,0,0,0,0,19,@Explosion_Bunny,3,0,0,0,0,0, 'Run Target Dummy - Linked with previous event - Data set 0 1 on Explosion Bunny'),
+(@Run_Dummy,0,4,0,61,0,100,0,0,0,0,0,80,@Run_Dummy*100,0,0,0,0,0,1,0,0,0,0,0,0,0, 'Run Target Dummy - Linked with previous event - Start script 0'),
+(@Run_Dummy*100,9,0,0,0,0,100,0,29000,29000,0,0,11,@RUN_MARK,0,0,0,0,0,1,0,0,0,0,0,0,0, 'Run Target Dummy - Action 0 - Cast run mark on self');
+-- Add SAI for Cannonball Stack
+UPDATE `gameobject_template` SET `AIName`='SmartGameObjectAI' WHERE `entry`=@CANNONBALL_STACK;
+DELETE FROM `smart_scripts` WHERE `source_type`=1 AND `entryorguid`=@CANNONBALL_STACK;
+INSERT INTO `smart_scripts` (`entryorguid`,`source_type`,`id`,`link`,`event_type`,`event_phase_mask`,`event_chance`,`event_flags`,`event_param1`,`event_param2`,`event_param3`,`event_param4`,`action_type`,`action_param1`,`action_param2`,`action_param3`,`action_param4`,`action_param5`,`action_param6`,`target_type`,`target_param1`,`target_param2`,`target_param3`,`target_x`,`target_y`,`target_z`,`target_o`,`comment`) VALUES
+(@CANNONBALL_STACK,1,0,0,38,0,100,0,0,1,0,0,70,30,0,0,0,0,0,1,0,0,0,0,0,0,0,' Cannonball Stack - On data set 0 1 - Respawn object /make it reappear after 30 secs/');
+-- Add SAI support for Bombing Run Fel Cannon Dummy
+UPDATE `creature_template` SET `AIName`='SmartAI',`unit_flags`=4,`flags_extra`=`flags_extra`|128 WHERE `entry`=@Fel_Cannon_Dummy;
+DELETE FROM `smart_scripts` WHERE `source_type`=0 AND `entryorguid`=@Fel_Cannon_Dummy;
+INSERT INTO `smart_scripts` (`entryorguid`,`source_type`,`id`,`link`,`event_type`,`event_phase_mask`,`event_chance`,`event_flags`,`event_param1`,`event_param2`,`event_param3`,`event_param4`,`action_type`,`action_param1`,`action_param2`,`action_param3`,`action_param4`,`action_param5`,`action_param6`,`target_type`,`target_param1`,`target_param2`,`target_param3`,`target_x`,`target_y`,`target_z`,`target_o`,`comment`) VALUES
+(@Fel_Cannon_Dummy,0,0,0,8,0,100,0,40110,0,4350,5000,11,40119,0,0,0,0,0,19,@Flak_Cannon,5,0,0,0,0,0, 'Fel Cannon Dummy - On spell hit by Cannon trigger - Cast Aggro Burst on Flak Cannon');
+-- Add SAI support for Bombing Run Flak Cannon
+UPDATE `creature_template` SET `AIName`='SmartAI',`unit_flags`=`unit_flags`|4|256|131072,`flags_extra`=`flags_extra`|2 WHERE `entry`=@Flak_Cannon;
+DELETE FROM `smart_scripts` WHERE `source_type`=0 AND `entryorguid`=@Flak_Cannon;
+INSERT INTO `smart_scripts` (`entryorguid`,`source_type`,`id`,`link`,`event_type`,`event_phase_mask`,`event_chance`,`event_flags`,`event_param1`,`event_param2`,`event_param3`,`event_param4`,`action_type`,`action_param1`,`action_param2`,`action_param3`,`action_param4`,`action_param5`,`action_param6`,`target_type`,`target_param1`,`target_param2`,`target_param3`,`target_x`,`target_y`,`target_z`,`target_o`,`comment`) VALUES
+(@Flak_Cannon,0,0,0,25,0,100,0,0,0,0,0,11,40111,0,0,0,0,0,1,0,0,0,0,0,0,0, 'Flak Cannon - On reset - Cast The Aggro Bunnies'),
+(@Flak_Cannon,0,1,2,8,0,100,0,41598,0,0,0,66,0,0,0,0,0,0,7,0,0,0,0,0,0,0, 'Flak Cannon - On hit by Bolt Pair - Set orientation to invoker'),
+(@Flak_Cannon,0,2,0,61,0,100,0,0,0,0,0,11,40109,0,0,0,0,0,7,0,0,0,0,0,0,0, 'Flak Cannon - Linked with previous event - Cast spell The Bolt');
+-- Add SAI support for Bombing Run Flak Cannon 2 /target bunny/
+UPDATE `creature_template` SET `AIName`='SmartAI',`flags_extra`=`flags_extra`|128,`InhabitType`=4 WHERE `entry`=@Flak_Cannon2;
+DELETE FROM `smart_scripts` WHERE `source_type`=0 AND `entryorguid`=@Flak_Cannon2;
+INSERT INTO `smart_scripts` (`entryorguid`,`source_type`,`id`,`link`,`event_type`,`event_phase_mask`,`event_chance`,`event_flags`,`event_param1`,`event_param2`,`event_param3`,`event_param4`,`action_type`,`action_param1`,`action_param2`,`action_param3`,`action_param4`,`action_param5`,`action_param6`,`target_type`,`target_param1`,`target_param2`,`target_param3`,`target_x`,`target_y`,`target_z`,`target_o`,`comment`) VALUES
+(@Flak_Cannon2,0,0,0,54,0,100,0,0,0,0,0,11,41598,0,0,0,0,0,7,0,0,0,0,0,0,0, 'Flak Cannon 2 - On just summoned - Cast The Bolt Pair on invoker'),
+(@Flak_Cannon2,0,1,2,8,0,100,0,40109,0,0,0,11,40075,0,0,0,0,0,1,0,0,0,0,0,0,0, 'Flak Cannon 2 - On spell hit Cannon Bolt - Cast on self Fel Flak Fire'),
+(@Flak_Cannon2,0,2,0,61,0,100,0,0,0,0,0,41,5000,0,0,0,0,0,1,0,0,0,0,0,0,0, 'Flak Cannon 2 - Linked with previous event - Despawn in 5 sec');
+-- Add SAI support for Explosion Bunny
+UPDATE `creature_template` SET `AIName`='SmartAI',`flags_extra`=`flags_extra`|128,`unit_flags`=0 WHERE `entry`=@Explosion_Bunny;
+DELETE FROM `smart_scripts` WHERE `source_type`=0 AND `entryorguid`=@Explosion_Bunny;
+INSERT INTO `smart_scripts` (`entryorguid`,`source_type`,`id`,`link`,`event_type`,`event_phase_mask`,`event_chance`,`event_flags`,`event_param1`,`event_param2`,`event_param3`,`event_param4`,`action_type`,`action_param1`,`action_param2`,`action_param3`,`action_param4`,`action_param5`,`action_param6`,`target_type`,`target_param1`,`target_param2`,`target_param3`,`target_x`,`target_y`,`target_z`,`target_o`,`comment`) VALUES
+(@Explosion_Bunny,0,0,0,38,0,100,0,0,1,0,0,11,@EXPLOSION_VISUAL,0,0,0,0,0,1,0,0,0,0,0,0,0, 'Explosion Bunny - On data set 0 1 - Cast Explosion Visual on self');
+-- Add conditions
+DELETE FROM `conditions` WHERE `SourceTypeOrReferenceId`=13 AND `SourceEntry` IN (@THROW_BOMB,40110,40112,40075);
+DELETE FROM `conditions` WHERE `SourceTypeOrReferenceId`=17 AND `SourceEntry` IN (@THROW_BOMB,40200,41598,40111);
+DELETE FROM `conditions` WHERE `SourceTypeOrReferenceId`=22 AND `SourceEntry`=@Fel_Cannon_Dummy;
+INSERT INTO `conditions` (`SourceTypeOrReferenceId`,`SourceGroup`,`SourceEntry`,`ElseGroup`,`ConditionTypeOrReference`,`ConditionTarget`,`ConditionValue1`,`ConditionValue2`,`ConditionValue3`,`NegativeCondition`,`ErrorTextId`,`Comment`) VALUES
+(17,0,@THROW_BOMB,0,29,0,@Run_Dummy,35,0,0,0,'Throw Bomb requires Run Target Dummy within 35y'),
+(13,1,@THROW_BOMB,0,31,0,3,@Run_Dummy,0,0,0,'Throw Bomb implicit effect 0 can hit only Run Target Dummy'),
+(13,1,@THROW_BOMB,0,1,0,@RUN_MARK,0,0,0,0,'Throw Bomb can hit only targets under the aura of 40196'),
+(17,0,40200,0,9,0,11010,0,0,1,0,'To cast remove see invisibility player must not be on quest 11010'),
+(17,0,40200,0,9,0,11102,0,0,1,0,'To cast remove see invisibility player must not be on quest 11102'),
+(17,0,40200,0,9,0,11023,0,0,1,0,'To cast remove see invisibility player must not be on quest 11023'),
+(13,1,40110,0,31,0,3,23077,0,0,0,'Cannon Trigger implicit targets can be only Fel Cannon Dummies'),
+(13,1,40110,0,35,0,1,65,2,0,0,'Cannon Trigger implicit hit can happen only on targets under 65 yards range'),
+(17,0,40111,0,29,0,@Fel_Cannon_Dummy,10,0,1,0,'The Aggro Bunnies caster should not be around Fel Cannon Dummies to cast'),
+(13,1,40112,0,31,0,4,0,0,0,0,'Bombing Run Dummy aggro check can hit players'),
+(13,3,40075,0,31,0,4,0,0,0,0,'Fel Flak Fire effect 2 can hit only players'),
+(22,1,@Fel_Cannon_Dummy,0,1,1,40119,0,0,1,0,'Fel Cannon Dummy event 0 will happen only if target is missing aura from aggro burst');
+-- Insert addon data
+DELETE FROM `creature_template_addon` WHERE `entry` IN (@Run_Dummy,@Explosion_Bunny,@Fel_Cannon_Dummy);
+INSERT INTO `creature_template_addon` (`entry`,`mount`,`bytes1`,`bytes2`,`emote`,`auras`) VALUES
+(@Run_Dummy,0,0,0,0,'40196 40194 40195'), -- Mark, See Invisibility, Invisibility
+(@Explosion_Bunny,0,0,0,0,'40194 40195'), -- See Invisibility, Invisibility
+(@Fel_Cannon_Dummy,0,0,0,0,'40113'); -- The Aggro Check Aura
+-- Remove achievement from disabled
+DELETE FROM `disables` WHERE `sourceType`=4 AND `entry`=3923;
+-- Add missing spell from dbc
+DELETE FROM `spell_dbc` WHERE `Id`=40200;
+INSERT INTO `spell_dbc` (`Id`,`Dispel`,`Mechanic`,`Attributes`,`AttributesEx`,`AttributesEx2`,`AttributesEx3`,`AttributesEx4`,`AttributesEx5`,`AttributesEx6`,`AttributesEx7`,`Stances`,`StancesNot`,`Targets`,`CastingTimeIndex`,`AuraInterruptFlags`,`ProcFlags`,`ProcChance`,`ProcCharges`,`MaxLevel`,`BaseLevel`,`SpellLevel`,`DurationIndex`,`RangeIndex`,`StackAmount`,`EquippedItemClass`,`EquippedItemSubClassMask`,`EquippedItemInventoryTypeMask`,`Effect1`,`Effect2`,`Effect3`,`EffectDieSides1`,`EffectDieSides2`,`EffectDieSides3`,`EffectRealPointsPerLevel1`,`EffectRealPointsPerLevel2`,`EffectRealPointsPerLevel3`,`EffectBasePoints1`,`EffectBasePoints2`,`EffectBasePoints3`,`EffectMechanic1`,`EffectMechanic2`,`EffectMechanic3`,`EffectImplicitTargetA1`,`EffectImplicitTargetA2`,`EffectImplicitTargetA3`,`EffectImplicitTargetB1`,`EffectImplicitTargetB2`,`EffectImplicitTargetB3`,`EffectRadiusIndex1`,`EffectRadiusIndex2`,`EffectRadiusIndex3`,`EffectApplyAuraName1`,`EffectApplyAuraName2`,`EffectApplyAuraName3`,`EffectAmplitude1`,`EffectAmplitude2`,`EffectAmplitude3`,`EffectMultipleValue1`,`EffectMultipleValue2`,`EffectMultipleValue3`,`EffectMiscValue1`,`EffectMiscValue2`,`EffectMiscValue3`,`EffectMiscValueB1`,`EffectMiscValueB2`,`EffectMiscValueB3`,`EffectTriggerSpell1`,`EffectTriggerSpell2`,`EffectTriggerSpell3`,`EffectSpellClassMaskA1`,`EffectSpellClassMaskA2`,`EffectSpellClassMaskA3`,`EffectSpellClassMaskB1`,`EffectSpellClassMaskB2`,`EffectSpellClassMaskB3`,`EffectSpellClassMaskC1`,`EffectSpellClassMaskC2`,`EffectSpellClassMaskC3`,`MaxTargetLevel`,`SpellFamilyName`,`SpellFamilyFlags1`,`SpellFamilyFlags2`,`SpellFamilyFlags3`,`MaxAffectedTargets`,`DmgClass`,`PreventionType`,`DmgMultiplier1`,`DmgMultiplier2`,`DmgMultiplier3`,`AreaGroupId`,`SchoolMask`,`Comment`) VALUES
+(40200,0,0,256,0,0,0,0,0,0,0,0,0,0,1,0,0,101,0,0,0,0,26,1,0,-1,0,0,164,0,0,0,0,0,0,0,0,0,0,0,0,0,0,18,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,40195,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,'Bombing Run: See Invisibility Aura Remover');
+-- Spell area - Check to cast remove aura /against see invisibility aura/, if having it and not on quest
+DELETE FROM `spell_area` WHERE `spell`=40200;
+INSERT INTO `spell_area` (`spell`,`area`,`quest_start`,`quest_start_active`,`quest_end`,`aura_spell`,`racemask`,`gender`,`autocast`) VALUES
+(40200,3522,0,0,0,@See_Invisibility,0,2,1);
+-- Insert cannonballs spawns /based on sniffs/
+SET @guid := 14811;
+DELETE FROM `gameobject` WHERE `guid` BETWEEN @guid+0 AND @guid+13;
+INSERT INTO `gameobject` (`guid`,`id`,`map`,`spawnMask`,`phaseMask`,`position_x`,`position_y`,`position_z`,`orientation`,`rotation0`,`rotation1`,`rotation2`,`rotation3`,`spawntimesecs`,`animprogress`,`state`) VALUES
+(@guid+0,@CANNONBALL_STACK,530,1,1,2825.11,7024.05,369.982,5.69617,0,0,0.289313,-0.957235,300,0,1),
+(@guid+1,@CANNONBALL_STACK,530,1,1,2938.26,7094.72,369.413,2.78314,0,0,0.983982,0.178267,300,0,1),
+(@guid+2,@CANNONBALL_STACK,530,1,1,2924.84,7031.46,367.857,4.26205,0,0,0.847134,-0.53138,300,0,1),
+(@guid+3,@CANNONBALL_STACK,530,1,1,2938.02,7015.59,365.75,3.65778,0,0,0.966879,-0.255237,300,0,1),
+(@guid+4,@CANNONBALL_STACK,530,1,1,2998.57,7043.55,368.539,5.91266,0,0,0.184206,-0.982888,300,0,1),
+(@guid+5,@CANNONBALL_STACK,530,1,1,2982,7054.94,368.32,4.99766,0,0,0.599411,-0.800442,300,0,1),
+(@guid+6,@CANNONBALL_STACK,530,1,1,2978.73,6889.19,369.701,0.689745,0,0,0.338077,0.941119,300,0,1),
+(@guid+7,@CANNONBALL_STACK,530,1,1,2941.56,6827.17,367.3,4.08109,0,0,0.891683,-0.452661,300,0,1),
+(@guid+8,@CANNONBALL_STACK,530,1,1,2953.55,6859.3,369.954,6.14433,0,0,0.0693712,-0.997591,300,0,1),
+(@guid+9,@CANNONBALL_STACK,530,1,1,3023.13,6799.74,374.46,1.58666,0,0,0.712695,0.701474,300,0,1),
+(@guid+10,@CANNONBALL_STACK,530,1,1,3028.3,6824.84,373.591,5.0275,0,0,0.587401,-0.809296,300,0,1),
+(@guid+11,@CANNONBALL_STACK,530,1,1,3022.15,6859.05,369.546,3.44885,0,0,0.988222,-0.153025,300,0,1),
+(@guid+12,@CANNONBALL_STACK,530,1,1,3016.28,6876.11,370.188,3.47791,0,0,0.985895,-0.167365,300,0,1),
+(@guid+13,@CANNONBALL_STACK,530,1,1,2940.6,7106.65,370.123,0.88561,0,0,0.428475,0.903553,300,0,1);
+-- Insert spawns for Fel Flak Cannons, Run Target Dummies and Explosion Bunnies /based on sniffs/
+SET @guid := 85656;
+DELETE FROM `creature` WHERE `guid` BETWEEN @guid+0 AND @guid+44;
+INSERT INTO `creature` (`guid`,`id`,`map`,`spawnMask`,`phaseMask`,`modelid`,`equipment_id`,`position_x`,`position_y`,`position_z`,`orientation`,`spawntimesecs`,`spawndist`,`currentwaypoint`,`curhealth`,`curmana`,`MovementType`,`npcflag`,`unit_flags`,`dynamicflags`) VALUES
+(@guid+0,23118,530,1,1,0,0,2764.71,7024.45,370.203,0,300,0,0,42,0,0,0,33554432,0),
+(@guid+1,23119,530,1,1,0,0,2764.71,7024.45,370.203,0,300,0,0,6986,0,0,0,33554432,0),
+(@guid+2,23118,530,1,1,0,0,2786.61,7036.28,370.686,0,300,0,0,42,0,0,0,33554432,0),
+(@guid+3,23119,530,1,1,0,0,2786.61,7036.28,370.686,0,300,0,0,6986,0,0,0,33554432,0),
+(@guid+4,23118,530,1,1,0,0,2824.71,7044.79,369.877,0,300,0,0,42,0,0,0,33554432,0),
+(@guid+5,23119,530,1,1,0,0,2824.71,7044.79,369.877,0,300,0,0,6986,0,0,0,33554432,0),
+(@guid+6,23076,530,1,1,0,0,2775.81,7030.75,370.337,1.85606,300,0,0,22140,0,0,0,0,0),
+(@guid+7,23076,530,1,1,0,0,2933.28,7103.93,369.209,2.58129,300,0,0,21543,0,0,0,0,0),
+(@guid+8,23119,530,1,1,0,0,2940.82,7107.17,370.115,4.65944,300,0,0,6986,0,0,0,33554432,0),
+(@guid+9,23118,530,1,1,0,0,2940.82,7107.17,370.115,4.65944,300,0,0,42,0,0,0,33554432,0),
+(@guid+10,23118,530,1,1,0,0,2825.11,7024.05,369.982,5.69617,300,0,0,42,0,0,0,33554432,0),
+(@guid+11,23119,530,1,1,0,0,2825.11,7024.05,369.982,5.69617,300,0,0,6986,0,0,0,33554432,0),
+(@guid+12,23076,530,1,1,0,0,2834.14,7018.43,368.459,5.42992,300,0,0,21543,0,0,0,0,0),
+(@guid+13,23119,530,1,1,0,0,2938.84,7094.48,371.493,0.242375,300,0,0,6986,0,0,0,33554432,0),
+(@guid+14,23118,530,1,1,0,0,2938.84,7094.48,371.493,0.242375,300,0,0,42,0,0,0,33554432,0),
+(@guid+15,23076,530,1,1,0,0,2925.49,7021.72,367.007,3.59446,300,0,0,22140,0,0,0,0,0),
+(@guid+16,23119,530,1,1,0,0,2924.84,7031.46,367.857,4.26205,300,0,0,6986,0,0,0,33554432,0),
+(@guid+17,23118,530,1,1,0,0,2924.84,7031.46,367.857,4.26205,300,0,0,42,0,0,0,33554432,0),
+(@guid+18,23119,530,1,1,0,0,2938.02,7015.59,366.54,3.65778,300,0,0,6986,0,0,0,33554432,0),
+(@guid+19,23118,530,1,1,0,0,2938.02,7015.59,366.54,3.65778,300,0,0,42,0,0,0,33554432,0),
+(@guid+20,23076,530,1,1,0,0,2994.48,7039.91,369.42,5.26077,300,0,0,22140,0,0,0,0,0),
+(@guid+21,23119,530,1,1,0,0,2998.57,7043.55,368.539,5.91266,300,0,0,6986,0,0,0,33554432,0),
+(@guid+22,23118,530,1,1,0,0,2998.57,7043.55,368.539,5.91266,300,0,0,42,0,0,0,33554432,0),
+(@guid+23,23119,530,1,1,0,0,2982,7054.94,368.82,4.99766,300,0,0,6986,0,0,0,33554432,0),
+(@guid+24,23118,530,1,1,0,0,2982,7054.94,368.82,4.99766,300,0,0,42,0,0,0,33554432,0),
+(@guid+25,23076,530,1,1,0,0,2982.59,6886.5,370.082,0.831123,300,0,0,22140,0,0,0,0,0),
+(@guid+26,23118,530,1,1,0,0,2978.74,6889.12,371.288,0.897875,300,0,0,42,0,0,0,33554432,0),
+(@guid+27,23119,530,1,1,0,0,2978.74,6889.12,371.288,0.897875,300,0,0,6986,0,0,0,33554432,0),
+(@guid+28,23118,530,1,1,0,0,2941.56,6827.17,367.3,4.54054,300,0,0,42,0,0,0,33554432,0),
+(@guid+29,23119,530,1,1,0,0,2941.56,6827.17,367.3,4.54054,300,0,0,6986,0,0,0,33554432,0),
+(@guid+30,23076,530,1,1,0,0,2938.19,6818.01,366.959,3.31926,300,0,0,21543,0,0,0,0,0),
+(@guid+31,23076,530,1,1,0,0,2946.3,6875.71,370.04,3.2148,300,0,0,22140,0,0,0,0,0),
+(@guid+32,23118,530,1,1,0,0,2953.55,6859.3,369.954,6.14433,300,0,0,42,0,0,0,33554432,0),
+(@guid+33,23119,530,1,1,0,0,2953.55,6859.3,369.954,6.14433,300,0,0,6986,0,0,0,33554432,0),
+(@guid+34,23119,530,1,1,0,0,3023.13,6799.74,374.46,1.58666,300,0,0,6986,0,0,0,33554432,0),
+(@guid+35,23118,530,1,1,0,0,3023.13,6799.74,374.46,1.58666,300,0,0,42,0,0,0,33554432,0),
+(@guid+36,23076,530,1,1,0,0,3028.22,6807.09,374.075,5.94641,300,0,0,22140,0,0,0,0,0),
+(@guid+37,23118,530,1,1,0,0,3028.3,6824.84,373.591,5.0275,300,0,0,42,0,0,0,33554432,0),
+(@guid+38,23119,530,1,1,0,0,3028.3,6824.84,373.591,5.0275,300,0,0,6986,0,0,0,33554432,0),
+(@guid+39,23119,530,1,1,0,0,3022.15,6859.05,369.546,3.44885,300,0,0,6986,0,0,0,33554432,0),
+(@guid+40,23118,530,1,1,0,0,3022.15,6859.05,369.546,3.44885,300,0,0,42,0,0,0,33554432,0),
+(@guid+41,23076,530,1,1,0,0,3022.21,6864.61,369.93,0.100696,300,0,0,22140,0,0,0,0,0),
+(@guid+42,23118,530,1,1,0,0,3016.28,6876.11,370.188,3.47791,300,0,0,42,0,0,0,33554432,0),
+(@guid+43,23119,530,1,1,0,0,3016.28,6876.11,370.188,3.47791,300,0,0,6986,0,0,0,33554432,0),
+(@guid+44,23076,530,1,1,0,0,2816.74,7057.61,369.779,1.4555,300,0,0,21543,0,0,0,0,0);
diff --git a/sql/old/3.3.5a/2012_09_13_01_world_spell_script_name.sql b/sql/old/3.3.5a/2012_09_13_01_world_spell_script_name.sql
new file mode 100644
index 00000000000..61e4067c544
--- /dev/null
+++ b/sql/old/3.3.5a/2012_09_13_01_world_spell_script_name.sql
@@ -0,0 +1,14 @@
+-- Add spell script name for Fires Over Skettis and Bombing Run quests
+DELETE FROM `spell_script_names` WHERE `spell_id`=40113;
+DELETE FROM `spell_script_names` WHERE `spell_id`=40160;
+DELETE FROM `spell_script_names` WHERE `spell_id`=39844;
+DELETE FROM `spell_script_names` WHERE `spell_id`=40056;
+DELETE FROM `spell_script_names` WHERE `spell_id`=40112;
+DELETE FROM `spell_script_names` WHERE `spell_id`=40119;
+INSERT INTO `spell_script_names` VALUES
+(39844,'spell_q11010_q11102_q11023_q11008_check_fly_mount'),
+(40160,'spell_q11010_q11102_q11023_q11008_check_fly_mount'),
+(40113,'spell_q11010_q11102_q11023_aggro_check_aura'),
+(40056,'spell_q11010_q11102_q11023_choose_loc'),
+(40112,'spell_q11010_q11102_q11023_aggro_check'),
+(40119,'spell_q11010_q11102_q11023_aggro_burst');
diff --git a/sql/old/3.3.5a/2012_09_13_01_world_spell_target_position.sql b/sql/old/3.3.5a/2012_09_13_01_world_spell_target_position.sql
new file mode 100644
index 00000000000..0879dbbbda0
--- /dev/null
+++ b/sql/old/3.3.5a/2012_09_13_01_world_spell_target_position.sql
@@ -0,0 +1,15 @@
+DELETE FROM `spell_target_position` WHERE `id` IN (60323,60324,60325,60326,60327,60328,60329,60330,60331,60332,60333,60334,60335);
+INSERT INTO `spell_target_position` (`id`, `target_map`, `target_position_x`, `target_position_y`, `target_position_z`, `target_orientation`) VALUES
+(60323,0,-5506.339,-704.348,392.686,0.595), -- Steelgrills Depot
+(60324,0,-9470.760,3.909,49.794,4.802), -- Lions Pride Inn, Goldshire
+(60325,1,-3721.306,-4411.906,25.247,0.831), -- Theramore isle, Dustwallow Marsh
+(60326,0,286.314,-2184.086,122.612,2.271), -- Aerie Peak, The Hinterlands
+(60327,1,6395.708,433.256,33.260,0.566), -- Auberdine, Darkshore
+(60328,0,-14412.923,692.017,22.248,1.231), -- Boote Bay
+(60329,1,-7135.717,-3787.769,8.799,5.992), -- Tanaris, Gadgetzan
+(60330,0,-10336.138,-2934.057,116.723,4.523), -- Swamp of Sorrows, Z coord is intended
+(60331,0,-10446.900,-3261.909,20.179,5.875), -- Stonard, Swamp of Sorrows
+(60332,0,-103.988,-902.795,55.534,5.924), -- Tarren Mill, Hillsbrad Foothils
+(60333,0,1804.836,196.322,70.399,1.572), -- Undercity
+(60334,1,-1060.266,23.137,141.455,5.967), -- Thunder Bluff
+(60335,1,-506.224,-2590.084,113.150,2.445); -- Barrens, The Crossroads
diff --git a/sql/old/3.3.5a/2012_09_13_02_world_trinity_string.sql b/sql/old/3.3.5a/2012_09_13_02_world_trinity_string.sql
new file mode 100644
index 00000000000..f7214ad127b
--- /dev/null
+++ b/sql/old/3.3.5a/2012_09_13_02_world_trinity_string.sql
@@ -0,0 +1,12 @@
+DELETE FROM `command` WHERE `name` = 'cheat status';
+INSERT INTO `command` (`name`, `security`, `help`) VALUES
+('cheat status', 2, 'Syntax: .cheat status \n\nShows the cheats you currently have enabled.');
+
+DELETE FROM `trinity_string` WHERE `entry` BETWEEN 357 AND 362;
+INSERT INTO `trinity_string` (`entry`, `content_default`) VALUES
+(357, 'Cheat Command Status:'),
+(358, 'Godmode: %s.'),
+(359, 'Casttime: %s.'),
+(360, 'Cooldown: %s.'),
+(361, 'Power: %s.'),
+(362, 'Waterwalk: %s.');
diff --git a/sql/old/3.3.5a/2012_09_14_00_world_creature_template.sql b/sql/old/3.3.5a/2012_09_14_00_world_creature_template.sql
new file mode 100644
index 00000000000..335b92e9af7
--- /dev/null
+++ b/sql/old/3.3.5a/2012_09_14_00_world_creature_template.sql
@@ -0,0 +1,287 @@
+UPDATE `creature_template` SET `lootid`=18604 WHERE `entry`=17400;
+UPDATE `creature_template` SET `lootid`=18605 WHERE `entry`=17401;
+UPDATE `creature_template` SET `lootid`=19884 WHERE `entry`=17816;
+UPDATE `creature_template` SET `lootid`=19885 WHERE `entry`=17957;
+UPDATE `creature_template` SET `lootid`=19886 WHERE `entry`=17958;
+UPDATE `creature_template` SET `lootid`=19887 WHERE `entry`=17961;
+UPDATE `creature_template` SET `lootid`=19888 WHERE `entry`=17938;
+UPDATE `creature_template` SET `lootid`=19889 WHERE `entry`=17959;
+UPDATE `creature_template` SET `lootid`=19890 WHERE `entry`=17960;
+UPDATE `creature_template` SET `lootid`=19891 WHERE `entry`=17940;
+UPDATE `creature_template` SET `lootid`=19892 WHERE `entry`=17817;
+UPDATE `creature_template` SET `lootid`=19902 WHERE `entry`=17963;
+UPDATE `creature_template` SET `lootid`=19903 WHERE `entry`=17962;
+UPDATE `creature_template` SET `lootid`=19904 WHERE `entry`=17964;
+UPDATE `creature_template` SET `lootid`=20164 WHERE `entry`=17723;
+UPDATE `creature_template` SET `lootid`=20173 WHERE `entry`=17731;
+UPDATE `creature_template` SET `lootid`=20174 WHERE `entry`=19632;
+UPDATE `creature_template` SET `lootid`=20175 WHERE `entry`=17732;
+UPDATE `creature_template` SET `lootid`=20177 WHERE `entry`=17730;
+UPDATE `creature_template` SET `lootid`=20179 WHERE `entry`=17771;
+UPDATE `creature_template` SET `lootid`=20180 WHERE `entry`=17729;
+UPDATE `creature_template` SET `lootid`=20181 WHERE `entry`=17728;
+UPDATE `creature_template` SET `lootid`=20185 WHERE `entry`=17724;
+UPDATE `creature_template` SET `lootid`=20187 WHERE `entry`=17734;
+UPDATE `creature_template` SET `lootid`=20188 WHERE `entry`=17725;
+UPDATE `creature_template` SET `lootid`=20190 WHERE `entry`=17871;
+UPDATE `creature_template` SET `lootid`=20191 WHERE `entry`=17726;
+UPDATE `creature_template` SET `lootid`=20192 WHERE `entry`=17727;
+UPDATE `creature_template` SET `lootid`=20193 WHERE `entry`=17735;
+UPDATE `creature_template` SET `lootid`=20255 WHERE `entry`=18311;
+UPDATE `creature_template` SET `lootid`=20256 WHERE `entry`=18331;
+UPDATE `creature_template` SET `lootid`=20257 WHERE `entry`=18317;
+UPDATE `creature_template` SET `lootid`=20258 WHERE `entry`=18309;
+UPDATE `creature_template` SET `lootid`=20259 WHERE `entry`=18313;
+UPDATE `creature_template` SET `lootid`=20260 WHERE `entry`=18312;
+UPDATE `creature_template` SET `lootid`=20261 WHERE `entry`=18315;
+UPDATE `creature_template` SET `lootid`=20263 WHERE `entry`=19306;
+UPDATE `creature_template` SET `lootid`=20264 WHERE `entry`=18314;
+UPDATE `creature_template` SET `lootid`=20265 WHERE `entry`=19307;
+UPDATE `creature_template` SET `lootid`=20298 WHERE `entry`=18524;
+UPDATE `creature_template` SET `lootid`=20299 WHERE `entry`=18497;
+UPDATE `creature_template` SET `lootid`=20300 WHERE `entry`=18702;
+UPDATE `creature_template` SET `lootid`=20301 WHERE `entry`=18493;
+UPDATE `creature_template` SET `lootid`=20302 WHERE `entry`=18495;
+UPDATE `creature_template` SET `lootid`=20309 WHERE `entry`=18503;
+UPDATE `creature_template` SET `lootid`=20310 WHERE `entry`=18557;
+UPDATE `creature_template` SET `lootid`=20311 WHERE `entry`=18556;
+UPDATE `creature_template` SET `lootid`=20312 WHERE `entry`=18558;
+UPDATE `creature_template` SET `lootid`=20313 WHERE `entry`=18559;
+UPDATE `creature_template` SET `lootid`=20315 WHERE `entry`=18521;
+UPDATE `creature_template` SET `lootid`=20320 WHERE `entry`=18500;
+UPDATE `creature_template` SET `lootid`=20321 WHERE `entry`=18498;
+UPDATE `creature_template` SET `lootid`=20322 WHERE `entry`=18499;
+UPDATE `creature_template` SET `lootid`=20323 WHERE `entry`=18501;
+UPDATE `creature_template` SET `lootid`=20525 WHERE `entry`=18934;
+UPDATE `creature_template` SET `lootid`=20526 WHERE `entry`=17820;
+UPDATE `creature_template` SET `lootid`=20527 WHERE `entry`=17819;
+UPDATE `creature_template` SET `lootid`=20528 WHERE `entry`=17840;
+UPDATE `creature_template` SET `lootid`=20529 WHERE `entry`=17860;
+UPDATE `creature_template` SET `lootid`=20530 WHERE `entry`=17833;
+UPDATE `creature_template` SET `lootid`=20532 WHERE `entry`=18171;
+UPDATE `creature_template` SET `lootid`=20533 WHERE `entry`=18172;
+UPDATE `creature_template` SET `lootid`=20534 WHERE `entry`=18170;
+UPDATE `creature_template` SET `lootid`=20537 WHERE `entry`=17815;
+UPDATE `creature_template` SET `lootid`=20538 WHERE `entry`=17814;
+UPDATE `creature_template` SET `lootid`=20543 WHERE `entry`=17846;
+UPDATE `creature_template` SET `lootid`=20545 WHERE `entry`=18092;
+UPDATE `creature_template` SET `lootid`=20546 WHERE `entry`=18094;
+UPDATE `creature_template` SET `lootid`=20547 WHERE `entry`=18093;
+UPDATE `creature_template` SET `lootid`=20620 WHERE `entry`=17721;
+UPDATE `creature_template` SET `lootid`=20621 WHERE `entry`=17800;
+UPDATE `creature_template` SET `lootid`=20622 WHERE `entry`=17803;
+UPDATE `creature_template` SET `lootid`=20623 WHERE `entry`=17801;
+UPDATE `creature_template` SET `lootid`=20624 WHERE `entry`=17805;
+UPDATE `creature_template` SET `lootid`=20625 WHERE `entry`=17722;
+UPDATE `creature_template` SET `lootid`=20626 WHERE `entry`=17802;
+UPDATE `creature_template` SET `lootid`=20627 WHERE `entry`=17917;
+UPDATE `creature_template` SET `lootid`=20628 WHERE `entry`=17799;
+UPDATE `creature_template` SET `lootid`=20638 WHERE `entry`=18633;
+UPDATE `creature_template` SET `lootid`=20639 WHERE `entry`=18636;
+UPDATE `creature_template` SET `lootid`=20640 WHERE `entry`=18631;
+UPDATE `creature_template` SET `lootid`=20641 WHERE `entry`=18635;
+UPDATE `creature_template` SET `lootid`=20642 WHERE `entry`=18632;
+UPDATE `creature_template` SET `lootid`=20643 WHERE `entry`=18641;
+UPDATE `creature_template` SET `lootid`=20644 WHERE `entry`=18830;
+UPDATE `creature_template` SET `lootid`=20645 WHERE `entry`=18794;
+UPDATE `creature_template` SET `lootid`=20646 WHERE `entry`=18637;
+UPDATE `creature_template` SET `lootid`=20647 WHERE `entry`=18639;
+UPDATE `creature_template` SET `lootid`=20648 WHERE `entry`=18634;
+UPDATE `creature_template` SET `lootid`=20649 WHERE `entry`=18640;
+UPDATE `creature_template` SET `lootid`=20650 WHERE `entry`=18638;
+UPDATE `creature_template` SET `lootid`=20651 WHERE `entry`=18642;
+UPDATE `creature_template` SET `lootid`=20652 WHERE `entry`=18796;
+UPDATE `creature_template` SET `lootid`=20655 WHERE `entry`=18663;
+UPDATE `creature_template` SET `lootid`=20656 WHERE `entry`=18848;
+UPDATE `creature_template` SET `lootid`=20660 WHERE `entry`=19208;
+UPDATE `creature_template` SET `lootid`=20661 WHERE `entry`=19209;
+UPDATE `creature_template` SET `lootid`=20686 WHERE `entry`=19429;
+UPDATE `creature_template` SET `lootid`=20688 WHERE `entry`=19428;
+UPDATE `creature_template` SET `lootid`=20691 WHERE `entry`=18327;
+UPDATE `creature_template` SET `lootid`=20692 WHERE `entry`=18323;
+UPDATE `creature_template` SET `lootid`=20693 WHERE `entry`=18318;
+UPDATE `creature_template` SET `lootid`=20694 WHERE `entry`=18328;
+UPDATE `creature_template` SET `lootid`=20695 WHERE `entry`=18325;
+UPDATE `creature_template` SET `lootid`=20696 WHERE `entry`=18322;
+UPDATE `creature_template` SET `lootid`=20697 WHERE `entry`=18319;
+UPDATE `creature_template` SET `lootid`=20698 WHERE `entry`=18320;
+UPDATE `creature_template` SET `lootid`=20699 WHERE `entry`=18326;
+UPDATE `creature_template` SET `lootid`=20701 WHERE `entry`=18321;
+UPDATE `creature_template` SET `lootid`=20993 WHERE `entry`=20923;
+UPDATE `creature_template` SET `lootid`=21522 WHERE `entry`=19510;
+UPDATE `creature_template` SET `lootid`=21523 WHERE `entry`=20990;
+UPDATE `creature_template` SET `lootid`=21524 WHERE `entry`=19167;
+UPDATE `creature_template` SET `lootid`=21527 WHERE `entry`=19231;
+UPDATE `creature_template` SET `lootid`=21528 WHERE `entry`=19712;
+UPDATE `creature_template` SET `lootid`=21531 WHERE `entry`=19716;
+UPDATE `creature_template` SET `lootid`=21532 WHERE `entry`=19713;
+UPDATE `creature_template` SET `lootid`=21539 WHERE `entry`=19168;
+UPDATE `creature_template` SET `lootid`=21540 WHERE `entry`=20988;
+UPDATE `creature_template` SET `lootid`=21541 WHERE `entry`=20059;
+UPDATE `creature_template` SET `lootid`=21542 WHERE `entry`=19735;
+UPDATE `creature_template` SET `lootid`=21543 WHERE `entry`=19166;
+UPDATE `creature_template` SET `lootid`=21585 WHERE `entry`=20857;
+UPDATE `creature_template` SET `lootid`=21586 WHERE `entry`=20869;
+UPDATE `creature_template` SET `lootid`=21587 WHERE `entry`=20859;
+UPDATE `creature_template` SET `lootid`=21588 WHERE `entry`=20911;
+UPDATE `creature_template` SET `lootid`=21589 WHERE `entry`=20905;
+UPDATE `creature_template` SET `lootid`=21591 WHERE `entry`=20867;
+UPDATE `creature_template` SET `lootid`=21593 WHERE `entry`=20868;
+UPDATE `creature_template` SET `lootid`=21594 WHERE `entry`=20880;
+UPDATE `creature_template` SET `lootid`=21595 WHERE `entry`=20879;
+UPDATE `creature_template` SET `lootid`=21596 WHERE `entry`=20896;
+UPDATE `creature_template` SET `lootid`=21597 WHERE `entry`=20897;
+UPDATE `creature_template` SET `lootid`=21598 WHERE `entry`=20898;
+UPDATE `creature_template` SET `lootid`=21601 WHERE `entry`=20912;
+UPDATE `creature_template` SET `lootid`=21604 WHERE `entry`=20875;
+UPDATE `creature_template` SET `lootid`=21605 WHERE `entry`=20873;
+UPDATE `creature_template` SET `lootid`=21606 WHERE `entry`=20906;
+UPDATE `creature_template` SET `lootid`=21607 WHERE `entry`=20865;
+UPDATE `creature_template` SET `lootid`=21608 WHERE `entry`=20864;
+UPDATE `creature_template` SET `lootid`=21610 WHERE `entry`=20901;
+UPDATE `creature_template` SET `lootid`=21611 WHERE `entry`=20902;
+UPDATE `creature_template` SET `lootid`=21613 WHERE `entry`=20882;
+UPDATE `creature_template` SET `lootid`=21614 WHERE `entry`=20866;
+UPDATE `creature_template` SET `lootid`=21615 WHERE `entry`=20883;
+UPDATE `creature_template` SET `lootid`=21616 WHERE `entry`=20909;
+UPDATE `creature_template` SET `lootid`=21617 WHERE `entry`=20908;
+UPDATE `creature_template` SET `lootid`=21618 WHERE `entry`=20910;
+UPDATE `creature_template` SET `lootid`=21619 WHERE `entry`=20881;
+UPDATE `creature_template` SET `lootid`=21621 WHERE `entry`=20900;
+UPDATE `creature_template` SET `lootid`=21842 WHERE `entry`=21126;
+UPDATE `creature_template` SET `lootid`=21843 WHERE `entry`=21127;
+UPDATE `creature_template` SET `lootid`=21914 WHERE `entry`=21694;
+UPDATE `creature_template` SET `lootid`=21916 WHERE `entry`=21696;
+UPDATE `creature_template` SET `lootid`=21917 WHERE `entry`=21695;
+UPDATE `creature_template` SET `lootid`=21989 WHERE `entry`=21891;
+UPDATE `creature_template` SET `lootid`=21990 WHERE `entry`=21904;
+UPDATE `creature_template` SET `lootid`=22129 WHERE `entry`=22128;
+UPDATE `creature_template` SET `lootid`=22162 WHERE `entry`=18983;
+UPDATE `creature_template` SET `lootid`=22163 WHERE `entry`=17952;
+UPDATE `creature_template` SET `lootid`=22173 WHERE `entry`=18982;
+UPDATE `creature_template` SET `lootid`=22346 WHERE `entry`=21702;
+UPDATE `creature_template` SET `lootid`=22530 WHERE `entry`=13536;
+UPDATE `creature_template` SET `lootid`=22532 WHERE `entry`=13539;
+UPDATE `creature_template` SET `lootid`=22533 WHERE `entry`=13424;
+UPDATE `creature_template` SET `lootid`=22534 WHERE `entry`=13542;
+UPDATE `creature_template` SET `lootid`=22535 WHERE `entry`=13554;
+UPDATE `creature_template` SET `lootid`=22536 WHERE `entry`=13545;
+UPDATE `creature_template` SET `lootid`=22537 WHERE `entry`=13557;
+UPDATE `creature_template` SET `lootid`=22538 WHERE `entry`=13425;
+UPDATE `creature_template` SET `lootid`=22539 WHERE `entry`=13155;
+UPDATE `creature_template` SET `lootid`=22543 WHERE `entry`=14770;
+UPDATE `creature_template` SET `lootid`=22547 WHERE `entry`=14768;
+UPDATE `creature_template` SET `lootid`=22550 WHERE `entry`=13378;
+UPDATE `creature_template` SET `lootid`=22555 WHERE `entry`=603;
+UPDATE `creature_template` SET `lootid`=22565 WHERE `entry`=13377;
+UPDATE `creature_template` SET `lootid`=22576 WHERE `entry`=13416;
+UPDATE `creature_template` SET `lootid`=22578 WHERE `entry`=13151;
+UPDATE `creature_template` SET `lootid`=22579 WHERE `entry`=14767;
+UPDATE `creature_template` SET `lootid`=22587 WHERE `entry`=13526;
+UPDATE `creature_template` SET `lootid`=22592 WHERE `entry`=13530;
+UPDATE `creature_template` SET `lootid`=22595 WHERE `entry`=14769;
+UPDATE `creature_template` SET `lootid`=22607 WHERE `entry`=13527;
+UPDATE `creature_template` SET `lootid`=22612 WHERE `entry`=13531;
+UPDATE `creature_template` SET `lootid`=22613 WHERE `entry`=13140;
+UPDATE `creature_template` SET `lootid`=22614 WHERE `entry`=13319;
+UPDATE `creature_template` SET `lootid`=22615 WHERE `entry`=13320;
+UPDATE `creature_template` SET `lootid`=22616 WHERE `entry`=13154;
+UPDATE `creature_template` SET `lootid`=22617 WHERE `entry`=13152;
+UPDATE `creature_template` SET `lootid`=22618 WHERE `entry`=13318;
+UPDATE `creature_template` SET `lootid`=22619 WHERE `entry`=13153;
+UPDATE `creature_template` SET `lootid`=22620 WHERE `entry`=13139;
+UPDATE `creature_template` SET `lootid`=22621 WHERE `entry`=13446;
+UPDATE `creature_template` SET `lootid`=22623 WHERE `entry`=13597;
+UPDATE `creature_template` SET `lootid`=22624 WHERE `entry`=13357;
+UPDATE `creature_template` SET `lootid`=22628 WHERE `entry`=13841;
+UPDATE `creature_template` SET `lootid`=22634 WHERE `entry`=13598;
+UPDATE `creature_template` SET `lootid`=22635 WHERE `entry`=13356;
+UPDATE `creature_template` SET `lootid`=22639 WHERE `entry`=13449;
+UPDATE `creature_template` SET `lootid`=22640 WHERE `entry`=13840;
+UPDATE `creature_template` SET `lootid`=22645 WHERE `entry`=12048;
+UPDATE `creature_template` SET `lootid`=22649 WHERE `entry`=12052;
+UPDATE `creature_template` SET `lootid`=22657 WHERE `entry`=12047;
+UPDATE `creature_template` SET `lootid`=22662 WHERE `entry`=13325;
+UPDATE `creature_template` SET `lootid`=22663 WHERE `entry`=13327;
+UPDATE `creature_template` SET `lootid`=22664 WHERE `entry`=13330;
+UPDATE `creature_template` SET `lootid`=22667 WHERE `entry`=13335;
+UPDATE `creature_template` SET `lootid`=22668 WHERE `entry`=13336;
+UPDATE `creature_template` SET `lootid`=22669 WHERE `entry`=13337;
+UPDATE `creature_template` SET `lootid`=22671 WHERE `entry`=13426;
+UPDATE `creature_template` SET `lootid`=22672 WHERE `entry`=13427;
+UPDATE `creature_template` SET `lootid`=22673 WHERE `entry`=13428;
+UPDATE `creature_template` SET `lootid`=22676 WHERE `entry`=13528;
+UPDATE `creature_template` SET `lootid`=22679 WHERE `entry`=13440;
+UPDATE `creature_template` SET `lootid`=22687 WHERE `entry`=13324;
+UPDATE `creature_template` SET `lootid`=22688 WHERE `entry`=13329;
+UPDATE `creature_template` SET `lootid`=22689 WHERE `entry`=13524;
+UPDATE `creature_template` SET `lootid`=22691 WHERE `entry`=13576;
+UPDATE `creature_template` SET `lootid`=22700 WHERE `entry`=13298;
+UPDATE `creature_template` SET `lootid`=22701 WHERE `entry`=13145;
+UPDATE `creature_template` SET `lootid`=22702 WHERE `entry`=13296;
+UPDATE `creature_template` SET `lootid`=22703 WHERE `entry`=13147;
+UPDATE `creature_template` SET `lootid`=22704 WHERE `entry`=13299;
+UPDATE `creature_template` SET `lootid`=22705 WHERE `entry`=13300;
+UPDATE `creature_template` SET `lootid`=22706 WHERE `entry`=13146;
+UPDATE `creature_template` SET `lootid`=22707 WHERE `entry`=13137;
+UPDATE `creature_template` SET `lootid`=22708 WHERE `entry`=13138;
+UPDATE `creature_template` SET `lootid`=22709 WHERE `entry`=13297;
+UPDATE `creature_template` SET `lootid`=22710 WHERE `entry`=13143;
+UPDATE `creature_template` SET `lootid`=22711 WHERE `entry`=13144;
+UPDATE `creature_template` SET `lootid`=22713 WHERE `entry`=13525;
+UPDATE `creature_template` SET `lootid`=22718 WHERE `entry`=13529;
+UPDATE `creature_template` SET `lootid`=22719 WHERE `entry`=13333;
+UPDATE `creature_template` SET `lootid`=22725 WHERE `entry`=10984;
+UPDATE `creature_template` SET `lootid`=22736 WHERE `entry`=13776;
+UPDATE `creature_template` SET `lootid`=22754 WHERE `entry`=13537;
+UPDATE `creature_template` SET `lootid`=22759 WHERE `entry`=13777;
+UPDATE `creature_template` SET `lootid`=22764 WHERE `entry`=13676;
+UPDATE `creature_template` SET `lootid`=22765 WHERE `entry`=13618;
+UPDATE `creature_template` SET `lootid`=22768 WHERE `entry`=13150;
+UPDATE `creature_template` SET `lootid`=22769 WHERE `entry`=13149;
+UPDATE `creature_template` SET `lootid`=22774 WHERE `entry`=13541;
+UPDATE `creature_template` SET `lootid`=22776 WHERE `entry`=13544;
+UPDATE `creature_template` SET `lootid`=22788 WHERE `entry`=12156;
+UPDATE `creature_template` SET `lootid`=22789 WHERE `entry`=12158;
+UPDATE `creature_template` SET `lootid`=22790 WHERE `entry`=13956;
+UPDATE `creature_template` SET `lootid`=22791 WHERE `entry`=13958;
+UPDATE `creature_template` SET `lootid`=22792 WHERE `entry`=12157;
+UPDATE `creature_template` SET `lootid`=22794 WHERE `entry`=10983;
+UPDATE `creature_template` SET `lootid`=22795 WHERE `entry`=13957;
+UPDATE `creature_template` SET `lootid`=22796 WHERE `entry`=11679;
+UPDATE `creature_template` SET `lootid`=25548 WHERE `entry`=24976;
+UPDATE `creature_template` SET `lootid`=25551 WHERE `entry`=24698;
+UPDATE `creature_template` SET `lootid`=29274 WHERE `entry`=16506;
+UPDATE `creature_template` SET `lootid`=29833 WHERE `entry`=16156;
+UPDATE `creature_template` SET `lootid`=30759 WHERE `entry`=22262;
+UPDATE `creature_template` SET `lootid`=30760 WHERE `entry`=22261;
+UPDATE `creature_template` SET `lootid`=30761 WHERE `entry`=22263;
+UPDATE `creature_template` SET `lootid`=30763 WHERE `entry`=23174;
+UPDATE `creature_template` SET `lootid`=30773 WHERE `entry`=23386;
+UPDATE `creature_template` SET `lootid`=30822 WHERE `entry`=26690;
+UPDATE `creature_template` SET `lootid`=30823 WHERE `entry`=26691;
+UPDATE `creature_template` SET `lootid`=31178 WHERE `entry`=27729;
+UPDATE `creature_template` SET `lootid`=31179 WHERE `entry`=28249;
+UPDATE `creature_template` SET `lootid`=31180 WHERE `entry`=27732;
+UPDATE `creature_template` SET `lootid`=31184 WHERE `entry`=28200;
+UPDATE `creature_template` SET `lootid`=31187 WHERE `entry`=27734;
+UPDATE `creature_template` SET `lootid`=31188 WHERE `entry`=28199;
+UPDATE `creature_template` SET `lootid`=31199 WHERE `entry`=27736;
+UPDATE `creature_template` SET `lootid`=31200 WHERE `entry`=28201;
+UPDATE `creature_template` SET `lootid`=31201 WHERE `entry`=27731;
+UPDATE `creature_template` SET `lootid`=31202 WHERE `entry`=27742;
+UPDATE `creature_template` SET `lootid`=31203 WHERE `entry`=27744;
+UPDATE `creature_template` SET `lootid`=31206 WHERE `entry`=27743;
+UPDATE `creature_template` SET `lootid`=33391 WHERE `entry`=32915;
+UPDATE `creature_template` SET `lootid`=33773 WHERE `entry`=33772;
+UPDATE `creature_template` SET `lootid`=34106 WHERE `entry`=33432;
+UPDATE `creature_template` SET `lootid`=34108 WHERE `entry`=33651;
+UPDATE `creature_template` SET `lootid`=35306 WHERE `entry`=35305;
+UPDATE `creature_template` SET `lootid`=35308 WHERE `entry`=35307;
+UPDATE `creature_template` SET `lootid`=35310 WHERE `entry`=35309;
+UPDATE `creature_template` SET `lootid`=35359 WHERE `entry`=35143;
+UPDATE `creature_template` SET `lootid`=38151 WHERE `entry`=37532;
+UPDATE `creature_template` SET `lootid`=39805 WHERE `entry`=39946;
+UPDATE `creature_template` SET `lootid`=39823 WHERE `entry`=39948;
+UPDATE `creature_template` SET `lootid`=39920 WHERE `entry`=39947;
+UPDATE `creature_template` SET `lootid`=40420 WHERE `entry`=40419;
diff --git a/sql/old/3.3.5a/2012_09_14_00_world_sai.sql b/sql/old/3.3.5a/2012_09_14_00_world_sai.sql
new file mode 100644
index 00000000000..13f11b7a795
--- /dev/null
+++ b/sql/old/3.3.5a/2012_09_14_00_world_sai.sql
@@ -0,0 +1 @@
+UPDATE `smart_scripts` SET `event_param1` = 35282, `action_param1` = 256, `comment` = 'Scrapped Fel Reaver - On Spellhit - Remove - OOC Not attackable - flags' WHERE `entryorguid` = 20243;
diff --git a/sql/old/3.3.5a/2012_09_14_01_world_creature_loot_template.sql b/sql/old/3.3.5a/2012_09_14_01_world_creature_loot_template.sql
new file mode 100644
index 00000000000..77ab9e89b04
--- /dev/null
+++ b/sql/old/3.3.5a/2012_09_14_01_world_creature_loot_template.sql
@@ -0,0 +1,5 @@
+DELETE FROM `creature_loot_template` WHERE `entry` = 37126;
+INSERT INTO `creature_loot_template` (`entry`,`item`,`ChanceOrQuestChance`,`lootmode`,`groupid`,`mincountOrRef`,`maxcount`) VALUES
+(37126, 49426, 100, 1, 0, 1, 1),
+(37126, 1, 100, 1, 0, -100002, 1);
+UPDATE `creature_template` SET `lootid` = 37126 WHERE `entry` IN (37126,38258);
diff --git a/sql/old/3.3.5a/2012_09_15_00_world_achievement_criteria_data.sql b/sql/old/3.3.5a/2012_09_15_00_world_achievement_criteria_data.sql
new file mode 100644
index 00000000000..a30eff7024e
--- /dev/null
+++ b/sql/old/3.3.5a/2012_09_15_00_world_achievement_criteria_data.sql
@@ -0,0 +1,6 @@
+-- Insert achievement instance criteria data scripts
+DELETE FROM `achievement_criteria_data` WHERE `type`=11 and `criteria_id` IN (7323,7324,7325);
+INSERT INTO `achievement_criteria_data` (`criteria_id`, `type`, `value1`, `value2`, `ScriptName`) VALUES
+(7323,11,0,0,'achievement_ruby_void'),
+(7324,11,0,0,'achievement_emerald_void'),
+(7325,11,0,0,'achievement_amber_void');
diff --git a/sql/old/3.3.5a/2012_09_15_00_world_creature_template.sql b/sql/old/3.3.5a/2012_09_15_00_world_creature_template.sql
new file mode 100644
index 00000000000..3db5a598c1d
--- /dev/null
+++ b/sql/old/3.3.5a/2012_09_15_00_world_creature_template.sql
@@ -0,0 +1,288 @@
+UPDATE `creature_template` SET `lootid`=`entry` WHERE `entry` IN (17400,17401,17816,17957,17958,17961,17938,17959,17960,17940,17817,17963,17962,17964,17723,17731,19632,17732,17730,17771,17729,17728,17724,17734,17725,17871,17726,17727,17735,18311,18331,18317,18309,18313,18312,18315,19306,18314,19307,18524,18497,18702,18493,18495,18503,18557,18556,18558,18559,18521,18500,18498,18499,18501,18934,17820,17819,17840,17860,17833,18171,18172,18170,17815,17814,17846,18092,18094,18093,17721,17800,17803,17801,17805,17722,17802,17917,17799,18633,18636,18631,18635,18632,18641,18830,18794,18637,18639,18634,18640,18638,18642,18796,18663,18848,19208,19209,19429,19428,18327,18323,18318,18328,18325,18322,18319,18320,18326,18321,20923,19510,20990,19167,19231,19712,19716,19713,19168,20988,20059,19735,19166,20857,20869,20859,20911,20905,20867,20868,20880,20879,20896,20897,20898,20912,20875,20873,20906,20865,20864,20901,20902,20882,20866,20883,20909,20908,20910,20881,20900,21126,21127,21694,21696,21695,21891,21904,22128,18983,17952,18982,21702,13536,13539,13424,13542,13554,13545,13557,13425,13155,14770,14768,13378,603,13377,13416,13151,14767,13526,13530,14769,13527,13531,13140,13319,13320,13154,13152,13318,13153,13139,13446,13597,13357,13841,13598,13356,13449,13840,12048,12052,12047,13325,13327,13330,13335,13336,13337,13426,13427,13428,13528,13440,13324,13329,13524,13576,13298,13145,13296,13147,13299,13300,13146,13137,13138,13297,13143,13144,13525,13529,13333,10984,13776,13537,13777,13676,13618,13150,13149,13541,13544,12156,12158,13956,13958,12157,10983,13957,11679,24976,24698,16506,16156,22262,22261,22263,23174,23386,26690,26691,27729,28249,27732,28200,27734,28199,27736,28201,27731,27742,27744,27743,32915,33772,33432,33651,35305,35307,35309,35143,37532,39946,39948,39947,40419);
+UPDATE `creature_template` SET `lootid`=17400 WHERE `entry`=18604;
+UPDATE `creature_template` SET `lootid`=17401 WHERE `entry`=18605;
+UPDATE `creature_template` SET `lootid`=17816 WHERE `entry`=19884;
+UPDATE `creature_template` SET `lootid`=17957 WHERE `entry`=19885;
+UPDATE `creature_template` SET `lootid`=17958 WHERE `entry`=19886;
+UPDATE `creature_template` SET `lootid`=17961 WHERE `entry`=19887;
+UPDATE `creature_template` SET `lootid`=17938 WHERE `entry`=19888;
+UPDATE `creature_template` SET `lootid`=17959 WHERE `entry`=19889;
+UPDATE `creature_template` SET `lootid`=17960 WHERE `entry`=19890;
+UPDATE `creature_template` SET `lootid`=17940 WHERE `entry`=19891;
+UPDATE `creature_template` SET `lootid`=17817 WHERE `entry`=19892;
+UPDATE `creature_template` SET `lootid`=17963 WHERE `entry`=19902;
+UPDATE `creature_template` SET `lootid`=17962 WHERE `entry`=19903;
+UPDATE `creature_template` SET `lootid`=17964 WHERE `entry`=19904;
+UPDATE `creature_template` SET `lootid`=17723 WHERE `entry`=20164;
+UPDATE `creature_template` SET `lootid`=17731 WHERE `entry`=20173;
+UPDATE `creature_template` SET `lootid`=19632 WHERE `entry`=20174;
+UPDATE `creature_template` SET `lootid`=17732 WHERE `entry`=20175;
+UPDATE `creature_template` SET `lootid`=17730 WHERE `entry`=20177;
+UPDATE `creature_template` SET `lootid`=17771 WHERE `entry`=20179;
+UPDATE `creature_template` SET `lootid`=17729 WHERE `entry`=20180;
+UPDATE `creature_template` SET `lootid`=17728 WHERE `entry`=20181;
+UPDATE `creature_template` SET `lootid`=17724 WHERE `entry`=20185;
+UPDATE `creature_template` SET `lootid`=17734 WHERE `entry`=20187;
+UPDATE `creature_template` SET `lootid`=17725 WHERE `entry`=20188;
+UPDATE `creature_template` SET `lootid`=17871 WHERE `entry`=20190;
+UPDATE `creature_template` SET `lootid`=17726 WHERE `entry`=20191;
+UPDATE `creature_template` SET `lootid`=17727 WHERE `entry`=20192;
+UPDATE `creature_template` SET `lootid`=17735 WHERE `entry`=20193;
+UPDATE `creature_template` SET `lootid`=18311 WHERE `entry`=20255;
+UPDATE `creature_template` SET `lootid`=18331 WHERE `entry`=20256;
+UPDATE `creature_template` SET `lootid`=18317 WHERE `entry`=20257;
+UPDATE `creature_template` SET `lootid`=18309 WHERE `entry`=20258;
+UPDATE `creature_template` SET `lootid`=18313 WHERE `entry`=20259;
+UPDATE `creature_template` SET `lootid`=18312 WHERE `entry`=20260;
+UPDATE `creature_template` SET `lootid`=18315 WHERE `entry`=20261;
+UPDATE `creature_template` SET `lootid`=19306 WHERE `entry`=20263;
+UPDATE `creature_template` SET `lootid`=18314 WHERE `entry`=20264;
+UPDATE `creature_template` SET `lootid`=19307 WHERE `entry`=20265;
+UPDATE `creature_template` SET `lootid`=18524 WHERE `entry`=20298;
+UPDATE `creature_template` SET `lootid`=18497 WHERE `entry`=20299;
+UPDATE `creature_template` SET `lootid`=18702 WHERE `entry`=20300;
+UPDATE `creature_template` SET `lootid`=18493 WHERE `entry`=20301;
+UPDATE `creature_template` SET `lootid`=18495 WHERE `entry`=20302;
+UPDATE `creature_template` SET `lootid`=18503 WHERE `entry`=20309;
+UPDATE `creature_template` SET `lootid`=18557 WHERE `entry`=20310;
+UPDATE `creature_template` SET `lootid`=18556 WHERE `entry`=20311;
+UPDATE `creature_template` SET `lootid`=18558 WHERE `entry`=20312;
+UPDATE `creature_template` SET `lootid`=18559 WHERE `entry`=20313;
+UPDATE `creature_template` SET `lootid`=18521 WHERE `entry`=20315;
+UPDATE `creature_template` SET `lootid`=18500 WHERE `entry`=20320;
+UPDATE `creature_template` SET `lootid`=18498 WHERE `entry`=20321;
+UPDATE `creature_template` SET `lootid`=18499 WHERE `entry`=20322;
+UPDATE `creature_template` SET `lootid`=18501 WHERE `entry`=20323;
+UPDATE `creature_template` SET `lootid`=18934 WHERE `entry`=20525;
+UPDATE `creature_template` SET `lootid`=17820 WHERE `entry`=20526;
+UPDATE `creature_template` SET `lootid`=17819 WHERE `entry`=20527;
+UPDATE `creature_template` SET `lootid`=17840 WHERE `entry`=20528;
+UPDATE `creature_template` SET `lootid`=17860 WHERE `entry`=20529;
+UPDATE `creature_template` SET `lootid`=17833 WHERE `entry`=20530;
+UPDATE `creature_template` SET `lootid`=18171 WHERE `entry`=20532;
+UPDATE `creature_template` SET `lootid`=18172 WHERE `entry`=20533;
+UPDATE `creature_template` SET `lootid`=18170 WHERE `entry`=20534;
+UPDATE `creature_template` SET `lootid`=17815 WHERE `entry`=20537;
+UPDATE `creature_template` SET `lootid`=17814 WHERE `entry`=20538;
+UPDATE `creature_template` SET `lootid`=17846 WHERE `entry`=20543;
+UPDATE `creature_template` SET `lootid`=18092 WHERE `entry`=20545;
+UPDATE `creature_template` SET `lootid`=18094 WHERE `entry`=20546;
+UPDATE `creature_template` SET `lootid`=18093 WHERE `entry`=20547;
+UPDATE `creature_template` SET `lootid`=17721 WHERE `entry`=20620;
+UPDATE `creature_template` SET `lootid`=17800 WHERE `entry`=20621;
+UPDATE `creature_template` SET `lootid`=17803 WHERE `entry`=20622;
+UPDATE `creature_template` SET `lootid`=17801 WHERE `entry`=20623;
+UPDATE `creature_template` SET `lootid`=17805 WHERE `entry`=20624;
+UPDATE `creature_template` SET `lootid`=17722 WHERE `entry`=20625;
+UPDATE `creature_template` SET `lootid`=17802 WHERE `entry`=20626;
+UPDATE `creature_template` SET `lootid`=17917 WHERE `entry`=20627;
+UPDATE `creature_template` SET `lootid`=17799 WHERE `entry`=20628;
+UPDATE `creature_template` SET `lootid`=18633 WHERE `entry`=20638;
+UPDATE `creature_template` SET `lootid`=18636 WHERE `entry`=20639;
+UPDATE `creature_template` SET `lootid`=18631 WHERE `entry`=20640;
+UPDATE `creature_template` SET `lootid`=18635 WHERE `entry`=20641;
+UPDATE `creature_template` SET `lootid`=18632 WHERE `entry`=20642;
+UPDATE `creature_template` SET `lootid`=18641 WHERE `entry`=20643;
+UPDATE `creature_template` SET `lootid`=18830 WHERE `entry`=20644;
+UPDATE `creature_template` SET `lootid`=18794 WHERE `entry`=20645;
+UPDATE `creature_template` SET `lootid`=18637 WHERE `entry`=20646;
+UPDATE `creature_template` SET `lootid`=18639 WHERE `entry`=20647;
+UPDATE `creature_template` SET `lootid`=18634 WHERE `entry`=20648;
+UPDATE `creature_template` SET `lootid`=18640 WHERE `entry`=20649;
+UPDATE `creature_template` SET `lootid`=18638 WHERE `entry`=20650;
+UPDATE `creature_template` SET `lootid`=18642 WHERE `entry`=20651;
+UPDATE `creature_template` SET `lootid`=18796 WHERE `entry`=20652;
+UPDATE `creature_template` SET `lootid`=18663 WHERE `entry`=20655;
+UPDATE `creature_template` SET `lootid`=18848 WHERE `entry`=20656;
+UPDATE `creature_template` SET `lootid`=19208 WHERE `entry`=20660;
+UPDATE `creature_template` SET `lootid`=19209 WHERE `entry`=20661;
+UPDATE `creature_template` SET `lootid`=19429 WHERE `entry`=20686;
+UPDATE `creature_template` SET `lootid`=19428 WHERE `entry`=20688;
+UPDATE `creature_template` SET `lootid`=18327 WHERE `entry`=20691;
+UPDATE `creature_template` SET `lootid`=18323 WHERE `entry`=20692;
+UPDATE `creature_template` SET `lootid`=18318 WHERE `entry`=20693;
+UPDATE `creature_template` SET `lootid`=18328 WHERE `entry`=20694;
+UPDATE `creature_template` SET `lootid`=18325 WHERE `entry`=20695;
+UPDATE `creature_template` SET `lootid`=18322 WHERE `entry`=20696;
+UPDATE `creature_template` SET `lootid`=18319 WHERE `entry`=20697;
+UPDATE `creature_template` SET `lootid`=18320 WHERE `entry`=20698;
+UPDATE `creature_template` SET `lootid`=18326 WHERE `entry`=20699;
+UPDATE `creature_template` SET `lootid`=18321 WHERE `entry`=20701;
+UPDATE `creature_template` SET `lootid`=20923 WHERE `entry`=20993;
+UPDATE `creature_template` SET `lootid`=19510 WHERE `entry`=21522;
+UPDATE `creature_template` SET `lootid`=20990 WHERE `entry`=21523;
+UPDATE `creature_template` SET `lootid`=19167 WHERE `entry`=21524;
+UPDATE `creature_template` SET `lootid`=19231 WHERE `entry`=21527;
+UPDATE `creature_template` SET `lootid`=19712 WHERE `entry`=21528;
+UPDATE `creature_template` SET `lootid`=19716 WHERE `entry`=21531;
+UPDATE `creature_template` SET `lootid`=19713 WHERE `entry`=21532;
+UPDATE `creature_template` SET `lootid`=19168 WHERE `entry`=21539;
+UPDATE `creature_template` SET `lootid`=20988 WHERE `entry`=21540;
+UPDATE `creature_template` SET `lootid`=20059 WHERE `entry`=21541;
+UPDATE `creature_template` SET `lootid`=19735 WHERE `entry`=21542;
+UPDATE `creature_template` SET `lootid`=19166 WHERE `entry`=21543;
+UPDATE `creature_template` SET `lootid`=20857 WHERE `entry`=21585;
+UPDATE `creature_template` SET `lootid`=20869 WHERE `entry`=21586;
+UPDATE `creature_template` SET `lootid`=20859 WHERE `entry`=21587;
+UPDATE `creature_template` SET `lootid`=20911 WHERE `entry`=21588;
+UPDATE `creature_template` SET `lootid`=20905 WHERE `entry`=21589;
+UPDATE `creature_template` SET `lootid`=20867 WHERE `entry`=21591;
+UPDATE `creature_template` SET `lootid`=20868 WHERE `entry`=21593;
+UPDATE `creature_template` SET `lootid`=20880 WHERE `entry`=21594;
+UPDATE `creature_template` SET `lootid`=20879 WHERE `entry`=21595;
+UPDATE `creature_template` SET `lootid`=20896 WHERE `entry`=21596;
+UPDATE `creature_template` SET `lootid`=20897 WHERE `entry`=21597;
+UPDATE `creature_template` SET `lootid`=20898 WHERE `entry`=21598;
+UPDATE `creature_template` SET `lootid`=20912 WHERE `entry`=21601;
+UPDATE `creature_template` SET `lootid`=20875 WHERE `entry`=21604;
+UPDATE `creature_template` SET `lootid`=20873 WHERE `entry`=21605;
+UPDATE `creature_template` SET `lootid`=20906 WHERE `entry`=21606;
+UPDATE `creature_template` SET `lootid`=20865 WHERE `entry`=21607;
+UPDATE `creature_template` SET `lootid`=20864 WHERE `entry`=21608;
+UPDATE `creature_template` SET `lootid`=20901 WHERE `entry`=21610;
+UPDATE `creature_template` SET `lootid`=20902 WHERE `entry`=21611;
+UPDATE `creature_template` SET `lootid`=20882 WHERE `entry`=21613;
+UPDATE `creature_template` SET `lootid`=20866 WHERE `entry`=21614;
+UPDATE `creature_template` SET `lootid`=20883 WHERE `entry`=21615;
+UPDATE `creature_template` SET `lootid`=20909 WHERE `entry`=21616;
+UPDATE `creature_template` SET `lootid`=20908 WHERE `entry`=21617;
+UPDATE `creature_template` SET `lootid`=20910 WHERE `entry`=21618;
+UPDATE `creature_template` SET `lootid`=20881 WHERE `entry`=21619;
+UPDATE `creature_template` SET `lootid`=20900 WHERE `entry`=21621;
+UPDATE `creature_template` SET `lootid`=21126 WHERE `entry`=21842;
+UPDATE `creature_template` SET `lootid`=21127 WHERE `entry`=21843;
+UPDATE `creature_template` SET `lootid`=21694 WHERE `entry`=21914;
+UPDATE `creature_template` SET `lootid`=21696 WHERE `entry`=21916;
+UPDATE `creature_template` SET `lootid`=21695 WHERE `entry`=21917;
+UPDATE `creature_template` SET `lootid`=21891 WHERE `entry`=21989;
+UPDATE `creature_template` SET `lootid`=21904 WHERE `entry`=21990;
+UPDATE `creature_template` SET `lootid`=22128 WHERE `entry`=22129;
+UPDATE `creature_template` SET `lootid`=18983 WHERE `entry`=22162;
+UPDATE `creature_template` SET `lootid`=17952 WHERE `entry`=22163;
+UPDATE `creature_template` SET `lootid`=18982 WHERE `entry`=22173;
+UPDATE `creature_template` SET `lootid`=21702 WHERE `entry`=22346;
+UPDATE `creature_template` SET `lootid`=13536 WHERE `entry`=22530;
+UPDATE `creature_template` SET `lootid`=13539 WHERE `entry`=22532;
+UPDATE `creature_template` SET `lootid`=13424 WHERE `entry`=22533;
+UPDATE `creature_template` SET `lootid`=13542 WHERE `entry`=22534;
+UPDATE `creature_template` SET `lootid`=13554 WHERE `entry`=22535;
+UPDATE `creature_template` SET `lootid`=13545 WHERE `entry`=22536;
+UPDATE `creature_template` SET `lootid`=13557 WHERE `entry`=22537;
+UPDATE `creature_template` SET `lootid`=13425 WHERE `entry`=22538;
+UPDATE `creature_template` SET `lootid`=13155 WHERE `entry`=22539;
+UPDATE `creature_template` SET `lootid`=14770 WHERE `entry`=22543;
+UPDATE `creature_template` SET `lootid`=14768 WHERE `entry`=22547;
+UPDATE `creature_template` SET `lootid`=13378 WHERE `entry`=22550;
+UPDATE `creature_template` SET `lootid`=603 WHERE `entry`=22555;
+UPDATE `creature_template` SET `lootid`=13377 WHERE `entry`=22565;
+UPDATE `creature_template` SET `lootid`=13416 WHERE `entry`=22576;
+UPDATE `creature_template` SET `lootid`=13151 WHERE `entry`=22578;
+UPDATE `creature_template` SET `lootid`=14767 WHERE `entry`=22579;
+UPDATE `creature_template` SET `lootid`=13526 WHERE `entry`=22587;
+UPDATE `creature_template` SET `lootid`=13530 WHERE `entry`=22592;
+UPDATE `creature_template` SET `lootid`=14769 WHERE `entry`=22595;
+UPDATE `creature_template` SET `lootid`=13527 WHERE `entry`=22607;
+UPDATE `creature_template` SET `lootid`=13531 WHERE `entry`=22612;
+UPDATE `creature_template` SET `lootid`=13140 WHERE `entry`=22613;
+UPDATE `creature_template` SET `lootid`=13319 WHERE `entry`=22614;
+UPDATE `creature_template` SET `lootid`=13320 WHERE `entry`=22615;
+UPDATE `creature_template` SET `lootid`=13154 WHERE `entry`=22616;
+UPDATE `creature_template` SET `lootid`=13152 WHERE `entry`=22617;
+UPDATE `creature_template` SET `lootid`=13318 WHERE `entry`=22618;
+UPDATE `creature_template` SET `lootid`=13153 WHERE `entry`=22619;
+UPDATE `creature_template` SET `lootid`=13139 WHERE `entry`=22620;
+UPDATE `creature_template` SET `lootid`=13446 WHERE `entry`=22621;
+UPDATE `creature_template` SET `lootid`=13597 WHERE `entry`=22623;
+UPDATE `creature_template` SET `lootid`=13357 WHERE `entry`=22624;
+UPDATE `creature_template` SET `lootid`=13841 WHERE `entry`=22628;
+UPDATE `creature_template` SET `lootid`=13598 WHERE `entry`=22634;
+UPDATE `creature_template` SET `lootid`=13356 WHERE `entry`=22635;
+UPDATE `creature_template` SET `lootid`=13449 WHERE `entry`=22639;
+UPDATE `creature_template` SET `lootid`=13840 WHERE `entry`=22640;
+UPDATE `creature_template` SET `lootid`=12048 WHERE `entry`=22645;
+UPDATE `creature_template` SET `lootid`=12052 WHERE `entry`=22649;
+UPDATE `creature_template` SET `lootid`=12047 WHERE `entry`=22657;
+UPDATE `creature_template` SET `lootid`=13325 WHERE `entry`=22662;
+UPDATE `creature_template` SET `lootid`=13327 WHERE `entry`=22663;
+UPDATE `creature_template` SET `lootid`=13330 WHERE `entry`=22664;
+UPDATE `creature_template` SET `lootid`=13335 WHERE `entry`=22667;
+UPDATE `creature_template` SET `lootid`=13336 WHERE `entry`=22668;
+UPDATE `creature_template` SET `lootid`=13337 WHERE `entry`=22669;
+UPDATE `creature_template` SET `lootid`=13426 WHERE `entry`=22671;
+UPDATE `creature_template` SET `lootid`=13427 WHERE `entry`=22672;
+UPDATE `creature_template` SET `lootid`=13428 WHERE `entry`=22673;
+UPDATE `creature_template` SET `lootid`=13528 WHERE `entry`=22676;
+UPDATE `creature_template` SET `lootid`=13440 WHERE `entry`=22679;
+UPDATE `creature_template` SET `lootid`=13324 WHERE `entry`=22687;
+UPDATE `creature_template` SET `lootid`=13329 WHERE `entry`=22688;
+UPDATE `creature_template` SET `lootid`=13524 WHERE `entry`=22689;
+UPDATE `creature_template` SET `lootid`=13576 WHERE `entry`=22691;
+UPDATE `creature_template` SET `lootid`=13298 WHERE `entry`=22700;
+UPDATE `creature_template` SET `lootid`=13145 WHERE `entry`=22701;
+UPDATE `creature_template` SET `lootid`=13296 WHERE `entry`=22702;
+UPDATE `creature_template` SET `lootid`=13147 WHERE `entry`=22703;
+UPDATE `creature_template` SET `lootid`=13299 WHERE `entry`=22704;
+UPDATE `creature_template` SET `lootid`=13300 WHERE `entry`=22705;
+UPDATE `creature_template` SET `lootid`=13146 WHERE `entry`=22706;
+UPDATE `creature_template` SET `lootid`=13137 WHERE `entry`=22707;
+UPDATE `creature_template` SET `lootid`=13138 WHERE `entry`=22708;
+UPDATE `creature_template` SET `lootid`=13297 WHERE `entry`=22709;
+UPDATE `creature_template` SET `lootid`=13143 WHERE `entry`=22710;
+UPDATE `creature_template` SET `lootid`=13144 WHERE `entry`=22711;
+UPDATE `creature_template` SET `lootid`=13525 WHERE `entry`=22713;
+UPDATE `creature_template` SET `lootid`=13529 WHERE `entry`=22718;
+UPDATE `creature_template` SET `lootid`=13333 WHERE `entry`=22719;
+UPDATE `creature_template` SET `lootid`=10984 WHERE `entry`=22725;
+UPDATE `creature_template` SET `lootid`=13776 WHERE `entry`=22736;
+UPDATE `creature_template` SET `lootid`=13537 WHERE `entry`=22754;
+UPDATE `creature_template` SET `lootid`=13777 WHERE `entry`=22759;
+UPDATE `creature_template` SET `lootid`=13676 WHERE `entry`=22764;
+UPDATE `creature_template` SET `lootid`=13618 WHERE `entry`=22765;
+UPDATE `creature_template` SET `lootid`=13150 WHERE `entry`=22768;
+UPDATE `creature_template` SET `lootid`=13149 WHERE `entry`=22769;
+UPDATE `creature_template` SET `lootid`=13541 WHERE `entry`=22774;
+UPDATE `creature_template` SET `lootid`=13544 WHERE `entry`=22776;
+UPDATE `creature_template` SET `lootid`=12156 WHERE `entry`=22788;
+UPDATE `creature_template` SET `lootid`=12158 WHERE `entry`=22789;
+UPDATE `creature_template` SET `lootid`=13956 WHERE `entry`=22790;
+UPDATE `creature_template` SET `lootid`=13958 WHERE `entry`=22791;
+UPDATE `creature_template` SET `lootid`=12157 WHERE `entry`=22792;
+UPDATE `creature_template` SET `lootid`=10983 WHERE `entry`=22794;
+UPDATE `creature_template` SET `lootid`=13957 WHERE `entry`=22795;
+UPDATE `creature_template` SET `lootid`=11679 WHERE `entry`=22796;
+UPDATE `creature_template` SET `lootid`=24976 WHERE `entry`=25548;
+UPDATE `creature_template` SET `lootid`=24698 WHERE `entry`=25551;
+UPDATE `creature_template` SET `lootid`=16506 WHERE `entry`=29274;
+UPDATE `creature_template` SET `lootid`=16156 WHERE `entry`=29833;
+UPDATE `creature_template` SET `lootid`=22262 WHERE `entry`=30759;
+UPDATE `creature_template` SET `lootid`=22261 WHERE `entry`=30760;
+UPDATE `creature_template` SET `lootid`=22263 WHERE `entry`=30761;
+UPDATE `creature_template` SET `lootid`=23174 WHERE `entry`=30763;
+UPDATE `creature_template` SET `lootid`=23386 WHERE `entry`=30773;
+UPDATE `creature_template` SET `lootid`=26690 WHERE `entry`=30822;
+UPDATE `creature_template` SET `lootid`=26691 WHERE `entry`=30823;
+UPDATE `creature_template` SET `lootid`=27729 WHERE `entry`=31178;
+UPDATE `creature_template` SET `lootid`=28249 WHERE `entry`=31179;
+UPDATE `creature_template` SET `lootid`=27732 WHERE `entry`=31180;
+UPDATE `creature_template` SET `lootid`=28200 WHERE `entry`=31184;
+UPDATE `creature_template` SET `lootid`=27734 WHERE `entry`=31187;
+UPDATE `creature_template` SET `lootid`=28199 WHERE `entry`=31188;
+UPDATE `creature_template` SET `lootid`=27736 WHERE `entry`=31199;
+UPDATE `creature_template` SET `lootid`=28201 WHERE `entry`=31200;
+UPDATE `creature_template` SET `lootid`=27731 WHERE `entry`=31201;
+UPDATE `creature_template` SET `lootid`=27742 WHERE `entry`=31202;
+UPDATE `creature_template` SET `lootid`=27744 WHERE `entry`=31203;
+UPDATE `creature_template` SET `lootid`=27743 WHERE `entry`=31206;
+UPDATE `creature_template` SET `lootid`=32915 WHERE `entry`=33391;
+UPDATE `creature_template` SET `lootid`=33772 WHERE `entry`=33773;
+UPDATE `creature_template` SET `lootid`=33432 WHERE `entry`=34106;
+UPDATE `creature_template` SET `lootid`=33651 WHERE `entry`=34108;
+UPDATE `creature_template` SET `lootid`=35305 WHERE `entry`=35306;
+UPDATE `creature_template` SET `lootid`=35307 WHERE `entry`=35308;
+UPDATE `creature_template` SET `lootid`=35309 WHERE `entry`=35310;
+UPDATE `creature_template` SET `lootid`=35143 WHERE `entry`=35359;
+UPDATE `creature_template` SET `lootid`=37532 WHERE `entry`=38151;
+UPDATE `creature_template` SET `lootid`=39946 WHERE `entry`=39805;
+UPDATE `creature_template` SET `lootid`=39948 WHERE `entry`=39823;
+UPDATE `creature_template` SET `lootid`=39947 WHERE `entry`=39920;
+UPDATE `creature_template` SET `lootid`=40419 WHERE `entry`=40420;
diff --git a/sql/old/3.3.5a/2012_09_15_00_world_disables.sql b/sql/old/3.3.5a/2012_09_15_00_world_disables.sql
new file mode 100644
index 00000000000..371315b5be7
--- /dev/null
+++ b/sql/old/3.3.5a/2012_09_15_00_world_disables.sql
@@ -0,0 +1,4 @@
+-- Remove achievements from disables
+DELETE FROM `disables` WHERE `sourceType`=4 AND `entry`=7323; -- Ruby Void
+DELETE FROM `disables` WHERE `sourceType`=4 AND `entry`=7324; -- Emerald Void
+DELETE FROM `disables` WHERE `sourceType`=4 AND `entry`=7325; -- Amber Void
diff --git a/sql/old/3.3.5a/2012_09_15_01_world_creature_loot_template.sql b/sql/old/3.3.5a/2012_09_15_01_world_creature_loot_template.sql
new file mode 100644
index 00000000000..71068d95bde
--- /dev/null
+++ b/sql/old/3.3.5a/2012_09_15_01_world_creature_loot_template.sql
@@ -0,0 +1,19 @@
+SET @SisterSvalna := 37126; -- Sister Svalna
+
+CALL `sp_get_ref_id`('RAID_CRE',@Reference);
+SET @RefSisterSvalna := @Reference+1;
+
+DELETE FROM `creature_loot_template` WHERE `entry`=@SisterSvalna;
+INSERT INTO `creature_loot_template` (`entry`,`item`,`ChanceOrQuestChance`,`lootmode`,`groupid`,`mincountOrRef`,`maxcount`) VALUES
+(@SisterSvalna,49426,100,1,0,1,1),-- Sister Svalna dropping 1 Emblem of Frost
+(@SisterSvalna,1,100,1,0,-@RefSisterSvalna,1);
+
+DELETE FROM `reference_loot_template` WHERE `entry`=@RefSisterSvalna;
+INSERT INTO `reference_loot_template` (`entry`,`item`,`ChanceOrQuestChance`,`lootmode`,`groupid`,`mincountOrRef`,`maxcount`) VALUES
+(@RefSisterSvalna,50452,6,1,1,1,1), -- Wodin's Lucky Necklace
+(@RefSisterSvalna,50453,5,1,1,1,1); -- Ring of Rotting Sinew
+
+DELETE FROM `conditions` WHERE `SourceTypeOrReferenceId`=10 AND `SourceGroup`=@RefSisterSvalna;
+INSERT INTO `conditions` (`SourceTypeOrReferenceId`, `SourceGroup`, `SourceEntry`, `SourceId`, `ElseGroup`, `ConditionTypeOrReference`, `ConditionTarget`, `ConditionValue1`, `ConditionValue2`, `ConditionValue3`, `NegativeCondition`, `ErrorTextId`, `ScriptName`, `Comment`) VALUES
+(10,@RefSisterSvalna,50452,0,0,19,0,3,0,0,0,0,'', 'Wodin''s Lucky Necklace only 25 heroic'),
+(10,@RefSisterSvalna,50453,0,0,19,0,3,0,0,0,0,'', 'Ring of Rotting Sinew only 25 heroic');
diff --git a/sql/updates/world/2012_09_16_00_world_version.sql b/sql/updates/world/2012_09_16_00_world_version.sql
new file mode 100644
index 00000000000..74a1cf67499
--- /dev/null
+++ b/sql/updates/world/2012_09_16_00_world_version.sql
@@ -0,0 +1 @@
+UPDATE `version` SET `db_version`='TDB 335.49', `cache_id`=49 LIMIT 1;
diff --git a/sql/updates/world/2012_09_16_01_world_conditions.sql b/sql/updates/world/2012_09_16_01_world_conditions.sql
new file mode 100644
index 00000000000..64f87262d0e
--- /dev/null
+++ b/sql/updates/world/2012_09_16_01_world_conditions.sql
@@ -0,0 +1,4 @@
+DELETE FROM `conditions` WHERE `SourceTypeOrReferenceId`=10 AND `SourceGroup`=34379;
+INSERT INTO `conditions` (`SourceTypeOrReferenceId`, `SourceGroup`, `SourceEntry`, `SourceId`, `ElseGroup`, `ConditionTypeOrReference`, `ConditionTarget`, `ConditionValue1`, `ConditionValue2`, `ConditionValue3`, `NegativeCondition`, `ErrorTextId`, `ScriptName`, `Comment`) VALUES
+(10,34379,50452,0,0,19,0,8,0,0,0,0,'', 'Wodin''s Lucky Necklace only 25 heroic'),
+(10,34379,50453,0,0,19,0,8,0,0,0,0,'', 'Ring of Rotting Sinew only 25 heroic');
diff --git a/sql/updates/world/2012_09_16_01_world_creature_loot_template.sql b/sql/updates/world/2012_09_16_01_world_creature_loot_template.sql
new file mode 100644
index 00000000000..2d87ad3aa16
--- /dev/null
+++ b/sql/updates/world/2012_09_16_01_world_creature_loot_template.sql
@@ -0,0 +1 @@
+UPDATE `creature_loot_template` SET `item`=39657 WHERE `entry`=28546 AND `item`=36657;
diff --git a/sql/updates/world/2012_09_16_01_world_creature_template_addon.sql b/sql/updates/world/2012_09_16_01_world_creature_template_addon.sql
new file mode 100644
index 00000000000..15415e856f3
--- /dev/null
+++ b/sql/updates/world/2012_09_16_01_world_creature_template_addon.sql
@@ -0,0 +1,3 @@
+DELETE FROM `creature_template_addon` WHERE `entry`=28670; -- Frostbrood Vanquisher
+INSERT INTO `creature_template_addon` (`entry`,`path_id`,`mount`,`bytes1`,`bytes2`,`emote`,`auras`) VALUES
+(28670,0,0,0x3000000,0x1,0,'53112');
diff --git a/sql/updates/world/2012_09_16_02_world_fires_over_skettis.sql b/sql/updates/world/2012_09_16_02_world_fires_over_skettis.sql
new file mode 100644
index 00000000000..d50f45bb020
--- /dev/null
+++ b/sql/updates/world/2012_09_16_02_world_fires_over_skettis.sql
@@ -0,0 +1,26 @@
+-- Add support for quest ID: 11008 - "Fires Over Skettis" Warpten fix and Nelegalno/shlomi1515 updates
+-- Also add support for achievement - http://www.wowhead.com/achievement=1275/bombs-away
+-- Fix previous SQL what is not changed is not included
+SET @TRIGGER := 22991;
+SET @EGG := 185549;
+SET @SKYBLAST := 39844;
+SET @SUMMEGG := 39843;
+-- Adds SAI support for Monstrous Kaliri Egg Trigger and the GO
+UPDATE `creature_template` SET `AIName`= 'SmartAI' WHERE `entry`=@TRIGGER;
+DELETE FROM `smart_scripts` WHERE `entryorguid`=@TRIGGER AND `source_type`=0;
+DELETE FROM `smart_scripts` WHERE `entryorguid`=@TRIGGER*100 AND `source_type`=9;
+INSERT INTO `smart_scripts` (`entryorguid`,`source_type`,`id`,`link`,`event_type`,`event_phase_mask`,`event_chance`,`event_flags`,`event_param1`,`event_param2`,`event_param3`,`event_param4`,`action_type`,`action_param1`,`action_param2`,`action_param3`,`action_param4`,`action_param5`,`action_param6`,`target_type`,`target_param1`,`target_param2`,`target_param3`,`target_x`,`target_y`,`target_z`,`target_o`,`comment`) VALUES
+(@TRIGGER,0,0,0,25,0,100,0,0,0,0,0,11,@SUMMEGG,0,0,0,0,0,1,0,0,0,0,0,0,0, 'Monstrous Kaliri Egg Trigger - On spawn/reset - Summon Monstrous Kaliri Egg (object wild)'),
+(@TRIGGER,0,1,2,8,0,100,0,@SKYBLAST,0,0,0,33,@TRIGGER,0,0,0,0,0,16,0,0,0,0,0,0,0, 'Monstrous Kaliri Egg Trigger - On Skyguard Blasting Charge hit - Give kill credit to invoker party'),
+(@TRIGGER,0,2,0,61,0,100,0,0,0,0,0,80,@TRIGGER*100,0,0,0,0,0,1,0,0,0,0,0,0,0, 'Monstrous Kaliri Egg Trigger - Linked with previous event - Start script 0'),
+(@TRIGGER*100,9,0,0,0,0,100,0,44000,44000,0,0,11,@SUMMEGG,0,0,0,0,0,1,0,0,0,0,0,0,0, 'Monstrous Kaliri Egg Trigger /On actionlist/ - Action 0 - Cast Summon Monstrous Kaliri Egg');
+-- Add conditions (thanks to Vincent-Michael for adding and Shauren for noticing my failure miss)
+DELETE FROM `conditions` WHERE `SourceTypeOrReferenceId`=13 AND `SourceEntry`=@SKYBLAST;
+INSERT INTO `conditions` (`SourceTypeOrReferenceId`,`SourceGroup`,`SourceEntry`,`SourceId`,`ElseGroup`,`ConditionTypeOrReference`,`ConditionTarget`,`ConditionValue1`,`ConditionValue2`,`ConditionValue3`,`NegativeCondition`,`ErrorTextId`,`ScriptName`,`Comment`) VALUES
+(13,1,@SKYBLAST,0,0,31,0,3,22991,0,0,0,'','Skyguard Blasting Charge can hit only Monstrous Kaliri Egg Trigger'),
+(13,2,@SKYBLAST,0,0,31,0,5,185549,0,0,0,'','Skyguard Blasting can hit only Monstrous Kaliri Egg');
+-- Remove SAI for Cannonball Stack
+UPDATE `gameobject_template` SET `AIName`='' WHERE `entry`=@EGG;
+DELETE FROM `smart_scripts` WHERE `entryorguid`=@EGG AND `source_type`=1;
+-- Delete GO spawns that are not needed
+DELETE FROM `gameobject` WHERE `id`=@EGG;
diff --git a/sql/updates/world/2012_09_16_03_world_spell_script_names.sql b/sql/updates/world/2012_09_16_03_world_spell_script_names.sql
new file mode 100644
index 00000000000..8b7e6aa92ba
--- /dev/null
+++ b/sql/updates/world/2012_09_16_03_world_spell_script_names.sql
@@ -0,0 +1,3 @@
+DELETE FROM spell_script_names WHERE scriptName="spell_dru_savage_roar";
+INSERT INTO spell_script_names (spell_id, ScriptName) VALUES
+(52610, 'spell_dru_savage_roar');
diff --git a/src/server/authserver/Authentication/AuthCodes.cpp b/src/server/authserver/Authentication/AuthCodes.cpp
index ace18e7b45c..bdb96ca0d25 100644
--- a/src/server/authserver/Authentication/AuthCodes.cpp
+++ b/src/server/authserver/Authentication/AuthCodes.cpp
@@ -16,15 +16,36 @@
*/
#include "AuthCodes.h"
+#include <cstddef>
namespace AuthHelper
{
- bool IsPreBCAcceptedClientBuild(int build)
+ static RealmBuildInfo const PostBcAcceptedClientBuilds[] =
+ {
+ {15595, 4, 3, 4, ' '},
+ {14545, 4, 2, 2, ' '},
+ {13623, 4, 0, 6, 'a'},
+ {12340, 3, 3, 5, 'a'},
+ {11723, 3, 3, 3, 'a'},
+ {11403, 3, 3, 2, ' '},
+ {11159, 3, 3, 0, 'a'},
+ {10505, 3, 2, 2, 'a'},
+ {9947, 3, 1, 3, ' '},
+ {8606, 2, 4, 3, ' '},
+ {0, 0, 0, 0, ' '} // terminator
+ };
+
+ static RealmBuildInfo const PreBcAcceptedClientBuilds[] =
{
- int accepted_versions[] = PRE_BC_ACCEPTED_CLIENT_BUILD;
+ {6005, 1, 12, 2, ' '},
+ {5875, 1, 12, 1, ' '},
+ {0, 0, 0, 0, ' '} // terminator
+ };
- for (int i = 0; accepted_versions[i]; ++i)
- if (build == accepted_versions[i])
+ bool IsPreBCAcceptedClientBuild(int build)
+ {
+ for (int i = 0; PreBcAcceptedClientBuilds[i].Build; ++i)
+ if (PreBcAcceptedClientBuilds[i].Build == build)
return true;
return false;
@@ -32,10 +53,8 @@ namespace AuthHelper
bool IsPostBCAcceptedClientBuild(int build)
{
- int accepted_versions[] = POST_BC_ACCEPTED_CLIENT_BUILD;
-
- for (int i = 0; accepted_versions[i]; ++i)
- if (build == accepted_versions[i])
+ for (int i = 0; PostBcAcceptedClientBuilds[i].Build; ++i)
+ if (PostBcAcceptedClientBuilds[i].Build == build)
return true;
return false;
@@ -45,4 +64,17 @@ namespace AuthHelper
{
return (IsPostBCAcceptedClientBuild(build) || IsPreBCAcceptedClientBuild(build));
}
+
+ RealmBuildInfo const* GetBuildInfo(int build)
+ {
+ for (int i = 0; PostBcAcceptedClientBuilds[i].Build; ++i)
+ if (PostBcAcceptedClientBuilds[i].Build == build)
+ return &PostBcAcceptedClientBuilds[i];
+
+ for (int i = 0; PreBcAcceptedClientBuilds[i].Build; ++i)
+ if (PreBcAcceptedClientBuilds[i].Build == build)
+ return &PreBcAcceptedClientBuilds[i];
+
+ return NULL;
+ }
};
diff --git a/src/server/authserver/Authentication/AuthCodes.h b/src/server/authserver/Authentication/AuthCodes.h
index f940d459d40..148225377ff 100755
--- a/src/server/authserver/Authentication/AuthCodes.h
+++ b/src/server/authserver/Authentication/AuthCodes.h
@@ -65,9 +65,6 @@ enum LoginResult
LOGIN_LOCKED_ENFORCED = 0x10,
};
-#define POST_BC_ACCEPTED_CLIENT_BUILD {12340, 11723, 11403, 11159, 10571, 10505, 10146, 9947, 8606, 0}
-#define PRE_BC_ACCEPTED_CLIENT_BUILD {5875, 6005, 0}
-
enum ExpansionFlags
{
POST_BC_EXP_FLAG = 0x2,
@@ -75,8 +72,18 @@ enum ExpansionFlags
NO_VALID_EXP_FLAG = 0x0
};
+struct RealmBuildInfo
+{
+ int Build;
+ int MajorVersion;
+ int MinorVersion;
+ int BugfixVersion;
+ int HotfixVersion;
+};
+
namespace AuthHelper
{
+ RealmBuildInfo const* GetBuildInfo(int build);
bool IsAcceptedClientBuild(int build);
bool IsPostBCAcceptedClientBuild(int build);
bool IsPreBCAcceptedClientBuild(int build);
diff --git a/src/server/authserver/Main.cpp b/src/server/authserver/Main.cpp
index f5a3c7cf7e1..ed0fa9ab06a 100755
--- a/src/server/authserver/Main.cpp
+++ b/src/server/authserver/Main.cpp
@@ -80,7 +80,7 @@ extern int main(int argc, char **argv)
{
if (++c >= argc)
{
- sLog->outError(LOG_FILTER_AUTHSERVER, "Runtime-Error: -c option requires an input argument");
+ printf("Runtime-Error: -c option requires an input argument");
usage(argv[0]);
return 1;
}
@@ -92,8 +92,8 @@ extern int main(int argc, char **argv)
if (!ConfigMgr::Load(cfg_file))
{
- sLog->outError(LOG_FILTER_AUTHSERVER, "Invalid or missing configuration file : %s", cfg_file);
- sLog->outError(LOG_FILTER_AUTHSERVER, "Verify that the file exists and has \'[authserver]\' written in the top of the file!");
+ printf("Invalid or missing configuration file : %s", cfg_file);
+ printf("Verify that the file exists and has \'[authserver]\' written in the top of the file!");
return 1;
}
@@ -141,10 +141,16 @@ extern int main(int argc, char **argv)
// Launch the listening network socket
RealmAcceptor acceptor;
- uint16 rmport = ConfigMgr::GetIntDefault("RealmServerPort", 3724);
+ int32 rmport = ConfigMgr::GetIntDefault("RealmServerPort", 3724);
+ if (rmport < 0 || rmport > 0xFFFF)
+ {
+ sLog->outError(LOG_FILTER_AUTHSERVER, "Specified port out of allowed range (1-65535)");
+ return 1;
+ }
+
std::string bind_ip = ConfigMgr::GetStringDefault("BindIP", "0.0.0.0");
- ACE_INET_Addr bind_addr(rmport, bind_ip.c_str());
+ ACE_INET_Addr bind_addr(uint16(rmport), bind_ip.c_str());
if (acceptor.open(bind_addr, ACE_Reactor::instance(), ACE_NONBLOCK) == -1)
{
@@ -238,14 +244,14 @@ bool StartDB()
return false;
}
- uint8 worker_threads = ConfigMgr::GetIntDefault("LoginDatabase.WorkerThreads", 1);
+ int32 worker_threads = ConfigMgr::GetIntDefault("LoginDatabase.WorkerThreads", 1);
if (worker_threads < 1 || worker_threads > 32)
{
sLog->outError(LOG_FILTER_AUTHSERVER, "Improper value specified for LoginDatabase.WorkerThreads, defaulting to 1.");
worker_threads = 1;
}
- uint8 synch_threads = ConfigMgr::GetIntDefault("LoginDatabase.SynchThreads", 1);
+ int32 synch_threads = ConfigMgr::GetIntDefault("LoginDatabase.SynchThreads", 1);
if (synch_threads < 1 || synch_threads > 32)
{
sLog->outError(LOG_FILTER_AUTHSERVER, "Improper value specified for LoginDatabase.SynchThreads, defaulting to 1.");
@@ -253,7 +259,7 @@ bool StartDB()
}
// NOTE: While authserver is singlethreaded you should keep synch_threads == 1. Increasing it is just silly since only 1 will be used ever.
- if (!LoginDatabase.Open(dbstring.c_str(), worker_threads, synch_threads))
+ if (!LoginDatabase.Open(dbstring.c_str(), uint8(worker_threads), uint8(synch_threads)))
{
sLog->outError(LOG_FILTER_AUTHSERVER, "Cannot connect to database");
return false;
diff --git a/src/server/authserver/Server/AuthSocket.cpp b/src/server/authserver/Server/AuthSocket.cpp
index 0794d9a802a..fc4d4dfcc9b 100755
--- a/src/server/authserver/Server/AuthSocket.cpp
+++ b/src/server/authserver/Server/AuthSocket.cpp
@@ -196,7 +196,7 @@ const AuthHandler table[] =
Patcher PatchesCache;
// Constructor - set the N and g values for SRP6
-AuthSocket::AuthSocket(RealmSocket& socket) : socket_(socket)
+AuthSocket::AuthSocket(RealmSocket& socket) : pPatch(NULL), socket_(socket)
{
N.SetHexStr("894B645E89E1535BBDAD5B8B290650530801B18EBFBF5E8FAB3C82872A3E9BB7");
g.SetDword(7);
@@ -343,7 +343,7 @@ bool AuthSocket::_HandleLogonChallenge()
_login = (const char*)ch->I;
_build = ch->build;
- _expversion = (AuthHelper::IsPostBCAcceptedClientBuild(_build) ? POST_BC_EXP_FLAG : NO_VALID_EXP_FLAG) | (AuthHelper::IsPreBCAcceptedClientBuild(_build) ? PRE_BC_EXP_FLAG : NO_VALID_EXP_FLAG);
+ _expversion = uint8(AuthHelper::IsPostBCAcceptedClientBuild(_build) ? POST_BC_EXP_FLAG : (AuthHelper::IsPreBCAcceptedClientBuild(_build) ? PRE_BC_EXP_FLAG : NO_VALID_EXP_FLAG));
_os = (const char*)ch->os;
if (_os.size() > 4)
@@ -352,19 +352,19 @@ bool AuthSocket::_HandleLogonChallenge()
// Restore string order as its byte order is reversed
std::reverse(_os.begin(), _os.end());
- pkt << (uint8)AUTH_LOGON_CHALLENGE;
- pkt << (uint8)0x00;
+ pkt << uint8(AUTH_LOGON_CHALLENGE);
+ pkt << uint8(0x00);
// Verify that this IP is not in the ip_banned table
LoginDatabase.Execute(LoginDatabase.GetPreparedStatement(LOGIN_DEL_EXPIRED_IP_BANS));
- const std::string& ip_address = socket().getRemoteAddress();
- PreparedStatement *stmt = LoginDatabase.GetPreparedStatement(LOGIN_SEL_IP_BANNED);
+ std::string const& ip_address = socket().getRemoteAddress();
+ PreparedStatement* stmt = LoginDatabase.GetPreparedStatement(LOGIN_SEL_IP_BANNED);
stmt->setString(0, ip_address);
PreparedQueryResult result = LoginDatabase.Query(stmt);
if (result)
{
- pkt << (uint8)WOW_FAIL_BANNED;
+ pkt << uint8(WOW_FAIL_BANNED);
sLog->outDebug(LOG_FILTER_AUTHSERVER, "'%s:%d' [AuthChallenge] Banned ip tries to login!",socket().getRemoteAddress().c_str(), socket().getRemotePort());
}
else
@@ -409,14 +409,14 @@ bool AuthSocket::_HandleLogonChallenge()
PreparedQueryResult banresult = LoginDatabase.Query(stmt);
if (banresult)
{
- if ((*banresult)[0].GetUInt64() == (*banresult)[1].GetUInt64())
+ if ((*banresult)[0].GetUInt32() == (*banresult)[1].GetUInt32())
{
- pkt << (uint8)WOW_FAIL_BANNED;
+ pkt << uint8(WOW_FAIL_BANNED);
sLog->outDebug(LOG_FILTER_AUTHSERVER, "'%s:%d' [AuthChallenge] Banned account %s tried to login!", socket().getRemoteAddress().c_str(), socket().getRemotePort(), _login.c_str ());
}
else
{
- pkt << (uint8)WOW_FAIL_SUSPENDED;
+ pkt << uint8(WOW_FAIL_SUSPENDED);
sLog->outDebug(LOG_FILTER_AUTHSERVER, "'%s:%d' [AuthChallenge] Temporarily banned account %s tried to login!", socket().getRemoteAddress().c_str(), socket().getRemotePort(), _login.c_str ());
}
}
@@ -450,7 +450,10 @@ bool AuthSocket::_HandleLogonChallenge()
unk3.SetRand(16 * 8);
// Fill the response packet with the result
- pkt << uint8(WOW_SUCCESS);
+ if (AuthHelper::IsAcceptedClientBuild(_build))
+ pkt << uint8(WOW_SUCCESS);
+ else
+ pkt << uint8(WOW_FAIL_VERSION_INVALID);
// B may be calculated < 32B so we force minimal length to 32B
pkt.append(B.AsByteArray(32), 32); // 32 bytes
@@ -749,7 +752,7 @@ bool AuthSocket::_HandleReconnectChallenge()
// Reinitialize build, expansion and the account securitylevel
_build = ch->build;
- _expversion = (AuthHelper::IsPostBCAcceptedClientBuild(_build) ? POST_BC_EXP_FLAG : NO_VALID_EXP_FLAG) | (AuthHelper::IsPreBCAcceptedClientBuild(_build) ? PRE_BC_EXP_FLAG : NO_VALID_EXP_FLAG);
+ _expversion = uint8(AuthHelper::IsPostBCAcceptedClientBuild(_build) ? POST_BC_EXP_FLAG : (AuthHelper::IsPreBCAcceptedClientBuild(_build) ? PRE_BC_EXP_FLAG : NO_VALID_EXP_FLAG));
_os = (const char*)ch->os;
if (_os.size() > 4)
@@ -766,11 +769,11 @@ bool AuthSocket::_HandleReconnectChallenge()
// Sending response
ByteBuffer pkt;
- pkt << (uint8)AUTH_RECONNECT_CHALLENGE;
- pkt << (uint8)0x00;
+ pkt << uint8(AUTH_RECONNECT_CHALLENGE);
+ pkt << uint8(0x00);
_reconnectProof.SetRand(16 * 8);
pkt.append(_reconnectProof.AsByteArray(16), 16); // 16 bytes random
- pkt << (uint64)0x00 << (uint64)0x00; // 16 bytes zeros
+ pkt << uint64(0x00) << uint64(0x00); // 16 bytes zeros
socket().send((char const*)pkt.contents(), pkt.size());
return true;
}
@@ -800,9 +803,9 @@ bool AuthSocket::_HandleReconnectProof()
{
// Sending response
ByteBuffer pkt;
- pkt << (uint8)AUTH_RECONNECT_PROOF;
- pkt << (uint8)0x00;
- pkt << (uint16)0x00; // 2 bytes zeros
+ pkt << uint8(AUTH_RECONNECT_PROOF);
+ pkt << uint8(0x00);
+ pkt << uint16(0x00); // 2 bytes zeros
socket().send((char const*)pkt.contents(), pkt.size());
_authed = true;
return true;
@@ -849,73 +852,87 @@ bool AuthSocket::_HandleRealmList()
for (RealmList::RealmMap::const_iterator i = sRealmList->begin(); i != sRealmList->end(); ++i)
{
// don't work with realms which not compatible with the client
- if ((_expversion & POST_BC_EXP_FLAG) && i->second.gamebuild != _build)
- continue;
- else if ((_expversion & PRE_BC_EXP_FLAG) && !AuthHelper::IsPreBCAcceptedClientBuild(i->second.gamebuild))
+ bool okBuild = ((_expversion & POST_BC_EXP_FLAG) && i->second.gamebuild == _build) || ((_expversion & PRE_BC_EXP_FLAG) && !AuthHelper::IsPreBCAcceptedClientBuild(i->second.gamebuild));
+
+ // No SQL injection. id of realm is controlled by the database.
+ uint32 flag = i->second.flag;
+ RealmBuildInfo const* buildInfo = AuthHelper::GetBuildInfo(i->second.gamebuild);
+ if (!okBuild)
+ {
+ if (!buildInfo)
continue;
- uint8 AmountOfCharacters;
+ flag |= REALM_FLAG_OFFLINE | REALM_FLAG_SPECIFYBUILD; // tell the client what build the realm is for
+ }
- // No SQL injection. id of realm is controlled by the database.
+ if (!buildInfo)
+ flag &= ~REALM_FLAG_SPECIFYBUILD;
+
+ std::string name = i->first;
+ if (_expversion & PRE_BC_EXP_FLAG && flag & REALM_FLAG_SPECIFYBUILD)
+ {
+ std::ostringstream ss;
+ ss << name << " (" << buildInfo->MajorVersion << '.' << buildInfo->MinorVersion << '.' << buildInfo->BugfixVersion << ')';
+ name = ss.str();
+ }
+
+ uint8 lock = (i->second.allowedSecurityLevel > _accountSecurityLevel) ? 1 : 0;
+
+ uint8 AmountOfCharacters = 0;
stmt = LoginDatabase.GetPreparedStatement(LOGIN_SEL_NUM_CHARS_ON_REALM);
stmt->setUInt32(0, i->second.m_ID);
stmt->setUInt32(1, id);
result = LoginDatabase.Query(stmt);
if (result)
AmountOfCharacters = (*result)[0].GetUInt8();
- else
- AmountOfCharacters = 0;
-
- uint8 lock = (i->second.allowedSecurityLevel > _accountSecurityLevel) ? 1 : 0;
pkt << i->second.icon; // realm type
- if ( _expversion & POST_BC_EXP_FLAG ) // only 2.x and 3.x clients
+ if (_expversion & POST_BC_EXP_FLAG) // only 2.x and 3.x clients
pkt << lock; // if 1, then realm locked
- pkt << uint8(i->second.flag); // RealmFlags
- pkt << i->first;
+ pkt << uint8(flag); // RealmFlags
+ pkt << name;
pkt << i->second.address;
pkt << i->second.populationLevel;
pkt << AmountOfCharacters;
pkt << i->second.timezone; // realm category
if (_expversion & POST_BC_EXP_FLAG) // 2.x and 3.x clients
- pkt << (uint8)0x2C; // unk, may be realm number/id?
+ pkt << uint8(0x2C); // unk, may be realm number/id?
else
- pkt << (uint8)0x0; // 1.12.1 and 1.12.2 clients
+ pkt << uint8(0x0); // 1.12.1 and 1.12.2 clients
- if (i->second.flag & REALM_FLAG_SPECIFYBUILD)
+ if (_expversion & POST_BC_EXP_FLAG && flag & REALM_FLAG_SPECIFYBUILD)
{
- // TODO: Make this customizable
- pkt << uint8(3);
- pkt << uint8(3);
- pkt << uint8(5);
- pkt << uint16(12340);
+ pkt << uint8(buildInfo->MajorVersion);
+ pkt << uint8(buildInfo->MinorVersion);
+ pkt << uint8(buildInfo->BugfixVersion);
+ pkt << uint16(buildInfo->Build);
}
++RealmListSize;
}
- if ( _expversion & POST_BC_EXP_FLAG ) // 2.x and 3.x clients
+ if (_expversion & POST_BC_EXP_FLAG) // 2.x and 3.x clients
{
- pkt << (uint8)0x10;
- pkt << (uint8)0x00;
+ pkt << uint8(0x10);
+ pkt << uint8(0x00);
}
else // 1.12.1 and 1.12.2 clients
{
- pkt << (uint8)0x00;
- pkt << (uint8)0x02;
+ pkt << uint8(0x00);
+ pkt << uint8(0x02);
}
// make a ByteBuffer which stores the RealmList's size
ByteBuffer RealmListSizeBuffer;
- RealmListSizeBuffer << (uint32)0;
+ RealmListSizeBuffer << uint32(0);
if (_expversion & POST_BC_EXP_FLAG) // only 2.x and 3.x clients
- RealmListSizeBuffer << (uint16)RealmListSize;
+ RealmListSizeBuffer << uint16(RealmListSize);
else
- RealmListSizeBuffer << (uint32)RealmListSize;
+ RealmListSizeBuffer << uint32(RealmListSize);
ByteBuffer hdr;
- hdr << (uint8) REALM_LIST;
- hdr << (uint16)(pkt.size() + RealmListSizeBuffer.size());
+ hdr << uint8(REALM_LIST);
+ hdr << uint16(pkt.size() + RealmListSizeBuffer.size());
hdr.append(RealmListSizeBuffer); // append RealmList's size buffer
hdr.append(pkt); // append realms in the realmlist
@@ -929,7 +946,7 @@ bool AuthSocket::_HandleXferResume()
{
sLog->outDebug(LOG_FILTER_AUTHSERVER, "Entering _HandleXferResume");
// Check packet length and patch existence
- if (socket().recv_len() < 9 || !pPatch)
+ if (socket().recv_len() < 9 || !pPatch) // FIXME: pPatch is never used
{
sLog->outError(LOG_FILTER_AUTHSERVER, "Error while resuming patch transfer (wrong packet)");
return false;
@@ -983,7 +1000,9 @@ PatcherRunnable::PatcherRunnable(class AuthSocket* as)
}
// Send content of patch file to the client
-void PatcherRunnable::run() {}
+void PatcherRunnable::run()
+{
+}
// Preload MD5 hashes of existing patch files on server
#ifndef _WIN32
diff --git a/src/server/authserver/authserver.conf.dist b/src/server/authserver/authserver.conf.dist
index d77b40e6591..67d22c49da1 100644
--- a/src/server/authserver/authserver.conf.dist
+++ b/src/server/authserver/authserver.conf.dist
@@ -9,6 +9,7 @@
# EXAMPLE CONFIG
# AUTH SERVER SETTINGS
# MYSQL SETTINGS
+# LOGGING SYSTEM SETTINGS
#
###################################################################################################
@@ -148,125 +149,105 @@ LoginDatabase.WorkerThreads = 1
###################################################################################################
#
-# Logging system options.
-# Note: As it uses dynamic option naming, all options related to one appender or logger are grouped.
-#
-#
-# Appender config values: Given a appender "name" the following options
-# can be read:
-#
-# Appender.name.Type
-# Description: Type of appender. Extra appender config options
-# will be read depending on this value
-# Default: 0 - (None)
-# 1 - (Console)
-# 2 - (File)
-# 3 - (DB)
-#
-# Appender.name.Level
-# Description: Appender level of logging
-# Default: 0 - (Disabled)
-# 1 - (Trace)
-# 2 - (Debug)
-# 3 - (Info)
-# 4 - (Warn)
-# 5 - (Error)
-# 6 - (Fatal)
-#
-# Appender.name.Colors
-# Description: Colors for log messages
-# (Format: "fatal error warn info debug trace").
-# (Only used with Type = 1)
-# Default: "" - no colors
-# Colors: 0 - BLACK
-# 1 - RED
-# 2 - GREEN
-# 3 - BROWN
-# 4 - BLUE
-# 5 - MAGENTA
-# 6 - CYAN
-# 7 - GREY
-# 8 - YELLOW
-# 9 - LRED
-# 10 - LGREEN
-# 11 - LBLUE
-# 12 - LMAGENTA
-# 13 - LCYAN
-# 14 - WHITE
-# Example: "13 11 9 5 3 1"
-#
-# Appender.name.File
-# Description: Name of the file
-# Allows to use one "%u" to create dynamic files
-# (Only used with Type = 2)
-#
-# Appender.name.Mode
-# Description: Mode to open the file
-# (Only used with Type = 2)
-# Default: a - (Append)
-# w - (Overwrite)
-#
-# Appender.name.Backup
-# Description: Make a backup of existing file before overwrite
-# (Only used with Mode = w)
-# Default: 0 - false
-# 1 - true
-#
-# Appender.name.Timestamp
-# Description: Append timestamp to the log file name.
-# Logname_YYYY-MM-DD_HH-MM-SS.Ext for Logname.Ext
-# (Only used with Type = 2)
-#
-# Logger config values: Given a logger "name" the following options
-# can be read:
-#
-# Logger.name.Type
-# Description: Type of logger. Logs anything related to...
-# If no logger with type = 0 exists core will create
-# it but disabled. Logger with type = 0 is the
-# default one, used when there is no other specific
-# logger configured for other logger types
-# Default: 0 - Default. Each type that has no config will
-# rely on this one. Core will create this logger
-# (disabled) if it's not configured
-# 7 - Network input/output,
-# 30 - Authserver
-#
-# Logger.name.Level
-# Description: Logger level of logging
-# Default: 0 - (Disabled)
-# 1 - (Trace)
-# 2 - (Debug)
-# 3 - (Info)
-# 4 - (Warn)
-# 5 - (Error)
-# 6 - (Fatal)
-#
-# Logger.name.Appenders
-# Description: List of appenders linked to logger
+# LOGGING SYSTEM SETTINGS
+#
+# Appender config values: Given a appender "name"
+# Appender.name
+# Description: Defines 'where to log'
+# Format: Type,LogLevel,Flags,optional1,optional2
+#
+# Type
+# 0 - (None)
+# 1 - (Console)
+# 2 - (File)
+# 3 - (DB)
+#
+# LogLevel
+# 0 - (Disabled)
+# 1 - (Trace)
+# 2 - (Debug)
+# 3 - (Info)
+# 4 - (Warn)
+# 5 - (Error)
+# 6 - (Fatal)
+#
+# Flags:
+# 0 - None
+# 1 - Prefix Timestamp to the text
+# 2 - Prefix Log Level to the text
+# 4 - Prefix Log Filter type to the text
+# 8 - Append timestamp to the log file name. Format: YYYY-MM-DD_HH-MM-SS (Only used with Type = 2)
+# 16 - Make a backup of existing file before overwrite (Only used with Mode = w)
+#
+# Colors (read as optional1 if Type = Console)
+# Format: "fatal error warn info debug trace"
+# 0 - BLACK
+# 1 - RED
+# 2 - GREEN
+# 3 - BROWN
+# 4 - BLUE
+# 5 - MAGENTA
+# 6 - CYAN
+# 7 - GREY
+# 8 - YELLOW
+# 9 - LRED
+# 10 - LGREEN
+# 11 - LBLUE
+# 12 - LMAGENTA
+# 13 - LCYAN
+# 14 - WHITE
+# Example: "13 11 9 5 3 1"
+#
+# File: Name of the file (read as optional1 if Type = File)
+# Allows to use one "%s" to create dynamic files
+#
+# Mode: Mode to open the file (read as optional2 if Type = File)
+# a - (Append)
+# w - (Overwrite)
+#
+
+Appender.Console=1,2,0
+Appender.Auth=2,2,0,Auth.log,w
+
+# LogLevel
+# 0 - (Disabled)
+# 1 - (Trace)
+# 2 - (Debug)
+# 3 - (Info)
+# 4 - (Warn)
+# 5 - (Error)
+# 6 - (Fatal)
+#
+# AppenderList: List of appenders linked to logger
# (Using spaces as separator).
#
# Appenders
# Description: List of Appenders to read from config
# (Using spaces as separator).
-# Default: "Console Auth"
+# Default: "Console Server"
+
+Appenders=Console Auth
+
+# Logger config values: Given a logger "name"
+# Logger.name
+# Description: Defines 'What to log'
+# Format: Type,LogLevel,AppenderList
+# Type
+# 0 - Default. Each type that has no config will
+# rely on this one. Core will create this logger
+# (disabled) if it's not configured
+# 7 - Network input/output,
+# 30 - Authserver
+
+Logger.Root=0,3,Console Auth
+
#
# Loggers
# Description: List of Loggers to read from config
# (Using spaces as separator).
# Default: "root"
-Loggers=root
-Appenders=Console Auth
-
-Appender.Console.Type=1
-Appender.Console.Level=2
+Loggers=Root
-Appender.Auth.Type=2
-Appender.Auth.Level=2
-Appender.Auth.File=Auth.log
-Appender.Auth.Mode=w
-
-Logger.root.Type=0
-Logger.root.Level=3
-Logger.root.Appenders=Console Auth
+#
+################################################################################################### \ No newline at end of file
diff --git a/src/server/collision/Management/IVMapManager.h b/src/server/collision/Management/IVMapManager.h
index a645e88ef05..7cf296625f4 100755
--- a/src/server/collision/Management/IVMapManager.h
+++ b/src/server/collision/Management/IVMapManager.h
@@ -35,7 +35,7 @@ namespace VMAP
{
VMAP_LOAD_RESULT_ERROR,
VMAP_LOAD_RESULT_OK,
- VMAP_LOAD_RESULT_IGNORED,
+ VMAP_LOAD_RESULT_IGNORED
};
#define VMAP_INVALID_HEIGHT -100000.0f // for check
diff --git a/src/server/collision/Maps/MapTree.cpp b/src/server/collision/Maps/MapTree.cpp
index 6489ddd7a4f..89412a69c33 100644
--- a/src/server/collision/Maps/MapTree.cpp
+++ b/src/server/collision/Maps/MapTree.cpp
@@ -124,8 +124,8 @@ namespace VMAP
return intersectionCallBack.result;
}
- StaticMapTree::StaticMapTree(uint32 mapID, const std::string &basePath):
- iMapID(mapID), iTreeValues(0), iBasePath(basePath)
+ StaticMapTree::StaticMapTree(uint32 mapID, const std::string &basePath)
+ : iMapID(mapID), iIsTiled(false), iTreeValues(0), iBasePath(basePath)
{
if (iBasePath.length() > 0 && iBasePath[iBasePath.length()-1] != '/' && iBasePath[iBasePath.length()-1] != '\\')
{
diff --git a/src/server/collision/Maps/TileAssembler.cpp b/src/server/collision/Maps/TileAssembler.cpp
index 3bfed7d322d..434522d3515 100644
--- a/src/server/collision/Maps/TileAssembler.cpp
+++ b/src/server/collision/Maps/TileAssembler.cpp
@@ -54,11 +54,8 @@ namespace VMAP
//=================================================================
TileAssembler::TileAssembler(const std::string& pSrcDirName, const std::string& pDestDirName)
+ : iDestDir(pDestDirName), iSrcDir(pSrcDirName), iFilterMethod(NULL), iCurrentUniqueNameId(0)
{
- iCurrentUniqueNameId = 0;
- iFilterMethod = NULL;
- iSrcDir = pSrcDirName;
- iDestDir = pDestDirName;
//mkdir(iDestDir);
//init();
}
@@ -336,9 +333,15 @@ namespace VMAP
void TileAssembler::exportGameobjectModels()
{
FILE* model_list = fopen((iSrcDir + "/" + "temp_gameobject_models").c_str(), "rb");
+ if (!model_list)
+ return;
+
FILE* model_list_copy = fopen((iDestDir + "/" + GAMEOBJECT_MODELS).c_str(), "wb");
- if (!model_list || !model_list_copy)
+ if (!model_list_copy)
+ {
+ fclose(model_list);
return;
+ }
uint32 name_length, displayId;
char buff[500];
diff --git a/src/server/collision/Models/GameObjectModel.cpp b/src/server/collision/Models/GameObjectModel.cpp
index 6045cbc4c9c..6cb0f90d98e 100644
--- a/src/server/collision/Models/GameObjectModel.cpp
+++ b/src/server/collision/Models/GameObjectModel.cpp
@@ -83,7 +83,7 @@ void LoadGameObjectModelList()
}
fclose(model_list_file);
- sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded %u GameObject models in %u ms", uint32(model_list.size()), GetMSTimeDiffToNow(oldMSTime));
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u GameObject models in %u ms", uint32(model_list.size()), GetMSTimeDiffToNow(oldMSTime));
}
diff --git a/src/server/collision/Models/GameObjectModel.h b/src/server/collision/Models/GameObjectModel.h
index 0bb6c0f47bc..78a0e876676 100644
--- a/src/server/collision/Models/GameObjectModel.h
+++ b/src/server/collision/Models/GameObjectModel.h
@@ -61,6 +61,8 @@ public:
void disable() { phasemask = 0;}
void enable(uint32 ph_mask) { phasemask = ph_mask;}
+ bool isEnabled() const {return phasemask != 0;}
+
bool intersectRay(const G3D::Ray& Ray, float& MaxDist, bool StopAtFirstHit, uint32 ph_mask) const;
static GameObjectModel* Create(const GameObject& go);
diff --git a/src/server/collision/Models/ModelInstance.h b/src/server/collision/Models/ModelInstance.h
index 1118b654578..b0189ad8542 100755
--- a/src/server/collision/Models/ModelInstance.h
+++ b/src/server/collision/Models/ModelInstance.h
@@ -63,7 +63,7 @@ namespace VMAP
class ModelInstance: public ModelSpawn
{
public:
- ModelInstance(): iModel(0) {}
+ ModelInstance(): iInvScale(0.0f), iModel(0) {}
ModelInstance(const ModelSpawn &spawn, WorldModel* model);
void setUnloaded() { iModel = 0; }
bool intersectRay(const G3D::Ray& pRay, float& pMaxDist, bool pStopAtFirstHit) const;
diff --git a/src/server/game/AI/CoreAI/CombatAI.cpp b/src/server/game/AI/CoreAI/CombatAI.cpp
index 7d7a27fce13..5ab5f99310a 100755
--- a/src/server/game/AI/CoreAI/CombatAI.cpp
+++ b/src/server/game/AI/CoreAI/CombatAI.cpp
@@ -111,6 +111,11 @@ void CombatAI::UpdateAI(const uint32 diff)
DoMeleeAttackIfReady();
}
+void CombatAI::SpellInterrupted(uint32 spellId, uint32 unTimeMs)
+{
+ events.RescheduleEvent(spellId, unTimeMs);
+}
+
/////////////////
//CasterAI
/////////////////
diff --git a/src/server/game/AI/CoreAI/CombatAI.h b/src/server/game/AI/CoreAI/CombatAI.h
index ad98cec0779..fa31e57d780 100755
--- a/src/server/game/AI/CoreAI/CombatAI.h
+++ b/src/server/game/AI/CoreAI/CombatAI.h
@@ -46,6 +46,7 @@ class CombatAI : public CreatureAI
void EnterCombat(Unit* who);
void JustDied(Unit* killer);
void UpdateAI(const uint32 diff);
+ void SpellInterrupted(uint32 spellId, uint32 unTimeMs);
static int Permissible(const Creature*);
protected:
EventMap events;
diff --git a/src/server/game/AI/CoreAI/GameObjectAI.h b/src/server/game/AI/CoreAI/GameObjectAI.h
index fbc8675cc47..6dfea9ac158 100644
--- a/src/server/game/AI/CoreAI/GameObjectAI.h
+++ b/src/server/game/AI/CoreAI/GameObjectAI.h
@@ -39,6 +39,11 @@ class GameObjectAI
virtual void Reset() {};
+ // Pass parameters between AI
+ virtual void DoAction(const int32 /*param = 0 */) {}
+ virtual void SetGUID(const uint64& /*guid*/, int32 /*id = 0 */) {}
+ virtual uint64 GetGUID(int32 /*id = 0 */) { return 0; }
+
static int Permissible(GameObject const* go);
virtual bool GossipHello(Player* /*player*/) { return false; }
diff --git a/src/server/game/AI/CoreAI/UnitAI.h b/src/server/game/AI/CoreAI/UnitAI.h
index 593f0d15e18..119cfd3d35e 100755
--- a/src/server/game/AI/CoreAI/UnitAI.h
+++ b/src/server/game/AI/CoreAI/UnitAI.h
@@ -35,7 +35,7 @@ enum GeneralScriptTexts
EMOTE_GENERIC_FRENZY = -1000002,
EMOTE_GENERIC_ENRAGED = -1000003,
EMOTE_GENERIC_BERSERK = -1000004,
- EMOTE_GENERIC_BERSERK_RAID = -1000005, // RaidBossEmote version of the previous one
+ EMOTE_GENERIC_BERSERK_RAID = -1000005 // RaidBossEmote version of the previous one
};
//Selection method used by SelectTarget
@@ -45,7 +45,7 @@ enum SelectAggroTarget
SELECT_TARGET_TOPAGGRO, //Selects targes from top aggro to bottom
SELECT_TARGET_BOTTOMAGGRO, //Selects targets from bottom aggro to top
SELECT_TARGET_NEAREST,
- SELECT_TARGET_FARTHEST,
+ SELECT_TARGET_FARTHEST
};
// default predicate function to select target based on distance, player and/or aura criteria
@@ -242,6 +242,10 @@ class UnitAI
// Called when the unit heals
virtual void HealDone(Unit* /*done_to*/, uint32& /*addhealth*/) {}
+ /// Called when a spell is interrupted by Spell::EffectInterruptCast
+ /// Use to reschedule next planned cast of spell.
+ virtual void SpellInterrupted(uint32 /*spellId*/, uint32 /*unTimeMs*/) {}
+
void AttackStartCaster(Unit* victim, float dist);
void DoAddAuraToAllHostilePlayers(uint32 spellid);
diff --git a/src/server/game/AI/CreatureAI.h b/src/server/game/AI/CreatureAI.h
index 68752b82e7f..d3ad27935ca 100755
--- a/src/server/game/AI/CreatureAI.h
+++ b/src/server/game/AI/CreatureAI.h
@@ -45,7 +45,7 @@ enum SelectTargetType
SELECT_TARGET_SINGLE_FRIEND, //Only Single Friend
SELECT_TARGET_AOE_FRIEND, //Only AoE Friend
- SELECT_TARGET_ANY_FRIEND, //AoE or Single Friend
+ SELECT_TARGET_ANY_FRIEND //AoE or Single Friend
};
//Spell Effects used by SelectSpell
@@ -54,7 +54,7 @@ enum SelectEffect
SELECT_EFFECT_DONTCARE = 0, //All spell effects allowed
SELECT_EFFECT_DAMAGE, //Spell does damage
SELECT_EFFECT_HEALING, //Spell does healing
- SELECT_EFFECT_AURA, //Spell applies an aura
+ SELECT_EFFECT_AURA //Spell applies an aura
};
enum SCEquip
diff --git a/src/server/game/AI/CreatureAIImpl.h b/src/server/game/AI/CreatureAIImpl.h
index d097adf38ec..981ac1f5f16 100755
--- a/src/server/game/AI/CreatureAIImpl.h
+++ b/src/server/game/AI/CreatureAIImpl.h
@@ -505,14 +505,14 @@ enum AITarget
AITARGET_ENEMY,
AITARGET_ALLY,
AITARGET_BUFF,
- AITARGET_DEBUFF,
+ AITARGET_DEBUFF
};
enum AICondition
{
AICOND_AGGRO,
AICOND_COMBAT,
- AICOND_DIE,
+ AICOND_DIE
};
#define AI_DEFAULT_COOLDOWN 5000
diff --git a/src/server/game/AI/CreatureAISelector.cpp b/src/server/game/AI/CreatureAISelector.cpp
index 2d69f1e0243..4ccaa174e67 100755
--- a/src/server/game/AI/CreatureAISelector.cpp
+++ b/src/server/game/AI/CreatureAISelector.cpp
@@ -137,6 +137,11 @@ namespace FactorySelector
ai_factory = ai_registry.GetRegistryItem(go->GetAIName());
+ // scriptname in db
+ if (!ai_factory)
+ if (GameObjectAI* scriptedAI = sScriptMgr->GetGameObjectAI(go))
+ return scriptedAI;
+
//future goAI types go here
std::string ainame = (ai_factory == NULL || go->GetScriptId()) ? "NullGameObjectAI" : ai_factory->key();
diff --git a/src/server/game/AI/EventAI/CreatureEventAI.cpp b/src/server/game/AI/EventAI/CreatureEventAI.cpp
index aa14bc1b56e..951a035628a 100755
--- a/src/server/game/AI/EventAI/CreatureEventAI.cpp
+++ b/src/server/game/AI/EventAI/CreatureEventAI.cpp
@@ -1317,6 +1317,10 @@ bool CreatureEventAI::CanCast(Unit* target, SpellInfo const* spell, bool trigger
if (!me->IsInRange(target, spell->GetMinRange(false), spell->GetMaxRange(false)))
return false;
+ //Spell is on cooldown
+ if (me->HasSpellCooldown(spell->Id))
+ return false;
+
return true;
}
diff --git a/src/server/game/AI/EventAI/CreatureEventAI.h b/src/server/game/AI/EventAI/CreatureEventAI.h
index b9e1ae32be4..da5f0b084cf 100755
--- a/src/server/game/AI/EventAI/CreatureEventAI.h
+++ b/src/server/game/AI/EventAI/CreatureEventAI.h
@@ -60,7 +60,7 @@ enum EventAI_Type
EVENT_T_TARGET_BUFFED = 24, // Param1 = SpellID, Param2 = Number of Time STacked, Param3/4 Repeat Min/Max
EVENT_T_RESET = 35, // Is it called after combat, when the creature respawn and spawn. -- TRINITY ONLY
- EVENT_T_END,
+ EVENT_T_END
};
enum EventAI_ActionType
@@ -119,7 +119,7 @@ enum EventAI_ActionType
ACTION_T_ATTACK_START_PULSE = 103, //Distance
ACTION_T_SUMMON_GO = 104, //GameObjectID, DespawnTime in ms
- ACTION_T_END = 105,
+ ACTION_T_END = 105
};
enum Target
@@ -156,7 +156,7 @@ enum CastFlags
CAST_FORCE_CAST = 0x04, //Forces cast even if creature is out of mana or out of range
CAST_NO_MELEE_IF_OOM = 0x08, //Prevents creature from entering melee if out of mana or out of range
CAST_FORCE_TARGET_SELF = 0x10, //Forces the target to cast this spell on itself
- CAST_AURA_NOT_PRESENT = 0x20, //Only casts the spell if the target does not have an aura from the spell
+ CAST_AURA_NOT_PRESENT = 0x20 //Only casts the spell if the target does not have an aura from the spell
};
enum EventFlags
diff --git a/src/server/game/AI/EventAI/CreatureEventAIMgr.cpp b/src/server/game/AI/EventAI/CreatureEventAIMgr.cpp
index 7289a4eed28..728b17b0bbf 100755
--- a/src/server/game/AI/EventAI/CreatureEventAIMgr.cpp
+++ b/src/server/game/AI/EventAI/CreatureEventAIMgr.cpp
@@ -43,7 +43,7 @@ void CreatureEventAIMgr::LoadCreatureEventAI_Texts()
if (!result)
{
- sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded 0 additional CreatureEventAI Texts data. DB table `creature_ai_texts` is empty.");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 additional CreatureEventAI Texts data. DB table `creature_ai_texts` is empty.");
return;
}
@@ -98,7 +98,7 @@ void CreatureEventAIMgr::LoadCreatureEventAI_Texts()
}
while (result->NextRow());
- sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded %u additional CreatureEventAI Texts data in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u additional CreatureEventAI Texts data in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
}
@@ -114,7 +114,7 @@ void CreatureEventAIMgr::LoadCreatureEventAI_Summons()
if (!result)
{
- sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded 0 CreatureEventAI Summon definitions. DB table `creature_ai_summons` is empty.");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 CreatureEventAI Summon definitions. DB table `creature_ai_summons` is empty.");
return;
}
@@ -146,7 +146,7 @@ void CreatureEventAIMgr::LoadCreatureEventAI_Summons()
}
while (result->NextRow());
- sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded %u CreatureEventAI summon definitions in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u CreatureEventAI summon definitions in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
}
@@ -167,7 +167,7 @@ void CreatureEventAIMgr::LoadCreatureEventAI_Scripts()
if (!result)
{
- sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded 0 CreatureEventAI scripts. DB table `creature_ai_scripts` is empty.");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 CreatureEventAI scripts. DB table `creature_ai_scripts` is empty.");
return;
}
@@ -738,6 +738,6 @@ void CreatureEventAIMgr::LoadCreatureEventAI_Scripts()
}
while (result->NextRow());
- sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded %u CreatureEventAI scripts in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u CreatureEventAI scripts in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
}
diff --git a/src/server/game/AI/ScriptedAI/ScriptedCreature.h b/src/server/game/AI/ScriptedAI/ScriptedCreature.h
index ba0a94d2590..aa46d555b7d 100644
--- a/src/server/game/AI/ScriptedAI/ScriptedCreature.h
+++ b/src/server/game/AI/ScriptedAI/ScriptedCreature.h
@@ -41,8 +41,10 @@ class SummonList : public std::list<uint64>
template <class Predicate> void DoAction(int32 info, Predicate& predicate, uint16 max = 0)
{
- Trinity::Containers::RandomResizeList<uint64, Predicate>(*this, predicate, max);
- for (iterator i = begin(); i != end(); )
+ // We need to use a copy of SummonList here, otherwise original SummonList would be modified
+ std::list<uint64> listCopy = *this;
+ Trinity::Containers::RandomResizeList<uint64, Predicate>(listCopy, predicate, max);
+ for (iterator i = listCopy.begin(); i != listCopy.end(); )
{
Creature* summon = Unit::GetCreature(*me, *i++);
if (summon && summon->IsAIEnabled)
diff --git a/src/server/game/AI/SmartScripts/SmartAI.cpp b/src/server/game/AI/SmartScripts/SmartAI.cpp
index 0b8236908a0..7dd4053b82f 100644
--- a/src/server/game/AI/SmartScripts/SmartAI.cpp
+++ b/src/server/game/AI/SmartScripts/SmartAI.cpp
@@ -634,8 +634,11 @@ void SmartAI::SpellHitTarget(Unit* target, const SpellInfo* spellInfo)
void SmartAI::DamageTaken(Unit* doneBy, uint32& damage)
{
GetScript()->ProcessEventsFor(SMART_EVENT_DAMAGED, doneBy, damage);
- if ((me->GetHealth() - damage) <= mInvincibilityHpLevel)
- damage = me->GetHealth() - mInvincibilityHpLevel;
+ if (mInvincibilityHpLevel && (damage >= me->GetHealth() - mInvincibilityHpLevel))
+ {
+ damage = 0;
+ me->SetHealth(mInvincibilityHpLevel);
+ }
}
void SmartAI::HealReceived(Unit* doneBy, uint32& addhealth)
diff --git a/src/server/game/AI/SmartScripts/SmartAI.h b/src/server/game/AI/SmartScripts/SmartAI.h
index 79cef0c3b37..f81d6e86850 100644
--- a/src/server/game/AI/SmartScripts/SmartAI.h
+++ b/src/server/game/AI/SmartScripts/SmartAI.h
@@ -40,7 +40,7 @@ enum SmartEscortState
enum SmartEscortVars
{
SMART_ESCORT_MAX_PLAYER_DIST = 50,
- SMART_MAX_AID_DIST = SMART_ESCORT_MAX_PLAYER_DIST / 2,
+ SMART_MAX_AID_DIST = SMART_ESCORT_MAX_PLAYER_DIST / 2
};
class SmartAI : public CreatureAI
diff --git a/src/server/game/AI/SmartScripts/SmartScript.cpp b/src/server/game/AI/SmartScripts/SmartScript.cpp
index 6e5a34e8c33..dbc6f6bae1a 100644
--- a/src/server/game/AI/SmartScripts/SmartScript.cpp
+++ b/src/server/game/AI/SmartScripts/SmartScript.cpp
@@ -79,6 +79,7 @@ SmartScript::SmartScript()
{
go = NULL;
me = NULL;
+ trigger = NULL;
mEventPhase = 0;
mPathId = 0;
mTargetStorage = new ObjectListMap();
@@ -92,6 +93,7 @@ SmartScript::SmartScript()
meOrigGUID = 0;
goOrigGUID = 0;
mLastInvoker = 0;
+ mScriptType = SMART_SCRIPT_TYPE_CREATURE;
}
SmartScript::~SmartScript()
@@ -1117,10 +1119,10 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u
}
case SMART_ACTION_SUMMON_CREATURE:
{
- float x, y, z, o;
ObjectList* targets = GetTargets(e, unit);
if (targets)
{
+ float x, y, z, o;
for (ObjectList::const_iterator itr = targets->begin(); itr != targets->end(); ++itr)
{
(*itr)->GetPosition(x, y, z, o);
@@ -1149,10 +1151,10 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u
if (!GetBaseObject())
break;
- float x, y, z, o;
ObjectList* targets = GetTargets(e, unit);
if (targets)
{
+ float x, y, z, o;
for (ObjectList::const_iterator itr = targets->begin(); itr != targets->end(); ++itr)
{
if (!IsUnit(*itr))
@@ -1949,6 +1951,20 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u
delete targets;
break;
}
+ case SMART_ACTION_SET_HOME_POS:
+ {
+ if (!me)
+ break;
+
+ if (e.GetTargetType() == SMART_TARGET_SELF)
+ me->SetHomePosition(me->GetPositionX(), me->GetPositionY(), me->GetPositionZ(), me->GetOrientation());
+ else if (e.GetTargetType() == SMART_TARGET_POSITION)
+ me->SetHomePosition(e.target.x, e.target.y, e.target.z, e.target.o);
+ else
+ sLog->outError(LOG_FILTER_SQL, "SmartScript: Action target for SMART_ACTION_SET_HOME_POS is not using SMART_TARGET_SELF or SMART_TARGET_POSITION, skipping");
+
+ break;
+ }
default:
sLog->outError(LOG_FILTER_SQL, "SmartScript::ProcessAction: Entry %d SourceType %u, Event %u, Unhandled Action type %u", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType());
break;
diff --git a/src/server/game/AI/SmartScripts/SmartScriptMgr.cpp b/src/server/game/AI/SmartScripts/SmartScriptMgr.cpp
index 7a997609b5d..654cdee72c3 100644
--- a/src/server/game/AI/SmartScripts/SmartScriptMgr.cpp
+++ b/src/server/game/AI/SmartScripts/SmartScriptMgr.cpp
@@ -50,7 +50,7 @@ void SmartWaypointMgr::LoadFromDB()
if (!result)
{
- sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded 0 SmartAI Waypoint Paths. DB table `waypoints` is empty.");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 SmartAI Waypoint Paths. DB table `waypoints` is empty.");
return;
}
@@ -88,7 +88,7 @@ void SmartWaypointMgr::LoadFromDB()
}
while (result->NextRow());
- sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded %u SmartAI waypoint paths (total %u waypoints) in %u ms", count, total, GetMSTimeDiffToNow(oldMSTime));
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u SmartAI waypoint paths (total %u waypoints) in %u ms", count, total, GetMSTimeDiffToNow(oldMSTime));
}
@@ -117,7 +117,7 @@ void SmartAIMgr::LoadSmartAIFromDB()
if (!result)
{
- sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded 0 SmartAI scripts. DB table `smartai_scripts` is empty.");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 SmartAI scripts. DB table `smartai_scripts` is empty.");
return;
}
@@ -234,7 +234,7 @@ void SmartAIMgr::LoadSmartAIFromDB()
}
while (result->NextRow());
- sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded %u SmartAI scripts in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u SmartAI scripts in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
}
@@ -904,6 +904,7 @@ bool SmartAIMgr::IsEventValid(SmartScriptHolder& e)
case SMART_ACTION_SEND_GOSSIP_MENU:
case SMART_ACTION_GO_SET_LOOT_STATE:
case SMART_ACTION_SEND_TARGET_TO_TARGET:
+ case SMART_ACTION_SET_HOME_POS:
break;
default:
sLog->outError(LOG_FILTER_SQL, "SmartAIMgr: Not handled action_type(%u), event_type(%u), Entry %d SourceType %u Event %u, skipped.", e.GetActionType(), e.GetEventType(), e.entryOrGuid, e.GetScriptType(), e.event_id);
@@ -913,7 +914,7 @@ bool SmartAIMgr::IsEventValid(SmartScriptHolder& e)
return true;
}
-bool SmartAIMgr::IsTextValid(SmartScriptHolder const& e, uint32 id)
+/*bool SmartAIMgr::IsTextValid(SmartScriptHolder const& e, uint32 id) // unused
{
bool error = false;
uint32 entry = 0;
@@ -938,4 +939,4 @@ bool SmartAIMgr::IsTextValid(SmartScriptHolder const& e, uint32 id)
return false;
}
return true;
-}
+}*/
diff --git a/src/server/game/AI/SmartScripts/SmartScriptMgr.h b/src/server/game/AI/SmartScripts/SmartScriptMgr.h
index 05965d8ffa0..19aa6886ea0 100644
--- a/src/server/game/AI/SmartScripts/SmartScriptMgr.h
+++ b/src/server/game/AI/SmartScripts/SmartScriptMgr.h
@@ -54,7 +54,7 @@ enum SMART_EVENT_PHASE
SMART_EVENT_PHASE_6 = 6,
SMART_EVENT_PHASE_MAX = 7,
- SMART_EVENT_PHASE_COUNT = 6,
+ SMART_EVENT_PHASE_COUNT = 6
};
enum SMART_EVENT_PHASE_BITS
@@ -66,7 +66,7 @@ enum SMART_EVENT_PHASE_BITS
SMART_EVENT_PHASE_4_BIT = 8,
SMART_EVENT_PHASE_5_BIT = 16,
SMART_EVENT_PHASE_6_BIT = 32,
- SMART_EVENT_PHASE_ALL = SMART_EVENT_PHASE_1_BIT + SMART_EVENT_PHASE_2_BIT + SMART_EVENT_PHASE_3_BIT + SMART_EVENT_PHASE_4_BIT + SMART_EVENT_PHASE_5_BIT + SMART_EVENT_PHASE_6_BIT,
+ SMART_EVENT_PHASE_ALL = SMART_EVENT_PHASE_1_BIT + SMART_EVENT_PHASE_2_BIT + SMART_EVENT_PHASE_3_BIT + SMART_EVENT_PHASE_4_BIT + SMART_EVENT_PHASE_5_BIT + SMART_EVENT_PHASE_6_BIT
};
const uint32 SmartPhaseMask[SMART_EVENT_PHASE_COUNT][2] =
@@ -76,7 +76,7 @@ const uint32 SmartPhaseMask[SMART_EVENT_PHASE_COUNT][2] =
{SMART_EVENT_PHASE_3, SMART_EVENT_PHASE_3_BIT },
{SMART_EVENT_PHASE_4, SMART_EVENT_PHASE_4_BIT },
{SMART_EVENT_PHASE_5, SMART_EVENT_PHASE_5_BIT },
- {SMART_EVENT_PHASE_6, SMART_EVENT_PHASE_6_BIT },
+ {SMART_EVENT_PHASE_6, SMART_EVENT_PHASE_6_BIT }
};
enum SMART_EVENT
@@ -156,7 +156,7 @@ enum SMART_EVENT
SMART_EVENT_ACTION_DONE = 72, // eventId (SharedDefines.EventId)
SMART_EVENT_ON_SPELLCLICK = 73, // clicker (unit)
- SMART_EVENT_END = 74,
+ SMART_EVENT_END = 74
};
struct SmartEvent
@@ -376,7 +376,7 @@ enum SMART_SCRIPT_RESPAWN_CONDITION
SMART_SCRIPT_RESPAWN_CONDITION_NONE = 0,
SMART_SCRIPT_RESPAWN_CONDITION_MAP = 1,
SMART_SCRIPT_RESPAWN_CONDITION_AREA = 2,
- SMART_SCRIPT_RESPAWN_CONDITION_END = 3,
+ SMART_SCRIPT_RESPAWN_CONDITION_END = 3
};
enum SMART_ACTION
@@ -484,8 +484,9 @@ enum SMART_ACTION
SMART_ACTION_SEND_GOSSIP_MENU = 98, // menuId, optionId
SMART_ACTION_GO_SET_LOOT_STATE = 99, // state
SMART_ACTION_SEND_TARGET_TO_TARGET = 100, // id
+ SMART_ACTION_SET_HOME_POS = 101, // none
- SMART_ACTION_END = 101,
+ SMART_ACTION_END = 102
};
struct SmartAction
@@ -934,7 +935,7 @@ enum SMARTAI_TEMPLATE
SMARTAI_TEMPLATE_PASSIVE = 3,
SMARTAI_TEMPLATE_CAGED_GO_PART = 4, //creatureID, give credit at point end?,
SMARTAI_TEMPLATE_CAGED_NPC_PART = 5, //gameObjectID, despawntime, run?, dist, TextGroupID
- SMARTAI_TEMPLATE_END = 6,
+ SMARTAI_TEMPLATE_END = 6
};
enum SMARTAI_TARGETS
@@ -964,7 +965,7 @@ enum SMARTAI_TARGETS
SMART_TARGET_ACTION_INVOKER_VEHICLE = 22, // Unit's vehicle who caused this Event to occur
SMART_TARGET_OWNER_OR_SUMMONER = 23, // Unit's owner or summoner
SMART_TARGET_THREAT_LIST = 24, // All units on creature's threat list
- SMART_TARGET_END = 25,
+ SMART_TARGET_END = 25
};
struct SmartTarget
@@ -1057,12 +1058,12 @@ struct SmartTarget
enum eSmartAI
{
- SMART_EVENT_PARAM_COUNT = 4,
- SMART_ACTION_PARAM_COUNT = 6,
- SMART_SUMMON_COUNTER = 0xFFFFFF,
+ SMART_EVENT_PARAM_COUNT = 4,
+ SMART_ACTION_PARAM_COUNT = 6,
+ SMART_SUMMON_COUNTER = 0xFFFFFF,
SMART_ESCORT_LAST_OOC_POINT = 0xFFFFFF,
- SMART_RANDOM_POINT = 0xFFFFFE,
- SMART_ESCORT_TARGETS = 0xFFFFFF
+ SMART_RANDOM_POINT = 0xFFFFFE,
+ SMART_ESCORT_TARGETS = 0xFFFFFF
};
enum SmartScriptType
@@ -1091,7 +1092,7 @@ enum SmartAITypeMaskId
SMART_SCRIPT_TYPE_MASK_SPELL = 64,
SMART_SCRIPT_TYPE_MASK_TRANSPORT = 128,
SMART_SCRIPT_TYPE_MASK_INSTANCE = 256,
- SMART_SCRIPT_TYPE_MASK_TIMED_ACTIONLIST = 512,
+ SMART_SCRIPT_TYPE_MASK_TIMED_ACTIONLIST = 512
};
const uint32 SmartAITypeMask[SMART_SCRIPT_TYPE_MAX][2] =
@@ -1183,7 +1184,7 @@ const uint32 SmartAIEventMask[SMART_EVENT_END][2] =
{SMART_EVENT_GO_STATE_CHANGED, SMART_SCRIPT_TYPE_MASK_GAMEOBJECT },
{SMART_EVENT_GO_EVENT_INFORM, SMART_SCRIPT_TYPE_MASK_GAMEOBJECT },
{SMART_EVENT_ACTION_DONE, SMART_SCRIPT_TYPE_MASK_CREATURE },
- {SMART_EVENT_ON_SPELLCLICK, SMART_SCRIPT_TYPE_MASK_CREATURE },
+ {SMART_EVENT_ON_SPELLCLICK, SMART_SCRIPT_TYPE_MASK_CREATURE }
};
enum SmartEventFlags
@@ -1209,22 +1210,16 @@ enum SmartCastFlags
//CAST_FORCE_CAST = 0x04, //Forces cast even if creature is out of mana or out of range
//CAST_NO_MELEE_IF_OOM = 0x08, //Prevents creature from entering melee if out of mana or out of range
//CAST_FORCE_TARGET_SELF = 0x10, //Forces the target to cast this spell on itself
- SMARTCAST_AURA_NOT_PRESENT = 0x20, //Only casts the spell if the target does not have an aura from the spell
+ SMARTCAST_AURA_NOT_PRESENT = 0x20 //Only casts the spell if the target does not have an aura from the spell
};
// one line in DB is one event
struct SmartScriptHolder
{
- SmartScriptHolder()
- {
- timer = 0;
- active = false;
- runOnce = false;
- link = 0;
- entryOrGuid = 0;
- event_id = 0;
- enableTimed = false;
- }
+ SmartScriptHolder() : entryOrGuid(0), source_type(SMART_SCRIPT_TYPE_CREATURE)
+ , event_id(0), link(0), timer(0), active(false), runOnce(false)
+ , enableTimed(false) {}
+
int32 entryOrGuid;
SmartScriptType source_type;
uint32 event_id;
@@ -1436,7 +1431,7 @@ class SmartAIMgr
return true;
}
- bool IsTextValid(SmartScriptHolder const& e, uint32 id);
+ //bool IsTextValid(SmartScriptHolder const& e, uint32 id);
};
#define sSmartScriptMgr ACE_Singleton<SmartAIMgr, ACE_Null_Mutex>::instance()
diff --git a/src/server/game/Accounts/AccountMgr.h b/src/server/game/Accounts/AccountMgr.h
index c69f3c0a6f3..aaaf4f4f603 100755
--- a/src/server/game/Accounts/AccountMgr.h
+++ b/src/server/game/Accounts/AccountMgr.h
@@ -55,6 +55,6 @@ namespace AccountMgr
bool IsGMAccount(uint32 gmlevel);
bool IsAdminAccount(uint32 gmlevel);
bool IsConsoleAccount(uint32 gmlevel);
-};
+}
#endif
diff --git a/src/server/game/Achievements/AchievementMgr.cpp b/src/server/game/Achievements/AchievementMgr.cpp
index 191d91b61a7..93a3378c3c5 100755
--- a/src/server/game/Achievements/AchievementMgr.cpp
+++ b/src/server/game/Achievements/AchievementMgr.cpp
@@ -128,12 +128,6 @@ bool AchievementCriteriaData::IsValid(AchievementCriteriaEntry const* criteria)
}
return true;
case ACHIEVEMENT_CRITERIA_DATA_TYPE_T_PLAYER_CLASS_RACE:
- if (!classRace.class_id && !classRace.race_id)
- {
- sLog->outError(LOG_FILTER_SQL, "Table `achievement_criteria_data` (Entry: %u Type: %u) for data type ACHIEVEMENT_CRITERIA_DATA_TYPE_T_PLAYER_CLASS_RACE (%u) must not have 0 in either value field, ignored.",
- criteria->ID, criteria->requiredType, dataType);
- return false;
- }
if (classRace.class_id && ((1 << (classRace.class_id-1)) & CLASSMASK_ALL_PLAYABLE) == 0)
{
sLog->outError(LOG_FILTER_SQL, "Table `achievement_criteria_data` (Entry: %u Type: %u) for data type ACHIEVEMENT_CRITERIA_DATA_TYPE_T_PLAYER_CLASS_RACE (%u) has non-existing class in value1 (%u), ignored.",
@@ -364,7 +358,7 @@ bool AchievementCriteriaData::Meets(uint32 criteria_id, Player const* source, Un
return sScriptMgr->OnCriteriaCheck(this, const_cast<Player*>(source), const_cast<Unit*>(target));
case ACHIEVEMENT_CRITERIA_DATA_TYPE_MAP_DIFFICULTY:
if (source->GetMap()->IsRaid())
- if (source->GetMap()->Is25ManRaid() != (difficulty.difficulty & RAID_DIFFICULTY_MASK_25MAN))
+ if (source->GetMap()->Is25ManRaid() != ((difficulty.difficulty & RAID_DIFFICULTY_MASK_25MAN) != 0))
return false;
return source->GetMap()->GetSpawnMode() >= difficulty.difficulty;
case ACHIEVEMENT_CRITERIA_DATA_TYPE_MAP_PLAYER_COUNT:
@@ -391,14 +385,14 @@ bool AchievementCriteriaData::Meets(uint32 criteria_id, Player const* source, Un
Map* map = source->GetMap();
if (!map->IsDungeon())
{
- sLog->outError(LOG_FILTER_SQL, "Achievement system call ACHIEVEMENT_CRITERIA_DATA_INSTANCE_SCRIPT (%u) for achievement criteria %u for non-dungeon/non-raid map %u",
+ sLog->outError(LOG_FILTER_ACHIEVEMENTSYS, "Achievement system call ACHIEVEMENT_CRITERIA_DATA_INSTANCE_SCRIPT (%u) for achievement criteria %u for non-dungeon/non-raid map %u",
ACHIEVEMENT_CRITERIA_DATA_INSTANCE_SCRIPT, criteria_id, map->GetId());
return false;
}
InstanceScript* instance = ((InstanceMap*)map)->GetInstanceScript();
if (!instance)
{
- sLog->outError(LOG_FILTER_SQL, "Achievement system call ACHIEVEMENT_CRITERIA_DATA_INSTANCE_SCRIPT (%u) for achievement criteria %u for map %u but map does not have a instance script",
+ sLog->outError(LOG_FILTER_ACHIEVEMENTSYS, "Achievement system call ACHIEVEMENT_CRITERIA_DATA_INSTANCE_SCRIPT (%u) for achievement criteria %u for map %u but map does not have a instance script",
ACHIEVEMENT_CRITERIA_DATA_INSTANCE_SCRIPT, criteria_id, map->GetId());
return false;
}
@@ -634,8 +628,7 @@ void AchievementMgr::LoadFromDB(PreparedQueryResult achievementResult, PreparedQ
if (AchievementReward const* reward = sAchievementMgr->GetAchievementReward(achievement))
if (uint32 titleId = reward->titleId[Player::TeamForRace(GetPlayer()->getRace()) == ALLIANCE ? 0 : 1])
if (CharTitlesEntry const* titleEntry = sCharTitlesStore.LookupEntry(titleId))
- if (!GetPlayer()->HasTitle(titleEntry))
- GetPlayer()->SetTitle(titleEntry);
+ GetPlayer()->SetTitle(titleEntry);
} while (achievementResult->NextRow());
}
@@ -723,7 +716,7 @@ void AchievementMgr::SendAchievementEarned(AchievementEntry const* achievement)
WorldPacket data(SMSG_ACHIEVEMENT_EARNED, 8+4+8);
data.append(GetPlayer()->GetPackGUID());
data << uint32(achievement->ID);
- data << uint32(secsToTimeBitFields(time(NULL)));
+ data.AppendPackedTime(time(NULL));
data << uint32(0);
GetPlayer()->SendMessageToSetInRange(&data, sWorld->getFloatConfig(CONFIG_LISTEN_RANGE_SAY), true);
}
@@ -741,7 +734,7 @@ void AchievementMgr::SendCriteriaUpdate(AchievementCriteriaEntry const* entry, C
data << uint32(0);
else
data << uint32(timedCompleted ? 0 : 1); // this are some flags, 1 is for keeping the counter at 0 in client
- data << uint32(secsToTimeBitFields(progress->date));
+ data.AppendPackedTime(progress->date);
data << uint32(timeElapsed); // time elapsed in seconds
data << uint32(0); // unk
GetPlayer()->SendDirectMessage(&data);
@@ -2132,7 +2125,7 @@ void AchievementMgr::BuildAllDataPacket(WorldPacket* data) const
continue;
*data << uint32(iter->first);
- *data << uint32(secsToTimeBitFields(iter->second.date));
+ data->AppendPackedTime(iter->second.date);
}
*data << int32(-1);
@@ -2142,7 +2135,7 @@ void AchievementMgr::BuildAllDataPacket(WorldPacket* data) const
data->appendPackGUID(iter->second.counter);
data->append(GetPlayer()->GetPackGUID());
*data << uint32(0);
- *data << uint32(secsToTimeBitFields(iter->second.date));
+ data->AppendPackedTime(iter->second.date);
*data << uint32(0);
*data << uint32(0);
}
@@ -2201,8 +2194,7 @@ void AchievementGlobalMgr::LoadAchievementCriteriaList()
if (sAchievementCriteriaStore.GetNumRows() == 0)
{
- sLog->outError(LOG_FILTER_SQL, ">> Loaded 0 achievement criteria.");
-
+ sLog->outError(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 achievement criteria.");
return;
}
@@ -2219,8 +2211,7 @@ void AchievementGlobalMgr::LoadAchievementCriteriaList()
m_AchievementCriteriasByTimedType[criteria->timedType].push_back(criteria);
}
- sLog->outInfo(LOG_FILTER_ACHIEVEMENTSYS, ">> Loaded %lu achievement criteria in %u ms", (unsigned long)m_AchievementCriteriasByType->size(), GetMSTimeDiffToNow(oldMSTime));
-
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %lu achievement criteria in %u ms", (unsigned long)m_AchievementCriteriasByType->size(), GetMSTimeDiffToNow(oldMSTime));
}
void AchievementGlobalMgr::LoadAchievementReferenceList()
@@ -2229,8 +2220,7 @@ void AchievementGlobalMgr::LoadAchievementReferenceList()
if (sAchievementStore.GetNumRows() == 0)
{
- sLog->outInfo(LOG_FILTER_ACHIEVEMENTSYS, ">> Loaded 0 achievement references.");
-
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 achievement references.");
return;
}
@@ -2250,8 +2240,7 @@ void AchievementGlobalMgr::LoadAchievementReferenceList()
if (AchievementEntry const* achievement = sAchievementStore.LookupEntry(4539))
const_cast<AchievementEntry*>(achievement)->mapID = 631; // Correct map requirement (currently has Ulduar)
- sLog->outInfo(LOG_FILTER_ACHIEVEMENTSYS, ">> Loaded %u achievement references in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
-
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u achievement references in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
}
void AchievementGlobalMgr::LoadAchievementCriteriaData()
@@ -2264,8 +2253,7 @@ void AchievementGlobalMgr::LoadAchievementCriteriaData()
if (!result)
{
- sLog->outInfo(LOG_FILTER_ACHIEVEMENTSYS, ">> Loaded 0 additional achievement criteria data. DB table `achievement_criteria_data` is empty.");
-
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 additional achievement criteria data. DB table `achievement_criteria_data` is empty.");
return;
}
@@ -2396,8 +2384,7 @@ void AchievementGlobalMgr::LoadAchievementCriteriaData()
sLog->outError(LOG_FILTER_SQL, "Table `achievement_criteria_data` does not have expected data for criteria (Entry: %u Type: %u) for achievement %u.", criteria->ID, criteria->requiredType, criteria->referredAchievement);
}
- sLog->outInfo(LOG_FILTER_ACHIEVEMENTSYS, ">> Loaded %u additional achievement criteria data in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
-
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u additional achievement criteria data in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
}
void AchievementGlobalMgr::LoadCompletedAchievements()
@@ -2408,8 +2395,7 @@ void AchievementGlobalMgr::LoadCompletedAchievements()
if (!result)
{
- sLog->outInfo(LOG_FILTER_ACHIEVEMENTSYS, ">> Loaded 0 completed achievements. DB table `character_achievement` is empty.");
-
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 completed achievements. DB table `character_achievement` is empty.");
return;
}
@@ -2436,8 +2422,7 @@ void AchievementGlobalMgr::LoadCompletedAchievements()
m_allCompletedAchievements.insert(achievementId);
} while (result->NextRow());
- sLog->outInfo(LOG_FILTER_ACHIEVEMENTSYS, ">> Loaded %lu completed achievements in %u ms", (unsigned long)m_allCompletedAchievements.size(), GetMSTimeDiffToNow(oldMSTime));
-
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %lu completed achievements in %u ms", (unsigned long)m_allCompletedAchievements.size(), GetMSTimeDiffToNow(oldMSTime));
}
void AchievementGlobalMgr::LoadRewards()
@@ -2451,8 +2436,7 @@ void AchievementGlobalMgr::LoadRewards()
if (!result)
{
- sLog->outError(LOG_FILTER_SQL, ">> Loaded 0 achievement rewards. DB table `achievement_reward` is empty.");
-
+ sLog->outError(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 achievement rewards. DB table `achievement_reward` is empty.");
return;
}
@@ -2543,8 +2527,7 @@ void AchievementGlobalMgr::LoadRewards()
}
while (result->NextRow());
- sLog->outInfo(LOG_FILTER_ACHIEVEMENTSYS, ">> Loaded %u achievement rewards in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
-
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u achievement rewards in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
}
void AchievementGlobalMgr::LoadRewardLocales()
@@ -2559,8 +2542,7 @@ void AchievementGlobalMgr::LoadRewardLocales()
if (!result)
{
- sLog->outInfo(LOG_FILTER_ACHIEVEMENTSYS, ">> Loaded 0 achievement reward locale strings. DB table `locales_achievement_reward` is empty");
-
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 achievement reward locale strings. DB table `locales_achievement_reward` is empty");
return;
}
@@ -2586,6 +2568,5 @@ void AchievementGlobalMgr::LoadRewardLocales()
}
} while (result->NextRow());
- sLog->outInfo(LOG_FILTER_ACHIEVEMENTSYS, ">> Loaded %lu achievement reward locale strings in %u ms", (unsigned long)m_achievementRewardLocales.size(), GetMSTimeDiffToNow(oldMSTime));
-
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %lu achievement reward locale strings in %u ms", (unsigned long)m_achievementRewardLocales.size(), GetMSTimeDiffToNow(oldMSTime));
}
diff --git a/src/server/game/Achievements/AchievementMgr.h b/src/server/game/Achievements/AchievementMgr.h
index c7d838fcb44..3215b4196f7 100755
--- a/src/server/game/Achievements/AchievementMgr.h
+++ b/src/server/game/Achievements/AchievementMgr.h
@@ -63,7 +63,7 @@ enum AchievementCriteriaDataType
ACHIEVEMENT_CRITERIA_DATA_INSTANCE_SCRIPT = 18, // 0 0 maker instance script call for check current criteria requirements fit
ACHIEVEMENT_CRITERIA_DATA_TYPE_S_EQUIPED_ITEM = 19, // item_level item_quality for equipped item in slot to check item level and quality
ACHIEVEMENT_CRITERIA_DATA_TYPE_MAP_ID = 20, // map_id 0 player must be on map with id in map_id
- ACHIEVEMENT_CRITERIA_DATA_TYPE_S_PLAYER_CLASS_RACE = 21, // class_id race_id
+ ACHIEVEMENT_CRITERIA_DATA_TYPE_S_PLAYER_CLASS_RACE = 21 // class_id race_id
};
#define MAX_ACHIEVEMENT_CRITERIA_DATA_TYPE 22 // maximum value in AchievementCriteriaDataType enum
diff --git a/src/server/game/Addons/AddonMgr.cpp b/src/server/game/Addons/AddonMgr.cpp
index 6af87827917..a0789040e9a 100755
--- a/src/server/game/Addons/AddonMgr.cpp
+++ b/src/server/game/Addons/AddonMgr.cpp
@@ -43,7 +43,7 @@ void LoadFromDB()
QueryResult result = CharacterDatabase.Query("SELECT name, crc FROM addons");
if (!result)
{
- sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded 0 known addons. DB table `addons` is empty!");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 known addons. DB table `addons` is empty!");
return;
}
@@ -63,7 +63,7 @@ void LoadFromDB()
}
while (result->NextRow());
- sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded %u known addons in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u known addons in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
}
diff --git a/src/server/game/Addons/AddonMgr.h b/src/server/game/Addons/AddonMgr.h
index 38338b3980f..fd227b258c5 100755
--- a/src/server/game/Addons/AddonMgr.h
+++ b/src/server/game/Addons/AddonMgr.h
@@ -25,13 +25,7 @@
struct AddonInfo
{
AddonInfo(const std::string& name, uint8 enabled, uint32 crc, uint8 state, bool crcOrPubKey)
- {
- Name = name;
- Enabled = enabled;
- CRC = crc;
- State = state;
- UsePublicKeyOrCRC = crcOrPubKey;
- }
+ : Name(name), Enabled(enabled), CRC(crc), State(state), UsePublicKeyOrCRC(crcOrPubKey) {}
std::string Name;
uint8 Enabled;
diff --git a/src/server/game/AuctionHouse/AuctionHouseMgr.cpp b/src/server/game/AuctionHouse/AuctionHouseMgr.cpp
index ab08262a928..75bac2ca5ca 100644
--- a/src/server/game/AuctionHouse/AuctionHouseMgr.cpp
+++ b/src/server/game/AuctionHouse/AuctionHouseMgr.cpp
@@ -34,7 +34,7 @@
enum eAuctionHouse
{
- AH_MINIMUM_DEPOSIT = 100,
+ AH_MINIMUM_DEPOSIT = 100
};
AuctionHouseMgr::AuctionHouseMgr()
@@ -263,7 +263,7 @@ void AuctionHouseMgr::LoadAuctionItems()
if (!result)
{
- sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded 0 auction items. DB table `auctionhouse` or `item_instance` is empty!");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 auction items. DB table `auctionhouse` or `item_instance` is empty!");
return;
}
@@ -296,7 +296,7 @@ void AuctionHouseMgr::LoadAuctionItems()
}
while (result->NextRow());
- sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded %u auction items in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u auction items in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
}
@@ -309,7 +309,7 @@ void AuctionHouseMgr::LoadAuctions()
if (!result)
{
- sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded 0 auctions. DB table `auctionhouse` is empty.");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 auctions. DB table `auctionhouse` is empty.");
return;
}
@@ -335,7 +335,7 @@ void AuctionHouseMgr::LoadAuctions()
CharacterDatabase.CommitTransaction(trans);
- sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded %u auctions in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u auctions in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
}
@@ -734,7 +734,7 @@ void AuctionHouseMgr::DeleteExpiredAuctionsAtStartup()
if (!expAuctions)
{
- sLog->outInfo(LOG_FILTER_GENERAL, ">> No expired auctions to delete");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> No expired auctions to delete");
return;
}
@@ -782,7 +782,7 @@ void AuctionHouseMgr::DeleteExpiredAuctionsAtStartup()
} while (expAuctions->NextRow());
- sLog->outInfo(LOG_FILTER_GENERAL, ">> Deleted %u expired auctions in %u ms", expirecount, GetMSTimeDiffToNow(oldMSTime));
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Deleted %u expired auctions in %u ms", expirecount, GetMSTimeDiffToNow(oldMSTime));
}
diff --git a/src/server/game/Battlefield/Battlefield.cpp b/src/server/game/Battlefield/Battlefield.cpp
new file mode 100644
index 00000000000..ae58f3504b4
--- /dev/null
+++ b/src/server/game/Battlefield/Battlefield.cpp
@@ -0,0 +1,1118 @@
+/*
+ * Copyright (C) 2008-2010 TrinityCore <http://www.trinitycore.org/>
+ * Copyright (C) 2005-2009 MaNGOS <http://getmangos.com/>
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation; either version 2 of the License, or (at your
+ * option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
+ * more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#include "Battlefield.h"
+#include "BattlefieldMgr.h"
+#include "ObjectAccessor.h"
+#include "ObjectMgr.h"
+#include "Map.h"
+#include "MapManager.h"
+#include "Group.h"
+#include "WorldPacket.h"
+#include "GridNotifiers.h"
+#include "GridNotifiersImpl.h"
+#include "GridNotifiers.h"
+#include "GridNotifiersImpl.h"
+#include "CellImpl.h"
+#include "CreatureTextMgr.h"
+#include "GroupMgr.h"
+
+Battlefield::Battlefield()
+{
+ m_Timer = 0;
+ m_IsEnabled = true;
+ m_isActive = false;
+ m_DefenderTeam = TEAM_NEUTRAL;
+
+ m_TypeId = 0;
+ m_BattleId = 0;
+ m_ZoneId = 0;
+ m_MapId = 0;
+ m_MaxPlayer = 0;
+ m_MinPlayer = 0;
+ m_BattleTime = 0;
+ m_NoWarBattleTime = 0;
+ m_TimeForAcceptInvite = 20;
+ m_uiKickDontAcceptTimer = 1000;
+
+ m_uiKickAfkPlayersTimer = 1000;
+
+ m_LastResurectTimer = 30 * IN_MILLISECONDS;
+ m_StartGroupingTimer = 0;
+ m_StartGrouping = false;
+ StalkerGuid = 0;
+}
+
+Battlefield::~Battlefield()
+{
+ for (BfCapturePointMap::iterator itr = m_capturePoints.begin(); itr != m_capturePoints.end(); ++itr)
+ delete itr->second;
+
+ for (GraveyardVect::const_iterator itr = m_GraveyardList.begin(); itr != m_GraveyardList.end(); ++itr)
+ delete *itr;
+
+ m_capturePoints.clear();
+}
+
+// Called when a player enters the zone
+void Battlefield::HandlePlayerEnterZone(Player* player, uint32 /*zone*/)
+{
+ // If battle is started,
+ // If not full of players > invite player to join the war
+ // If full of players > announce to player that BF is full and kick him after a few second if he desn't leave
+ if (IsWarTime())
+ {
+ if (m_PlayersInWar[player->GetTeamId()].size() + m_InvitedPlayers[player->GetTeamId()].size() < m_MaxPlayer) // Vacant spaces
+ InvitePlayerToWar(player);
+ else // No more vacant places
+ {
+ // TODO: Send a packet to announce it to player
+ m_PlayersWillBeKick[player->GetTeamId()][player->GetGUID()] = time(NULL) + 10;
+ InvitePlayerToQueue(player);
+ }
+ }
+ else
+ {
+ // If time left is < 15 minutes invite player to join queue
+ if (m_Timer <= m_StartGroupingTimer)
+ InvitePlayerToQueue(player);
+ }
+
+ // Add player in the list of player in zone
+ m_players[player->GetTeamId()].insert(player->GetGUID());
+ OnPlayerEnterZone(player);
+}
+
+// Called when a player leave the zone
+void Battlefield::HandlePlayerLeaveZone(Player* player, uint32 /*zone*/)
+{
+ if (IsWarTime())
+ {
+ // If the player is participating to the battle
+ if (m_PlayersInWar[player->GetTeamId()].find(player->GetGUID()) != m_PlayersInWar[player->GetTeamId()].end())
+ {
+ m_PlayersInWar[player->GetTeamId()].erase(player->GetGUID());
+ player->GetSession()->SendBfLeaveMessage(m_BattleId);
+ if (Group* group = player->GetGroup()) // Remove the player from the raid group
+ group->RemoveMember(player->GetGUID());
+
+ OnPlayerLeaveWar(player);
+ }
+ }
+
+ for (BfCapturePointMap::iterator itr = m_capturePoints.begin(); itr != m_capturePoints.end(); ++itr)
+ itr->second->HandlePlayerLeave(player);
+
+ m_InvitedPlayers[player->GetTeamId()].erase(player->GetGUID());
+ m_PlayersWillBeKick[player->GetTeamId()].erase(player->GetGUID());
+ m_players[player->GetTeamId()].erase(player->GetGUID());
+ SendRemoveWorldStates(player);
+ RemovePlayerFromResurrectQueue(player->GetGUID());
+ OnPlayerLeaveZone(player);
+}
+
+bool Battlefield::Update(uint32 diff)
+{
+ if (m_Timer <= diff)
+ {
+ // Battlefield ends on time
+ if (IsWarTime())
+ EndBattle(true);
+ else // Time to start a new battle!
+ StartBattle();
+ }
+ else
+ m_Timer -= diff;
+
+ // Invite players a few minutes before the battle's beginning
+ if (!IsWarTime() && !m_StartGrouping && m_Timer <= m_StartGroupingTimer)
+ {
+ m_StartGrouping = true;
+ InvitePlayersInZoneToQueue();
+ OnStartGrouping();
+ }
+
+ bool objective_changed = false;
+ if (IsWarTime())
+ {
+ if (m_uiKickAfkPlayersTimer <= diff)
+ {
+ m_uiKickAfkPlayersTimer = 1000;
+ KickAfkPlayers();
+ }
+ else
+ m_uiKickAfkPlayersTimer -= diff;
+
+ // Kick players who chose not to accept invitation to the battle
+ if (m_uiKickDontAcceptTimer <= diff)
+ {
+ for (int team = 0; team < 2; team++)
+ for (PlayerTimerMap::iterator itr = m_InvitedPlayers[team].begin(); itr != m_InvitedPlayers[team].end(); ++itr)
+ if ((*itr).second <= time(NULL))
+ KickPlayerFromBattlefield((*itr).first);
+
+ InvitePlayersInZoneToWar();
+ for (int team = 0; team < 2; team++)
+ for (PlayerTimerMap::iterator itr = m_PlayersWillBeKick[team].begin(); itr != m_PlayersWillBeKick[team].end(); ++itr)
+ if ((*itr).second <= time(NULL))
+ KickPlayerFromBattlefield((*itr).first);
+
+ m_uiKickDontAcceptTimer = 1000;
+ }
+ else
+ m_uiKickDontAcceptTimer -= diff;
+
+ for (BfCapturePointMap::iterator itr = m_capturePoints.begin(); itr != m_capturePoints.end(); ++itr)
+ if (itr->second->Update(diff))
+ objective_changed = true;
+ }
+
+
+ if (m_LastResurectTimer <= diff)
+ {
+ for (uint8 i = 0; i < m_GraveyardList.size(); i++)
+ if (GetGraveyardById(i))
+ m_GraveyardList[i]->Resurrect();
+ m_LastResurectTimer = RESURRECTION_INTERVAL;
+ }
+ else
+ m_LastResurectTimer -= diff;
+
+ return objective_changed;
+}
+
+void Battlefield::InvitePlayersInZoneToQueue()
+{
+ for (uint8 team = 0; team < 2; ++team)
+ for (GuidSet::const_iterator itr = m_players[team].begin(); itr != m_players[team].end(); ++itr)
+ if (Player* player = sObjectAccessor->FindPlayer(*itr))
+ InvitePlayerToQueue(player);
+}
+
+void Battlefield::InvitePlayerToQueue(Player* player)
+{
+ if (m_PlayersInQueue[player->GetTeamId()].count(player->GetGUID()))
+ return;
+
+ if (m_PlayersInQueue[player->GetTeamId()].size() <= m_MinPlayer || m_PlayersInQueue[GetOtherTeam(player->GetTeamId())].size() >= m_MinPlayer)
+ player->GetSession()->SendBfInvitePlayerToQueue(m_BattleId);
+}
+
+void Battlefield::InvitePlayersInQueueToWar()
+{
+ for (uint8 team = 0; team < BG_TEAMS_COUNT; ++team)
+ {
+ for (GuidSet::const_iterator itr = m_PlayersInQueue[team].begin(); itr != m_PlayersInQueue[team].end(); ++itr)
+ {
+ if (Player* player = sObjectAccessor->FindPlayer(*itr))
+ {
+ if (m_PlayersInWar[player->GetTeamId()].size() + m_InvitedPlayers[player->GetTeamId()].size() < m_MaxPlayer)
+ InvitePlayerToWar(player);
+ else
+ {
+ //Full
+ }
+ }
+ }
+ m_PlayersInQueue[team].clear();
+ }
+}
+
+void Battlefield::InvitePlayersInZoneToWar()
+{
+ for (uint8 team = 0; team < BG_TEAMS_COUNT; ++team)
+ for (GuidSet::const_iterator itr = m_players[team].begin(); itr != m_players[team].end(); ++itr)
+ {
+ if (Player* player = sObjectAccessor->FindPlayer(*itr))
+ {
+ if (m_PlayersInWar[player->GetTeamId()].count(player->GetGUID()) || m_InvitedPlayers[player->GetTeamId()].count(player->GetGUID()))
+ continue;
+ if (m_PlayersInWar[player->GetTeamId()].size() + m_InvitedPlayers[player->GetTeamId()].size() < m_MaxPlayer)
+ InvitePlayerToWar(player);
+ else // Battlefield is full of players
+ m_PlayersWillBeKick[player->GetTeamId()][player->GetGUID()] = time(NULL) + 10;
+ }
+ }
+}
+
+void Battlefield::InvitePlayerToWar(Player* player)
+{
+ if (!player)
+ return;
+
+ // TODO : needed ?
+ if (player->isInFlight())
+ return;
+
+ if (player->InArena() || player->GetBattleground())
+ {
+ m_PlayersInQueue[player->GetTeamId()].erase(player->GetGUID());
+ return;
+ }
+
+ // If the player does not match minimal level requirements for the battlefield, kick him
+ if (player->getLevel() < m_MinLevel)
+ {
+ if (m_PlayersWillBeKick[player->GetTeamId()].count(player->GetGUID()) == 0)
+ m_PlayersWillBeKick[player->GetTeamId()][player->GetGUID()] = time(NULL) + 10;
+ return;
+ }
+
+ // Check if player is not already in war
+ if (m_PlayersInWar[player->GetTeamId()].count(player->GetGUID()) || m_InvitedPlayers[player->GetTeamId()].count(player->GetGUID()))
+ return;
+
+ m_PlayersWillBeKick[player->GetTeamId()].erase(player->GetGUID());
+ m_InvitedPlayers[player->GetTeamId()][player->GetGUID()] = time(NULL) + m_TimeForAcceptInvite;
+ player->GetSession()->SendBfInvitePlayerToWar(m_BattleId, m_ZoneId, m_TimeForAcceptInvite);
+}
+
+void Battlefield::InitStalker(uint32 entry, float x, float y, float z, float o)
+{
+ if (Creature* creature = SpawnCreature(entry, x, y, z, o, TEAM_NEUTRAL))
+ StalkerGuid = creature->GetGUID();
+ else
+ sLog->outError(LOG_FILTER_BATTLEFIELD, "Battlefield::InitStalker: could not spawn Stalker (Creature entry %u), zone messeges will be un-available", entry);
+}
+
+void Battlefield::KickAfkPlayers()
+{
+ for (uint8 team = 0; team < BG_TEAMS_COUNT; ++team)
+ for (GuidSet::const_iterator itr = m_PlayersInWar[team].begin(); itr != m_PlayersInWar[team].end(); ++itr)
+ if (Player* player = sObjectAccessor->FindPlayer(*itr))
+ if (player->isAFK())
+ KickPlayerFromBattlefield(*itr);
+}
+
+void Battlefield::KickPlayerFromBattlefield(uint64 guid)
+{
+ if (Player* player = sObjectAccessor->FindPlayer(guid))
+ if (player->GetZoneId() == GetZoneId())
+ player->TeleportTo(KickPosition);
+}
+
+void Battlefield::StartBattle()
+{
+ if (m_isActive)
+ return;
+
+ for (int team = 0; team < BG_TEAMS_COUNT; team++)
+ {
+ m_PlayersInWar[team].clear();
+ m_Groups[team].clear();
+ }
+
+ m_Timer = m_BattleTime;
+ m_isActive = true;
+
+ InvitePlayersInZoneToWar();
+ InvitePlayersInQueueToWar();
+
+ DoPlaySoundToAll(BF_START);
+
+ OnBattleStart();
+}
+
+void Battlefield::EndBattle(bool endByTimer)
+{
+ if (!m_isActive)
+ return;
+
+ m_isActive = false;
+
+ m_StartGrouping = false;
+
+ if (!endByTimer)
+ SetDefenderTeam(GetAttackerTeam());
+
+ if (GetDefenderTeam() == TEAM_ALLIANCE)
+ DoPlaySoundToAll(BF_ALLIANCE_WINS);
+ else
+ DoPlaySoundToAll(BF_HORDE_WINS);
+
+ OnBattleEnd(endByTimer);
+
+ // Reset battlefield timer
+ m_Timer = m_NoWarBattleTime;
+ SendInitWorldStatesToAll();
+}
+
+void Battlefield::DoPlaySoundToAll(uint32 SoundID)
+{
+ WorldPacket data;
+ data.Initialize(SMSG_PLAY_SOUND, 4);
+ data << uint32(SoundID);
+
+ for (int team = 0; team < BG_TEAMS_COUNT; team++)
+ for (GuidSet::const_iterator itr = m_PlayersInWar[team].begin(); itr != m_PlayersInWar[team].end(); ++itr)
+ if (Player* player = sObjectAccessor->FindPlayer(*itr))
+ player->GetSession()->SendPacket(&data);
+}
+
+bool Battlefield::HasPlayer(Player* player) const
+{
+ return m_players[player->GetTeamId()].find(player->GetGUID()) != m_players[player->GetTeamId()].end();
+}
+
+// Called in WorldSession::HandleBfQueueInviteResponse
+void Battlefield::PlayerAcceptInviteToQueue(Player* player)
+{
+ // Add player in queue
+ m_PlayersInQueue[player->GetTeamId()].insert(player->GetGUID());
+ // Send notification
+ player->GetSession()->SendBfQueueInviteResponse(m_BattleId, m_ZoneId);
+}
+
+// Called in WorldSession::HandleBfExitRequest
+void Battlefield::AskToLeaveQueue(Player* player)
+{
+ // Remove player from queue
+ m_PlayersInQueue[player->GetTeamId()].erase(player->GetGUID());
+}
+
+// Called in WorldSession::HandleBfEntryInviteResponse
+void Battlefield::PlayerAcceptInviteToWar(Player* player)
+{
+ if (!IsWarTime())
+ return;
+
+ if (AddOrSetPlayerToCorrectBfGroup(player))
+ {
+ player->GetSession()->SendBfEntered(m_BattleId);
+ m_PlayersInWar[player->GetTeamId()].insert(player->GetGUID());
+ m_InvitedPlayers[player->GetTeamId()].erase(player->GetGUID());
+
+ if (player->isAFK())
+ player->ToggleAFK();
+
+ OnPlayerJoinWar(player); //for scripting
+ }
+}
+
+void Battlefield::TeamCastSpell(TeamId team, int32 spellId)
+{
+ if (spellId > 0)
+ for (GuidSet::const_iterator itr = m_PlayersInWar[team].begin(); itr != m_PlayersInWar[team].end(); ++itr)
+ if (Player* player = sObjectAccessor->FindPlayer(*itr))
+ player->CastSpell(player, uint32(spellId), true);
+ else
+ for (GuidSet::const_iterator itr = m_PlayersInWar[team].begin(); itr != m_PlayersInWar[team].end(); ++itr)
+ if (Player* player = sObjectAccessor->FindPlayer(*itr))
+ player->RemoveAuraFromStack(uint32(-spellId));
+}
+
+void Battlefield::BroadcastPacketToZone(WorldPacket& data) const
+{
+ for (uint8 team = 0; team < BG_TEAMS_COUNT; ++team)
+ for (GuidSet::const_iterator itr = m_players[team].begin(); itr != m_players[team].end(); ++itr)
+ if (Player* player = sObjectAccessor->FindPlayer(*itr))
+ player->GetSession()->SendPacket(&data);
+}
+
+void Battlefield::BroadcastPacketToQueue(WorldPacket& data) const
+{
+ for (uint8 team = 0; team < BG_TEAMS_COUNT; ++team)
+ for (GuidSet::const_iterator itr = m_PlayersInQueue[team].begin(); itr != m_PlayersInQueue[team].end(); ++itr)
+ if (Player* player = sObjectAccessor->FindPlayer(*itr))
+ player->GetSession()->SendPacket(&data);
+}
+
+void Battlefield::BroadcastPacketToWar(WorldPacket& data) const
+{
+ for (uint8 team = 0; team < BG_TEAMS_COUNT; ++team)
+ for (GuidSet::const_iterator itr = m_PlayersInWar[team].begin(); itr != m_PlayersInWar[team].end(); ++itr)
+ if (Player* player = sObjectAccessor->FindPlayer(*itr))
+ player->GetSession()->SendPacket(&data);
+}
+
+WorldPacket Battlefield::BuildWarningAnnPacket(std::string msg)
+{
+ WorldPacket data(SMSG_MESSAGECHAT, 200);
+
+ data << uint8(CHAT_MSG_RAID_BOSS_EMOTE);
+ data << uint32(LANG_UNIVERSAL);
+ data << uint64(0);
+ data << uint32(0); // 2.1.0
+ data << uint32(1);
+ data << uint8(0);
+ data << uint64(0);
+ data << uint32(msg.length() + 1);
+ data << msg;
+ data << uint8(0);
+
+ return data;
+}
+
+void Battlefield::SendWarningToAllInZone(uint32 entry)
+{
+ if (Unit* unit = sObjectAccessor->FindUnit(StalkerGuid))
+ if (Creature* stalker = unit->ToCreature())
+ // FIXME: replaced CHAT_TYPE_END with CHAT_MSG_BG_SYSTEM_NEUTRAL to fix compile, it's a guessed change :/
+ sCreatureTextMgr->SendChat(stalker, (uint8) entry, 0, CHAT_MSG_BG_SYSTEM_NEUTRAL, LANG_ADDON, TEXT_RANGE_ZONE);
+}
+
+/*void Battlefield::SendWarningToAllInWar(int32 entry,...)
+{
+ const char *format = sObjectMgr->GetTrinityStringForDBCLocale(entry);
+ va_list ap;
+ char str [1024];
+ va_start(ap, entry);
+ vsnprintf(str,1024,format, ap);
+ va_end(ap);
+ std::string msg = (std::string)str;
+
+ WorldPacket data = BuildWarningAnnPacket(msg);
+ BroadcastPacketWar(data);
+}*/
+
+void Battlefield::SendWarningToPlayer(Player* player, uint32 entry)
+{
+ if (player)
+ if (Unit* unit = sObjectAccessor->FindUnit(StalkerGuid))
+ if (Creature* stalker = unit->ToCreature())
+ sCreatureTextMgr->SendChat(stalker, (uint8)entry, player->GetGUID());
+}
+
+void Battlefield::SendUpdateWorldState(uint32 field, uint32 value)
+{
+ for (uint8 i = 0; i < BG_TEAMS_COUNT; ++i)
+ for (GuidSet::iterator itr = m_players[i].begin(); itr != m_players[i].end(); ++itr)
+ if (Player* player = sObjectAccessor->FindPlayer(*itr))
+ player->SendUpdateWorldState(field, value);
+}
+
+void Battlefield::RegisterZone(uint32 zoneId)
+{
+ sBattlefieldMgr->AddZone(zoneId, this);
+}
+
+void Battlefield::HideNpc(Creature* creature)
+{
+ creature->CombatStop();
+ creature->SetReactState(REACT_PASSIVE);
+ creature->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_NOT_SELECTABLE);
+ creature->SetPhaseMask(2, true);
+ creature->DisappearAndDie();
+ creature->SetVisible(false);
+}
+
+void Battlefield::ShowNpc(Creature* creature, bool aggressive)
+{
+ creature->SetPhaseMask(1, true);
+ creature->SetVisible(true);
+ creature->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_NOT_SELECTABLE);
+ if (!creature->isAlive())
+ creature->Respawn(true);
+ if (aggressive)
+ creature->SetReactState(REACT_AGGRESSIVE);
+ else
+ {
+ creature->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE);
+ creature->SetReactState(REACT_PASSIVE);
+ }
+}
+
+// ****************************************************
+// ******************* Group System *******************
+// ****************************************************
+Group* Battlefield::GetFreeBfRaid(TeamId TeamId)
+{
+ for (GuidSet::const_iterator itr = m_Groups[TeamId].begin(); itr != m_Groups[TeamId].end(); ++itr)
+ if (Group* group = sGroupMgr->GetGroupByGUID(*itr))
+ if (!group->IsFull())
+ return group;
+
+ return NULL;
+}
+
+Group* Battlefield::GetGroupPlayer(uint64 guid, TeamId TeamId)
+{
+ for (GuidSet::const_iterator itr = m_Groups[TeamId].begin(); itr != m_Groups[TeamId].end(); ++itr)
+ if (Group* group = sGroupMgr->GetGroupByGUID(*itr))
+ if (group->IsMember(guid))
+ return group;
+
+ return NULL;
+}
+
+bool Battlefield::AddOrSetPlayerToCorrectBfGroup(Player* player)
+{
+ if (!player->IsInWorld())
+ return false;
+
+ if (Group* group = player->GetGroup())
+ group->RemoveMember(player->GetGUID());
+
+ Group* group = GetFreeBfRaid(player->GetTeamId());
+ if (!group)
+ {
+ group = new Group;
+ group->SetBattlefieldGroup(this);
+ group->Create(player);
+ sGroupMgr->AddGroup(group);
+ m_Groups[player->GetTeamId()].insert(group->GetGUID());
+ }
+ else if (group->IsMember(player->GetGUID()))
+ {
+ uint8 subgroup = group->GetMemberGroup(player->GetGUID());
+ player->SetBattlegroundOrBattlefieldRaid(group, subgroup);
+ }
+ else
+ group->AddMember(player);
+
+ return true;
+}
+
+//***************End of Group System*******************
+
+//*****************************************************
+//***************Spirit Guide System*******************
+//*****************************************************
+
+//--------------------
+//-Battlefield Method-
+//--------------------
+BfGraveyard* Battlefield::GetGraveyardById(uint32 id)
+{
+ if (id < m_GraveyardList.size())
+ {
+ if (m_GraveyardList[id])
+ return m_GraveyardList[id];
+ else
+ sLog->outError(LOG_FILTER_BATTLEFIELD, "Battlefield::GetGraveyardById Id:%u not existed", id);
+ }
+ else
+ sLog->outError(LOG_FILTER_BATTLEFIELD, "Battlefield::GetGraveyardById Id:%u cant be found", id);
+
+ return NULL;
+}
+
+WorldSafeLocsEntry const * Battlefield::GetClosestGraveYard(Player* player)
+{
+ BfGraveyard* closestGY = NULL;
+ float maxdist = -1;
+ for (uint8 i = 0; i < m_GraveyardList.size(); i++)
+ {
+ if (m_GraveyardList[i])
+ {
+ if (m_GraveyardList[i]->GetControlTeamId() != player->GetTeamId())
+ continue;
+
+ float dist = m_GraveyardList[i]->GetDistance(player);
+ if (dist < maxdist || maxdist < 0)
+ {
+ closestGY = m_GraveyardList[i];
+ maxdist = dist;
+ }
+ }
+ }
+
+ if (closestGY)
+ return sWorldSafeLocsStore.LookupEntry(closestGY->GetGraveyardId());
+
+ return NULL;
+}
+
+void Battlefield::AddPlayerToResurrectQueue(uint64 npcGuid, uint64 playerGuid)
+{
+ for (uint8 i = 0; i < m_GraveyardList.size(); i++)
+ {
+ if (!m_GraveyardList[i])
+ continue;
+
+ if (m_GraveyardList[i]->HasNpc(npcGuid))
+ {
+ m_GraveyardList[i]->AddPlayer(playerGuid);
+ break;
+ }
+ }
+}
+
+void Battlefield::RemovePlayerFromResurrectQueue(uint64 playerGuid)
+{
+ for (uint8 i = 0; i < m_GraveyardList.size(); i++)
+ {
+ if (!m_GraveyardList[i])
+ continue;
+
+ if (m_GraveyardList[i]->HasPlayer(playerGuid))
+ {
+ m_GraveyardList[i]->RemovePlayer(playerGuid);
+ break;
+ }
+ }
+}
+
+void Battlefield::SendAreaSpiritHealerQueryOpcode(Player* player, const uint64 &guid)
+{
+ WorldPacket data(SMSG_AREA_SPIRIT_HEALER_TIME, 12);
+ uint32 time = m_LastResurectTimer; // resurrect every 30 seconds
+
+ data << guid << time;
+ ASSERT(player && player->GetSession());
+ player->GetSession()->SendPacket(&data);
+}
+
+// ----------------------
+// - BfGraveyard Method -
+// ----------------------
+BfGraveyard::BfGraveyard(Battlefield* battlefield)
+{
+ m_Bf = battlefield;
+ m_GraveyardId = 0;
+ m_ControlTeam = TEAM_NEUTRAL;
+ m_SpiritGuide[0] = 0;
+ m_SpiritGuide[1] = 0;
+ m_ResurrectQueue.clear();
+}
+
+void BfGraveyard::Initialize(TeamId startControl, uint32 graveyardId)
+{
+ m_ControlTeam = startControl;
+ m_GraveyardId = graveyardId;
+}
+
+void BfGraveyard::SetSpirit(Creature* spirit, TeamId team)
+{
+ if (!spirit)
+ {
+ sLog->outError(LOG_FILTER_BATTLEFIELD, "BfGraveyard::SetSpirit: Invalid Spirit.");
+ return;
+ }
+
+ m_SpiritGuide[team] = spirit->GetGUID();
+ spirit->SetReactState(REACT_PASSIVE);
+}
+
+float BfGraveyard::GetDistance(Player* player)
+{
+ const WorldSafeLocsEntry* safeLoc = sWorldSafeLocsStore.LookupEntry(m_GraveyardId);
+ return player->GetDistance2d(safeLoc->x, safeLoc->y);
+}
+
+void BfGraveyard::AddPlayer(uint64 playerGuid)
+{
+ if (!m_ResurrectQueue.count(playerGuid))
+ {
+ m_ResurrectQueue.insert(playerGuid);
+
+ if (Player* player = sObjectAccessor->FindPlayer(playerGuid))
+ player->CastSpell(player, SPELL_WAITING_FOR_RESURRECT, true);
+ }
+}
+
+void BfGraveyard::RemovePlayer(uint64 playerGuid)
+{
+ m_ResurrectQueue.erase(m_ResurrectQueue.find(playerGuid));
+
+ if (Player* player = sObjectAccessor->FindPlayer(playerGuid))
+ player->RemoveAurasDueToSpell(SPELL_WAITING_FOR_RESURRECT);
+}
+
+void BfGraveyard::Resurrect()
+{
+ if (m_ResurrectQueue.empty())
+ return;
+
+ for (GuidSet::const_iterator itr = m_ResurrectQueue.begin(); itr != m_ResurrectQueue.end(); ++itr)
+ {
+ // Get player object from his guid
+ Player* player = sObjectAccessor->FindPlayer(*itr);
+ if (!player)
+ continue;
+
+ // Check if the player is in world and on the good graveyard
+ if (player->IsInWorld())
+ if (Unit* spirit = sObjectAccessor->FindUnit(m_SpiritGuide[m_ControlTeam]))
+ spirit->CastSpell(spirit, SPELL_SPIRIT_HEAL, true);
+
+ // Resurect player
+ player->CastSpell(player, SPELL_RESURRECTION_VISUAL, true);
+ player->ResurrectPlayer(1.0f);
+ player->CastSpell(player, 6962, true);
+ player->CastSpell(player, SPELL_SPIRIT_HEAL_MANA, true);
+
+ sObjectAccessor->ConvertCorpseForPlayer(player->GetGUID());
+ }
+
+ m_ResurrectQueue.clear();
+}
+
+// For changing graveyard control
+void BfGraveyard::GiveControlTo(TeamId team)
+{
+ // Guide switching
+ // Note: Visiblity changes are made by phasing
+ /*if (m_SpiritGuide[1 - team])
+ m_SpiritGuide[1 - team]->SetVisible(false);
+ if (m_SpiritGuide[team])
+ m_SpiritGuide[team]->SetVisible(true);*/
+
+ m_ControlTeam = team;
+ // Teleport to other graveyard, player witch were on this graveyard
+ RelocateDeadPlayers();
+}
+
+void BfGraveyard::RelocateDeadPlayers()
+{
+ WorldSafeLocsEntry const* closestGrave = NULL;
+ for (GuidSet::const_iterator itr = m_ResurrectQueue.begin(); itr != m_ResurrectQueue.end(); ++itr)
+ {
+ Player* player = sObjectAccessor->FindPlayer(*itr);
+ if (!player)
+ continue;
+
+ if (closestGrave)
+ player->TeleportTo(player->GetMapId(), closestGrave->x, closestGrave->y, closestGrave->z, player->GetOrientation());
+ else
+ {
+ closestGrave = m_Bf->GetClosestGraveYard(player);
+ if (closestGrave)
+ player->TeleportTo(player->GetMapId(), closestGrave->x, closestGrave->y, closestGrave->z, player->GetOrientation());
+ }
+ }
+}
+
+// *******************************************************
+// *************** End Spirit Guide system ***************
+// *******************************************************
+// ********************** Misc ***************************
+// *******************************************************
+
+Creature* Battlefield::SpawnCreature(uint32 entry, Position pos, TeamId team)
+{
+ return SpawnCreature(entry, pos.m_positionX, pos.m_positionY, pos.m_positionZ, pos.m_orientation, team);
+}
+
+Creature* Battlefield::SpawnCreature(uint32 entry, float x, float y, float z, float o, TeamId team)
+{
+ //Get map object
+ Map* map = const_cast < Map * >(sMapMgr->CreateBaseMap(m_MapId));
+ if (!map)
+ {
+ sLog->outError(LOG_FILTER_BATTLEFIELD, "Battlefield::SpawnCreature: Can't create creature entry: %u map not found", entry);
+ return 0;
+ }
+
+ Creature* creature = new Creature;
+ if (!creature->Create(sObjectMgr->GenerateLowGuid(HIGHGUID_UNIT), map, PHASEMASK_NORMAL, entry, 0, team, x, y, z, o))
+ {
+ sLog->outError(LOG_FILTER_BATTLEFIELD, "Battlefield::SpawnCreature: Can't create creature entry: %u", entry);
+ delete creature;
+ return NULL;
+ }
+
+ creature->SetHomePosition(x, y, z, o);
+
+ CreatureTemplate const* cinfo = sObjectMgr->GetCreatureTemplate(entry);
+ if (!cinfo)
+ {
+ sLog->outError(LOG_FILTER_BATTLEFIELD, "Battlefield::SpawnCreature: entry %u does not exist.", entry);
+ return NULL;
+ }
+ // force using DB speeds -- do we really need this?
+ creature->SetSpeed(MOVE_WALK, cinfo->speed_walk);
+ creature->SetSpeed(MOVE_RUN, cinfo->speed_run);
+
+ // Set creature in world
+ map->AddToMap(creature);
+ creature->setActive(true);
+
+ return creature;
+}
+
+// Method for spawning gameobject on map
+GameObject* Battlefield::SpawnGameObject(uint32 entry, float x, float y, float z, float o)
+{
+ // Get map object
+ Map* map = const_cast<Map*>(sMapMgr->CreateBaseMap(571)); // *vomits*
+ if (!map)
+ return 0;
+
+ // Create gameobject
+ GameObject* go = new GameObject;
+ if (!go->Create(sObjectMgr->GenerateLowGuid(HIGHGUID_GAMEOBJECT), entry, map, PHASEMASK_NORMAL, x, y, z, o, 0, 0, 0, 0, 100, GO_STATE_READY))
+ {
+ sLog->outError(LOG_FILTER_BATTLEFIELD, "Battlefield::SpawnGameObject: Gameobject template %u not found in database! Battlefield not created!", entry);
+ sLog->outError(LOG_FILTER_BATTLEFIELD, "Battlefield::SpawnGameObject: Cannot create gameobject template %u! Battlefield not created!", entry);
+ delete go;
+ return NULL;
+ }
+
+ // Add to world
+ map->AddToMap(go);
+ go->setActive(true);
+
+ return go;
+}
+
+// *******************************************************
+// ******************* CapturePoint **********************
+// *******************************************************
+
+BfCapturePoint::BfCapturePoint(Battlefield* battlefield) : m_Bf(battlefield), m_capturePoint(NULL)
+{
+ m_team = TEAM_NEUTRAL;
+ m_value = 0;
+ m_minValue = 0.0f;
+ m_maxValue = 0.0f;
+ m_State = BF_CAPTUREPOINT_OBJECTIVESTATE_NEUTRAL;
+ m_OldState = BF_CAPTUREPOINT_OBJECTIVESTATE_NEUTRAL;
+ m_capturePointEntry = 0;
+ m_neutralValuePct = 0;
+ m_maxSpeed = 0;
+}
+
+bool BfCapturePoint::HandlePlayerEnter(Player* player)
+{
+ if (m_capturePoint)
+ {
+ player->SendUpdateWorldState(m_capturePoint->GetGOInfo()->capturePoint.worldState1, 1);
+ player->SendUpdateWorldState(m_capturePoint->GetGOInfo()->capturePoint.worldstate2, uint32(ceil((m_value + m_maxValue) / (2 * m_maxValue) * 100.0f)));
+ player->SendUpdateWorldState(m_capturePoint->GetGOInfo()->capturePoint.worldstate3, m_neutralValuePct);
+ }
+ return m_activePlayers[player->GetTeamId()].insert(player->GetGUID()).second;
+}
+
+GuidSet::iterator BfCapturePoint::HandlePlayerLeave(Player* player)
+{
+ if (m_capturePoint)
+ player->SendUpdateWorldState(m_capturePoint->GetGOInfo()->capturePoint.worldState1, 0);
+
+ GuidSet::iterator current = m_activePlayers[player->GetTeamId()].find(player->GetGUID());
+
+ if (current == m_activePlayers[player->GetTeamId()].end())
+ return current; // return end()
+
+ m_activePlayers[player->GetTeamId()].erase(current++);
+ return current;
+}
+
+void BfCapturePoint::SendChangePhase()
+{
+ if (!m_capturePoint)
+ return;
+
+ // send this too, sometimes the slider disappears, dunno why :(
+ SendUpdateWorldState(m_capturePoint->GetGOInfo()->capturePoint.worldState1, 1);
+ // send these updates to only the ones in this objective
+ SendUpdateWorldState(m_capturePoint->GetGOInfo()->capturePoint.worldstate2, (uint32) ceil((m_value + m_maxValue) / (2 * m_maxValue) * 100.0f));
+ // send this too, sometimes it resets :S
+ SendUpdateWorldState(m_capturePoint->GetGOInfo()->capturePoint.worldstate3, m_neutralValuePct);
+}
+
+bool BfCapturePoint::SetCapturePointData(GameObject* capturePoint)
+{
+ ASSERT(capturePoint);
+
+ sLog->outDebug(LOG_FILTER_BATTLEFIELD, "Creating capture point %u", capturePoint->GetEntry());
+
+ m_capturePoint = capturePoint;
+
+ // check info existence
+ GameObjectTemplate const* goinfo = capturePoint->GetGOInfo();
+ if (goinfo->type != GAMEOBJECT_TYPE_CAPTURE_POINT)
+ {
+ sLog->outError(LOG_FILTER_GENERAL, "OutdoorPvP: GO %u is not capture point!", capturePoint->GetEntry());
+ return false;
+ }
+
+ // get the needed values from goinfo
+ m_maxValue = goinfo->capturePoint.maxTime;
+ m_maxSpeed = m_maxValue / (goinfo->capturePoint.minTime ? goinfo->capturePoint.minTime : 60);
+ m_neutralValuePct = goinfo->capturePoint.neutralPercent;
+ m_minValue = m_maxValue * goinfo->capturePoint.neutralPercent / 100;
+ m_capturePointEntry = capturePoint->GetEntry();
+ if (m_team == TEAM_ALLIANCE)
+ {
+ m_value = m_maxValue;
+ m_State = BF_CAPTUREPOINT_OBJECTIVESTATE_ALLIANCE;
+ }
+ else
+ {
+ m_value = -m_maxValue;
+ m_State = BF_CAPTUREPOINT_OBJECTIVESTATE_HORDE;
+ }
+
+ return true;
+}
+
+bool BfCapturePoint::DelCapturePoint()
+{
+ if (m_capturePoint)
+ {
+ m_capturePoint->SetRespawnTime(0); // not save respawn time
+ m_capturePoint->Delete();
+ m_capturePoint = NULL;
+ }
+
+ return true;
+}
+
+bool BfCapturePoint::Update(uint32 diff)
+{
+ if (!m_capturePoint)
+ return false;
+
+ float radius = m_capturePoint->GetGOInfo()->capturePoint.radius;
+
+ for (uint8 team = 0; team < 2; ++team)
+ {
+ for (GuidSet::iterator itr = m_activePlayers[team].begin(); itr != m_activePlayers[team].end();)
+ {
+ if (Player* player = sObjectAccessor->FindPlayer(*itr))
+ {
+ if (!m_capturePoint->IsWithinDistInMap(player, radius) || !player->IsOutdoorPvPActive())
+ itr = HandlePlayerLeave(player);
+ else
+ ++itr;
+ }
+ else
+ ++itr;
+ }
+ }
+
+ std::list<Player*> players;
+ Trinity::AnyPlayerInObjectRangeCheck checker(m_capturePoint, radius);
+ Trinity::PlayerListSearcher<Trinity::AnyPlayerInObjectRangeCheck> searcher(m_capturePoint, players, checker);
+ m_capturePoint->VisitNearbyWorldObject(radius, searcher);
+
+ for (std::list<Player*>::iterator itr = players.begin(); itr != players.end(); ++itr)
+ if ((*itr)->IsOutdoorPvPActive())
+ if (m_activePlayers[(*itr)->GetTeamId()].insert((*itr)->GetGUID()).second)
+ HandlePlayerEnter(*itr);
+
+ // get the difference of numbers
+ float fact_diff = ((float) m_activePlayers[0].size() - (float) m_activePlayers[1].size()) * diff / BATTLEFIELD_OBJECTIVE_UPDATE_INTERVAL;
+ if (!fact_diff)
+ return false;
+
+ uint32 Challenger = 0;
+ float maxDiff = m_maxSpeed * diff;
+
+ if (fact_diff < 0)
+ {
+ // horde is in majority, but it's already horde-controlled -> no change
+ if (m_State == BF_CAPTUREPOINT_OBJECTIVESTATE_HORDE && m_value <= -m_maxValue)
+ return false;
+
+ if (fact_diff < -maxDiff)
+ fact_diff = -maxDiff;
+
+ Challenger = HORDE;
+ }
+ else
+ {
+ // ally is in majority, but it's already ally-controlled -> no change
+ if (m_State == BF_CAPTUREPOINT_OBJECTIVESTATE_ALLIANCE && m_value >= m_maxValue)
+ return false;
+
+ if (fact_diff > maxDiff)
+ fact_diff = maxDiff;
+
+ Challenger = ALLIANCE;
+ }
+
+ float oldValue = m_value;
+ TeamId oldTeam = m_team;
+
+ m_OldState = m_State;
+
+ m_value += fact_diff;
+
+ if (m_value < -m_minValue) // red
+ {
+ if (m_value < -m_maxValue)
+ m_value = -m_maxValue;
+ m_State = BF_CAPTUREPOINT_OBJECTIVESTATE_HORDE;
+ m_team = TEAM_HORDE;
+ }
+ else if (m_value > m_minValue) // blue
+ {
+ if (m_value > m_maxValue)
+ m_value = m_maxValue;
+ m_State = BF_CAPTUREPOINT_OBJECTIVESTATE_ALLIANCE;
+ m_team = TEAM_ALLIANCE;
+ }
+ else if (oldValue * m_value <= 0) // grey, go through mid point
+ {
+ // if challenger is ally, then n->a challenge
+ if (Challenger == ALLIANCE)
+ m_State = BF_CAPTUREPOINT_OBJECTIVESTATE_NEUTRAL_ALLIANCE_CHALLENGE;
+ // if challenger is horde, then n->h challenge
+ else if (Challenger == HORDE)
+ m_State = BF_CAPTUREPOINT_OBJECTIVESTATE_NEUTRAL_HORDE_CHALLENGE;
+ m_team = TEAM_NEUTRAL;
+ }
+ else // grey, did not go through mid point
+ {
+ // old phase and current are on the same side, so one team challenges the other
+ if (Challenger == ALLIANCE && (m_OldState == BF_CAPTUREPOINT_OBJECTIVESTATE_HORDE || m_OldState == BF_CAPTUREPOINT_OBJECTIVESTATE_NEUTRAL_HORDE_CHALLENGE))
+ m_State = BF_CAPTUREPOINT_OBJECTIVESTATE_HORDE_ALLIANCE_CHALLENGE;
+ else if (Challenger == HORDE && (m_OldState == BF_CAPTUREPOINT_OBJECTIVESTATE_ALLIANCE || m_OldState == BF_CAPTUREPOINT_OBJECTIVESTATE_NEUTRAL_ALLIANCE_CHALLENGE))
+ m_State = BF_CAPTUREPOINT_OBJECTIVESTATE_ALLIANCE_HORDE_CHALLENGE;
+ m_team = TEAM_NEUTRAL;
+ }
+
+ if (m_value != oldValue)
+ SendChangePhase();
+
+ if (m_OldState != m_State)
+ {
+ //sLog->outError(LOG_FILTER_BATTLEFIELD, "%u->%u", m_OldState, m_State);
+ if (oldTeam != m_team)
+ ChangeTeam(oldTeam);
+ return true;
+ }
+
+ return false;
+}
+
+void BfCapturePoint::SendUpdateWorldState(uint32 field, uint32 value)
+{
+ for (uint8 team = 0; team < 2; ++team)
+ for (GuidSet::iterator itr = m_activePlayers[team].begin(); itr != m_activePlayers[team].end(); ++itr) // send to all players present in the area
+ if (Player* player = sObjectAccessor->FindPlayer(*itr))
+ player->SendUpdateWorldState(field, value);
+}
+
+void BfCapturePoint::SendObjectiveComplete(uint32 id, uint64 guid)
+{
+ uint8 team;
+ switch (m_State)
+ {
+ case BF_CAPTUREPOINT_OBJECTIVESTATE_ALLIANCE:
+ team = 0;
+ break;
+ case BF_CAPTUREPOINT_OBJECTIVESTATE_HORDE:
+ team = 1;
+ break;
+ default:
+ return;
+ }
+
+ // send to all players present in the area
+ for (GuidSet::iterator itr = m_activePlayers[team].begin(); itr != m_activePlayers[team].end(); ++itr)
+ if (Player* player = sObjectAccessor->FindPlayer(*itr))
+ player->KilledMonsterCredit(id, guid);
+}
+
+bool BfCapturePoint::IsInsideObjective(Player* player) const
+{
+ return m_activePlayers[player->GetTeamId()].find(player->GetGUID()) != m_activePlayers[player->GetTeamId()].end();
+}
diff --git a/src/server/game/Battlefield/Battlefield.h b/src/server/game/Battlefield/Battlefield.h
new file mode 100644
index 00000000000..480aafbeb42
--- /dev/null
+++ b/src/server/game/Battlefield/Battlefield.h
@@ -0,0 +1,430 @@
+/*
+ * Copyright (C) 2008-2010 TrinityCore <http://www.trinitycore.org/>
+ * Copyright (C) 2005-2009 MaNGOS <http://getmangos.com/>
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation; either version 2 of the License, or (at your
+ * option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
+ * more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef BATTLEFIELD_H_
+#define BATTLEFIELD_H_
+
+#include "Utilities/Util.h"
+#include "SharedDefines.h"
+#include "ZoneScript.h"
+#include "WorldPacket.h"
+#include "GameObject.h"
+#include "Battleground.h"
+#include "ObjectAccessor.h"
+
+enum BattlefieldTypes
+{
+ BATTLEFIELD_WG // Wintergrasp
+};
+
+enum BattlefieldIDs
+{
+ BATTLEFIELD_BATTLEID_WG = 1 // Wintergrasp battle
+};
+
+enum BattlefieldObjectiveStates
+{
+ BF_CAPTUREPOINT_OBJECTIVESTATE_NEUTRAL = 0,
+ BF_CAPTUREPOINT_OBJECTIVESTATE_ALLIANCE,
+ BF_CAPTUREPOINT_OBJECTIVESTATE_HORDE,
+ BF_CAPTUREPOINT_OBJECTIVESTATE_NEUTRAL_ALLIANCE_CHALLENGE,
+ BF_CAPTUREPOINT_OBJECTIVESTATE_NEUTRAL_HORDE_CHALLENGE,
+ BF_CAPTUREPOINT_OBJECTIVESTATE_ALLIANCE_HORDE_CHALLENGE,
+ BF_CAPTUREPOINT_OBJECTIVESTATE_HORDE_ALLIANCE_CHALLENGE
+};
+
+enum BattlefieldSounds
+{
+ BF_HORDE_WINS = 8454,
+ BF_ALLIANCE_WINS = 8455,
+ BF_START = 3439
+};
+
+enum BattlefieldTimers
+{
+ BATTLEFIELD_OBJECTIVE_UPDATE_INTERVAL = 1000
+};
+
+// some class predefs
+class Player;
+class GameObject;
+class WorldPacket;
+class Creature;
+class Unit;
+
+class Battlefield;
+class BfGraveyard;
+
+typedef std::set<uint64> GuidSet;
+typedef std::vector<BfGraveyard*> GraveyardVect;
+typedef std::map<uint64, uint32> PlayerTimerMap;
+
+class BfCapturePoint
+{
+ public:
+ BfCapturePoint(Battlefield* bf);
+
+ virtual void FillInitialWorldStates(WorldPacket& /*data*/) {}
+
+ // Send world state update to all players present
+ void SendUpdateWorldState(uint32 field, uint32 value);
+
+ // Send kill notify to players in the controlling faction
+ void SendObjectiveComplete(uint32 id, uint64 guid);
+
+ // Used when player is activated/inactivated in the area
+ virtual bool HandlePlayerEnter(Player* player);
+ virtual GuidSet::iterator HandlePlayerLeave(Player* player);
+ //virtual void HandlePlayerActivityChanged(Player* player);
+
+ // Checks if player is in range of a capture credit marker
+ bool IsInsideObjective(Player* player) const;
+
+ // Returns true if the state of the objective has changed, in this case, the OutdoorPvP must send a world state ui update.
+ virtual bool Update(uint32 diff);
+ virtual void ChangeTeam(TeamId /*oldTeam*/) {}
+ virtual void SendChangePhase();
+
+ bool SetCapturePointData(GameObject* capturePoint);
+ GameObject* GetCapturePointGo() { return m_capturePoint; }
+
+ TeamId GetTeamId() { return m_team; }
+ protected:
+ bool DelCapturePoint();
+
+ // active Players in the area of the objective, 0 - alliance, 1 - horde
+ GuidSet m_activePlayers[2];
+
+ // Total shift needed to capture the objective
+ float m_maxValue;
+ float m_minValue;
+
+ // Maximum speed of capture
+ float m_maxSpeed;
+
+ // The status of the objective
+ float m_value;
+ TeamId m_team;
+
+ // Objective states
+ BattlefieldObjectiveStates m_OldState;
+ BattlefieldObjectiveStates m_State;
+
+ // Neutral value on capture bar
+ uint32 m_neutralValuePct;
+
+ // Pointer to the Battlefield this objective belongs to
+ Battlefield* m_Bf;
+
+ // Capture point entry
+ uint32 m_capturePointEntry;
+
+ // Gameobject related to that capture point
+ GameObject* m_capturePoint;
+};
+
+class BfGraveyard
+{
+ public:
+ BfGraveyard(Battlefield* Bf);
+
+ // Method to changing who controls the graveyard
+ void GiveControlTo(TeamId team);
+ TeamId GetControlTeamId() { return m_ControlTeam; }
+
+ // Find the nearest graveyard to a player
+ float GetDistance(Player* player);
+
+ // Initialize the graveyard
+ void Initialize(TeamId startcontrol, uint32 gy);
+
+ // Set spirit service for the graveyard
+ void SetSpirit(Creature* spirit, TeamId team);
+
+ // Add a player to the graveyard
+ void AddPlayer(uint64 player_guid);
+
+ // Remove a player from the graveyard
+ void RemovePlayer(uint64 player_guid);
+
+ // Resurrect players
+ void Resurrect();
+
+ // Move players waiting to that graveyard on the nearest one
+ void RelocateDeadPlayers();
+
+ // Check if this graveyard has a spirit guide
+ bool HasNpc(uint64 guid)
+ {
+ if (!m_SpiritGuide[0] || !m_SpiritGuide[1])
+ return false;
+
+ if (!sObjectAccessor->FindUnit(m_SpiritGuide[0]) ||
+ !sObjectAccessor->FindUnit(m_SpiritGuide[1]))
+ return false;
+
+ return (m_SpiritGuide[0] == guid || m_SpiritGuide[1] == guid);
+ }
+
+ // Check if a player is in this graveyard's ressurect queue
+ bool HasPlayer(uint64 guid) { return m_ResurrectQueue.find(guid) != m_ResurrectQueue.end(); }
+
+ // Get the graveyard's ID.
+ uint32 GetGraveyardId() { return m_GraveyardId; }
+
+ protected:
+ TeamId m_ControlTeam;
+ uint32 m_GraveyardId;
+ uint64 m_SpiritGuide[2];
+ GuidSet m_ResurrectQueue;
+ Battlefield* m_Bf;
+};
+
+class Battlefield : public ZoneScript
+{
+ friend class BattlefieldMgr;
+
+ public:
+ /// Constructor
+ Battlefield();
+ /// Destructor
+ virtual ~Battlefield();
+
+ /// typedef of map witch store capturepoint and the associate gameobject entry
+ typedef std::map<uint32 /*lowguid */, BfCapturePoint*> BfCapturePointMap;
+
+ /// Call this to init the Battlefield
+ virtual bool SetupBattlefield() { return true; }
+
+ /// Generate packet which contain all worldstatedata of area
+ virtual void FillInitialWorldStates(WorldPacket& /*data*/) {}
+
+ /// Update data of a worldstate to all players present in zone
+ void SendUpdateWorldState(uint32 field, uint32 value);
+
+ /**
+ * \brief Called every time for update bf data and time
+ * - Update timer for start/end battle
+ * - Invite player in zone to queue m_StartGroupingTimer minutes before start
+ * - Kick Afk players
+ * \param diff : time ellapsed since last call (in ms)
+ */
+ virtual bool Update(uint32 diff);
+
+ /// Invite all players in zone to join the queue, called x minutes before battle start in Update()
+ void InvitePlayersInZoneToQueue();
+ /// Invite all players in queue to join battle on battle start
+ void InvitePlayersInQueueToWar();
+ /// Invite all players in zone to join battle on battle start
+ void InvitePlayersInZoneToWar();
+
+ /// Called when a Unit is kill in battlefield zone
+ virtual void HandleKill(Player* /*killer*/, Unit* /*killed*/) {};
+
+ uint32 GetTypeId() { return m_TypeId; }
+ uint32 GetZoneId() { return m_ZoneId; }
+
+ void TeamApplyBuff(TeamId team, uint32 spellId, uint32 spellId2 = 0);
+
+ /// Return true if battle is start, false if battle is not started
+ bool IsWarTime() { return m_isActive; }
+
+ /// Enable or Disable battlefield
+ void ToggleBattlefield(bool enable) { m_IsEnabled = enable; }
+ /// Return if battlefield is enable
+ bool IsEnabled() { return m_IsEnabled; }
+
+ /**
+ * \brief Kick player from battlefield and teleport him to kick-point location
+ * \param guid : guid of player who must be kick
+ */
+ void KickPlayerFromBattlefield(uint64 guid);
+
+ /// Called when player (player) enter in zone
+ void HandlePlayerEnterZone(Player* player, uint32 zone);
+ /// Called when player (player) leave the zone
+ void HandlePlayerLeaveZone(Player* player, uint32 zone);
+
+ // All-purpose data storage 64 bit
+ virtual uint64 GetData64(uint32 dataId) { return m_Data64[dataId]; }
+ virtual void SetData64(uint32 dataId, uint64 value) { m_Data64[dataId] = value; }
+
+ // All-purpose data storage 32 bit
+ virtual uint32 GetData(uint32 dataId) { return m_Data32[dataId]; }
+ virtual void SetData(uint32 dataId, uint32 value) { m_Data32[dataId] = value; }
+ virtual void UpdateData(uint32 index, int32 pad) { m_Data32[index] += pad; }
+
+ // Battlefield - generic methods
+ TeamId GetDefenderTeam() { return m_DefenderTeam; }
+ TeamId GetAttackerTeam() { return TeamId(1 - m_DefenderTeam); }
+ TeamId GetOtherTeam(TeamId team) { return (team == TEAM_HORDE ? TEAM_ALLIANCE : TEAM_HORDE); }
+ void SetDefenderTeam(TeamId team) { m_DefenderTeam = team; }
+
+ // Group methods
+ /**
+ * \brief Find a not full battlefield group, if there is no, create one
+ * \param TeamId : Id of player team for who we search a group (player->GetTeamId())
+ */
+ Group* GetFreeBfRaid(TeamId TeamId);
+ /// Return battlefield group where player is.
+ Group* GetGroupPlayer(uint64 guid, TeamId TeamId);
+ /// Force player to join a battlefield group
+ bool AddOrSetPlayerToCorrectBfGroup(Player* player);
+
+ // Graveyard methods
+ // Find which graveyard the player must be teleported to to be resurrected by spiritguide
+ WorldSafeLocsEntry const * GetClosestGraveYard(Player* player);
+
+ virtual void AddPlayerToResurrectQueue(uint64 npc_guid, uint64 player_guid);
+ void RemovePlayerFromResurrectQueue(uint64 player_guid);
+ void SetGraveyardNumber(uint32 number) { m_GraveyardList.resize(number); }
+ BfGraveyard* GetGraveyardById(uint32 id);
+
+ // Misc methods
+ Creature* SpawnCreature(uint32 entry, float x, float y, float z, float o, TeamId team);
+ Creature* SpawnCreature(uint32 entry, Position pos, TeamId team);
+ GameObject* SpawnGameObject(uint32 entry, float x, float y, float z, float o);
+
+ // Script-methods
+
+ /// Called on start
+ virtual void OnBattleStart() {};
+ /// Called at the end of battle
+ virtual void OnBattleEnd(bool /*endByTimer*/) {};
+ /// Called x minutes before battle start when player in zone are invite to join queue
+ virtual void OnStartGrouping() {};
+ /// Called when a player accept to join the battle
+ virtual void OnPlayerJoinWar(Player* /*player*/) {};
+ /// Called when a player leave the battle
+ virtual void OnPlayerLeaveWar(Player* /*player*/) {};
+ /// Called when a player leave battlefield zone
+ virtual void OnPlayerLeaveZone(Player* /*player*/) {};
+ /// Called when a player enter in battlefield zone
+ virtual void OnPlayerEnterZone(Player* /*player*/) {};
+
+ WorldPacket BuildWarningAnnPacket(std::string msg);
+ void SendWarningToAllInZone(uint32 entry);
+ //void SendWarningToAllInWar(int32 entry, ...); -- UNUSED
+ void SendWarningToPlayer(Player* player, uint32 entry);
+
+ void PlayerAcceptInviteToQueue(Player* player);
+ void PlayerAcceptInviteToWar(Player* player);
+ uint32 GetBattleId() { return m_BattleId; }
+ void AskToLeaveQueue(Player* player);
+
+ virtual void DoCompleteOrIncrementAchievement(uint32 /*achievement*/, Player* /*player*/, uint8 /*incrementNumber = 1*/) {};
+
+ /// Send all worldstate data to all player in zone.
+ virtual void SendInitWorldStatesToAll() {};
+
+ /// Return if we can use mount in battlefield
+ bool CanFlyIn() { return !m_isActive; }
+
+ void SendAreaSpiritHealerQueryOpcode(Player* player, const uint64 & guid);
+
+ void StartBattle();
+ void EndBattle(bool endByTimer);
+
+ void HideNpc(Creature* creature);
+ void ShowNpc(Creature* creature, bool aggressive);
+
+ GraveyardVect GetGraveyardVector() { return m_GraveyardList; }
+
+ uint32 GetTimer() { return m_Timer; }
+ void SetTimer(uint32 timer) { m_Timer = timer; }
+
+ void DoPlaySoundToAll(uint32 SoundID);
+
+ void InvitePlayerToQueue(Player* player);
+ void InvitePlayerToWar(Player* player);
+
+ void InitStalker(uint32 entry, float x, float y, float z, float o);
+
+ protected:
+ uint64 StalkerGuid;
+ uint32 m_Timer; // Global timer for event
+ bool m_IsEnabled;
+ bool m_isActive;
+ TeamId m_DefenderTeam;
+
+ // Map of the objectives belonging to this OutdoorPvP
+ BfCapturePointMap m_capturePoints;
+
+ // Players info maps
+ GuidSet m_players[BG_TEAMS_COUNT]; // Players in zone
+ GuidSet m_PlayersInQueue[BG_TEAMS_COUNT]; // Players in the queue
+ GuidSet m_PlayersInWar[BG_TEAMS_COUNT]; // Players in WG combat
+ PlayerTimerMap m_InvitedPlayers[BG_TEAMS_COUNT];
+ PlayerTimerMap m_PlayersWillBeKick[BG_TEAMS_COUNT];
+
+ // Variables that must exist for each battlefield
+ uint32 m_TypeId; // See enum BattlefieldTypes
+ uint32 m_BattleId; // BattleID (for packet)
+ uint32 m_ZoneId; // ZoneID of Wintergrasp = 4197
+ uint32 m_MapId; // MapId where is Battlefield
+ uint32 m_MaxPlayer; // Maximum number of player that participated to Battlefield
+ uint32 m_MinPlayer; // Minimum number of player for Battlefield start
+ uint32 m_MinLevel; // Required level to participate at Battlefield
+ uint32 m_BattleTime; // Length of a battle
+ uint32 m_NoWarBattleTime; // Time between two battles
+ uint32 m_RestartAfterCrash; // Delay to restart Wintergrasp if the server crashed during a running battle.
+ uint32 m_TimeForAcceptInvite;
+ uint32 m_uiKickDontAcceptTimer;
+ WorldLocation KickPosition; // Position where players are teleported if they switch to afk during the battle or if they don't accept invitation
+
+ uint32 m_uiKickAfkPlayersTimer; // Timer for check Afk in war
+
+ // Graveyard variables
+ GraveyardVect m_GraveyardList; // Vector witch contain the different GY of the battle
+ uint32 m_LastResurectTimer; // Timer for resurect player every 30 sec
+
+ uint32 m_StartGroupingTimer; // Timer for invite players in area 15 minute before start battle
+ bool m_StartGrouping; // bool for know if all players in area has been invited
+
+ GuidSet m_Groups[BG_TEAMS_COUNT]; // Contain different raid group
+
+ std::vector<uint64> m_Data64;
+ std::vector<uint32> m_Data32;
+
+ void KickAfkPlayers();
+
+ // use for switch off all worldstate for client
+ virtual void SendRemoveWorldStates(Player* /*player*/) {}
+
+ // use for send a packet for all player list
+ void BroadcastPacketToZone(WorldPacket& data) const;
+ void BroadcastPacketToQueue(WorldPacket& data) const;
+ void BroadcastPacketToWar(WorldPacket& data) const;
+
+ // CapturePoint system
+ void AddCapturePoint(BfCapturePoint* cp) { m_capturePoints[cp->GetCapturePointGo()->GetEntry()] = cp; }
+
+ BfCapturePoint* GetCapturePoint(uint32 lowguid) const
+ {
+ Battlefield::BfCapturePointMap::const_iterator itr = m_capturePoints.find(lowguid);
+ if (itr != m_capturePoints.end())
+ return itr->second;
+ return NULL;
+ }
+
+ void RegisterZone(uint32 zoneid);
+ bool HasPlayer(Player* player) const;
+ void TeamCastSpell(TeamId team, int32 spellId);
+};
+
+#endif
diff --git a/src/server/game/Battlefield/BattlefieldHandler.cpp b/src/server/game/Battlefield/BattlefieldHandler.cpp
new file mode 100644
index 00000000000..b852082d582
--- /dev/null
+++ b/src/server/game/Battlefield/BattlefieldHandler.cpp
@@ -0,0 +1,150 @@
+/*
+ * Copyright (C) 2008-2010 TrinityCore <http://www.trinitycore.org/>
+ * Copyright (C) 2005-2009 MaNGOS <http://getmangos.com/>
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation; either version 2 of the License, or (at your
+ * option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
+ * more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#include "Common.h"
+#include "ObjectAccessor.h"
+#include "ObjectMgr.h"
+#include "WorldPacket.h"
+#include "WorldSession.h"
+
+#include "Battlefield.h"
+#include "BattlefieldMgr.h"
+#include "Opcodes.h"
+
+//This send to player windows for invite player to join the war
+//Param1:(BattleId) the BattleId of Bf
+//Param2:(ZoneId) the zone where the battle is (4197 for wg)
+//Param3:(time) Time in second that the player have for accept
+void WorldSession::SendBfInvitePlayerToWar(uint32 BattleId, uint32 ZoneId, uint32 p_time)
+{
+ //Send packet
+ WorldPacket data(SMSG_BATTLEFIELD_MGR_ENTRY_INVITE, 12);
+ data << uint32(BattleId);
+ data << uint32(ZoneId);
+ data << uint32((time(NULL) + p_time));
+
+ //Sending the packet to player
+ SendPacket(&data);
+}
+
+//This send invitation to player to join the queue
+//Param1:(BattleId) the BattleId of Bf
+void WorldSession::SendBfInvitePlayerToQueue(uint32 BattleId)
+{
+ WorldPacket data(SMSG_BATTLEFIELD_MGR_QUEUE_INVITE, 5);
+
+ data << uint32(BattleId);
+ data << uint8(1); //warmup ? used ?
+
+ //Sending packet to player
+ SendPacket(&data);
+}
+
+//This send packet for inform player that he join queue
+//Param1:(BattleId) the BattleId of Bf
+//Param2:(ZoneId) the zone where the battle is (4197 for wg)
+//Param3:(CanQueue) if able to queue
+//Param4:(Full) on log in is full
+void WorldSession::SendBfQueueInviteResponse(uint32 BattleId,uint32 ZoneId, bool CanQueue, bool Full)
+{
+ WorldPacket data(SMSG_BATTLEFIELD_MGR_QUEUE_REQUEST_RESPONSE, 11);
+ data << uint32(BattleId);
+ data << uint32(ZoneId);
+ data << uint8((CanQueue ? 1 : 0)); //Accepted //0 you cannot queue wg //1 you are queued
+ data << uint8((Full ? 0 : 1)); //Logging In //0 wg full //1 queue for upcoming
+ data << uint8(1); //Warmup
+ SendPacket(&data);
+}
+
+//This is call when player accept to join war
+//Param1:(BattleId) the BattleId of Bf
+void WorldSession::SendBfEntered(uint32 BattleId)
+{
+// m_PlayerInWar[player->GetTeamId()].insert(player->GetGUID());
+ WorldPacket data(SMSG_BATTLEFIELD_MGR_ENTERED, 7);
+ data << uint32(BattleId);
+ data << uint8(1); //unk
+ data << uint8(1); //unk
+ data << uint8(_player->isAFK() ? 1 : 0); //Clear AFK
+ SendPacket(&data);
+}
+
+void WorldSession::SendBfLeaveMessage(uint32 BattleId, BFLeaveReason reason)
+{
+ WorldPacket data(SMSG_BATTLEFIELD_MGR_EJECTED, 7);
+ data << uint32(BattleId);
+ data << uint8(reason);//byte Reason
+ data << uint8(2);//byte BattleStatus
+ data << uint8(0);//bool Relocated
+ SendPacket(&data);
+}
+
+//Send by client when he click on accept for queue
+void WorldSession::HandleBfQueueInviteResponse(WorldPacket & recv_data)
+{
+ uint32 BattleId;
+ uint8 Accepted;
+
+ recv_data >> BattleId >> Accepted;
+ sLog->outError(LOG_FILTER_GENERAL, "HandleQueueInviteResponse: BattleID:%u Accepted:%u", BattleId, Accepted);
+ Battlefield* Bf = sBattlefieldMgr->GetBattlefieldByBattleId(BattleId);
+ if (!Bf)
+ return;
+
+ if (Accepted)
+ {
+ Bf->PlayerAcceptInviteToQueue(_player);
+ }
+}
+
+//Send by client on clicking in accept or refuse of invitation windows for join game
+void WorldSession::HandleBfEntryInviteResponse(WorldPacket & recv_data)
+{
+ uint32 BattleId;
+ uint8 Accepted;
+
+ recv_data >> BattleId >> Accepted;
+ sLog->outError(LOG_FILTER_GENERAL, "HandleBattlefieldInviteResponse: BattleID:%u Accepted:%u", BattleId, Accepted);
+ Battlefield* Bf = sBattlefieldMgr->GetBattlefieldByBattleId(BattleId);
+ if (!Bf)
+ return;
+
+ //If player accept invitation
+ if (Accepted)
+ {
+ Bf->PlayerAcceptInviteToWar(_player);
+ }
+ else
+ {
+ if (_player->GetZoneId() == Bf->GetZoneId())
+ Bf->KickPlayerFromBattlefield(_player->GetGUID());
+ }
+}
+
+void WorldSession::HandleBfExitRequest(WorldPacket & recv_data)
+{
+ uint32 BattleId;
+
+ recv_data >> BattleId;
+ sLog->outError(LOG_FILTER_GENERAL, "HandleBfExitRequest: BattleID:%u ", BattleId);
+ Battlefield* Bf = sBattlefieldMgr->GetBattlefieldByBattleId(BattleId);
+ if (!Bf)
+ return;
+
+ Bf->AskToLeaveQueue(_player);
+}
diff --git a/src/server/game/Battlefield/BattlefieldMgr.cpp b/src/server/game/Battlefield/BattlefieldMgr.cpp
new file mode 100644
index 00000000000..6122b25e8e8
--- /dev/null
+++ b/src/server/game/Battlefield/BattlefieldMgr.cpp
@@ -0,0 +1,140 @@
+/*
+ * Copyright (C) 2008-2010 TrinityCore <http://www.trinitycore.org/>
+ * Copyright (C) 2005-2009 MaNGOS <http://getmangos.com/>
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation; either version 2 of the License, or (at your
+ * option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
+ * more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#include "BattlefieldMgr.h"
+#include "Zones/BattlefieldWG.h"
+#include "ObjectMgr.h"
+#include "Player.h"
+
+BattlefieldMgr::BattlefieldMgr()
+{
+ m_UpdateTimer = 0;
+ //sLog->outDebug(LOG_FILTER_BATTLEFIELD, "Instantiating BattlefieldMgr");
+}
+
+BattlefieldMgr::~BattlefieldMgr()
+{
+ //sLog->outDebug(LOG_FILTER_BATTLEFIELD, "Deleting BattlefieldMgr");
+ for (BattlefieldSet::iterator itr = m_BattlefieldSet.begin(); itr != m_BattlefieldSet.end(); ++itr)
+ delete *itr;
+}
+
+void BattlefieldMgr::InitBattlefield()
+{
+ Battlefield* pBf = new BattlefieldWG;
+ // respawn, init variables
+ if (!pBf->SetupBattlefield())
+ {
+ sLog->outInfo(LOG_FILTER_GENERAL, "Battlefield : Wintergrasp init failed.");
+ delete pBf;
+ }
+ else
+ {
+ m_BattlefieldSet.push_back(pBf);
+ sLog->outInfo(LOG_FILTER_GENERAL, "Battlefield : Wintergrasp successfully initiated.");
+ }
+
+ /* For Cataclysm: Tol Barad
+ pBf = new BattlefieldTB;
+ // respawn, init variables
+ if(!pBf->SetupBattlefield())
+ {
+ sLog->outDebug(LOG_FILTER_BATTLEFIELD, "Battlefield : Tol Barad init failed.");
+ delete pBf;
+ }
+ else
+ {
+ m_BattlefieldSet.push_back(pBf);
+ sLog->outDebug(LOG_FILTER_BATTLEFIELD, "Battlefield : Tol Barad successfully initiated.");
+ } */
+}
+
+void BattlefieldMgr::AddZone(uint32 zoneid, Battlefield *handle)
+{
+ m_BattlefieldMap[zoneid] = handle;
+}
+
+void BattlefieldMgr::HandlePlayerEnterZone(Player * player, uint32 zoneid)
+{
+ BattlefieldMap::iterator itr = m_BattlefieldMap.find(zoneid);
+ if (itr == m_BattlefieldMap.end())
+ return;
+
+ if (itr->second->HasPlayer(player) || !itr->second->IsEnabled())
+ return;
+
+ itr->second->HandlePlayerEnterZone(player, zoneid);
+ sLog->outDebug(LOG_FILTER_BATTLEFIELD, "Player %u entered outdoorpvp id %u", player->GetGUIDLow(), itr->second->GetTypeId());
+}
+
+void BattlefieldMgr::HandlePlayerLeaveZone(Player * player, uint32 zoneid)
+{
+ BattlefieldMap::iterator itr = m_BattlefieldMap.find(zoneid);
+ if (itr == m_BattlefieldMap.end())
+ return;
+
+ // teleport: remove once in removefromworld, once in updatezone
+ if (!itr->second->HasPlayer(player))
+ return;
+ itr->second->HandlePlayerLeaveZone(player, zoneid);
+ sLog->outDebug(LOG_FILTER_BATTLEFIELD, "Player %u left outdoorpvp id %u", player->GetGUIDLow(), itr->second->GetTypeId());
+}
+
+Battlefield *BattlefieldMgr::GetBattlefieldToZoneId(uint32 zoneid)
+{
+ BattlefieldMap::iterator itr = m_BattlefieldMap.find(zoneid);
+ if (itr == m_BattlefieldMap.end())
+ {
+ // no handle for this zone, return
+ return NULL;
+ }
+ if (!itr->second->IsEnabled())
+ return NULL;
+ return itr->second;
+}
+
+Battlefield *BattlefieldMgr::GetBattlefieldByBattleId(uint32 battleid)
+{
+ for (BattlefieldSet::iterator itr = m_BattlefieldSet.begin(); itr != m_BattlefieldSet.end(); ++itr)
+ {
+ if ((*itr)->GetBattleId() == battleid)
+ return (*itr);
+ }
+ return NULL;
+}
+
+void BattlefieldMgr::Update(uint32 diff)
+{
+ m_UpdateTimer += diff;
+ if (m_UpdateTimer > BATTLEFIELD_OBJECTIVE_UPDATE_INTERVAL)
+ {
+ for (BattlefieldSet::iterator itr = m_BattlefieldSet.begin(); itr != m_BattlefieldSet.end(); ++itr)
+ if ((*itr)->IsEnabled())
+ (*itr)->Update(m_UpdateTimer);
+ m_UpdateTimer = 0;
+ }
+}
+
+ZoneScript *BattlefieldMgr::GetZoneScript(uint32 zoneId)
+{
+ BattlefieldMap::iterator itr = m_BattlefieldMap.find(zoneId);
+ if (itr != m_BattlefieldMap.end())
+ return itr->second;
+ else
+ return NULL;
+}
diff --git a/src/server/game/Battlefield/BattlefieldMgr.h b/src/server/game/Battlefield/BattlefieldMgr.h
new file mode 100644
index 00000000000..4ee37e424fd
--- /dev/null
+++ b/src/server/game/Battlefield/BattlefieldMgr.h
@@ -0,0 +1,79 @@
+/*
+ * Copyright (C) 2008-2010 TrinityCore <http://www.trinitycore.org/>
+ * Copyright (C) 2005-2009 MaNGOS <http://getmangos.com/>
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation; either version 2 of the License, or (at your
+ * option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
+ * more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef BATTLEFIELD_MGR_H_
+#define BATTLEFIELD_MGR_H_
+
+#include "Battlefield.h"
+#include "ace/Singleton.h"
+
+class Player;
+class GameObject;
+class Creature;
+class ZoneScript;
+struct GossipMenuItems;
+
+// class to handle player enter / leave / areatrigger / GO use events
+class BattlefieldMgr
+{
+ public:
+ // ctor
+ BattlefieldMgr();
+ // dtor
+ ~BattlefieldMgr();
+
+ // create battlefield events
+ void InitBattlefield();
+ // called when a player enters an battlefield area
+ void HandlePlayerEnterZone(Player * player, uint32 areaflag);
+ // called when player leaves an battlefield area
+ void HandlePlayerLeaveZone(Player * player, uint32 areaflag);
+ // called when player resurrects
+ void HandlePlayerResurrects(Player * player, uint32 areaflag);
+ // return assigned battlefield
+ Battlefield *GetBattlefieldToZoneId(uint32 zoneid);
+ Battlefield *GetBattlefieldByBattleId(uint32 battleid);
+
+ ZoneScript *GetZoneScript(uint32 zoneId);
+
+ void AddZone(uint32 zoneid, Battlefield * handle);
+
+ void Update(uint32 diff);
+
+ void HandleGossipOption(Player * player, uint64 guid, uint32 gossipid);
+
+ bool CanTalkTo(Player * player, Creature * creature, GossipMenuItems gso);
+
+ void HandleDropFlag(Player * player, uint32 spellId);
+
+ typedef std::vector < Battlefield * >BattlefieldSet;
+ typedef std::map < uint32 /* zoneid */ , Battlefield * >BattlefieldMap;
+ private:
+ // contains all initiated battlefield events
+ // used when initing / cleaning up
+ BattlefieldSet m_BattlefieldSet;
+ // maps the zone ids to an battlefield event
+ // used in player event handling
+ BattlefieldMap m_BattlefieldMap;
+ // update interval
+ uint32 m_UpdateTimer;
+};
+
+#define sBattlefieldMgr ACE_Singleton<BattlefieldMgr, ACE_Null_Mutex>::instance()
+
+#endif
diff --git a/src/server/game/Battlefield/Zones/BattlefieldWG.cpp b/src/server/game/Battlefield/Zones/BattlefieldWG.cpp
new file mode 100644
index 00000000000..9a701b5b044
--- /dev/null
+++ b/src/server/game/Battlefield/Zones/BattlefieldWG.cpp
@@ -0,0 +1,1102 @@
+/*
+ * Copyright (C) 2008-2010 TrinityCore <http://www.trinitycore.org/>
+ * Copyright (C) 2005-2009 MaNGOS <http://getmangos.com/>
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation; either version 2 of the License, or (at your
+ * option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
+ * more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+// TODO: Implement proper support for vehicle+player teleportation
+// TODO: Use spell victory/defeat in wg instead of RewardMarkOfHonor() && RewardHonor
+// TODO: Add proper implement of achievement
+
+#include "ObjectMgr.h"
+#include "BattlefieldWG.h"
+#include "SpellAuras.h"
+#include "Vehicle.h"
+
+enum WGVehicles
+{
+ NPC_WG_SEIGE_ENGINE_ALLIANCE = 28312,
+ NPC_WG_SEIGE_ENGINE_HORDE = 32627,
+ NPC_WG_DEMOLISHER = 28094,
+ NPC_WG_CATAPULT = 27881
+};
+
+BattlefieldWG::~BattlefieldWG()
+{
+ for (Workshop::const_iterator itr = WorkshopsList.begin(); itr != WorkshopsList.end(); ++itr)
+ delete *itr;
+
+ for (GameObjectBuilding::const_iterator itr = BuildingsInZone.begin(); itr != BuildingsInZone.end(); ++itr)
+ delete *itr;
+}
+
+bool BattlefieldWG::SetupBattlefield()
+{
+ InitStalker(BATTLEFIELD_WG_NPC_STALKER, WintergraspStalkerPos[0], WintergraspStalkerPos[1], WintergraspStalkerPos[2], WintergraspStalkerPos[3]);
+
+ m_TypeId = BATTLEFIELD_WG; // See enum BattlefieldTypes
+ m_BattleId = BATTLEFIELD_BATTLEID_WG;
+ m_ZoneId = BATTLEFIELD_WG_ZONEID;
+ m_MapId = BATTLEFIELD_WG_MAPID;
+
+ m_MaxPlayer = sWorld->getIntConfig(CONFIG_WINTERGRASP_PLR_MAX);
+ m_IsEnabled = sWorld->getBoolConfig(CONFIG_WINTERGRASP_ENABLE);
+ m_MinPlayer = sWorld->getIntConfig(CONFIG_WINTERGRASP_PLR_MIN);
+ m_MinLevel = sWorld->getIntConfig(CONFIG_WINTERGRASP_PLR_MIN_LVL);
+ m_BattleTime = sWorld->getIntConfig(CONFIG_WINTERGRASP_BATTLETIME) * MINUTE * IN_MILLISECONDS;
+ m_NoWarBattleTime = sWorld->getIntConfig(CONFIG_WINTERGRASP_NOBATTLETIME) * MINUTE * IN_MILLISECONDS;
+ m_RestartAfterCrash = sWorld->getIntConfig(CONFIG_WINTERGRASP_RESTART_AFTER_CRASH) * MINUTE * IN_MILLISECONDS;
+
+ m_TimeForAcceptInvite = 20;
+ m_StartGroupingTimer = 15 * MINUTE * IN_MILLISECONDS;
+ m_StartGrouping = false;
+
+ m_tenacityStack = 0;
+
+ KickPosition.Relocate(5728.117f, 2714.346f, 697.733f, 0);
+ KickPosition.m_mapId = m_MapId;
+
+ RegisterZone(m_ZoneId);
+
+ m_Data32.resize(BATTLEFIELD_WG_DATA_MAX);
+
+ m_saveTimer = 60000;
+
+ // Init GraveYards
+ SetGraveyardNumber(BATTLEFIELD_WG_GRAVEYARD_MAX);
+
+ // Load from db
+ if ((sWorld->getWorldState(BATTLEFIELD_WG_WORLD_STATE_ACTIVE) == 0) && (sWorld->getWorldState(BATTLEFIELD_WG_WORLD_STATE_DEFENDER) == 0)
+ && (sWorld->getWorldState(ClockWorldState[0]) == 0))
+ {
+ sWorld->setWorldState(BATTLEFIELD_WG_WORLD_STATE_ACTIVE, uint64(false));
+ sWorld->setWorldState(BATTLEFIELD_WG_WORLD_STATE_DEFENDER, uint64(urand(0, 1)));
+ sWorld->setWorldState(ClockWorldState[0], uint64(m_NoWarBattleTime));
+ }
+
+ m_isActive = bool(sWorld->getWorldState(BATTLEFIELD_WG_WORLD_STATE_ACTIVE));
+ m_DefenderTeam = TeamId(sWorld->getWorldState(BATTLEFIELD_WG_WORLD_STATE_DEFENDER));
+
+ m_Timer = sWorld->getWorldState(ClockWorldState[0]);
+ if (m_isActive)
+ {
+ m_isActive = false;
+ m_Timer = m_RestartAfterCrash;
+ }
+
+ for (uint8 i = 0; i < BATTLEFIELD_WG_GRAVEYARD_MAX; i++)
+ {
+ BfGraveyardWG* graveyard = new BfGraveyardWG(this);
+
+ // When between games, the graveyard is controlled by the defending team
+ if (WGGraveYard[i].startcontrol == TEAM_NEUTRAL)
+ graveyard->Initialize(m_DefenderTeam, WGGraveYard[i].gyid);
+ else
+ graveyard->Initialize(WGGraveYard[i].startcontrol, WGGraveYard[i].gyid);
+
+ graveyard->SetTextId(WGGraveYard[i].textid);
+ m_GraveyardList[i] = graveyard;
+ }
+
+
+ // Spawn workshop creatures and gameobjects
+ for (uint8 i = 0; i < WG_MAX_WORKSHOP; i++)
+ {
+ WGWorkshop* workshop = new WGWorkshop(this, i);
+ if (i < BATTLEFIELD_WG_WORKSHOP_KEEP_WEST)
+ workshop->GiveControlTo(GetAttackerTeam(), true);
+ else
+ workshop->GiveControlTo(GetDefenderTeam(), true);
+
+ // Note: Capture point is added once the gameobject is created.
+ WorkshopsList.insert(workshop);
+ }
+
+ // Spawn NPCs in the defender's keep, both Horde and Alliance
+ for (uint8 i = 0; i < WG_MAX_KEEP_NPC; i++)
+ {
+ // Horde npc
+ if (Creature* creature = SpawnCreature(WGKeepNPC[i].entryHorde, WGKeepNPC[i].x, WGKeepNPC[i].y, WGKeepNPC[i].z, WGKeepNPC[i].o, TEAM_HORDE))
+ KeepCreature[TEAM_HORDE].insert(creature->GetGUID());
+ // Alliance npc
+ if (Creature* creature = SpawnCreature(WGKeepNPC[i].entryAlliance, WGKeepNPC[i].x, WGKeepNPC[i].y, WGKeepNPC[i].z, WGKeepNPC[i].o, TEAM_ALLIANCE))
+ KeepCreature[TEAM_ALLIANCE].insert(creature->GetGUID());
+ }
+
+ // Hide NPCs from the Attacker's team in the keep
+ for (GuidSet::const_iterator itr = KeepCreature[GetAttackerTeam()].begin(); itr != KeepCreature[GetAttackerTeam()].end(); ++itr)
+ if (Unit* unit = sObjectAccessor->FindUnit(*itr))
+ if (Creature* creature = unit->ToCreature())
+ HideNpc(creature);
+
+ // Spawn Horde NPCs outside the keep
+ for (uint8 i = 0; i < WG_OUTSIDE_ALLIANCE_NPC; i++)
+ if (Creature* creature = SpawnCreature(WGOutsideNPC[i].entryHorde, WGOutsideNPC[i].x, WGOutsideNPC[i].y, WGOutsideNPC[i].z, WGOutsideNPC[i].o, TEAM_HORDE))
+ OutsideCreature[TEAM_HORDE].insert(creature->GetGUID());
+
+ // Spawn Alliance NPCs outside the keep
+ for (uint8 i = WG_OUTSIDE_ALLIANCE_NPC; i < WG_MAX_OUTSIDE_NPC; i++)
+ if (Creature* creature = SpawnCreature(WGOutsideNPC[i].entryAlliance, WGOutsideNPC[i].x, WGOutsideNPC[i].y, WGOutsideNPC[i].z, WGOutsideNPC[i].o, TEAM_ALLIANCE))
+ OutsideCreature[TEAM_ALLIANCE].insert(creature->GetGUID());
+
+ // Hide units outside the keep that are defenders
+ for (GuidSet::const_iterator itr = OutsideCreature[GetDefenderTeam()].begin(); itr != OutsideCreature[GetDefenderTeam()].end(); ++itr)
+ if (Unit* unit = sObjectAccessor->FindUnit(*itr))
+ if (Creature* creature = unit->ToCreature())
+ HideNpc(creature);
+
+ // Spawn turrets and hide them per default
+ for (uint8 i = 0; i < WG_MAX_TURRET; i++)
+ {
+ Position towerCannonPos;
+ WGTurret[i].GetPosition(&towerCannonPos);
+ if (Creature* creature = SpawnCreature(NPC_TOWER_CANNON, towerCannonPos, TEAM_ALLIANCE))
+ {
+ CanonList.insert(creature->GetGUID());
+ HideNpc(creature);
+ }
+ }
+
+ // Spawn all gameobjects
+ for (uint8 i = 0; i < WG_MAX_OBJ; i++)
+ {
+ GameObject* go = SpawnGameObject(WGGameObjectBuilding[i].entry, WGGameObjectBuilding[i].x, WGGameObjectBuilding[i].y, WGGameObjectBuilding[i].z, WGGameObjectBuilding[i].o);
+ BfWGGameObjectBuilding* b = new BfWGGameObjectBuilding(this);
+ b->Init(go, WGGameObjectBuilding[i].type, WGGameObjectBuilding[i].WorldState, WGGameObjectBuilding[i].nameId);
+ if (!IsEnabled() && go->GetEntry() == GO_WINTERGRASP_VAULT_GATE)
+ go->SetDestructibleState(GO_DESTRUCTIBLE_DESTROYED);
+ BuildingsInZone.insert(b);
+ }
+
+ // Spawning portal defender
+ for (uint8 i = 0; i < WG_MAX_TELEPORTER; i++)
+ {
+ GameObject* go = SpawnGameObject(WGPortalDefenderData[i].entry, WGPortalDefenderData[i].x, WGPortalDefenderData[i].y, WGPortalDefenderData[i].z, WGPortalDefenderData[i].o);
+ DefenderPortalList.insert(go);
+ go->SetUInt32Value(GAMEOBJECT_FACTION, WintergraspFaction[GetDefenderTeam()]);
+ }
+
+ // Spawn banners in the keep
+ for (uint8 i = 0; i < WG_KEEPGAMEOBJECT_MAX; i++)
+ {
+ if (GameObject* go = SpawnGameObject(WGKeepGameObject[i].entryHorde, WGKeepGameObject[i].x, WGKeepGameObject[i].y, WGKeepGameObject[i].z, WGKeepGameObject[i].o))
+ {
+ go->SetRespawnTime(GetDefenderTeam()? RESPAWN_ONE_DAY : RESPAWN_IMMEDIATELY);
+ m_KeepGameObject[1].insert(go);
+ }
+ if (GameObject* go = SpawnGameObject(WGKeepGameObject[i].entryAlliance, WGKeepGameObject[i].x, WGKeepGameObject[i].y, WGKeepGameObject[i].z, WGKeepGameObject[i].o))
+ {
+ go->SetRespawnTime(GetDefenderTeam()? RESPAWN_IMMEDIATELY : RESPAWN_ONE_DAY);
+ m_KeepGameObject[0].insert(go);
+ }
+ }
+
+ // Show defender banner in keep
+ for (GameObjectSet::const_iterator itr = m_KeepGameObject[GetDefenderTeam()].begin(); itr != m_KeepGameObject[GetDefenderTeam()].end(); ++itr)
+ (*itr)->SetRespawnTime(RESPAWN_IMMEDIATELY);
+
+ // Hide attackant banner in keep
+ for (GameObjectSet::const_iterator itr = m_KeepGameObject[GetAttackerTeam()].begin(); itr != m_KeepGameObject[GetAttackerTeam()].end(); ++itr)
+ (*itr)->SetRespawnTime(RESPAWN_ONE_DAY);
+
+ UpdateCounterVehicle(true);
+ return true;
+}
+
+bool BattlefieldWG::Update(uint32 diff)
+{
+ bool m_return = Battlefield::Update(diff);
+ if (m_saveTimer <= diff)
+ {
+ sWorld->setWorldState(BATTLEFIELD_WG_WORLD_STATE_ACTIVE, m_isActive);
+ sWorld->setWorldState(BATTLEFIELD_WG_WORLD_STATE_DEFENDER, m_DefenderTeam);
+ sWorld->setWorldState(ClockWorldState[0], m_Timer);
+ m_saveTimer = 60 * IN_MILLISECONDS;
+ }
+ else
+ m_saveTimer -= diff;
+
+ return m_return;
+}
+
+void BattlefieldWG::OnBattleStart()
+{
+ // Spawn titan relic
+ m_titansRelic = SpawnGameObject(GO_WINTERGRASP_TITAN_S_RELIC, 5440.0f, 2840.8f, 430.43f, 0);
+ if (m_titansRelic)
+ {
+ // Update faction of relic, only attacker can click on
+ m_titansRelic->SetUInt32Value(GAMEOBJECT_FACTION, WintergraspFaction[GetAttackerTeam()]);
+ // Set in use (not allow to click on before last door is broken)
+ m_titansRelic->SetFlag(GAMEOBJECT_FLAGS, GO_FLAG_IN_USE);
+ }
+ else
+ sLog->outError(LOG_FILTER_BATTLEFIELD, "WG: Failed to spawn titan relic.");
+
+
+ // Update tower visibility and update faction
+ for (GuidSet::const_iterator itr = CanonList.begin(); itr != CanonList.end(); ++itr)
+ {
+ if (Unit* unit = sObjectAccessor->FindUnit(*itr))
+ {
+ if (Creature* creature = unit->ToCreature())
+ {
+ ShowNpc(creature, true);
+ creature->setFaction(WintergraspFaction[GetDefenderTeam()]);
+ }
+ }
+ }
+
+ // Rebuild all wall
+ for (GameObjectBuilding::const_iterator itr = BuildingsInZone.begin(); itr != BuildingsInZone.end(); ++itr)
+ {
+ if (*itr)
+ {
+ (*itr)->Rebuild();
+ (*itr)->UpdateTurretAttack(false);
+ }
+ }
+
+ SetData(BATTLEFIELD_WG_DATA_BROKEN_TOWER_ATT, 0);
+ SetData(BATTLEFIELD_WG_DATA_BROKEN_TOWER_DEF, 0);
+ SetData(BATTLEFIELD_WG_DATA_DAMAGED_TOWER_ATT, 0);
+ SetData(BATTLEFIELD_WG_DATA_DAMAGED_TOWER_DEF, 0);
+
+ // Update graveyard (in no war time all graveyard is to deffender, in war time, depend of base)
+ for (Workshop::const_iterator itr = WorkshopsList.begin(); itr != WorkshopsList.end(); ++itr)
+ if (*itr)
+ (*itr)->UpdateGraveyardAndWorkshop();
+
+ for (uint8 team = 0; team < 2; ++team)
+ for (GuidSet::const_iterator itr = m_players[team].begin(); itr != m_players[team].end(); ++itr)
+ {
+ // Kick player in orb room, TODO: offline player ?
+ if (Player* player = sObjectAccessor->FindPlayer(*itr))
+ {
+ float x, y, z;
+ player->GetPosition(x, y, z);
+ if (5500 > x && x > 5392 && y < 2880 && y > 2800 && z < 480)
+ player->TeleportTo(571, 5349.8686f, 2838.481f, 409.240f, 0.046328f);
+ SendInitWorldStatesTo(player);
+ }
+ }
+ // Initialize vehicle counter
+ UpdateCounterVehicle(true);
+ // Send start warning to all players
+ SendWarningToAllInZone(BATTLEFIELD_WG_TEXT_START);
+}
+
+void BattlefieldWG::UpdateCounterVehicle(bool init)
+{
+ if (init)
+ {
+ SetData(BATTLEFIELD_WG_DATA_VEHICLE_H, 0);
+ SetData(BATTLEFIELD_WG_DATA_VEHICLE_A, 0);
+ }
+ SetData(BATTLEFIELD_WG_DATA_MAX_VEHICLE_H, 0);
+ SetData(BATTLEFIELD_WG_DATA_MAX_VEHICLE_A, 0);
+
+ for (Workshop::const_iterator itr = WorkshopsList.begin(); itr != WorkshopsList.end(); ++itr)
+ {
+ if (WGWorkshop* workshop = (*itr))
+ {
+ if (workshop->teamControl == TEAM_ALLIANCE)
+ UpdateData(BATTLEFIELD_WG_DATA_MAX_VEHICLE_A, 4);
+ else if (workshop->teamControl == TEAM_HORDE)
+ UpdateData(BATTLEFIELD_WG_DATA_MAX_VEHICLE_H, 4);
+ }
+ }
+
+ UpdateVehicleCountWG();
+}
+
+void BattlefieldWG::OnBattleEnd(bool endByTimer)
+{
+ // Remove relic
+ if (m_titansRelic)
+ m_titansRelic->RemoveFromWorld();
+ m_titansRelic = NULL;
+
+ // Remove turret
+ for (GuidSet::const_iterator itr = CanonList.begin(); itr != CanonList.end(); ++itr)
+ {
+ if (Unit* unit = sObjectAccessor->FindUnit(*itr))
+ {
+ if (Creature* creature = unit->ToCreature())
+ {
+ if (!endByTimer)
+ creature->setFaction(WintergraspFaction[GetDefenderTeam()]);
+ HideNpc(creature);
+ }
+ }
+ }
+
+ if (!endByTimer) // One player triggered the relic
+ {
+ // Change all npc in keep
+ for (GuidSet::const_iterator itr = KeepCreature[GetAttackerTeam()].begin(); itr != KeepCreature[GetAttackerTeam()].end(); ++itr)
+ if (Unit* unit = sObjectAccessor->FindUnit(*itr))
+ if (Creature* creature = unit->ToCreature())
+ HideNpc(creature);
+
+ for (GuidSet::const_iterator itr = KeepCreature[GetDefenderTeam()].begin(); itr != KeepCreature[GetDefenderTeam()].end(); ++itr)
+ if (Unit* unit = sObjectAccessor->FindUnit(*itr))
+ if (Creature* creature = unit->ToCreature())
+ ShowNpc(creature, true);
+
+ // Change all npc out of keep
+ for (GuidSet::const_iterator itr = OutsideCreature[GetDefenderTeam()].begin(); itr != OutsideCreature[GetDefenderTeam()].end(); ++itr)
+ if (Unit* unit = sObjectAccessor->FindUnit(*itr))
+ if (Creature* creature = unit->ToCreature())
+ HideNpc(creature);
+
+ for (GuidSet::const_iterator itr = OutsideCreature[GetAttackerTeam()].begin(); itr != OutsideCreature[GetAttackerTeam()].end(); ++itr)
+ if (Unit* unit = sObjectAccessor->FindUnit(*itr))
+ if (Creature* creature = unit->ToCreature())
+ ShowNpc(creature, true);
+ }
+
+ // Update all graveyard, control is to defender when no wartime
+ for (uint8 i = 0; i < BATTLEFIELD_WG_GY_HORDE; i++)
+ if (BfGraveyard* graveyard = GetGraveyardById(i))
+ graveyard->GiveControlTo(GetDefenderTeam());
+
+ for (GameObjectSet::const_iterator itr = m_KeepGameObject[GetDefenderTeam()].begin(); itr != m_KeepGameObject[GetDefenderTeam()].end(); ++itr)
+ (*itr)->SetRespawnTime(RESPAWN_IMMEDIATELY);
+
+ for (GameObjectSet::const_iterator itr = m_KeepGameObject[GetAttackerTeam()].begin(); itr != m_KeepGameObject[GetAttackerTeam()].end(); ++itr)
+ (*itr)->SetRespawnTime(RESPAWN_ONE_DAY);
+
+ // Update portal defender faction
+ for (GameObjectSet::const_iterator itr = DefenderPortalList.begin(); itr != DefenderPortalList.end(); ++itr)
+ (*itr)->SetUInt32Value(GAMEOBJECT_FACTION, WintergraspFaction[GetDefenderTeam()]);
+
+ // Saving data
+ for (GameObjectBuilding::const_iterator itr = BuildingsInZone.begin(); itr != BuildingsInZone.end(); ++itr)
+ (*itr)->Save();
+ for (Workshop::const_iterator itr = WorkshopsList.begin(); itr != WorkshopsList.end(); ++itr)
+ (*itr)->Save();
+
+ for (GuidSet::const_iterator itr = m_PlayersInWar[GetDefenderTeam()].begin(); itr != m_PlayersInWar[GetDefenderTeam()].end(); ++itr)
+ {
+ if (Player* player = sObjectAccessor->FindPlayer(*itr))
+ {
+ player->CastSpell(player, SPELL_ESSENCE_OF_WINTERGRASP, true);
+ player->CastSpell(player, SPELL_VICTORY_REWARD, true);
+ // Send Wintergrasp victory achievement
+ DoCompleteOrIncrementAchievement(ACHIEVEMENTS_WIN_WG, player);
+ // Award achievement for succeeding in Wintergrasp in 10 minutes or less
+ if (!endByTimer && GetTimer() <= 10000)
+ DoCompleteOrIncrementAchievement(ACHIEVEMENTS_WIN_WG_TIMER_10, player);
+ }
+ }
+
+ for (GuidSet::const_iterator itr = m_PlayersInWar[GetAttackerTeam()].begin(); itr != m_PlayersInWar[GetAttackerTeam()].end(); ++itr)
+ if (Player* player = sObjectAccessor->FindPlayer(*itr))
+ player->CastSpell(player, SPELL_DEFEAT_REWARD, true);
+
+ for (uint8 team = 0; team < 2; ++team)
+ {
+ for (GuidSet::const_iterator itr = m_PlayersInWar[team].begin(); itr != m_PlayersInWar[team].end(); ++itr)
+ if (Player* player = sObjectAccessor->FindPlayer(*itr))
+ RemoveAurasFromPlayer(player);
+
+ m_PlayersInWar[team].clear();
+
+ for (GuidSet::const_iterator itr = m_vehicles[team].begin(); itr != m_vehicles[team].end(); ++itr)
+ if (Unit* unit = sObjectAccessor->FindUnit(*itr))
+ if (Creature* creature = unit->ToCreature())
+ if (creature->IsVehicle())
+ creature->GetVehicleKit()->Dismiss();
+
+ m_vehicles[team].clear();
+ }
+
+ if (!endByTimer)
+ {
+ for (uint8 team = 0; team < 2; ++team)
+ {
+ for (GuidSet::const_iterator itr = m_players[team].begin(); itr != m_players[team].end(); ++itr)
+ {
+ if (Player* player = sObjectAccessor->FindPlayer(*itr))
+ {
+ player->RemoveAurasDueToSpell(m_DefenderTeam == TEAM_ALLIANCE ? SPELL_HORDE_CONTROL_PHASE_SHIFT : SPELL_ALLIANCE_CONTROL_PHASE_SHIFT, player->GetGUID());
+ player->AddAura(m_DefenderTeam == TEAM_HORDE ? SPELL_HORDE_CONTROL_PHASE_SHIFT : SPELL_ALLIANCE_CONTROL_PHASE_SHIFT, player);
+ }
+ }
+ }
+ }
+
+ if (!endByTimer) // win alli/horde
+ SendWarningToAllInZone((GetDefenderTeam() == TEAM_ALLIANCE) ? BATTLEFIELD_WG_TEXT_WIN_KEEP : BATTLEFIELD_WG_TEXT_WIN_KEEP + 1);
+ else // defend alli/horde
+ SendWarningToAllInZone((GetDefenderTeam() == TEAM_ALLIANCE) ? BATTLEFIELD_WG_TEXT_DEFEND_KEEP : BATTLEFIELD_WG_TEXT_DEFEND_KEEP + 1);
+}
+
+// *******************************************************
+// ******************* Reward System *********************
+// *******************************************************
+void BattlefieldWG::DoCompleteOrIncrementAchievement(uint32 achievement, Player* player, uint8 /*incrementNumber*/)
+{
+ AchievementEntry const* achievementEntry = sAchievementStore.LookupEntry(achievement);
+
+ if (!achievementEntry)
+ return;
+
+ switch (achievement)
+ {
+ case ACHIEVEMENTS_WIN_WG_100:
+ {
+ // player->GetAchievementMgr().UpdateAchievementCriteria();
+ }
+ default:
+ {
+ if (player)
+ player->CompletedAchievement(achievementEntry);
+ break;
+ }
+ }
+
+}
+
+void BattlefieldWG::OnStartGrouping()
+{
+ SendWarningToAllInZone(BATTLEFIELD_WG_TEXT_WILL_START);
+}
+
+uint8 BattlefieldWG::GetSpiritGraveyardId(uint32 areaId)
+{
+ switch (areaId)
+ {
+ case AREA_WINTERGRASP_FORTRESS:
+ return BATTLEFIELD_WG_GY_KEEP;
+ case AREA_THE_SUNKEN_RING:
+ return BATTLEFIELD_WG_GY_WORKSHOP_NE;
+ case AREA_THE_BROKEN_TEMPLATE:
+ return BATTLEFIELD_WG_GY_WORKSHOP_NW;
+ case AREA_WESTPARK_WORKSHOP:
+ return BATTLEFIELD_WG_GY_WORKSHOP_SW;
+ case AREA_EASTPARK_WORKSHOP:
+ return BATTLEFIELD_WG_GY_WORKSHOP_SE;
+ case AREA_WINTERGRASP:
+ return BATTLEFIELD_WG_GY_ALLIANCE;
+ case AREA_THE_CHILLED_QUAGMIRE:
+ return BATTLEFIELD_WG_GY_HORDE;
+ default:
+ sLog->outError(LOG_FILTER_BATTLEFIELD, "BattlefieldWG::GetSpiritGraveyardId: Unexpected Area Id %u", areaId);
+ break;
+ }
+
+ return 0;
+}
+
+void BattlefieldWG::OnCreatureCreate(Creature* creature)
+{
+ // Accessing to db spawned creatures
+ switch (creature->GetEntry())
+ {
+ case NPC_DWARVEN_SPIRIT_GUIDE:
+ case NPC_TAUNKA_SPIRIT_GUIDE:
+ {
+ TeamId teamId = (creature->GetEntry() == NPC_DWARVEN_SPIRIT_GUIDE ? TEAM_ALLIANCE : TEAM_HORDE);
+ uint8 graveyardId = GetSpiritGraveyardId(creature->GetAreaId());
+ if (m_GraveyardList[graveyardId])
+ m_GraveyardList[graveyardId]->SetSpirit(creature, teamId);
+ break;
+ }
+ }
+
+ // untested code - not sure if it is valid.
+ if (IsWarTime())
+ {
+ switch (creature->GetEntry())
+ {
+ case NPC_WINTERGRASP_SIEGE_ENGINE_ALLIANCE:
+ case NPC_WINTERGRASP_SIEGE_ENGINE_HORDE:
+ case NPC_WINTERGRASP_CATAPULT:
+ case NPC_WINTERGRASP_DEMOLISHER:
+ {
+ if (!creature->ToTempSummon()->GetSummonerGUID() || !sObjectAccessor->FindPlayer(creature->ToTempSummon()->GetSummonerGUID()))
+ {
+ creature->setDeathState(DEAD);
+ creature->RemoveFromWorld();
+ return;
+ }
+ Player* creator = sObjectAccessor->FindPlayer(creature->ToTempSummon()->GetSummonerGUID());
+ TeamId team = creator->GetTeamId();
+
+ if (team == TEAM_HORDE)
+ {
+ if (GetData(BATTLEFIELD_WG_DATA_VEHICLE_H) < GetData(BATTLEFIELD_WG_DATA_MAX_VEHICLE_H))
+ {
+ UpdateData(BATTLEFIELD_WG_DATA_VEHICLE_H, 1);
+ creature->AddAura(SPELL_HORDE_FLAG, creature);
+ m_vehicles[team].insert(creature->GetGUID());
+ UpdateVehicleCountWG();
+ }
+ else
+ {
+ creature->setDeathState(DEAD);
+ creature->RemoveFromWorld();
+ return;
+ }
+ }
+ else
+ {
+ if (GetData(BATTLEFIELD_WG_DATA_VEHICLE_A) < GetData(BATTLEFIELD_WG_DATA_MAX_VEHICLE_A))
+ {
+ UpdateData(BATTLEFIELD_WG_DATA_VEHICLE_A, 1);
+ creature->AddAura(SPELL_ALLIANCE_FLAG, creature);
+ m_vehicles[team].insert(creature->GetGUID());
+ UpdateVehicleCountWG();
+ }
+ else
+ {
+ creature->setDeathState(DEAD);
+ creature->RemoveFromWorld();
+ return;
+ }
+ }
+
+ creature->CastSpell(creator, SPELL_GRAB_PASSENGER, true);
+ break;
+ }
+ }
+ }
+}
+
+void BattlefieldWG::OnCreatureRemove(Creature* /*creature*/)
+{
+/* possibly can be used later
+ if (IsWarTime())
+ {
+ switch (creature->GetEntry())
+ {
+ case NPC_WINTERGRASP_SIEGE_ENGINE_ALLIANCE:
+ case NPC_WINTERGRASP_SIEGE_ENGINE_HORDE:
+ case NPC_WINTERGRASP_CATAPULT:
+ case NPC_WINTERGRASP_DEMOLISHER:
+ {
+ uint8 team;
+ if (creature->getFaction() == WintergraspFaction[TEAM_ALLIANCE])
+ team = TEAM_ALLIANCE;
+ else if (creature->getFaction() == WintergraspFaction[TEAM_HORDE])
+ team = TEAM_HORDE;
+ else
+ return;
+
+ m_vehicles[team].erase(creature->GetGUID());
+ if (team == TEAM_HORDE)
+ UpdateData(BATTLEFIELD_WG_DATA_VEHICLE_H, -1);
+ else
+ UpdateData(BATTLEFIELD_WG_DATA_VEHICLE_A, -1);
+ UpdateVehicleCountWG();
+
+ break;
+ }
+ }
+ }*/
+}
+
+void BattlefieldWG::OnGameObjectCreate(GameObject* go)
+{
+ bool isWorkshop = false;
+ uint8 workshopId = 0;
+
+ switch (go->GetEntry())
+ {
+ case GO_WINTERGRASP_FACTORY_BANNER_NE:
+ isWorkshop = true;
+ workshopId = BATTLEFIELD_WG_WORKSHOP_NE;
+ break;
+ case GO_WINTERGRASP_FACTORY_BANNER_NW:
+ isWorkshop = true;
+ workshopId = BATTLEFIELD_WG_WORKSHOP_NW;
+ break;
+ case GO_WINTERGRASP_FACTORY_BANNER_SE:
+ isWorkshop = true;
+ workshopId = BATTLEFIELD_WG_WORKSHOP_SE;
+ break;
+ case GO_WINTERGRASP_FACTORY_BANNER_SW:
+ isWorkshop = true;
+ workshopId = BATTLEFIELD_WG_WORKSHOP_SW;
+ break;
+
+ }
+
+ if (!isWorkshop)
+ return;
+
+ for (Workshop::const_iterator itr = WorkshopsList.begin(); itr != WorkshopsList.end(); ++itr)
+ {
+ if (WGWorkshop* workshop = (*itr))
+ {
+ if (workshop->workshopId == workshopId)
+ {
+ WintergraspCapturePoint* capturePoint = new WintergraspCapturePoint(this, GetAttackerTeam());
+
+ capturePoint->SetCapturePointData(go);
+ capturePoint->LinkToWorkshop(workshop);
+ AddCapturePoint(capturePoint);
+ break;
+ }
+ }
+ }
+}
+
+// Called when player kill a unit in wg zone
+void BattlefieldWG::HandleKill(Player* killer, Unit* victim)
+{
+ if (killer == victim)
+ return;
+
+ bool again = false;
+ TeamId killerTeam = killer->GetTeamId();
+
+ if (victim->GetTypeId() == TYPEID_PLAYER)
+ {
+ for (GuidSet::const_iterator itr = m_PlayersInWar[killerTeam].begin(); itr != m_PlayersInWar[killerTeam].end(); ++itr)
+ if (Player* player = sObjectAccessor->FindPlayer(*itr))
+ if (player->GetDistance2d(killer) < 40)
+ PromotePlayer(player);
+ return;
+ }
+
+ for (GuidSet::const_iterator itr = KeepCreature[GetOtherTeam(killerTeam)].begin();
+ itr != KeepCreature[GetOtherTeam(killerTeam)].end(); ++itr)
+ {
+ if (Unit* unit = sObjectAccessor->FindUnit(*itr))
+ {
+ if (Creature* creature = unit->ToCreature())
+ {
+ if (victim->GetEntry() == creature->GetEntry() && !again)
+ {
+ again = true;
+ for (GuidSet::const_iterator iter = m_PlayersInWar[killerTeam].begin(); iter != m_PlayersInWar[killerTeam].end(); ++iter)
+ if (Player* player = sObjectAccessor->FindPlayer(*iter))
+ if (player->GetDistance2d(killer) < 40.0f)
+ PromotePlayer(player);
+ }
+ }
+ }
+ }
+ // TODO:Recent PvP activity worldstate
+}
+
+bool BattlefieldWG::FindAndRemoveVehicleFromList(Unit* vehicle)
+{
+ for (uint32 itr = 0; itr < 2; ++itr)
+ {
+ if (m_vehicles[itr].find(vehicle->GetGUID()) != m_vehicles[itr].end())
+ {
+ m_vehicles[itr].erase(vehicle->GetGUID());
+ if (itr == TEAM_HORDE)
+ UpdateData(BATTLEFIELD_WG_DATA_VEHICLE_H, -1);
+ else
+ UpdateData(BATTLEFIELD_WG_DATA_VEHICLE_A, -1);
+ return true;
+ }
+ }
+ return false;
+}
+
+void BattlefieldWG::OnUnitDeath(Unit* unit)
+{
+ if (IsWarTime())
+ if (unit->IsVehicle())
+ if (FindAndRemoveVehicleFromList(unit))
+ UpdateVehicleCountWG();
+}
+
+// Update rank for player
+void BattlefieldWG::PromotePlayer(Player* killer)
+{
+ if (!m_isActive)
+ return;
+ // Updating rank of player
+ if (Aura* aur = killer->GetAura(SPELL_RECRUIT))
+ {
+ if (aur->GetStackAmount() >= 5)
+ {
+ killer->RemoveAura(SPELL_RECRUIT);
+ killer->CastSpell(killer, SPELL_CORPORAL, true);
+ SendWarningToPlayer(killer, BATTLEFIELD_WG_TEXT_FIRSTRANK);
+ }
+ else
+ killer->CastSpell(killer, SPELL_RECRUIT, true);
+ }
+ else if (Aura* aur = killer->GetAura(SPELL_CORPORAL))
+ {
+ if (aur->GetStackAmount() >= 5)
+ {
+ killer->RemoveAura(SPELL_CORPORAL);
+ killer->CastSpell(killer, SPELL_LIEUTENANT, true);
+ SendWarningToPlayer(killer, BATTLEFIELD_WG_TEXT_SECONDRANK);
+ }
+ else
+ killer->CastSpell(killer, SPELL_CORPORAL, true);
+ }
+}
+
+void BattlefieldWG::RemoveAurasFromPlayer(Player* player)
+{
+ player->RemoveAurasDueToSpell(SPELL_RECRUIT);
+ player->RemoveAurasDueToSpell(SPELL_CORPORAL);
+ player->RemoveAurasDueToSpell(SPELL_LIEUTENANT);
+ player->RemoveAurasDueToSpell(SPELL_TOWER_CONTROL);
+ player->RemoveAurasDueToSpell(SPELL_SPIRITUAL_IMMUNITY);
+ player->RemoveAurasDueToSpell(SPELL_TENACITY);
+ player->RemoveAurasDueToSpell(SPELL_ESSENCE_OF_WINTERGRASP);
+ player->RemoveAurasDueToSpell(SPELL_WINTERGRASP_RESTRICTED_FLIGHT_AREA);
+}
+
+void BattlefieldWG::OnPlayerJoinWar(Player* player)
+{
+ RemoveAurasFromPlayer(player);
+
+ player->CastSpell(player, SPELL_RECRUIT, true);
+
+ if (player->GetZoneId() != m_ZoneId)
+ {
+ if (player->GetTeamId() == GetDefenderTeam())
+ player->TeleportTo(571, 5345, 2842, 410, 3.14f);
+ else
+ {
+ if (player->GetTeamId() == TEAM_HORDE)
+ player->TeleportTo(571, 5025.857422f, 3674.628906f, 362.737122f, 4.135169f);
+ else
+ player->TeleportTo(571, 5101.284f, 2186.564f, 373.549f, 3.812f);
+ }
+ }
+
+ UpdateTenacity();
+
+ if (player->GetTeamId() == GetAttackerTeam())
+ {
+ if (GetData(BATTLEFIELD_WG_DATA_BROKEN_TOWER_ATT) < 3)
+ player->SetAuraStack(SPELL_TOWER_CONTROL, player, 3 - GetData(BATTLEFIELD_WG_DATA_BROKEN_TOWER_ATT));
+ }
+ else
+ {
+ if (GetData(BATTLEFIELD_WG_DATA_BROKEN_TOWER_ATT) > 0)
+ player->SetAuraStack(SPELL_TOWER_CONTROL, player, GetData(BATTLEFIELD_WG_DATA_BROKEN_TOWER_ATT));
+ }
+ SendInitWorldStatesTo(player);
+}
+
+void BattlefieldWG::OnPlayerLeaveWar(Player* player)
+{
+ // Remove all aura from WG // TODO: false we can go out of this zone on retail and keep Rank buff, remove on end of WG
+ if (!player->GetSession()->PlayerLogout())
+ {
+ if (player->GetVehicle()) // Remove vehicle of player if he go out.
+ player->GetVehicle()->Dismiss();
+ RemoveAurasFromPlayer(player);
+ }
+
+ player->RemoveAurasDueToSpell(SPELL_HORDE_CONTROLS_FACTORY_PHASE_SHIFT);
+ player->RemoveAurasDueToSpell(SPELL_ALLIANCE_CONTROLS_FACTORY_PHASE_SHIFT);
+ player->RemoveAurasDueToSpell(SPELL_HORDE_CONTROL_PHASE_SHIFT);
+ player->RemoveAurasDueToSpell(SPELL_ALLIANCE_CONTROL_PHASE_SHIFT);
+}
+
+void BattlefieldWG::OnPlayerLeaveZone(Player* player)
+{
+ if (!m_isActive)
+ RemoveAurasFromPlayer(player);
+
+ player->RemoveAurasDueToSpell(SPELL_HORDE_CONTROLS_FACTORY_PHASE_SHIFT);
+ player->RemoveAurasDueToSpell(SPELL_ALLIANCE_CONTROLS_FACTORY_PHASE_SHIFT);
+ player->RemoveAurasDueToSpell(SPELL_HORDE_CONTROL_PHASE_SHIFT);
+ player->RemoveAurasDueToSpell(SPELL_ALLIANCE_CONTROL_PHASE_SHIFT);
+}
+
+void BattlefieldWG::OnPlayerEnterZone(Player* player)
+{
+ if (!m_isActive)
+ RemoveAurasFromPlayer(player);
+
+ player->AddAura(m_DefenderTeam == TEAM_HORDE ? SPELL_HORDE_CONTROL_PHASE_SHIFT : SPELL_ALLIANCE_CONTROL_PHASE_SHIFT, player);
+ // Send worldstate to player
+ SendInitWorldStatesTo(player);
+}
+
+uint32 BattlefieldWG::GetData(uint32 data)
+{
+ switch (data)
+ {
+ // Used to determine when the phasing spells must be casted
+ // See: SpellArea::IsFitToRequirements
+ case AREA_THE_SUNKEN_RING:
+ case AREA_THE_BROKEN_TEMPLATE:
+ case AREA_WESTPARK_WORKSHOP:
+ case AREA_EASTPARK_WORKSHOP:
+ // Graveyards and Workshops are controlled by the same team.
+ if (m_GraveyardList[GetSpiritGraveyardId(data)])
+ return m_GraveyardList[GetSpiritGraveyardId(data)]->GetControlTeamId();
+ }
+
+ return Battlefield::GetData(data);
+}
+
+// Method sending worldsate to player
+WorldPacket BattlefieldWG::BuildInitWorldStates()
+{
+ WorldPacket data(SMSG_INIT_WORLD_STATES, (4 + 4 + 4 + 2 + (BuildingsInZone.size() * 8) + (WorkshopsList.size() * 8)));
+
+ data << uint32(m_MapId);
+ data << uint32(m_ZoneId);
+ data << uint32(0);
+ data << uint16(4 + 2 + 4 + BuildingsInZone.size() + WorkshopsList.size());
+
+ data << uint32(BATTLEFIELD_WG_WORLD_STATE_ATTACKER) << uint32(GetAttackerTeam());
+ data << uint32(BATTLEFIELD_WG_WORLD_STATE_DEFENDER) << uint32(GetDefenderTeam());
+ data << uint32(BATTLEFIELD_WG_WORLD_STATE_ACTIVE) << uint32(IsWarTime()? 0 : 1); // Note: cleanup these two, their names look awkward
+ data << uint32(BATTLEFIELD_WG_WORLD_STATE_SHOW_WORLDSTATE) << uint32(IsWarTime()? 1 : 0);
+
+ for (uint32 i = 0; i < 2; ++i)
+ data << ClockWorldState[i] << uint32(time(NULL) + (m_Timer / 1000));
+
+ data << uint32(BATTLEFIELD_WG_WORLD_STATE_VEHICLE_H) << uint32(GetData(BATTLEFIELD_WG_DATA_VEHICLE_H));
+ data << uint32(BATTLEFIELD_WG_WORLD_STATE_MAX_VEHICLE_H) << GetData(BATTLEFIELD_WG_DATA_MAX_VEHICLE_H);
+ data << uint32(BATTLEFIELD_WG_WORLD_STATE_VEHICLE_A) << uint32(GetData(BATTLEFIELD_WG_DATA_VEHICLE_A));
+ data << uint32(BATTLEFIELD_WG_WORLD_STATE_MAX_VEHICLE_A) << GetData(BATTLEFIELD_WG_DATA_MAX_VEHICLE_A);
+
+ for (GameObjectBuilding::const_iterator itr = BuildingsInZone.begin(); itr != BuildingsInZone.end(); ++itr)
+ data << (*itr)->m_WorldState << (*itr)->m_State;
+
+ for (Workshop::const_iterator itr = WorkshopsList.begin(); itr != WorkshopsList.end(); ++itr)
+ if (*itr)
+ data << WorkshopsData[(*itr)->workshopId].worldstate << (*itr)->state;
+
+ return data;
+}
+
+void BattlefieldWG::SendInitWorldStatesTo(Player* player)
+{
+ WorldPacket data = BuildInitWorldStates();
+ player->GetSession()->SendPacket(&data);
+}
+
+void BattlefieldWG::SendInitWorldStatesToAll()
+{
+ WorldPacket data = BuildInitWorldStates();
+ for (uint8 team = 0; team < 2; team++)
+ for (GuidSet::iterator itr = m_players[team].begin(); itr != m_players[team].end(); ++itr)
+ if (Player* player = sObjectAccessor->FindPlayer(*itr))
+ player->GetSession()->SendPacket(&data);
+}
+
+void BattlefieldWG::BrokenWallOrTower(TeamId /*team*/)
+{
+// might be some use for this in the future. old code commented out below. KL
+/* if (team == GetDefenderTeam())
+ {
+ for (GuidSet::const_iterator itr = m_PlayersInWar[GetAttackerTeam()].begin(); itr != m_PlayersInWar[GetAttackerTeam()].end(); ++itr)
+ {
+ if (Player* player = sObjectAccessor->FindPlayer(*itr))
+ IncrementQuest(player, WGQuest[player->GetTeamId()][2], true);
+ }
+ }*/
+}
+
+// Called when a tower is broke
+void BattlefieldWG::UpdatedDestroyedTowerCount(TeamId team)
+{
+ // Destroy an attack tower
+ if (team == GetAttackerTeam())
+ {
+ // Update counter
+ UpdateData(BATTLEFIELD_WG_DATA_DAMAGED_TOWER_ATT, -1);
+ UpdateData(BATTLEFIELD_WG_DATA_BROKEN_TOWER_ATT, 1);
+
+ // Remove buff stack on attackers
+ for (GuidSet::const_iterator itr = m_PlayersInWar[GetAttackerTeam()].begin(); itr != m_PlayersInWar[GetAttackerTeam()].end(); ++itr)
+ if (Player* player = sObjectAccessor->FindPlayer(*itr))
+ player->RemoveAuraFromStack(SPELL_TOWER_CONTROL);
+
+ // Add buff stack to defenders
+ for (GuidSet::const_iterator itr = m_PlayersInWar[GetDefenderTeam()].begin(); itr != m_PlayersInWar[GetDefenderTeam()].end(); ++itr)
+ if (Player* player = sObjectAccessor->FindPlayer(*itr))
+ {
+ player->CastSpell(player, SPELL_TOWER_CONTROL, true);
+ DoCompleteOrIncrementAchievement(ACHIEVEMENTS_WG_TOWER_DESTROY, player);
+ }
+
+ // If all three south towers are destroyed (ie. all attack towers), remove ten minutes from battle time
+ if (GetData(BATTLEFIELD_WG_DATA_BROKEN_TOWER_ATT) == 3)
+ {
+ if (int32(m_Timer - 600000) < 0)
+ m_Timer = 0;
+ else
+ m_Timer -= 600000;
+ SendInitWorldStatesToAll();
+ }
+ }
+ else
+ {
+ UpdateData(BATTLEFIELD_WG_DATA_DAMAGED_TOWER_DEF, -1);
+ UpdateData(BATTLEFIELD_WG_DATA_BROKEN_TOWER_DEF, 1);
+ }
+}
+
+void BattlefieldWG::ProcessEvent(WorldObject *obj, uint32 eventId)
+{
+ if (!obj || !IsWarTime())
+ return;
+
+ // We handle only gameobjects here
+ GameObject* go = obj->ToGameObject();
+ if (!go)
+ return;
+
+ // On click on titan relic
+ if (go->GetEntry() == GO_WINTERGRASP_TITAN_S_RELIC)
+ {
+ if (CanInteractWithRelic())
+ EndBattle(false);
+ else
+ GetRelic()->SetRespawnTime(RESPAWN_IMMEDIATELY);
+ }
+
+ // if destroy or damage event, search the wall/tower and update worldstate/send warning message
+ for (GameObjectBuilding::const_iterator itr = BuildingsInZone.begin(); itr != BuildingsInZone.end(); ++itr)
+ {
+ if (go->GetEntry() == (*itr)->m_Build->GetEntry())
+ {
+ if ((*itr)->m_Build->GetGOInfo()->building.damagedEvent == eventId)
+ (*itr)->Damaged();
+
+ if ((*itr)->m_Build->GetGOInfo()->building.destroyedEvent == eventId)
+ (*itr)->Destroyed();
+
+ break;
+ }
+ }
+}
+
+// Called when a tower is damaged, used for honor reward calcul
+void BattlefieldWG::UpdateDamagedTowerCount(TeamId team)
+{
+ if (team == GetAttackerTeam())
+ UpdateData(BATTLEFIELD_WG_DATA_DAMAGED_TOWER_ATT, 1);
+ else
+ UpdateData(BATTLEFIELD_WG_DATA_DAMAGED_TOWER_DEF, 1);
+}
+
+// Update vehicle count WorldState to player
+void BattlefieldWG::UpdateVehicleCountWG()
+{
+ SendUpdateWorldState(BATTLEFIELD_WG_WORLD_STATE_VEHICLE_H, GetData(BATTLEFIELD_WG_DATA_VEHICLE_H));
+ SendUpdateWorldState(BATTLEFIELD_WG_WORLD_STATE_MAX_VEHICLE_H, GetData(BATTLEFIELD_WG_DATA_MAX_VEHICLE_H));
+ SendUpdateWorldState(BATTLEFIELD_WG_WORLD_STATE_VEHICLE_A, GetData(BATTLEFIELD_WG_DATA_VEHICLE_A));
+ SendUpdateWorldState(BATTLEFIELD_WG_WORLD_STATE_MAX_VEHICLE_A, GetData(BATTLEFIELD_WG_DATA_MAX_VEHICLE_A));
+}
+
+void BattlefieldWG::UpdateTenacity()
+{
+ TeamId team = TEAM_NEUTRAL;
+ uint32 alliancePlayers = m_PlayersInWar[TEAM_ALLIANCE].size();
+ uint32 hordePlayers = m_PlayersInWar[TEAM_HORDE].size();
+ int32 newStack = 0;
+
+ if (alliancePlayers && hordePlayers)
+ {
+ if (alliancePlayers < hordePlayers)
+ newStack = int32((float(hordePlayers / alliancePlayers) - 1) * 4); // positive, should cast on alliance
+ else if (alliancePlayers > hordePlayers)
+ newStack = int32((1 - float(alliancePlayers / hordePlayers)) * 4); // negative, should cast on horde
+ }
+
+ if (newStack == int32(m_tenacityStack))
+ return;
+
+ if (m_tenacityStack > 0 && newStack <= 0) // old buff was on alliance
+ team = TEAM_ALLIANCE;
+ else if (newStack >= 0) // old buff was on horde
+ team = TEAM_HORDE;
+
+ m_tenacityStack = newStack;
+ // Remove old buff
+ if (team != TEAM_NEUTRAL)
+ {
+ for (GuidSet::const_iterator itr = m_players[team].begin(); itr != m_players[team].end(); ++itr)
+ if (Player* player = sObjectAccessor->FindPlayer(*itr))
+ if (player->getLevel() >= m_MinLevel)
+ player->RemoveAurasDueToSpell(SPELL_TENACITY);
+
+ for (GuidSet::const_iterator itr = m_vehicles[team].begin(); itr != m_vehicles[team].end(); ++itr)
+ if (Unit* unit = sObjectAccessor->FindUnit(*itr))
+ if (Creature* creature = unit->ToCreature())
+ creature->RemoveAurasDueToSpell(SPELL_TENACITY_VEHICLE);
+ }
+
+ // Apply new buff
+ if (newStack)
+ {
+ team = newStack > 0 ? TEAM_ALLIANCE : TEAM_HORDE;
+
+ if (newStack < 0)
+ newStack = -newStack;
+ if (newStack > 20)
+ newStack = 20;
+
+ uint32 buff_honor = SPELL_GREATEST_HONOR;
+ if (newStack < 15)
+ buff_honor = SPELL_GREATER_HONOR;
+ if (newStack < 10)
+ buff_honor = SPELL_GREAT_HONOR;
+ if (newStack < 5)
+ buff_honor = 0;
+
+ for (GuidSet::const_iterator itr = m_PlayersInWar[team].begin(); itr != m_PlayersInWar[team].end(); ++itr)
+ if (Player* player = sObjectAccessor->FindPlayer(*itr))
+ player->SetAuraStack(SPELL_TENACITY, player, newStack);
+
+ for (GuidSet::const_iterator itr = m_vehicles[team].begin(); itr != m_vehicles[team].end(); ++itr)
+ if (Unit* unit = sObjectAccessor->FindUnit(*itr))
+ if (Creature* creature = unit->ToCreature())
+ creature->SetAuraStack(SPELL_TENACITY_VEHICLE, creature, newStack);
+
+ if (buff_honor != 0)
+ {
+ for (GuidSet::const_iterator itr = m_PlayersInWar[team].begin(); itr != m_PlayersInWar[team].end(); ++itr)
+ if (Player* player = sObjectAccessor->FindPlayer(*itr))
+ player->CastSpell(player, buff_honor, true);
+ for (GuidSet::const_iterator itr = m_vehicles[team].begin(); itr != m_vehicles[team].end(); ++itr)
+ if (Unit* unit = sObjectAccessor->FindUnit(*itr))
+ if (Creature* creature = unit->ToCreature())
+ creature->CastSpell(creature, buff_honor, true);
+ }
+ }
+}
+
+WintergraspCapturePoint::WintergraspCapturePoint(BattlefieldWG* battlefield, TeamId teamInControl) : BfCapturePoint(battlefield)
+{
+ m_Bf = battlefield;
+ m_team = teamInControl;
+ m_Workshop = NULL;
+}
+
+void WintergraspCapturePoint::ChangeTeam(TeamId /*oldTeam*/)
+{
+ ASSERT(m_Workshop);
+ m_Workshop->GiveControlTo(m_team, false);
+}
+
+BfGraveyardWG::BfGraveyardWG(BattlefieldWG* battlefield) : BfGraveyard(battlefield)
+{
+ m_Bf = battlefield;
+}
diff --git a/src/server/game/Battlefield/Zones/BattlefieldWG.h b/src/server/game/Battlefield/Zones/BattlefieldWG.h
new file mode 100644
index 00000000000..11510e1ea98
--- /dev/null
+++ b/src/server/game/Battlefield/Zones/BattlefieldWG.h
@@ -0,0 +1,1784 @@
+/*
+ * Copyright (C) 2008-2010 TrinityCore <http://www.trinitycore.org/>
+ * Copyright (C) 2005-2009 MaNGOS <http://getmangos.com/>
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation; either version 2 of the License, or (at your
+ * option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
+ * more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef BATTLEFIELD_WG_
+#define BATTLEFIELD_WG_
+
+#include "ObjectAccessor.h"
+#include "WorldPacket.h"
+#include "World.h"
+#include "Group.h"
+#include "GroupMgr.h"
+#include "Battlefield.h"
+
+uint32 const VehNumWorldState[2] = { 3680, 3490 };
+uint32 const MaxVehNumWorldState[2] = { 3681, 3491 };
+uint32 const ClockWorldState[2] = { 3781, 4354 };
+uint32 const WintergraspFaction[3] = { 1732, 1735, 35 };
+float const WintergraspStalkerPos[4] = { 0, 0, 0, 0 };
+
+class BattlefieldWG;
+class WintergraspCapturePoint;
+
+struct BfWGGameObjectBuilding;
+struct WGWorkshop;
+
+typedef std::set<GameObject*> GameObjectSet;
+typedef std::set<BfWGGameObjectBuilding*> GameObjectBuilding;
+typedef std::set<WGWorkshop*> Workshop;
+typedef std::set<Group*> GroupSet;
+//typedef std::set<WintergraspCapturePoint *> CapturePointSet; unused ?
+
+enum WintergrastData
+{
+ BATTLEFIELD_WG_ZONEID = 4197, // Wintergrasp
+ BATTLEFIELD_WG_MAPID = 571 // Northrend
+};
+
+enum WintergraspSpells
+{
+ // Wartime auras
+ SPELL_RECRUIT = 37795,
+ SPELL_CORPORAL = 33280,
+ SPELL_LIEUTENANT = 55629,
+ SPELL_TENACITY = 58549,
+ SPELL_TENACITY_VEHICLE = 59911,
+ SPELL_TOWER_CONTROL = 62064,
+ SPELL_SPIRITUAL_IMMUNITY = 58729,
+ SPELL_GREAT_HONOR = 58555,
+ SPELL_GREATER_HONOR = 58556,
+ SPELL_GREATEST_HONOR = 58557,
+ SPELL_ALLIANCE_FLAG = 14268,
+ SPELL_HORDE_FLAG = 14267,
+ SPELL_GRAB_PASSENGER = 61178,
+
+ // Reward spells
+ SPELL_VICTORY_REWARD = 56902,
+ SPELL_DEFEAT_REWARD = 58494,
+ SPELL_DAMAGED_TOWER = 59135,
+ SPELL_DESTROYED_TOWER = 59136,
+ SPELL_DAMAGED_BUILDING = 59201,
+ SPELL_INTACT_BUILDING = 59203,
+
+ SPELL_TELEPORT_BRIDGE = 59096,
+ SPELL_TELEPORT_FORTRESS = 60035,
+
+ SPELL_TELEPORT_DALARAN = 53360,
+ SPELL_VICTORY_AURA = 60044,
+
+ // Other spells
+ SPELL_WINTERGRASP_WATER = 36444,
+ SPELL_ESSENCE_OF_WINTERGRASP = 58045,
+ SPELL_WINTERGRASP_RESTRICTED_FLIGHT_AREA = 58730,
+
+ // Phasing spells
+ SPELL_HORDE_CONTROLS_FACTORY_PHASE_SHIFT = 56618, // ADDS PHASE 16
+ SPELL_ALLIANCE_CONTROLS_FACTORY_PHASE_SHIFT = 56617, // ADDS PHASE 32
+
+ SPELL_HORDE_CONTROL_PHASE_SHIFT = 55773, // ADDS PHASE 64
+ SPELL_ALLIANCE_CONTROL_PHASE_SHIFT = 55774 // ADDS PHASE 128
+};
+
+enum WintergraspData
+{
+ BATTLEFIELD_WG_DATA_DAMAGED_TOWER_DEF,
+ BATTLEFIELD_WG_DATA_BROKEN_TOWER_DEF,
+ BATTLEFIELD_WG_DATA_DAMAGED_TOWER_ATT,
+ BATTLEFIELD_WG_DATA_BROKEN_TOWER_ATT,
+ BATTLEFIELD_WG_DATA_MAX_VEHICLE_A,
+ BATTLEFIELD_WG_DATA_MAX_VEHICLE_H,
+ BATTLEFIELD_WG_DATA_VEHICLE_A,
+ BATTLEFIELD_WG_DATA_VEHICLE_H,
+ BATTLEFIELD_WG_DATA_MAX
+};
+
+enum WintergraspAchievements
+{
+ ACHIEVEMENTS_WIN_WG = 1717,
+ ACHIEVEMENTS_WIN_WG_100 = 1718, // todo
+ ACHIEVEMENTS_WG_GNOMESLAUGHTER = 1723, // todo
+ ACHIEVEMENTS_WG_TOWER_DESTROY = 1727,
+ ACHIEVEMENTS_DESTRUCTION_DERBY_A = 1737, // todo
+ ACHIEVEMENTS_WG_TOWER_CANNON_KILL = 1751, // todo
+ ACHIEVEMENTS_WG_MASTER_A = 1752, // todo
+ ACHIEVEMENTS_WIN_WG_TIMER_10 = 1755,
+ ACHIEVEMENTS_STONE_KEEPER_50 = 2085, // todo
+ ACHIEVEMENTS_STONE_KEEPER_100 = 2086, // todo
+ ACHIEVEMENTS_STONE_KEEPER_250 = 2087, // todo
+ ACHIEVEMENTS_STONE_KEEPER_500 = 2088, // todo
+ ACHIEVEMENTS_STONE_KEEPER_1000 = 2089, // todo
+ ACHIEVEMENTS_WG_RANGER = 2199, // todo
+ ACHIEVEMENTS_DESTRUCTION_DERBY_H = 2476, // todo
+ ACHIEVEMENTS_WG_MASTER_H = 2776 // todo
+};
+
+enum WintergraspWorldStates
+{
+ BATTLEFIELD_WG_WORLD_STATE_VEHICLE_H = 3490,
+ BATTLEFIELD_WG_WORLD_STATE_MAX_VEHICLE_H = 3491,
+ BATTLEFIELD_WG_WORLD_STATE_VEHICLE_A = 3680,
+ BATTLEFIELD_WG_WORLD_STATE_MAX_VEHICLE_A = 3681,
+ BATTLEFIELD_WG_WORLD_STATE_ACTIVE = 3801,
+ BATTLEFIELD_WG_WORLD_STATE_DEFENDER = 3802,
+ BATTLEFIELD_WG_WORLD_STATE_ATTACKER = 3803,
+ BATTLEFIELD_WG_WORLD_STATE_SHOW_WORLDSTATE = 3710
+};
+
+enum WintergraspAreaIds
+{
+ AREA_WINTERGRASP_FORTRESS = 4575,
+ AREA_THE_SUNKEN_RING = 4538,
+ AREA_THE_BROKEN_TEMPLATE = 4539,
+ AREA_WESTPARK_WORKSHOP = 4611,
+ AREA_EASTPARK_WORKSHOP = 4612,
+ AREA_WINTERGRASP = 4197,
+ AREA_THE_CHILLED_QUAGMIRE = 4589
+};
+
+/*#########################
+ *####### Graveyards ######
+ *#########################*/
+
+class BfGraveyardWG : public BfGraveyard
+{
+ public:
+ BfGraveyardWG(BattlefieldWG* Bf);
+
+ void SetTextId(uint32 textid) { m_GossipTextId = textid; }
+ uint32 GetTextId() { return m_GossipTextId; }
+ protected:
+ uint32 m_GossipTextId;
+};
+
+enum WGGraveyardId
+{
+ BATTLEFIELD_WG_GY_WORKSHOP_NE,
+ BATTLEFIELD_WG_GY_WORKSHOP_NW,
+ BATTLEFIELD_WG_GY_WORKSHOP_SE,
+ BATTLEFIELD_WG_GY_WORKSHOP_SW,
+ BATTLEFIELD_WG_GY_KEEP,
+ BATTLEFIELD_WG_GY_HORDE,
+ BATTLEFIELD_WG_GY_ALLIANCE,
+ BATTLEFIELD_WG_GRAVEYARD_MAX
+};
+
+enum WGGossipText
+{
+ BATTLEFIELD_WG_GOSSIPTEXT_GY_NE = -1850501,
+ BATTLEFIELD_WG_GOSSIPTEXT_GY_NW = -1850502,
+ BATTLEFIELD_WG_GOSSIPTEXT_GY_SE = -1850504,
+ BATTLEFIELD_WG_GOSSIPTEXT_GY_SW = -1850503,
+ BATTLEFIELD_WG_GOSSIPTEXT_GY_KEEP = -1850500,
+ BATTLEFIELD_WG_GOSSIPTEXT_GY_HORDE = -1850505,
+ BATTLEFIELD_WG_GOSSIPTEXT_GY_ALLIANCE = -1850506
+};
+
+enum WintergraspNpcs
+{
+ BATTLEFIELD_WG_NPC_GUARD_H = 30739,
+ BATTLEFIELD_WG_NPC_GUARD_A = 30740,
+ BATTLEFIELD_WG_NPC_STALKER = 15214,
+
+ BATTLEFIELD_WG_NPC_VIERON_BLAZEFEATHER = 31102,
+ BATTLEFIELD_WG_NPC_STONE_GUARD_MUKAR = 32296, // <WINTERGRASP QUARTERMASTER>
+ BATTLEFIELD_WG_NPC_HOODOO_MASTER_FU_JIN = 31101, // <MASTER HEXXER>
+ BATTLEFIELD_WG_NPC_CHAMPION_ROS_SLAI = 39173, // <WINTERGRASP QUARTERMASTER>
+ BATTLEFIELD_WG_NPC_COMMANDER_DARDOSH = 31091,
+ BATTLEFIELD_WG_NPC_TACTICAL_OFFICER_KILRATH = 31151,
+ BATTLEFIELD_WG_NPC_SIEGESMITH_STRONGHOOF = 31106,
+ BATTLEFIELD_WG_NPC_PRIMALIST_MULFORT = 31053,
+ BATTLEFIELD_WG_NPC_LIEUTENANT_MURP = 31107,
+
+ BATTLEFIELD_WG_NPC_BOWYER_RANDOLPH = 31052,
+ BATTLEFIELD_WG_NPC_KNIGHT_DAMERON = 32294, // <WINTERGRASP QUARTERMASTER>
+ BATTLEFIELD_WG_NPC_SORCERESS_KAYLANA = 31051, // <ENCHANTRESS>
+ BATTLEFIELD_WG_NPC_MARSHAL_MAGRUDER = 39172, // <WINTERGRASP QUARTERMASTER>
+ BATTLEFIELD_WG_NPC_COMMANDER_ZANNETH = 31036,
+ BATTLEFIELD_WG_NPC_TACTICAL_OFFICER_AHBRAMIS = 31153,
+ BATTLEFIELD_WG_NPC_SIEGE_MASTER_STOUTHANDLE = 31108,
+ BATTLEFIELD_WG_NPC_ANCHORITE_TESSA = 31054,
+ BATTLEFIELD_WG_NPC_SENIOR_DEMOLITIONIST_LEGOSO = 31109,
+
+ NPC_TAUNKA_SPIRIT_GUIDE = 31841, // Horde spirit guide for Wintergrasp
+ NPC_DWARVEN_SPIRIT_GUIDE = 31842, // Alliance spirit guide for Wintergrasp
+ NPC_TOWER_CANNON = 28366,
+
+ NPC_WINTERGRASP_SIEGE_ENGINE_ALLIANCE = 28312,
+ NPC_WINTERGRASP_SIEGE_ENGINE_HORDE = 32627,
+ NPC_WINTERGRASP_CATAPULT = 27881,
+ NPC_WINTERGRASP_DEMOLISHER = 28094,
+ NPC_WINTERGRASP_TOWER_CANNON = 28366
+};
+
+struct BfWGCoordGY
+{
+ float x;
+ float y;
+ float z;
+ float o;
+ uint32 gyid;
+ uint8 type;
+ uint32 textid; // for gossip menu
+ TeamId startcontrol;
+};
+
+uint32 const WGQuest[2][6] =
+{
+ { 13186, 13181, 13222, 13538, 13177, 13179 },
+ { 13185, 13183, 13223, 13539, 13178, 13180 },
+};
+// 7 in sql, 7 in header
+BfWGCoordGY const WGGraveYard[BATTLEFIELD_WG_GRAVEYARD_MAX] =
+{
+ { 5104.750f, 2300.940f, 368.579f, 0.733038f, 1329, BATTLEFIELD_WG_GY_WORKSHOP_NE, BATTLEFIELD_WG_GOSSIPTEXT_GY_NE, TEAM_NEUTRAL },
+ { 5099.120f, 3466.036f, 368.484f, 5.317802f, 1330, BATTLEFIELD_WG_GY_WORKSHOP_NW, BATTLEFIELD_WG_GOSSIPTEXT_GY_NW, TEAM_NEUTRAL },
+ { 4314.648f, 2408.522f, 392.642f, 6.268125f, 1333, BATTLEFIELD_WG_GY_WORKSHOP_SE, BATTLEFIELD_WG_GOSSIPTEXT_GY_SE, TEAM_NEUTRAL },
+ { 4331.716f, 3235.695f, 390.251f, 0.008500f, 1334, BATTLEFIELD_WG_GY_WORKSHOP_SW, BATTLEFIELD_WG_GOSSIPTEXT_GY_SW, TEAM_NEUTRAL },
+ { 5537.986f, 2897.493f, 517.057f, 4.819249f, 1285, BATTLEFIELD_WG_GY_KEEP, BATTLEFIELD_WG_GOSSIPTEXT_GY_KEEP, TEAM_NEUTRAL },
+ { 5032.454f, 3711.382f, 372.468f, 3.971623f, 1331, BATTLEFIELD_WG_GY_HORDE, BATTLEFIELD_WG_GOSSIPTEXT_GY_HORDE, TEAM_HORDE },
+ { 5140.790f, 2179.120f, 390.950f, 1.972220f, 1332, BATTLEFIELD_WG_GY_ALLIANCE, BATTLEFIELD_WG_GOSSIPTEXT_GY_ALLIANCE, TEAM_ALLIANCE },
+};
+
+/* ######################### *
+ * WintergraspCapturePoint *
+ * ######################### */
+
+class WintergraspCapturePoint : public BfCapturePoint
+{
+ public:
+ WintergraspCapturePoint(BattlefieldWG* battlefield, TeamId teamInControl);
+
+ void LinkToWorkshop(WGWorkshop* workshop) { m_Workshop = workshop; }
+
+ void ChangeTeam(TeamId oldteam);
+ TeamId GetTeam() const { return m_team; }
+
+ protected:
+ WGWorkshop* m_Workshop;
+};
+
+/* ######################### *
+ * WinterGrasp Battlefield *
+ * ######################### */
+
+class BattlefieldWG : public Battlefield
+{
+ public:
+ ~BattlefieldWG();
+ /**
+ * \brief Called when the battle start
+ * - Spawn relic and turret
+ * - Rebuild tower and wall
+ * - Invite player to war
+ */
+ void OnBattleStart();
+
+ /**
+ * \brief Called when battle end
+ * - Remove relic and turret
+ * - Change banner/npc in keep if it needed
+ * - Saving battlestate
+ * - Reward honor/mark to player
+ * - Remove vehicle
+ * \param endByTimer : true if battle ended when timer is at 00:00, false if battle ended by clicking on relic
+ */
+ void OnBattleEnd(bool endByTimer);
+
+ /**
+ * \brief Called when grouping starts (15 minutes before battlestart)
+ * - Invite all player in zone to join queue
+ */
+ void OnStartGrouping();
+
+ /**
+ * \brief Called when player accept invite to join battle
+ * - Update aura
+ * - Teleport if it needed
+ * - Update worldstate
+ * - Update tenacity
+ * \param player: Player who accepted invite
+ */
+ void OnPlayerJoinWar(Player* player);
+
+ /**
+ * \brief Called when player left the battle
+ * - Update player aura
+ * \param player : Player who left the battle
+ */
+ void OnPlayerLeaveWar(Player* player);
+
+ /**
+ * \brief Called when player left the WG zone
+ * \param player : Player who left the zone
+ */
+ void OnPlayerLeaveZone(Player* player);
+
+ /**
+ * \brief Called when player enters in WG zone
+ * - Update aura
+ * - Update worldstate
+ * \param player : Player who enters the zone
+ */
+ void OnPlayerEnterZone(Player* player);
+
+ /**
+ * \brief Called for update battlefield data
+ * - Save battle timer in database every minutes
+ * - Update imunity aura from graveyard
+ * \param diff : time elapsed since the last call (in ms)
+ */
+ bool Update(uint32 diff);
+
+ /**
+ * \brief Called when a creature is created
+ * - Update vehicle count
+ */
+ void OnCreatureCreate(Creature* creature);
+
+ /**
+ * \brief Called when a creature is removed
+ * - Update vehicle count
+ */
+ void OnCreatureRemove(Creature* creature);
+
+ /**
+ * \brief Called when a gameobject is created
+ */
+ void OnGameObjectCreate(GameObject* go);
+
+ /**
+ * \brief Called when a wall/tower is broken
+ * - Update quest
+ */
+ void BrokenWallOrTower(TeamId team);
+
+ /**
+ * \brief Called when a tower is damaged
+ * - Update tower count (for reward calcul)
+ */
+ void UpdateDamagedTowerCount(TeamId team);
+
+ /**
+ * \brief Called when tower is broken
+ * - Update tower buff
+ * - check if three south tower is down for remove 10 minutes to wg
+ */
+ void UpdatedDestroyedTowerCount(TeamId team);
+
+ void DoCompleteOrIncrementAchievement(uint32 achievement, Player* player, uint8 incrementNumber = 1);
+
+ void RemoveAurasFromPlayer(Player* player);
+
+ /**
+ * \brief Called when battlefield is setup, at server start
+ */
+ bool SetupBattlefield();
+
+ /// Return pointer to relic object
+ GameObject* GetRelic() { return m_titansRelic; }
+
+ /// Define relic object
+ void SetRelic(GameObject* relic) { m_titansRelic = relic; }
+
+ /// Check if players can interact with the relic (Only if the last door has been broken)
+ bool CanInteractWithRelic() { return m_isRelicInteractible; }
+
+ /// Define if player can interact with the relic
+ void SetRelicInteractible(bool allow) { m_isRelicInteractible = allow; }
+
+ void UpdateVehicleCountWG();
+ void UpdateCounterVehicle(bool init);
+
+ WorldPacket BuildInitWorldStates();
+ void SendInitWorldStatesTo(Player* player);
+ void SendInitWorldStatesToAll();
+
+ void HandleKill(Player* killer, Unit* victim);
+ void OnUnitDeath(Unit* unit);
+ void PromotePlayer(Player* killer);
+
+ void UpdateTenacity();
+ void ProcessEvent(WorldObject *obj, uint32 eventId);
+
+ bool FindAndRemoveVehicleFromList(Unit* vehicle);
+
+ // returns the graveyardId in the specified area.
+ uint8 GetSpiritGraveyardId(uint32 areaId);
+
+ uint32 GetData(uint32 data);
+ protected:
+ bool m_isRelicInteractible;
+
+ Workshop WorkshopsList;
+
+ GameObjectSet DefenderPortalList;
+ GameObjectSet m_KeepGameObject[2];
+ GameObjectBuilding BuildingsInZone;
+
+ GuidSet m_vehicles[2];
+ GuidSet CanonList;
+ GuidSet KeepCreature[2];
+ GuidSet OutsideCreature[2];
+
+ uint32 m_tenacityStack;
+ uint32 m_saveTimer;
+
+ GameObject* m_titansRelic;
+};
+
+uint8 const WG_MAX_OBJ = 32;
+uint8 const WG_KEEPGAMEOBJECT_MAX = 44;
+uint8 const WG_MAX_TURRET = 15;
+uint8 const WG_MAX_KEEP_NPC = 39;
+uint8 const WG_MAX_OUTSIDE_NPC = 14;
+uint8 const WG_OUTSIDE_ALLIANCE_NPC = 7;
+uint8 const WG_MAX_TELEPORTER = 12;
+
+enum WintergraspGameObjectBuildingType
+{
+ BATTLEFIELD_WG_OBJECTTYPE_DOOR,
+ BATTLEFIELD_WG_OBJECTTYPE_TITANRELIC,
+ BATTLEFIELD_WG_OBJECTTYPE_WALL,
+ BATTLEFIELD_WG_OBJECTTYPE_DOOR_LAST,
+ BATTLEFIELD_WG_OBJECTTYPE_KEEP_TOWER,
+ BATTLEFIELD_WG_OBJECTTYPE_TOWER
+};
+
+enum WintergraspGameObjectState
+{
+ BATTLEFIELD_WG_OBJECTSTATE_NONE,
+ BATTLEFIELD_WG_OBJECTSTATE_NEUTRAL_INTACT,
+ BATTLEFIELD_WG_OBJECTSTATE_NEUTRAL_DAMAGE,
+ BATTLEFIELD_WG_OBJECTSTATE_NEUTRAL_DESTROY,
+ BATTLEFIELD_WG_OBJECTSTATE_HORDE_INTACT,
+ BATTLEFIELD_WG_OBJECTSTATE_HORDE_DAMAGE,
+ BATTLEFIELD_WG_OBJECTSTATE_HORDE_DESTROY,
+ BATTLEFIELD_WG_OBJECTSTATE_ALLIANCE_INTACT,
+ BATTLEFIELD_WG_OBJECTSTATE_ALLIANCE_DAMAGE,
+ BATTLEFIELD_WG_OBJECTSTATE_ALLIANCE_DESTROY
+};
+
+enum WintergraspWorkshopIds
+{
+ BATTLEFIELD_WG_WORKSHOP_NE,
+ BATTLEFIELD_WG_WORKSHOP_NW,
+ BATTLEFIELD_WG_WORKSHOP_SE,
+ BATTLEFIELD_WG_WORKSHOP_SW,
+ BATTLEFIELD_WG_WORKSHOP_KEEP_WEST,
+ BATTLEFIELD_WG_WORKSHOP_KEEP_EAST
+};
+
+enum WintergraspWorldstates
+{
+ WORLDSTATE_WORKSHOP_NE = 3701,
+ WORLDSTATE_WORKSHOP_NW = 3700,
+ WORLDSTATE_WORKSHOP_SE = 3703,
+ WORLDSTATE_WORKSHOP_SW = 3702,
+ WORLDSTATE_WORKSHOP_K_W = 3698,
+ WORLDSTATE_WORKSHOP_K_E = 3699
+};
+
+enum WintergraspTeamControl
+{
+ BATTLEFIELD_WG_TEAM_ALLIANCE,
+ BATTLEFIELD_WG_TEAM_HORDE,
+ BATTLEFIELD_WG_TEAM_NEUTRAL
+};
+
+// TODO: Handle this with creature_text ?
+enum WintergraspText
+{
+ BATTLEFIELD_WG_TEXT_WORKSHOP_NAME_NE = 12055,
+ BATTLEFIELD_WG_TEXT_WORKSHOP_NAME_NW = 12052,
+ BATTLEFIELD_WG_TEXT_WORKSHOP_NAME_SE = 12053,
+ BATTLEFIELD_WG_TEXT_WORKSHOP_NAME_SW = 12054,
+ BATTLEFIELD_WG_TEXT_WORKSHOP_ATTACK = 12051,
+ BATTLEFIELD_WG_TEXT_WORKSHOP_TAKEN = 12050,
+ BATTLEFIELD_WG_TEXT_ALLIANCE = 12057,
+ BATTLEFIELD_WG_TEXT_HORDE = 12056,
+ BATTLEFIELD_WG_TEXT_WILL_START = 12058,
+ BATTLEFIELD_WG_TEXT_START = 12067,
+ BATTLEFIELD_WG_TEXT_FIRSTRANK = 12059,
+ BATTLEFIELD_WG_TEXT_SECONDRANK = 12060,
+ BATTLEFIELD_WG_TEXT_KEEPTOWER_NAME_NE = 12062,
+ BATTLEFIELD_WG_TEXT_KEEPTOWER_NAME_NW = 12064,
+ BATTLEFIELD_WG_TEXT_KEEPTOWER_NAME_SE = 12061,
+ BATTLEFIELD_WG_TEXT_KEEPTOWER_NAME_SW = 12063,
+ BATTLEFIELD_WG_TEXT_TOWER_DAMAGE = 12065,
+ BATTLEFIELD_WG_TEXT_TOWER_DESTROY = 12066,
+ BATTLEFIELD_WG_TEXT_TOWER_NAME_S = 12069,
+ BATTLEFIELD_WG_TEXT_TOWER_NAME_E = 12070,
+ BATTLEFIELD_WG_TEXT_TOWER_NAME_W = 12071,
+ BATTLEFIELD_WG_TEXT_DEFEND_KEEP = 12068,
+ BATTLEFIELD_WG_TEXT_WIN_KEEP = 12072
+};
+
+enum WintergraspGameObject
+{
+ GO_WINTERGRASP_FACTORY_BANNER_NE = 190475,
+ GO_WINTERGRASP_FACTORY_BANNER_NW = 190487,
+ GO_WINTERGRASP_FACTORY_BANNER_SE = 194959,
+ GO_WINTERGRASP_FACTORY_BANNER_SW = 194962,
+
+ GO_WINTERGRASP_TITAN_S_RELIC = 192829,
+
+ GO_WINTERGRASP_FORTRESS_TOWER_1 = 190221,
+ GO_WINTERGRASP_FORTRESS_TOWER_2 = 190373,
+ GO_WINTERGRASP_FORTRESS_TOWER_3 = 190377,
+ GO_WINTERGRASP_FORTRESS_TOWER_4 = 190378,
+
+ GO_WINTERGRASP_SHADOWSIGHT_TOWER = 190356,
+ GO_WINTERGRASP_WINTER_S_EDGE_TOWER = 190357,
+ GO_WINTERGRASP_FLAMEWATCH_TOWER = 190358,
+
+ GO_WINTERGRASP_FORTRESS_GATE = 190375,
+ GO_WINTERGRASP_VAULT_GATE = 191810,
+
+ GO_WINTERGRASP_KEEP_COLLISION_WALL = 194323
+};
+
+struct WintergraspObjectPositionData
+{
+ float x;
+ float y;
+ float z;
+ float o;
+ uint32 entryHorde;
+ uint32 entryAlliance;
+};
+
+// *****************************************************
+// ************ Destructible (Wall,Tower..) ************
+// *****************************************************
+
+struct WintergraspBuildingSpawnData
+{
+ uint32 entry;
+ uint32 WorldState;
+ float x;
+ float y;
+ float z;
+ float o;
+ uint32 type;
+ uint32 nameId;
+};
+
+const WintergraspBuildingSpawnData WGGameObjectBuilding[WG_MAX_OBJ] =
+{
+ // Wall (Not spawned in db)
+ // Entry WS X Y Z O type NameID
+ { 190219, 3749, 5371.46f, 3047.47f, 407.571f, 3.14159f, BATTLEFIELD_WG_OBJECTTYPE_WALL, 0 },
+ { 190220, 3750, 5331.26f, 3047.1f, 407.923f, 0.052359f, BATTLEFIELD_WG_OBJECTTYPE_WALL, 0 },
+ { 191795, 3764, 5385.84f, 2909.49f, 409.713f, 0.00872f, BATTLEFIELD_WG_OBJECTTYPE_WALL, 0 },
+ { 191796, 3772, 5384.45f, 2771.84f, 410.27f, 3.14159f, BATTLEFIELD_WG_OBJECTTYPE_WALL, 0 },
+ { 191799, 3762, 5371.44f, 2630.61f, 408.816f, 3.13286f, BATTLEFIELD_WG_OBJECTTYPE_WALL, 0 },
+ { 191800, 3766, 5301.84f, 2909.09f, 409.866f, 0.008724f, BATTLEFIELD_WG_OBJECTTYPE_WALL, 0 },
+ { 191801, 3770, 5301.06f, 2771.41f, 409.901f, 3.14159f, BATTLEFIELD_WG_OBJECTTYPE_WALL, 0 },
+ { 191802, 3751, 5280.2f, 2995.58f, 408.825f, 1.61443f, BATTLEFIELD_WG_OBJECTTYPE_WALL, 0 },
+ { 191803, 3752, 5279.14f, 2956.02f, 408.604f, 1.5708f, BATTLEFIELD_WG_OBJECTTYPE_WALL, 0 },
+ { 191804, 3767, 5278.69f, 2882.51f, 409.539f, 1.5708f, BATTLEFIELD_WG_OBJECTTYPE_WALL, 0 },
+ { 191806, 3769, 5279.5f, 2798.94f, 409.998f, 1.5708f, BATTLEFIELD_WG_OBJECTTYPE_WALL, 0 },
+ { 191807, 3759, 5279.94f, 2724.77f, 409.945f, 1.56207f, BATTLEFIELD_WG_OBJECTTYPE_WALL, 0 },
+ { 191808, 3760, 5279.6f, 2683.79f, 409.849f, 1.55334f, BATTLEFIELD_WG_OBJECTTYPE_WALL, 0 },
+ { 191809, 3761, 5330.96f, 2630.78f, 409.283f, 3.13286f, BATTLEFIELD_WG_OBJECTTYPE_WALL, 0 },
+ { 190369, 3753, 5256.08f, 2933.96f, 409.357f, 3.13286f, BATTLEFIELD_WG_OBJECTTYPE_WALL, 0 },
+ { 190370, 3758, 5257.46f, 2747.33f, 409.743f, -3.13286f, BATTLEFIELD_WG_OBJECTTYPE_WALL, 0 },
+ { 190371, 3754, 5214.96f, 2934.09f, 409.19f, -0.008724f, BATTLEFIELD_WG_OBJECTTYPE_WALL, 0 },
+ { 190372, 3757, 5215.82f, 2747.57f, 409.188f, -3.13286f, BATTLEFIELD_WG_OBJECTTYPE_WALL, 0 },
+ { 190374, 3755, 5162.27f, 2883.04f, 410.256f, 1.57952f, BATTLEFIELD_WG_OBJECTTYPE_WALL, 0 },
+ { 190376, 3756, 5163.72f, 2799.84f, 409.227f, 1.57952f, BATTLEFIELD_WG_OBJECTTYPE_WALL, 0 },
+
+ // Tower of keep (Not spawned in db)
+ { 190221, 3711, 5281.15f, 3044.59f, 407.843f, 3.11539f, BATTLEFIELD_WG_OBJECTTYPE_KEEP_TOWER, BATTLEFIELD_WG_TEXT_KEEPTOWER_NAME_NW },
+ { 190373, 3713, 5163.76f, 2932.23f, 409.19f, 3.12412f, BATTLEFIELD_WG_OBJECTTYPE_KEEP_TOWER, BATTLEFIELD_WG_TEXT_KEEPTOWER_NAME_SW },
+ { 190377, 3714, 5166.4f, 2748.37f, 409.188f, -1.5708f, BATTLEFIELD_WG_OBJECTTYPE_KEEP_TOWER, BATTLEFIELD_WG_TEXT_KEEPTOWER_NAME_SE },
+ { 190378, 3712, 5281.19f, 2632.48f, 409.099f, -1.58825f, BATTLEFIELD_WG_OBJECTTYPE_KEEP_TOWER, BATTLEFIELD_WG_TEXT_KEEPTOWER_NAME_NE },
+
+ // Wall (with passage) (Not spawned in db)
+ { 191797, 3765, 5343.29f, 2908.86f, 409.576f, 0.008724f, BATTLEFIELD_WG_OBJECTTYPE_WALL, 0 },
+ { 191798, 3771, 5342.72f, 2771.39f, 409.625f, 3.14159f, BATTLEFIELD_WG_OBJECTTYPE_WALL, 0 },
+ { 191805, 3768, 5279.13f, 2840.8f, 409.783f, 1.57952f, BATTLEFIELD_WG_OBJECTTYPE_WALL, 0 },
+
+ // South tower (Not spawned in db)
+ { 190356, 3704, 4557.17f, 3623.94f, 395.883f, 1.67552f, BATTLEFIELD_WG_OBJECTTYPE_TOWER, BATTLEFIELD_WG_TEXT_TOWER_NAME_W },
+ { 190357, 3705, 4398.17f, 2822.5f, 405.627f, -3.12412f, BATTLEFIELD_WG_OBJECTTYPE_TOWER, BATTLEFIELD_WG_TEXT_TOWER_NAME_S },
+ { 190358, 3706, 4459.1f, 1944.33f, 434.991f, -2.00276f, BATTLEFIELD_WG_OBJECTTYPE_TOWER, BATTLEFIELD_WG_TEXT_TOWER_NAME_E },
+
+ // Door of forteress (Not spawned in db)
+ { GO_WINTERGRASP_FORTRESS_GATE, 3763, 5162.99f, 2841.23f, 410.162f, -3.13286f, BATTLEFIELD_WG_OBJECTTYPE_DOOR, 0 },
+
+ // Last door (Not spawned in db)
+ { GO_WINTERGRASP_VAULT_GATE, 3773, 5397.11f, 2841.54f, 425.899f, 3.14159f, BATTLEFIELD_WG_OBJECTTYPE_DOOR_LAST, 0 },
+};
+
+
+// *********************************************************
+// **********Keep Element(GameObject,Creature)**************
+// *********************************************************
+
+// Keep gameobject
+// 192488 : 10 in sql, 19 in header
+// 192501 : 12 in sql, 17 in header
+// 192416 : 1 in sql, 33 in header
+// 192374 : 1 in sql, 1 in header
+// 192375 : 1 in sql, 1 in header
+// 192336 : 1 in sql, 1 in header
+// 192255 : 1 in sql, 1 in header
+// 192269 : 1 in sql, 7 in header
+// 192254 : 1 in sql, 1 in header
+// 192349 : 1 in sql, 1 in header
+// 192366 : 1 in sql, 3 in header
+// 192367 : 1 in sql, 1 in header
+// 192364 : 1 in sql, 1 in header
+// 192370 : 1 in sql, 1 in header
+// 192369 : 1 in sql, 1 in header
+// 192368 : 1 in sql, 1 in header
+// 192362 : 1 in sql, 1 in header
+// 192363 : 1 in sql, 1 in header
+// 192379 : 1 in sql, 1 in header
+// 192378 : 1 in sql, 1 in header
+// 192355 : 1 in sql, 1 in header
+// 192354 : 1 in sql, 1 in header
+// 192358 : 1 in sql, 1 in header
+// 192359 : 1 in sql, 1 in header
+// 192338 : 1 in sql, 1 in header
+// 192339 : 1 in sql, 1 in header
+// 192284 : 1 in sql, 1 in header
+// 192285 : 1 in sql, 1 in header
+// 192371 : 1 in sql, 1 in header
+// 192372 : 1 in sql, 1 in header
+// 192373 : 1 in sql, 1 in header
+// 192360 : 1 in sql, 1 in header
+// 192361 : 1 in sql, 1 in header
+// 192356 : 1 in sql, 1 in header
+// 192352 : 1 in sql, 1 in header
+// 192353 : 1 in sql, 1 in header
+// 192357 : 1 in sql, 1 in header
+// 192350 : 1 in sql, 1 in header
+// 192351 : 1 in sql, 1 in header
+const WintergraspObjectPositionData WGKeepGameObject[WG_KEEPGAMEOBJECT_MAX] =
+{
+ { 5262.540039f, 3047.949951f, 432.054993f, 3.106650f, 192488, 192501 }, // Flag on tower
+ { 5272.939941f, 2976.550049f, 444.492004f, 3.124120f, 192374, 192416 }, // Flag on Wall Intersect
+ { 5235.189941f, 2941.899902f, 444.278015f, 1.588250f, 192375, 192416 }, // Flag on Wall Intersect
+ { 5163.129883f, 2952.590088f, 433.502991f, 1.535890f, 192488, 192501 }, // Flag on tower
+ { 5145.109863f, 2935.000000f, 433.385986f, 3.141590f, 192488, 192501 }, // Flag on tower
+ { 5158.810059f, 2883.129883f, 431.618011f, 3.141590f, 192488, 192416 }, // Flag on wall
+ { 5154.490234f, 2862.149902f, 445.011993f, 3.141590f, 192336, 192416 }, // Flag on Wall Intersect
+ { 5154.520020f, 2853.310059f, 409.183014f, 3.141590f, 192255, 192269 }, // Flag on the floor
+ { 5154.459961f, 2828.939941f, 409.188995f, 3.141590f, 192254, 192269 }, // Flag on the floor
+ { 5155.310059f, 2820.739990f, 444.979004f, -3.13286f, 192349, 192416 }, // Flag on wall intersect
+ { 5160.339844f, 2798.610107f, 430.769012f, 3.141590f, 192488, 192416 }, // Flag on wall
+ { 5146.040039f, 2747.209961f, 433.584015f, 3.071770f, 192488, 192501 }, // Flag on tower
+ { 5163.779785f, 2729.679932f, 433.394012f, -1.58825f, 192488, 192501 }, // Flag on tower
+ { 5236.270020f, 2739.459961f, 444.992004f, -1.59698f, 192366, 192416 }, // Flag on wall intersect
+ { 5271.799805f, 2704.870117f, 445.183014f, -3.13286f, 192367, 192416 }, // Flag on wall intersect
+ { 5260.819824f, 2631.800049f, 433.324005f, 3.054330f, 192488, 192501 }, // Flag on tower
+ { 5278.379883f, 2613.830078f, 433.408997f, -1.58825f, 192488, 192501 }, // Flag on tower
+ { 5350.879883f, 2622.719971f, 444.686005f, -1.57080f, 192364, 192416 }, // Flag on wall intersect
+ { 5392.270020f, 2639.739990f, 435.330994f, 1.509710f, 192370, 192416 }, // Flag on wall intersect
+ { 5350.950195f, 2640.360107f, 435.407990f, 1.570800f, 192369, 192416 }, // Flag on wall intersect
+ { 5289.459961f, 2704.679932f, 435.875000f, -0.01745f, 192368, 192416 }, // Flag on wall intersect
+ { 5322.120117f, 2763.610107f, 444.973999f, -1.55334f, 192362, 192416 }, // Flag on wall intersect
+ { 5363.609863f, 2763.389893f, 445.023987f, -1.54462f, 192363, 192416 }, // Flag on wall intersect
+ { 5363.419922f, 2781.030029f, 435.763000f, 1.570800f, 192379, 192416 }, // Flag on wall intersect
+ { 5322.020020f, 2781.129883f, 435.811005f, 1.570800f, 192378, 192416 }, // Flag on wall intersect
+ { 5288.919922f, 2820.219971f, 435.721008f, 0.017452f, 192355, 192416 }, // Flag on wall intersect
+ { 5288.410156f, 2861.790039f, 435.721008f, 0.017452f, 192354, 192416 }, // Flag on wall intersect
+ { 5322.229980f, 2899.429932f, 435.808014f, -1.58825f, 192358, 192416 }, // Flag on wall intersect
+ { 5364.350098f, 2899.399902f, 435.838989f, -1.57080f, 192359, 192416 }, // Flag on wall intersect
+ { 5397.759766f, 2873.080078f, 455.460999f, 3.106650f, 192338, 192416 }, // Flag on keep
+ { 5397.390137f, 2809.330078f, 455.343994f, 3.106650f, 192339, 192416 }, // Flag on keep
+ { 5372.479980f, 2862.500000f, 409.049011f, 3.141590f, 192284, 192269 }, // Flag on floor
+ { 5371.490234f, 2820.800049f, 409.177002f, 3.141590f, 192285, 192269 }, // Flag on floor
+ { 5364.290039f, 2916.939941f, 445.330994f, 1.579520f, 192371, 192416 }, // Flag on wall intersect
+ { 5322.859863f, 2916.949951f, 445.153992f, 1.562070f, 192372, 192416 }, // Flag on wall intersect
+ { 5290.350098f, 2976.560059f, 435.221008f, 0.017452f, 192373, 192416 }, // Flag on wall intersect
+ { 5352.370117f, 3037.090088f, 435.252014f, -1.57080f, 192360, 192416 }, // Flag on wall intersect
+ { 5392.649902f, 3037.110107f, 433.713013f, -1.52716f, 192361, 192416 }, // Flag on wall intersect
+ { 5237.069824f, 2757.030029f, 435.795990f, 1.518440f, 192356, 192416 }, // Flag on wall intersect
+ { 5173.020020f, 2820.929932f, 435.720001f, 0.017452f, 192352, 192416 }, // Flag on wall intersect
+ { 5172.109863f, 2862.570068f, 435.721008f, 0.017452f, 192353, 192416 }, // Flag on wall intersect
+ { 5235.339844f, 2924.340088f, 435.040009f, -1.57080f, 192357, 192416 }, // Flag on wall intersect
+ { 5270.689941f, 2861.780029f, 445.058014f, -3.11539f, 192350, 192416 }, // Flag on wall intersect
+ { 5271.279785f, 2820.159912f, 445.200989f, -3.13286f, 192351, 192416 } // Flag on wall intersect
+};
+
+const Position WGTurret[WG_MAX_TURRET] =
+{
+ { 5391.19f, 3060.8f, 419.616f, 1.69557f },
+ { 5266.75f, 2976.5f, 421.067f, 3.20354f },
+ { 5234.86f, 2948.8f, 420.88f, 1.61311f },
+ { 5323.05f, 2923.7f, 421.645f, 1.5817f },
+ { 5363.82f, 2923.87f, 421.709f, 1.60527f },
+ { 5264.04f, 2861.34f, 421.587f, 3.21142f },
+ { 5264.68f, 2819.78f, 421.656f, 3.15645f },
+ { 5322.16f, 2756.69f, 421.646f, 4.69978f },
+ { 5363.78f, 2756.77f, 421.629f, 4.78226f },
+ { 5236.2f, 2732.68f, 421.649f, 4.72336f },
+ { 5265.02f, 2704.63f, 421.7f, 3.12507f },
+ { 5350.87f, 2616.03f, 421.243f, 4.72729f },
+ { 5390.95f, 2615.5f, 421.126f, 4.6409f },
+ { 5148.8f, 2820.24f, 421.621f, 3.16043f },
+ { 5147.98f, 2861.93f, 421.63f, 3.18792f },
+};
+
+// Here there is all npc keeper spawn point
+const WintergraspObjectPositionData WGKeepNPC[WG_MAX_KEEP_NPC] =
+{
+ // X Y Z O horde alliance
+ // North East
+ { 5326.203125f, 2660.026367f, 409.100891f, 2.543383f, BATTLEFIELD_WG_NPC_GUARD_H, BATTLEFIELD_WG_NPC_GUARD_A }, // Roaming Guard
+ { 5298.430176f, 2738.760010f, 409.316010f, 3.971740f, BATTLEFIELD_WG_NPC_VIERON_BLAZEFEATHER, BATTLEFIELD_WG_NPC_BOWYER_RANDOLPH }, // Vieron Blazefeather
+ { 5335.310059f, 2764.110107f, 409.274994f, 4.834560f, BATTLEFIELD_WG_NPC_GUARD_H, BATTLEFIELD_WG_NPC_GUARD_A }, // Standing Guard
+ { 5349.810059f, 2763.629883f, 409.333008f, 4.660030f, BATTLEFIELD_WG_NPC_GUARD_H, BATTLEFIELD_WG_NPC_GUARD_A }, // Standing Guard
+ // North
+ { 5373.470215f, 2789.060059f, 409.322998f, 2.600540f, BATTLEFIELD_WG_NPC_STONE_GUARD_MUKAR, BATTLEFIELD_WG_NPC_KNIGHT_DAMERON }, // Stone Guard Mukar
+ { 5296.560059f, 2789.870117f, 409.274994f, 0.733038f, BATTLEFIELD_WG_NPC_HOODOO_MASTER_FU_JIN, BATTLEFIELD_WG_NPC_SORCERESS_KAYLANA }, // Voodoo Master Fu'jin
+ { 5372.670000f, 2786.740000f, 409.442000f, 2.809980f, BATTLEFIELD_WG_NPC_CHAMPION_ROS_SLAI, BATTLEFIELD_WG_NPC_MARSHAL_MAGRUDER }, // Wintergrasp Quartermaster
+ { 5368.709961f, 2856.360107f, 409.322998f, 2.949610f, BATTLEFIELD_WG_NPC_GUARD_H, BATTLEFIELD_WG_NPC_GUARD_A }, // Standing Guard
+ { 5367.910156f, 2826.520020f, 409.322998f, 3.333580f, BATTLEFIELD_WG_NPC_GUARD_H, BATTLEFIELD_WG_NPC_GUARD_A }, // Standing Guard
+ { 5389.270020f, 2847.370117f, 418.759003f, 3.106690f, BATTLEFIELD_WG_NPC_GUARD_H, BATTLEFIELD_WG_NPC_GUARD_A }, // Standing Guard
+ { 5388.560059f, 2834.770020f, 418.759003f, 3.071780f, BATTLEFIELD_WG_NPC_GUARD_H, BATTLEFIELD_WG_NPC_GUARD_A }, // Standing Guard
+ { 5359.129883f, 2837.989990f, 409.364014f, 4.698930f, BATTLEFIELD_WG_NPC_COMMANDER_DARDOSH, BATTLEFIELD_WG_NPC_COMMANDER_ZANNETH }, // Commander Dardosh
+ { 5366.129883f, 2833.399902f, 409.322998f, 3.141590f, BATTLEFIELD_WG_NPC_TACTICAL_OFFICER_KILRATH, BATTLEFIELD_WG_NPC_TACTICAL_OFFICER_AHBRAMIS }, // Tactical Officer Kilrath
+ // X Y Z O horde alliance
+ // North West
+ { 5350.680176f, 2917.010010f, 409.274994f, 1.466080f, BATTLEFIELD_WG_NPC_GUARD_H, BATTLEFIELD_WG_NPC_GUARD_A }, // Standing Guard
+ { 5335.120117f, 2916.800049f, 409.444000f, 1.500980f, BATTLEFIELD_WG_NPC_GUARD_H, BATTLEFIELD_WG_NPC_GUARD_A }, // Standing Guard
+ { 5295.560059f, 2926.669922f, 409.274994f, 0.872665f, BATTLEFIELD_WG_NPC_SIEGESMITH_STRONGHOOF, BATTLEFIELD_WG_NPC_SIEGE_MASTER_STOUTHANDLE }, // Stronghoof
+ { 5371.399902f, 3026.510010f, 409.205994f, 3.250030f, BATTLEFIELD_WG_NPC_PRIMALIST_MULFORT, BATTLEFIELD_WG_NPC_ANCHORITE_TESSA }, // Primalist Mulfort
+ { 5392.123535f, 3031.110352f, 409.187683f, 3.677212f, BATTLEFIELD_WG_NPC_GUARD_H, BATTLEFIELD_WG_NPC_GUARD_A }, // Roaming Guard
+ // South
+ { 5270.060059f, 2847.550049f, 409.274994f, 3.071780f, BATTLEFIELD_WG_NPC_GUARD_H, BATTLEFIELD_WG_NPC_GUARD_A }, // Standing Guard
+ { 5270.160156f, 2833.479980f, 409.274994f, 3.124140f, BATTLEFIELD_WG_NPC_GUARD_H, BATTLEFIELD_WG_NPC_GUARD_A }, // Standing Guard
+ { 5179.109863f, 2837.129883f, 409.274994f, 3.211410f, BATTLEFIELD_WG_NPC_GUARD_H, BATTLEFIELD_WG_NPC_GUARD_A }, // Standing Guard
+ { 5179.669922f, 2846.600098f, 409.274994f, 3.089230f, BATTLEFIELD_WG_NPC_GUARD_H, BATTLEFIELD_WG_NPC_GUARD_A }, // Standing Guard
+ { 5234.970215f, 2883.399902f, 409.274994f, 4.293510f, BATTLEFIELD_WG_NPC_LIEUTENANT_MURP, BATTLEFIELD_WG_NPC_SENIOR_DEMOLITIONIST_LEGOSO }, // Lieutenant Murp
+ // X Y Z O horde alliance
+ // Portal guards (from around the fortress)
+ { 5319.209473f, 3055.947754f, 409.176636f, 1.020201f, BATTLEFIELD_WG_NPC_GUARD_H, BATTLEFIELD_WG_NPC_GUARD_A }, // Standing Guard
+ { 5311.612305f, 3061.207275f, 408.734161f, 0.965223f, BATTLEFIELD_WG_NPC_GUARD_H, BATTLEFIELD_WG_NPC_GUARD_A }, // Standing Guard
+ { 5264.713379f, 3017.283447f, 408.479706f, 3.482424f, BATTLEFIELD_WG_NPC_GUARD_H, BATTLEFIELD_WG_NPC_GUARD_A }, // Standing Guard
+ { 5269.096191f, 3008.315918f, 408.826294f, 3.843706f, BATTLEFIELD_WG_NPC_GUARD_H, BATTLEFIELD_WG_NPC_GUARD_A }, // Standing Guard
+ { 5201.414551f, 2945.096924f, 409.190735f, 0.945592f, BATTLEFIELD_WG_NPC_GUARD_H, BATTLEFIELD_WG_NPC_GUARD_A }, // Standing Guard
+ { 5193.386230f, 2949.617188f, 409.190735f, 1.145859f, BATTLEFIELD_WG_NPC_GUARD_H, BATTLEFIELD_WG_NPC_GUARD_A }, // Standing Guard
+ { 5148.116211f, 2904.761963f, 409.193756f, 3.368532f, BATTLEFIELD_WG_NPC_GUARD_H, BATTLEFIELD_WG_NPC_GUARD_A }, // Standing Guard
+ { 5153.355957f, 2895.501465f, 409.199310f, 3.549174f, BATTLEFIELD_WG_NPC_GUARD_H, BATTLEFIELD_WG_NPC_GUARD_A }, // Standing Guard
+ { 5154.353027f, 2787.349365f, 409.250183f, 2.555644f, BATTLEFIELD_WG_NPC_GUARD_H, BATTLEFIELD_WG_NPC_GUARD_A }, // Standing Guard
+ { 5150.066406f, 2777.876953f, 409.343903f, 2.708797f, BATTLEFIELD_WG_NPC_GUARD_H, BATTLEFIELD_WG_NPC_GUARD_A }, // Standing Guard
+ { 5193.706543f, 2732.882812f, 409.189514f, 4.845073f, BATTLEFIELD_WG_NPC_GUARD_H, BATTLEFIELD_WG_NPC_GUARD_A }, // Standing Guard
+ { 5202.126953f, 2737.570557f, 409.189514f, 5.375215f, BATTLEFIELD_WG_NPC_GUARD_H, BATTLEFIELD_WG_NPC_GUARD_A }, // Standing Guard
+ { 5269.181152f, 2671.174072f, 409.098999f, 2.457459f, BATTLEFIELD_WG_NPC_GUARD_H, BATTLEFIELD_WG_NPC_GUARD_A }, // Standing Guard
+ { 5264.960938f, 2662.332520f, 409.098999f, 2.598828f, BATTLEFIELD_WG_NPC_GUARD_H, BATTLEFIELD_WG_NPC_GUARD_A }, // Standing Guard
+ { 5307.111816f, 2616.006836f, 409.095734f, 5.355575f, BATTLEFIELD_WG_NPC_GUARD_H, BATTLEFIELD_WG_NPC_GUARD_A }, // Standing Guard
+ { 5316.770996f, 2619.430176f, 409.027740f, 5.363431f, BATTLEFIELD_WG_NPC_GUARD_H, BATTLEFIELD_WG_NPC_GUARD_A } // Standing Guard
+};
+
+const WintergraspObjectPositionData WGOutsideNPC[WG_MAX_OUTSIDE_NPC] =
+{
+ { 5032.04f, 3681.79f, 362.980f, 4.210f, BATTLEFIELD_WG_NPC_VIERON_BLAZEFEATHER, 0 },
+ { 5020.71f, 3626.19f, 360.150f, 4.640f, BATTLEFIELD_WG_NPC_HOODOO_MASTER_FU_JIN, 0 },
+ { 4994.85f, 3660.51f, 359.150f, 2.260f, BATTLEFIELD_WG_NPC_COMMANDER_DARDOSH, 0 },
+ { 5015.46f, 3677.11f, 362.970f, 6.009f, BATTLEFIELD_WG_NPC_TACTICAL_OFFICER_KILRATH, 0 },
+ { 5031.12f, 3663.77f, 363.500f, 3.110f, BATTLEFIELD_WG_NPC_SIEGESMITH_STRONGHOOF, 0 },
+ { 5042.74f, 3675.82f, 363.060f, 3.358f, BATTLEFIELD_WG_NPC_PRIMALIST_MULFORT, 0 },
+ { 5014.45f, 3640.87f, 361.390f, 3.280f, BATTLEFIELD_WG_NPC_LIEUTENANT_MURP, 0 },
+ { 5100.07f, 2168.89f, 365.779f, 1.972f, 0, BATTLEFIELD_WG_NPC_BOWYER_RANDOLPH },
+ { 5081.70f, 2173.73f, 365.878f, 0.855f, 0, BATTLEFIELD_WG_NPC_SORCERESS_KAYLANA },
+ { 5078.28f, 2183.70f, 365.029f, 1.466f, 0, BATTLEFIELD_WG_NPC_COMMANDER_ZANNETH },
+ { 5088.49f, 2188.18f, 365.647f, 5.253f, 0, BATTLEFIELD_WG_NPC_TACTICAL_OFFICER_AHBRAMIS },
+ { 5095.67f, 2193.28f, 365.924f, 4.939f, 0, BATTLEFIELD_WG_NPC_SIEGE_MASTER_STOUTHANDLE },
+ { 5088.61f, 2167.66f, 365.689f, 0.680f, 0, BATTLEFIELD_WG_NPC_ANCHORITE_TESSA },
+ { 5080.40f, 2199.00f, 359.489f, 2.967f, 0, BATTLEFIELD_WG_NPC_SENIOR_DEMOLITIONIST_LEGOSO },
+};
+
+struct WintergraspTeleporterData
+{
+ uint32 entry;
+ float x;
+ float y;
+ float z;
+ float o;
+};
+
+const WintergraspTeleporterData WGPortalDefenderData[WG_MAX_TELEPORTER] =
+{
+ // Player teleporter
+ { 190763, 5153.41f, 2901.35f, 409.191f, -0.069f },
+ { 190763, 5268.70f, 2666.42f, 409.099f, -0.715f },
+ { 190763, 5197.05f, 2944.81f, 409.191f, 2.3387f },
+ { 190763, 5196.67f, 2737.34f, 409.189f, -2.932f },
+ { 190763, 5314.58f, 3055.85f, 408.862f, 0.5410f },
+ { 190763, 5391.28f, 2828.09f, 418.675f, -2.164f },
+ { 190763, 5153.93f, 2781.67f, 409.246f, 1.6580f },
+ { 190763, 5311.44f, 2618.93f, 409.092f, -2.373f },
+ { 190763, 5269.21f, 3013.84f, 408.828f, -1.762f },
+ { 190763, 5401.62f, 2853.66f, 418.674f, 2.6354f },
+ // Vehicle teleporter
+ { 192951, 5314.51f, 2703.69f, 408.550f, -0.890f },
+ { 192951, 5316.25f, 2977.04f, 408.539f, -0.820f },
+};
+
+// *********************************************************
+// **********Tower Element(GameObject,Creature)*************
+// *********************************************************
+
+struct WintergraspTowerData
+{
+ uint32 towerEntry; // Gameobject id of tower
+ uint8 nbObject; // Number of gameobjects spawned on this point
+ WintergraspObjectPositionData GameObject[6]; // Gameobject position and entry (Horde/Alliance)
+
+ // Creature : Turrets and Guard, TODO: check if killed on tower destruction? tower damage?
+ uint8 nbCreatureBottom;
+ WintergraspObjectPositionData CreatureBottom[9];
+ uint8 nbCreatureTop;
+ WintergraspObjectPositionData CreatureTop[5];
+};
+
+uint8 const WG_MAX_ATTACKTOWERS = 3;
+// 192414 : 0 in sql, 1 in header
+// 192278 : 0 in sql, 3 in header
+const WintergraspTowerData AttackTowers[WG_MAX_ATTACKTOWERS] =
+{
+ // West tower
+ {
+ 190356,
+ 6,
+ {
+ { 4559.109863f, 3606.219971f, 419.998993f, -1.483530f, 192488, 192501 }, // Flag on tower
+ { 4539.419922f, 3622.489990f, 420.033997f, -3.071770f, 192488, 192501 }, // Flag on tower
+ { 4555.259766f, 3641.649902f, 419.973999f, 1.675510f, 192488, 192501 }, // Flag on tower
+ { 4574.870117f, 3625.909912f, 420.079010f, 0.080117f, 192488, 192501 }, // Flag on tower
+ { 4433.899902f, 3534.139893f, 360.274994f, -1.850050f, 192269, 192278 }, // Flag near workshop
+ { 4572.930176f, 3475.520020f, 363.009003f, 1.42240f, 192269, 192278 } // Flag near bridge
+ },
+ 1,
+ {
+ { 4418.688477f, 3506.251709f, 358.975494f, 4.293305f, BATTLEFIELD_WG_NPC_GUARD_H, BATTLEFIELD_WG_NPC_GUARD_A }, // Roaming Guard
+ { 0, 0, 0, 0, 0, 0 },
+ { 0, 0, 0, 0, 0, 0 },
+ { 0, 0, 0, 0, 0, 0 },
+ { 0, 0, 0, 0, 0, 0 },
+ { 0, 0, 0, 0, 0, 0 },
+ { 0, 0, 0, 0, 0, 0 },
+ { 0, 0, 0, 0, 0, 0 },
+ { 0, 0, 0, 0, 0, 0 },
+ },
+ 0,
+ {
+ { 0, 0, 0, 0, 0, 0 },
+ { 0, 0, 0, 0, 0, 0 },
+ { 0, 0, 0, 0, 0, 0 },
+ { 0, 0, 0, 0, 0, 0 },
+ { 0, 0, 0, 0, 0, 0 },
+ }
+ },
+
+ // South Tower
+ {
+ 190357,
+ 5,
+ {
+ { 4416.000000f, 2822.669922f, 429.851013f, -0.017452f, 192488, 192501 }, // Flag on tower
+ { 4398.819824f, 2804.699951f, 429.791992f, -1.588250f, 192488, 192501 }, // Flag on tower
+ { 4387.620117f, 2719.570068f, 389.934998f, -1.544620f, 192366, 192414 }, // Flag near tower
+ { 4464.120117f, 2855.449951f, 406.110992f, 0.829032f, 192366, 192429 }, // Flag near tower
+ { 4526.459961f, 2810.179932f, 391.200012f, -2.993220f, 192269, 192278 }, // Flag near bridge
+ { 0, 0, 0, 0, 0, 0 },
+ },
+ 6,
+ {
+ { 4452.859863f, 2808.870117f, 402.604004f, 6.056290f, BATTLEFIELD_WG_NPC_GUARD_H, BATTLEFIELD_WG_NPC_GUARD_A }, // Standing Guard
+ { 4455.899902f, 2835.958008f, 401.122559f, 0.034907f, BATTLEFIELD_WG_NPC_GUARD_H, BATTLEFIELD_WG_NPC_GUARD_A }, // Standing Guard
+ { 4412.649414f, 2953.792236f, 374.799957f, 0.980838f, BATTLEFIELD_WG_NPC_GUARD_H, BATTLEFIELD_WG_NPC_GUARD_A }, // Roaming Guard
+ { 4362.089844f, 2811.510010f, 407.337006f, 3.193950f, BATTLEFIELD_WG_NPC_GUARD_H, BATTLEFIELD_WG_NPC_GUARD_A }, // Standing Guard
+ { 4412.290039f, 2753.790039f, 401.015015f, 5.829400f, BATTLEFIELD_WG_NPC_GUARD_H, BATTLEFIELD_WG_NPC_GUARD_A }, // Standing Guard
+ { 4421.939941f, 2773.189941f, 400.894989f, 5.707230f, BATTLEFIELD_WG_NPC_GUARD_H, BATTLEFIELD_WG_NPC_GUARD_A }, // Standing Guard
+ { 0, 0, 0, 0, 0, 0},
+ { 0, 0, 0, 0, 0, 0},
+ { 0, 0, 0, 0, 0, 0},
+ },
+ 0,
+ {
+ { 0, 0, 0, 0, 0, 0 },
+ { 0, 0, 0, 0, 0, 0 },
+ { 0, 0, 0, 0, 0, 0 },
+ { 0, 0, 0, 0, 0, 0 },
+ { 0, 0, 0, 0, 0, 0 },
+ },
+ },
+
+ // East Tower
+ {
+ 190358,
+ 4,
+ {
+ { 4466.790039f, 1960.420044f, 459.144012f, 1.151920f, 192488, 192501 }, // Flag on tower
+ { 4475.350098f, 1937.030029f, 459.070007f, -0.43633f, 192488, 192501 }, // Flag on tower
+ { 4451.759766f, 1928.099976f, 459.075989f, -2.00713f, 192488, 192501 }, // Flag on tower
+ { 4442.990234f, 1951.900024f, 459.092987f, 2.740160f, 192488, 192501 }, // Flag on tower
+ { 0, 0, 0, 0, 0, 0 },
+ { 0, 0, 0, 0, 0, 0 },
+ },
+ 5,
+ {
+ { 4501.060059f, 1990.280029f, 431.157013f, 1.029740f, BATTLEFIELD_WG_NPC_GUARD_H, BATTLEFIELD_WG_NPC_GUARD_A }, // Standing Guard
+ { 4463.830078f, 2015.180054f, 430.299988f, 1.431170f, BATTLEFIELD_WG_NPC_GUARD_H, BATTLEFIELD_WG_NPC_GUARD_A }, // Standing Guard
+ { 4494.580078f, 1943.760010f, 435.627014f, 6.195920f, BATTLEFIELD_WG_NPC_GUARD_H, BATTLEFIELD_WG_NPC_GUARD_A }, // Standing Guard
+ { 4450.149902f, 1897.579956f, 435.045013f, 4.398230f, BATTLEFIELD_WG_NPC_GUARD_H, BATTLEFIELD_WG_NPC_GUARD_A }, // Standing Guard
+ { 4428.870117f, 1906.869995f, 432.648010f, 3.996800f, BATTLEFIELD_WG_NPC_GUARD_H, BATTLEFIELD_WG_NPC_GUARD_A }, // Standing Guard
+ { 0, 0, 0, 0, 0, 0 },
+ { 0, 0, 0, 0, 0, 0 },
+ { 0, 0, 0, 0, 0, 0 },
+ { 0, 0, 0, 0, 0, 0 },
+ },
+ 0,
+ {
+ { 0, 0, 0, 0, 0, 0 },
+ { 0, 0, 0, 0, 0, 0 },
+ { 0, 0, 0, 0, 0, 0 },
+ { 0, 0, 0, 0, 0, 0 },
+ { 0, 0, 0, 0, 0, 0 },
+ },
+ },
+};
+
+struct WintergraspTowerCannonData
+{
+ uint32 towerEntry;
+ uint8 nbTowerCannonBottom;
+ Position TowerCannonBottom[5];
+ uint8 nbTurretTop;
+ Position TurretTop[5];
+};
+
+const uint8 WG_MAX_TOWER_CANNON = 7;
+
+const WintergraspTowerCannonData TowerCannon[WG_MAX_TOWER_CANNON] =
+{
+ {
+ 190221,
+ 0,
+ {
+ { 0, 0, 0, 0 },
+ { 0, 0, 0, 0 },
+ { 0, 0, 0, 0 },
+ { 0, 0, 0, 0 },
+ { 0, 0, 0, 0 },
+ },
+ 2,
+ {
+ { 5255.88f, 3047.63f, 438.499f, 3.13677f },
+ { 5280.9f, 3071.32f, 438.499f, 1.62879f },
+ { 0, 0, 0, 0 },
+ { 0, 0, 0, 0 },
+ { 0, 0, 0, 0 },
+ },
+ },
+ {
+ 190373,
+ 0,
+ {
+ { 0, 0, 0, 0 },
+ { 0, 0, 0, 0 },
+ { 0, 0, 0, 0 },
+ { 0, 0, 0, 0 },
+ { 0, 0, 0, 0 },
+ },
+ 2,
+ {
+ { 5138.59f, 2935.16f, 439.845f, 3.11723f },
+ { 5163.06f, 2959.52f, 439.846f, 1.47258f },
+ { 0, 0, 0, 0 },
+ { 0, 0, 0, 0 },
+ { 0, 0, 0, 0 },
+ },
+ },
+ {
+ 190377,
+ 0,
+ {
+ { 0, 0, 0, 0 },
+ { 0, 0, 0, 0 },
+ { 0, 0, 0, 0 },
+ { 0, 0, 0, 0 },
+ { 0, 0, 0, 0 },
+ },
+ 2,
+ {
+ { 5163.84f, 2723.74f, 439.844f, 1.3994f },
+ { 5139.69f, 2747.4f, 439.844f, 3.17221f },
+ { 0, 0, 0, 0 },
+ { 0, 0, 0, 0 },
+ { 0, 0, 0, 0 },
+ },
+ },
+ {
+ 190378,
+ 0,
+ {
+ { 0, 0, 0, 0 },
+ { 0, 0, 0, 0 },
+ { 0, 0, 0, 0 },
+ { 0, 0, 0, 0 },
+ { 0, 0, 0, 0 },
+ },
+ 2,
+ {
+ { 5278.21f, 2607.23f, 439.755f, 4.71944f },
+ { 5255.01f, 2631.98f, 439.755f, 3.15257f },
+ { 0, 0, 0, 0 },
+ { 0, 0, 0, 0 },
+ { 0, 0, 0, 0 },
+ },
+ },
+ {
+ 190356,
+ 2,
+ {
+ {4537.380371f, 3599.531738f, 402.886993f, 3.998462f},
+ {4581.497559f, 3604.087158f, 402.886963f, 5.651723f},
+ {0, 0, 0, 0},
+ {0, 0, 0, 0},
+ {0, 0, 0, 0},
+ },
+ 2,
+ {
+ {4469.448242f, 1966.623779f, 465.647217f, 1.153573f},
+ {4581.895996f, 3626.438477f, 426.539062f, 0.117806f},
+ {0, 0, 0, 0},
+ {0, 0, 0, 0},
+ {0, 0, 0, 0},
+ },
+ },
+ {
+ 190357,
+ 2,
+ {
+ { 4421.640137f, 2799.935791f, 412.630920f, 5.459298f },
+ { 4420.263184f, 2845.340332f, 412.630951f, 0.742197f },
+ { 0, 0, 0, 0 },
+ { 0, 0, 0, 0 },
+ { 0, 0, 0, 0 },
+ },
+ 3,
+ {
+ { 4423.430664f, 2822.762939f, 436.283142f, 6.223487f },
+ { 4397.825684f, 2847.629639f, 436.283325f, 1.579430f },
+ { 4398.814941f, 2797.266357f, 436.283051f, 4.703747f },
+ { 0, 0, 0, 0 },
+ { 0, 0, 0, 0 },
+ },
+ },
+ {
+ 190358,
+ 2,
+ {
+ { 4448.138184f, 1974.998779f, 441.995911f, 1.967238f },
+ { 4448.713379f, 1955.148682f, 441.995178f, 0.380733f },
+ { 0, 0, 0, 0 },
+ { 0, 0, 0, 0 },
+ { 0, 0, 0, 0 },
+ },
+ 2,
+ {
+ { 4469.448242f, 1966.623779f, 465.647217f, 1.153573f },
+ { 4481.996582f, 1933.658325f, 465.647186f, 5.873029f },
+ { 0, 0, 0, 0 },
+ { 0, 0, 0, 0 },
+ { 0, 0, 0, 0 },
+ },
+ },
+};
+
+// *********************************************************
+// *****************WorkShop Data & Element*****************
+// *********************************************************
+
+uint8 const WG_MAX_WORKSHOP = 6;
+
+struct WGWorkshopData
+{
+ uint8 id;
+ uint32 worldstate;
+ uint32 text;
+};
+
+const WGWorkshopData WorkshopsData[WG_MAX_WORKSHOP] =
+{
+ // NE
+ {BATTLEFIELD_WG_WORKSHOP_NE, WORLDSTATE_WORKSHOP_NE, BATTLEFIELD_WG_TEXT_WORKSHOP_NAME_NE},
+ // NW
+ {BATTLEFIELD_WG_WORKSHOP_NW, WORLDSTATE_WORKSHOP_NW, BATTLEFIELD_WG_TEXT_WORKSHOP_NAME_NW},
+ // SE
+ {BATTLEFIELD_WG_WORKSHOP_SE, WORLDSTATE_WORKSHOP_SE, BATTLEFIELD_WG_TEXT_WORKSHOP_NAME_SE},
+ // SW
+ {BATTLEFIELD_WG_WORKSHOP_SW, WORLDSTATE_WORKSHOP_SW, BATTLEFIELD_WG_TEXT_WORKSHOP_NAME_SW},
+ // KEEP WEST - It can't be taken, so it doesn't have a textid
+ {BATTLEFIELD_WG_WORKSHOP_KEEP_WEST, WORLDSTATE_WORKSHOP_K_W, 0},
+ // KEEP EAST - It can't be taken, so it doesn't have a textid
+ {BATTLEFIELD_WG_WORKSHOP_KEEP_EAST, WORLDSTATE_WORKSHOP_K_E, 0}
+};
+
+// ********************************************************************
+// * Structs using for Building,Graveyard,Workshop *
+// ********************************************************************
+// Structure for different buildings that can be destroyed during battle
+struct BfWGGameObjectBuilding
+{
+ BfWGGameObjectBuilding(BattlefieldWG* WG)
+ {
+ m_WG = WG;
+ m_Team = 0;
+ m_Build = NULL;
+ m_Type = 0;
+ m_WorldState = 0;
+ m_State = 0;
+ m_NameId = 0;
+ }
+
+ // the team that controls this point
+ uint8 m_Team;
+
+ // WG object
+ BattlefieldWG* m_WG;
+
+ // Linked gameobject
+ GameObject* m_Build;
+
+ // eWGGameObjectBuildingType
+ uint32 m_Type;
+
+ // WorldState
+ uint32 m_WorldState;
+
+ // eWGGameObjectState
+ uint32 m_State;
+
+ // Name id for warning text
+ uint32 m_NameId;
+
+ // GameObject associations
+ GameObjectSet m_GameObjectList[2];
+
+ // Creature associations
+ GuidSet m_CreatureBottomList[2];
+ GuidSet m_CreatureTopList[2];
+ GuidSet m_TowerCannonBottomList;
+ GuidSet m_TurretTopList;
+
+ void Rebuild()
+ {
+ switch (m_Type)
+ {
+ case BATTLEFIELD_WG_OBJECTTYPE_KEEP_TOWER:
+ case BATTLEFIELD_WG_OBJECTTYPE_DOOR_LAST:
+ case BATTLEFIELD_WG_OBJECTTYPE_DOOR:
+ case BATTLEFIELD_WG_OBJECTTYPE_WALL:
+ m_Team = m_WG->GetDefenderTeam(); // Objects that are part of the keep should be the defender's
+ break;
+ case BATTLEFIELD_WG_OBJECTTYPE_TOWER:
+ m_Team = m_WG->GetAttackerTeam(); // The towers in the south should be the attacker's
+ break;
+ default:
+ m_Team = TEAM_NEUTRAL;
+ break;
+ }
+
+ // Rebuild gameobject
+ if (m_Build->IsDestructibleBuilding())
+ {
+ m_Build->SetDestructibleState(GO_DESTRUCTIBLE_REBUILDING, NULL, true);
+ if (m_Build->GetEntry() == GO_WINTERGRASP_VAULT_GATE)
+ if (GameObject* go = m_Build->FindNearestGameObject(GO_WINTERGRASP_KEEP_COLLISION_WALL, 10.0f))
+ go->EnableCollision(true);
+
+ // Update worldstate
+ m_State = BATTLEFIELD_WG_OBJECTSTATE_ALLIANCE_INTACT - (m_Team * 3);
+ m_WG->SendUpdateWorldState(m_WorldState, m_State);
+ }
+ UpdateCreatureAndGo();
+ m_Build->SetUInt32Value(GAMEOBJECT_FACTION, WintergraspFaction[m_Team]);
+ }
+
+ // Called when associated gameobject is damaged
+ void Damaged()
+ {
+ // Update worldstate
+ m_State = BATTLEFIELD_WG_OBJECTSTATE_ALLIANCE_DAMAGE - (m_Team * 3);
+ m_WG->SendUpdateWorldState(m_WorldState, m_State);
+
+ // Send warning message
+ if (m_NameId) // tower damage + name
+ m_WG->SendWarningToAllInZone(m_NameId);
+
+ for (GuidSet::const_iterator itr = m_CreatureTopList[m_WG->GetAttackerTeam()].begin(); itr != m_CreatureTopList[m_WG->GetAttackerTeam()].end(); ++itr)
+ if (Unit* unit = sObjectAccessor->FindUnit(*itr))
+ if (Creature* creature = unit->ToCreature())
+ m_WG->HideNpc(creature);
+
+ for (GuidSet::const_iterator itr = m_TurretTopList.begin(); itr != m_TurretTopList.end(); ++itr)
+ if (Unit* unit = sObjectAccessor->FindUnit(*itr))
+ if (Creature* creature = unit->ToCreature())
+ m_WG->HideNpc(creature);
+
+ if (m_Type == BATTLEFIELD_WG_OBJECTTYPE_KEEP_TOWER)
+ m_WG->UpdateDamagedTowerCount(m_WG->GetDefenderTeam());
+ else if (m_Type == BATTLEFIELD_WG_OBJECTTYPE_TOWER)
+ m_WG->UpdateDamagedTowerCount(m_WG->GetAttackerTeam());
+ }
+
+ // Called when associated gameobject is destroyed
+ void Destroyed()
+ {
+ // Update worldstate
+ m_State = BATTLEFIELD_WG_OBJECTSTATE_ALLIANCE_DESTROY - (m_Team * 3);
+ m_WG->SendUpdateWorldState(m_WorldState, m_State);
+
+ // Warn players
+ if (m_NameId)
+ m_WG->SendWarningToAllInZone(m_NameId);
+
+ switch (m_Type)
+ {
+ // Inform the global wintergrasp script of the destruction of this object
+ case BATTLEFIELD_WG_OBJECTTYPE_TOWER:
+ case BATTLEFIELD_WG_OBJECTTYPE_KEEP_TOWER:
+ m_WG->UpdatedDestroyedTowerCount(TeamId(m_Team));
+ break;
+ case BATTLEFIELD_WG_OBJECTTYPE_DOOR_LAST:
+ if (GameObject* go = m_Build->FindNearestGameObject(GO_WINTERGRASP_KEEP_COLLISION_WALL, 10.0f))
+ go->EnableCollision(false);
+ m_WG->SetRelicInteractible(true);
+ if (m_WG->GetRelic())
+ m_WG->GetRelic()->RemoveFlag(GAMEOBJECT_FLAGS, GO_FLAG_IN_USE);
+ else
+ sLog->outError(LOG_FILTER_GENERAL, "BattlefieldWG: Relic not found.");
+ break;
+ }
+
+ m_WG->BrokenWallOrTower(TeamId(m_Team));
+ }
+
+ void Init(GameObject* go, uint32 type, uint32 worldstate, uint32 nameid)
+ {
+ // GameObject associated to object
+ m_Build = go;
+
+ // Type of building (WALL/TOWER/DOOR)
+ m_Type = type;
+
+ // WorldState for client (icon on map)
+ m_WorldState = worldstate;
+
+ // NameId for Warning text
+ m_NameId = nameid;
+
+ switch (m_Type)
+ {
+ case BATTLEFIELD_WG_OBJECTTYPE_KEEP_TOWER:
+ case BATTLEFIELD_WG_OBJECTTYPE_DOOR_LAST:
+ case BATTLEFIELD_WG_OBJECTTYPE_DOOR:
+ case BATTLEFIELD_WG_OBJECTTYPE_WALL:
+ m_Team = m_WG->GetDefenderTeam(); // Objects that are part of the keep should be the defender's
+ break;
+ case BATTLEFIELD_WG_OBJECTTYPE_TOWER:
+ m_Team = m_WG->GetAttackerTeam(); // The towers in the south should be the attacker's
+ break;
+ default:
+ m_Team = TEAM_NEUTRAL;
+ break;
+ }
+
+ m_State = sWorld->getWorldState(m_WorldState);
+ if (m_Build)
+ {
+ switch (m_State)
+ {
+ case BATTLEFIELD_WG_OBJECTSTATE_ALLIANCE_INTACT:
+ case BATTLEFIELD_WG_OBJECTSTATE_HORDE_INTACT:
+ m_Build->SetDestructibleState(GO_DESTRUCTIBLE_REBUILDING, NULL, true);
+ break;
+ case BATTLEFIELD_WG_OBJECTSTATE_ALLIANCE_DESTROY:
+ case BATTLEFIELD_WG_OBJECTSTATE_HORDE_DESTROY:
+ m_Build->SetDestructibleState(GO_DESTRUCTIBLE_DESTROYED);
+ break;
+ case BATTLEFIELD_WG_OBJECTSTATE_ALLIANCE_DAMAGE:
+ case BATTLEFIELD_WG_OBJECTSTATE_HORDE_DAMAGE:
+ m_Build->SetDestructibleState(GO_DESTRUCTIBLE_DAMAGED);
+ break;
+ }
+ }
+
+ int32 towerid = -1;
+ switch (go->GetEntry())
+ {
+ case GO_WINTERGRASP_FORTRESS_TOWER_1:
+ towerid = 0;
+ break;
+ case GO_WINTERGRASP_FORTRESS_TOWER_2:
+ towerid = 1;
+ break;
+ case GO_WINTERGRASP_FORTRESS_TOWER_3:
+ towerid = 2;
+ break;
+ case GO_WINTERGRASP_FORTRESS_TOWER_4:
+ towerid = 3;
+ break;
+ case GO_WINTERGRASP_SHADOWSIGHT_TOWER:
+ towerid = 4;
+ break;
+ case GO_WINTERGRASP_WINTER_S_EDGE_TOWER:
+ towerid = 5;
+ break;
+ case GO_WINTERGRASP_FLAMEWATCH_TOWER:
+ towerid = 6;
+ break;
+ }
+
+ if (towerid > 3) // Attacker towers
+ {
+ // Spawn associate gameobjects
+ for (uint8 i = 0; i < AttackTowers[towerid - 4].nbObject; i++)
+ {
+ WintergraspObjectPositionData gobData = AttackTowers[towerid - 4].GameObject[i];
+ if (GameObject* go = m_WG->SpawnGameObject(gobData.entryHorde, gobData.x, gobData.y, gobData.z, gobData.o))
+ m_GameObjectList[TEAM_HORDE].insert(go);
+ if (GameObject* go = m_WG->SpawnGameObject(gobData.entryAlliance, gobData.x, gobData.y, gobData.z, gobData.o))
+ m_GameObjectList[TEAM_ALLIANCE].insert(go);
+ }
+
+ // Spawn associate npc bottom
+ for (uint8 i = 0; i < AttackTowers[towerid - 4].nbCreatureBottom; i++)
+ {
+ WintergraspObjectPositionData creatureData = AttackTowers[towerid - 4].CreatureBottom[i];
+ if (Creature* creature = m_WG->SpawnCreature(creatureData.entryHorde, creatureData.x, creatureData.y, creatureData.z, creatureData.o, TEAM_HORDE))
+ m_CreatureBottomList[TEAM_HORDE].insert(creature->GetGUID());
+ if (Creature* creature = m_WG->SpawnCreature(creatureData.entryAlliance, creatureData.x, creatureData.y, creatureData.z, creatureData.o, TEAM_ALLIANCE))
+ m_CreatureBottomList[TEAM_ALLIANCE].insert(creature->GetGUID());
+ }
+
+ // Spawn associate npc top
+ for (uint8 i = 0; i < AttackTowers[towerid - 4].nbCreatureTop; i++)
+ {
+ WintergraspObjectPositionData creatureData = AttackTowers[towerid - 4].CreatureTop[i];
+ if (Creature* creature = m_WG->SpawnCreature(creatureData.entryHorde, creatureData.x, creatureData.y, creatureData.z, creatureData.o, TEAM_HORDE))
+ m_CreatureTopList[TEAM_HORDE].insert(creature->GetGUID());
+ if (Creature* creature = m_WG->SpawnCreature(creatureData.entryAlliance, creatureData.x, creatureData.y, creatureData.z, creatureData.o, TEAM_ALLIANCE))
+ m_CreatureTopList[TEAM_ALLIANCE].insert(creature->GetGUID());
+ }
+ }
+
+ if (towerid >= 0)
+ {
+ // Spawn Turret bottom
+ for (uint8 i = 0; i < TowerCannon[towerid].nbTowerCannonBottom; i++)
+ {
+ Position turretPos;
+ TowerCannon[towerid].TowerCannonBottom[i].GetPosition(&turretPos);
+ if (Creature* turret = m_WG->SpawnCreature(NPC_WINTERGRASP_TOWER_CANNON, turretPos, TEAM_ALLIANCE))
+ {
+ m_TowerCannonBottomList.insert(turret->GetGUID());
+ switch (go->GetEntry())
+ {
+ case GO_WINTERGRASP_FORTRESS_TOWER_1:
+ case GO_WINTERGRASP_FORTRESS_TOWER_2:
+ case GO_WINTERGRASP_FORTRESS_TOWER_3:
+ case GO_WINTERGRASP_FORTRESS_TOWER_4:
+ turret->setFaction(WintergraspFaction[m_WG->GetDefenderTeam()]);
+ break;
+ case GO_WINTERGRASP_SHADOWSIGHT_TOWER:
+ case GO_WINTERGRASP_WINTER_S_EDGE_TOWER:
+ case GO_WINTERGRASP_FLAMEWATCH_TOWER:
+ turret->setFaction(WintergraspFaction[m_WG->GetAttackerTeam()]);
+ break;
+ }
+ m_WG->HideNpc(turret);
+ }
+ }
+
+ // Spawn Turret top
+ for (uint8 i = 0; i < TowerCannon[towerid].nbTurretTop; i++)
+ {
+ Position towerCannonPos;
+ TowerCannon[towerid].TurretTop[i].GetPosition(&towerCannonPos);
+ if (Creature* turret = m_WG->SpawnCreature(28366, towerCannonPos, TeamId(0)))
+ {
+ m_TurretTopList.insert(turret->GetGUID());
+ switch (go->GetEntry())
+ {
+ case GO_WINTERGRASP_FORTRESS_TOWER_1:
+ case GO_WINTERGRASP_FORTRESS_TOWER_2:
+ case GO_WINTERGRASP_FORTRESS_TOWER_3:
+ case GO_WINTERGRASP_FORTRESS_TOWER_4:
+ turret->setFaction(WintergraspFaction[m_WG->GetDefenderTeam()]);
+ break;
+ case GO_WINTERGRASP_SHADOWSIGHT_TOWER:
+ case GO_WINTERGRASP_WINTER_S_EDGE_TOWER:
+ case GO_WINTERGRASP_FLAMEWATCH_TOWER:
+ turret->setFaction(WintergraspFaction[m_WG->GetAttackerTeam()]);
+ break;
+ }
+ m_WG->HideNpc(turret);
+ }
+ }
+ UpdateCreatureAndGo();
+ }
+ }
+
+ void UpdateCreatureAndGo()
+ {
+ for (GuidSet::const_iterator itr = m_CreatureTopList[m_WG->GetDefenderTeam()].begin(); itr != m_CreatureTopList[m_WG->GetDefenderTeam()].end(); ++itr)
+ if (Unit* unit = sObjectAccessor->FindUnit(*itr))
+ if (Creature* creature = unit->ToCreature())
+ m_WG->HideNpc(creature);
+
+ for (GuidSet::const_iterator itr = m_CreatureTopList[m_WG->GetAttackerTeam()].begin(); itr != m_CreatureTopList[m_WG->GetAttackerTeam()].end(); ++itr)
+ if (Unit* unit = sObjectAccessor->FindUnit(*itr))
+ if (Creature* creature = unit->ToCreature())
+ m_WG->ShowNpc(creature, true);
+
+ for (GuidSet::const_iterator itr = m_CreatureBottomList[m_WG->GetDefenderTeam()].begin(); itr != m_CreatureBottomList[m_WG->GetDefenderTeam()].end(); ++itr)
+ if (Unit* unit = sObjectAccessor->FindUnit(*itr))
+ if (Creature* creature = unit->ToCreature())
+ m_WG->HideNpc(creature);
+
+ for (GuidSet::const_iterator itr = m_CreatureBottomList[m_WG->GetAttackerTeam()].begin(); itr != m_CreatureBottomList[m_WG->GetAttackerTeam()].end(); ++itr)
+ if (Unit* unit = sObjectAccessor->FindUnit(*itr))
+ if (Creature* creature = unit->ToCreature())
+ m_WG->ShowNpc(creature, true);
+
+ for (GameObjectSet::const_iterator itr = m_GameObjectList[m_WG->GetDefenderTeam()].begin(); itr != m_GameObjectList[m_WG->GetDefenderTeam()].end(); ++itr)
+ (*itr)->SetRespawnTime(RESPAWN_ONE_DAY);
+
+ for (GameObjectSet::const_iterator itr = m_GameObjectList[m_WG->GetAttackerTeam()].begin(); itr != m_GameObjectList[m_WG->GetAttackerTeam()].end(); ++itr)
+ (*itr)->SetRespawnTime(RESPAWN_IMMEDIATELY);
+ }
+
+ void UpdateTurretAttack(bool disable)
+ {
+ for (GuidSet::const_iterator itr = m_TowerCannonBottomList.begin(); itr != m_TowerCannonBottomList.end(); ++itr)
+ {
+ if (Unit* unit = sObjectAccessor->FindUnit(*itr))
+ {
+ if (Creature* creature = unit->ToCreature())
+ {
+ if (m_Build)
+ {
+ if (disable)
+ m_WG->HideNpc(creature);
+ else
+ m_WG->ShowNpc(creature, true);
+
+ switch (m_Build->GetEntry())
+ {
+ case GO_WINTERGRASP_FORTRESS_TOWER_1:
+ case GO_WINTERGRASP_FORTRESS_TOWER_2:
+ case GO_WINTERGRASP_FORTRESS_TOWER_3:
+ case GO_WINTERGRASP_FORTRESS_TOWER_4:
+ {
+ creature->setFaction(WintergraspFaction[m_WG->GetDefenderTeam()]);
+ break;
+ }
+ case GO_WINTERGRASP_SHADOWSIGHT_TOWER:
+ case GO_WINTERGRASP_WINTER_S_EDGE_TOWER:
+ case GO_WINTERGRASP_FLAMEWATCH_TOWER:
+ {
+ creature->setFaction(WintergraspFaction[m_WG->GetAttackerTeam()]);
+ break;
+ }
+ }
+ }
+ }
+ }
+ }
+
+ for (GuidSet::const_iterator itr = m_TurretTopList.begin(); itr != m_TurretTopList.end(); ++itr)
+ {
+ if (Unit* unit = sObjectAccessor->FindUnit(*itr))
+ {
+ if (Creature* creature = unit->ToCreature())
+ {
+ if (m_Build)
+ {
+ if (disable)
+ m_WG->HideNpc(creature);
+ else
+ m_WG->ShowNpc(creature, true);
+
+ switch (m_Build->GetEntry())
+ {
+ case GO_WINTERGRASP_FORTRESS_TOWER_1:
+ case GO_WINTERGRASP_FORTRESS_TOWER_2:
+ case GO_WINTERGRASP_FORTRESS_TOWER_3:
+ case GO_WINTERGRASP_FORTRESS_TOWER_4:
+ {
+ creature->setFaction(WintergraspFaction[m_WG->GetDefenderTeam()]);
+ break;
+ }
+ case GO_WINTERGRASP_SHADOWSIGHT_TOWER:
+ case GO_WINTERGRASP_WINTER_S_EDGE_TOWER:
+ case GO_WINTERGRASP_FLAMEWATCH_TOWER:
+ {
+ creature->setFaction(WintergraspFaction[m_WG->GetAttackerTeam()]);
+ break;
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+
+ void Save()
+ {
+ sWorld->setWorldState(m_WorldState, m_State);
+ }
+};
+
+struct WGWorkshop
+{
+ // pointer to the battlefield that the workshop belongs to
+ BattlefieldWG* bf;
+ // id of the workshop, useful to retrieve data of the WorkshopsData array
+ uint8 workshopId;
+ // team that controls the node
+ uint8 teamControl;
+ // for worldstate
+ uint32 state;
+
+ WGWorkshop(BattlefieldWG* _bf, uint8 _workshopId)
+ {
+ ASSERT(_bf || _workshopId < WG_MAX_WORKSHOP);
+
+ bf = _bf;
+ workshopId = _workshopId;
+ }
+
+ void GiveControlTo(uint8 team, bool init /* for first call in setup*/)
+ {
+ switch (team)
+ {
+ case BATTLEFIELD_WG_TEAM_NEUTRAL:
+ {
+ // Send warning message to all player to inform a faction attack to a workshop
+ // alliance / horde attacking a workshop
+ bf->SendWarningToAllInZone(teamControl ? WorkshopsData[workshopId].text : WorkshopsData[workshopId].text + 1);
+ break;
+ }
+ case BATTLEFIELD_WG_TEAM_ALLIANCE:
+ case BATTLEFIELD_WG_TEAM_HORDE:
+ {
+ // Updating worldstate
+ state = team == BATTLEFIELD_WG_TEAM_ALLIANCE ? BATTLEFIELD_WG_OBJECTSTATE_ALLIANCE_INTACT : BATTLEFIELD_WG_OBJECTSTATE_HORDE_INTACT;
+ bf->SendUpdateWorldState(WorkshopsData[workshopId].worldstate, state);
+
+ // Warning message
+ if (!init) // workshop taken - alliance
+ bf->SendWarningToAllInZone(team == BATTLEFIELD_WG_TEAM_ALLIANCE ? WorkshopsData[workshopId].text : WorkshopsData[workshopId].text+1);
+
+ // Found associate graveyard and update it
+ if (workshopId < BATTLEFIELD_WG_WORKSHOP_KEEP_WEST)
+ if (bf->GetGraveyardById(workshopId))
+ bf->GetGraveyardById(workshopId)->GiveControlTo(team == BATTLEFIELD_WG_TEAM_ALLIANCE ? TEAM_ALLIANCE : TEAM_HORDE);
+
+ teamControl = team;
+ break;
+ }
+ }
+
+ if (!init)
+ bf->UpdateCounterVehicle(false);
+ }
+
+ void UpdateGraveyardAndWorkshop()
+ {
+ if (workshopId < BATTLEFIELD_WG_WORKSHOP_KEEP_WEST)
+ bf->GetGraveyardById(workshopId)->GiveControlTo(TeamId(teamControl));
+ else
+ GiveControlTo(bf->GetDefenderTeam(), true);
+ }
+
+ void Save()
+ {
+ sWorld->setWorldState(WorkshopsData[workshopId].worldstate, state);
+ }
+};
+
+// Structure for the 6 workshop
+struct WintergraspWorkshopData
+{
+ BattlefieldWG* m_WG; // Pointer to wintergrasp
+ GameObject* m_Build;
+ uint32 m_Type;
+ uint32 m_State; // For worldstate
+ uint32 m_WorldState;
+ uint32 m_TeamControl; // Team witch control the workshop
+ GuidSet m_CreatureOnPoint[2]; // Contain all Creature associate to this point
+ GameObjectSet m_GameObjectOnPoint[2]; // Contain all Gameobject associate to this point
+ uint32 m_NameId; // Id of trinity_string witch contain name of this node, using for alert message
+
+ WintergraspWorkshopData(BattlefieldWG* WG)
+ {
+ m_WG = WG;
+ m_Build = NULL;
+ m_Type = 0;
+ m_State = 0;
+ m_WorldState = 0;
+ m_TeamControl = 0;
+ m_NameId = 0;
+ }
+
+ // Spawning associate creature and store them
+ void AddCreature(WintergraspObjectPositionData obj)
+ {
+ if (Creature* creature = m_WG->SpawnCreature(obj.entryHorde, obj.x, obj.y, obj.z, obj.o, TEAM_HORDE))
+ m_CreatureOnPoint[TEAM_HORDE].insert(creature->GetGUID());
+
+ if (Creature* creature = m_WG->SpawnCreature(obj.entryAlliance, obj.x, obj.y, obj.z, obj.o, TEAM_ALLIANCE))
+ m_CreatureOnPoint[TEAM_ALLIANCE].insert(creature->GetGUID());
+ }
+
+ // Spawning Associate gameobject and store them
+ void AddGameObject(WintergraspObjectPositionData obj)
+ {
+ if (GameObject* gameobject = m_WG->SpawnGameObject(obj.entryHorde, obj.x, obj.y, obj.z, obj.o))
+ m_GameObjectOnPoint[TEAM_HORDE].insert(gameobject);
+ if (GameObject* gameobject = m_WG->SpawnGameObject(obj.entryAlliance, obj.x, obj.y, obj.z, obj.o))
+ m_GameObjectOnPoint[TEAM_ALLIANCE].insert(gameobject);
+ }
+
+ // Init method, setup variable
+ void Init(uint32 worldstate, uint32 type, uint32 nameid)
+ {
+ m_WorldState = worldstate;
+ m_Type = type;
+ m_NameId = nameid;
+ }
+
+ // Called on change faction in CapturePoint class
+ void GiveControlTo(uint8 team, bool init /* for first call in setup*/)
+ {
+ switch (team)
+ {
+ case BATTLEFIELD_WG_TEAM_NEUTRAL:
+ {
+ // Send warning message to all player for inform a faction attack a workshop
+ // alliance / horde attacking workshop
+ m_WG->SendWarningToAllInZone(m_TeamControl ? m_NameId : m_NameId + 1);
+ break;
+ }
+ case BATTLEFIELD_WG_TEAM_ALLIANCE:
+ {
+ // Show Alliance creature
+ for (GuidSet::const_iterator itr = m_CreatureOnPoint[TEAM_ALLIANCE].begin(); itr != m_CreatureOnPoint[TEAM_ALLIANCE].end(); ++itr)
+ if (Unit* unit = sObjectAccessor->FindUnit(*itr))
+ if (Creature* creature = unit->ToCreature())
+ m_WG->ShowNpc(creature, creature->GetEntry() != 30499);
+
+ // Hide Horde creature
+ for (GuidSet::const_iterator itr = m_CreatureOnPoint[TEAM_HORDE].begin(); itr != m_CreatureOnPoint[TEAM_HORDE].end(); ++itr)
+ if (Unit* unit = sObjectAccessor->FindUnit(*itr))
+ if (Creature* creature = unit->ToCreature())
+ m_WG->HideNpc(creature);
+
+ // Show Alliance gameobject
+ for (GameObjectSet::const_iterator itr = m_GameObjectOnPoint[TEAM_ALLIANCE].begin(); itr != m_GameObjectOnPoint[TEAM_ALLIANCE].end(); ++itr)
+ (*itr)->SetRespawnTime(RESPAWN_IMMEDIATELY);
+
+ // Hide Horde gameobject
+ for (GameObjectSet::const_iterator itr = m_GameObjectOnPoint[TEAM_HORDE].begin(); itr != m_GameObjectOnPoint[TEAM_HORDE].end(); ++itr)
+ (*itr)->SetRespawnTime(RESPAWN_ONE_DAY);
+
+
+ // Updating worldstate
+ m_State = BATTLEFIELD_WG_OBJECTSTATE_ALLIANCE_INTACT;
+ m_WG->SendUpdateWorldState(m_WorldState, m_State);
+
+ // Warning message
+ if (!init) // workshop taken - alliance
+ m_WG->SendWarningToAllInZone(m_NameId);
+
+ // Found associate graveyard and update it
+ if (m_Type < BATTLEFIELD_WG_WORKSHOP_KEEP_WEST)
+ if (m_WG && m_WG->GetGraveyardById(m_Type))
+ m_WG->GetGraveyardById(m_Type)->GiveControlTo(TEAM_ALLIANCE);
+
+ m_TeamControl = team;
+ break;
+ }
+ case BATTLEFIELD_WG_TEAM_HORDE:
+ {
+ // Show Horde creature
+ for (GuidSet::const_iterator itr = m_CreatureOnPoint[TEAM_HORDE].begin(); itr != m_CreatureOnPoint[TEAM_HORDE].end(); ++itr)
+ if (Unit* unit = sObjectAccessor->FindUnit(*itr))
+ if (Creature* creature = unit->ToCreature())
+ m_WG->ShowNpc(creature, creature->GetEntry() != 30400);
+
+ // Hide Alliance creature
+ for (GuidSet::const_iterator itr = m_CreatureOnPoint[TEAM_ALLIANCE].begin(); itr != m_CreatureOnPoint[TEAM_ALLIANCE].end(); ++itr)
+ if (Unit* unit = sObjectAccessor->FindUnit(*itr))
+ if (Creature* creature = unit->ToCreature())
+ m_WG->HideNpc(creature);
+
+ // Hide Alliance gameobject
+ for (GameObjectSet::const_iterator itr = m_GameObjectOnPoint[TEAM_ALLIANCE].begin(); itr != m_GameObjectOnPoint[TEAM_ALLIANCE].end(); ++itr)
+ (*itr)->SetRespawnTime(RESPAWN_ONE_DAY);
+
+ // Show Horde gameobject
+ for (GameObjectSet::const_iterator itr = m_GameObjectOnPoint[TEAM_HORDE].begin(); itr != m_GameObjectOnPoint[TEAM_HORDE].end(); ++itr)
+ (*itr)->SetRespawnTime(RESPAWN_IMMEDIATELY);
+
+ // Update worlstate
+ m_State = BATTLEFIELD_WG_OBJECTSTATE_HORDE_INTACT;
+ m_WG->SendUpdateWorldState(m_WorldState, m_State);
+
+ // Warning message
+ if (!init) // workshop taken - horde
+ m_WG->SendWarningToAllInZone(m_NameId + 1);
+
+ // Update graveyard control
+ if (m_Type < BATTLEFIELD_WG_WORKSHOP_KEEP_WEST)
+ if (m_WG && m_WG->GetGraveyardById(m_Type))
+ m_WG->GetGraveyardById(m_Type)->GiveControlTo(TEAM_HORDE);
+
+ m_TeamControl = team;
+ break;
+ }
+ }
+ if (!init)
+ m_WG->UpdateCounterVehicle(false);
+ }
+
+ void UpdateGraveyardAndWorkshop()
+ {
+ if (m_Type < BATTLEFIELD_WG_WORKSHOP_KEEP_WEST)
+ m_WG->GetGraveyardById(m_Type)->GiveControlTo(TeamId(m_TeamControl));
+ else
+ GiveControlTo(m_WG->GetDefenderTeam(), true);
+ }
+
+ void Save()
+ {
+ sWorld->setWorldState(m_WorldState, m_State);
+ }
+};
+
+#endif
diff --git a/src/server/game/Battlegrounds/ArenaTeam.cpp b/src/server/game/Battlegrounds/ArenaTeam.cpp
index 7c6cabe37ba..e88c501398e 100755
--- a/src/server/game/Battlegrounds/ArenaTeam.cpp
+++ b/src/server/game/Battlegrounds/ArenaTeam.cpp
@@ -24,16 +24,9 @@
#include "ArenaTeamMgr.h"
ArenaTeam::ArenaTeam()
+ : TeamId(0), Type(0), TeamName(), CaptainGuid(0), BackgroundColor(0), EmblemStyle(0), EmblemColor(0),
+ BorderStyle(0), BorderColor(0)
{
- TeamId = 0;
- Type = 0;
- TeamName = "";
- CaptainGuid = 0;
- BackgroundColor = 0;
- EmblemStyle = 0;
- EmblemColor = 0;
- BorderStyle = 0;
- BorderColor = 0;
Stats.WeekGames = 0;
Stats.SeasonGames = 0;
Stats.Rank = 0;
@@ -87,7 +80,7 @@ bool ArenaTeam::Create(uint64 captainGuid, uint8 type, std::string teamName, uin
// Add captain as member
AddMember(CaptainGuid);
- sLog->outDebug(LOG_FILTER_BATTLEGROUND, "New ArenaTeam created [Id: %u] [Type: %u] [Captain low GUID: %u]", GetId(), GetType(), captainLowGuid);
+ sLog->outInfo(LOG_FILTER_ARENAS, "New ArenaTeam created [Id: %u] [Type: %u] [Captain low GUID: %u]", GetId(), GetType(), captainLowGuid);
return true;
}
@@ -125,7 +118,7 @@ bool ArenaTeam::AddMember(uint64 playerGuid)
// Check if player is already in a similar arena team
if ((player && player->GetArenaTeamId(GetSlot())) || Player::GetArenaTeamIdFromDB(playerGuid, GetType()) != 0)
{
- sLog->outError(LOG_FILTER_BATTLEGROUND, "Arena: Player %s (guid: %u) already has an arena team of type %u", playerName.c_str(), GUID_LOPART(playerGuid), GetType());
+ sLog->outDebug(LOG_FILTER_ARENAS, "Arena: Player %s (guid: %u) already has an arena team of type %u", playerName.c_str(), GUID_LOPART(playerGuid), GetType());
return false;
}
@@ -184,7 +177,7 @@ bool ArenaTeam::AddMember(uint64 playerGuid)
player->SetArenaTeamInfoField(GetSlot(), ARENA_TEAM_MEMBER, 1);
}
- sLog->outDebug(LOG_FILTER_BATTLEGROUND, "Player: %s [GUID: %u] joined arena team type: %u [Id: %u].", playerName.c_str(), GUID_LOPART(playerGuid), GetType(), GetId());
+ sLog->outInfo(LOG_FILTER_ARENAS, "Player: %s [GUID: %u] joined arena team type: %u [Id: %u].", playerName.c_str(), GUID_LOPART(playerGuid), GetType(), GetId());
return true;
}
@@ -251,7 +244,7 @@ bool ArenaTeam::LoadMembersFromDB(QueryResult result)
if (newMember.Name.empty())
{
sLog->outError(LOG_FILTER_SQL, "ArenaTeam %u has member with empty name - probably player %u doesn't exist, deleting him from memberlist!", arenaTeamId, GUID_LOPART(newMember.Guid));
- this->DelMember(newMember.Guid, true);
+ DelMember(newMember.Guid, true);
continue;
}
@@ -267,7 +260,7 @@ bool ArenaTeam::LoadMembersFromDB(QueryResult result)
if (Empty() || !captainPresentInTeam)
{
// Arena team is empty or captain is not in team, delete from db
- sLog->outDebug(LOG_FILTER_BATTLEGROUND, "ArenaTeam %u does not have any members or its captain is not in team, disbanding it...", TeamId);
+ sLog->outDebug(LOG_FILTER_ARENAS, "ArenaTeam %u does not have any members or its captain is not in team, disbanding it...", TeamId);
return false;
}
@@ -297,7 +290,7 @@ void ArenaTeam::SetCaptain(uint64 guid)
newCaptain->SetArenaTeamInfoField(GetSlot(), ARENA_TEAM_MEMBER, 0);
char const* oldCaptainName = oldCaptain ? oldCaptain->GetName() : "";
uint32 oldCaptainLowGuid = oldCaptain ? oldCaptain->GetGUIDLow() : 0;
- sLog->outDebug(LOG_FILTER_BATTLEGROUND, "Player: %s [GUID: %u] promoted player: %s [GUID: %u] to leader of arena team [Id: %u] [Type: %u].",
+ sLog->outInfo(LOG_FILTER_ARENAS, "Player: %s [GUID: %u] promoted player: %s [GUID: %u] to leader of arena team [Id: %u] [Type: %u].",
oldCaptainName, oldCaptainLowGuid, newCaptain->GetName(), newCaptain->GetGUIDLow(), GetId(), GetType());
}
}
@@ -321,7 +314,7 @@ void ArenaTeam::DelMember(uint64 guid, bool cleanDb)
// delete all info regarding this team
for (uint32 i = 0; i < ARENA_TEAM_END; ++i)
player->SetArenaTeamInfoField(GetSlot(), ArenaTeamInfoType(i), 0);
- sLog->outDebug(LOG_FILTER_BATTLEGROUND, "Player: %s [GUID: %u] left arena team type: %u [Id: %u].", player->GetName(), player->GetGUIDLow(), GetType(), GetId());
+ sLog->outInfo(LOG_FILTER_ARENAS, "Player: %s [GUID: %u] left arena team type: %u [Id: %u].", player->GetName(), player->GetGUIDLow(), GetType(), GetId());
}
// Only used for single member deletion, for arena team disband we use a single query for more efficiency
@@ -346,7 +339,7 @@ void ArenaTeam::Disband(WorldSession* session)
BroadcastEvent(ERR_ARENA_TEAM_DISBANDED_S, 0, 2, session->GetPlayerName(), GetName(), "");
if (Player* player = session->GetPlayer())
- sLog->outDebug(LOG_FILTER_BATTLEGROUND, "Player: %s [GUID: %u] disbanded arena team type: %u [Id: %u].", player->GetName(), player->GetGUIDLow(), GetType(), GetId());
+ sLog->outInfo(LOG_FILTER_ARENAS, "Player: %s [GUID: %u] disbanded arena team type: %u [Id: %u].", player->GetName(), player->GetGUIDLow(), GetType(), GetId());
}
// Update database
@@ -507,7 +500,7 @@ void ArenaTeam::BroadcastEvent(ArenaTeamEvents event, uint64 guid, uint8 strCoun
data << str1 << str2 << str3;
break;
default:
- sLog->outError(LOG_FILTER_BATTLEGROUND, "Unhandled strCount %u in ArenaTeam::BroadcastEvent", strCount);
+ sLog->outError(LOG_FILTER_ARENAS, "Unhandled strCount %u in ArenaTeam::BroadcastEvent", strCount);
return;
}
@@ -529,7 +522,7 @@ uint8 ArenaTeam::GetSlotByType(uint32 type)
default:
break;
}
- sLog->outError(LOG_FILTER_BATTLEGROUND, "FATAL: Unknown arena team type %u for some arena team", type);
+ sLog->outError(LOG_FILTER_ARENAS, "FATAL: Unknown arena team type %u for some arena team", type);
return 0xFF;
}
diff --git a/src/server/game/Battlegrounds/ArenaTeamMgr.cpp b/src/server/game/Battlegrounds/ArenaTeamMgr.cpp
index 665742c97b1..55de445345b 100644
--- a/src/server/game/Battlegrounds/ArenaTeamMgr.cpp
+++ b/src/server/game/Battlegrounds/ArenaTeamMgr.cpp
@@ -101,8 +101,7 @@ void ArenaTeamMgr::LoadArenaTeams()
if (!result)
{
- sLog->outInfo(LOG_FILTER_BATTLEGROUND, ">> Loaded 0 arena teams. DB table `arena_team` is empty!");
-
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 arena teams. DB table `arena_team` is empty!");
return;
}
@@ -132,8 +131,7 @@ void ArenaTeamMgr::LoadArenaTeams()
}
while (result->NextRow());
- sLog->outInfo(LOG_FILTER_BATTLEGROUND, ">> Loaded %u arena teams in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
-
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u arena teams in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
}
void ArenaTeamMgr::DistributeArenaPoints()
diff --git a/src/server/game/Battlegrounds/Battleground.cpp b/src/server/game/Battlegrounds/Battleground.cpp
index cfb4aec8525..eb5f3459edf 100755
--- a/src/server/game/Battlegrounds/Battleground.cpp
+++ b/src/server/game/Battlegrounds/Battleground.cpp
@@ -771,17 +771,17 @@ void Battleground::EndBattleground(uint32 winner)
winner_matchmaker_rating = GetArenaMatchmakerRating(winner);
winner_matchmaker_change = winner_arena_team->WonAgainst(winner_matchmaker_rating, loser_matchmaker_rating, winner_change);
loser_matchmaker_change = loser_arena_team->LostAgainst(loser_matchmaker_rating, winner_matchmaker_rating, loser_change);
- sLog->outDebug(LOG_FILTER_BATTLEGROUND, "match Type: %u --- Winner: old rating: %u, rating gain: %d, old MMR: %u, MMR gain: %d --- Loser: old rating: %u, rating loss: %d, old MMR: %u, MMR loss: %d ---", m_ArenaType, winner_team_rating, winner_change, winner_matchmaker_rating,
+ sLog->outDebug(LOG_FILTER_ARENAS, "match Type: %u --- Winner: old rating: %u, rating gain: %d, old MMR: %u, MMR gain: %d --- Loser: old rating: %u, rating loss: %d, old MMR: %u, MMR loss: %d ---", m_ArenaType, winner_team_rating, winner_change, winner_matchmaker_rating,
winner_matchmaker_change, loser_team_rating, loser_change, loser_matchmaker_rating, loser_matchmaker_change);
SetArenaMatchmakerRating(winner, winner_matchmaker_rating + winner_matchmaker_change);
SetArenaMatchmakerRating(GetOtherTeam(winner), loser_matchmaker_rating + loser_matchmaker_change);
SetArenaTeamRatingChangeForTeam(winner, winner_change);
SetArenaTeamRatingChangeForTeam(GetOtherTeam(winner), loser_change);
- sLog->outDebug(LOG_FILTER_BATTLEGROUND, "Arena match Type: %u for Team1Id: %u - Team2Id: %u ended. WinnerTeamId: %u. Winner rating: +%d, Loser rating: %d", m_ArenaType, m_ArenaTeamIds[BG_TEAM_ALLIANCE], m_ArenaTeamIds[BG_TEAM_HORDE], winner_arena_team->GetId(), winner_change, loser_change);
+ sLog->outDebug(LOG_FILTER_ARENAS, "Arena match Type: %u for Team1Id: %u - Team2Id: %u ended. WinnerTeamId: %u. Winner rating: +%d, Loser rating: %d", m_ArenaType, m_ArenaTeamIds[BG_TEAM_ALLIANCE], m_ArenaTeamIds[BG_TEAM_HORDE], winner_arena_team->GetId(), winner_change, loser_change);
if (sWorld->getBoolConfig(CONFIG_ARENA_LOG_EXTENDED_INFO))
for (Battleground::BattlegroundScoreMap::const_iterator itr = GetPlayerScoresBegin(); itr != GetPlayerScoresEnd(); ++itr)
if (Player* player = ObjectAccessor::FindPlayer(itr->first))
- sLog->outDebug(LOG_FILTER_BATTLEGROUND, "Statistics match Type: %u for %s (GUID: " UI64FMTD ", Team: %d, IP: %s): %u damage, %u healing, %u killing blows", m_ArenaType, player->GetName(), itr->first, player->GetArenaTeamId(m_ArenaType == 5 ? 2 : m_ArenaType == 3), player->GetSession()->GetRemoteAddress().c_str(), itr->second->DamageDone, itr->second->HealingDone, itr->second->KillingBlows);
+ sLog->outDebug(LOG_FILTER_ARENAS, "Statistics match Type: %u for %s (GUID: " UI64FMTD ", Team: %d, IP: %s): %u damage, %u healing, %u killing blows", m_ArenaType, player->GetName(), itr->first, player->GetArenaTeamId(m_ArenaType == 5 ? 2 : m_ArenaType == 3), player->GetSession()->GetRemoteAddress().c_str(), itr->second->DamageDone, itr->second->HealingDone, itr->second->KillingBlows);
}
// Deduct 16 points from each teams arena-rating if there are no winners after 45+2 minutes
else
@@ -1103,7 +1103,7 @@ void Battleground::StartBattleground()
// and it doesn't matter if we call StartBattleground() more times, because m_Battlegrounds is a map and instance id never changes
sBattlegroundMgr->AddBattleground(GetInstanceID(), GetTypeID(), this);
if (m_IsRated)
- sLog->outDebug(LOG_FILTER_BATTLEGROUND, "Arena match type: %u for Team1Id: %u - Team2Id: %u started.", m_ArenaType, m_ArenaTeamIds[BG_TEAM_ALLIANCE], m_ArenaTeamIds[BG_TEAM_HORDE]);
+ sLog->outDebug(LOG_FILTER_ARENAS, "Arena match type: %u for Team1Id: %u - Team2Id: %u started.", m_ArenaType, m_ArenaTeamIds[BG_TEAM_ALLIANCE], m_ArenaTeamIds[BG_TEAM_HORDE]);
}
void Battleground::AddPlayer(Player* player)
@@ -1213,7 +1213,7 @@ void Battleground::AddOrSetPlayerToCorrectBgGroup(Player* player, uint32 team)
if (group->IsMember(playerGuid))
{
uint8 subgroup = group->GetMemberGroup(playerGuid);
- player->SetBattlegroundRaid(group, subgroup);
+ player->SetBattlegroundOrBattlefieldRaid(group, subgroup);
}
else
{
diff --git a/src/server/game/Battlegrounds/Battleground.h b/src/server/game/Battlegrounds/Battleground.h
index 01dfbb23033..e658ac4ecbd 100755
--- a/src/server/game/Battlegrounds/Battleground.h
+++ b/src/server/game/Battlegrounds/Battleground.h
@@ -38,7 +38,7 @@ enum BattlegroundSounds
SOUND_HORDE_WINS = 8454,
SOUND_ALLIANCE_WINS = 8455,
SOUND_BG_START = 3439,
- SOUND_BG_START_L70ETC = 11803,
+ SOUND_BG_START_L70ETC = 11803
};
enum BattlegroundQuests
@@ -79,7 +79,7 @@ enum BattlegroundMarksCount
enum BattlegroundCreatures
{
BG_CREATURE_ENTRY_A_SPIRITGUIDE = 13116, // alliance
- BG_CREATURE_ENTRY_H_SPIRITGUIDE = 13117, // horde
+ BG_CREATURE_ENTRY_H_SPIRITGUIDE = 13117 // horde
};
enum BattlegroundSpells
@@ -99,7 +99,7 @@ enum BattlegroundSpells
SPELL_AURA_PLAYER_INACTIVE = 43681, // Inactive
SPELL_HONORABLE_DEFENDER_25Y = 68652, // +50% honor when standing at a capture point that you control, 25yards radius (added in 3.2)
SPELL_HONORABLE_DEFENDER_60Y = 66157, // +50% honor when standing at a capture point that you control, 60yards radius (added in 3.2), probably for 40+ player battlegrounds
- SPELL_THE_LAST_STANDING = 26549, // Arena achievement related
+ SPELL_THE_LAST_STANDING = 26549 // Arena achievement related
};
enum BattlegroundTimeIntervals
@@ -112,7 +112,7 @@ enum BattlegroundTimeIntervals
MAX_OFFLINE_TIME = 300, // secs
RESPAWN_ONE_DAY = 86400, // secs
RESPAWN_IMMEDIATELY = 0, // secs
- BUFF_RESPAWN_TIME = 180, // secs
+ BUFF_RESPAWN_TIME = 180 // secs
};
enum BattlegroundStartTimeIntervals
@@ -121,7 +121,7 @@ enum BattlegroundStartTimeIntervals
BG_START_DELAY_1M = 60000, // ms (1 minute)
BG_START_DELAY_30S = 30000, // ms (30 seconds)
BG_START_DELAY_15S = 15000, // ms (15 seconds) Used only in arena
- BG_START_DELAY_NONE = 0, // ms
+ BG_START_DELAY_NONE = 0 // ms
};
enum BattlegroundBuffObjects
@@ -137,8 +137,8 @@ enum BattlegroundRandomRewards
BG_REWARD_WINNER_ARENA_FIRST = 25,
BG_REWARD_WINNER_HONOR_LAST = 15,
BG_REWARD_WINNER_ARENA_LAST = 0,
- BG_REWARD_LOSER_HONOR_FIRST = 5,
- BG_REWARD_LOSER_HONOR_LAST = 5
+ BG_REWARD_LOSER_HONOR_FIRST = 5,
+ BG_REWARD_LOSER_HONOR_LAST = 5
};
const uint32 Buff_Entries[3] = { BG_OBJECTID_SPEEDBUFF_ENTRY, BG_OBJECTID_REGENBUFF_ENTRY, BG_OBJECTID_BERSERKERBUFF_ENTRY };
@@ -209,7 +209,7 @@ enum ScoreType
SCORE_SECONDARY_OBJECTIVES = 17,
//SOTA
SCORE_DESTROYED_DEMOLISHER = 18,
- SCORE_DESTROYED_WALL = 19,
+ SCORE_DESTROYED_WALL = 19
};
enum ArenaType
@@ -275,7 +275,7 @@ enum GroupJoinBattlegroundResult
ERR_BATTLEGROUND_JOIN_FAILED = -12, // Join as a group failed (uint64 guid doesn't exist in client cache)
ERR_LFG_CANT_USE_BATTLEGROUND = -13, // You cannot queue for a battleground or arena while using the dungeon system.
ERR_IN_RANDOM_BG = -14, // Can't do that while in a Random Battleground queue.
- ERR_IN_NON_RANDOM_BG = -15, // Can't queue for Random Battleground while in another Battleground queue.
+ ERR_IN_NON_RANDOM_BG = -15 // Can't queue for Random Battleground while in another Battleground queue.
};
class BattlegroundScore
diff --git a/src/server/game/Battlegrounds/BattlegroundMgr.cpp b/src/server/game/Battlegrounds/BattlegroundMgr.cpp
index 290da0bb31f..0b107983379 100755
--- a/src/server/game/Battlegrounds/BattlegroundMgr.cpp
+++ b/src/server/game/Battlegrounds/BattlegroundMgr.cpp
@@ -683,8 +683,7 @@ void BattlegroundMgr::CreateInitialBattlegrounds()
if (!result)
{
- sLog->outError(LOG_FILTER_SQL, ">> Loaded 0 battlegrounds. DB table `battleground_template` is empty.");
-
+ sLog->outError(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 battlegrounds. DB table `battleground_template` is empty.");
return;
}
@@ -792,8 +791,7 @@ void BattlegroundMgr::CreateInitialBattlegrounds()
}
while (result->NextRow());
- sLog->outInfo(LOG_FILTER_BATTLEGROUND, ">> Loaded %u battlegrounds in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
-
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u battlegrounds in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
}
void BattlegroundMgr::InitAutomaticArenaPointDistribution()
@@ -1077,8 +1075,7 @@ void BattlegroundMgr::LoadBattleMastersEntry()
if (!result)
{
- sLog->outInfo(LOG_FILTER_BATTLEGROUND, ">> Loaded 0 battlemaster entries. DB table `battlemaster_entry` is empty!");
-
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 battlemaster entries. DB table `battlemaster_entry` is empty!");
return;
}
@@ -1102,8 +1099,7 @@ void BattlegroundMgr::LoadBattleMastersEntry()
}
while (result->NextRow());
- sLog->outInfo(LOG_FILTER_BATTLEGROUND, ">> Loaded %u battlemaster entries in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
-
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u battlemaster entries in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
}
HolidayIds BattlegroundMgr::BGTypeToWeekendHolidayId(BattlegroundTypeId bgTypeId)
diff --git a/src/server/game/Battlegrounds/BattlegroundQueue.cpp b/src/server/game/Battlegrounds/BattlegroundQueue.cpp
index 85d41977d13..f36b4d49a35 100755
--- a/src/server/game/Battlegrounds/BattlegroundQueue.cpp
+++ b/src/server/game/Battlegrounds/BattlegroundQueue.cpp
@@ -309,7 +309,7 @@ void BattlegroundQueue::RemovePlayer(uint64 guid, bool decreaseInvitedCount)
{
//we must check premade and normal team's queue - because when players from premade are joining bg,
//they leave groupinfo so we can't use its players size to find out index
- for (uint32 j = index; j < BG_QUEUE_GROUP_TYPES_COUNT; j += BG_QUEUE_NORMAL_ALLIANCE)
+ for (uint32 j = index; j < BG_QUEUE_GROUP_TYPES_COUNT; j += BG_TEAMS_COUNT)
{
for (group_itr_tmp = m_QueuedGroups[bracket_id_tmp][j].begin(); group_itr_tmp != m_QueuedGroups[bracket_id_tmp][j].end(); ++group_itr_tmp)
{
diff --git a/src/server/game/Battlegrounds/Zones/BattlegroundAB.cpp b/src/server/game/Battlegrounds/Zones/BattlegroundAB.cpp
index 8b2543f20ff..9ebaf481098 100755
--- a/src/server/game/Battlegrounds/Zones/BattlegroundAB.cpp
+++ b/src/server/game/Battlegrounds/Zones/BattlegroundAB.cpp
@@ -371,9 +371,10 @@ void BattlegroundAB::_NodeOccupied(uint8 node, Team team)
if (node >= BG_AB_DYNAMIC_NODES_COUNT)//only dynamic nodes, no start points
return;
- Creature* trigger = GetBGCreature(node+7);//0-6 spirit guides
+
+ Creature* trigger = BgCreatures[node+7] ? GetBGCreature(node+7) : NULL;//0-6 spirit guides
if (!trigger)
- trigger = AddCreature(WORLD_TRIGGER, node+7, team, BG_AB_NodePositions[node][0], BG_AB_NodePositions[node][1], BG_AB_NodePositions[node][2], BG_AB_NodePositions[node][3]);
+ trigger = AddCreature(WORLD_TRIGGER, node+7, team, BG_AB_NodePositions[node][0], BG_AB_NodePositions[node][1], BG_AB_NodePositions[node][2], BG_AB_NodePositions[node][3]);
//add bonus honor aura trigger creature when node is accupied
//cast bonus aura (+50% honor in 25yards)
diff --git a/src/server/game/Battlegrounds/Zones/BattlegroundAB.h b/src/server/game/Battlegrounds/Zones/BattlegroundAB.h
index 2cac5df73a9..870b3965522 100755
--- a/src/server/game/Battlegrounds/Zones/BattlegroundAB.h
+++ b/src/server/game/Battlegrounds/Zones/BattlegroundAB.h
@@ -102,7 +102,7 @@ enum BG_AB_ObjectType
BG_AB_OBJECT_SPEEDBUFF_GOLD_MINE = 54,
BG_AB_OBJECT_REGENBUFF_GOLD_MINE = 55,
BG_AB_OBJECT_BERSERKBUFF_GOLD_MINE = 56,
- BG_AB_OBJECT_MAX = 57,
+ BG_AB_OBJECT_MAX = 57
};
/* Object id templates from DB */
@@ -123,7 +123,7 @@ enum BG_AB_ObjectTypes
enum BG_AB_Timers
{
- BG_AB_FLAG_CAPTURING_TIME = 60000,
+ BG_AB_FLAG_CAPTURING_TIME = 60000
};
enum BG_AB_Score
@@ -146,7 +146,7 @@ enum BG_AB_BattlegroundNodes
BG_AB_SPIRIT_ALIANCE = 5,
BG_AB_SPIRIT_HORDE = 6,
- BG_AB_ALL_NODES_COUNT = 7, // all nodes (dynamic and static)
+ BG_AB_ALL_NODES_COUNT = 7 // all nodes (dynamic and static)
};
enum BG_AB_NodeStatus
diff --git a/src/server/game/Battlegrounds/Zones/BattlegroundAV.h b/src/server/game/Battlegrounds/Zones/BattlegroundAV.h
index f073b69a779..b71b3476fcc 100755
--- a/src/server/game/Battlegrounds/Zones/BattlegroundAV.h
+++ b/src/server/game/Battlegrounds/Zones/BattlegroundAV.h
@@ -95,7 +95,7 @@ horde:
AV_SOUND_BOTH_TOWER_DEFEND = 8192,
AV_SOUND_ALLIANCE_CAPTAIN = 8232, //gets called when someone attacks them and at the beginning after 3min+rand(x)*10sec (maybe buff)
- AV_SOUND_HORDE_CAPTAIN = 8333,
+ AV_SOUND_HORDE_CAPTAIN = 8333
};
@@ -1359,7 +1359,7 @@ enum BG_AV_WorldStates
//Neutral
//Snowfall Grave
*/
- AV_SNOWFALL_N = 1966, //over aa
+ AV_SNOWFALL_N = 1966 //over aa
/*
AV_SNOWFALL_A_C = 1341, //over hc
AV_SNOWFALL_A_A = 1343, //over ha
diff --git a/src/server/game/Battlegrounds/Zones/BattlegroundDS.h b/src/server/game/Battlegrounds/Zones/BattlegroundDS.h
index aaf08ba1313..d9e60079bf6 100755
--- a/src/server/game/Battlegrounds/Zones/BattlegroundDS.h
+++ b/src/server/game/Battlegrounds/Zones/BattlegroundDS.h
@@ -52,14 +52,14 @@ enum BattlegroundDSCreatureTypes
enum BattlegroundDSCreatures
{
- BG_DS_NPC_TYPE_WATER_SPOUT = 28567,
+ BG_DS_NPC_TYPE_WATER_SPOUT = 28567
};
enum BattlegroundDSSpells
{
BG_DS_SPELL_FLUSH = 57405, // Visual and target selector for the starting knockback from the pipe
BG_DS_SPELL_FLUSH_KNOCKBACK = 61698, // Knockback effect for previous spell (triggered, not need to be casted)
- BG_DS_SPELL_WATER_SPOUT = 58873, // Knockback effect of the central waterfall
+ BG_DS_SPELL_WATER_SPOUT = 58873 // Knockback effect of the central waterfall
};
enum BattlegroundDSData
@@ -76,7 +76,7 @@ enum BattlegroundDSData
BG_DS_WATERFALL_STATUS_WARNING = 1, // Water starting to fall, but no LoS Blocking nor movement blocking
BG_DS_WATERFALL_STATUS_ON = 2, // LoS and Movement blocking active
- BG_DS_WATERFALL_STATUS_OFF = 3,
+ BG_DS_WATERFALL_STATUS_OFF = 3
};
class BattlegroundDSScore : public BattlegroundScore
diff --git a/src/server/game/Battlegrounds/Zones/BattlegroundEY.h b/src/server/game/Battlegrounds/Zones/BattlegroundEY.h
index 534a40484ce..c7ee4c62504 100755
--- a/src/server/game/Battlegrounds/Zones/BattlegroundEY.h
+++ b/src/server/game/Battlegrounds/Zones/BattlegroundEY.h
@@ -26,7 +26,7 @@ class Battleground;
enum BG_EY_Misc
{
BG_EY_FLAG_RESPAWN_TIME = (8*IN_MILLISECONDS),
- BG_EY_FPOINTS_TICK_TIME = (2*IN_MILLISECONDS),
+ BG_EY_FPOINTS_TICK_TIME = (2*IN_MILLISECONDS)
};
enum BG_EY_WorldStates
diff --git a/src/server/game/Battlegrounds/Zones/BattlegroundIC.cpp b/src/server/game/Battlegrounds/Zones/BattlegroundIC.cpp
index 202869567d8..90571dfb758 100755
--- a/src/server/game/Battlegrounds/Zones/BattlegroundIC.cpp
+++ b/src/server/game/Battlegrounds/Zones/BattlegroundIC.cpp
@@ -57,7 +57,8 @@ BattlegroundIC::BattlegroundIC()
BattlegroundIC::~BattlegroundIC()
{
-
+ delete gunshipHorde;
+ delete gunshipAlliance;
}
void BattlegroundIC::HandlePlayerResurrect(Player* player)
diff --git a/src/server/game/Battlegrounds/Zones/BattlegroundIC.h b/src/server/game/Battlegrounds/Zones/BattlegroundIC.h
index 90f39a61e12..20f44acc14f 100755
--- a/src/server/game/Battlegrounds/Zones/BattlegroundIC.h
+++ b/src/server/game/Battlegrounds/Zones/BattlegroundIC.h
@@ -178,7 +178,7 @@ enum gameobjectsIC
GO_HORDE_BANNER_GRAVEYARD_H_CONT = 195394,
GO_HORDE_GUNSHIP = 195276,
- GO_ALLIANCE_GUNSHIP = 195121,
+ GO_ALLIANCE_GUNSHIP = 195121
};
#define MAX_REINFORCEMENTS 300
@@ -336,7 +336,7 @@ enum BG_IC_GOs
BG_IC_GO_TELEPORTER_EFFECTS_H_3,
BG_IC_GO_TELEPORTER_EFFECTS_H_4,
BG_IC_GO_TELEPORTER_EFFECTS_H_5,
- BG_IC_GO_TELEPORTER_EFFECTS_H_6,
+ BG_IC_GO_TELEPORTER_EFFECTS_H_6
};
enum BG_IC_NPCs
@@ -411,7 +411,7 @@ enum BG_IC_NPCs
BG_IC_NPC_SPIRIT_GUIDE_4,
BG_IC_NPC_SPIRIT_GUIDE_5,
BG_IC_NPC_SPIRIT_GUIDE_6,
- BG_IC_NPC_SPIRIT_GUIDE_7,
+ BG_IC_NPC_SPIRIT_GUIDE_7
};
enum BannersTypes
@@ -751,7 +751,7 @@ enum ICDoorList
BG_IC_A_FRONT,
BG_IC_A_WEST,
BG_IC_A_EAST,
- BG_IC_MAXDOOR,
+ BG_IC_MAXDOOR
};
enum ICNodePointType
diff --git a/src/server/game/Battlegrounds/Zones/BattlegroundRV.h b/src/server/game/Battlegrounds/Zones/BattlegroundRV.h
index 8c5746931e3..d8ac082ec19 100755
--- a/src/server/game/Battlegrounds/Zones/BattlegroundRV.h
+++ b/src/server/game/Battlegrounds/Zones/BattlegroundRV.h
@@ -46,7 +46,7 @@ enum BattlegroundRVObjectTypes
BG_RV_OBJECT_ELEVATOR_1,
BG_RV_OBJECT_ELEVATOR_2,
- BG_RV_OBJECT_MAX,
+ BG_RV_OBJECT_MAX
};
enum BattlegroundRVObjects
@@ -73,7 +73,7 @@ enum BattlegroundRVObjects
BG_RV_OBJECT_TYPE_PILAR_1 = 194583, // axe
BG_RV_OBJECT_TYPE_PILAR_2 = 194584, // arena
BG_RV_OBJECT_TYPE_PILAR_3 = 194585, // lightning
- BG_RV_OBJECT_TYPE_PILAR_4 = 194587, // ivory
+ BG_RV_OBJECT_TYPE_PILAR_4 = 194587 // ivory
};
enum BattlegroundRVData
@@ -88,7 +88,7 @@ enum BattlegroundRVData
BG_RV_FIRST_TIMER = 20133,
BG_RV_WORLD_STATE_A = 0xe10,
BG_RV_WORLD_STATE_H = 0xe11,
- BG_RV_WORLD_STATE = 0xe1a,
+ BG_RV_WORLD_STATE = 0xe1a
};
class BattlegroundRVScore : public BattlegroundScore
diff --git a/src/server/game/Battlegrounds/Zones/BattlegroundSA.h b/src/server/game/Battlegrounds/Zones/BattlegroundSA.h
index fd11cb2c5ea..78653a993a0 100755
--- a/src/server/game/Battlegrounds/Zones/BattlegroundSA.h
+++ b/src/server/game/Battlegrounds/Zones/BattlegroundSA.h
@@ -104,7 +104,7 @@ enum BG_SA_WorldStates
BG_SA_LEFT_GY_HORDE = 3633,
BG_SA_CENTER_GY_HORDE = 3634,
BG_SA_BONUS_TIMER = 0xdf3,
- BG_SA_ENABLE_TIMER = 3564,
+ BG_SA_ENABLE_TIMER = 3564
};
enum npc
@@ -112,7 +112,7 @@ enum npc
NPC_ANTI_PERSONNAL_CANNON = 27894,
NPC_DEMOLISHER_SA = 28781,
NPC_RIGGER_SPARKLIGHT = 29260,
- NPC_GORGRIL_RIGSPARK = 29262,
+ NPC_GORGRIL_RIGSPARK = 29262
};
enum BG_SA_NPCs
@@ -146,7 +146,7 @@ enum BG_SA_Boat
BG_SA_BOAT_ONE_A = 193182,
BG_SA_BOAT_TWO_H = 193183,
BG_SA_BOAT_ONE_H = 193184,
- BG_SA_BOAT_TWO_A = 193185,
+ BG_SA_BOAT_TWO_A = 193185
};
uint32 const BG_SA_NpcEntries[BG_SA_MAXNPC] =
diff --git a/src/server/game/Battlegrounds/Zones/BattlegroundWS.cpp b/src/server/game/Battlegrounds/Zones/BattlegroundWS.cpp
index 483e8ffdaf6..e4803af8a21 100755
--- a/src/server/game/Battlegrounds/Zones/BattlegroundWS.cpp
+++ b/src/server/game/Battlegrounds/Zones/BattlegroundWS.cpp
@@ -52,6 +52,8 @@ BattlegroundWS::BattlegroundWS()
StartMessageIds[BG_STARTING_EVENT_SECOND] = LANG_BG_WS_START_ONE_MINUTE;
StartMessageIds[BG_STARTING_EVENT_THIRD] = LANG_BG_WS_START_HALF_MINUTE;
StartMessageIds[BG_STARTING_EVENT_FOURTH] = LANG_BG_WS_HAS_BEGUN;
+ _flagSpellForceTimer = 0;
+ _bothFlagsKept = false;
_flagDebuffState = 0;
}
@@ -700,28 +702,39 @@ void BattlegroundWS::Reset()
//call parent's class reset
Battleground::Reset();
- m_FlagKeepers[BG_TEAM_ALLIANCE] = 0;
- m_FlagKeepers[BG_TEAM_HORDE] = 0;
+ m_FlagKeepers[BG_TEAM_ALLIANCE] = 0;
+ m_FlagKeepers[BG_TEAM_HORDE] = 0;
+
m_DroppedFlagGUID[BG_TEAM_ALLIANCE] = 0;
- m_DroppedFlagGUID[BG_TEAM_HORDE] = 0;
- _flagState[BG_TEAM_ALLIANCE] = BG_WS_FLAG_STATE_ON_BASE;
- _flagState[BG_TEAM_HORDE] = BG_WS_FLAG_STATE_ON_BASE;
- m_TeamScores[BG_TEAM_ALLIANCE] = 0;
- m_TeamScores[BG_TEAM_HORDE] = 0;
- bool isBGWeekend = sBattlegroundMgr->IsBGWeekend(GetTypeID());
- m_ReputationCapture = (isBGWeekend) ? 45 : 35;
- m_HonorWinKills = (isBGWeekend) ? 3 : 1;
- m_HonorEndKills = (isBGWeekend) ? 4 : 2;
- // For WorldState
- _minutesElapsed = 0;
- _lastFlagCaptureTeam = 0;
-
- /* Spirit nodes is static at this BG and then not required deleting at BG reset.
- if (BgCreatures[WS_SPIRIT_MAIN_ALLIANCE])
- DelCreature(WS_SPIRIT_MAIN_ALLIANCE);
- if (BgCreatures[WS_SPIRIT_MAIN_HORDE])
- DelCreature(WS_SPIRIT_MAIN_HORDE);
- */
+ m_DroppedFlagGUID[BG_TEAM_HORDE] = 0;
+
+ _flagState[BG_TEAM_ALLIANCE] = BG_WS_FLAG_STATE_ON_BASE;
+ _flagState[BG_TEAM_HORDE] = BG_WS_FLAG_STATE_ON_BASE;
+
+ m_TeamScores[BG_TEAM_ALLIANCE] = 0;
+ m_TeamScores[BG_TEAM_HORDE] = 0;
+
+ if (sBattlegroundMgr->IsBGWeekend(GetTypeID()))
+ {
+ m_ReputationCapture = 45;
+ m_HonorWinKills = 3;
+ m_HonorEndKills = 4;
+ }
+ else
+ {
+ m_ReputationCapture = 35;
+ m_HonorWinKills = 1;
+ m_HonorEndKills = 2;
+ }
+ _minutesElapsed = 0;
+ _lastFlagCaptureTeam = 0;
+ _bothFlagsKept = false;
+ _flagDebuffState = 0;
+ _flagSpellForceTimer = 0;
+ _flagsDropTimer[BG_TEAM_ALLIANCE] = 0;
+ _flagsDropTimer[BG_TEAM_HORDE] = 0;
+ _flagsTimer[BG_TEAM_ALLIANCE] = 0;
+ _flagsTimer[BG_TEAM_HORDE] = 0;
}
void BattlegroundWS::EndBattleground(uint32 winner)
diff --git a/src/server/game/CMakeLists.txt b/src/server/game/CMakeLists.txt
index a83e77e6632..68ae2d8ea38 100644
--- a/src/server/game/CMakeLists.txt
+++ b/src/server/game/CMakeLists.txt
@@ -17,6 +17,7 @@ file(GLOB_RECURSE sources_Achievements Achievements/*.cpp Achievements/*.h)
file(GLOB_RECURSE sources_Addons Addons/*.cpp Addons/*.h)
file(GLOB_RECURSE sources_AI AI/*.cpp AI/*.h)
file(GLOB_RECURSE sources_AuctionHouse AuctionHouse/*.cpp AuctionHouse/*.h)
+file(GLOB_RECURSE sources_Battlefield Battlefield/*.cpp Battlefield/*.h)
file(GLOB_RECURSE sources_Battlegrounds Battlegrounds/*.cpp Battlegrounds/*.h)
file(GLOB_RECURSE sources_Calendar Calendar/*.cpp Calendar/*.h)
file(GLOB_RECURSE sources_Chat Chat/*.cpp Chat/*.h)
@@ -68,6 +69,7 @@ set(game_STAT_SRCS
${sources_Addons}
${sources_AI}
${sources_AuctionHouse}
+ ${sources_Battlefield}
${sources_Battlegrounds}
${sources_Calendar}
${sources_Chat}
@@ -136,6 +138,8 @@ include_directories(
${CMAKE_CURRENT_SOURCE_DIR}/AI/ScriptedAI
${CMAKE_CURRENT_SOURCE_DIR}/AI/SmartScripts
${CMAKE_CURRENT_SOURCE_DIR}/AuctionHouse
+ ${CMAKE_CURRENT_SOURCE_DIR}/Battlefield
+ ${CMAKE_CURRENT_SOURCE_DIR}/Battlefield/Zones
${CMAKE_CURRENT_SOURCE_DIR}/Battlegrounds
${CMAKE_CURRENT_SOURCE_DIR}/Battlegrounds/Zones
${CMAKE_CURRENT_SOURCE_DIR}/Calendar
diff --git a/src/server/game/Chat/Channels/Channel.h b/src/server/game/Chat/Channels/Channel.h
index 9564dbb381e..04bb4ae2916 100755
--- a/src/server/game/Chat/Channels/Channel.h
+++ b/src/server/game/Chat/Channels/Channel.h
@@ -68,7 +68,7 @@ enum ChatNotify
CHAT_NOT_IN_AREA_NOTICE = 0x20, //+ "[%s] You are not in the correct area for this channel."; -- The user is trying to send a chat to a zone specific channel, and they're not physically in that zone.
CHAT_NOT_IN_LFG_NOTICE = 0x21, //+ "[%s] You must be queued in looking for group before joining this channel."; -- The user must be in the looking for group system to join LFG chat channels.
CHAT_VOICE_ON_NOTICE = 0x22, //+ "[%s] Channel voice enabled by %s.";
- CHAT_VOICE_OFF_NOTICE = 0x23, //+ "[%s] Channel voice disabled by %s.";
+ CHAT_VOICE_OFF_NOTICE = 0x23 //+ "[%s] Channel voice disabled by %s.";
};
enum ChannelFlags
@@ -101,7 +101,7 @@ enum ChannelDBCFlags
CHANNEL_DBC_FLAG_DEFENSE = 0x10000, // LocalDefense, WorldDefense
CHANNEL_DBC_FLAG_GUILD_REQ = 0x20000, // GuildRecruitment
CHANNEL_DBC_FLAG_LFG = 0x40000, // LFG
- CHANNEL_DBC_FLAG_UNK1 = 0x80000, // General
+ CHANNEL_DBC_FLAG_UNK1 = 0x80000 // General
};
enum ChannelMemberFlags
@@ -112,7 +112,7 @@ enum ChannelMemberFlags
MEMBER_FLAG_VOICED = 0x04,
MEMBER_FLAG_MUTED = 0x08,
MEMBER_FLAG_CUSTOM = 0x10,
- MEMBER_FLAG_MIC_MUTED = 0x20,
+ MEMBER_FLAG_MIC_MUTED = 0x20
// 0x40
// 0x80
};
diff --git a/src/server/game/Chat/Chat.h b/src/server/game/Chat/Chat.h
index 269ebdd1d2f..d4701b10ce1 100755
--- a/src/server/game/Chat/Chat.h
+++ b/src/server/game/Chat/Chat.h
@@ -47,8 +47,8 @@ class ChatHandler
{
public:
WorldSession* GetSession() { return m_session; }
- explicit ChatHandler(WorldSession* session) : m_session(session) {}
- explicit ChatHandler(Player* player) : m_session(player->GetSession()) {}
+ explicit ChatHandler(WorldSession* session) : m_session(session), sentErrorMessage(false) {}
+ explicit ChatHandler(Player* player) : m_session(player->GetSession()), sentErrorMessage(false) {}
virtual ~ChatHandler() {}
static void FillMessageData(WorldPacket* data, WorldSession* session, uint8 type, uint32 language, const char *channelName, uint64 target_guid, const char *message, Unit* speaker);
@@ -126,7 +126,7 @@ class ChatHandler
bool ShowHelpForCommand(ChatCommand* table, const char* cmd);
protected:
- explicit ChatHandler() : m_session(NULL) {} // for CLI subclass
+ explicit ChatHandler() : m_session(NULL), sentErrorMessage(false) {} // for CLI subclass
static bool SetDataForCommandInTable(ChatCommand* table, const char* text, uint32 security, std::string const& help, std::string const& fullcommand);
bool ExecuteCommandInTable(ChatCommand* table, const char* text, const std::string& fullcmd);
bool ShowHelpForSubCommands(ChatCommand* table, char const* cmd, char const* subcmd);
diff --git a/src/server/game/Combat/UnitEvents.h b/src/server/game/Combat/UnitEvents.h
index de60491de89..8d57ef6c59c 100755
--- a/src/server/game/Combat/UnitEvents.h
+++ b/src/server/game/Combat/UnitEvents.h
@@ -49,7 +49,7 @@ enum UNIT_EVENT_TYPE
UEV_THREAT_SET_NEXT_TARGET = 1<<5,
// A new victim (target) was set. Could be NULL
- UEV_THREAT_VICTIM_CHANGED = 1<<6,
+ UEV_THREAT_VICTIM_CHANGED = 1<<6
// Future use
//UEV_UNIT_KILLED = 1<<7,
@@ -123,8 +123,8 @@ class ThreatManagerEvent : public ThreatRefStatusChangeEvent
private:
ThreatContainer* iThreatContainer;
public:
- ThreatManagerEvent(uint32 pType) : ThreatRefStatusChangeEvent(pType) {}
- ThreatManagerEvent(uint32 pType, HostileReference* pHostileReference) : ThreatRefStatusChangeEvent(pType, pHostileReference) {}
+ ThreatManagerEvent(uint32 pType) : ThreatRefStatusChangeEvent(pType), iThreatContainer(NULL) {}
+ ThreatManagerEvent(uint32 pType, HostileReference* pHostileReference) : ThreatRefStatusChangeEvent(pType, pHostileReference), iThreatContainer(NULL) {}
void setThreatContainer(ThreatContainer* pThreatContainer) { iThreatContainer = pThreatContainer; }
diff --git a/src/server/game/Conditions/ConditionMgr.cpp b/src/server/game/Conditions/ConditionMgr.cpp
index 67ba643dd97..ddf450d2d56 100755
--- a/src/server/game/Conditions/ConditionMgr.cpp
+++ b/src/server/game/Conditions/ConditionMgr.cpp
@@ -279,6 +279,11 @@ bool Condition::Meets(ConditionSourceInfo& sourceInfo)
condMeets = player->HasTitle(ConditionValue1);
break;
}
+ case CONDITION_SPAWNMASK:
+ {
+ condMeets = ((1 << object->GetMap()->GetSpawnMode()) & ConditionValue1);
+ break;
+ }
default:
condMeets = false;
break;
@@ -430,6 +435,9 @@ uint32 Condition::GetSearcherTypeMaskForCondition()
case CONDITION_TITLE:
mask |= GRID_MAP_TYPE_MASK_PLAYER;
break;
+ case CONDITION_SPAWNMASK:
+ mask |= GRID_MAP_TYPE_MASK_ALL;
+ break;
default:
ASSERT(false && "Condition::GetSearcherTypeMaskForCondition - missing condition handling!");
break;
@@ -867,7 +875,6 @@ void ConditionMgr::LoadConditions(bool isReload)
valid = true;
++count;
continue; // do not add to m_AllocatedMemory to avoid double deleting
- break;
}
case CONDITION_SOURCE_TYPE_SPELL_IMPLICIT_TARGET:
valid = addToSpellImplicitTargetConditions(cond);
@@ -926,7 +933,7 @@ void ConditionMgr::LoadConditions(bool isReload)
}
while (result->NextRow());
- sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded %u conditions in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u conditions in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
}
@@ -1843,9 +1850,15 @@ bool ConditionMgr::isConditionTypeValid(Condition* cond)
}
break;
}
- case CONDITION_UNUSED_19:
- sLog->outError(LOG_FILTER_SQL, "Found ConditionTypeOrReference = CONDITION_UNUSED_19 in `conditions` table - ignoring");
- return false;
+ case CONDITION_SPAWNMASK:
+ {
+ if (cond->ConditionValue1 > SPAWNMASK_RAID_ALL)
+ {
+ sLog->outError(LOG_FILTER_SQL, "SpawnMask condition has non existing SpawnMask in value1 (%u), skipped", cond->ConditionValue1);
+ return false;
+ }
+ break;
+ }
case CONDITION_UNUSED_20:
sLog->outError(LOG_FILTER_SQL, "Found ConditionTypeOrReference = CONDITION_UNUSED_20 in `conditions` table - ignoring");
return false;
diff --git a/src/server/game/Conditions/ConditionMgr.h b/src/server/game/Conditions/ConditionMgr.h
index 130a23a0cb0..bd72015d76f 100755
--- a/src/server/game/Conditions/ConditionMgr.h
+++ b/src/server/game/Conditions/ConditionMgr.h
@@ -49,7 +49,7 @@ enum ConditionTypes
CONDITION_RACE = 16, // race 0 0 true if player's race is equal to race
CONDITION_ACHIEVEMENT = 17, // achievement_id 0 0 true if achievement is complete
CONDITION_TITLE = 18, // title id 0 0 true if player has title
- CONDITION_UNUSED_19 = 19, //
+ CONDITION_SPAWNMASK = 19, // spawnMask 0 0 true if in spawnMask
CONDITION_UNUSED_20 = 20, //
CONDITION_UNUSED_21 = 21, //
CONDITION_MAPID = 22, // map_id 0 0 true if in map_id
@@ -149,7 +149,7 @@ enum RelationType
enum
{
- MAX_CONDITION_TARGETS = 3,
+ MAX_CONDITION_TARGETS = 3
};
struct ConditionSourceInfo
diff --git a/src/server/game/Conditions/DisableMgr.cpp b/src/server/game/Conditions/DisableMgr.cpp
index 6215cf5bb75..27695f3eafa 100755
--- a/src/server/game/Conditions/DisableMgr.cpp
+++ b/src/server/game/Conditions/DisableMgr.cpp
@@ -59,7 +59,7 @@ void LoadDisables()
if (!result)
{
- sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded 0 disables. DB table `disables` is empty!");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 disables. DB table `disables` is empty!");
return;
}
@@ -228,7 +228,7 @@ void LoadDisables()
}
while (result->NextRow());
- sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded %u disables in %u ms", total_count, GetMSTimeDiffToNow(oldMSTime));
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u disables in %u ms", total_count, GetMSTimeDiffToNow(oldMSTime));
}
@@ -239,7 +239,7 @@ void CheckQuestDisables()
uint32 count = m_DisableMap[DISABLE_TYPE_QUEST].size();
if (!count)
{
- sLog->outInfo(LOG_FILTER_GENERAL, ">> Checked 0 quest disables.");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Checked 0 quest disables.");
return;
}
@@ -259,7 +259,7 @@ void CheckQuestDisables()
++itr;
}
- sLog->outInfo(LOG_FILTER_GENERAL, ">> Checked %u quest disables in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Checked %u quest disables in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
}
diff --git a/src/server/game/Conditions/DisableMgr.h b/src/server/game/Conditions/DisableMgr.h
index 0f9310ace3b..b1bb43315bd 100755
--- a/src/server/game/Conditions/DisableMgr.h
+++ b/src/server/game/Conditions/DisableMgr.h
@@ -31,7 +31,7 @@ enum DisableType
DISABLE_TYPE_BATTLEGROUND = 3,
DISABLE_TYPE_ACHIEVEMENT_CRITERIA = 4,
DISABLE_TYPE_OUTDOORPVP = 5,
- DISABLE_TYPE_VMAP = 6,
+ DISABLE_TYPE_VMAP = 6
};
enum SpellDisableTypes
@@ -43,7 +43,7 @@ enum SpellDisableTypes
SPELL_DISABLE_MAP = 0x10,
SPELL_DISABLE_AREA = 0x20,
MAX_SPELL_DISABLE_TYPE = ( SPELL_DISABLE_PLAYER | SPELL_DISABLE_CREATURE | SPELL_DISABLE_PET |
- SPELL_DISABLE_DEPRECATED_SPELL | SPELL_DISABLE_MAP | SPELL_DISABLE_AREA),
+ SPELL_DISABLE_DEPRECATED_SPELL | SPELL_DISABLE_MAP | SPELL_DISABLE_AREA)
};
enum VmapDisableTypes
@@ -51,7 +51,7 @@ enum VmapDisableTypes
VMAP_DISABLE_AREAFLAG = 0x1,
VMAP_DISABLE_HEIGHT = 0x2,
VMAP_DISABLE_LOS = 0x4,
- VMAP_DISABLE_LIQUIDSTATUS = 0x8,
+ VMAP_DISABLE_LIQUIDSTATUS = 0x8
};
namespace DisableMgr
diff --git a/src/server/game/DataStores/DBCEnums.h b/src/server/game/DataStores/DBCEnums.h
index e73480cb4de..12ec7206141 100755
--- a/src/server/game/DataStores/DBCEnums.h
+++ b/src/server/game/DataStores/DBCEnums.h
@@ -53,7 +53,7 @@ enum AchievementFaction
{
ACHIEVEMENT_FACTION_HORDE = 0,
ACHIEVEMENT_FACTION_ALLIANCE = 1,
- ACHIEVEMENT_FACTION_ANY = -1,
+ ACHIEVEMENT_FACTION_ANY = -1
};
enum AchievementFlags
@@ -67,7 +67,7 @@ enum AchievementFlags
ACHIEVEMENT_FLAG_AVERAGE = 0x00000040, // Show as average value (value / time_in_days) depend from other flag (by def use last criteria value)
ACHIEVEMENT_FLAG_BAR = 0x00000080, // Show as progress bar (value / max vale) depend from other flag (by def use last criteria value)
ACHIEVEMENT_FLAG_REALM_FIRST_REACH = 0x00000100, //
- ACHIEVEMENT_FLAG_REALM_FIRST_KILL = 0x00000200, //
+ ACHIEVEMENT_FLAG_REALM_FIRST_KILL = 0x00000200 //
};
#define MAX_CRITERIA_REQUIREMENTS 2
@@ -81,7 +81,7 @@ enum AchievementCriteriaCondition
ACHIEVEMENT_CRITERIA_CONDITION_NO_LOSE = 4, // only used in "Win 10 arenas without losing"
ACHIEVEMENT_CRITERIA_CONDITION_NO_SPELL_HIT = 9, // requires the player not to be hit by specific spell
ACHIEVEMENT_CRITERIA_CONDITION_NOT_IN_GROUP = 10, // requires the player not to be in group
- ACHIEVEMENT_CRITERIA_CONDITION_UNK3 = 13, // unk
+ ACHIEVEMENT_CRITERIA_CONDITION_UNK3 = 13 // unk
};
enum AchievementCriteriaFlags
@@ -91,7 +91,7 @@ enum AchievementCriteriaFlags
ACHIEVEMENT_CRITERIA_FLAG_UNK3 = 0x00000004, // BG related??
ACHIEVEMENT_CRITERIA_FLAG_UNK4 = 0x00000008, //
ACHIEVEMENT_CRITERIA_FLAG_UNK5 = 0x00000010, // not used
- ACHIEVEMENT_CRITERIA_FLAG_MONEY_COUNTER = 0x00000020, // Displays counter as money
+ ACHIEVEMENT_CRITERIA_FLAG_MONEY_COUNTER = 0x00000020 // Displays counter as money
};
enum AchievementCriteriaTimedTypes
@@ -103,7 +103,7 @@ enum AchievementCriteriaTimedTypes
ACHIEVEMENT_TIMED_TYPE_CREATURE = 7, // Timer is started by killing creature with entry in timerStartEvent
ACHIEVEMENT_TIMED_TYPE_ITEM = 9, // Timer is started by using item with entry in timerStartEvent
- ACHIEVEMENT_TIMED_TYPE_MAX,
+ ACHIEVEMENT_TIMED_TYPE_MAX
};
enum AchievementCriteriaTypes
@@ -223,12 +223,12 @@ enum AchievementCriteriaTypes
// 122
// 123
// 0..123 => 124 criteria types total
- ACHIEVEMENT_CRITERIA_TYPE_TOTAL = 124,
+ ACHIEVEMENT_CRITERIA_TYPE_TOTAL = 124
};
enum AchievementCategory
{
- CATEGORY_CHILDRENS_WEEK = 163,
+ CATEGORY_CHILDRENS_WEEK = 163
};
enum AreaFlags
@@ -275,7 +275,7 @@ enum Difficulty
RAID_DIFFICULTY_10MAN_NORMAL = 0,
RAID_DIFFICULTY_25MAN_NORMAL = 1,
RAID_DIFFICULTY_10MAN_HEROIC = 2,
- RAID_DIFFICULTY_25MAN_HEROIC = 3,
+ RAID_DIFFICULTY_25MAN_HEROIC = 3
};
#define RAID_DIFFICULTY_MASK_25MAN 1 // since 25man difficulties are 1 and 3, we can check them like that
@@ -300,14 +300,14 @@ enum SpawnMask
SPAWNMASK_RAID_25MAN_HEROIC = (1 << RAID_DIFFICULTY_25MAN_HEROIC),
SPAWNMASK_RAID_HEROIC_ALL = (SPAWNMASK_RAID_10MAN_HEROIC | SPAWNMASK_RAID_25MAN_HEROIC),
- SPAWNMASK_RAID_ALL = (SPAWNMASK_RAID_NORMAL_ALL | SPAWNMASK_RAID_HEROIC_ALL),
+ SPAWNMASK_RAID_ALL = (SPAWNMASK_RAID_NORMAL_ALL | SPAWNMASK_RAID_HEROIC_ALL)
};
enum FactionTemplateFlags
{
FACTION_TEMPLATE_FLAG_PVP = 0x00000800, // flagged for PvP
FACTION_TEMPLATE_FLAG_CONTESTED_GUARD = 0x00001000, // faction will attack players that were involved in PvP combats
- FACTION_TEMPLATE_FLAG_HOSTILE_BY_DEFAULT= 0x00002000,
+ FACTION_TEMPLATE_FLAG_HOSTILE_BY_DEFAULT= 0x00002000
};
enum FactionMasks
@@ -350,7 +350,7 @@ enum ItemEnchantmentType
enum ItemLimitCategoryMode
{
ITEM_LIMIT_CATEGORY_MODE_HAVE = 0, // limit applied to amount items in inventory/bank
- ITEM_LIMIT_CATEGORY_MODE_EQUIP = 1, // limit applied to amount equipped items (including used gems)
+ ITEM_LIMIT_CATEGORY_MODE_EQUIP = 1 // limit applied to amount equipped items (including used gems)
};
enum TotemCategoryType
@@ -411,7 +411,7 @@ enum SummonPropFlags
SUMMON_PROP_FLAG_UNK13 = 0x00001000, // Lightwell, Jeeves, Gnomish Alarm-o-bot, Build vehicles(wintergrasp)
SUMMON_PROP_FLAG_UNK14 = 0x00002000, // Guides, player follows
SUMMON_PROP_FLAG_UNK15 = 0x00004000, // Force of Nature, Shadowfiend, Feral Spirit, Summon Water Elemental
- SUMMON_PROP_FLAG_UNK16 = 0x00008000, // Light/Dark Bullet, Soul/Fiery Consumption, Twisted Visage, Twilight Whelp. Phase related?
+ SUMMON_PROP_FLAG_UNK16 = 0x00008000 // Light/Dark Bullet, Soul/Fiery Consumption, Twisted Visage, Twilight Whelp. Phase related?
};
enum VehicleSeatFlags
@@ -436,7 +436,7 @@ enum VehicleSeatFlags
VEHICLE_SEAT_FLAG_HAS_START_WARITING_FOR_VEH_TRANSITION_ANIM_EXIT = 0x10000000,
VEHICLE_SEAT_FLAG_CAN_CAST = 0x20000000, // Lua_UnitHasVehicleUI
VEHICLE_SEAT_FLAG_UNK2 = 0x40000000, // checked in conjunction with 0x800 in CastSpell2
- VEHICLE_SEAT_FLAG_ALLOWS_INTERACTION = 0x80000000,
+ VEHICLE_SEAT_FLAG_ALLOWS_INTERACTION = 0x80000000
};
enum VehicleSeatFlagsB
@@ -449,7 +449,7 @@ enum VehicleSeatFlagsB
VEHICLE_SEAT_FLAG_B_USABLE_FORCED_3 = 0x00000100,
VEHICLE_SEAT_FLAG_B_USABLE_FORCED_4 = 0x02000000,
VEHICLE_SEAT_FLAG_B_CAN_SWITCH = 0x04000000,
- VEHICLE_SEAT_FLAG_B_VEHICLE_PLAYERFRAME_UI = 0x80000000, // Lua_UnitHasVehiclePlayerFrameUI - actually checked for flagsb &~ 0x80000000
+ VEHICLE_SEAT_FLAG_B_VEHICLE_PLAYERFRAME_UI = 0x80000000 // Lua_UnitHasVehiclePlayerFrameUI - actually checked for flagsb &~ 0x80000000
};
#endif
diff --git a/src/server/game/DataStores/DBCStores.cpp b/src/server/game/DataStores/DBCStores.cpp
index 48ceda2a212..850c58bdf93 100755
--- a/src/server/game/DataStores/DBCStores.cpp
+++ b/src/server/game/DataStores/DBCStores.cpp
@@ -636,7 +636,7 @@ void LoadDBCStores(const std::string& dataPath)
exit(1);
}
- sLog->outInfo(LOG_FILTER_GENERAL, ">> Initialized %d data stores in %u ms", DBCFileCount, GetMSTimeDiffToNow(oldMSTime));
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Initialized %d data stores in %u ms", DBCFileCount, GetMSTimeDiffToNow(oldMSTime));
}
diff --git a/src/server/game/DataStores/DBCStructure.h b/src/server/game/DataStores/DBCStructure.h
index fdec06f6f48..ef949f43f49 100755
--- a/src/server/game/DataStores/DBCStructure.h
+++ b/src/server/game/DataStores/DBCStructure.h
@@ -1092,7 +1092,7 @@ struct ItemEntry
uint32 ID; // 0
uint32 Class; // 1
uint32 SubClass; // 2 some items have strange subclasses
- int32 Unk0; // 3
+ int32 SoundOverrideSubclass; // 3
int32 Material; // 4
uint32 DisplayId; // 5
uint32 InventoryType; // 6
diff --git a/src/server/game/DungeonFinding/LFGMgr.cpp b/src/server/game/DungeonFinding/LFGMgr.cpp
index 3a2a044ca3b..bb6c1dfdcc1 100755
--- a/src/server/game/DungeonFinding/LFGMgr.cpp
+++ b/src/server/game/DungeonFinding/LFGMgr.cpp
@@ -135,8 +135,7 @@ void LFGMgr::LoadRewards()
if (!result)
{
- sLog->outError(LOG_FILTER_SQL, ">> Loaded 0 lfg dungeon rewards. DB table `lfg_dungeon_rewards` is empty!");
-
+ sLog->outError(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 lfg dungeon rewards. DB table `lfg_dungeon_rewards` is empty!");
return;
}
@@ -183,8 +182,7 @@ void LFGMgr::LoadRewards()
++count;
} while (result->NextRow());
- sLog->outInfo(LOG_FILTER_LFG, ">> Loaded %u lfg dungeon rewards in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
-
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u lfg dungeon rewards in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
}
void LFGMgr::Update(uint32 diff)
@@ -1241,11 +1239,11 @@ LfgAnswer LFGMgr::GetCompatibles(std::string key)
void LFGMgr::GetCompatibleDungeons(LfgDungeonSet& dungeons, const PlayerSet& players, LfgLockPartyMap& lockMap)
{
lockMap.clear();
- for (PlayerSet::const_iterator it = players.begin(); it != players.end() && dungeons.size(); ++it)
+ for (PlayerSet::const_iterator it = players.begin(); it != players.end() && !dungeons.empty(); ++it)
{
uint64 guid = (*it)->GetGUID();
LfgLockMap cachedLockMap = GetLockedDungeons(guid);
- for (LfgLockMap::const_iterator it2 = cachedLockMap.begin(); it2 != cachedLockMap.end() && dungeons.size(); ++it2)
+ for (LfgLockMap::const_iterator it2 = cachedLockMap.begin(); it2 != cachedLockMap.end() && !dungeons.empty(); ++it2)
{
uint32 dungeonId = (it2->first & 0x00FFFFFF); // Compare dungeon ids
LfgDungeonSet::iterator itDungeon = dungeons.find(dungeonId);
diff --git a/src/server/game/DungeonFinding/LFGMgr.h b/src/server/game/DungeonFinding/LFGMgr.h
index f21818deb64..e341b21706f 100755
--- a/src/server/game/DungeonFinding/LFGMgr.h
+++ b/src/server/game/DungeonFinding/LFGMgr.h
@@ -29,7 +29,7 @@ class Player;
enum LFGenum
{
- LFG_TIME_ROLECHECK = 2*MINUTE,
+ LFG_TIME_ROLECHECK = 40*IN_MILLISECONDS,
LFG_TIME_BOOT = 2*MINUTE,
LFG_TIME_PROPOSAL = 2*MINUTE,
LFG_TANKS_NEEDED = 1,
diff --git a/src/server/game/Entities/Corpse/Corpse.cpp b/src/server/game/Entities/Corpse/Corpse.cpp
index 60c0b7ad394..9359581e3a0 100755
--- a/src/server/game/Entities/Corpse/Corpse.cpp
+++ b/src/server/game/Entities/Corpse/Corpse.cpp
@@ -26,8 +26,7 @@
#include "GossipDef.h"
#include "World.h"
-Corpse::Corpse(CorpseType type) : WorldObject(type != CORPSE_BONES)
-, m_type(type)
+Corpse::Corpse(CorpseType type) : WorldObject(type != CORPSE_BONES), m_type(type)
{
m_objectType |= TYPEMASK_CORPSE;
m_objectTypeId = TYPEID_CORPSE;
@@ -39,6 +38,7 @@ Corpse::Corpse(CorpseType type) : WorldObject(type != CORPSE_BONES)
m_time = time(NULL);
lootForBody = false;
+ lootRecipient = NULL;
}
Corpse::~Corpse()
diff --git a/src/server/game/Entities/Creature/Creature.cpp b/src/server/game/Entities/Creature/Creature.cpp
index 866437d828c..b92c3048b45 100755
--- a/src/server/game/Entities/Creature/Creature.cpp
+++ b/src/server/game/Entities/Creature/Creature.cpp
@@ -380,6 +380,7 @@ bool Creature::UpdateEntry(uint32 Entry, uint32 team, const CreatureData* data)
SetAttackTime(RANGED_ATTACK, cInfo->rangeattacktime);
SetUInt32Value(UNIT_FIELD_FLAGS, unit_flags);
+ SetUInt32Value(UNIT_FIELD_FLAGS_2, cInfo->unit_flags2);
SetUInt32Value(UNIT_DYNAMIC_FLAGS, dynamicflags);
@@ -2230,6 +2231,38 @@ bool Creature::HasSpellCooldown(uint32 spell_id) const
return (itr != m_CreatureSpellCooldowns.end() && itr->second > time(NULL)) || HasCategoryCooldown(spell_id);
}
+void Creature::ProhibitSpellSchool(SpellSchoolMask idSchoolMask, uint32 unTimeMs)
+{
+ time_t curTime = time(NULL);
+ for (uint8 i = 0; i < CREATURE_MAX_SPELLS; ++i)
+ {
+ if (m_spells[i] == 0)
+ continue;
+
+ uint32 unSpellId = m_spells[i];
+ SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(unSpellId);
+ if (!spellInfo)
+ {
+ ASSERT(spellInfo);
+ continue;
+ }
+
+ // Not send cooldown for this spells
+ if (spellInfo->Attributes & SPELL_ATTR0_DISABLED_WHILE_ACTIVE)
+ continue;
+
+ if (spellInfo->PreventionType != SPELL_PREVENTION_TYPE_SILENCE)
+ continue;
+
+ if ((idSchoolMask & spellInfo->GetSchoolMask()) && GetCreatureSpellCooldownDelay(unSpellId) < unTimeMs)
+ {
+ _AddCreatureSpellCooldown(unSpellId, curTime + unTimeMs/IN_MILLISECONDS);
+ if (UnitAI* ai = GetAI())
+ ai->SpellInterrupted(unSpellId, unTimeMs);
+ }
+ }
+}
+
bool Creature::HasSpell(uint32 spellID) const
{
uint8 i;
@@ -2447,7 +2480,7 @@ void Creature::SetPosition(float x, float y, float z, float o)
GetMap()->CreatureRelocation(ToCreature(), x, y, z, o);
if (IsVehicle())
- GetVehicleKit()->RelocatePassengers(x, y, z, o);
+ GetVehicleKit()->RelocatePassengers();
}
bool Creature::IsDungeonBoss() const
diff --git a/src/server/game/Entities/Creature/Creature.h b/src/server/game/Entities/Creature/Creature.h
index c8ebf1aa13b..abab3738ff7 100755
--- a/src/server/game/Entities/Creature/Creature.h
+++ b/src/server/game/Entities/Creature/Creature.h
@@ -54,7 +54,7 @@ enum CreatureFlagsExtra
CREATURE_FLAG_EXTRA_NO_SKILLGAIN = 0x00040000, // creature won't increase weapon skills
CREATURE_FLAG_EXTRA_TAUNT_DIMINISH = 0x00080000, // Taunt is a subject to diminishing returns on this creautre
CREATURE_FLAG_EXTRA_ALL_DIMINISH = 0x00100000, // Creature is subject to all diminishing returns as player are
- CREATURE_FLAG_EXTRA_DUNGEON_BOSS = 0x10000000, // creature is a dungeon boss (SET DYNAMICALLY, DO NOT ADD IN DB)
+ CREATURE_FLAG_EXTRA_DUNGEON_BOSS = 0x10000000 // creature is a dungeon boss (SET DYNAMICALLY, DO NOT ADD IN DB)
};
#define CREATURE_FLAG_EXTRA_DB_ALLOWED (CREATURE_FLAG_EXTRA_INSTANCE_BIND | CREATURE_FLAG_EXTRA_CIVILIAN | \
@@ -111,6 +111,7 @@ struct CreatureTemplate
uint32 rangeattacktime;
uint32 unit_class; // enum Classes. Note only 4 classes are known for creatures.
uint32 unit_flags; // enum UnitFlags mask values
+ uint32 unit_flags2; // enum UnitFlags2 mask values
uint32 dynamicflags;
uint32 family; // enum CreatureFamily values (optional)
uint32 trainer_type;
@@ -411,15 +412,15 @@ typedef std::map<uint32, time_t> CreatureSpellCooldowns;
enum CreatureCellMoveState
{
- CREATURE_CELL_MOVE_NONE, //not in move list
- CREATURE_CELL_MOVE_ACTIVE, //in move list
- CREATURE_CELL_MOVE_INACTIVE, //in move list but should not move
+ CREATURE_CELL_MOVE_NONE, // not in move list
+ CREATURE_CELL_MOVE_ACTIVE, // in move list
+ CREATURE_CELL_MOVE_INACTIVE // in move list but should not move
};
class MapCreature
{
- friend class Map; //map for moving creatures
- friend class ObjectGridLoader; //grid loader for loading creatures
+ friend class Map; // map for moving creatures
+ friend class ObjectGridLoader; // grid loader for loading creatures
protected:
MapCreature() : _moveState(CREATURE_CELL_MOVE_NONE) {}
@@ -539,6 +540,13 @@ class Creature : public Unit, public GridObject<Creature>, public MapCreature
void AddCreatureSpellCooldown(uint32 spellid);
bool HasSpellCooldown(uint32 spell_id) const;
bool HasCategoryCooldown(uint32 spell_id) const;
+ uint32 GetCreatureSpellCooldownDelay(uint32 spellId) const
+ {
+ CreatureSpellCooldowns::const_iterator itr = m_CreatureSpellCooldowns.find(spellId);
+ time_t t = time(NULL);
+ return uint32(itr != m_CreatureSpellCooldowns.end() && itr->second > t ? itr->second - t : 0);
+ }
+ virtual void ProhibitSpellSchool(SpellSchoolMask idSchoolMask, uint32 unTimeMs);
bool HasSpell(uint32 spellID) const;
diff --git a/src/server/game/Entities/Creature/CreatureGroups.cpp b/src/server/game/Entities/Creature/CreatureGroups.cpp
index 21ed1a23828..8823a788555 100755
--- a/src/server/game/Entities/Creature/CreatureGroups.cpp
+++ b/src/server/game/Entities/Creature/CreatureGroups.cpp
@@ -84,8 +84,7 @@ void FormationMgr::LoadCreatureFormations()
if (!result)
{
- sLog->outError(LOG_FILTER_SQL, ">> Loaded 0 creatures in formations. DB table `creature_formations` is empty!");
-
+ sLog->outError(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 creatures in formations. DB table `creature_formations` is empty!");
return;
}
@@ -136,8 +135,7 @@ void FormationMgr::LoadCreatureFormations()
}
while (result->NextRow());
- sLog->outInfo(LOG_FILTER_UNITS, ">> Loaded %u creatures in formations in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
-
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u creatures in formations in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
}
void CreatureGroup::AddMember(Creature* member)
diff --git a/src/server/game/Entities/Creature/GossipDef.cpp b/src/server/game/Entities/Creature/GossipDef.cpp
index 63e186ffc42..ec196280d99 100755
--- a/src/server/game/Entities/Creature/GossipDef.cpp
+++ b/src/server/game/Entities/Creature/GossipDef.cpp
@@ -367,8 +367,8 @@ void PlayerMenu::SendQuestGiverQuestDetails(Quest const* quest, uint64 npcGUID,
}
// rewarded honor points. Multiply with 10 to satisfy client
- data << 10 * Trinity::Honor::hk_honor_at_level(_session->GetPlayer()->getLevel(), quest->GetRewHonorMultiplier());
- data << float(0.0f); // new 3.3.0, honor multiplier?
+ data << uint32(10 * quest->CalculateHonorGain(_session->GetPlayer()->GetQuestLevel(quest)));
+ data << float(0.0f); // unk, honor multiplier?
data << uint32(quest->GetRewSpell()); // reward spell, this spell will display (icon) (casted if RewSpellCast == 0)
data << int32(quest->GetRewSpellCast()); // casted spell
data << uint32(quest->GetCharTitleId()); // CharTitleId, new 2.4.0, player gets this title (id from CharTitles)
@@ -454,8 +454,8 @@ void PlayerMenu::SendQuestQueryResponse(Quest const* quest) const
data << int32(quest->GetRewSpellCast()); // casted spell
// rewarded honor points
- data << Trinity::Honor::hk_honor_at_level(_session->GetPlayer()->getLevel(), quest->GetRewHonorMultiplier());
- data << float(0); // new reward honor (multipled by ~62 at client side)
+ data << uint32(quest->GetRewHonorAddition());
+ data << float(quest->GetRewHonorMultiplier());
data << uint32(quest->GetSrcItemId()); // source item id
data << uint32(quest->GetFlags() & 0xFFFF); // quest flags
data << uint32(quest->GetCharTitleId()); // CharTitleId, new 2.4.0, player gets this title (id from CharTitles)
@@ -598,8 +598,8 @@ void PlayerMenu::SendQuestGiverOfferReward(Quest const* quest, uint64 npcGUID, b
data << uint32(quest->XPValue(_session->GetPlayer()) * sWorld->getRate(RATE_XP_QUEST));
// rewarded honor points. Multiply with 10 to satisfy client
- data << 10 * Trinity::Honor::hk_honor_at_level(_session->GetPlayer()->getLevel(), quest->GetRewHonorMultiplier());
- data << float(0); // unk, honor multiplier?
+ data << uint32(10 * quest->CalculateHonorGain(_session->GetPlayer()->GetQuestLevel(quest)));
+ data << float(0.0f); // unk, honor multiplier?
data << uint32(0x08); // unused by client?
data << uint32(quest->GetRewSpell()); // reward spell, this spell will display (icon) (casted if RewSpellCast == 0)
data << int32(quest->GetRewSpellCast()); // casted spell
diff --git a/src/server/game/Entities/Creature/TemporarySummon.h b/src/server/game/Entities/Creature/TemporarySummon.h
index 537bbd9c099..ba7faf60ddf 100755
--- a/src/server/game/Entities/Creature/TemporarySummon.h
+++ b/src/server/game/Entities/Creature/TemporarySummon.h
@@ -29,7 +29,7 @@ class TempSummon : public Creature
void Update(uint32 time);
virtual void InitStats(uint32 lifetime);
virtual void InitSummon();
- void UnSummon(uint32 msTime = 0);
+ virtual void UnSummon(uint32 msTime = 0);
void RemoveFromWorld();
void SetTempSummonType(TempSummonType type);
void SaveToDB(uint32 /*mapid*/, uint8 /*spawnMask*/, uint32 /*phaseMask*/) {}
diff --git a/src/server/game/Entities/DynamicObject/DynamicObject.h b/src/server/game/Entities/DynamicObject/DynamicObject.h
index 7e68f6acd38..68da99ac668 100755
--- a/src/server/game/Entities/DynamicObject/DynamicObject.h
+++ b/src/server/game/Entities/DynamicObject/DynamicObject.h
@@ -29,7 +29,7 @@ enum DynamicObjectType
{
DYNAMIC_OBJECT_PORTAL = 0x0, // unused
DYNAMIC_OBJECT_AREA_SPELL = 0x1,
- DYNAMIC_OBJECT_FARSIGHT_FOCUS = 0x2,
+ DYNAMIC_OBJECT_FARSIGHT_FOCUS = 0x2
};
class DynamicObject : public WorldObject, public GridObject<DynamicObject>
diff --git a/src/server/game/Entities/GameObject/GameObject.cpp b/src/server/game/Entities/GameObject/GameObject.cpp
index 7375ed9f886..c28ff21bfa5 100755
--- a/src/server/game/Entities/GameObject/GameObject.cpp
+++ b/src/server/game/Entities/GameObject/GameObject.cpp
@@ -133,14 +133,13 @@ void GameObject::AddToWorld()
m_zoneScript->OnGameObjectCreate(this);
sObjectAccessor->AddObject(this);
- bool startOpen = (GetGoType() == GAMEOBJECT_TYPE_DOOR || GetGoType() == GAMEOBJECT_TYPE_BUTTON ? GetGOInfo()->door.startOpen : false);
+
// The state can be changed after GameObject::Create but before GameObject::AddToWorld
- bool toggledState = GetGOData() ? GetGOData()->go_state == GO_STATE_READY : false;
+ bool toggledState = GetGoType() == GAMEOBJECT_TYPE_CHEST ? getLootState() == GO_READY : GetGoState() == GO_STATE_READY;
if (m_model)
- GetMap()->Insert(*m_model);
- if (startOpen ^ toggledState)
- EnableCollision(false);
+ GetMap()->InsertGameObjectModel(*m_model);
+ EnableCollision(toggledState);
WorldObject::AddToWorld();
}
}
@@ -155,8 +154,8 @@ void GameObject::RemoveFromWorld()
RemoveFromOwner();
if (m_model)
- if (GetMap()->Contains(*m_model))
- GetMap()->Remove(*m_model);
+ if (GetMap()->ContainsGameObjectModel(*m_model))
+ GetMap()->RemoveGameObjectModel(*m_model);
WorldObject::RemoveFromWorld();
sObjectAccessor->RemoveObject(this);
}
@@ -855,6 +854,13 @@ bool GameObject::IsDynTransport() const
return gInfo->type == GAMEOBJECT_TYPE_MO_TRANSPORT || (gInfo->type == GAMEOBJECT_TYPE_TRANSPORT && !gInfo->transport.pause);
}
+bool GameObject::IsDestructibleBuilding() const
+{
+ GameObjectTemplate const* gInfo = GetGOInfo();
+ if (!gInfo) return false;
+ return gInfo->type == GAMEOBJECT_TYPE_DESTRUCTIBLE_BUILDING;
+}
+
Unit* GameObject::GetOwner() const
{
return ObjectAccessor::GetUnit(*this, GetOwnerGUID());
@@ -871,7 +877,7 @@ bool GameObject::IsAlwaysVisibleFor(WorldObject const* seer) const
if (WorldObject::IsAlwaysVisibleFor(seer))
return true;
- if (IsTransport())
+ if (IsTransport() || IsDestructibleBuilding())
return true;
if (!seer)
@@ -1412,7 +1418,8 @@ void GameObject::Use(Unit* user)
// full amount unique participants including original summoner
if (GetUniqueUseCount() == info->summoningRitual.reqParticipants)
{
- spellCaster = m_ritualOwner ? m_ritualOwner : spellCaster;
+ if (m_ritualOwner)
+ spellCaster = m_ritualOwner;
spellId = info->summoningRitual.spellId;
@@ -1700,6 +1707,11 @@ bool GameObject::IsInRange(float x, float y, float z, float radius) const
float dy = y - GetPositionY();
float dz = z - GetPositionZ();
float dist = sqrt(dx*dx + dy*dy);
+ //! Check if the distance between the 2 objects is 0, can happen if both objects are on the same position.
+ //! The code below this check wont crash if dist is 0 because 0/0 in float operations is valid, and returns infinite
+ if (G3D::fuzzyEq(dist, 0.0f))
+ return true;
+
float sinB = dx / dist;
float cosB = dy / dist;
dx = dist * (cosA * cosB + sinA * sinB);
@@ -1919,17 +1931,12 @@ void GameObject::SetLootState(LootState state, Unit* unit)
sScriptMgr->OnGameObjectLootStateChanged(this, state, unit);
if (m_model)
{
- // startOpen determines whether we are going to add or remove the LoS on activation
- bool startOpen = (GetGoType() == GAMEOBJECT_TYPE_DOOR || GetGoType() == GAMEOBJECT_TYPE_BUTTON ? GetGOInfo()->door.startOpen : false);
-
+ bool collision = false;
// Use the current go state
- if (GetGoState() == GO_STATE_ACTIVE)
- startOpen = !startOpen;
+ if ((GetGoState() != GO_STATE_READY && (state == GO_ACTIVATED || state == GO_JUST_DEACTIVATED)) || state == GO_READY)
+ collision = !collision;
- if (state == GO_ACTIVATED || state == GO_JUST_DEACTIVATED)
- EnableCollision(startOpen);
- else if (state == GO_READY)
- EnableCollision(!startOpen);
+ EnableCollision(collision);
}
}
@@ -1943,15 +1950,11 @@ void GameObject::SetGoState(GOState state)
return;
// startOpen determines whether we are going to add or remove the LoS on activation
- bool startOpen = (GetGoType() == GAMEOBJECT_TYPE_DOOR || GetGoType() == GAMEOBJECT_TYPE_BUTTON ? GetGOInfo()->door.startOpen : false);
-
- if (GetGOData() && GetGOData()->go_state == GO_STATE_READY)
- startOpen = !startOpen;
+ bool collision = false;
+ if (state == GO_STATE_READY)
+ collision = !collision;
- if (state == GO_STATE_ACTIVE || state == GO_STATE_ACTIVE_ALTERNATIVE)
- EnableCollision(startOpen);
- else if (state == GO_STATE_READY)
- EnableCollision(!startOpen);
+ EnableCollision(collision);
}
}
@@ -1964,7 +1967,8 @@ void GameObject::SetDisplayId(uint32 displayid)
void GameObject::SetPhaseMask(uint32 newPhaseMask, bool update)
{
WorldObject::SetPhaseMask(newPhaseMask, update);
- EnableCollision(true);
+ if (m_model && m_model->isEnabled())
+ EnableCollision(true);
}
void GameObject::EnableCollision(bool enable)
@@ -1972,8 +1976,8 @@ void GameObject::EnableCollision(bool enable)
if (!m_model)
return;
- /*if (enable && !GetMap()->Contains(*m_model))
- GetMap()->Insert(*m_model);*/
+ /*if (enable && !GetMap()->ContainsGameObjectModel(*m_model))
+ GetMap()->InsertGameObjectModel(*m_model);*/
m_model->enable(enable ? GetPhaseMask() : 0);
}
@@ -1983,12 +1987,12 @@ void GameObject::UpdateModel()
if (!IsInWorld())
return;
if (m_model)
- if (GetMap()->Contains(*m_model))
- GetMap()->Remove(*m_model);
+ if (GetMap()->ContainsGameObjectModel(*m_model))
+ GetMap()->RemoveGameObjectModel(*m_model);
delete m_model;
m_model = GameObjectModel::Create(*this);
if (m_model)
- GetMap()->Insert(*m_model);
+ GetMap()->InsertGameObjectModel(*m_model);
}
Player* GameObject::GetLootRecipient() const
diff --git a/src/server/game/Entities/GameObject/GameObject.h b/src/server/game/Entities/GameObject/GameObject.h
index a8035043543..eb2fa8f1a0e 100755
--- a/src/server/game/Entities/GameObject/GameObject.h
+++ b/src/server/game/Entities/GameObject/GameObject.h
@@ -632,6 +632,7 @@ class GameObject : public WorldObject, public GridObject<GameObject>
bool IsTransport() const;
bool IsDynTransport() const;
+ bool IsDestructibleBuilding() const;
uint32 GetDBTableGUIDLow() const { return m_DBTableGuid; }
diff --git a/src/server/game/Entities/Item/Item.cpp b/src/server/game/Entities/Item/Item.cpp
index c032647d924..58cc1d027a3 100755
--- a/src/server/game/Entities/Item/Item.cpp
+++ b/src/server/game/Entities/Item/Item.cpp
@@ -1019,7 +1019,7 @@ Item* Item::CreateItem(uint32 item, uint32 count, Player const* player)
if (count > pProto->GetMaxStackSize())
count = pProto->GetMaxStackSize();
- ASSERT(count !=0 && "pProto->Stackable == 0 but checked at loading already");
+ ASSERT(count != 0 && "pProto->Stackable == 0 but checked at loading already");
Item* pItem = NewItemOrBag(pProto);
if (pItem->Create(sObjectMgr->GenerateLowGuid(HIGHGUID_ITEM), item, player))
diff --git a/src/server/game/Entities/Item/ItemEnchantmentMgr.cpp b/src/server/game/Entities/Item/ItemEnchantmentMgr.cpp
index 0478173b96e..f85bf80e145 100755
--- a/src/server/game/Entities/Item/ItemEnchantmentMgr.cpp
+++ b/src/server/game/Entities/Item/ItemEnchantmentMgr.cpp
@@ -70,14 +70,10 @@ void LoadRandomEnchantmentsTable()
++count;
} while (result->NextRow());
- sLog->outInfo(LOG_FILTER_PLAYER_ITEMS, ">> Loaded %u Item Enchantment definitions in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
-
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u Item Enchantment definitions in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
}
else
- {
sLog->outError(LOG_FILTER_SQL, ">> Loaded 0 Item Enchantment definitions. DB table `item_enchantment_template` is empty.");
-
- }
}
uint32 GetItemEnchantMod(int32 entry)
diff --git a/src/server/game/Entities/Item/ItemPrototype.h b/src/server/game/Entities/Item/ItemPrototype.h
index 5088a30157c..f2f41d6a8b9 100755
--- a/src/server/game/Entities/Item/ItemPrototype.h
+++ b/src/server/game/Entities/Item/ItemPrototype.h
@@ -181,7 +181,7 @@ enum ItemFieldFlags
ITEM_FLAG_UNK25 = 0x40000000, // ?
ITEM_FLAG_UNK26 = 0x80000000, // ?
- ITEM_FLAG_MAIL_TEXT_MASK = ITEM_FLAG_READABLE | ITEM_FLAG_UNK13 | ITEM_FLAG_UNK14,
+ ITEM_FLAG_MAIL_TEXT_MASK = ITEM_FLAG_READABLE | ITEM_FLAG_UNK13 | ITEM_FLAG_UNK14
};
enum ItemFlagsExtra
@@ -196,7 +196,7 @@ enum ItemFlagsCustom
{
ITEM_FLAGS_CU_DURATION_REAL_TIME = 0x0001, // Item duration will tick even if player is offline
ITEM_FLAGS_CU_IGNORE_QUEST_STATUS = 0x0002, // No quest status will be checked when this item drops
- ITEM_FLAGS_CU_FOLLOW_LOOT_RULES = 0x0004, // Item will always follow group/master/need before greed looting rules
+ ITEM_FLAGS_CU_FOLLOW_LOOT_RULES = 0x0004 // Item will always follow group/master/need before greed looting rules
};
enum BAG_FAMILY_MASK
@@ -588,7 +588,7 @@ struct ItemTemplate
uint32 ItemId;
uint32 Class; // id from ItemClass.dbc
uint32 SubClass; // id from ItemSubClass.dbc
- int32 Unk0;
+ int32 SoundOverrideSubclass; // < 0: id from ItemSubClass.dbc, used to override weapon sound from actual SubClass
std::string Name1;
uint32 DisplayInfoID; // id from ItemDisplayInfo.dbc
uint32 Quality;
diff --git a/src/server/game/Entities/Object/Object.cpp b/src/server/game/Entities/Object/Object.cpp
index b910fee951b..cbdae9de0bf 100755
--- a/src/server/game/Entities/Object/Object.cpp
+++ b/src/server/game/Entities/Object/Object.cpp
@@ -48,6 +48,8 @@
#include "MovementPacketBuilder.h"
#include "DynamicTree.h"
#include "Group.h"
+#include "Battlefield.h"
+#include "BattlefieldMgr.h"
uint32 GuidHigh2TypeId(uint32 guid_hi)
{
@@ -1762,10 +1764,10 @@ bool WorldObject::canSeeOrDetect(WorldObject const* obj, bool ignoreStealth, boo
if (obj->IsAlwaysVisibleFor(this) || CanAlwaysSee(obj))
return true;
- bool corpseCheck = false;
bool corpseVisibility = false;
if (distanceCheck)
{
+ bool corpseCheck = false;
if (Player const* thisPlayer = ToPlayer())
{
if (thisPlayer->isDead() && thisPlayer->GetHealth() > 0 && // Cheap way to check for ghost state
@@ -2329,7 +2331,17 @@ void WorldObject::SetZoneScript()
if (map->IsDungeon())
m_zoneScript = (ZoneScript*)((InstanceMap*)map)->GetInstanceScript();
else if (!map->IsBattlegroundOrArena())
- m_zoneScript = sOutdoorPvPMgr->GetZoneScript(GetZoneId());
+ {
+ if (Battlefield* bf = sBattlefieldMgr->GetBattlefieldToZoneId(GetZoneId()))
+ m_zoneScript = bf;
+ else
+ {
+ if (Battlefield* bf = sBattlefieldMgr->GetBattlefieldToZoneId(GetZoneId()))
+ m_zoneScript = bf;
+ else
+ m_zoneScript = sOutdoorPvPMgr->GetZoneScript(GetZoneId());
+ }
+ }
}
}
@@ -2525,6 +2537,15 @@ GameObject* WorldObject::FindNearestGameObject(uint32 entry, float range) const
return go;
}
+GameObject* WorldObject::FindNearestGameObjectOfType(GameobjectTypes type, float range) const
+{
+ GameObject* go = NULL;
+ Trinity::NearestGameObjectTypeInObjectRangeCheck checker(*this, type, range);
+ Trinity::GameObjectLastSearcher<Trinity::NearestGameObjectTypeInObjectRangeCheck> searcher(this, go, checker);
+ VisitNearbyGridObject(range, searcher);
+ return go;
+}
+
void WorldObject::GetGameObjectListWithEntryInGrid(std::list<GameObject*>& gameobjectList, uint32 entry, float maxSearchRange) const
{
CellCoord pair(Trinity::ComputeCellCoord(this->GetPositionX(), this->GetPositionY()));
diff --git a/src/server/game/Entities/Object/Object.h b/src/server/game/Entities/Object/Object.h
index ab9ea2daea9..410903f6619 100755
--- a/src/server/game/Entities/Object/Object.h
+++ b/src/server/game/Entities/Object/Object.h
@@ -799,6 +799,7 @@ class WorldObject : public Object, public WorldLocation
Creature* FindNearestCreature(uint32 entry, float range, bool alive = true) const;
GameObject* FindNearestGameObject(uint32 entry, float range) const;
+ GameObject* FindNearestGameObjectOfType(GameobjectTypes type, float range) const;
void GetGameObjectListWithEntryInGrid(std::list<GameObject*>& lList, uint32 uiEntry, float fMaxSearchRange) const;
void GetCreatureListWithEntryInGrid(std::list<Creature*>& lList, uint32 uiEntry, float fMaxSearchRange) const;
diff --git a/src/server/game/Entities/Object/ObjectDefines.h b/src/server/game/Entities/Object/ObjectDefines.h
index c227d081d8b..a3c8901880f 100755
--- a/src/server/game/Entities/Object/ObjectDefines.h
+++ b/src/server/game/Entities/Object/ObjectDefines.h
@@ -44,7 +44,7 @@ enum HighGuid
HIGHGUID_DYNAMICOBJECT = 0xF100, // blizz F100
HIGHGUID_CORPSE = 0xF101, // blizz F100
HIGHGUID_MO_TRANSPORT = 0x1FC0, // blizz 1FC0 (for GAMEOBJECT_TYPE_MO_TRANSPORT)
- HIGHGUID_GROUP = 0x1F50,
+ HIGHGUID_GROUP = 0x1F50
};
#define IS_EMPTY_GUID(Guid) (Guid == 0)
diff --git a/src/server/game/Entities/Object/Updates/UpdateFieldFlags.h b/src/server/game/Entities/Object/Updates/UpdateFieldFlags.h
index 71b3f0cd4aa..2cd303d5fc5 100644
--- a/src/server/game/Entities/Object/Updates/UpdateFieldFlags.h
+++ b/src/server/game/Entities/Object/Updates/UpdateFieldFlags.h
@@ -32,7 +32,7 @@ enum UpdatefieldFlags
UF_FLAG_SPECIAL_INFO = 0x020,
UF_FLAG_PARTY_MEMBER = 0x040,
UF_FLAG_UNUSED2 = 0x080,
- UF_FLAG_DYNAMIC = 0x100,
+ UF_FLAG_DYNAMIC = 0x100
};
extern uint32 ItemUpdateFieldFlags[CONTAINER_END];
diff --git a/src/server/game/Entities/Object/Updates/UpdateFields.h b/src/server/game/Entities/Object/Updates/UpdateFields.h
index 825bda98ae6..7e4aa9aaab8 100755
--- a/src/server/game/Entities/Object/Updates/UpdateFields.h
+++ b/src/server/game/Entities/Object/Updates/UpdateFields.h
@@ -28,7 +28,7 @@ enum EObjectFields
OBJECT_FIELD_ENTRY = 0x0003, // Size: 1, Type: INT, Flags: PUBLIC
OBJECT_FIELD_SCALE_X = 0x0004, // Size: 1, Type: FLOAT, Flags: PUBLIC
OBJECT_FIELD_PADDING = 0x0005, // Size: 1, Type: INT, Flags: NONE
- OBJECT_END = 0x0006,
+ OBJECT_END = 0x0006
};
enum EItemFields
@@ -71,7 +71,7 @@ enum EItemFields
ITEM_FIELD_MAXDURABILITY = OBJECT_END + 0x0037, // Size: 1, Type: INT, Flags: OWNER, ITEM_OWNER
ITEM_FIELD_CREATE_PLAYED_TIME = OBJECT_END + 0x0038, // Size: 1, Type: INT, Flags: PUBLIC
ITEM_FIELD_PAD = OBJECT_END + 0x0039, // Size: 1, Type: INT, Flags: NONE
- ITEM_END = OBJECT_END + 0x003A,
+ ITEM_END = OBJECT_END + 0x003A
};
enum EContainerFields
@@ -79,7 +79,7 @@ enum EContainerFields
CONTAINER_FIELD_NUM_SLOTS = ITEM_END + 0x0000, // Size: 1, Type: INT, Flags: PUBLIC
CONTAINER_ALIGN_PAD = ITEM_END + 0x0001, // Size: 1, Type: BYTES, Flags: NONE
CONTAINER_FIELD_SLOT_1 = ITEM_END + 0x0002, // Size: 72, Type: LONG, Flags: PUBLIC
- CONTAINER_END = ITEM_END + 0x004A,
+ CONTAINER_END = ITEM_END + 0x004A
};
enum EUnitFields
@@ -333,9 +333,9 @@ enum EUnitFields
PLAYER_FIELD_KEYRING_SLOT_1 = UNIT_END + 0x015C, // Size: 64, Type: LONG, Flags: PRIVATE
PLAYER_FIELD_CURRENCYTOKEN_SLOT_1 = UNIT_END + 0x019C, // Size: 64, Type: LONG, Flags: PRIVATE
PLAYER_FARSIGHT = UNIT_END + 0x01DC, // Size: 2, Type: LONG, Flags: PRIVATE
- PLAYER__FIELD_KNOWN_TITLES = UNIT_END + 0x01DE, // Size: 2, Type: LONG, Flags: PRIVATE
- PLAYER__FIELD_KNOWN_TITLES1 = UNIT_END + 0x01E0, // Size: 2, Type: LONG, Flags: PRIVATE
- PLAYER__FIELD_KNOWN_TITLES2 = UNIT_END + 0x01E2, // Size: 2, Type: LONG, Flags: PRIVATE
+ PLAYER__FIELD_KNOWN_TITLES = UNIT_END + 0x01DE, // Size: 2, Type: LONG, Flags: PRIVATE
+ PLAYER__FIELD_KNOWN_TITLES1 = UNIT_END + 0x01E0, // Size: 2, Type: LONG, Flags: PRIVATE
+ PLAYER__FIELD_KNOWN_TITLES2 = UNIT_END + 0x01E2, // Size: 2, Type: LONG, Flags: PRIVATE
PLAYER_FIELD_KNOWN_CURRENCIES = UNIT_END + 0x01E4, // Size: 2, Type: LONG, Flags: PRIVATE
PLAYER_XP = UNIT_END + 0x01E6, // Size: 1, Type: INT, Flags: PRIVATE
PLAYER_NEXT_LEVEL_XP = UNIT_END + 0x01E7, // Size: 1, Type: INT, Flags: PRIVATE
@@ -390,7 +390,7 @@ enum EUnitFields
PLAYER_FIELD_GLYPHS_1 = UNIT_END + 0x0492, // Size: 6, Type: INT, Flags: PRIVATE
PLAYER_GLYPHS_ENABLED = UNIT_END + 0x0498, // Size: 1, Type: INT, Flags: PRIVATE
PLAYER_PET_SPELL_POWER = UNIT_END + 0x0499, // Size: 1, Type: INT, Flags: PRIVATE
- PLAYER_END = UNIT_END + 0x049A,
+ PLAYER_END = UNIT_END + 0x049A
};
enum EGameObjectFields
@@ -403,7 +403,7 @@ enum EGameObjectFields
GAMEOBJECT_FACTION = OBJECT_END + 0x0009, // Size: 1, Type: INT, Flags: PUBLIC
GAMEOBJECT_LEVEL = OBJECT_END + 0x000A, // Size: 1, Type: INT, Flags: PUBLIC
GAMEOBJECT_BYTES_1 = OBJECT_END + 0x000B, // Size: 1, Type: BYTES, Flags: PUBLIC
- GAMEOBJECT_END = OBJECT_END + 0x000C,
+ GAMEOBJECT_END = OBJECT_END + 0x000C
};
enum EDynamicObjectFields
@@ -413,7 +413,7 @@ enum EDynamicObjectFields
DYNAMICOBJECT_SPELLID = OBJECT_END + 0x0003, // Size: 1, Type: INT, Flags: PUBLIC
DYNAMICOBJECT_RADIUS = OBJECT_END + 0x0004, // Size: 1, Type: FLOAT, Flags: PUBLIC
DYNAMICOBJECT_CASTTIME = OBJECT_END + 0x0005, // Size: 1, Type: INT, Flags: PUBLIC
- DYNAMICOBJECT_END = OBJECT_END + 0x0006,
+ DYNAMICOBJECT_END = OBJECT_END + 0x0006
};
enum ECorpseFields
@@ -428,6 +428,6 @@ enum ECorpseFields
CORPSE_FIELD_FLAGS = OBJECT_END + 0x001B, // Size: 1, Type: INT, Flags: PUBLIC
CORPSE_FIELD_DYNAMIC_FLAGS = OBJECT_END + 0x001C, // Size: 1, Type: INT, Flags: DYNAMIC
CORPSE_FIELD_PAD = OBJECT_END + 0x001D, // Size: 1, Type: INT, Flags: NONE
- CORPSE_END = OBJECT_END + 0x001E,
+ CORPSE_END = OBJECT_END + 0x001E
};
#endif
diff --git a/src/server/game/Entities/Pet/Pet.cpp b/src/server/game/Entities/Pet/Pet.cpp
index 17b214857db..ead018ac620 100755
--- a/src/server/game/Entities/Pet/Pet.cpp
+++ b/src/server/game/Entities/Pet/Pet.cpp
@@ -2033,3 +2033,40 @@ void Pet::SynchronizeLevelWithOwner()
break;
}
}
+
+void Pet::ProhibitSpellSchool(SpellSchoolMask idSchoolMask, uint32 unTimeMs)
+{
+ WorldPacket data(SMSG_SPELL_COOLDOWN, 8+1+m_spells.size()*8);
+ data << uint64(GetGUID());
+ data << uint8(0x0); // flags (0x1, 0x2)
+ time_t curTime = time(NULL);
+ for (PetSpellMap::const_iterator itr = m_spells.begin(); itr != m_spells.end(); ++itr)
+ {
+ if (itr->second.state == PETSPELL_REMOVED)
+ continue;
+ uint32 unSpellId = itr->first;
+ SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(unSpellId);
+ if (!spellInfo)
+ {
+ ASSERT(spellInfo);
+ continue;
+ }
+
+ // Not send cooldown for this spells
+ if (spellInfo->Attributes & SPELL_ATTR0_DISABLED_WHILE_ACTIVE)
+ continue;
+
+ if (spellInfo->PreventionType != SPELL_PREVENTION_TYPE_SILENCE)
+ continue;
+
+ if ((idSchoolMask & spellInfo->GetSchoolMask()) && GetCreatureSpellCooldownDelay(unSpellId) < unTimeMs)
+ {
+ data << uint32(unSpellId);
+ data << uint32(unTimeMs); // in m.secs
+ _AddCreatureSpellCooldown(unSpellId, curTime + unTimeMs/IN_MILLISECONDS);
+ }
+ }
+
+ if (Player* owner = GetOwner())
+ owner->GetSession()->SendPacket(&data);
+} \ No newline at end of file
diff --git a/src/server/game/Entities/Pet/Pet.h b/src/server/game/Entities/Pet/Pet.h
index 3475817816d..6e080263862 100755
--- a/src/server/game/Entities/Pet/Pet.h
+++ b/src/server/game/Entities/Pet/Pet.h
@@ -27,7 +27,7 @@ enum PetType
{
SUMMON_PET = 0,
HUNTER_PET = 1,
- MAX_PET_TYPE = 4,
+ MAX_PET_TYPE = 4
};
#define MAX_PET_STABLES 4
@@ -61,7 +61,7 @@ enum PetSpellType
{
PETSPELL_NORMAL = 0,
PETSPELL_FAMILY = 1,
- PETSPELL_TALENT = 2,
+ PETSPELL_TALENT = 2
};
struct PetSpell
@@ -200,6 +200,7 @@ class Pet : public Guardian
bool unlearnSpell(uint32 spell_id, bool learn_prev, bool clear_ab = true);
bool removeSpell(uint32 spell_id, bool learn_prev, bool clear_ab = true);
void CleanupActionBar();
+ virtual void ProhibitSpellSchool(SpellSchoolMask idSchoolMask, uint32 unTimeMs);
PetSpellMap m_spells;
AutoSpellList m_autospells;
diff --git a/src/server/game/Entities/Player/Player.cpp b/src/server/game/Entities/Player/Player.cpp
index 2fd80b7b843..a2eb4385587 100755
--- a/src/server/game/Entities/Player/Player.cpp
+++ b/src/server/game/Entities/Player/Player.cpp
@@ -74,6 +74,8 @@
#include "InstanceScript.h"
#include <cmath>
#include "AccountMgr.h"
+#include "Battlefield.h"
+#include "BattlefieldMgr.h"
#define ZONE_UPDATE_INTERVAL (1*IN_MILLISECONDS)
@@ -726,7 +728,6 @@ Player::Player(WorldSession* session): Unit(true), m_achievementMgr(this), m_rep
m_MirrorTimerFlagsLast = UNDERWATER_NONE;
m_isInWater = false;
m_drunkTimer = 0;
- m_drunk = 0;
m_restTime = 0;
m_deathTimer = 0;
m_deathExpireTime = 0;
@@ -860,6 +861,8 @@ Player::Player(WorldSession* session): Unit(true), m_achievementMgr(this), m_rep
m_SeasonalQuestChanged = false;
SetPendingBind(0, 0);
+
+ _activeCheats = CHEAT_NONE;
}
Player::~Player()
@@ -1228,7 +1231,7 @@ bool Player::StoreNewItemInBestSlots(uint32 titem_id, uint32 titem_amount)
}
// item can't be added
- sLog->outError(LOG_FILTER_PLAYER, "STORAGE: Can't equip or store initial item %u for race %u class %u, error msg = %u", titem_id, getRace(), getClass(), msg);
+ sLog->outError(LOG_FILTER_PLAYER_ITEMS, "STORAGE: Can't equip or store initial item %u for race %u class %u, error msg = %u", titem_id, getRace(), getClass(), msg);
return false;
}
@@ -1458,49 +1461,51 @@ void Player::HandleDrowning(uint32 time_diff)
m_MirrorTimerFlagsLast = m_MirrorTimerFlags;
}
-///The player sobers by 256 every 10 seconds
+///The player sobers by 1% every 9 seconds
void Player::HandleSobering()
{
m_drunkTimer = 0;
- uint32 drunk = (m_drunk <= 256) ? 0 : (m_drunk - 256);
+ uint8 currentDrunkValue = GetDrunkValue();
+ uint8 drunk = currentDrunkValue ? --currentDrunkValue : 0;
SetDrunkValue(drunk);
}
-DrunkenState Player::GetDrunkenstateByValue(uint16 value)
+DrunkenState Player::GetDrunkenstateByValue(uint8 value)
{
- if (value >= 23000)
+ if (value >= 90)
return DRUNKEN_SMASHED;
- if (value >= 12800)
+ if (value >= 50)
return DRUNKEN_DRUNK;
- if (value & 0xFFFE)
+ if (value)
return DRUNKEN_TIPSY;
return DRUNKEN_SOBER;
}
-void Player::SetDrunkValue(uint16 newDrunkenValue, uint32 itemId)
+void Player::SetDrunkValue(uint8 newDrunkValue, uint32 itemId /*= 0*/)
{
- uint32 oldDrunkenState = Player::GetDrunkenstateByValue(m_drunk);
+ bool isSobering = newDrunkValue < GetDrunkValue();
+ uint32 oldDrunkenState = Player::GetDrunkenstateByValue(GetDrunkValue());
+ if (newDrunkValue > 100)
+ newDrunkValue = 100;
// select drunk percent or total SPELL_AURA_MOD_FAKE_INEBRIATE amount, whichever is higher for visibility updates
- int32 drunkPercent = newDrunkenValue * 100 / 0xFFFF;
- drunkPercent = std::max(drunkPercent, GetTotalAuraModifier(SPELL_AURA_MOD_FAKE_INEBRIATE));
-
+ int32 drunkPercent = std::max<int32>(newDrunkValue, GetTotalAuraModifier(SPELL_AURA_MOD_FAKE_INEBRIATE));
if (drunkPercent)
{
m_invisibilityDetect.AddFlag(INVISIBILITY_DRUNK);
m_invisibilityDetect.SetValue(INVISIBILITY_DRUNK, drunkPercent);
}
- else if (!HasAuraType(SPELL_AURA_MOD_FAKE_INEBRIATE) && !newDrunkenValue)
+ else if (!HasAuraType(SPELL_AURA_MOD_FAKE_INEBRIATE) && !newDrunkValue)
m_invisibilityDetect.DelFlag(INVISIBILITY_DRUNK);
- m_drunk = newDrunkenValue;
- SetUInt32Value(PLAYER_BYTES_3, (GetUInt32Value(PLAYER_BYTES_3) & 0xFFFF0001) | (m_drunk & 0xFFFE));
-
- uint32 newDrunkenState = Player::GetDrunkenstateByValue(m_drunk);
-
+ uint32 newDrunkenState = Player::GetDrunkenstateByValue(newDrunkValue);
+ SetByteValue(PLAYER_BYTES_3, 1, newDrunkValue);
UpdateObjectVisibility();
+ if (!isSobering)
+ m_drunkTimer = 0; // reset sobering timer
+
if (newDrunkenState == oldDrunkenState)
return;
@@ -1508,7 +1513,6 @@ void Player::SetDrunkValue(uint16 newDrunkenValue, uint32 itemId)
data << uint64(GetGUID());
data << uint32(newDrunkenState);
data << uint32(itemId);
-
SendMessageToSet(&data, true);
}
@@ -1534,7 +1538,7 @@ void Player::Update(uint32 p_time)
{
//sLog->outFatal(LOG_FILTER_PLAYER, "Player has m_pad %u during update!", m_pad);
//if (m_spellModTakingSpell)
- sLog->outFatal(LOG_FILTER_PLAYER, "Player has m_spellModTakingSpell %u during update!", m_spellModTakingSpell->m_spellInfo->Id);
+ sLog->outFatal(LOG_FILTER_SPELLS_AURAS, "Player has m_spellModTakingSpell %u during update!", m_spellModTakingSpell->m_spellInfo->Id);
m_spellModTakingSpell = NULL;
}
@@ -1731,7 +1735,7 @@ void Player::Update(uint32 p_time)
{
// m_nextSave reseted in SaveToDB call
SaveToDB();
- sLog->outInfo(LOG_FILTER_PLAYER, "Player '%s' (GUID: %u) saved", GetName(), GetGUIDLow());
+ sLog->outDebug(LOG_FILTER_PLAYER, "Player '%s' (GUID: %u) saved", GetName(), GetGUIDLow());
}
else
m_nextSave -= p_time;
@@ -1749,11 +1753,10 @@ void Player::Update(uint32 p_time)
m_Last_tick = now;
}
- if (m_drunk)
+ if (GetDrunkValue())
{
m_drunkTimer += p_time;
-
- if (m_drunkTimer > 10*IN_MILLISECONDS)
+ if (m_drunkTimer > 9 * IN_MILLISECONDS)
HandleSobering();
}
@@ -1879,12 +1882,12 @@ bool Player::BuildEnumData(PreparedQueryResult result, WorldPacket* data)
PlayerInfo const* info = sObjectMgr->GetPlayerInfo(plrRace, plrClass);
if (!info)
{
- sLog->outError(LOG_FILTER_PLAYER, "Player %u has incorrect race/class pair. Don't build enum.", guid);
+ sLog->outError(LOG_FILTER_PLAYER_LOADING, "Player %u has incorrect race/class pair. Don't build enum.", guid);
return false;
}
else if (!IsValidGender(gender))
{
- sLog->outError(LOG_FILTER_PLAYER, "Player (%u) has incorrect gender (%hu), don't build enum.", guid, gender);
+ sLog->outError(LOG_FILTER_PLAYER_LOADING, "Player (%u) has incorrect gender (%hu), don't build enum.", guid, gender);
return false;
}
@@ -2066,14 +2069,14 @@ bool Player::TeleportTo(uint32 mapid, float x, float y, float z, float orientati
{
if (!MapManager::IsValidMapCoord(mapid, x, y, z, orientation))
{
- sLog->outError(LOG_FILTER_PLAYER, "TeleportTo: invalid map (%d) or invalid coordinates (X: %f, Y: %f, Z: %f, O: %f) given when teleporting player (GUID: %u, name: %s, map: %d, X: %f, Y: %f, Z: %f, O: %f).",
+ sLog->outError(LOG_FILTER_MAPS, "TeleportTo: invalid map (%d) or invalid coordinates (X: %f, Y: %f, Z: %f, O: %f) given when teleporting player (GUID: %u, name: %s, map: %d, X: %f, Y: %f, Z: %f, O: %f).",
mapid, x, y, z, orientation, GetGUIDLow(), GetName(), GetMapId(), GetPositionX(), GetPositionY(), GetPositionZ(), GetOrientation());
return false;
}
if (AccountMgr::IsPlayerAccount(GetSession()->GetSecurity()) && DisableMgr::IsDisabledFor(DISABLE_TYPE_MAP, mapid, this))
{
- sLog->outError(LOG_FILTER_PLAYER, "Player (GUID: %u, name: %s) tried to enter a forbidden map %u", GetGUIDLow(), GetName(), mapid);
+ sLog->outError(LOG_FILTER_MAPS, "Player (GUID: %u, name: %s) tried to enter a forbidden map %u", GetGUIDLow(), GetName(), mapid);
SendTransferAborted(mapid, TRANSFER_ABORT_MAP_NOT_ALLOWED);
return false;
}
@@ -2406,6 +2409,7 @@ void Player::RemoveFromWorld()
StopCastingBindSight();
UnsummonPetTemporaryIfAny();
sOutdoorPvPMgr->HandlePlayerLeaveZone(this, m_zoneUpdateId);
+ sBattlefieldMgr->HandlePlayerLeaveZone(this, m_zoneUpdateId);
}
///- Do not add/remove the player from the object storage
@@ -2426,7 +2430,7 @@ void Player::RemoveFromWorld()
{
if (WorldObject* viewpoint = GetViewpoint())
{
- sLog->outFatal(LOG_FILTER_PLAYER, "Player %s has viewpoint %u %u when removed from world", GetName(), viewpoint->GetEntry(), viewpoint->GetTypeId());
+ sLog->outError(LOG_FILTER_PLAYER, "Player %s has viewpoint %u %u when removed from world", GetName(), viewpoint->GetEntry(), viewpoint->GetTypeId());
SetViewpoint(viewpoint, false);
}
}
@@ -3355,7 +3359,7 @@ void Player::SendInitialSpells()
GetSession()->SendPacket(&data);
- sLog->outInfo(LOG_FILTER_PLAYER, "CHARACTER: Sent Initial Spells");
+ sLog->outDebug(LOG_FILTER_NETWORKIO, "CHARACTER: Sent Initial Spells");
}
void Player::RemoveMail(uint32 id)
@@ -3436,7 +3440,7 @@ bool Player::AddTalent(uint32 spellId, uint8 spec, bool learning)
// do character spell book cleanup (all characters)
if (!IsInWorld() && !learning) // spell load case
{
- sLog->outError(LOG_FILTER_PLAYER, "Player::addSpell: Non-existed in SpellStore spell #%u request, deleting for all characters in `character_spell`.", spellId);
+ sLog->outError(LOG_FILTER_SPELLS_AURAS, "Player::addSpell: Non-existed in SpellStore spell #%u request, deleting for all characters in `character_spell`.", spellId);
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_INVALID_SPELL);
@@ -3445,7 +3449,7 @@ bool Player::AddTalent(uint32 spellId, uint8 spec, bool learning)
CharacterDatabase.Execute(stmt);
}
else
- sLog->outError(LOG_FILTER_PLAYER, "Player::addSpell: Non-existed in SpellStore spell #%u request.", spellId);
+ sLog->outError(LOG_FILTER_SPELLS_AURAS, "Player::addSpell: Non-existed in SpellStore spell #%u request.", spellId);
return false;
}
@@ -3455,7 +3459,7 @@ bool Player::AddTalent(uint32 spellId, uint8 spec, bool learning)
// do character spell book cleanup (all characters)
if (!IsInWorld() && !learning) // spell load case
{
- sLog->outError(LOG_FILTER_PLAYER, "Player::addTalent: Broken spell #%u learning not allowed, deleting for all characters in `character_talent`.", spellId);
+ sLog->outError(LOG_FILTER_SPELLS_AURAS, "Player::addTalent: Broken spell #%u learning not allowed, deleting for all characters in `character_talent`.", spellId);
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_INVALID_SPELL);
@@ -3464,7 +3468,7 @@ bool Player::AddTalent(uint32 spellId, uint8 spec, bool learning)
CharacterDatabase.Execute(stmt);
}
else
- sLog->outError(LOG_FILTER_PLAYER, "Player::addTalent: Broken spell #%u learning not allowed.", spellId);
+ sLog->outError(LOG_FILTER_SPELLS_AURAS, "Player::addTalent: Broken spell #%u learning not allowed.", spellId);
return false;
}
@@ -3509,7 +3513,7 @@ bool Player::addSpell(uint32 spellId, bool active, bool learning, bool dependent
// do character spell book cleanup (all characters)
if (!IsInWorld() && !learning) // spell load case
{
- sLog->outError(LOG_FILTER_PLAYER, "Player::addSpell: Non-existed in SpellStore spell #%u request, deleting for all characters in `character_spell`.", spellId);
+ sLog->outError(LOG_FILTER_SPELLS_AURAS, "Player::addSpell: Non-existed in SpellStore spell #%u request, deleting for all characters in `character_spell`.", spellId);
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_INVALID_SPELL);
@@ -3518,7 +3522,7 @@ bool Player::addSpell(uint32 spellId, bool active, bool learning, bool dependent
CharacterDatabase.Execute(stmt);
}
else
- sLog->outError(LOG_FILTER_PLAYER, "Player::addSpell: Non-existed in SpellStore spell #%u request.", spellId);
+ sLog->outError(LOG_FILTER_SPELLS_AURAS, "Player::addSpell: Non-existed in SpellStore spell #%u request.", spellId);
return false;
}
@@ -3528,7 +3532,7 @@ bool Player::addSpell(uint32 spellId, bool active, bool learning, bool dependent
// do character spell book cleanup (all characters)
if (!IsInWorld() && !learning) // spell load case
{
- sLog->outError(LOG_FILTER_PLAYER, "Player::addSpell: Broken spell #%u learning not allowed, deleting for all characters in `character_spell`.", spellId);
+ sLog->outError(LOG_FILTER_SPELLS_AURAS, "Player::addSpell: Broken spell #%u learning not allowed, deleting for all characters in `character_spell`.", spellId);
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_INVALID_SPELL);
@@ -3537,7 +3541,7 @@ bool Player::addSpell(uint32 spellId, bool active, bool learning, bool dependent
CharacterDatabase.Execute(stmt);
}
else
- sLog->outError(LOG_FILTER_PLAYER, "Player::addSpell: Broken spell #%u learning not allowed.", spellId);
+ sLog->outError(LOG_FILTER_SPELLS_AURAS, "Player::addSpell: Broken spell #%u learning not allowed.", spellId);
return false;
}
@@ -4291,7 +4295,7 @@ void Player::_LoadSpellCooldowns(PreparedQueryResult result)
if (!sSpellMgr->GetSpellInfo(spell_id))
{
- sLog->outError(LOG_FILTER_PLAYER, "Player %u has unknown spell %u in `character_spell_cooldown`, skipping.", GetGUIDLow(), spell_id);
+ sLog->outError(LOG_FILTER_PLAYER_LOADING, "Player %u has unknown spell %u in `character_spell_cooldown`, skipping.", GetGUIDLow(), spell_id);
continue;
}
@@ -5003,7 +5007,7 @@ void Player::DeleteOldCharacters(uint32 keepDays)
if (result)
{
- sLog->outInfo(LOG_FILTER_PLAYER, "Player::DeleteOldChars: Found " UI64FMTD " character(s) to delete", result->GetRowCount());
+ sLog->outDebug(LOG_FILTER_PLAYER, "Player::DeleteOldChars: Found " UI64FMTD " character(s) to delete", result->GetRowCount());
do
{
Field* fields = result->Fetch();
@@ -5418,7 +5422,7 @@ uint32 Player::DurabilityRepair(uint16 pos, bool cost, float discountMod, bool g
DurabilityCostsEntry const* dcost = sDurabilityCostsStore.LookupEntry(ditemProto->ItemLevel);
if (!dcost)
{
- sLog->outError(LOG_FILTER_PLAYER, "RepairDurability: Wrong item lvl %u", ditemProto->ItemLevel);
+ sLog->outError(LOG_FILTER_PLAYER_ITEMS, "RepairDurability: Wrong item lvl %u", ditemProto->ItemLevel);
return TotalCost;
}
@@ -5426,7 +5430,7 @@ uint32 Player::DurabilityRepair(uint16 pos, bool cost, float discountMod, bool g
DurabilityQualityEntry const* dQualitymodEntry = sDurabilityQualityStore.LookupEntry(dQualitymodEntryId);
if (!dQualitymodEntry)
{
- sLog->outError(LOG_FILTER_PLAYER, "RepairDurability: Wrong dQualityModEntry %u", dQualitymodEntryId);
+ sLog->outError(LOG_FILTER_PLAYER_ITEMS, "RepairDurability: Wrong dQualityModEntry %u", dQualitymodEntryId);
return TotalCost;
}
@@ -5442,7 +5446,7 @@ uint32 Player::DurabilityRepair(uint16 pos, bool cost, float discountMod, bool g
{
if (GetGuildId() == 0)
{
- sLog->outDebug(LOG_FILTER_PLAYER, "You are not member of a guild");
+ sLog->outDebug(LOG_FILTER_PLAYER_ITEMS, "You are not member of a guild");
return TotalCost;
}
@@ -5457,7 +5461,7 @@ uint32 Player::DurabilityRepair(uint16 pos, bool cost, float discountMod, bool g
}
else if (!HasEnoughMoney(costs))
{
- sLog->outDebug(LOG_FILTER_PLAYER, "You do not have enough money");
+ sLog->outDebug(LOG_FILTER_PLAYER_ITEMS, "You do not have enough money");
return TotalCost;
}
else
@@ -5494,7 +5498,17 @@ void Player::RepopAtGraveyard()
if (Battleground* bg = GetBattleground())
ClosestGrave = bg->GetClosestGraveYard(this);
else
- ClosestGrave = sObjectMgr->GetClosestGraveYard(GetPositionX(), GetPositionY(), GetPositionZ(), GetMapId(), GetTeam());
+ {
+ if (sBattlefieldMgr->GetBattlefieldToZoneId(GetZoneId()))
+ ClosestGrave = sBattlefieldMgr->GetBattlefieldToZoneId(GetZoneId())->GetClosestGraveYard(this);
+ else
+ {
+ if (sBattlefieldMgr->GetBattlefieldToZoneId(GetZoneId()))
+ ClosestGrave = sBattlefieldMgr->GetBattlefieldToZoneId(GetZoneId())->GetClosestGraveYard(this);
+ else
+ ClosestGrave = sObjectMgr->GetClosestGraveYard(GetPositionX(), GetPositionY(), GetPositionZ(), GetMapId(), GetTeam());
+ }
+ }
// stop countdown until repop
m_deathTimer = 0;
@@ -5665,7 +5679,7 @@ void Player::HandleBaseModValue(BaseModGroup modGroup, BaseModType modType, floa
{
if (modGroup >= BASEMOD_END || modType >= MOD_END)
{
- sLog->outError(LOG_FILTER_PLAYER, "ERROR in HandleBaseModValue(): non existed BaseModGroup of wrong BaseModType!");
+ sLog->outError(LOG_FILTER_SPELLS_AURAS, "ERROR in HandleBaseModValue(): non existed BaseModGroup of wrong BaseModType!");
return;
}
@@ -5696,7 +5710,7 @@ float Player::GetBaseModValue(BaseModGroup modGroup, BaseModType modType) const
{
if (modGroup >= BASEMOD_END || modType > MOD_END)
{
- sLog->outError(LOG_FILTER_PLAYER, "trial to access non existed BaseModGroup or wrong BaseModType!");
+ sLog->outError(LOG_FILTER_SPELLS_AURAS, "trial to access non existed BaseModGroup or wrong BaseModType!");
return 0.0f;
}
@@ -5710,7 +5724,7 @@ float Player::GetTotalBaseModValue(BaseModGroup modGroup) const
{
if (modGroup >= BASEMOD_END)
{
- sLog->outError(LOG_FILTER_PLAYER, "wrong BaseModGroup in GetTotalBaseModValue()!");
+ sLog->outError(LOG_FILTER_SPELLS_AURAS, "wrong BaseModGroup in GetTotalBaseModValue()!");
return 0.0f;
}
@@ -6432,7 +6446,7 @@ void Player::SetSkill(uint16 id, uint16 step, uint16 newVal, uint16 maxVal)
SkillLineEntry const* pSkill = sSkillLineStore.LookupEntry(id);
if (!pSkill)
{
- sLog->outError(LOG_FILTER_PLAYER, "Skill not found in SkillLineStore: skill #%u", id);
+ sLog->outError(LOG_FILTER_PLAYER_SKILLS, "Skill not found in SkillLineStore: skill #%u", id);
return;
}
@@ -6592,8 +6606,6 @@ int16 Player::GetSkillTempBonusValue(uint32 skill) const
void Player::SendActionButtons(uint32 state) const
{
- sLog->outInfo(LOG_FILTER_PLAYER, "Sending Action Buttons for '%u' spec '%u'", GetGUIDLow(), m_activeSpec);
-
WorldPacket data(SMSG_ACTION_BUTTONS, 1+(MAX_ACTION_BUTTONS*4));
data << uint8(state);
/*
@@ -6615,20 +6627,20 @@ void Player::SendActionButtons(uint32 state) const
}
GetSession()->SendPacket(&data);
- sLog->outInfo(LOG_FILTER_PLAYER, "Action Buttons for '%u' spec '%u' Sent", GetGUIDLow(), m_activeSpec);
+ sLog->outInfo(LOG_FILTER_NETWORKIO, "SMSG_ACTION_BUTTONS sent '%u' spec '%u' Sent", GetGUIDLow(), m_activeSpec);
}
bool Player::IsActionButtonDataValid(uint8 button, uint32 action, uint8 type)
{
if (button >= MAX_ACTION_BUTTONS)
{
- sLog->outError(LOG_FILTER_PLAYER, "Action %u not added into button %u for player %s: button must be < %u", action, button, GetName(), MAX_ACTION_BUTTONS);
+ sLog->outError(LOG_FILTER_PLAYER_LOADING, "Action %u not added into button %u for player %s: button must be < %u", action, button, GetName(), MAX_ACTION_BUTTONS);
return false;
}
if (action >= MAX_ACTION_BUTTON_ACTION_VALUE)
{
- sLog->outError(LOG_FILTER_PLAYER, "Action %u not added into button %u for player %s: action must be < %u", action, button, GetName(), MAX_ACTION_BUTTON_ACTION_VALUE);
+ sLog->outError(LOG_FILTER_PLAYER_LOADING, "Action %u not added into button %u for player %s: action must be < %u", action, button, GetName(), MAX_ACTION_BUTTON_ACTION_VALUE);
return false;
}
@@ -6637,7 +6649,7 @@ bool Player::IsActionButtonDataValid(uint8 button, uint32 action, uint8 type)
case ACTION_BUTTON_SPELL:
if (!sSpellMgr->GetSpellInfo(action))
{
- sLog->outError(LOG_FILTER_PLAYER, "Spell action %u not added into button %u for player %s: spell not exist", action, button, GetName());
+ sLog->outError(LOG_FILTER_PLAYER_LOADING, "Spell action %u not added into button %u for player %s: spell not exist", action, button, GetName());
return false;
}
@@ -6650,7 +6662,7 @@ bool Player::IsActionButtonDataValid(uint8 button, uint32 action, uint8 type)
case ACTION_BUTTON_ITEM:
if (!sObjectMgr->GetItemTemplate(action))
{
- sLog->outError(LOG_FILTER_PLAYER, "Item action %u not added into button %u for player %s: item not exist", action, button, GetName());
+ sLog->outError(LOG_FILTER_PLAYER_LOADING, "Item action %u not added into button %u for player %s: item not exist", action, button, GetName());
return false;
}
break;
@@ -6672,7 +6684,7 @@ ActionButton* Player::addActionButton(uint8 button, uint32 action, uint8 type)
// set data and update to CHANGED if not NEW
ab.SetActionAndType(action, ActionButtonType(type));
- sLog->outInfo(LOG_FILTER_PLAYER, "Player '%u' Added Action '%u' (type %u) to Button '%u'", GetGUIDLow(), action, type, button);
+ sLog->outInfo(LOG_FILTER_PLAYER_LOADING, "Player '%u' Added Action '%u' (type %u) to Button '%u'", GetGUIDLow(), action, type, button);
return &ab;
}
@@ -6687,7 +6699,7 @@ void Player::removeActionButton(uint8 button)
else
buttonItr->second.uState = ACTIONBUTTON_DELETED; // saved, will deleted at next save
- sLog->outInfo(LOG_FILTER_PLAYER, "Action Button '%u' Removed from Player '%u'", button, GetGUIDLow());
+ sLog->outInfo(LOG_FILTER_PLAYER_LOADING, "Action Button '%u' Removed from Player '%u'", button, GetGUIDLow());
}
ActionButton const* Player::GetActionButton(uint8 button)
@@ -7252,8 +7264,6 @@ void Player::SetArenaPoints(uint32 value)
void Player::ModifyHonorPoints(int32 value, SQLTransaction* trans /*=NULL*/)
{
- PreparedStatement* stmt = NULL;
-
int32 newValue = int32(GetHonorPoints()) + value;
if (newValue < 0)
newValue = 0;
@@ -7261,7 +7271,7 @@ void Player::ModifyHonorPoints(int32 value, SQLTransaction* trans /*=NULL*/)
if (trans && !trans->null())
{
- stmt = CharacterDatabase.GetPreparedStatement(CHAR_UDP_CHAR_HONOR_POINTS);
+ PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_UDP_CHAR_HONOR_POINTS);
stmt->setUInt32(0, newValue);
stmt->setUInt32(1, GetGUIDLow());
(*trans)->Append(stmt);
@@ -7270,8 +7280,6 @@ void Player::ModifyHonorPoints(int32 value, SQLTransaction* trans /*=NULL*/)
void Player::ModifyArenaPoints(int32 value, SQLTransaction* trans /*=NULL*/)
{
- PreparedStatement* stmt = NULL;
-
int32 newValue = int32(GetArenaPoints()) + value;
if (newValue < 0)
newValue = 0;
@@ -7279,7 +7287,7 @@ void Player::ModifyArenaPoints(int32 value, SQLTransaction* trans /*=NULL*/)
if (trans && !trans->null())
{
- stmt = CharacterDatabase.GetPreparedStatement(CHAR_UDP_CHAR_ARENA_POINTS);
+ PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_UDP_CHAR_ARENA_POINTS);
stmt->setUInt32(0, newValue);
stmt->setUInt32(1, GetGUIDLow());
(*trans)->Append(stmt);
@@ -7416,6 +7424,8 @@ void Player::UpdateZone(uint32 newZone, uint32 newArea)
{
sOutdoorPvPMgr->HandlePlayerLeaveZone(this, m_zoneUpdateId);
sOutdoorPvPMgr->HandlePlayerEnterZone(this, newZone);
+ sBattlefieldMgr->HandlePlayerLeaveZone(this, m_zoneUpdateId);
+ sBattlefieldMgr->HandlePlayerEnterZone(this, newZone);
SendInitWorldStates(newZone, newArea); // only if really enters to new zone, not just area change, works strange...
}
@@ -7495,8 +7505,7 @@ void Player::UpdateZone(uint32 newZone, uint32 newArea)
if (GetRestType() == REST_TYPE_IN_TAVERN) // Still inside a tavern or has recently left
{
// Remove rest state if we have recently left a tavern.
- // Why is 40 yd hardcoded?
- if (GetMapId() != GetInnPosMapId() || GetExactDist(GetInnPosX(), GetInnPosY(), GetInnPosZ()) > 40.0f)
+ if (GetMapId() != GetInnPosMapId() || GetExactDist(GetInnPosX(), GetInnPosY(), GetInnPosZ()) > 1.0f)
{
RemoveFlag(PLAYER_FLAGS, PLAYER_FLAGS_RESTING);
SetRestType(REST_TYPE_NO);
@@ -7563,7 +7572,7 @@ void Player::CheckDuelDistance(time_t currTime)
bool Player::IsOutdoorPvPActive()
{
- return isAlive() && !HasInvisibilityAura() && !HasStealthAura() && (IsPvP() || sWorld->IsPvPRealm()) && !HasUnitMovementFlag(MOVEMENTFLAG_FLYING) && !isInFlight();
+ return isAlive() && !HasInvisibilityAura() && !HasStealthAura() && IsPvP() && !HasUnitMovementFlag(MOVEMENTFLAG_FLYING) && !isInFlight();
}
void Player::DuelComplete(DuelCompleteType type)
@@ -7698,7 +7707,7 @@ void Player::_ApplyItemMods(Item* item, uint8 slot, bool apply)
if (item->IsBroken())
return;
- sLog->outInfo(LOG_FILTER_PLAYER, "applying mods for item %u ", item->GetGUIDLow());
+ sLog->outInfo(LOG_FILTER_PLAYER_ITEMS, "applying mods for item %u ", item->GetGUIDLow());
uint8 attacktype = Player::GetAttackBySlot(slot);
@@ -7904,6 +7913,9 @@ void Player::_ApplyItemBonuses(ItemTemplate const* proto, uint8 slot, bool apply
ApplyModInt32Value(PLAYER_FIELD_MOD_TARGET_RESISTANCE, -val, apply);
m_spellPenetrationItemMod += apply ? val : -val;
break;
+ case ITEM_MOD_BLOCK_VALUE:
+ HandleBaseModValue(SHIELD_BLOCK_VALUE, FLAT_MOD, float(val), apply);
+ break;
// deprecated item mods
case ITEM_MOD_SPELL_HEALING_DONE:
case ITEM_MOD_SPELL_DAMAGE_DONE:
@@ -8290,7 +8302,7 @@ void Player::CastItemCombatSpell(Unit* target, WeaponAttackType attType, uint32
SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(spellData.SpellId);
if (!spellInfo)
{
- sLog->outError(LOG_FILTER_PLAYER, "WORLD: unknown Item spellid %i", spellData.SpellId);
+ sLog->outError(LOG_FILTER_PLAYER_ITEMS, "WORLD: unknown Item spellid %i", spellData.SpellId);
continue;
}
@@ -8359,7 +8371,7 @@ void Player::CastItemCombatSpell(Unit* target, WeaponAttackType attType, uint32
SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(pEnchant->spellid[s]);
if (!spellInfo)
{
- sLog->outError(LOG_FILTER_PLAYER, "Player::CastItemCombatSpell(GUID: %u, name: %s, enchant: %i): unknown spell %i is casted, ignoring...",
+ sLog->outError(LOG_FILTER_PLAYER_ITEMS, "Player::CastItemCombatSpell(GUID: %u, name: %s, enchant: %i): unknown spell %i is casted, ignoring...",
GetGUIDLow(), GetName(), pEnchant->ID, pEnchant->spellid[s]);
continue;
}
@@ -11519,7 +11531,11 @@ InventoryResult Player::CanEquipItem(uint8 slot, uint16 &dest, Item* pItem, bool
if (eslot == EQUIPMENT_SLOT_OFFHAND)
{
- if (type == INVTYPE_WEAPON || type == INVTYPE_WEAPONOFFHAND)
+ // Do not allow polearm to be equipped in the offhand (rare case for the only 1h polearm 41750)
+ if (type == INVTYPE_WEAPON && pProto->SubClass == ITEM_SUBCLASS_WEAPON_POLEARM)
+ return EQUIP_ERR_ITEM_DOESNT_GO_TO_SLOT;
+
+ else if (type == INVTYPE_WEAPON || type == INVTYPE_WEAPONOFFHAND)
{
if (!CanDualWield())
return EQUIP_ERR_CANT_DUAL_WIELD;
@@ -14714,13 +14730,14 @@ bool Player::CanSeeStartQuest(Quest const* quest)
bool Player::CanTakeQuest(Quest const* quest, bool msg)
{
- return SatisfyQuestStatus(quest, msg) && SatisfyQuestExclusiveGroup(quest, msg)
+ return !DisableMgr::IsDisabledFor(DISABLE_TYPE_QUEST, quest->GetQuestId(), this)
+ && SatisfyQuestStatus(quest, msg) && SatisfyQuestExclusiveGroup(quest, msg)
&& SatisfyQuestClass(quest, msg) && SatisfyQuestRace(quest, msg) && SatisfyQuestLevel(quest, msg)
&& SatisfyQuestSkill(quest, msg) && SatisfyQuestReputation(quest, msg)
&& SatisfyQuestPreviousQuest(quest, msg) && SatisfyQuestTimed(quest, msg)
&& SatisfyQuestNextChain(quest, msg) && SatisfyQuestPrevChain(quest, msg)
&& SatisfyQuestDay(quest, msg) && SatisfyQuestWeek(quest, msg)
- && SatisfyQuestSeasonal(quest,msg) && !DisableMgr::IsDisabledFor(DISABLE_TYPE_QUEST, quest->GetQuestId(), this)
+ && SatisfyQuestSeasonal(quest,msg)
&& SatisfyQuestConditions(quest, msg);
}
@@ -15670,7 +15687,6 @@ bool Player::TakeQuestSourceItem(uint32 questId, bool msg)
{
uint32 srcItemId = quest->GetSrcItemId();
ItemTemplate const* item = sObjectMgr->GetItemTemplate(srcItemId);
- bool destroyItem = true;
if (srcItemId > 0)
{
@@ -15690,6 +15706,7 @@ bool Player::TakeQuestSourceItem(uint32 questId, bool msg)
return false;
}
+ bool destroyItem = true;
for (uint8 n = 0; n < QUEST_ITEM_OBJECTIVES_COUNT; ++n)
if (item->StartQuest == questId && srcItemId == quest->RequiredItemId[n])
destroyItem = false;
@@ -16363,7 +16380,7 @@ void Player::SendQuestReward(Quest const* quest, uint32 XP, Object* questGiver)
data << uint32(quest->GetRewOrReqMoney() + int32(quest->GetRewMoneyMaxLevel() * sWorld->getRate(RATE_DROP_MONEY)));
}
- data << 10 * Trinity::Honor::hk_honor_at_level(getLevel(), quest->GetRewHonorMultiplier());
+ data << uint32(10 * quest->CalculateHonorGain(GetQuestLevel(quest)));
data << uint32(quest->GetBonusTalents()); // bonus talents
data << uint32(quest->GetRewArenaPoints());
GetSession()->SendPacket(&data);
@@ -16750,7 +16767,8 @@ bool Player::LoadFromDB(uint32 guid, SQLQueryHolder *holder)
SetUInt32Value(PLAYER_BYTES, fields[9].GetUInt32());
SetUInt32Value(PLAYER_BYTES_2, fields[10].GetUInt32());
- SetUInt32Value(PLAYER_BYTES_3, (fields[49].GetUInt16() & 0xFFFE) | fields[5].GetUInt8());
+ SetByteValue(PLAYER_BYTES_3, 0, fields[5].GetUInt8());
+ SetByteValue(PLAYER_BYTES_3, 1, fields[49].GetUInt8());
SetUInt32Value(PLAYER_FLAGS, fields[11].GetUInt32());
SetInt32Value(PLAYER_FIELD_WATCHED_FACTION_INDEX, fields[48].GetUInt32());
@@ -17060,13 +17078,11 @@ bool Player::LoadFromDB(uint32 guid, SQLQueryHolder *holder)
// set value, including drunk invisibility detection
// calculate sobering. after 15 minutes logged out, the player will be sober again
- float soberFactor;
- if (time_diff > 15*MINUTE)
- soberFactor = 0;
- else
- soberFactor = 1-time_diff/(15.0f*MINUTE);
- uint16 newDrunkenValue = uint16(soberFactor*(GetUInt32Value(PLAYER_BYTES_3) & 0xFFFE));
- SetDrunkValue(newDrunkenValue);
+ uint8 newDrunkValue = 0;
+ if (time_diff < uint32(GetDrunkValue()) * 9)
+ newDrunkValue = GetDrunkValue() - time_diff / 9;
+
+ SetDrunkValue(newDrunkValue);
m_cinematic = fields[18].GetUInt8();
m_Played_time[PLAYED_TIME_TOTAL]= fields[19].GetUInt32();
@@ -17109,7 +17125,7 @@ bool Player::LoadFromDB(uint32 guid, SQLQueryHolder *holder)
SetUInt64Value(PLAYER_FARSIGHT, 0);
SetCreatorGUID(0);
- RemoveFlag(UNIT_FIELD_FLAGS_2, UNIT_FLAG2_FORCE_MOVE);
+ RemoveFlag(UNIT_FIELD_FLAGS_2, UNIT_FLAG2_FORCE_MOVEMENT);
// reset some aura modifiers before aura apply
SetUInt32Value(PLAYER_TRACK_CREATURES, 0);
@@ -17506,8 +17522,8 @@ void Player::_LoadInventory(PreparedQueryResult result, uint32 timeDiff)
{
uint32 zoneId = GetZoneId();
- std::map<uint64, Bag*> bagMap; // fast guid lookup for bags
- std::map<uint64, Item*> invalidBagMap; // fast guid lookup for bags
+ std::map<uint32, Bag*> bagMap; // fast guid lookup for bags
+ std::map<uint32, Item*> invalidBagMap; // fast guid lookup for bags
std::list<Item*> problematicItems;
SQLTransaction trans = CharacterDatabase.BeginTransaction();
@@ -17566,7 +17582,7 @@ void Player::_LoadInventory(PreparedQueryResult result, uint32 timeDiff)
{
item->SetSlot(NULL_SLOT);
// Item is in the bag, find the bag
- std::map<uint64, Bag*>::iterator itr = bagMap.find(bagGuid);
+ std::map<uint32, Bag*>::iterator itr = bagMap.find(bagGuid);
if (itr != bagMap.end())
{
ItemPosCountVec dest;
@@ -17576,8 +17592,8 @@ void Player::_LoadInventory(PreparedQueryResult result, uint32 timeDiff)
}
else if (invalidBagMap.find(bagGuid) != invalidBagMap.end())
{
- std::map<uint64, Item*>::iterator itr = invalidBagMap.find(bagGuid);
- if (std::find(problematicItems.begin(),problematicItems.end(),itr->second) != problematicItems.end())
+ std::map<uint32, Item*>::iterator itr = invalidBagMap.find(bagGuid);
+ if (std::find(problematicItems.begin(), problematicItems.end(), itr->second) != problematicItems.end())
err = EQUIP_ERR_INT_BAG_ERROR;
}
else
@@ -17627,7 +17643,6 @@ void Player::_LoadInventory(PreparedQueryResult result, uint32 timeDiff)
Item* Player::_LoadItem(SQLTransaction& trans, uint32 zoneId, uint32 timeDiff, Field* fields)
{
- PreparedStatement* stmt = NULL;
Item* item = NULL;
uint32 itemGuid = fields[13].GetUInt32();
uint32 itemEntry = fields[14].GetUInt32();
@@ -17637,6 +17652,8 @@ Item* Player::_LoadItem(SQLTransaction& trans, uint32 zoneId, uint32 timeDiff, F
item = NewItemOrBag(proto);
if (item->LoadFromDB(itemGuid, GetGUID(), fields, itemEntry))
{
+ PreparedStatement* stmt = NULL;
+
// Do not allow to have item limited to another map/zone in alive state
if (isAlive() && item->IsLimitedToAnotherMapOrZone(GetMapId(), zoneId))
{
@@ -18660,7 +18677,7 @@ void Player::SaveToDB(bool create /*=false*/)
stmt->setUInt32(index++, GetUInt32Value(PLAYER_CHOSEN_TITLE));
stmt->setUInt64(index++, GetUInt64Value(PLAYER_FIELD_KNOWN_CURRENCIES));
stmt->setUInt32(index++, GetUInt32Value(PLAYER_FIELD_WATCHED_FACTION_INDEX));
- stmt->setUInt16(index++, (uint16)(GetUInt32Value(PLAYER_BYTES_3) & 0xFFFE));
+ stmt->setUInt8(index++, GetDrunkValue());
stmt->setUInt32(index++, GetHealth());
for (uint32 i = 0; i < MAX_POWERS; ++i)
@@ -18771,7 +18788,7 @@ void Player::SaveToDB(bool create /*=false*/)
stmt->setUInt32(index++, GetUInt32Value(PLAYER_CHOSEN_TITLE));
stmt->setUInt64(index++, GetUInt64Value(PLAYER_FIELD_KNOWN_CURRENCIES));
stmt->setUInt32(index++, GetUInt32Value(PLAYER_FIELD_WATCHED_FACTION_INDEX));
- stmt->setUInt16(index++, (uint16)(GetUInt32Value(PLAYER_BYTES_3) & 0xFFFE));
+ stmt->setUInt8(index++, GetDrunkValue());
stmt->setUInt32(index++, GetHealth());
for (uint32 i = 0; i < MAX_POWERS; ++i)
@@ -22081,7 +22098,7 @@ void Player::SendInitialPacketsBeforeAddToMap()
SendEquipmentSetList();
data.Initialize(SMSG_LOGIN_SETTIMESPEED, 4 + 4 + 4);
- data << uint32(secsToTimeBitFields(sWorld->GetGameTime()));
+ data.AppendPackedTime(sWorld->GetGameTime());
data << float(0.01666667f); // game speed
data << uint32(0); // added in 3.1.2
GetSession()->SendPacket(&data);
@@ -23304,7 +23321,7 @@ bool Player::isUsingLfg()
return sLFGMgr->GetState(guid) != LFG_STATE_NONE;
}
-void Player::SetBattlegroundRaid(Group* group, int8 subgroup)
+void Player::SetBattlegroundOrBattlefieldRaid(Group* group, int8 subgroup)
{
//we must move references from m_group to m_originalGroup
SetOriginalGroup(GetGroup(), GetSubGroup());
@@ -23314,7 +23331,7 @@ void Player::SetBattlegroundRaid(Group* group, int8 subgroup)
m_group.setSubGroup((uint8)subgroup);
}
-void Player::RemoveFromBattlegroundRaid()
+void Player::RemoveFromBattlegroundOrBattlefieldRaid()
{
//remove existing reference
m_group.unlink();
@@ -24493,11 +24510,11 @@ bool Player::canSeeSpellClickOn(Creature const* c) const
ConditionList conds = sConditionMgr->GetConditionsForSpellClickEvent(c->GetEntry(), itr->second.spellId);
ConditionSourceInfo info = ConditionSourceInfo(const_cast<Player*>(this), const_cast<Creature*>(c));
- if (!sConditionMgr->IsObjectMeetToConditions(info, conds))
- return false;
+ if (sConditionMgr->IsObjectMeetToConditions(info, conds))
+ return true;
}
- return true;
+ return false;
}
void Player::BuildPlayerTalentsInfoData(WorldPacket* data)
diff --git a/src/server/game/Entities/Player/Player.h b/src/server/game/Entities/Player/Player.h
index 774e75104b1..5637b3b5af0 100755
--- a/src/server/game/Entities/Player/Player.h
+++ b/src/server/game/Entities/Player/Player.h
@@ -114,7 +114,7 @@ struct PlayerTalent
// Spell modifier (used for modify other spells)
struct SpellModifier
{
- SpellModifier(Aura* _ownerAura = NULL) : charges(0), ownerAura(_ownerAura) {}
+ SpellModifier(Aura* _ownerAura = NULL) : op(SPELLMOD_DAMAGE), type(SPELLMOD_FLAT), charges(0), value(0), mask(), spellId(0), ownerAura(_ownerAura) {}
SpellModOp op : 8;
SpellModType type : 8;
int16 charges : 16;
@@ -299,7 +299,7 @@ struct Areas
enum RuneCooldowns
{
RUNE_BASE_COOLDOWN = 10000,
- RUNE_MISS_COOLDOWN = 1500, // cooldown applied on runes when the spell misses
+ RUNE_MISS_COOLDOWN = 1500 // cooldown applied on runes when the spell misses
};
enum RuneType
@@ -399,7 +399,7 @@ enum PlayerFlags
PLAYER_FLAGS_UNK28 = 0x10000000,
PLAYER_FLAGS_UNK29 = 0x20000000,
PLAYER_FLAGS_UNK30 = 0x40000000,
- PLAYER_FLAGS_UNK31 = 0x80000000,
+ PLAYER_FLAGS_UNK31 = 0x80000000
};
// used for PLAYER__FIELD_KNOWN_TITLES field (uint64), (1<<bit_index) without (-1)
@@ -672,7 +672,7 @@ enum TradeSlots
TRADE_SLOT_COUNT = 7,
TRADE_SLOT_TRADED_COUNT = 6,
TRADE_SLOT_NONTRADED = 6,
- TRADE_SLOT_INVALID = -1,
+ TRADE_SLOT_INVALID = -1
};
enum TransferAbortReason
@@ -692,7 +692,7 @@ enum TransferAbortReason
TRANSFER_ABORT_NOT_FOUND2 = 0x0D, // 3.1
TRANSFER_ABORT_NOT_FOUND3 = 0x0E, // 3.2
TRANSFER_ABORT_REALM_ONLY = 0x0F, // All players on party must be from the same realm.
- TRANSFER_ABORT_MAP_NOT_ALLOWED = 0x10, // Map can't be entered at this time.
+ TRANSFER_ABORT_MAP_NOT_ALLOWED = 0x10 // Map can't be entered at this time.
};
enum InstanceResetWarningType
@@ -739,7 +739,7 @@ enum TeleportToOptions
TELE_TO_NOT_LEAVE_TRANSPORT = 0x02,
TELE_TO_NOT_LEAVE_COMBAT = 0x04,
TELE_TO_NOT_UNSUMMON_PET = 0x08,
- TELE_TO_SPELL = 0x10,
+ TELE_TO_SPELL = 0x10
};
/// Type of environmental damages
@@ -761,7 +761,7 @@ enum PlayerChatTag
CHAT_TAG_DND = 0x02,
CHAT_TAG_GM = 0x04,
CHAT_TAG_COM = 0x08, // Commentator
- CHAT_TAG_DEV = 0x10,
+ CHAT_TAG_DEV = 0x10
};
enum PlayedTimeIndex
@@ -807,7 +807,7 @@ enum PlayerLoginQueryIndex
PLAYER_LOGIN_QUERY_LOADQUESTSTATUSREW = 29,
PLAYER_LOGIN_QUERY_LOADINSTANCELOCKTIMES = 30,
PLAYER_LOGIN_QUERY_LOADSEASONALQUESTSTATUS = 31,
- MAX_PLAYER_LOGIN_QUERY,
+ MAX_PLAYER_LOGIN_QUERY
};
enum PlayerDelayedOperations
@@ -896,6 +896,16 @@ enum PlayerRestState
REST_STATE_RAF_LINKED = 0x06
};
+enum PlayerCommandStates
+{
+ CHEAT_NONE = 0x00,
+ CHEAT_GOD = 0x01,
+ CHEAT_CASTTIME = 0x02,
+ CHEAT_COOLDOWN = 0x04,
+ CHEAT_POWER = 0x08,
+ CHEAT_WATERWALK = 0x10
+};
+
class PlayerTaxi
{
public:
@@ -981,7 +991,7 @@ class TradeData
public: // constructors
TradeData(Player* player, Player* trader) :
m_player(player), m_trader(trader), m_accepted(false), m_acceptProccess(false),
- m_money(0), m_spell(0) {}
+ m_money(0), m_spell(0), m_spellCastItem(0) { memset(m_items, 0, TRADE_SLOT_COUNT * sizeof(uint64)); }
Player* GetTrader() const { return m_trader; }
TradeData* GetTraderData() const;
@@ -1148,6 +1158,11 @@ class Player : public Unit, public GridObject<Player>
void InitStatsForLevel(bool reapplyMods = false);
+ // .cheat command related
+ bool GetCommandStatus(uint32 command) const { return _activeCheats & command; }
+ void SetCommandStatusOn(uint32 command) { _activeCheats |= command; }
+ void SetCommandStatusOff(uint32 command) { _activeCheats &= ~command; }
+
// Played Time Stuff
time_t m_logintime;
time_t m_Last_tick;
@@ -2050,9 +2065,9 @@ class Player : public Unit, public GridObject<Player>
inline SpellCooldowns GetSpellCooldowns() const { return m_spellCooldowns; }
- void SetDrunkValue(uint16 newDrunkValue, uint32 itemid=0);
- uint16 GetDrunkValue() const { return m_drunk; }
- static DrunkenState GetDrunkenstateByValue(uint16 value);
+ void SetDrunkValue(uint8 newDrunkValue, uint32 itemId = 0);
+ uint8 GetDrunkValue() const { return GetByteValue(PLAYER_BYTES_3, 1); }
+ static DrunkenState GetDrunkenstateByValue(uint8 value);
uint32 GetDeathTimer() const { return m_deathTimer; }
uint32 GetCorpseReclaimDelay(bool pvp) const;
@@ -2417,9 +2432,9 @@ class Player : public Unit, public GridObject<Player>
Player* GetNextRandomRaidMember(float radius);
PartyResult CanUninviteFromGroup() const;
- // Battleground Group System
- void SetBattlegroundRaid(Group* group, int8 subgroup = -1);
- void RemoveFromBattlegroundRaid();
+ // Battleground / Battlefield Group System
+ void SetBattlegroundOrBattlefieldRaid(Group* group, int8 subgroup = -1);
+ void RemoveFromBattlegroundOrBattlefieldRaid();
Group* GetOriginalGroup() { return m_originalGroup.getTarget(); }
GroupReference& GetOriginalGroupRef() { return m_originalGroup; }
uint8 GetOriginalSubGroup() const { return m_originalGroup.getSubGroup(); }
@@ -2720,7 +2735,6 @@ class Player : public Unit, public GridObject<Player>
time_t m_lastDailyQuestTime;
uint32 m_drunkTimer;
- uint16 m_drunk;
uint32 m_weaponChangeTimer;
uint32 m_zoneUpdateId;
@@ -2855,6 +2869,8 @@ class Player : public Unit, public GridObject<Player>
InstanceTimeMap _instanceResetTimes;
uint32 _pendingBindId;
uint32 _pendingBindTimer;
+
+ uint32 _activeCheats;
};
void AddItemsSetItem(Player*player, Item* item);
diff --git a/src/server/game/Entities/Player/SocialMgr.h b/src/server/game/Entities/Player/SocialMgr.h
index 3c7d13070fa..99a40d6110f 100755
--- a/src/server/game/Entities/Player/SocialMgr.h
+++ b/src/server/game/Entities/Player/SocialMgr.h
@@ -54,24 +54,12 @@ struct FriendInfo
uint8 Class;
std::string Note;
- FriendInfo()
+ FriendInfo() : Status(FRIEND_STATUS_OFFLINE), Flags(0), Area(0), Level(0), Class(0), Note()
{
- Status = FRIEND_STATUS_OFFLINE;
- Flags = 0;
- Area = 0;
- Level = 0;
- Class = 0;
- Note = "";
}
- FriendInfo(uint8 flags, const std::string& note)
+ FriendInfo(uint8 flags, const std::string& note) : Status(FRIEND_STATUS_OFFLINE), Flags(flags), Area(0), Level(0), Class(0), Note(note)
{
- Status = FRIEND_STATUS_OFFLINE;
- Flags = flags;
- Area = 0;
- Level = 0;
- Class = 0;
- Note = note;
}
};
diff --git a/src/server/game/Entities/Totem/Totem.cpp b/src/server/game/Entities/Totem/Totem.cpp
index 80c5de35e59..d5d1bd99277 100755
--- a/src/server/game/Entities/Totem/Totem.cpp
+++ b/src/server/game/Entities/Totem/Totem.cpp
@@ -86,7 +86,7 @@ void Totem::InitStats(uint32 duration)
void Totem::InitSummon()
{
- if (m_type == TOTEM_PASSIVE)
+ if (m_type == TOTEM_PASSIVE && GetSpell())
{
CastSpell(this, GetSpell(), true);
}
@@ -96,10 +96,16 @@ void Totem::InitSummon()
CastSpell(this, GetSpell(1), true);
}
-void Totem::UnSummon()
+void Totem::UnSummon(uint32 msTime)
{
+ if (msTime)
+ {
+ m_Events.AddEvent(new ForcedUnsummonDelayEvent(*this), m_Events.CalculateTime(msTime));
+ return;
+ }
+
CombatStop();
- RemoveAurasDueToSpell(GetSpell());
+ RemoveAurasDueToSpell(GetSpell(), GetGUID());
// clear owner's totem slot
for (int i = SUMMON_SLOT_TOTEM; i < MAX_TOTEM_SLOT; ++i)
@@ -111,7 +117,11 @@ void Totem::UnSummon()
}
}
- m_owner->RemoveAurasDueToSpell(GetSpell());
+ m_owner->RemoveAurasDueToSpell(GetSpell(), GetGUID());
+
+ // Remove Sentry Totem Aura
+ if (GetEntry() == SENTRY_TOTEM_ENTRY)
+ m_owner->RemoveAurasDueToSpell(SENTRY_TOTEM_SPELLID);
//remove aura all party members too
if (Player* owner = m_owner->ToPlayer())
@@ -127,7 +137,7 @@ void Totem::UnSummon()
{
Player* target = itr->getSource();
if (target && group->SameSubGroup(owner, target))
- target->RemoveAurasDueToSpell(GetSpell());
+ target->RemoveAurasDueToSpell(GetSpell(), GetGUID());
}
}
}
diff --git a/src/server/game/Entities/Totem/Totem.h b/src/server/game/Entities/Totem/Totem.h
index c33b8776660..6271253498d 100755
--- a/src/server/game/Entities/Totem/Totem.h
+++ b/src/server/game/Entities/Totem/Totem.h
@@ -27,8 +27,10 @@ enum TotemType
TOTEM_ACTIVE = 1,
TOTEM_STATUE = 2 // copied straight from MaNGOS, may need more implementation to work
};
+// Some Totems cast spells that are not in creature DB
+#define SENTRY_TOTEM_SPELLID 6495
-#define SENTRY_TOTEM_ENTRY 3968
+#define SENTRY_TOTEM_ENTRY 3968
class Totem : public Minion
{
@@ -38,7 +40,7 @@ class Totem : public Minion
void Update(uint32 time);
void InitStats(uint32 duration);
void InitSummon();
- void UnSummon();
+ void UnSummon(uint32 msTime = 0);
uint32 GetSpell(uint8 slot = 0) const { return m_spells[slot]; }
uint32 GetTotemDuration() const { return m_duration; }
void SetTotemDuration(uint32 duration) { m_duration = duration; }
diff --git a/src/server/game/Entities/Transport/Transport.cpp b/src/server/game/Entities/Transport/Transport.cpp
index 52d5c9114ff..558fdd72a95 100755
--- a/src/server/game/Entities/Transport/Transport.cpp
+++ b/src/server/game/Entities/Transport/Transport.cpp
@@ -35,8 +35,7 @@ void MapManager::LoadTransports()
if (!result)
{
- sLog->outInfo(LOG_FILTER_TRANSPORTS, ">> Loaded 0 transports. DB table `transports` is empty!");
-
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 transports. DB table `transports` is empty!");
return;
}
@@ -66,7 +65,7 @@ void MapManager::LoadTransports()
continue;
}
- // sLog->outInfo(LOG_FILTER_TRANSPORTS, "Loading transport %d between %s, %s", entry, name.c_str(), goinfo->name);
+ // sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading transport %d between %s, %s", entry, name.c_str(), goinfo->name);
std::set<uint32> mapsUsed;
@@ -121,8 +120,7 @@ void MapManager::LoadTransports()
while (result->NextRow());
}
- sLog->outInfo(LOG_FILTER_TRANSPORTS, ">> Loaded %u transports in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
-
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u transports in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
}
void MapManager::LoadTransportNPCs()
@@ -134,8 +132,7 @@ void MapManager::LoadTransportNPCs()
if (!result)
{
- sLog->outInfo(LOG_FILTER_TRANSPORTS, ">> Loaded 0 transport NPCs. DB table `creature_transport` is empty!");
-
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 transport NPCs. DB table `creature_transport` is empty!");
return;
}
@@ -166,8 +163,7 @@ void MapManager::LoadTransportNPCs()
}
while (result->NextRow());
- sLog->outInfo(LOG_FILTER_TRANSPORTS, ">> Loaded %u transport npcs in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
-
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u transport npcs in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
}
Transport::Transport(uint32 period, uint32 script) : GameObject(), m_pathTime(0), m_timer(0),
@@ -708,17 +704,15 @@ void Transport::UpdateNPCPositions()
}
}
-//! This method transforms supplied transport offsets into global coordinates
void Transport::CalculatePassengerPosition(float& x, float& y, float& z, float& o)
{
float inx = x, iny = y, inz = z, ino = o;
o = GetOrientation() + ino;
- x = GetPositionX() + (inx * cos(GetOrientation()) + iny * sin(GetOrientation() + M_PI));
- y = GetPositionY() + (iny * cos(GetOrientation()) + inx * sin(GetOrientation()));
+ x = GetPositionX() + inx * cos(GetOrientation()) - iny * sin(GetOrientation());
+ y = GetPositionY() + iny * cos(GetOrientation()) + inx * sin(GetOrientation());
z = GetPositionZ() + inz;
}
-//! This method transforms supplied global coordinates into local offsets
void Transport::CalculatePassengerOffset(float& x, float& y, float& z, float& o)
{
o -= GetOrientation();
@@ -726,6 +720,6 @@ void Transport::CalculatePassengerOffset(float& x, float& y, float& z, float& o)
y -= GetPositionY(); // y = searchedY * cos(o) + searchedX * sin(o)
x -= GetPositionX(); // x = searchedX * cos(o) + searchedY * sin(o + pi)
float inx = x, iny = y;
- y = (iny - inx * tan(GetOrientation())) / (cos(GetOrientation()) - sin(GetOrientation() + M_PI) * tan(GetOrientation()));
- x = (inx - iny * sin(GetOrientation() + M_PI) / cos(GetOrientation())) / (cos(GetOrientation()) - tan(GetOrientation()) * sin(GetOrientation() + M_PI));
+ y = (iny - inx * tan(GetOrientation())) / (cos(GetOrientation()) + sin(GetOrientation()) * tan(GetOrientation()));
+ x = (inx + iny * tan(GetOrientation())) / (cos(GetOrientation()) + sin(GetOrientation()) * tan(GetOrientation()));
}
diff --git a/src/server/game/Entities/Transport/Transport.h b/src/server/game/Entities/Transport/Transport.h
index 4b0c42c9071..8fd12b50695 100755
--- a/src/server/game/Entities/Transport/Transport.h
+++ b/src/server/game/Entities/Transport/Transport.h
@@ -20,12 +20,13 @@
#define TRANSPORTS_H
#include "GameObject.h"
+#include "VehicleDefines.h"
#include <map>
#include <set>
#include <string>
-class Transport : public GameObject
+class Transport : public GameObject, public TransportBase
{
public:
Transport(uint32 period, uint32 script);
@@ -47,8 +48,13 @@ class Transport : public GameObject
uint32 AddNPCPassenger(uint32 tguid, uint32 entry, float x, float y, float z, float o, uint32 anim=0);
void UpdatePosition(MovementInfo* mi);
void UpdateNPCPositions();
+
+ /// This method transforms supplied transport offsets into global coordinates
void CalculatePassengerPosition(float& x, float& y, float& z, float& o);
+
+ /// This method transforms supplied global coordinates into local offsets
void CalculatePassengerOffset(float& x, float& y, float& z, float& o);
+
void BuildStartMovePacket(Map const* targetMap);
void BuildStopMovePacket(Map const* targetMap);
uint32 GetScriptId() const { return ScriptId; }
diff --git a/src/server/game/Entities/Unit/Unit.cpp b/src/server/game/Entities/Unit/Unit.cpp
index 6b426d04fd7..7dc1afa9738 100755
--- a/src/server/game/Entities/Unit/Unit.cpp
+++ b/src/server/game/Entities/Unit/Unit.cpp
@@ -57,6 +57,8 @@
#include "MoveSpline.h"
#include "ConditionMgr.h"
#include "UpdateFieldFlags.h"
+#include "Battlefield.h"
+#include "BattlefieldMgr.h"
#include <math.h>
@@ -152,12 +154,25 @@ _hitMask(hitMask), _spell(spell), _damageInfo(damageInfo), _healInfo(healInfo)
#ifdef _MSC_VER
#pragma warning(disable:4355)
#endif
-Unit::Unit(bool isWorldObject): WorldObject(isWorldObject),
-m_movedPlayer(NULL), m_lastSanctuaryTime(0), IsAIEnabled(false), NeedChangeAI(false),
-m_ControlledByPlayer(false), movespline(new Movement::MoveSpline()), i_AI(NULL),
-i_disabledAI(NULL), m_procDeep(0), m_removedAurasCount(0), i_motionMaster(this),
-m_ThreatManager(this), m_vehicle(NULL), m_vehicleKit(NULL), m_unitTypeMask(UNIT_MASK_NONE),
-m_HostileRefManager(this)
+Unit::Unit(bool isWorldObject): WorldObject(isWorldObject)
+ , m_movedPlayer(NULL)
+ , m_lastSanctuaryTime(0)
+ , m_TempSpeed(0.0f)
+ , IsAIEnabled(false)
+ , NeedChangeAI(false)
+ , m_ControlledByPlayer(false)
+ , movespline(new Movement::MoveSpline())
+ , i_AI(NULL)
+ , i_disabledAI(NULL)
+ , m_AutoRepeatFirstCast(false)
+ , m_procDeep(0)
+ , m_removedAurasCount(0)
+ , i_motionMaster(this)
+ , m_ThreatManager(this)
+ , m_vehicle(NULL)
+ , m_vehicleKit(NULL)
+ , m_unitTypeMask(UNIT_MASK_NONE)
+ , m_HostileRefManager(this)
{
#ifdef _MSC_VER
#pragma warning(default:4355)
@@ -252,8 +267,8 @@ m_HostileRefManager(this)
m_serverSideVisibility.SetValue(SERVERSIDE_VISIBILITY_GHOST, GHOST_VISIBILITY_ALIVE);
_focusSpell = NULL;
- _targetLocked = false;
_lastLiquid = NULL;
+ _isWalkingBeforeCharm = false;
}
////////////////////////////////////////////////////////////
@@ -378,9 +393,7 @@ void Unit::MonsterMoveWithSpeed(float x, float y, float z, float speed)
void Unit::UpdateSplineMovement(uint32 t_diff)
{
- enum{
- POSITION_UPDATE_DELAY = 400,
- };
+ uint32 const positionUpdateDelay = 400;
if (movespline->Finalized())
return;
@@ -394,7 +407,7 @@ void Unit::UpdateSplineMovement(uint32 t_diff)
m_movesplineTimer.Update(t_diff);
if (m_movesplineTimer.Passed() || arrived)
{
- m_movesplineTimer.Reset(POSITION_UPDATE_DELAY);
+ m_movesplineTimer.Reset(positionUpdateDelay);
Movement::Location loc = movespline->ComputePosition();
if (HasUnitMovementFlag(MOVEMENTFLAG_ONTRANSPORT))
@@ -404,17 +417,14 @@ void Unit::UpdateSplineMovement(uint32 t_diff)
pos.m_positionY = loc.y;
pos.m_positionZ = loc.z;
pos.m_orientation = loc.orientation;
- if (Unit* vehicle = GetVehicleBase())
- {
- loc.x += vehicle->GetPositionX();
- loc.y += vehicle->GetPositionY();
- loc.z += vehicle->GetPositionZMinusOffset();
- loc.orientation = vehicle->GetOrientation();
- }
- else if (Transport* trans = GetTransport())
- trans->CalculatePassengerPosition(loc.x, loc.y, loc.z, loc.orientation);
+
+ if (TransportBase* transport = GetDirectTransport())
+ transport->CalculatePassengerPosition(loc.x, loc.y, loc.z, loc.orientation);
}
+ if (HasUnitState(UNIT_STATE_CANNOT_TURN))
+ loc.orientation = GetOrientation();
+
UpdatePosition(loc.x, loc.y, loc.z, loc.orientation);
}
}
@@ -539,9 +549,12 @@ uint32 Unit::DealDamage(Unit* victim, uint32 damage, CleanDamage const* cleanDam
if (IsAIEnabled)
GetAI()->DamageDealt(victim, damage, damagetype);
- // Signal to pets that their owner was attacked
if (victim->GetTypeId() == TYPEID_PLAYER)
{
+ if (victim->ToPlayer()->GetCommandStatus(CHEAT_GOD))
+ return 0;
+
+ // Signal to pets that their owner was attacked
Pet* pet = victim->ToPlayer()->GetPet();
if (pet && pet->isAlive())
@@ -857,17 +870,24 @@ void Unit::CastCustomSpell(Unit* target, uint32 spellId, int32 const* bp0, int32
values.AddSpellMod(SPELLVALUE_BASE_POINT1, *bp1);
if (bp2)
values.AddSpellMod(SPELLVALUE_BASE_POINT2, *bp2);
- CastCustomSpell(spellId, values, target, triggered, castItem, triggeredByAura, originalCaster);
+ CastCustomSpell(spellId, values, target, triggered ? TRIGGERED_FULL_MASK : TRIGGERED_NONE, castItem, triggeredByAura, originalCaster);
}
void Unit::CastCustomSpell(uint32 spellId, SpellValueMod mod, int32 value, Unit* target, bool triggered, Item* castItem, AuraEffect const* triggeredByAura, uint64 originalCaster)
{
CustomSpellValues values;
values.AddSpellMod(mod, value);
- CastCustomSpell(spellId, values, target, triggered, castItem, triggeredByAura, originalCaster);
+ CastCustomSpell(spellId, values, target, triggered ? TRIGGERED_FULL_MASK : TRIGGERED_NONE, castItem, triggeredByAura, originalCaster);
+}
+
+void Unit::CastCustomSpell(uint32 spellId, SpellValueMod mod, int32 value, Unit* target, TriggerCastFlags triggerFlags, Item* castItem, AuraEffect const* triggeredByAura, uint64 originalCaster)
+{
+ CustomSpellValues values;
+ values.AddSpellMod(mod, value);
+ CastCustomSpell(spellId, values, target, triggerFlags, castItem, triggeredByAura, originalCaster);
}
-void Unit::CastCustomSpell(uint32 spellId, CustomSpellValues const& value, Unit* victim, bool triggered, Item* castItem, AuraEffect const* triggeredByAura, uint64 originalCaster)
+void Unit::CastCustomSpell(uint32 spellId, CustomSpellValues const& value, Unit* victim, TriggerCastFlags triggerFlags, Item* castItem, AuraEffect const* triggeredByAura, uint64 originalCaster)
{
SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(spellId);
if (!spellInfo)
@@ -878,7 +898,7 @@ void Unit::CastCustomSpell(uint32 spellId, CustomSpellValues const& value, Unit*
SpellCastTargets targets;
targets.SetUnitTarget(victim);
- CastSpell(targets, spellInfo, &value, triggered ? TRIGGERED_FULL_MASK : TRIGGERED_NONE, castItem, triggeredByAura, originalCaster);
+ CastSpell(targets, spellInfo, &value, triggerFlags, castItem, triggeredByAura, originalCaster);
}
void Unit::CastSpell(float x, float y, float z, uint32 spellId, bool triggered, Item* castItem, AuraEffect const* triggeredByAura, uint64 originalCaster)
@@ -4293,11 +4313,16 @@ uint32 Unit::GetDoTsByCaster(uint64 casterGUID) const
int32 Unit::GetTotalAuraModifier(AuraType auratype) const
{
+ std::map<SpellGroup, int32> SameEffectSpellGroup;
int32 modifier = 0;
AuraEffectList const& mTotalAuraList = GetAuraEffectsByType(auratype);
for (AuraEffectList::const_iterator i = mTotalAuraList.begin(); i != mTotalAuraList.end(); ++i)
- modifier += (*i)->GetAmount();
+ if (!sSpellMgr->AddSameEffectStackRuleSpellGroups((*i)->GetSpellInfo(), (*i)->GetAmount(), SameEffectSpellGroup))
+ modifier += (*i)->GetAmount();
+
+ for (std::map<SpellGroup, int32>::const_iterator itr = SameEffectSpellGroup.begin(); itr != SameEffectSpellGroup.end(); ++itr)
+ modifier += itr->second;
return modifier;
}
@@ -4341,14 +4366,19 @@ int32 Unit::GetMaxNegativeAuraModifier(AuraType auratype) const
int32 Unit::GetTotalAuraModifierByMiscMask(AuraType auratype, uint32 misc_mask) const
{
+ std::map<SpellGroup, int32> SameEffectSpellGroup;
int32 modifier = 0;
AuraEffectList const& mTotalAuraList = GetAuraEffectsByType(auratype);
+
for (AuraEffectList::const_iterator i = mTotalAuraList.begin(); i != mTotalAuraList.end(); ++i)
- {
- if ((*i)->GetMiscValue()& misc_mask)
- modifier += (*i)->GetAmount();
- }
+ if ((*i)->GetMiscValue() & misc_mask)
+ if (!sSpellMgr->AddSameEffectStackRuleSpellGroups((*i)->GetSpellInfo(), (*i)->GetAmount(), SameEffectSpellGroup))
+ modifier += (*i)->GetAmount();
+
+ for (std::map<SpellGroup, int32>::const_iterator itr = SameEffectSpellGroup.begin(); itr != SameEffectSpellGroup.end(); ++itr)
+ modifier += itr->second;
+
return modifier;
}
@@ -6660,34 +6690,6 @@ bool Unit::HandleDummyAuraProc(Unit* victim, uint32 damage, AuraEffect* triggere
CastCustomSpell(target, triggered_spell_id, &basepoints0, &basepoints0, NULL, true, castItem, triggeredByAura);
return true;
}
- // Sacred Shield
- if (dummySpell->SpellFamilyFlags[1] & 0x80000)
- {
- if (procFlag & PROC_FLAG_TAKEN_SPELL_MAGIC_DMG_CLASS_POS)
- {
- if (procSpell->SpellFamilyName == SPELLFAMILY_PALADIN && (procSpell->SpellFamilyFlags[0] & 0x40000000))
- {
- basepoints0 = damage / 12;
-
- if (basepoints0)
- CastCustomSpell(this, 66922, &basepoints0, NULL, NULL, true, 0, triggeredByAura, victim->GetGUID());
-
- return true;
- }
- else
- return false;
- }
- else if (damage > 0)
- triggered_spell_id = 58597;
-
- // Item - Paladin T8 Holy 4P Bonus
- if (Unit* caster = triggeredByAura->GetCaster())
- if (AuraEffect const* aurEff = caster->GetAuraEffect(64895, 0))
- cooldown = aurEff->GetAmount();
-
- target = this;
- break;
- }
// Righteous Vengeance
if (dummySpell->SpellIconID == 3025)
{
@@ -6708,6 +6710,23 @@ bool Unit::HandleDummyAuraProc(Unit* victim, uint32 damage, AuraEffect* triggere
}
switch (dummySpell->Id)
{
+ // Sacred Shield
+ case 53601:
+ {
+ if (procFlag & PROC_FLAG_TAKEN_SPELL_MAGIC_DMG_CLASS_POS)
+ return false;
+
+ if (damage > 0)
+ triggered_spell_id = 58597;
+
+ // Item - Paladin T8 Holy 4P Bonus
+ if (Unit* caster = triggeredByAura->GetCaster())
+ if (AuraEffect const* aurEff = caster->GetAuraEffect(64895, 0))
+ cooldown = aurEff->GetAmount();
+
+ target = this;
+ break;
+ }
// Heart of the Crusader
case 20335: // rank 1
triggered_spell_id = 21183;
@@ -6721,10 +6740,13 @@ bool Unit::HandleDummyAuraProc(Unit* victim, uint32 damage, AuraEffect* triggere
// Judgement of Light
case 20185:
{
- // 2% of base mana
- basepoints0 = int32(victim->CountPctFromMaxHealth(2));
- victim->CastCustomSpell(victim, 20267, &basepoints0, 0, 0, true, 0, triggeredByAura);
- return true;
+ if (!victim)
+ return false;
+
+ // 2% of maximum health
+ basepoints0 = int32(victim->CountPctFromMaxHealth(2));
+ victim->CastCustomSpell(victim, 20267, &basepoints0, 0, 0, true, 0, triggeredByAura);
+ return true;
}
// Judgement of Wisdom
case 20186:
@@ -9972,7 +9994,8 @@ void Unit::SetCharm(Unit* charm, bool apply)
if (!charm->AddUInt64Value(UNIT_FIELD_CHARMEDBY, GetGUID()))
sLog->outFatal(LOG_FILTER_UNITS, "Unit %u is being charmed, but it already has a charmer " UI64FMTD "", charm->GetEntry(), charm->GetCharmerGUID());
- if (charm->HasUnitMovementFlag(MOVEMENTFLAG_WALKING))
+ _isWalkingBeforeCharm = charm->IsWalking();
+ if (_isWalkingBeforeCharm)
{
charm->SetWalk(false);
charm->SendMovementFlagUpdate();
@@ -10010,6 +10033,12 @@ void Unit::SetCharm(Unit* charm, bool apply)
charm->SetByteValue(UNIT_FIELD_BYTES_2, 1, 0);
}
+ if (charm->IsWalking() != _isWalkingBeforeCharm)
+ {
+ charm->SetWalk(_isWalkingBeforeCharm);
+ charm->SendMovementFlagUpdate(true); // send packet to self, to update movement state on player.
+ }
+
if (charm->GetTypeId() == TYPEID_PLAYER
|| !charm->ToCreature()->HasUnitTypeMask(UNIT_MASK_MINION)
|| charm->GetOwnerGUID() != GetGUID())
@@ -10284,6 +10313,10 @@ uint32 Unit::SpellDamageBonusDone(Unit* victim, SpellInfo const* spellProto, uin
if (!spellProto || !victim || damagetype == DIRECT_DAMAGE)
return pdamage;
+ // Some spells don't benefit from done mods
+ if (spellProto->AttributesEx3 & SPELL_ATTR3_NO_DONE_BONUS)
+ return pdamage;
+
// small exception for Deep Wounds, can't find any general rule
// should ignore ALL damage mods, they already calculated in trigger spell
if (spellProto->Id == 12721) // Deep Wounds
@@ -10685,13 +10718,6 @@ uint32 Unit::SpellDamageBonusDone(Unit* victim, SpellInfo const* spellProto, uin
DoneTotal += int32(DoneAdvertisedBenefit * coeff * factorMod);
}
- // Some spells don't benefit from done mods
- if (spellProto->AttributesEx3 & SPELL_ATTR3_NO_DONE_BONUS)
- {
- DoneTotal = 0;
- DoneTotalMod = 1.0f;
- }
-
float tmpDamage = (int32(pdamage) + DoneTotal) * DoneTotalMod;
// apply spellmod to Done damage (flat and pct)
if (Player* modOwner = GetSpellModOwner())
@@ -11075,9 +11101,12 @@ uint32 Unit::SpellCriticalDamageBonus(SpellInfo const* spellProto, uint32 damage
crit_bonus -= damage;
- // adds additional damage to crit_bonus (from talents)
- if (Player* modOwner = GetSpellModOwner())
- modOwner->ApplySpellMod(spellProto->Id, SPELLMOD_CRIT_DAMAGE_BONUS, crit_bonus);
+ if (damage > uint32(crit_bonus))
+ {
+ // adds additional damage to critBonus (from talents)
+ if (Player* modOwner = GetSpellModOwner())
+ modOwner->ApplySpellMod(spellProto->Id, SPELLMOD_CRIT_DAMAGE_BONUS, crit_bonus);
+ }
crit_bonus += damage;
@@ -11242,16 +11271,6 @@ uint32 Unit::SpellHealingBonusDone(Unit* victim, SpellInfo const* spellProto, ui
DoneTotal += int32(DoneAdvertisedBenefit * coeff * factorMod);
}
- // Gift of the Naaru
- if (spellProto->SpellFamilyFlags[2] & 0x80000000 && spellProto->SpellIconID == 329)
- {
- int32 apBonus = int32(std::max(GetTotalAttackPowerValue(BASE_ATTACK), GetTotalAttackPowerValue(RANGED_ATTACK)));
- if (apBonus > DoneAdvertisedBenefit)
- DoneTotal += int32(apBonus * 0.22f); // 22% of AP per tick
- else
- DoneTotal += int32(DoneAdvertisedBenefit * 0.377f); // 37.7% of BH per tick
- }
-
for (uint8 i = 0; i < MAX_SPELL_EFFECTS; ++i)
{
switch (spellProto->Effects[i].ApplyAuraName)
@@ -12260,19 +12279,21 @@ bool Unit::_IsValidAttackTarget(Unit const* target, SpellInfo const* bySpell, Wo
if (GetReactionTo(target) == REP_NEUTRAL &&
target->GetReactionTo(this) == REP_NEUTRAL)
{
- if (
- !(target->GetTypeId() == TYPEID_PLAYER && GetTypeId() == TYPEID_PLAYER) &&
- !(target->GetTypeId() == TYPEID_UNIT && GetTypeId() == TYPEID_UNIT)
- )
+ if (!(target->GetTypeId() == TYPEID_PLAYER && GetTypeId() == TYPEID_PLAYER) &&
+ !(target->GetTypeId() == TYPEID_UNIT && GetTypeId() == TYPEID_UNIT))
{
Player const* player = target->GetTypeId() == TYPEID_PLAYER ? target->ToPlayer() : ToPlayer();
Unit const* creature = target->GetTypeId() == TYPEID_UNIT ? target : this;
if (FactionTemplateEntry const* factionTemplate = creature->getFactionTemplateEntry())
- if (FactionEntry const* factionEntry = sFactionStore.LookupEntry(factionTemplate->faction))
- if (FactionState const* repState = player->GetReputationMgr().GetState(factionEntry))
- if (!(repState->Flags & FACTION_FLAG_AT_WAR))
- return false;
+ {
+ if (!(player->GetReputationMgr().GetForcedRankIfAny(factionTemplate)))
+ if (FactionEntry const* factionEntry = sFactionStore.LookupEntry(factionTemplate->faction))
+ if (FactionState const* repState = player->GetReputationMgr().GetState(factionEntry))
+ if (!(repState->Flags & FACTION_FLAG_AT_WAR))
+ return false;
+
+ }
}
}
@@ -13212,13 +13233,13 @@ int32 Unit::ModSpellDuration(SpellInfo const* spellProto, Unit const* target, in
}
break;
case SPELLFAMILY_PALADIN:
- if (spellProto->SpellFamilyFlags[0] & 0x00000002)
+ if ((spellProto->SpellFamilyFlags[0] & 0x00000002) && spellProto->SpellIconID == 298)
{
// Glyph of Blessing of Might
if (AuraEffect* aurEff = GetAuraEffect(57958, 0))
duration += aurEff->GetAmount() * MINUTE * IN_MILLISECONDS;
}
- else if (spellProto->SpellFamilyFlags[0] & 0x00010000)
+ else if ((spellProto->SpellFamilyFlags[0] & 0x00010000) && spellProto->SpellIconID == 306)
{
// Glyph of Blessing of Wisdom
if (AuraEffect* aurEff = GetAuraEffect(57979, 0))
@@ -13901,7 +13922,8 @@ void Unit::DeleteCharmInfo()
CharmInfo::CharmInfo(Unit* unit)
: m_unit(unit), m_CommandState(COMMAND_FOLLOW), m_petnumber(0), m_barInit(false),
- m_isCommandAttack(false), m_isAtStay(false), m_isFollowing(false), m_isReturning(false)
+ m_isCommandAttack(false), m_isAtStay(false), m_isFollowing(false), m_isReturning(false),
+ m_stayX(0.0f), m_stayY(0.0f), m_stayZ(0.0f)
{
for (uint8 i = 0; i < MAX_SPELL_CHARM; ++i)
m_charmspells[i].SetActionAndType(0, ACT_DISABLED);
@@ -14761,11 +14783,11 @@ void Unit::StopMoving()
init.Launch();
}
-void Unit::SendMovementFlagUpdate()
+void Unit::SendMovementFlagUpdate(bool self /* = false */)
{
WorldPacket data;
BuildHeartBeatMsg(&data);
- SendMessageToSet(&data, false);
+ SendMessageToSet(&data, self);
}
bool Unit::IsSitState() const
@@ -15682,9 +15704,14 @@ void Unit::Kill(Unit* victim, bool durabilityLoss)
// outdoor pvp things, do these after setting the death state, else the player activity notify won't work... doh...
// handle player kill only if not suicide (spirit of redemption for example)
if (player && this != victim)
+ {
if (OutdoorPvP* pvp = player->GetOutdoorPvP())
pvp->HandleKill(player, victim);
+ if (Battlefield* bf = sBattlefieldMgr->GetBattlefieldToZoneId(player->GetZoneId()))
+ bf->HandleKill(player, victim);
+ }
+
//if (victim->GetTypeId() == TYPEID_PLAYER)
// if (OutdoorPvP* pvp = victim->ToPlayer()->GetOutdoorPvP())
// pvp->HandlePlayerActivityChangedpVictim->ToPlayer();
@@ -16137,7 +16164,8 @@ void Unit::RemoveCharmedBy(Unit* charmer)
if (Creature* creature = ToCreature())
{
- creature->AI()->OnCharmed(false);
+ if (creature->AI())
+ creature->AI()->OnCharmed(false);
if (type != CHARM_TYPE_VEHICLE) // Vehicles' AI is never modified
{
@@ -16276,6 +16304,13 @@ uint64 Unit::GetTransGUID() const
return 0;
}
+TransportBase* Unit::GetDirectTransport() const
+{
+ if (Vehicle* veh = GetVehicle())
+ return veh;
+ return GetTransport();
+}
+
bool Unit::IsInPartyWith(Unit const* unit) const
{
if (this == unit)
@@ -16952,19 +16987,20 @@ void Unit::JumpTo(WorldObject* obj, float speedZ)
bool Unit::HandleSpellClick(Unit* clicker, int8 seatId)
{
+ bool result = false;
uint32 spellClickEntry = GetVehicleKit() ? GetVehicleKit()->GetCreatureEntry() : GetEntry();
SpellClickInfoMapBounds clickPair = sObjectMgr->GetSpellClickInfoMapBounds(spellClickEntry);
for (SpellClickInfoContainer::const_iterator itr = clickPair.first; itr != clickPair.second; ++itr)
{
//! First check simple relations from clicker to clickee
if (!itr->second.IsFitToRequirements(clicker, this))
- return false;
+ continue;
//! Check database conditions
ConditionList conds = sConditionMgr->GetConditionsForSpellClickEvent(spellClickEntry, itr->second.spellId);
ConditionSourceInfo info = ConditionSourceInfo(clicker, this);
if (!sConditionMgr->IsObjectMeetToConditions(info, conds))
- return false;
+ continue;
Unit* caster = (itr->second.castFlags & NPC_CLICK_CAST_CASTER_CLICKER) ? clicker : this;
Unit* target = (itr->second.castFlags & NPC_CLICK_CAST_TARGET_CLICKER) ? clicker : this;
@@ -16990,11 +17026,11 @@ bool Unit::HandleSpellClick(Unit* clicker, int8 seatId)
if (!valid)
{
sLog->outError(LOG_FILTER_SQL, "Spell %u specified in npc_spellclick_spells is not a valid vehicle enter aura!", itr->second.spellId);
- return false;
+ continue;
}
if (IsInMap(caster))
- caster->CastCustomSpell(itr->second.spellId, SpellValueMod(SPELLVALUE_BASE_POINT0+i), seatId+1, target, false, NULL, NULL, origCasterGUID);
+ caster->CastCustomSpell(itr->second.spellId, SpellValueMod(SPELLVALUE_BASE_POINT0+i), seatId+1, target, GetVehicleKit() ? TRIGGERED_IGNORE_CASTER_MOUNTED_OR_ON_VEHICLE : TRIGGERED_NONE, NULL, NULL, origCasterGUID);
else // This can happen during Player::_LoadAuras
{
int32 bp0 = seatId;
@@ -17004,22 +17040,27 @@ bool Unit::HandleSpellClick(Unit* clicker, int8 seatId)
else
{
if (IsInMap(caster))
- caster->CastSpell(target, spellEntry, false, NULL, NULL, origCasterGUID);
+ caster->CastSpell(target, spellEntry, GetVehicleKit() ? TRIGGERED_IGNORE_CASTER_MOUNTED_OR_ON_VEHICLE : TRIGGERED_NONE, NULL, NULL, origCasterGUID);
else
Aura::TryRefreshStackOrCreate(spellEntry, MAX_EFFECT_MASK, this, clicker, NULL, NULL, origCasterGUID);
}
+
+ result = true;
}
- Creature* creature = ToCreature();
- if (creature && creature->IsAIEnabled)
- creature->AI()->OnSpellClick(clicker);
+ if (result)
+ {
+ Creature* creature = ToCreature();
+ if (creature && creature->IsAIEnabled)
+ creature->AI()->OnSpellClick(clicker);
+ }
- return true;
+ return result;
}
void Unit::EnterVehicle(Unit* base, int8 seatId)
{
- CastCustomSpell(VEHICLE_SPELL_RIDE_HARDCODED, SPELLVALUE_BASE_POINT0, seatId+1, base, false);
+ CastCustomSpell(VEHICLE_SPELL_RIDE_HARDCODED, SPELLVALUE_BASE_POINT0, seatId+1, base, TRIGGERED_IGNORE_CASTER_MOUNTED_OR_ON_VEHICLE);
}
void Unit::_EnterVehicle(Vehicle* vehicle, int8 seatId, AuraApplication const* aurApp)
@@ -17037,6 +17078,7 @@ void Unit::_EnterVehicle(Vehicle* vehicle, int8 seatId, AuraApplication const* a
sLog->outDebug(LOG_FILTER_VEHICLES, "EnterVehicle: %u leave vehicle %u seat %d and enter %d.", GetEntry(), m_vehicle->GetBase()->GetEntry(), GetTransSeat(), seatId);
ChangeSeat(seatId);
}
+
return;
}
else
@@ -17072,6 +17114,7 @@ void Unit::_EnterVehicle(Vehicle* vehicle, int8 seatId, AuraApplication const* a
ASSERT(!m_vehicle);
m_vehicle = vehicle;
+
if (!m_vehicle->AddPassenger(this, seatId))
{
m_vehicle = NULL;
@@ -17124,9 +17167,11 @@ void Unit::_ExitVehicle(Position const* exitPosition)
m_vehicle->RemovePassenger(this);
+ Player* player = ToPlayer();
+
// If player is on mouted duel and exits the mount should immediatly lose the duel
- if (GetTypeId() == TYPEID_PLAYER && ToPlayer()->duel && ToPlayer()->duel->isMounted)
- ToPlayer()->DuelComplete(DUEL_FLED);
+ if (player && player->duel && player->duel->isMounted)
+ player->DuelComplete(DUEL_FLED);
// This should be done before dismiss, because there may be some aura removal
Vehicle* vehicle = m_vehicle;
@@ -17143,8 +17188,8 @@ void Unit::_ExitVehicle(Position const* exitPosition)
AddUnitState(UNIT_STATE_MOVE);
- if (GetTypeId() == TYPEID_PLAYER)
- ToPlayer()->SetFallInformation(0, GetPositionZ());
+ if (player)
+ player->SetFallInformation(0, GetPositionZ());
else if (HasUnitMovementFlag(MOVEMENTFLAG_ROOT))
{
WorldPacket data(SMSG_SPLINE_MOVE_UNROOT, 8);
@@ -17160,7 +17205,7 @@ void Unit::_ExitVehicle(Position const* exitPosition)
//GetMotionMaster()->MoveFall(); // Enable this once passenger positions are calculater properly (see above)
- if (Player* player = ToPlayer())
+ if (player)
player->ResummonPetTemporaryUnSummonedIfAny();
if (vehicle->GetBase()->HasUnitTypeMask(UNIT_MASK_MINION))
@@ -17289,7 +17334,7 @@ void Unit::UpdateOrientation(float orientation)
{
SetOrientation(orientation);
if (IsVehicle())
- GetVehicleKit()->RelocatePassengers(GetPositionX(), GetPositionY(), GetPositionZ(), orientation);
+ GetVehicleKit()->RelocatePassengers();
}
//! Only server-side height update, does not broadcast to client
@@ -17297,7 +17342,7 @@ void Unit::UpdateHeight(float newZ)
{
Relocate(GetPositionX(), GetPositionY(), newZ);
if (IsVehicle())
- GetVehicleKit()->RelocatePassengers(GetPositionX(), GetPositionY(), newZ, GetOrientation());
+ GetVehicleKit()->RelocatePassengers();
}
void Unit::SendThreatListUpdate()
@@ -17695,3 +17740,31 @@ void Unit::SendMovementCanFlyChange()
BuildMovementPacket(&data);
SendMessageToSet(&data, false);
}
+
+void Unit::FocusTarget(Spell const* focusSpell, uint64 target)
+{
+ // already focused
+ if (_focusSpell)
+ return;
+
+ _focusSpell = focusSpell;
+ SetUInt64Value(UNIT_FIELD_TARGET, target);
+ if (focusSpell->GetSpellInfo()->AttributesEx5 & SPELL_ATTR5_DONT_TURN_DURING_CAST)
+ AddUnitState(UNIT_STATE_ROTATING);
+}
+
+void Unit::ReleaseFocus(Spell const* focusSpell)
+{
+ // focused to something else
+ if (focusSpell != _focusSpell)
+ return;
+
+ _focusSpell = NULL;
+ if (Unit* victim = getVictim())
+ SetUInt64Value(UNIT_FIELD_TARGET, victim->GetGUID());
+ else
+ SetUInt64Value(UNIT_FIELD_TARGET, 0);
+
+ if (focusSpell->GetSpellInfo()->AttributesEx5 & SPELL_ATTR5_DONT_TURN_DURING_CAST)
+ ClearUnitState(UNIT_STATE_ROTATING);
+}
diff --git a/src/server/game/Entities/Unit/Unit.h b/src/server/game/Entities/Unit/Unit.h
index 46dbf4829a6..8eb822831aa 100755
--- a/src/server/game/Entities/Unit/Unit.h
+++ b/src/server/game/Entities/Unit/Unit.h
@@ -46,7 +46,7 @@ enum SpellInterruptFlags
SPELL_INTERRUPT_FLAG_PUSH_BACK = 0x02, // push back
SPELL_INTERRUPT_FLAG_UNK3 = 0x04, // any info?
SPELL_INTERRUPT_FLAG_INTERRUPT = 0x08, // interrupt
- SPELL_INTERRUPT_FLAG_ABORT_ON_DMG = 0x10, // _complete_ interrupt on direct damage
+ SPELL_INTERRUPT_FLAG_ABORT_ON_DMG = 0x10 // _complete_ interrupt on direct damage
//SPELL_INTERRUPT_UNK = 0x20 // unk, 564 of 727 spells having this spell start with "Glyph"
};
@@ -86,7 +86,7 @@ enum SpellAuraInterruptFlags
AURA_INTERRUPT_FLAG_DIRECT_DAMAGE = 0x01000000, // 24 removed by any direct damage
AURA_INTERRUPT_FLAG_LANDING = 0x02000000, // 25 removed by hitting the ground
- AURA_INTERRUPT_FLAG_NOT_VICTIM = (AURA_INTERRUPT_FLAG_HITBYSPELL | AURA_INTERRUPT_FLAG_TAKE_DAMAGE | AURA_INTERRUPT_FLAG_DIRECT_DAMAGE),
+ AURA_INTERRUPT_FLAG_NOT_VICTIM = (AURA_INTERRUPT_FLAG_HITBYSPELL | AURA_INTERRUPT_FLAG_TAKE_DAMAGE | AURA_INTERRUPT_FLAG_DIRECT_DAMAGE)
};
enum SpellModOp
@@ -133,7 +133,7 @@ enum SpellValueMod
SPELLVALUE_BASE_POINT2,
SPELLVALUE_RADIUS_MOD,
SPELLVALUE_MAX_TARGETS,
- SPELLVALUE_AURA_STACK,
+ SPELLVALUE_AURA_STACK
};
typedef std::pair<SpellValueMod, int32> CustomSpellValueMod;
@@ -253,7 +253,7 @@ enum UnitPVPStateFlags
enum UnitRename
{
UNIT_CAN_BE_RENAMED = 0x01,
- UNIT_CAN_BE_ABANDONED = 0x02,
+ UNIT_CAN_BE_ABANDONED = 0x02
};
#define CREATURE_MAX_SPELLS 8
@@ -339,6 +339,7 @@ class UnitAI;
class Totem;
class Transport;
class Vehicle;
+class TransportBase;
typedef std::list<Unit*> UnitList;
typedef std::list< std::pair<Aura*, uint8> > DispelChargesList;
@@ -402,7 +403,7 @@ enum TriggerCastFlags
TRIGGERED_IGNORE_CASTER_AURAS = 0x00010000, //! Will ignore caster aura restrictions or requirements
TRIGGERED_DISALLOW_PROC_EVENTS = 0x00020000, //! Disallows proc events from triggered spell (default)
TRIGGERED_DONT_REPORT_CAST_ERROR = 0x00040000, //! Will return SPELL_FAILED_DONT_REPORT in CheckCast functions
- TRIGGERED_FULL_MASK = 0xFFFFFFFF,
+ TRIGGERED_FULL_MASK = 0xFFFFFFFF
};
enum UnitMods
@@ -461,11 +462,11 @@ enum BaseModType
enum DeathState
{
- ALIVE = 0,
- JUST_DIED = 1,
- CORPSE = 2,
- DEAD = 3,
- JUST_RESPAWNED = 4,
+ ALIVE = 0,
+ JUST_DIED = 1,
+ CORPSE = 2,
+ DEAD = 3,
+ JUST_RESPAWNED = 4
};
enum UnitState
@@ -618,17 +619,24 @@ enum UnitFlags
// Value masks for UNIT_FIELD_FLAGS_2
enum UnitFlags2
{
- UNIT_FLAG2_FEIGN_DEATH = 0x00000001,
- UNIT_FLAG2_UNK1 = 0x00000002, // Hide unit model (show only player equip)
- UNIT_FLAG2_IGNORE_REPUTATION = 0x00000004,
- UNIT_FLAG2_COMPREHEND_LANG = 0x00000008,
- UNIT_FLAG2_MIRROR_IMAGE = 0x00000010,
- UNIT_FLAG2_FORCE_MOVE = 0x00000040,
- UNIT_FLAG2_DISARM_OFFHAND = 0x00000080,
- UNIT_FLAG2_DISARM_RANGED = 0x00000400, // this does not disable ranged weapon display (maybe additional flag needed?)
- UNIT_FLAG2_REGENERATE_POWER = 0x00000800,
- UNIT_FLAG2_ALLOW_ENEMY_INTERACT = 0x00004000,
- UNIT_FLAG2_ALLOW_CHEAT_SPELLS = 0x00040000, // allows casting spells with AttributesEx7 & SPELL_ATTR7_IS_CHEAT_SPELL
+ UNIT_FLAG2_FEIGN_DEATH = 0x00000001,
+ UNIT_FLAG2_UNK1 = 0x00000002, // Hide unit model (show only player equip)
+ UNIT_FLAG2_IGNORE_REPUTATION = 0x00000004,
+ UNIT_FLAG2_COMPREHEND_LANG = 0x00000008,
+ UNIT_FLAG2_MIRROR_IMAGE = 0x00000010,
+ UNIT_FLAG2_INSTANTLY_APPEAR_MODEL = 0x00000020, // Unit model instantly appears when summoned (does not fade in)
+ UNIT_FLAG2_FORCE_MOVEMENT = 0x00000040,
+ UNIT_FLAG2_DISARM_OFFHAND = 0x00000080,
+ UNIT_FLAG2_DISABLE_PRED_STATS = 0x00000100, // Player has disabled predicted stats (Used by raid frames)
+ UNIT_FLAG2_DISARM_RANGED = 0x00000400, // this does not disable ranged weapon display (maybe additional flag needed?)
+ UNIT_FLAG2_REGENERATE_POWER = 0x00000800,
+ UNIT_FLAG2_RESTRICT_PARTY_INTERACTION = 0x00001000, // Restrict interaction to party or raid
+ UNIT_FLAG2_PREVENT_SPELL_CLICK = 0x00002000, // Prevent spellclick
+ UNIT_FLAG2_ALLOW_ENEMY_INTERACT = 0x00004000,
+ UNIT_FLAG2_DISABLE_TURN = 0x00008000,
+ UNIT_FLAG2_UNK2 = 0x00010000,
+ UNIT_FLAG2_PLAY_DEATH_ANIM = 0x00020000, // Plays special death animation upon death
+ UNIT_FLAG2_ALLOW_CHEAT_SPELLS = 0x00040000 // Allows casting spells with AttributesEx7 & SPELL_ATTR7_IS_CHEAT_SPELL
};
/// Non Player Character flags
@@ -660,7 +668,7 @@ enum NPCFlags
UNIT_NPC_FLAG_STABLEMASTER = 0x00400000, // 100%
UNIT_NPC_FLAG_GUILD_BANKER = 0x00800000, // cause client to send 997 opcode
UNIT_NPC_FLAG_SPELLCLICK = 0x01000000, // cause client to send 1015 opcode (spell click)
- UNIT_NPC_FLAG_PLAYER_VEHICLE = 0x02000000, // players with mounts that have vehicle data should have it set
+ UNIT_NPC_FLAG_PLAYER_VEHICLE = 0x02000000 // players with mounts that have vehicle data should have it set
};
enum MovementFlags
@@ -712,7 +720,7 @@ enum MovementFlags
//! TODO if needed: add more flags to this masks that are exclusive to players
MOVEMENTFLAG_MASK_PLAYER_ONLY =
- MOVEMENTFLAG_FLYING,
+ MOVEMENTFLAG_FLYING
};
enum MovementFlags2
{
@@ -732,7 +740,7 @@ enum MovementFlags2
MOVEMENTFLAG2_INTERPOLATED_PITCHING = 0x00001000,
MOVEMENTFLAG2_UNK14 = 0x00002000,
MOVEMENTFLAG2_UNK15 = 0x00004000,
- MOVEMENTFLAG2_UNK16 = 0x00008000,
+ MOVEMENTFLAG2_UNK16 = 0x00008000
};
enum UnitTypeMask
@@ -747,7 +755,7 @@ enum UnitTypeMask
UNIT_MASK_PUPPET = 0x00000040,
UNIT_MASK_HUNTER_PET = 0x00000080,
UNIT_MASK_CONTROLABLE_GUARDIAN = 0x00000100,
- UNIT_MASK_ACCESSORY = 0x00000200,
+ UNIT_MASK_ACCESSORY = 0x00000200
};
namespace Movement{
@@ -761,7 +769,7 @@ enum DiminishingLevels
DIMINISHING_LEVEL_3 = 2,
DIMINISHING_LEVEL_IMMUNE = 3,
DIMINISHING_LEVEL_4 = 3,
- DIMINISHING_LEVEL_TAUNT_IMMUNE = 4,
+ DIMINISHING_LEVEL_TAUNT_IMMUNE = 4
};
struct DiminishingReturn
@@ -1072,7 +1080,7 @@ enum CharmType
CHARM_TYPE_CHARM,
CHARM_TYPE_POSSESS,
CHARM_TYPE_VEHICLE,
- CHARM_TYPE_CONVERT,
+ CHARM_TYPE_CONVERT
};
typedef UnitActionBarEntry CharmSpellInfo;
@@ -1082,7 +1090,7 @@ enum ActionBarIndex
ACTION_BAR_INDEX_START = 0,
ACTION_BAR_INDEX_PET_SPELL_START = 3,
ACTION_BAR_INDEX_PET_SPELL_END = 7,
- ACTION_BAR_INDEX_END = 10,
+ ACTION_BAR_INDEX_END = 10
};
#define MAX_UNIT_ACTION_BAR_INDEX (ACTION_BAR_INDEX_END-ACTION_BAR_INDEX_START)
@@ -1182,7 +1190,7 @@ enum PlayerTotemType
SUMMON_TYPE_TOTEM_FIRE = 63,
SUMMON_TYPE_TOTEM_EARTH = 81,
SUMMON_TYPE_TOTEM_WATER = 82,
- SUMMON_TYPE_TOTEM_AIR = 83,
+ SUMMON_TYPE_TOTEM_AIR = 83
};
// delay time next attack to prevent client attack animation problems
@@ -1561,13 +1569,14 @@ class Unit : public WorldObject
void CastSpell(SpellCastTargets const& targets, SpellInfo const* spellInfo, CustomSpellValues const* value, TriggerCastFlags triggerFlags = TRIGGERED_NONE, Item* castItem = NULL, AuraEffect const* triggeredByAura = NULL, uint64 originalCaster = 0);
void CastSpell(Unit* victim, uint32 spellId, bool triggered, Item* castItem = NULL, AuraEffect const* triggeredByAura = NULL, uint64 originalCaster = 0);
void CastSpell(Unit* victim, uint32 spellId, TriggerCastFlags triggerFlags = TRIGGERED_NONE, Item* castItem = NULL, AuraEffect const* triggeredByAura = NULL, uint64 originalCaster = 0);
- void CastSpell(Unit* victim, SpellInfo const* spellInfo, bool triggered, Item* castItem= NULL, AuraEffect const* triggeredByAura = NULL, uint64 originalCaster = 0);
- void CastSpell(Unit* victim, SpellInfo const* spellInfo, TriggerCastFlags triggerFlags = TRIGGERED_NONE, Item* castItem= NULL, AuraEffect const* triggeredByAura = NULL, uint64 originalCaster = 0);
+ void CastSpell(Unit* victim, SpellInfo const* spellInfo, bool triggered, Item* castItem = NULL, AuraEffect const* triggeredByAura = NULL, uint64 originalCaster = 0);
+ void CastSpell(Unit* victim, SpellInfo const* spellInfo, TriggerCastFlags triggerFlags = TRIGGERED_NONE, Item* castItem = NULL, AuraEffect const* triggeredByAura = NULL, uint64 originalCaster = 0);
void CastSpell(float x, float y, float z, uint32 spellId, bool triggered, Item* castItem = NULL, AuraEffect const* triggeredByAura = NULL, uint64 originalCaster = 0);
- void CastCustomSpell(Unit* Victim, uint32 spellId, int32 const* bp0, int32 const* bp1, int32 const* bp2, bool triggered, Item* castItem= NULL, AuraEffect const* triggeredByAura = NULL, uint64 originalCaster = 0);
- void CastCustomSpell(uint32 spellId, SpellValueMod mod, int32 value, Unit* Victim = NULL, bool triggered = true, Item* castItem = NULL, AuraEffect const* triggeredByAura = NULL, uint64 originalCaster = 0);
- void CastCustomSpell(uint32 spellId, CustomSpellValues const &value, Unit* Victim = NULL, bool triggered = true, Item* castItem = NULL, AuraEffect const* triggeredByAura = NULL, uint64 originalCaster = 0);
void CastSpell(GameObject* go, uint32 spellId, bool triggered, Item* castItem = NULL, AuraEffect* triggeredByAura = NULL, uint64 originalCaster = 0);
+ void CastCustomSpell(Unit* victim, uint32 spellId, int32 const* bp0, int32 const* bp1, int32 const* bp2, bool triggered, Item* castItem = NULL, AuraEffect const* triggeredByAura = NULL, uint64 originalCaster = 0);
+ void CastCustomSpell(uint32 spellId, SpellValueMod mod, int32 value, Unit* victim, bool triggered, Item* castItem = NULL, AuraEffect const* triggeredByAura = NULL, uint64 originalCaster = 0);
+ void CastCustomSpell(uint32 spellId, SpellValueMod mod, int32 value, Unit* victim = NULL, TriggerCastFlags triggerFlags = TRIGGERED_NONE, Item* castItem = NULL, AuraEffect const* triggeredByAura = NULL, uint64 originalCaster = 0);
+ void CastCustomSpell(uint32 spellId, CustomSpellValues const &value, Unit* victim = NULL, TriggerCastFlags triggerFlags = TRIGGERED_NONE, Item* castItem = NULL, AuraEffect const* triggeredByAura = NULL, uint64 originalCaster = 0);
Aura* AddAura(uint32 spellId, Unit* target);
Aura* AddAura(SpellInfo const* spellInfo, uint8 effMask, Unit* target);
void SetAuraStack(uint32 spellId, Unit* target, uint32 stack);
@@ -1599,7 +1608,7 @@ class Unit : public WorldObject
void MonsterMoveWithSpeed(float x, float y, float z, float speed);
//void SetFacing(float ori, WorldObject* obj = NULL);
//void SendMonsterMove(float NewPosX, float NewPosY, float NewPosZ, uint8 type, uint32 MovementFlags, uint32 Time, Player* player = NULL);
- void SendMovementFlagUpdate();
+ void SendMovementFlagUpdate(bool self = false);
/*! These methods send the same packet to the client in apply and unapply case.
The client-side interpretation of this packet depends on the presence of relevant movementflags
@@ -2161,6 +2170,8 @@ class Unit : public WorldObject
uint32 GetTransTime() const { return m_movementInfo.t_time; }
int8 GetTransSeat() const { return m_movementInfo.t_seat; }
uint64 GetTransGUID() const;
+ /// Returns the transport this unit is on directly (if on vehicle and transport, return vehicle)
+ TransportBase* GetDirectTransport() const;
bool m_ControlledByPlayer;
@@ -2196,34 +2207,13 @@ class Unit : public WorldObject
void SetTarget(uint64 guid)
{
- if (!_targetLocked)
+ if (!_focusSpell)
SetUInt64Value(UNIT_FIELD_TARGET, guid);
}
- void FocusTarget(Spell const* focusSpell, uint64 target)
- {
- // already focused
- if (_focusSpell)
- return;
-
- _focusSpell = focusSpell;
- _targetLocked = true;
- SetUInt64Value(UNIT_FIELD_TARGET, target);
- }
-
- void ReleaseFocus(Spell const* focusSpell)
- {
- // focused to something else
- if (focusSpell != _focusSpell)
- return;
-
- _focusSpell = NULL;
- _targetLocked = false;
- if (Unit* victim = getVictim())
- SetUInt64Value(UNIT_FIELD_TARGET, victim->GetGUID());
- else
- SetUInt64Value(UNIT_FIELD_TARGET, 0);
- }
+ // Handling caster facing during spellcast
+ void FocusTarget(Spell const* focusSpell, uint64 target);
+ void ReleaseFocus(Spell const* focusSpell);
// Movement info
Movement::MoveSpline * movespline;
@@ -2347,8 +2337,8 @@ class Unit : public WorldObject
bool m_cleanupDone; // lock made to not add stuff after cleanup before delete
bool m_duringRemoveFromWorld; // lock made to not add stuff after begining removing from world
- Spell const* _focusSpell;
- bool _targetLocked; // locks the target during spell cast for proper facing
+ Spell const* _focusSpell; ///> Locks the target during spell cast for proper facing
+ bool _isWalkingBeforeCharm; // Are we walking before we were charmed?
};
namespace Trinity
diff --git a/src/server/game/Entities/Vehicle/Vehicle.cpp b/src/server/game/Entities/Vehicle/Vehicle.cpp
index 710821f2f24..ef4ed1a7f81 100755
--- a/src/server/game/Entities/Vehicle/Vehicle.cpp
+++ b/src/server/game/Entities/Vehicle/Vehicle.cpp
@@ -437,23 +437,23 @@ void Vehicle::RemovePassenger(Unit* unit)
}
//! Must be called after m_base::Relocate
-void Vehicle::RelocatePassengers(float x, float y, float z, float ang)
+void Vehicle::RelocatePassengers()
{
ASSERT(_me->GetMap());
- // not sure that absolute position calculation is correct, it must depend on vehicle orientation and pitch angle
+ // not sure that absolute position calculation is correct, it must depend on vehicle pitch angle
for (SeatMap::const_iterator itr = Seats.begin(); itr != Seats.end(); ++itr)
+ {
if (Unit* passenger = ObjectAccessor::GetUnit(*GetBase(), itr->second.Passenger))
{
ASSERT(passenger->IsInWorld());
- float px = x + passenger->m_movementInfo.t_pos.m_positionX;
- float py = y + passenger->m_movementInfo.t_pos.m_positionY;
- float pz = z + passenger->m_movementInfo.t_pos.m_positionZ;
- float po = ang + passenger->m_movementInfo.t_pos.m_orientation;
-
+ float px, py, pz, po;
+ passenger->m_movementInfo.t_pos.GetPosition(px, py, pz, po);
+ CalculatePassengerPosition(px, py, pz, po);
passenger->UpdatePosition(px, py, pz, po);
}
+ }
}
void Vehicle::Dismiss()
@@ -512,3 +512,23 @@ uint8 Vehicle::GetAvailableSeatCount() const
return ret;
}
+
+void Vehicle::CalculatePassengerPosition(float& x, float& y, float& z, float& o)
+{
+ float inx = x, iny = y, inz = z, ino = o;
+ o = GetBase()->GetOrientation() + ino;
+ x = GetBase()->GetPositionX() + inx * cos(GetBase()->GetOrientation()) - iny * sin(GetBase()->GetOrientation());
+ y = GetBase()->GetPositionY() + iny * cos(GetBase()->GetOrientation()) + inx * sin(GetBase()->GetOrientation());
+ z = GetBase()->GetPositionZ() + inz;
+}
+
+void Vehicle::CalculatePassengerOffset(float& x, float& y, float& z, float& o)
+{
+ o -= GetBase()->GetOrientation();
+ z -= GetBase()->GetPositionZ();
+ y -= GetBase()->GetPositionY(); // y = searchedY * cos(o) + searchedX * sin(o)
+ x -= GetBase()->GetPositionX(); // x = searchedX * cos(o) + searchedY * sin(o + pi)
+ float inx = x, iny = y;
+ y = (iny - inx * tan(GetBase()->GetOrientation())) / (cos(GetBase()->GetOrientation()) + sin(GetBase()->GetOrientation()) * tan(GetBase()->GetOrientation()));
+ x = (inx + iny * tan(GetBase()->GetOrientation())) / (cos(GetBase()->GetOrientation()) + sin(GetBase()->GetOrientation()) * tan(GetBase()->GetOrientation()));
+}
diff --git a/src/server/game/Entities/Vehicle/Vehicle.h b/src/server/game/Entities/Vehicle/Vehicle.h
index 213be5a21fe..4ad8663a17a 100755
--- a/src/server/game/Entities/Vehicle/Vehicle.h
+++ b/src/server/game/Entities/Vehicle/Vehicle.h
@@ -25,7 +25,9 @@
struct VehicleEntry;
class Unit;
-class Vehicle
+typedef std::set<uint64> GuidSet;
+
+class Vehicle : public TransportBase
{
public:
explicit Vehicle(Unit* unit, VehicleEntry const* vehInfo, uint32 creatureEntry);
@@ -50,9 +52,10 @@ class Vehicle
bool AddPassenger(Unit* passenger, int8 seatId = -1);
void EjectPassenger(Unit* passenger, Unit* controller);
void RemovePassenger(Unit* passenger);
- void RelocatePassengers(float x, float y, float z, float ang);
+ void RelocatePassengers();
void RemoveAllPassengers();
void Dismiss();
+ void TeleportVehicle(float x, float y, float z, float ang);
bool IsVehicleInUse() { return Seats.begin() != Seats.end(); }
SeatMap Seats;
@@ -63,8 +66,15 @@ class Vehicle
SeatMap::iterator GetSeatIteratorForPassenger(Unit* passenger);
void InitMovementInfoForBase();
+ /// This method transforms supplied transport offsets into global coordinates
+ void CalculatePassengerPosition(float& x, float& y, float& z, float& o);
+
+ /// This method transforms supplied global coordinates into local offsets
+ void CalculatePassengerOffset(float& x, float& y, float& z, float& o);
+
Unit* _me;
VehicleEntry const* _vehicleInfo;
+ GuidSet vehiclePlayers;
uint32 _usableSeatNum; // Number of seats that match VehicleSeatEntry::UsableByPlayer, used for proper display flags
uint32 _creatureEntry; // Can be different than me->GetBase()->GetEntry() in case of players
};
diff --git a/src/server/game/Entities/Vehicle/VehicleDefines.h b/src/server/game/Entities/Vehicle/VehicleDefines.h
index df34a61d444..cb8a6628b80 100644
--- a/src/server/game/Entities/Vehicle/VehicleDefines.h
+++ b/src/server/game/Entities/Vehicle/VehicleDefines.h
@@ -44,7 +44,7 @@ enum VehicleFlags
VEHICLE_FLAG_FULLSPEEDPITCHING = 0x00000020, // Sets MOVEFLAG2_FULLSPEEDPITCHING
VEHICLE_FLAG_CUSTOM_PITCH = 0x00000040, // If set use pitchMin and pitchMax from DBC, otherwise pitchMin = -pi/2, pitchMax = pi/2
VEHICLE_FLAG_ADJUST_AIM_ANGLE = 0x00000400, // Lua_IsVehicleAimAngleAdjustable
- VEHICLE_FLAG_ADJUST_AIM_POWER = 0x00000800, // Lua_IsVehicleAimPowerAdjustable
+ VEHICLE_FLAG_ADJUST_AIM_POWER = 0x00000800 // Lua_IsVehicleAimPowerAdjustable
};
enum VehicleSpells
@@ -75,4 +75,14 @@ typedef std::vector<VehicleAccessory> VehicleAccessoryList;
typedef std::map<uint32, VehicleAccessoryList> VehicleAccessoryContainer;
typedef std::map<int8, VehicleSeat> SeatMap;
+class TransportBase
+{
+ public:
+ /// This method transforms supplied transport offsets into global coordinates
+ virtual void CalculatePassengerPosition(float& x, float& y, float& z, float& o) = 0;
+
+ /// This method transforms supplied global coordinates into local offsets
+ virtual void CalculatePassengerOffset(float& x, float& y, float& z, float& o) = 0;
+};
+
#endif
diff --git a/src/server/game/Events/GameEventMgr.cpp b/src/server/game/Events/GameEventMgr.cpp
index afbae063e5e..2116738fac3 100755
--- a/src/server/game/Events/GameEventMgr.cpp
+++ b/src/server/game/Events/GameEventMgr.cpp
@@ -205,7 +205,7 @@ void GameEventMgr::LoadFromDB()
{
{
uint32 oldMSTime = getMSTime();
- // 1 2 3 4 5 6 7 8
+ // 0 1 2 3 4 5 6 7
QueryResult result = WorldDatabase.Query("SELECT eventEntry, UNIX_TIMESTAMP(start_time), UNIX_TIMESTAMP(end_time), occurence, length, holiday, description, world_event FROM game_event");
if (!result)
{
@@ -260,11 +260,11 @@ void GameEventMgr::LoadFromDB()
}
while (result->NextRow());
- sLog->outInfo(LOG_FILTER_GAMEEVENTS, ">> Loaded %u game events in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u game events in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
}
- sLog->outInfo(LOG_FILTER_GAMEEVENTS, "Loading Game Event Saves Data...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Game Event Saves Data...");
{
uint32 oldMSTime = getMSTime();
@@ -273,7 +273,7 @@ void GameEventMgr::LoadFromDB()
if (!result)
{
- sLog->outInfo(LOG_FILTER_GAMEEVENTS, ">> Loaded 0 game event saves in game events. DB table `game_event_save` is empty.");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 game event saves in game events. DB table `game_event_save` is empty.");
}
else
@@ -306,12 +306,12 @@ void GameEventMgr::LoadFromDB()
}
while (result->NextRow());
- sLog->outInfo(LOG_FILTER_GAMEEVENTS, ">> Loaded %u game event saves in game events in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u game event saves in game events in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
}
}
- sLog->outInfo(LOG_FILTER_GAMEEVENTS, "Loading Game Event Prerequisite Data...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Game Event Prerequisite Data...");
{
uint32 oldMSTime = getMSTime();
@@ -319,7 +319,7 @@ void GameEventMgr::LoadFromDB()
QueryResult result = WorldDatabase.Query("SELECT eventEntry, prerequisite_event FROM game_event_prerequisite");
if (!result)
{
- sLog->outInfo(LOG_FILTER_GAMEEVENTS, ">> Loaded 0 game event prerequisites in game events. DB table `game_event_prerequisite` is empty.");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 game event prerequisites in game events. DB table `game_event_prerequisite` is empty.");
}
else
@@ -357,22 +357,22 @@ void GameEventMgr::LoadFromDB()
}
while (result->NextRow());
- sLog->outInfo(LOG_FILTER_GAMEEVENTS, ">> Loaded %u game event prerequisites in game events in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u game event prerequisites in game events in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
}
}
- sLog->outInfo(LOG_FILTER_GAMEEVENTS, "Loading Game Event Creature Data...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Game Event Creature Data...");
{
uint32 oldMSTime = getMSTime();
- // 1 2
+ // 0 1
QueryResult result = WorldDatabase.Query("SELECT creature.guid, game_event_creature.eventEntry FROM creature"
" JOIN game_event_creature ON creature.guid = game_event_creature.guid");
if (!result)
{
- sLog->outInfo(LOG_FILTER_GAMEEVENTS, ">> Loaded 0 creatures in game events. DB table `game_event_creature` is empty");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 creatures in game events. DB table `game_event_creature` is empty");
}
else
@@ -400,12 +400,12 @@ void GameEventMgr::LoadFromDB()
}
while (result->NextRow());
- sLog->outInfo(LOG_FILTER_GAMEEVENTS, ">> Loaded %u creatures in game events in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u creatures in game events in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
}
}
- sLog->outInfo(LOG_FILTER_GAMEEVENTS, "Loading Game Event GO Data...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Game Event GO Data...");
{
uint32 oldMSTime = getMSTime();
@@ -415,7 +415,7 @@ void GameEventMgr::LoadFromDB()
if (!result)
{
- sLog->outInfo(LOG_FILTER_GAMEEVENTS, ">> Loaded 0 gameobjects in game events. DB table `game_event_gameobject` is empty.");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 gameobjects in game events. DB table `game_event_gameobject` is empty.");
}
else
@@ -443,12 +443,11 @@ void GameEventMgr::LoadFromDB()
}
while (result->NextRow());
- sLog->outInfo(LOG_FILTER_GAMEEVENTS, ">> Loaded %u gameobjects in game events in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
-
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u gameobjects in game events in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
}
}
- sLog->outInfo(LOG_FILTER_GAMEEVENTS, "Loading Game Event Model/Equipment Change Data...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Game Event Model/Equipment Change Data...");
{
uint32 oldMSTime = getMSTime();
@@ -458,8 +457,7 @@ void GameEventMgr::LoadFromDB()
if (!result)
{
- sLog->outInfo(LOG_FILTER_GAMEEVENTS, ">> Loaded 0 model/equipment changes in game events. DB table `game_event_model_equip` is empty.");
-
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 model/equipment changes in game events. DB table `game_event_model_equip` is empty.");
}
else
{
@@ -500,12 +498,11 @@ void GameEventMgr::LoadFromDB()
}
while (result->NextRow());
- sLog->outInfo(LOG_FILTER_GAMEEVENTS, ">> Loaded %u model/equipment changes in game events in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
-
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u model/equipment changes in game events in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
}
}
- sLog->outInfo(LOG_FILTER_GAMEEVENTS, "Loading Game Event Quest Data...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Game Event Quest Data...");
{
uint32 oldMSTime = getMSTime();
@@ -514,8 +511,7 @@ void GameEventMgr::LoadFromDB()
if (!result)
{
- sLog->outInfo(LOG_FILTER_GAMEEVENTS, ">> Loaded 0 quests additions in game events. DB table `game_event_creature_quest` is empty.");
-
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 quests additions in game events. DB table `game_event_creature_quest` is empty.");
}
else
{
@@ -541,12 +537,11 @@ void GameEventMgr::LoadFromDB()
}
while (result->NextRow());
- sLog->outInfo(LOG_FILTER_GAMEEVENTS, ">> Loaded %u quests additions in game events in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
-
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u quests additions in game events in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
}
}
- sLog->outInfo(LOG_FILTER_GAMEEVENTS, "Loading Game Event GO Quest Data...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Game Event GO Quest Data...");
{
uint32 oldMSTime = getMSTime();
@@ -555,8 +550,7 @@ void GameEventMgr::LoadFromDB()
if (!result)
{
- sLog->outInfo(LOG_FILTER_GAMEEVENTS, ">> Loaded 0 go quests additions in game events. DB table `game_event_gameobject_quest` is empty.");
-
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 go quests additions in game events. DB table `game_event_gameobject_quest` is empty.");
}
else
{
@@ -582,12 +576,11 @@ void GameEventMgr::LoadFromDB()
}
while (result->NextRow());
- sLog->outInfo(LOG_FILTER_GAMEEVENTS, ">> Loaded %u quests additions in game events in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
-
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u quests additions in game events in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
}
}
- sLog->outInfo(LOG_FILTER_GAMEEVENTS, "Loading Game Event Quest Condition Data...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Game Event Quest Condition Data...");
{
uint32 oldMSTime = getMSTime();
@@ -596,8 +589,7 @@ void GameEventMgr::LoadFromDB()
if (!result)
{
- sLog->outInfo(LOG_FILTER_GAMEEVENTS, ">> Loaded 0 quest event conditions in game events. DB table `game_event_quest_condition` is empty.");
-
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 quest event conditions in game events. DB table `game_event_quest_condition` is empty.");
}
else
{
@@ -625,12 +617,11 @@ void GameEventMgr::LoadFromDB()
}
while (result->NextRow());
- sLog->outInfo(LOG_FILTER_GAMEEVENTS, ">> Loaded %u quest event conditions in game events in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
-
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u quest event conditions in game events in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
}
}
- sLog->outInfo(LOG_FILTER_GAMEEVENTS, "Loading Game Event Condition Data...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Game Event Condition Data...");
{
uint32 oldMSTime = getMSTime();
@@ -639,8 +630,7 @@ void GameEventMgr::LoadFromDB()
if (!result)
{
- sLog->outInfo(LOG_FILTER_GAMEEVENTS, ">> Loaded 0 conditions in game events. DB table `game_event_condition` is empty.");
-
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 conditions in game events. DB table `game_event_condition` is empty.");
}
else
{
@@ -667,12 +657,11 @@ void GameEventMgr::LoadFromDB()
}
while (result->NextRow());
- sLog->outInfo(LOG_FILTER_GAMEEVENTS, ">> Loaded %u conditions in game events in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
-
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u conditions in game events in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
}
}
- sLog->outInfo(LOG_FILTER_GAMEEVENTS, "Loading Game Event Condition Save Data...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Game Event Condition Save Data...");
{
uint32 oldMSTime = getMSTime();
@@ -681,8 +670,7 @@ void GameEventMgr::LoadFromDB()
if (!result)
{
- sLog->outInfo(LOG_FILTER_GAMEEVENTS, ">> Loaded 0 condition saves in game events. DB table `game_event_condition_save` is empty.");
-
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 condition saves in game events. DB table `game_event_condition_save` is empty.");
}
else
{
@@ -715,12 +703,11 @@ void GameEventMgr::LoadFromDB()
}
while (result->NextRow());
- sLog->outInfo(LOG_FILTER_GAMEEVENTS, ">> Loaded %u condition saves in game events in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
-
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u condition saves in game events in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
}
}
- sLog->outInfo(LOG_FILTER_GAMEEVENTS, "Loading Game Event NPCflag Data...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Game Event NPCflag Data...");
{
uint32 oldMSTime = getMSTime();
@@ -729,8 +716,7 @@ void GameEventMgr::LoadFromDB()
if (!result)
{
- sLog->outInfo(LOG_FILTER_GAMEEVENTS, ">> Loaded 0 npcflags in game events. DB table `game_event_npcflag` is empty.");
-
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 npcflags in game events. DB table `game_event_npcflag` is empty.");
}
else
{
@@ -755,12 +741,11 @@ void GameEventMgr::LoadFromDB()
}
while (result->NextRow());
- sLog->outInfo(LOG_FILTER_GAMEEVENTS, ">> Loaded %u npcflags in game events in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
-
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u npcflags in game events in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
}
}
- sLog->outInfo(LOG_FILTER_GAMEEVENTS, "Loading Game Event Seasonal Quest Relations...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Game Event Seasonal Quest Relations...");
{
uint32 oldMSTime = getMSTime();
@@ -769,8 +754,7 @@ void GameEventMgr::LoadFromDB()
if (!result)
{
- sLog->outInfo(LOG_FILTER_GAMEEVENTS, ">> Loaded 0 seasonal quests additions in game events. DB table `game_event_seasonal_questrelation` is empty.");
-
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 seasonal quests additions in game events. DB table `game_event_seasonal_questrelation` is empty.");
}
else
{
@@ -799,12 +783,11 @@ void GameEventMgr::LoadFromDB()
}
while (result->NextRow());
- sLog->outInfo(LOG_FILTER_GAMEEVENTS, ">> Loaded %u quests additions in game events in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
-
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u quests additions in game events in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
}
}
- sLog->outInfo(LOG_FILTER_GAMEEVENTS, "Loading Game Event Vendor Additions Data...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Game Event Vendor Additions Data...");
{
uint32 oldMSTime = getMSTime();
@@ -813,8 +796,7 @@ void GameEventMgr::LoadFromDB()
if (!result)
{
- sLog->outInfo(LOG_FILTER_GAMEEVENTS, ">> Loaded 0 vendor additions in game events. DB table `game_event_npc_vendor` is empty.");
-
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 vendor additions in game events. DB table `game_event_npc_vendor` is empty.");
}
else
{
@@ -865,12 +847,11 @@ void GameEventMgr::LoadFromDB()
}
while (result->NextRow());
- sLog->outInfo(LOG_FILTER_GAMEEVENTS, ">> Loaded %u vendor additions in game events in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
-
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u vendor additions in game events in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
}
}
- sLog->outInfo(LOG_FILTER_GAMEEVENTS, "Loading Game Event Battleground Data...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Game Event Battleground Data...");
{
uint32 oldMSTime = getMSTime();
@@ -879,8 +860,7 @@ void GameEventMgr::LoadFromDB()
if (!result)
{
- sLog->outInfo(LOG_FILTER_GAMEEVENTS, ">> Loaded 0 battleground holidays in game events. DB table `game_event_condition` is empty.");
-
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 battleground holidays in game events. DB table `game_event_battleground_holiday` is empty.");
}
else
{
@@ -903,12 +883,11 @@ void GameEventMgr::LoadFromDB()
}
while (result->NextRow());
- sLog->outInfo(LOG_FILTER_GAMEEVENTS, ">> Loaded %u battleground holidays in game events in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
-
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u battleground holidays in game events in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
}
}
- sLog->outInfo(LOG_FILTER_GAMEEVENTS, "Loading Game Event Pool Data...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Game Event Pool Data...");
{
uint32 oldMSTime = getMSTime();
@@ -918,8 +897,7 @@ void GameEventMgr::LoadFromDB()
if (!result)
{
- sLog->outInfo(LOG_FILTER_GAMEEVENTS, ">> Loaded 0 pools for game events. DB table `game_event_pool` is empty.");
-
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 pools for game events. DB table `game_event_pool` is empty.");
}
else
{
@@ -952,8 +930,7 @@ void GameEventMgr::LoadFromDB()
}
while (result->NextRow());
- sLog->outInfo(LOG_FILTER_GAMEEVENTS, ">> Loaded %u pools for game events in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
-
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u pools for game events in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
}
}
}
diff --git a/src/server/game/Events/GameEventMgr.h b/src/server/game/Events/GameEventMgr.h
index d9b5890bfe5..dbc2c7ead10 100755
--- a/src/server/game/Events/GameEventMgr.h
+++ b/src/server/game/Events/GameEventMgr.h
@@ -28,12 +28,12 @@
enum GameEventState
{
- GAMEEVENT_NORMAL = 0, // standard game events
- GAMEEVENT_WORLD_INACTIVE = 1, // not yet started
- GAMEEVENT_WORLD_CONDITIONS = 2, // condition matching phase
- GAMEEVENT_WORLD_NEXTPHASE = 3, // conditions are met, now 'length' timer to start next event
- GAMEEVENT_WORLD_FINISHED = 4, // next events are started, unapply this one
- GAMEEVENT_INTERNAL = 5, // never handled in update
+ GAMEEVENT_NORMAL = 0, // standard game events
+ GAMEEVENT_WORLD_INACTIVE = 1, // not yet started
+ GAMEEVENT_WORLD_CONDITIONS = 2, // condition matching phase
+ GAMEEVENT_WORLD_NEXTPHASE = 3, // conditions are met, now 'length' timer to start next event
+ GAMEEVENT_WORLD_FINISHED = 4, // next events are started, unapply this one
+ GAMEEVENT_INTERNAL = 5 // never handled in update
};
struct GameEventFinishCondition
diff --git a/src/server/game/Globals/ObjectAccessor.h b/src/server/game/Globals/ObjectAccessor.h
index 5b31c6bfff4..0a1b41eb292 100755
--- a/src/server/game/Globals/ObjectAccessor.h
+++ b/src/server/game/Globals/ObjectAccessor.h
@@ -191,6 +191,7 @@ class ObjectAccessor
// ACCESS LIKE THAT IS NOT THREAD SAFE
static Pet* FindPet(uint64);
static Player* FindPlayer(uint64);
+ static Creature* FindCreature(uint64);
static Unit* FindUnit(uint64);
static Player* FindPlayerByName(const char* name);
diff --git a/src/server/game/Globals/ObjectMgr.cpp b/src/server/game/Globals/ObjectMgr.cpp
index fc4386633ff..7d94e0ad209 100755
--- a/src/server/game/Globals/ObjectMgr.cpp
+++ b/src/server/game/Globals/ObjectMgr.cpp
@@ -296,8 +296,7 @@ void ObjectMgr::LoadCreatureLocales()
}
} while (result->NextRow());
- sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded %lu creature locale strings in %u ms", (unsigned long)_creatureLocaleStore.size(), GetMSTimeDiffToNow(oldMSTime));
-
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %lu creature locale strings in %u ms", (unsigned long)_creatureLocaleStore.size(), GetMSTimeDiffToNow(oldMSTime));
}
void ObjectMgr::LoadGossipMenuItemsLocales()
@@ -333,8 +332,7 @@ void ObjectMgr::LoadGossipMenuItemsLocales()
}
} while (result->NextRow());
- sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded %lu gossip_menu_option locale strings in %u ms", (unsigned long)_gossipMenuItemsLocaleStore.size(), GetMSTimeDiffToNow(oldMSTime));
-
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %lu gossip_menu_option locale strings in %u ms", (unsigned long)_gossipMenuItemsLocaleStore.size(), GetMSTimeDiffToNow(oldMSTime));
}
void ObjectMgr::LoadPointOfInterestLocales()
@@ -360,8 +358,7 @@ void ObjectMgr::LoadPointOfInterestLocales()
AddLocaleString(fields[i].GetString(), LocaleConstant(i), data.IconName);
} while (result->NextRow());
- sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded %lu points_of_interest locale strings in %u ms", (unsigned long)_pointOfInterestLocaleStore.size(), GetMSTimeDiffToNow(oldMSTime));
-
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %lu points_of_interest locale strings in %u ms", (unsigned long)_pointOfInterestLocaleStore.size(), GetMSTimeDiffToNow(oldMSTime));
}
void ObjectMgr::LoadCreatureTemplates()
@@ -372,24 +369,23 @@ void ObjectMgr::LoadCreatureTemplates()
QueryResult result = WorldDatabase.Query("SELECT entry, difficulty_entry_1, difficulty_entry_2, difficulty_entry_3, KillCredit1, KillCredit2, modelid1, modelid2, modelid3, "
// 9 10 11 12 13 14 15 16 17 18 19 20 21
"modelid4, name, subname, IconName, gossip_menu_id, minlevel, maxlevel, exp, faction_A, faction_H, npcflag, speed_walk, speed_run, "
- // 22 23 24 25 26 27 28 29 30 31 32
- "scale, rank, mindmg, maxdmg, dmgschool, attackpower, dmg_multiplier, baseattacktime, rangeattacktime, unit_class, unit_flags, "
- // 33 34 35 36 37 38 39 40 41 42
+ // 22 23 24 25 26 27 28 29 30 31 32 33
+ "scale, rank, mindmg, maxdmg, dmgschool, attackpower, dmg_multiplier, baseattacktime, rangeattacktime, unit_class, unit_flags, unit_flags2, "
+ // 34 35 36 37 38 39 40 41 42 43
"dynamicflags, family, trainer_type, trainer_spell, trainer_class, trainer_race, minrangedmg, maxrangedmg, rangedattackpower, type, "
- // 43 44 45 46 47 48 49 50 51 52 53
+ // 44 45 46 47 48 49 50 51 52 53 54
"type_flags, lootid, pickpocketloot, skinloot, resistance1, resistance2, resistance3, resistance4, resistance5, resistance6, spell1, "
- // 54 55 56 57 58 59 60 61 62 63 64 65 66
+ // 55 56 57 58 59 60 61 62 63 64 65 66 67
"spell2, spell3, spell4, spell5, spell6, spell7, spell8, PetSpellDataId, VehicleId, mingold, maxgold, AIName, MovementType, "
- // 67 68 69 70 71 72 73 74 75 76 77
+ // 68 69 70 71 72 73 74 75 76 77 78
"InhabitType, HoverHeight, Health_mod, Mana_mod, Armor_mod, RacialLeader, questItem1, questItem2, questItem3, questItem4, questItem5, "
- // 78 79 80 81 82 83
+ // 79 80 81 82 83 84
" questItem6, movementId, RegenHealth, equipment_id, mechanic_immune_mask, flags_extra, ScriptName "
"FROM creature_template;");
if (!result)
{
- sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded 0 creature template definitions. DB table `creature_template` is empty.");
-
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 creature template definitions. DB table `creature_template` is empty.");
return;
}
@@ -439,49 +435,50 @@ void ObjectMgr::LoadCreatureTemplates()
creatureTemplate.rangeattacktime = fields[30].GetUInt32();
creatureTemplate.unit_class = uint32(fields[31].GetUInt8());
creatureTemplate.unit_flags = fields[32].GetUInt32();
- creatureTemplate.dynamicflags = fields[33].GetUInt32();
- creatureTemplate.family = uint32(fields[34].GetUInt8());
- creatureTemplate.trainer_type = uint32(fields[35].GetUInt8());
- creatureTemplate.trainer_spell = fields[36].GetUInt32();
- creatureTemplate.trainer_class = uint32(fields[37].GetUInt8());
- creatureTemplate.trainer_race = uint32(fields[38].GetUInt8());
- creatureTemplate.minrangedmg = fields[39].GetFloat();
- creatureTemplate.maxrangedmg = fields[40].GetFloat();
- creatureTemplate.rangedattackpower = uint32(fields[41].GetUInt16());
- creatureTemplate.type = uint32(fields[42].GetUInt8());
- creatureTemplate.type_flags = fields[43].GetUInt32();
- creatureTemplate.lootid = fields[44].GetUInt32();
- creatureTemplate.pickpocketLootId = fields[45].GetUInt32();
- creatureTemplate.SkinLootId = fields[46].GetUInt32();
+ creatureTemplate.unit_flags2 = fields[33].GetUInt32();
+ creatureTemplate.dynamicflags = fields[34].GetUInt32();
+ creatureTemplate.family = uint32(fields[35].GetUInt8());
+ creatureTemplate.trainer_type = uint32(fields[36].GetUInt8());
+ creatureTemplate.trainer_spell = fields[37].GetUInt32();
+ creatureTemplate.trainer_class = uint32(fields[38].GetUInt8());
+ creatureTemplate.trainer_race = uint32(fields[39].GetUInt8());
+ creatureTemplate.minrangedmg = fields[40].GetFloat();
+ creatureTemplate.maxrangedmg = fields[41].GetFloat();
+ creatureTemplate.rangedattackpower = uint32(fields[42].GetUInt16());
+ creatureTemplate.type = uint32(fields[43].GetUInt8());
+ creatureTemplate.type_flags = fields[44].GetUInt32();
+ creatureTemplate.lootid = fields[45].GetUInt32();
+ creatureTemplate.pickpocketLootId = fields[46].GetUInt32();
+ creatureTemplate.SkinLootId = fields[47].GetUInt32();
for (uint8 i = SPELL_SCHOOL_HOLY; i < MAX_SPELL_SCHOOL; ++i)
- creatureTemplate.resistance[i] = fields[47 + i -1].GetInt16();
+ creatureTemplate.resistance[i] = fields[48 + i -1].GetInt16();
for (uint8 i = 0; i < CREATURE_MAX_SPELLS; ++i)
- creatureTemplate.spells[i] = fields[53 + i].GetUInt32();
-
- creatureTemplate.PetSpellDataId = fields[61].GetUInt32();
- creatureTemplate.VehicleId = fields[62].GetUInt32();
- creatureTemplate.mingold = fields[63].GetUInt32();
- creatureTemplate.maxgold = fields[64].GetUInt32();
- creatureTemplate.AIName = fields[65].GetString();
- creatureTemplate.MovementType = uint32(fields[66].GetUInt8());
- creatureTemplate.InhabitType = uint32(fields[67].GetUInt8());
- creatureTemplate.HoverHeight = fields[68].GetFloat();
- creatureTemplate.ModHealth = fields[69].GetFloat();
- creatureTemplate.ModMana = fields[70].GetFloat();
- creatureTemplate.ModArmor = fields[71].GetFloat();
- creatureTemplate.RacialLeader = fields[72].GetBool();
+ creatureTemplate.spells[i] = fields[54 + i].GetUInt32();
+
+ creatureTemplate.PetSpellDataId = fields[62].GetUInt32();
+ creatureTemplate.VehicleId = fields[63].GetUInt32();
+ creatureTemplate.mingold = fields[64].GetUInt32();
+ creatureTemplate.maxgold = fields[65].GetUInt32();
+ creatureTemplate.AIName = fields[66].GetString();
+ creatureTemplate.MovementType = uint32(fields[67].GetUInt8());
+ creatureTemplate.InhabitType = uint32(fields[68].GetUInt8());
+ creatureTemplate.HoverHeight = fields[69].GetFloat();
+ creatureTemplate.ModHealth = fields[70].GetFloat();
+ creatureTemplate.ModMana = fields[71].GetFloat();
+ creatureTemplate.ModArmor = fields[72].GetFloat();
+ creatureTemplate.RacialLeader = fields[73].GetBool();
for (uint8 i = 0; i < MAX_CREATURE_QUEST_ITEMS; ++i)
- creatureTemplate.questItems[i] = fields[73 + i].GetUInt32();
+ creatureTemplate.questItems[i] = fields[74 + i].GetUInt32();
- creatureTemplate.movementId = fields[79].GetUInt32();
- creatureTemplate.RegenHealth = fields[80].GetBool();
- creatureTemplate.equipmentId = fields[81].GetUInt32();
- creatureTemplate.MechanicImmuneMask = fields[82].GetUInt32();
- creatureTemplate.flags_extra = fields[83].GetUInt32();
- creatureTemplate.ScriptID = GetScriptId(fields[84].GetCString());
+ creatureTemplate.movementId = fields[80].GetUInt32();
+ creatureTemplate.RegenHealth = fields[81].GetBool();
+ creatureTemplate.equipmentId = fields[82].GetUInt32();
+ creatureTemplate.MechanicImmuneMask = fields[83].GetUInt32();
+ creatureTemplate.flags_extra = fields[84].GetUInt32();
+ creatureTemplate.ScriptID = GetScriptId(fields[85].GetCString());
++count;
}
@@ -491,8 +488,7 @@ void ObjectMgr::LoadCreatureTemplates()
for (CreatureTemplateContainer::const_iterator itr = _creatureTemplateStore.begin(); itr != _creatureTemplateStore.end(); ++itr)
CheckCreatureTemplate(&itr->second);
- sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded %u creature definitions in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
-
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u creature definitions in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
}
void ObjectMgr::LoadCreatureTemplateAddons()
@@ -504,8 +500,7 @@ void ObjectMgr::LoadCreatureTemplateAddons()
if (!result)
{
- sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded 0 creature template addon definitions. DB table `creature_template_addon` is empty.");
-
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 creature template addon definitions. DB table `creature_template_addon` is empty.");
return;
}
@@ -563,8 +558,7 @@ void ObjectMgr::LoadCreatureTemplateAddons()
}
while (result->NextRow());
- sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded %u creature template addons in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
-
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u creature template addons in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
}
void ObjectMgr::CheckCreatureTemplate(CreatureTemplate const* cInfo)
@@ -881,8 +875,7 @@ void ObjectMgr::LoadCreatureAddons()
if (!result)
{
- sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded 0 creature addon definitions. DB table `creature_addon` is empty.");
-
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 creature addon definitions. DB table `creature_addon` is empty.");
return;
}
@@ -947,8 +940,7 @@ void ObjectMgr::LoadCreatureAddons()
}
while (result->NextRow());
- sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded %u creature addons in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
-
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u creature addons in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
}
CreatureAddon const* ObjectMgr::GetCreatureAddon(uint32 lowguid)
@@ -986,8 +978,7 @@ void ObjectMgr::LoadEquipmentTemplates()
if (!result)
{
- sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded 0 creature equipment templates. DB table `creature_equip_template` is empty!");
-
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 creature equipment templates. DB table `creature_equip_template` is empty!");
return;
}
@@ -1039,8 +1030,7 @@ void ObjectMgr::LoadEquipmentTemplates()
}
while (result->NextRow());
- sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded %u equipment templates in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
-
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u equipment templates in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
}
CreatureModelInfo const* ObjectMgr::GetCreatureModelInfo(uint32 modelId)
@@ -1117,8 +1107,7 @@ void ObjectMgr::LoadCreatureModelInfo()
if (!result)
{
- sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded 0 creature model definitions. DB table `creature_model_info` is empty.");
-
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 creature model definitions. DB table `creature_model_info` is empty.");
return;
}
@@ -1162,8 +1151,7 @@ void ObjectMgr::LoadCreatureModelInfo()
}
while (result->NextRow());
- sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded %u creature model based info in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
-
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u creature model based info in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
}
void ObjectMgr::LoadLinkedRespawn()
@@ -1348,8 +1336,7 @@ void ObjectMgr::LoadLinkedRespawn()
}
while (result->NextRow());
- sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded " UI64FMTD " linked respawns in %u ms", uint64(_linkedRespawnStore.size()), GetMSTimeDiffToNow(oldMSTime));
-
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded " UI64FMTD " linked respawns in %u ms", uint64(_linkedRespawnStore.size()), GetMSTimeDiffToNow(oldMSTime));
}
bool ObjectMgr::SetCreatureLinkedRespawn(uint32 guidLow, uint32 linkedGuidLow)
@@ -1535,8 +1522,7 @@ void ObjectMgr::LoadCreatures()
} while (result->NextRow());
- sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded %u creatures in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
-
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u creatures in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
}
void ObjectMgr::AddCreatureToGrid(uint32 guid, CreatureData const* data)
@@ -1840,8 +1826,7 @@ void ObjectMgr::LoadGameobjects()
++count;
} while (result->NextRow());
- sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded %lu gameobjects in %u ms", (unsigned long)_gameObjectDataStore.size(), GetMSTimeDiffToNow(oldMSTime));
-
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %lu gameobjects in %u ms", (unsigned long)_gameObjectDataStore.size(), GetMSTimeDiffToNow(oldMSTime));
}
void ObjectMgr::AddGameobjectToGrid(uint32 guid, GameObjectData const* data)
@@ -2009,16 +1994,15 @@ void ObjectMgr::LoadItemLocales()
}
} while (result->NextRow());
- sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded %lu Item locale strings in %u ms", (unsigned long)_itemLocaleStore.size(), GetMSTimeDiffToNow(oldMSTime));
-
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %lu Item locale strings in %u ms", (unsigned long)_itemLocaleStore.size(), GetMSTimeDiffToNow(oldMSTime));
}
void ObjectMgr::LoadItemTemplates()
{
uint32 oldMSTime = getMSTime();
- // 0 1 2 3 4 5 6 7 8 9 10 11 12
- QueryResult result = WorldDatabase.Query("SELECT entry, class, subclass, unk0, name, displayid, Quality, Flags, FlagsExtra, BuyCount, BuyPrice, SellPrice, InventoryType, "
+ // 0 1 2 3 4 5 6 7 8 9 10 11 12
+ QueryResult result = WorldDatabase.Query("SELECT entry, class, subclass, SoundOverrideSubclass, name, displayid, Quality, Flags, FlagsExtra, BuyCount, BuyPrice, SellPrice, InventoryType, "
// 13 14 15 16 17 18 19 20
"AllowableClass, AllowableRace, ItemLevel, RequiredLevel, RequiredSkill, RequiredSkillRank, requiredspell, requiredhonorrank, "
// 21 22 23 24 25 26 27 28
@@ -2052,8 +2036,7 @@ void ObjectMgr::LoadItemTemplates()
if (!result)
{
- sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded 0 item templates. DB table `item_template` is empty.");
-
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 item templates. DB table `item_template` is empty.");
return;
}
@@ -2072,7 +2055,7 @@ void ObjectMgr::LoadItemTemplates()
itemTemplate.ItemId = entry;
itemTemplate.Class = uint32(fields[1].GetUInt8());
itemTemplate.SubClass = uint32(fields[2].GetUInt8());
- itemTemplate.Unk0 = fields[3].GetInt32();
+ itemTemplate.SoundOverrideSubclass = int32(fields[3].GetInt8());
itemTemplate.Name1 = fields[4].GetString();
itemTemplate.DisplayInfoID = fields[5].GetUInt32();
itemTemplate.Quality = uint32(fields[6].GetUInt8());
@@ -2188,11 +2171,11 @@ void ObjectMgr::LoadItemTemplates()
itemTemplate.Class = dbcitem->Class;
}
- if (itemTemplate.Unk0 != dbcitem->Unk0)
+ if (itemTemplate.SoundOverrideSubclass != dbcitem->SoundOverrideSubclass)
{
- sLog->outError(LOG_FILTER_SQL, "Item (Entry: %u) does not have a correct Unk0 (%i), must be %i .", entry, itemTemplate.Unk0, dbcitem->Unk0);
+ sLog->outError(LOG_FILTER_SQL, "Item (Entry: %u) does not have a correct SoundOverrideSubclass (%i), must be %i .", entry, itemTemplate.SoundOverrideSubclass, dbcitem->SoundOverrideSubclass);
if (enforceDBCAttributes)
- itemTemplate.Unk0 = dbcitem->Unk0;
+ itemTemplate.SoundOverrideSubclass = dbcitem->SoundOverrideSubclass;
}
if (itemTemplate.Material != dbcitem->Material)
{
@@ -2614,8 +2597,7 @@ void ObjectMgr::LoadItemTemplates()
for (std::set<uint32>::const_iterator itr = notFoundOutfit.begin(); itr != notFoundOutfit.end(); ++itr)
sLog->outError(LOG_FILTER_SQL, "Item (Entry: %u) does not exist in `item_template` but is referenced in `CharStartOutfit.dbc`", *itr);
- sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded %u item templates in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
-
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u item templates in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
}
ItemTemplate const* ObjectMgr::GetItemTemplate(uint32 entry)
@@ -2650,8 +2632,7 @@ void ObjectMgr::LoadItemSetNameLocales()
AddLocaleString(fields[i].GetString(), LocaleConstant(i), data.Name);
} while (result->NextRow());
- sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded " UI64FMTD " Item set name locale strings in %u ms", uint64(_itemSetNameLocaleStore.size()), GetMSTimeDiffToNow(oldMSTime));
-
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded " UI64FMTD " Item set name locale strings in %u ms", uint64(_itemSetNameLocaleStore.size()), GetMSTimeDiffToNow(oldMSTime));
}
void ObjectMgr::LoadItemSetNames()
@@ -2679,8 +2660,7 @@ void ObjectMgr::LoadItemSetNames()
if (!result)
{
- sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded 0 item set names. DB table `item_set_names` is empty.");
-
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 item set names. DB table `item_set_names` is empty.");
return;
}
@@ -2734,8 +2714,7 @@ void ObjectMgr::LoadItemSetNames()
}
}
- sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded %u item set names in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
-
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u item set names in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
}
void ObjectMgr::LoadVehicleTemplateAccessories()
@@ -2791,8 +2770,7 @@ void ObjectMgr::LoadVehicleTemplateAccessories()
}
while (result->NextRow());
- sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded %u Vehicle Template Accessories in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
-
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u Vehicle Template Accessories in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
}
void ObjectMgr::LoadVehicleAccessories()
@@ -2808,8 +2786,7 @@ void ObjectMgr::LoadVehicleAccessories()
if (!result)
{
- sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded 0 Vehicle Accessories in %u ms", GetMSTimeDiffToNow(oldMSTime));
-
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 Vehicle Accessories in %u ms", GetMSTimeDiffToNow(oldMSTime));
return;
}
@@ -2836,8 +2813,7 @@ void ObjectMgr::LoadVehicleAccessories()
}
while (result->NextRow());
- sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded %u Vehicle Accessories in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
-
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u Vehicle Accessories in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
}
void ObjectMgr::LoadPetLevelInfo()
@@ -2929,8 +2905,7 @@ void ObjectMgr::LoadPetLevelInfo()
}
}
- sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded %u level pet stats definitions in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
-
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u level pet stats definitions in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
}
PetLevelInfo const* ObjectMgr::GetPetLevelInfo(uint32 creature_id, uint8 level) const
@@ -3071,13 +3046,12 @@ void ObjectMgr::LoadPlayerInfo()
}
while (result->NextRow());
- sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded %u player create definitions in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
-
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u player create definitions in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
}
}
// Load playercreate items
- sLog->outInfo(LOG_FILTER_GENERAL, "Loading Player Create Items Data...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Player Create Items Data...");
{
uint32 oldMSTime = getMSTime();
// 0 1 2 3
@@ -3085,8 +3059,7 @@ void ObjectMgr::LoadPlayerInfo()
if (!result)
{
- sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded 0 custom player create items. DB table `playercreateinfo_item` is empty.");
-
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 custom player create items. DB table `playercreateinfo_item` is empty.");
}
else
{
@@ -3143,13 +3116,12 @@ void ObjectMgr::LoadPlayerInfo()
}
while (result->NextRow());
- sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded %u custom player create items in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
-
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u custom player create items in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
}
}
// Load playercreate spells
- sLog->outInfo(LOG_FILTER_GENERAL, "Loading Player Create Spell Data...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Player Create Spell Data...");
{
uint32 oldMSTime = getMSTime();
@@ -3200,13 +3172,12 @@ void ObjectMgr::LoadPlayerInfo()
}
while (result->NextRow());
- sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded %u player create spells in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
-
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u player create spells in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
}
}
// Load playercreate actions
- sLog->outInfo(LOG_FILTER_GENERAL, "Loading Player Create Action Data...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Player Create Action Data...");
{
uint32 oldMSTime = getMSTime();
@@ -3247,13 +3218,12 @@ void ObjectMgr::LoadPlayerInfo()
}
while (result->NextRow());
- sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded %u player create actions in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
-
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u player create actions in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
}
}
// Loading levels data (class only dependent)
- sLog->outInfo(LOG_FILTER_GENERAL, "Loading Player Create Level HP/Mana Data...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Player Create Level HP/Mana Data...");
{
uint32 oldMSTime = getMSTime();
@@ -3329,12 +3299,11 @@ void ObjectMgr::LoadPlayerInfo()
}
}
- sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded %u level health/mana definitions in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
-
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u level health/mana definitions in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
}
// Loading levels data (class/race dependent)
- sLog->outInfo(LOG_FILTER_GENERAL, "Loading Player Create Level Stats Data...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Player Create Level Stats Data...");
{
uint32 oldMSTime = getMSTime();
@@ -3443,12 +3412,11 @@ void ObjectMgr::LoadPlayerInfo()
}
}
- sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded %u level stats definitions in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
-
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u level stats definitions in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
}
// Loading xp per level data
- sLog->outInfo(LOG_FILTER_GENERAL, "Loading Player Create XP Data...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Player Create XP Data...");
{
uint32 oldMSTime = getMSTime();
@@ -3502,8 +3470,7 @@ void ObjectMgr::LoadPlayerInfo()
}
}
- sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded %u xp for level definitions in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
-
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u xp for level definitions in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
}
}
@@ -4289,8 +4256,7 @@ void ObjectMgr::LoadQuests()
}
}
- sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded %lu quests definitions in %u ms", (unsigned long)_questTemplates.size(), GetMSTimeDiffToNow(oldMSTime));
-
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %lu quests definitions in %u ms", (unsigned long)_questTemplates.size(), GetMSTimeDiffToNow(oldMSTime));
}
void ObjectMgr::LoadQuestLocales()
@@ -4338,8 +4304,7 @@ void ObjectMgr::LoadQuestLocales()
}
} while (result->NextRow());
- sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded %lu Quest locale strings in %u ms", (unsigned long)_questLocaleStore.size(), GetMSTimeDiffToNow(oldMSTime));
-
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %lu Quest locale strings in %u ms", (unsigned long)_questLocaleStore.size(), GetMSTimeDiffToNow(oldMSTime));
}
void ObjectMgr::LoadScripts(ScriptsType type)
@@ -4357,7 +4322,7 @@ void ObjectMgr::LoadScripts(ScriptsType type)
if (sScriptMgr->IsScriptScheduled()) // function cannot be called when scripts are in use.
return;
- sLog->outInfo(LOG_FILTER_GENERAL, "Loading %s...", tableName.c_str());
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading %s...", tableName.c_str());
scripts->clear(); // need for reload support
@@ -4367,8 +4332,7 @@ void ObjectMgr::LoadScripts(ScriptsType type)
if (!result)
{
- sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded 0 script definitions. DB table `%s` is empty!", tableName.c_str());
-
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 script definitions. DB table `%s` is empty!", tableName.c_str());
return;
}
@@ -4659,8 +4623,7 @@ void ObjectMgr::LoadScripts(ScriptsType type)
}
while (result->NextRow());
- sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded %u script definitions in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
-
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u script definitions in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
}
void ObjectMgr::LoadGameObjectScripts()
@@ -4804,8 +4767,7 @@ void ObjectMgr::LoadSpellScriptNames()
if (!result)
{
- sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded 0 spell script names. DB table `spell_script_names` is empty!");
-
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 spell script names. DB table `spell_script_names` is empty!");
return;
}
@@ -4852,8 +4814,7 @@ void ObjectMgr::LoadSpellScriptNames()
}
while (result->NextRow());
- sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded %u spell script names in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
-
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u spell script names in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
}
void ObjectMgr::ValidateSpellScripts()
@@ -4862,8 +4823,7 @@ void ObjectMgr::ValidateSpellScripts()
if (_spellScriptsStore.empty())
{
- sLog->outInfo(LOG_FILTER_GENERAL, ">> Validated 0 scripts.");
-
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Validated 0 scripts.");
return;
}
@@ -4910,8 +4870,7 @@ void ObjectMgr::ValidateSpellScripts()
++count;
}
- sLog->outInfo(LOG_FILTER_GENERAL, ">> Validated %u scripts in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
-
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Validated %u scripts in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
}
void ObjectMgr::LoadPageTexts()
@@ -4923,8 +4882,7 @@ void ObjectMgr::LoadPageTexts()
if (!result)
{
- sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded 0 page texts. DB table `page_text` is empty!");
-
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 page texts. DB table `page_text` is empty!");
return;
}
@@ -4953,8 +4911,7 @@ void ObjectMgr::LoadPageTexts()
}
}
- sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded %u page texts in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
-
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u page texts in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
}
PageText const* ObjectMgr::GetPageText(uint32 pageEntry)
@@ -4989,8 +4946,7 @@ void ObjectMgr::LoadPageTextLocales()
AddLocaleString(fields[i].GetString(), LocaleConstant(i), data.Text);
} while (result->NextRow());
- sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded %lu PageText locale strings in %u ms", (unsigned long)_pageTextLocaleStore.size(), GetMSTimeDiffToNow(oldMSTime));
-
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %lu PageText locale strings in %u ms", (unsigned long)_pageTextLocaleStore.size(), GetMSTimeDiffToNow(oldMSTime));
}
void ObjectMgr::LoadInstanceTemplate()
@@ -5002,8 +4958,7 @@ void ObjectMgr::LoadInstanceTemplate()
if (!result)
{
- sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded 0 instance templates. DB table `page_text` is empty!");
-
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 instance templates. DB table `page_text` is empty!");
return;
}
@@ -5032,8 +4987,7 @@ void ObjectMgr::LoadInstanceTemplate()
}
while (result->NextRow());
- sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded %u instance templates in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
-
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u instance templates in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
}
InstanceTemplate const* ObjectMgr::GetInstanceTemplate(uint32 mapID)
@@ -5122,8 +5076,7 @@ void ObjectMgr::LoadInstanceEncounters()
++count;
} while (result->NextRow());
- sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded %u instance encounters in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
-
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u instance encounters in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
}
GossipText const* ObjectMgr::GetGossipText(uint32 Text_ID) const
@@ -5143,8 +5096,7 @@ void ObjectMgr::LoadGossipText()
int count = 0;
if (!result)
{
- sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded %u npc texts", count);
-
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u npc texts", count);
return;
}
_gossipTextStore.rehash(result->GetRowCount());
@@ -5183,8 +5135,7 @@ void ObjectMgr::LoadGossipText()
}
} while (result->NextRow());
- sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded %u npc texts in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
-
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u npc texts in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
}
void ObjectMgr::LoadNpcTextLocales()
@@ -5226,8 +5177,7 @@ void ObjectMgr::LoadNpcTextLocales()
}
} while (result->NextRow());
- sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded %lu NpcText locale strings in %u ms", (unsigned long)_npcTextLocaleStore.size(), GetMSTimeDiffToNow(oldMSTime));
-
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %lu NpcText locale strings in %u ms", (unsigned long)_npcTextLocaleStore.size(), GetMSTimeDiffToNow(oldMSTime));
}
//not very fast function but it is called only once a day, or on starting-up
@@ -5252,8 +5202,7 @@ void ObjectMgr::ReturnOrDeleteOldMails(bool serverUp)
PreparedQueryResult result = CharacterDatabase.Query(stmt);
if (!result)
{
- sLog->outInfo(LOG_FILTER_GENERAL, ">> No expired mails found.");
-
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> No expired mails found.");
return; // any mails need to be returned or deleted
}
@@ -5356,8 +5305,7 @@ void ObjectMgr::ReturnOrDeleteOldMails(bool serverUp)
}
while (result->NextRow());
- sLog->outInfo(LOG_FILTER_GENERAL, ">> Processed %u expired mails: %u deleted and %u returned in %u ms", deletedCount + returnedCount, deletedCount, returnedCount, GetMSTimeDiffToNow(oldMSTime));
-
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Processed %u expired mails: %u deleted and %u returned in %u ms", deletedCount + returnedCount, deletedCount, returnedCount, GetMSTimeDiffToNow(oldMSTime));
}
void ObjectMgr::LoadQuestAreaTriggers()
@@ -5370,8 +5318,7 @@ void ObjectMgr::LoadQuestAreaTriggers()
if (!result)
{
- sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded 0 quest trigger points. DB table `areatrigger_involvedrelation` is empty.");
-
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 quest trigger points. DB table `areatrigger_involvedrelation` is empty.");
return;
}
@@ -5415,8 +5362,7 @@ void ObjectMgr::LoadQuestAreaTriggers()
} while (result->NextRow());
- sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded %u quest trigger points in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
-
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u quest trigger points in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
}
void ObjectMgr::LoadTavernAreaTriggers()
@@ -5429,8 +5375,7 @@ void ObjectMgr::LoadTavernAreaTriggers()
if (!result)
{
- sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded 0 tavern triggers. DB table `areatrigger_tavern` is empty.");
-
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 tavern triggers. DB table `areatrigger_tavern` is empty.");
return;
}
@@ -5454,8 +5399,7 @@ void ObjectMgr::LoadTavernAreaTriggers()
_tavernAreaTriggerStore.insert(Trigger_ID);
} while (result->NextRow());
- sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded %u tavern triggers in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
-
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u tavern triggers in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
}
void ObjectMgr::LoadAreaTriggerScripts()
@@ -5467,8 +5411,7 @@ void ObjectMgr::LoadAreaTriggerScripts()
if (!result)
{
- sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded 0 areatrigger scripts. DB table `areatrigger_scripts` is empty.");
-
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 areatrigger scripts. DB table `areatrigger_scripts` is empty.");
return;
}
@@ -5492,8 +5435,7 @@ void ObjectMgr::LoadAreaTriggerScripts()
_areaTriggerScriptStore[Trigger_ID] = GetScriptId(scriptName);
} while (result->NextRow());
- sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded %u areatrigger scripts in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
-
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u areatrigger scripts in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
}
uint32 ObjectMgr::GetNearestTaxiNode(float x, float y, float z, uint32 mapid, uint32 team)
@@ -5611,8 +5553,7 @@ void ObjectMgr::LoadGraveyardZones()
if (!result)
{
- sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded 0 graveyard-zone links. DB table `game_graveyard_zone` is empty.");
-
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 graveyard-zone links. DB table `game_graveyard_zone` is empty.");
return;
}
@@ -5658,16 +5599,15 @@ void ObjectMgr::LoadGraveyardZones()
sLog->outError(LOG_FILTER_SQL, "Table `game_graveyard_zone` has a duplicate record for Graveyard (ID: %u) and Zone (ID: %u), skipped.", safeLocId, zoneId);
} while (result->NextRow());
- sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded %u graveyard-zone links in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
-
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u graveyard-zone links in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
}
WorldSafeLocsEntry const* ObjectMgr::GetDefaultGraveYard(uint32 team)
{
enum DefaultGraveyard
{
- HORDE_GRAVEYARD = 10, // Crossroads
- ALLIANCE_GRAVEYARD = 4, // Westfall
+ HORDE_GRAVEYARD = 10, // Crossroads
+ ALLIANCE_GRAVEYARD = 4 // Westfall
};
if (team == HORDE)
@@ -5904,8 +5844,7 @@ void ObjectMgr::LoadAreaTriggerTeleports()
QueryResult result = WorldDatabase.Query("SELECT id, target_map, target_position_x, target_position_y, target_position_z, target_orientation FROM areatrigger_teleport");
if (!result)
{
- sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded 0 area trigger teleport definitions. DB table `areatrigger_teleport` is empty.");
-
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 area trigger teleport definitions. DB table `areatrigger_teleport` is empty.");
return;
}
@@ -5951,8 +5890,7 @@ void ObjectMgr::LoadAreaTriggerTeleports()
} while (result->NextRow());
- sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded %u area trigger teleport definitions in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
-
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u area trigger teleport definitions in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
}
void ObjectMgr::LoadAccessRequirements()
@@ -5965,8 +5903,7 @@ void ObjectMgr::LoadAccessRequirements()
QueryResult result = WorldDatabase.Query("SELECT mapid, difficulty, level_min, level_max, item, item2, quest_done_A, quest_done_H, completed_achievement, quest_failed_text FROM access_requirement");
if (!result)
{
- sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded 0 access requirement definitions. DB table `access_requirement` is empty.");
-
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 access requirement definitions. DB table `access_requirement` is empty.");
return;
}
@@ -6043,8 +5980,7 @@ void ObjectMgr::LoadAccessRequirements()
_accessRequirementStore[requirement_ID] = ar;
} while (result->NextRow());
- sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded %u access requirement definitions in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
-
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u access requirement definitions in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
}
/*
@@ -6268,8 +6204,7 @@ void ObjectMgr::LoadGameObjectLocales()
AddLocaleString(fields[i + (TOTAL_LOCALES - 1)].GetString(), LocaleConstant(i), data.CastBarCaption);
} while (result->NextRow());
- sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded %lu gameobject locale strings in %u ms", (unsigned long)_gameObjectLocaleStore.size(), GetMSTimeDiffToNow(oldMSTime));
-
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %lu gameobject locale strings in %u ms", (unsigned long)_gameObjectLocaleStore.size(), GetMSTimeDiffToNow(oldMSTime));
}
inline void CheckGOLockId(GameObjectTemplate const* goInfo, uint32 dataN, uint32 N)
@@ -6345,8 +6280,7 @@ void ObjectMgr::LoadGameObjectTemplate()
if (!result)
{
- sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded 0 gameobject definitions. DB table `gameobject_template` is empty.");
-
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 gameobject definitions. DB table `gameobject_template` is empty.");
return;
}
@@ -6515,8 +6449,7 @@ void ObjectMgr::LoadGameObjectTemplate()
}
while (result->NextRow());
- sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded %u game object templates in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
-
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u game object templates in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
}
void ObjectMgr::LoadExplorationBaseXP()
@@ -6544,8 +6477,7 @@ void ObjectMgr::LoadExplorationBaseXP()
}
while (result->NextRow());
- sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded %u BaseXP definitions in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
-
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u BaseXP definitions in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
}
uint32 ObjectMgr::GetBaseXP(uint8 level)
@@ -6568,8 +6500,7 @@ void ObjectMgr::LoadPetNames()
if (!result)
{
- sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded 0 pet name parts. DB table `pet_name_generation` is empty!");
-
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 pet name parts. DB table `pet_name_generation` is empty!");
return;
}
@@ -6589,8 +6520,7 @@ void ObjectMgr::LoadPetNames()
}
while (result->NextRow());
- sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded %u pet name parts in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
-
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u pet name parts in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
}
void ObjectMgr::LoadPetNumber()
@@ -6604,8 +6534,7 @@ void ObjectMgr::LoadPetNumber()
_hiPetNumber = fields[0].GetUInt32()+1;
}
- sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded the max pet number: %d in %u ms", _hiPetNumber-1, GetMSTimeDiffToNow(oldMSTime));
-
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded the max pet number: %d in %u ms", _hiPetNumber-1, GetMSTimeDiffToNow(oldMSTime));
}
std::string ObjectMgr::GeneratePetName(uint32 entry)
@@ -6638,8 +6567,7 @@ void ObjectMgr::LoadCorpses()
PreparedQueryResult result = CharacterDatabase.Query(CharacterDatabase.GetPreparedStatement(CHAR_SEL_CORPSES));
if (!result)
{
- sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded 0 corpses. DB table `corpse` is empty.");
-
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 corpses. DB table `corpse` is empty.");
return;
}
@@ -6667,8 +6595,7 @@ void ObjectMgr::LoadCorpses()
}
while (result->NextRow());
- sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded %u corpses in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
-
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u corpses in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
}
void ObjectMgr::LoadReputationRewardRate()
@@ -6730,8 +6657,7 @@ void ObjectMgr::LoadReputationRewardRate()
}
while (result->NextRow());
- sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded %u reputation_reward_rate in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
-
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u reputation_reward_rate in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
}
void ObjectMgr::LoadReputationOnKill()
@@ -6804,8 +6730,7 @@ void ObjectMgr::LoadReputationOnKill()
++count;
} while (result->NextRow());
- sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded %u creature award reputation definitions in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
-
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u creature award reputation definitions in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
}
void ObjectMgr::LoadReputationSpilloverTemplate()
@@ -6819,8 +6744,7 @@ void ObjectMgr::LoadReputationSpilloverTemplate()
if (!result)
{
- sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded `reputation_spillover_template`, table is empty.");
-
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded `reputation_spillover_template`, table is empty.");
return;
}
@@ -6916,8 +6840,7 @@ void ObjectMgr::LoadReputationSpilloverTemplate()
}
while (result->NextRow());
- sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded %u reputation_spillover_template in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
-
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u reputation_spillover_template in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
}
void ObjectMgr::LoadPointsOfInterest()
@@ -6963,8 +6886,7 @@ void ObjectMgr::LoadPointsOfInterest()
++count;
} while (result->NextRow());
- sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded %u Points of Interest definitions in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
-
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u Points of Interest definitions in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
}
void ObjectMgr::LoadQuestPOI()
@@ -7035,8 +6957,7 @@ void ObjectMgr::LoadQuestPOI()
++count;
} while (result->NextRow());
- sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded %u quest POI definitions in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
-
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u quest POI definitions in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
}
void ObjectMgr::LoadNPCSpellClickSpells()
@@ -7103,8 +7024,7 @@ void ObjectMgr::LoadNPCSpellClickSpells()
}
}
- sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded %u spellclick definitions in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
-
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u spellclick definitions in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
}
void ObjectMgr::DeleteCreatureData(uint32 guid)
@@ -7182,8 +7102,7 @@ void ObjectMgr::LoadQuestRelationsHelper(QuestRelations& map, std::string table,
++count;
} while (result->NextRow());
- sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded %u quest relations from %s in %u ms", count, table.c_str(), GetMSTimeDiffToNow(oldMSTime));
-
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u quest relations from %s in %u ms", count, table.c_str(), GetMSTimeDiffToNow(oldMSTime));
}
void ObjectMgr::LoadGameobjectQuestRelations()
@@ -7252,8 +7171,7 @@ void ObjectMgr::LoadReservedPlayersNames()
if (!result)
{
- sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded 0 reserved player names. DB table `reserved_name` is empty!");
-
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 reserved player names. DB table `reserved_name` is empty!");
return;
}
@@ -7279,8 +7197,7 @@ void ObjectMgr::LoadReservedPlayersNames()
}
while (result->NextRow());
- sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded %u reserved player names in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
-
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u reserved player names in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
}
bool ObjectMgr::IsReservedName(const std::string& name) const
@@ -7384,6 +7301,11 @@ uint8 ObjectMgr::CheckPlayerName(const std::string& name, bool create)
if (!isValidString(wname, strictMask, false, create))
return CHAR_NAME_MIXED_LANGUAGES;
+ wstrToLower(wname);
+ for (size_t i = 2; i < wname.size(); ++i)
+ if (wname[i] == wname[i-1] && wname[i] == wname[i-2])
+ return CHAR_NAME_THREE_CONSECUTIVE;
+
return CHAR_NAME_SUCCESS;
}
@@ -7433,8 +7355,7 @@ void ObjectMgr::LoadGameObjectForQuests()
if (sObjectMgr->GetGameObjectTemplates()->empty())
{
- sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded 0 GameObjects for quests");
-
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 GameObjects for quests");
return;
}
@@ -7482,8 +7403,7 @@ void ObjectMgr::LoadGameObjectForQuests()
}
}
- sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded %u GameObjects for quests in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
-
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u GameObjects for quests in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
}
bool ObjectMgr::LoadTrinityStrings(const char* table, int32 min_value, int32 max_value)
@@ -7531,7 +7451,7 @@ bool ObjectMgr::LoadTrinityStrings(const char* table, int32 min_value, int32 max
if (min_value == MIN_TRINITY_STRING_ID) // error only in case internal strings
sLog->outError(LOG_FILTER_SQL, ">> Loaded 0 trinity strings. DB table `%s` is empty. Cannot continue.", table);
else
- sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded 0 string templates. DB table `%s` is empty.", table);
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 string templates. DB table `%s` is empty.", table);
return false;
}
@@ -7571,10 +7491,9 @@ bool ObjectMgr::LoadTrinityStrings(const char* table, int32 min_value, int32 max
} while (result->NextRow());
if (min_value == MIN_TRINITY_STRING_ID)
- sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded %u Trinity strings from table %s in %u ms", count, table, GetMSTimeDiffToNow(oldMSTime));
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u Trinity strings from table %s in %u ms", count, table, GetMSTimeDiffToNow(oldMSTime));
else
- sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded %u string templates from %s in %u ms", count, table, GetMSTimeDiffToNow(oldMSTime));
-
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u string templates from %s in %u ms", count, table, GetMSTimeDiffToNow(oldMSTime));
return true;
}
@@ -7631,8 +7550,7 @@ void ObjectMgr::LoadFishingBaseSkillLevel()
}
while (result->NextRow());
- sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded %u areas for fishing base skill level in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
-
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u areas for fishing base skill level in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
}
bool ObjectMgr::CheckDeclinedNames(std::wstring w_ownname, DeclinedName const& names)
@@ -7757,8 +7675,7 @@ void ObjectMgr::LoadGameTele()
}
while (result->NextRow());
- sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded %u GameTeleports in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
-
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u GameTeleports in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
}
GameTele const* ObjectMgr::GetGameTele(const std::string& name) const
@@ -7902,8 +7819,7 @@ void ObjectMgr::LoadMailLevelRewards()
}
while (result->NextRow());
- sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded %u level dependent mail rewards in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
-
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u level dependent mail rewards in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
}
void ObjectMgr::AddSpellToTrainer(uint32 entry, uint32 spell, uint32 spellCost, uint32 reqSkill, uint32 reqSkillValue, uint32 reqLevel)
@@ -7991,8 +7907,6 @@ void ObjectMgr::LoadTrainerSpell()
// For reload case
_cacheTrainerSpellStore.clear();
- std::set<uint32> skip_trainers;
-
QueryResult result = WorldDatabase.Query("SELECT b.entry, a.spell, a.spellcost, a.reqskill, a.reqskillvalue, a.reqlevel FROM npc_trainer AS a "
"INNER JOIN npc_trainer AS b ON a.entry = -(b.spell) "
"UNION SELECT * FROM npc_trainer WHERE spell > 0");
@@ -8023,8 +7937,7 @@ void ObjectMgr::LoadTrainerSpell()
}
while (result->NextRow());
- sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded %d Trainers in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
-
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %d Trainers in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
}
int ObjectMgr::LoadReferenceVendor(int32 vendor, int32 item, std::set<uint32> *skip_vendors)
@@ -8114,8 +8027,7 @@ void ObjectMgr::LoadVendors()
}
while (result->NextRow());
- sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded %d Vendors in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
-
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %d Vendors in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
}
void ObjectMgr::LoadGossipMenu()
@@ -8156,8 +8068,7 @@ void ObjectMgr::LoadGossipMenu()
}
while (result->NextRow());
- sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded %u gossip_menu entries in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
-
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u gossip_menu entries in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
}
void ObjectMgr::LoadGossipMenuItems()
@@ -8220,8 +8131,7 @@ void ObjectMgr::LoadGossipMenuItems()
}
while (result->NextRow());
- sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded %u gossip_menu_option entries in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
-
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u gossip_menu_option entries in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
}
void ObjectMgr::AddVendorItem(uint32 entry, uint32 item, int32 maxcount, uint32 incrtime, uint32 extendedCost, bool persist /*= true*/)
@@ -8399,8 +8309,7 @@ void ObjectMgr::LoadScriptNames()
while (result->NextRow());
std::sort(_scriptNamesStore.begin(), _scriptNamesStore.end());
- sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded %d Script Names in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
-
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %d Script Names in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
}
uint32 ObjectMgr::GetScriptId(const char *name)
@@ -8503,8 +8412,7 @@ void ObjectMgr::LoadCreatureClassLevelStats()
if (!result)
{
- sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded 0 creature base stats. DB table `creature_classlevelstats` is empty.");
-
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 creature base stats. DB table `creature_classlevelstats` is empty.");
return;
}
@@ -8552,8 +8460,7 @@ void ObjectMgr::LoadCreatureClassLevelStats()
}
}
- sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded %u creature base stats in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
-
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u creature base stats in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
}
void ObjectMgr::LoadFactionChangeAchievements()
@@ -8589,8 +8496,7 @@ void ObjectMgr::LoadFactionChangeAchievements()
}
while (result->NextRow());
- sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded %u faction change achievement pairs in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
-
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u faction change achievement pairs in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
}
void ObjectMgr::LoadFactionChangeItems()
@@ -8601,8 +8507,7 @@ void ObjectMgr::LoadFactionChangeItems()
if (!result)
{
- sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded 0 faction change item pairs. DB table `player_factionchange_items` is empty.");
-
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 faction change item pairs. DB table `player_factionchange_items` is empty.");
return;
}
@@ -8626,8 +8531,7 @@ void ObjectMgr::LoadFactionChangeItems()
}
while (result->NextRow());
- sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded %u faction change item pairs in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
-
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u faction change item pairs in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
}
void ObjectMgr::LoadFactionChangeSpells()
@@ -8663,8 +8567,7 @@ void ObjectMgr::LoadFactionChangeSpells()
}
while (result->NextRow());
- sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded %u faction change spell pairs in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
-
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u faction change spell pairs in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
}
void ObjectMgr::LoadFactionChangeReputations()
@@ -8675,8 +8578,7 @@ void ObjectMgr::LoadFactionChangeReputations()
if (!result)
{
- sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded 0 faction change reputation pairs. DB table `player_factionchange_reputations` is empty.");
-
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 faction change reputation pairs. DB table `player_factionchange_reputations` is empty.");
return;
}
@@ -8700,8 +8602,7 @@ void ObjectMgr::LoadFactionChangeReputations()
}
while (result->NextRow());
- sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded %u faction change reputation pairs in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
-
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u faction change reputation pairs in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
}
GameObjectTemplate const* ObjectMgr::GetGameObjectTemplate(uint32 entry)
diff --git a/src/server/game/Globals/ObjectMgr.h b/src/server/game/Globals/ObjectMgr.h
index 59bb2fb536f..a6d1dc6c386 100755
--- a/src/server/game/Globals/ObjectMgr.h
+++ b/src/server/game/Globals/ObjectMgr.h
@@ -128,7 +128,7 @@ enum eScriptFlags
SF_PLAYSOUND_DISTANCE_SOUND = 0x2,
// Orientation flags
- SF_ORIENTATION_FACE_TARGET = 0x1,
+ SF_ORIENTATION_FACE_TARGET = 0x1
};
struct ScriptInfo
@@ -536,7 +536,7 @@ enum SkillRangeType
SKILL_RANGE_LEVEL, // 1..max skill for level
SKILL_RANGE_MONO, // 1..1, grey monolite bar
SKILL_RANGE_RANK, // 1..skill for known rank
- SKILL_RANGE_NONE, // 0..0 always
+ SKILL_RANGE_NONE // 0..0 always
};
SkillRangeType GetSkillRangeType(SkillLineEntry const* pSkill, bool racial);
@@ -561,7 +561,7 @@ LanguageDesc const* GetLanguageDescByID(uint32 lang);
enum EncounterCreditType
{
ENCOUNTER_CREDIT_KILL_CREATURE = 0,
- ENCOUNTER_CREDIT_CAST_SPELL = 1,
+ ENCOUNTER_CREDIT_CAST_SPELL = 1
};
struct DungeonEncounter
@@ -787,13 +787,13 @@ class ObjectMgr
void LoadQuests();
void LoadQuestRelations()
{
- sLog->outInfo(LOG_FILTER_GENERAL, "Loading GO Start Quest Data...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading GO Start Quest Data...");
LoadGameobjectQuestRelations();
- sLog->outInfo(LOG_FILTER_GENERAL, "Loading GO End Quest Data...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading GO End Quest Data...");
LoadGameobjectInvolvedRelations();
- sLog->outInfo(LOG_FILTER_GENERAL, "Loading Creature Start Quest Data...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Creature Start Quest Data...");
LoadCreatureQuestRelations();
- sLog->outInfo(LOG_FILTER_GENERAL, "Loading Creature End Quest Data...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Creature End Quest Data...");
LoadCreatureInvolvedRelations();
}
void LoadGameobjectQuestRelations();
@@ -1285,7 +1285,7 @@ class ObjectMgr
CREATURE_TO_CREATURE,
CREATURE_TO_GO, // Creature is dependant on GO
GO_TO_GO,
- GO_TO_CREATURE, // GO is dependant on creature
+ GO_TO_CREATURE // GO is dependant on creature
};
};
diff --git a/src/server/game/Grids/NGrid.h b/src/server/game/Grids/NGrid.h
index b5701a7a590..0ef885703be 100755
--- a/src/server/game/Grids/NGrid.h
+++ b/src/server/game/Grids/NGrid.h
@@ -79,9 +79,13 @@ class NGrid
public:
typedef Grid<ACTIVE_OBJECT, WORLD_OBJECT_TYPES, GRID_OBJECT_TYPES> GridType;
NGrid(uint32 id, int32 x, int32 y, time_t expiry, bool unload = true)
- : i_gridId(id), i_x(x), i_y(y), i_cellstate(GRID_STATE_INVALID), i_GridObjectDataLoaded(false)
+ : i_gridId(id)
+ , i_GridInfo(GridInfo(expiry, unload))
+ , i_x(x)
+ , i_y(y)
+ , i_cellstate(GRID_STATE_INVALID)
+ , i_GridObjectDataLoaded(false)
{
- i_GridInfo = GridInfo(expiry, unload);
}
GridType& GetGridType(const uint32 x, const uint32 y)
diff --git a/src/server/game/Grids/Notifiers/GridNotifiers.h b/src/server/game/Grids/Notifiers/GridNotifiers.h
index 072db578220..db4dc819557 100755
--- a/src/server/game/Grids/Notifiers/GridNotifiers.h
+++ b/src/server/game/Grids/Notifiers/GridNotifiers.h
@@ -694,6 +694,30 @@ namespace Trinity
NearestGameObjectEntryInObjectRangeCheck(NearestGameObjectEntryInObjectRangeCheck const&);
};
+ // Success at unit in range, range update for next check (this can be use with GameobjectLastSearcher to find nearest GO with a certain type)
+ class NearestGameObjectTypeInObjectRangeCheck
+ {
+ public:
+ NearestGameObjectTypeInObjectRangeCheck(WorldObject const& obj, GameobjectTypes type, float range) : i_obj(obj), i_type(type), i_range(range) {}
+ bool operator()(GameObject* go)
+ {
+ if (go->GetGoType() == i_type && i_obj.IsWithinDistInMap(go, i_range))
+ {
+ i_range = i_obj.GetDistance(go); // use found GO range as new range limit for next check
+ return true;
+ }
+ return false;
+ }
+ float GetLastRange() const { return i_range; }
+ private:
+ WorldObject const& i_obj;
+ GameobjectTypes i_type;
+ float i_range;
+
+ // prevent clone this object
+ NearestGameObjectTypeInObjectRangeCheck(NearestGameObjectTypeInObjectRangeCheck const&);
+ };
+
class GameObjectWithDbGUIDCheck
{
public:
diff --git a/src/server/game/Groups/Group.cpp b/src/server/game/Groups/Group.cpp
index 5ace6da2f44..fda04effbf5 100755
--- a/src/server/game/Groups/Group.cpp
+++ b/src/server/game/Groups/Group.cpp
@@ -59,7 +59,7 @@ Loot* Roll::getLoot()
Group::Group() : m_leaderGuid(0), m_leaderName(""), m_groupType(GROUPTYPE_NORMAL),
m_dungeonDifficulty(DUNGEON_DIFFICULTY_NORMAL), m_raidDifficulty(RAID_DIFFICULTY_10MAN_NORMAL),
-m_bgGroup(NULL), m_lootMethod(FREE_FOR_ALL), m_lootThreshold(ITEM_QUALITY_UNCOMMON), m_looterGuid(0),
+m_bgGroup(NULL), m_bfGroup(NULL), m_lootMethod(FREE_FOR_ALL), m_lootThreshold(ITEM_QUALITY_UNCOMMON), m_looterGuid(0),
m_subGroupsCounts(NULL), m_guid(0), m_counter(0), m_maxEnchantingLevel(0), m_dbStoreId(0)
{
for (uint8 i = 0; i < TARGETICONCOUNT; ++i)
@@ -104,7 +104,7 @@ bool Group::Create(Player* leader)
m_leaderGuid = leaderGuid;
m_leaderName = leader->GetName();
- m_groupType = isBGGroup() ? GROUPTYPE_BGRAID : GROUPTYPE_NORMAL;
+ m_groupType = (isBGGroup() || isBFGroup()) ? GROUPTYPE_BGRAID : GROUPTYPE_NORMAL;
if (m_groupType & GROUPTYPE_RAID)
_initRaidSubGroupsCounter();
@@ -116,7 +116,7 @@ bool Group::Create(Player* leader)
m_dungeonDifficulty = DUNGEON_DIFFICULTY_NORMAL;
m_raidDifficulty = RAID_DIFFICULTY_10MAN_NORMAL;
- if (!isBGGroup())
+ if (!isBGGroup() && !isBFGroup())
{
m_dungeonDifficulty = leader->GetDungeonDifficulty();
m_raidDifficulty = leader->GetRaidDifficulty();
@@ -232,7 +232,7 @@ void Group::ConvertToLFG()
{
m_groupType = GroupType(m_groupType | GROUPTYPE_LFG | GROUPTYPE_UNK1);
m_lootMethod = NEED_BEFORE_GREED;
- if (!isBGGroup())
+ if (!isBGGroup() && !isBFGroup())
{
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_UPD_GROUP_TYPE);
@@ -251,7 +251,7 @@ void Group::ConvertToRaid()
_initRaidSubGroupsCounter();
- if (!isBGGroup())
+ if (!isBGGroup() && !isBFGroup())
{
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_UPD_GROUP_TYPE);
@@ -274,7 +274,7 @@ bool Group::AddInvite(Player* player)
if (!player || player->GetGroupInvite())
return false;
Group* group = player->GetGroup();
- if (group && group->isBGGroup())
+ if (group && (group->isBGGroup() || group->isBFGroup()))
group = player->GetOriginalGroup();
if (group)
return false;
@@ -371,8 +371,8 @@ bool Group::AddMember(Player* player)
if (player)
{
player->SetGroupInvite(NULL);
- if (player->GetGroup() && isBGGroup()) //if player is in group and he is being added to BG raid group, then call SetBattlegroundRaid()
- player->SetBattlegroundRaid(this, subGroup);
+ if (player->GetGroup() && (isBGGroup() || isBFGroup())) // if player is in group and he is being added to BG raid group, then call SetBattlegroundRaid()
+ player->SetBattlegroundOrBattlefieldRaid(this, subGroup);
else if (player->GetGroup()) //if player is in bg raid and we are adding him to normal group, then call SetOriginalGroup()
player->SetOriginalGroup(this, subGroup);
else //if player is not in group, then call set group
@@ -391,7 +391,7 @@ bool Group::AddMember(Player* player)
}
// insert into the table if we're not a battleground group
- if (!isBGGroup())
+ if (!isBGGroup() && !isBFGroup())
{
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_INS_GROUP_MEMBER);
@@ -410,7 +410,7 @@ bool Group::AddMember(Player* player)
if (player)
{
- if (!IsLeader(player->GetGUID()) && !isBGGroup())
+ if (!IsLeader(player->GetGUID()) && !isBGGroup() && !isBFGroup())
{
// reset the new member's instances, unless he is currently in one of them
// including raid/heroic instances that they are not permanently bound to!
@@ -465,7 +465,11 @@ bool Group::AddMember(Player* player)
UpdateData newData;
WorldPacket newDataPacket;
player->BuildValuesUpdateBlockForPlayer(&newData, member);
- member->SendDirectMessage(&newDataPacket);
+ if (newData.HasData())
+ {
+ newData.BuildPacket(&newDataPacket);
+ member->SendDirectMessage(&newDataPacket);
+ }
}
}
}
@@ -496,15 +500,15 @@ bool Group::RemoveMember(uint64 guid, const RemoveMethod &method /*= GROUP_REMOV
if (isLFGGroup() && method == GROUP_REMOVEMETHOD_KICK)
return m_memberSlots.size();
- // remove member and change leader (if need) only if strong more 2 members _before_ member remove (BG allow 1 member group)
- if (GetMembersCount() > ((isBGGroup() || isLFGGroup()) ? 1u : 2u))
+ // remove member and change leader (if need) only if strong more 2 members _before_ member remove (BG/BF allow 1 member group)
+ if (GetMembersCount() > ((isBGGroup() || isLFGGroup() || isBFGroup()) ? 1u : 2u))
{
Player* player = ObjectAccessor::FindPlayer(guid);
if (player)
{
// Battleground group handling
- if (isBGGroup())
- player->RemoveFromBattlegroundRaid();
+ if (isBGGroup() || isBFGroup())
+ player->RemoveFromBattlegroundOrBattlefieldRaid();
else
// Regular group
{
@@ -535,13 +539,13 @@ bool Group::RemoveMember(uint64 guid, const RemoveMethod &method /*= GROUP_REMOV
}
// Remove player from group in DB
- PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_GROUP_MEMBER);
-
- stmt->setUInt32(0, GUID_LOPART(guid));
-
- CharacterDatabase.Execute(stmt);
-
- DelinkMember(guid);
+ if (!isBGGroup() && !isBFGroup())
+ {
+ PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_GROUP_MEMBER);
+ stmt->setUInt32(0, GUID_LOPART(guid));
+ CharacterDatabase.Execute(stmt);
+ DelinkMember(guid);
+ }
// Reevaluate group enchanter if the leaving player had enchanting skill or the player is offline
if ((player && player->GetSkillValue(SKILL_ENCHANTING)) || !player)
@@ -632,7 +636,7 @@ void Group::ChangeLeader(uint64 guid)
sScriptMgr->OnGroupChangeLeader(this, m_leaderGuid, guid);
- if (!isBGGroup())
+ if (!isBGGroup() && !isBFGroup())
{
// Remove the groups permanent instance bindings
for (uint8 i = 0; i < MAX_DIFFICULTY; ++i)
@@ -692,8 +696,8 @@ void Group::Disband(bool hideDestroy /* = false */)
//we cannot call _removeMember because it would invalidate member iterator
//if we are removing player from battleground raid
- if (isBGGroup())
- player->RemoveFromBattlegroundRaid();
+ if (isBGGroup() || isBFGroup())
+ player->RemoveFromBattlegroundOrBattlefieldRaid();
else
{
//we can remove player who is in battleground from his original group
@@ -737,7 +741,7 @@ void Group::Disband(bool hideDestroy /* = false */)
RemoveAllInvites();
- if (!isBGGroup())
+ if (!isBGGroup() && !isBFGroup())
{
SQLTransaction trans = CharacterDatabase.BeginTransaction();
@@ -1507,7 +1511,7 @@ void Group::SendUpdateToPlayer(uint64 playerGUID, MemberSlot* slot)
Player* member = ObjectAccessor::FindPlayer(citr->guid);
uint8 onlineState = (member) ? MEMBER_STATUS_ONLINE : MEMBER_STATUS_OFFLINE;
- onlineState = onlineState | ((isBGGroup()) ? MEMBER_STATUS_PVP : 0);
+ onlineState = onlineState | ((isBGGroup() || isBFGroup()) ? MEMBER_STATUS_PVP : 0);
data << citr->name;
data << uint64(citr->guid); // guid
@@ -1598,7 +1602,7 @@ bool Group::_setMembersGroup(uint64 guid, uint8 group)
SubGroupCounterIncrease(group);
- if (!isBGGroup())
+ if (!isBGGroup() && !isBFGroup())
{
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_UPD_GROUP_MEMBER_SUBGROUP);
@@ -1649,7 +1653,7 @@ void Group::ChangeMembersGroup(uint64 guid, uint8 group)
SubGroupCounterDecrease(prevSubGroup);
// Preserve new sub group in database for non-raid groups
- if (!isBGGroup())
+ if (!isBGGroup() && !isBFGroup())
{
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_UPD_GROUP_MEMBER_SUBGROUP);
@@ -1844,7 +1848,7 @@ void Roll::targetObjectBuildLink()
void Group::SetDungeonDifficulty(Difficulty difficulty)
{
m_dungeonDifficulty = difficulty;
- if (!isBGGroup())
+ if (!isBGGroup() && !isBFGroup())
{
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_UPD_GROUP_DIFFICULTY);
@@ -1868,7 +1872,7 @@ void Group::SetDungeonDifficulty(Difficulty difficulty)
void Group::SetRaidDifficulty(Difficulty difficulty)
{
m_raidDifficulty = difficulty;
- if (!isBGGroup())
+ if (!isBGGroup() && !isBFGroup())
{
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_UPD_GROUP_RAID_DIFFICULTY);
@@ -1904,7 +1908,7 @@ bool Group::InCombatToInstance(uint32 instanceId)
void Group::ResetInstances(uint8 method, bool isRaid, Player* SendMsgTo)
{
- if (isBGGroup())
+ if (isBGGroup() || isBFGroup())
return;
// method can be INSTANCE_RESET_ALL, INSTANCE_RESET_CHANGE_DIFFICULTY, INSTANCE_RESET_GROUP_DISBAND
@@ -2019,7 +2023,7 @@ InstanceGroupBind* Group::GetBoundInstance(MapEntry const* mapEntry)
InstanceGroupBind* Group::BindToInstance(InstanceSave* save, bool permanent, bool load)
{
- if (!save || isBGGroup())
+ if (!save || isBGGroup() || isBFGroup())
return NULL;
InstanceGroupBind& bind = m_boundInstances[save->GetDifficulty()][save->GetMapId()];
@@ -2149,6 +2153,11 @@ bool Group::isBGGroup() const
return m_bgGroup != NULL;
}
+bool Group::isBFGroup() const
+{
+ return m_bfGroup != NULL;
+}
+
bool Group::IsCreated() const
{
return GetMembersCount() > 0;
@@ -2250,6 +2259,11 @@ void Group::SetBattlegroundGroup(Battleground* bg)
m_bgGroup = bg;
}
+void Group::SetBattlefieldGroup(Battlefield *bg)
+{
+ m_bfGroup = bg;
+}
+
void Group::SetGroupMemberFlag(uint64 guid, bool apply, GroupMemberFlags flag)
{
// Assistants, main assistants and main tanks are only available in raid groups
diff --git a/src/server/game/Groups/Group.h b/src/server/game/Groups/Group.h
index e5f174c4230..a00b7e1ef3a 100755
--- a/src/server/game/Groups/Group.h
+++ b/src/server/game/Groups/Group.h
@@ -26,6 +26,8 @@
#include "QueryResult.h"
#include "SharedDefines.h"
#include "Player.h"
+#include "Battlefield.h"
+#include "BattlefieldMgr.h"
class Creature;
class GroupReference;
@@ -64,20 +66,20 @@ enum GroupMemberOnlineStatus
MEMBER_STATUS_PVP_FFA = 0x0010, // Lua_UnitIsPVPFreeForAll
MEMBER_STATUS_UNK3 = 0x0020, // used in calls from Lua_GetPlayerMapPosition/Lua_GetBattlefieldFlagPosition
MEMBER_STATUS_AFK = 0x0040, // Lua_UnitIsAFK
- MEMBER_STATUS_DND = 0x0080, // Lua_UnitIsDND
+ MEMBER_STATUS_DND = 0x0080 // Lua_UnitIsDND
};
enum GroupMemberFlags
{
MEMBER_FLAG_ASSISTANT = 0x01,
MEMBER_FLAG_MAINTANK = 0x02,
- MEMBER_FLAG_MAINASSIST = 0x04,
+ MEMBER_FLAG_MAINASSIST = 0x04
};
enum GroupMemberAssignment
{
GROUP_ASSIGN_MAINTANK = 0,
- GROUP_ASSIGN_MAINASSIST = 1,
+ GROUP_ASSIGN_MAINASSIST = 1
};
enum GroupType
@@ -87,7 +89,7 @@ enum GroupType
GROUPTYPE_RAID = 0x02,
GROUPTYPE_BGRAID = GROUPTYPE_BG | GROUPTYPE_RAID, // mask
GROUPTYPE_UNK1 = 0x04,
- GROUPTYPE_LFG = 0x08,
+ GROUPTYPE_LFG = 0x08
// 0x10, leave/change group?, I saw this flag when leaving group and after leaving BG while in group
};
@@ -115,7 +117,7 @@ enum GroupUpdateFlags
GROUP_UPDATE_FLAG_PET_AURAS = 0x00040000, // uint64 mask, for each bit set uint32 spellid + uint8 unk, pet auras...
GROUP_UPDATE_FLAG_VEHICLE_SEAT = 0x00080000, // uint32 vehicle_seat_id (index from VehicleSeat.dbc)
GROUP_UPDATE_PET = 0x0007FC00, // all pet flags
- GROUP_UPDATE_FULL = 0x0007FFFF, // all known flags
+ GROUP_UPDATE_FULL = 0x0007FFFF // all known flags
};
#define GROUP_UPDATE_FLAGS_COUNT 20
@@ -205,6 +207,7 @@ class Group
bool isLFGGroup() const;
bool isRaidGroup() const;
bool isBGGroup() const;
+ bool isBFGroup() const;
bool IsCreated() const;
uint64 GetLeaderGUID() const;
uint64 GetGUID() const;
@@ -241,6 +244,7 @@ class Group
void ConvertToRaid();
void SetBattlegroundGroup(Battleground* bg);
+ void SetBattlefieldGroup(Battlefield* bf);
GroupJoinBattlegroundResult CanJoinBattlegroundQueue(Battleground const* bgOrTemplate, BattlegroundQueueTypeId bgQueueTypeId, uint32 MinPlayerCount, uint32 MaxPlayerCount, bool isRated, uint32 arenaSlot);
void ChangeMembersGroup(uint64 guid, uint8 group);
@@ -324,6 +328,7 @@ class Group
Difficulty m_dungeonDifficulty;
Difficulty m_raidDifficulty;
Battleground* m_bgGroup;
+ Battlefield* m_bfGroup;
uint64 m_targetIcons[TARGETICONCOUNT];
LootMethod m_lootMethod;
ItemQualities m_lootThreshold;
diff --git a/src/server/game/Groups/GroupMgr.cpp b/src/server/game/Groups/GroupMgr.cpp
index 3a758f6df30..77b3a304f6b 100644
--- a/src/server/game/Groups/GroupMgr.cpp
+++ b/src/server/game/Groups/GroupMgr.cpp
@@ -125,8 +125,7 @@ void GroupMgr::LoadGroups()
", g.icon7, g.icon8, g.groupType, g.difficulty, g.raiddifficulty, g.guid, lfg.dungeon, lfg.state FROM groups g LEFT JOIN lfg_data lfg ON lfg.guid = g.guid ORDER BY g.guid ASC");
if (!result)
{
- sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded 0 group definitions. DB table `groups` is empty!");
-
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 group definitions. DB table `groups` is empty!");
return;
}
@@ -151,11 +150,10 @@ void GroupMgr::LoadGroups()
}
while (result->NextRow());
- sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded %u group definitions in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
-
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u group definitions in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
}
- sLog->outInfo(LOG_FILTER_GENERAL, "Loading Group members...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Group members...");
{
uint32 oldMSTime = getMSTime();
@@ -169,8 +167,7 @@ void GroupMgr::LoadGroups()
QueryResult result = CharacterDatabase.Query("SELECT guid, memberGuid, memberFlags, subgroup, roles FROM group_member ORDER BY guid");
if (!result)
{
- sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded 0 group members. DB table `group_member` is empty!");
-
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 group members. DB table `group_member` is empty!");
return;
}
@@ -190,11 +187,10 @@ void GroupMgr::LoadGroups()
}
while (result->NextRow());
- sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded %u group members in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
-
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u group members in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
}
- sLog->outInfo(LOG_FILTER_GENERAL, "Loading Group instance saves...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Group instance saves...");
{
uint32 oldMSTime = getMSTime();
// 0 1 2 3 4 5 6
@@ -203,8 +199,7 @@ void GroupMgr::LoadGroups()
"LEFT JOIN character_instance ci LEFT JOIN groups g ON g.leaderGuid = ci.guid ON ci.instance = gi.instance AND ci.permanent = 1 GROUP BY gi.instance ORDER BY gi.guid");
if (!result)
{
- sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded 0 group-instance saves. DB table `group_instance` is empty!");
-
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 group-instance saves. DB table `group_instance` is empty!");
return;
}
@@ -235,7 +230,6 @@ void GroupMgr::LoadGroups()
}
while (result->NextRow());
- sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded %u group-instance saves in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
-
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u group-instance saves in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
}
}
diff --git a/src/server/game/Guilds/Guild.cpp b/src/server/game/Guilds/Guild.cpp
index 4df77f874f3..332c0924b61 100755
--- a/src/server/game/Guilds/Guild.cpp
+++ b/src/server/game/Guilds/Guild.cpp
@@ -1717,7 +1717,7 @@ void Guild::SendInfo(WorldSession* session) const
{
WorldPacket data(SMSG_GUILD_INFO, m_name.size() + 4 + 4 + 4);
data << m_name;
- data << secsToTimeBitFields(m_createdDate); // 3.x (prev. year + month + day)
+ data.AppendPackedTime(m_createdDate); // 3.x (prev. year + month + day)
data << uint32(m_members.size()); // Number of members
data << m_accountsNumber; // Number of accounts
diff --git a/src/server/game/Guilds/Guild.h b/src/server/game/Guilds/Guild.h
index e18e62e51b7..dd1fb7cc6b6 100755
--- a/src/server/game/Guilds/Guild.h
+++ b/src/server/game/Guilds/Guild.h
@@ -37,7 +37,7 @@ enum GuildMisc
GUILD_RANK_NONE = 0xFF,
GUILD_WITHDRAW_MONEY_UNLIMITED = 0xFFFFFFFF,
GUILD_WITHDRAW_SLOT_UNLIMITED = 0xFFFFFFFF,
- GUILD_EVENT_LOG_GUID_UNDEFINED = 0xFFFFFFFF,
+ GUILD_EVENT_LOG_GUID_UNDEFINED = 0xFFFFFFFF
};
enum GuildDefaultRanks
@@ -47,7 +47,7 @@ enum GuildDefaultRanks
GR_OFFICER = 1,
GR_VETERAN = 2,
GR_MEMBER = 3,
- GR_INITIATE = 4,
+ GR_INITIATE = 4
// When promoting member server does: rank--
// When demoting member server does: rank++
};
@@ -141,7 +141,7 @@ enum PetitionTurns
{
PETITION_TURN_OK = 0,
PETITION_TURN_ALREADY_IN_GUILD = 2,
- PETITION_TURN_NEED_MORE_SIGNATURES = 4,
+ PETITION_TURN_NEED_MORE_SIGNATURES = 4
};
enum PetitionSigns
@@ -150,7 +150,7 @@ enum PetitionSigns
PETITION_SIGN_ALREADY_SIGNED = 1,
PETITION_SIGN_ALREADY_IN_GUILD = 2,
PETITION_SIGN_CANT_SIGN_OWN = 3,
- PETITION_SIGN_NOT_SERVER = 4,
+ PETITION_SIGN_NOT_SERVER = 4
};
enum GuildBankRights
@@ -160,7 +160,7 @@ enum GuildBankRights
GUILD_BANK_RIGHT_UPDATE_TEXT = 0x04,
GUILD_BANK_RIGHT_DEPOSIT_ITEM = GUILD_BANK_RIGHT_VIEW_TAB | GUILD_BANK_RIGHT_PUT_ITEM,
- GUILD_BANK_RIGHT_FULL = 0xFF,
+ GUILD_BANK_RIGHT_FULL = 0xFF
};
enum GuildBankEventLogTypes
@@ -173,7 +173,7 @@ enum GuildBankEventLogTypes
GUILD_BANK_LOG_REPAIR_MONEY = 6,
GUILD_BANK_LOG_MOVE_ITEM2 = 7,
GUILD_BANK_LOG_UNK1 = 8,
- GUILD_BANK_LOG_UNK2 = 9,
+ GUILD_BANK_LOG_UNK2 = 9
};
enum GuildEventLogTypes
@@ -183,7 +183,7 @@ enum GuildEventLogTypes
GUILD_EVENT_LOG_PROMOTE_PLAYER = 3,
GUILD_EVENT_LOG_DEMOTE_PLAYER = 4,
GUILD_EVENT_LOG_UNINVITE_PLAYER = 5,
- GUILD_EVENT_LOG_LEAVE_GUILD = 6,
+ GUILD_EVENT_LOG_LEAVE_GUILD = 6
};
enum GuildEmblemError
diff --git a/src/server/game/Guilds/GuildMgr.cpp b/src/server/game/Guilds/GuildMgr.cpp
index dab67c59d2a..cebcf6040f9 100644
--- a/src/server/game/Guilds/GuildMgr.cpp
+++ b/src/server/game/Guilds/GuildMgr.cpp
@@ -93,7 +93,7 @@ Guild* GuildMgr::GetGuildByLeader(uint64 guid) const
void GuildMgr::LoadGuilds()
{
// 1. Load all guilds
- sLog->outInfo(LOG_FILTER_GUILD, "Loading guilds definitions...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading guilds definitions...");
{
uint32 oldMSTime = getMSTime();
@@ -105,8 +105,7 @@ void GuildMgr::LoadGuilds()
if (!result)
{
- sLog->outInfo(LOG_FILTER_GUILD, ">> Loaded 0 guild definitions. DB table `guild` is empty.");
-
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 guild definitions. DB table `guild` is empty.");
return;
}
else
@@ -128,13 +127,12 @@ void GuildMgr::LoadGuilds()
}
while (result->NextRow());
- sLog->outInfo(LOG_FILTER_GUILD, ">> Loaded %u guild definitions in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
-
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u guild definitions in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
}
}
// 2. Load all guild ranks
- sLog->outInfo(LOG_FILTER_GUILD, "Loading guild ranks...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading guild ranks...");
{
uint32 oldMSTime = getMSTime();
@@ -146,8 +144,7 @@ void GuildMgr::LoadGuilds()
if (!result)
{
- sLog->outInfo(LOG_FILTER_GUILD, ">> Loaded 0 guild ranks. DB table `guild_rank` is empty.");
-
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 guild ranks. DB table `guild_rank` is empty.");
}
else
{
@@ -164,13 +161,12 @@ void GuildMgr::LoadGuilds()
}
while (result->NextRow());
- sLog->outInfo(LOG_FILTER_GUILD, ">> Loaded %u guild ranks in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
-
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u guild ranks in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
}
}
// 3. Load all guild members
- sLog->outInfo(LOG_FILTER_GUILD, "Loading guild members...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading guild members...");
{
uint32 oldMSTime = getMSTime();
@@ -189,8 +185,7 @@ void GuildMgr::LoadGuilds()
if (!result)
{
- sLog->outInfo(LOG_FILTER_GUILD, ">> Loaded 0 guild members. DB table `guild_member` is empty.");
-
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 guild members. DB table `guild_member` is empty.");
}
else
{
@@ -208,13 +203,12 @@ void GuildMgr::LoadGuilds()
}
while (result->NextRow());
- sLog->outInfo(LOG_FILTER_GUILD, ">> Loaded %u guild members int %u ms", count, GetMSTimeDiffToNow(oldMSTime));
-
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u guild members int %u ms", count, GetMSTimeDiffToNow(oldMSTime));
}
}
// 4. Load all guild bank tab rights
- sLog->outInfo(LOG_FILTER_GUILD, "Loading bank tab rights...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading bank tab rights...");
{
uint32 oldMSTime = getMSTime();
@@ -226,8 +220,7 @@ void GuildMgr::LoadGuilds()
if (!result)
{
- sLog->outInfo(LOG_FILTER_GUILD, ">> Loaded 0 guild bank tab rights. DB table `guild_bank_right` is empty.");
-
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 guild bank tab rights. DB table `guild_bank_right` is empty.");
}
else
{
@@ -244,13 +237,12 @@ void GuildMgr::LoadGuilds()
}
while (result->NextRow());
- sLog->outInfo(LOG_FILTER_GUILD, ">> Loaded %u bank tab rights in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
-
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u bank tab rights in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
}
}
// 5. Load all event logs
- sLog->outInfo(LOG_FILTER_GUILD, "Loading guild event logs...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading guild event logs...");
{
uint32 oldMSTime = getMSTime();
@@ -261,8 +253,7 @@ void GuildMgr::LoadGuilds()
if (!result)
{
- sLog->outInfo(LOG_FILTER_GUILD, ">> Loaded 0 guild event logs. DB table `guild_eventlog` is empty.");
-
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 guild event logs. DB table `guild_eventlog` is empty.");
}
else
{
@@ -279,13 +270,12 @@ void GuildMgr::LoadGuilds()
}
while (result->NextRow());
- sLog->outInfo(LOG_FILTER_GUILD, ">> Loaded %u guild event logs in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
-
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u guild event logs in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
}
}
// 6. Load all bank event logs
- sLog->outInfo(LOG_FILTER_GUILD, "Loading guild bank event logs...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading guild bank event logs...");
{
uint32 oldMSTime = getMSTime();
@@ -297,8 +287,7 @@ void GuildMgr::LoadGuilds()
if (!result)
{
- sLog->outInfo(LOG_FILTER_GUILD, ">> Loaded 0 guild bank event logs. DB table `guild_bank_eventlog` is empty.");
-
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 guild bank event logs. DB table `guild_bank_eventlog` is empty.");
}
else
{
@@ -315,13 +304,12 @@ void GuildMgr::LoadGuilds()
}
while (result->NextRow());
- sLog->outInfo(LOG_FILTER_GUILD, ">> Loaded %u guild bank event logs in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
-
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u guild bank event logs in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
}
}
// 7. Load all guild bank tabs
- sLog->outInfo(LOG_FILTER_GUILD, "Loading guild bank tabs...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading guild bank tabs...");
{
uint32 oldMSTime = getMSTime();
@@ -333,8 +321,7 @@ void GuildMgr::LoadGuilds()
if (!result)
{
- sLog->outInfo(LOG_FILTER_GUILD, ">> Loaded 0 guild bank tabs. DB table `guild_bank_tab` is empty.");
-
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 guild bank tabs. DB table `guild_bank_tab` is empty.");
}
else
{
@@ -351,8 +338,7 @@ void GuildMgr::LoadGuilds()
}
while (result->NextRow());
- sLog->outInfo(LOG_FILTER_GUILD, ">> Loaded %u guild bank tabs in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
-
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u guild bank tabs in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
}
}
@@ -371,8 +357,7 @@ void GuildMgr::LoadGuilds()
if (!result)
{
- sLog->outInfo(LOG_FILTER_GUILD, ">> Loaded 0 guild bank tab items. DB table `guild_bank_item` or `item_instance` is empty.");
-
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 guild bank tab items. DB table `guild_bank_item` or `item_instance` is empty.");
}
else
{
@@ -389,8 +374,7 @@ void GuildMgr::LoadGuilds()
}
while (result->NextRow());
- sLog->outInfo(LOG_FILTER_GUILD, ">> Loaded %u guild bank tab items in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
-
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u guild bank tab items in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
}
}
@@ -412,7 +396,6 @@ void GuildMgr::LoadGuilds()
}
}
- sLog->outInfo(LOG_FILTER_GUILD, ">> Validated data of loaded guilds in %u ms", GetMSTimeDiffToNow(oldMSTime));
-
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Validated data of loaded guilds in %u ms", GetMSTimeDiffToNow(oldMSTime));
}
}
diff --git a/src/server/game/Handlers/AddonHandler.cpp b/src/server/game/Handlers/AddonHandler.cpp
index f86dacbc55e..c3ffeace3fb 100755
--- a/src/server/game/Handlers/AddonHandler.cpp
+++ b/src/server/game/Handlers/AddonHandler.cpp
@@ -37,26 +37,6 @@ bool AddonHandler::BuildAddonPacket(WorldPacket* Source, WorldPacket* Target)
uint32 CurrentPosition;
uint32 TempValue;
- unsigned char tdata[256] =
- {
- 0xC3, 0x5B, 0x50, 0x84, 0xB9, 0x3E, 0x32, 0x42, 0x8C, 0xD0, 0xC7, 0x48, 0xFA, 0x0E, 0x5D, 0x54,
- 0x5A, 0xA3, 0x0E, 0x14, 0xBA, 0x9E, 0x0D, 0xB9, 0x5D, 0x8B, 0xEE, 0xB6, 0x84, 0x93, 0x45, 0x75,
- 0xFF, 0x31, 0xFE, 0x2F, 0x64, 0x3F, 0x3D, 0x6D, 0x07, 0xD9, 0x44, 0x9B, 0x40, 0x85, 0x59, 0x34,
- 0x4E, 0x10, 0xE1, 0xE7, 0x43, 0x69, 0xEF, 0x7C, 0x16, 0xFC, 0xB4, 0xED, 0x1B, 0x95, 0x28, 0xA8,
- 0x23, 0x76, 0x51, 0x31, 0x57, 0x30, 0x2B, 0x79, 0x08, 0x50, 0x10, 0x1C, 0x4A, 0x1A, 0x2C, 0xC8,
- 0x8B, 0x8F, 0x05, 0x2D, 0x22, 0x3D, 0xDB, 0x5A, 0x24, 0x7A, 0x0F, 0x13, 0x50, 0x37, 0x8F, 0x5A,
- 0xCC, 0x9E, 0x04, 0x44, 0x0E, 0x87, 0x01, 0xD4, 0xA3, 0x15, 0x94, 0x16, 0x34, 0xC6, 0xC2, 0xC3,
- 0xFB, 0x49, 0xFE, 0xE1, 0xF9, 0xDA, 0x8C, 0x50, 0x3C, 0xBE, 0x2C, 0xBB, 0x57, 0xED, 0x46, 0xB9,
- 0xAD, 0x8B, 0xC6, 0xDF, 0x0E, 0xD6, 0x0F, 0xBE, 0x80, 0xB3, 0x8B, 0x1E, 0x77, 0xCF, 0xAD, 0x22,
- 0xCF, 0xB7, 0x4B, 0xCF, 0xFB, 0xF0, 0x6B, 0x11, 0x45, 0x2D, 0x7A, 0x81, 0x18, 0xF2, 0x92, 0x7E,
- 0x98, 0x56, 0x5D, 0x5E, 0x69, 0x72, 0x0A, 0x0D, 0x03, 0x0A, 0x85, 0xA2, 0x85, 0x9C, 0xCB, 0xFB,
- 0x56, 0x6E, 0x8F, 0x44, 0xBB, 0x8F, 0x02, 0x22, 0x68, 0x63, 0x97, 0xBC, 0x85, 0xBA, 0xA8, 0xF7,
- 0xB5, 0x40, 0x68, 0x3C, 0x77, 0x86, 0x6F, 0x4B, 0xD7, 0x88, 0xCA, 0x8A, 0xD7, 0xCE, 0x36, 0xF0,
- 0x45, 0x6E, 0xD5, 0x64, 0x79, 0x0F, 0x17, 0xFC, 0x64, 0xDD, 0x10, 0x6F, 0xF3, 0xF5, 0xE0, 0xA6,
- 0xC3, 0xFB, 0x1B, 0x8C, 0x29, 0xEF, 0x8E, 0xE5, 0x34, 0xCB, 0xD1, 0x2A, 0xCE, 0x79, 0xC3, 0x9A,
- 0x0D, 0x36, 0xEA, 0x01, 0xE0, 0xAA, 0x91, 0x20, 0x54, 0xF0, 0x72, 0xD8, 0x1E, 0xC7, 0x89, 0xD2
- };
-
// broken addon packet, can't be received from real client
if (Source->rpos() + 4 > Source->size())
return false;
@@ -110,7 +90,28 @@ bool AddonHandler::BuildAddonPacket(WorldPacket* Source, WorldPacket* Target)
uint8 unk = (crc != 0x4c1c776d); // If addon is Standard addon CRC
*Target << uint8(unk);
if (unk)
+ {
+ unsigned char tdata[256] =
+ {
+ 0xC3, 0x5B, 0x50, 0x84, 0xB9, 0x3E, 0x32, 0x42, 0x8C, 0xD0, 0xC7, 0x48, 0xFA, 0x0E, 0x5D, 0x54,
+ 0x5A, 0xA3, 0x0E, 0x14, 0xBA, 0x9E, 0x0D, 0xB9, 0x5D, 0x8B, 0xEE, 0xB6, 0x84, 0x93, 0x45, 0x75,
+ 0xFF, 0x31, 0xFE, 0x2F, 0x64, 0x3F, 0x3D, 0x6D, 0x07, 0xD9, 0x44, 0x9B, 0x40, 0x85, 0x59, 0x34,
+ 0x4E, 0x10, 0xE1, 0xE7, 0x43, 0x69, 0xEF, 0x7C, 0x16, 0xFC, 0xB4, 0xED, 0x1B, 0x95, 0x28, 0xA8,
+ 0x23, 0x76, 0x51, 0x31, 0x57, 0x30, 0x2B, 0x79, 0x08, 0x50, 0x10, 0x1C, 0x4A, 0x1A, 0x2C, 0xC8,
+ 0x8B, 0x8F, 0x05, 0x2D, 0x22, 0x3D, 0xDB, 0x5A, 0x24, 0x7A, 0x0F, 0x13, 0x50, 0x37, 0x8F, 0x5A,
+ 0xCC, 0x9E, 0x04, 0x44, 0x0E, 0x87, 0x01, 0xD4, 0xA3, 0x15, 0x94, 0x16, 0x34, 0xC6, 0xC2, 0xC3,
+ 0xFB, 0x49, 0xFE, 0xE1, 0xF9, 0xDA, 0x8C, 0x50, 0x3C, 0xBE, 0x2C, 0xBB, 0x57, 0xED, 0x46, 0xB9,
+ 0xAD, 0x8B, 0xC6, 0xDF, 0x0E, 0xD6, 0x0F, 0xBE, 0x80, 0xB3, 0x8B, 0x1E, 0x77, 0xCF, 0xAD, 0x22,
+ 0xCF, 0xB7, 0x4B, 0xCF, 0xFB, 0xF0, 0x6B, 0x11, 0x45, 0x2D, 0x7A, 0x81, 0x18, 0xF2, 0x92, 0x7E,
+ 0x98, 0x56, 0x5D, 0x5E, 0x69, 0x72, 0x0A, 0x0D, 0x03, 0x0A, 0x85, 0xA2, 0x85, 0x9C, 0xCB, 0xFB,
+ 0x56, 0x6E, 0x8F, 0x44, 0xBB, 0x8F, 0x02, 0x22, 0x68, 0x63, 0x97, 0xBC, 0x85, 0xBA, 0xA8, 0xF7,
+ 0xB5, 0x40, 0x68, 0x3C, 0x77, 0x86, 0x6F, 0x4B, 0xD7, 0x88, 0xCA, 0x8A, 0xD7, 0xCE, 0x36, 0xF0,
+ 0x45, 0x6E, 0xD5, 0x64, 0x79, 0x0F, 0x17, 0xFC, 0x64, 0xDD, 0x10, 0x6F, 0xF3, 0xF5, 0xE0, 0xA6,
+ 0xC3, 0xFB, 0x1B, 0x8C, 0x29, 0xEF, 0x8E, 0xE5, 0x34, 0xCB, 0xD1, 0x2A, 0xCE, 0x79, 0xC3, 0x9A,
+ 0x0D, 0x36, 0xEA, 0x01, 0xE0, 0xAA, 0x91, 0x20, 0x54, 0xF0, 0x72, 0xD8, 0x1E, 0xC7, 0x89, 0xD2
+ };
Target->append(tdata, sizeof(tdata));
+ }
*Target << uint32(0);
}
diff --git a/src/server/game/Handlers/AuctionHouseHandler.cpp b/src/server/game/Handlers/AuctionHouseHandler.cpp
index 10a130536c9..2ebcbce0661 100755
--- a/src/server/game/Handlers/AuctionHouseHandler.cpp
+++ b/src/server/game/Handlers/AuctionHouseHandler.cpp
@@ -247,7 +247,7 @@ void WorldSession::HandleAuctionSellItem(WorldPacket & recv_data)
if (GetSecurity() > SEC_PLAYER && sWorld->getBoolConfig(CONFIG_GM_LOG_TRADE))
{
sLog->outCommand(GetAccountId(), "GM %s (Account: %u) create auction: %s (Entry: %u Count: %u)",
- GetPlayerName(), GetAccountId(), item->GetTemplate()->Name1.c_str(), item->GetEntry(), item->GetCount());
+ GetPlayerName().c_str(), GetAccountId(), item->GetTemplate()->Name1.c_str(), item->GetEntry(), item->GetCount());
}
AH->item_guidlow = item->GetGUIDLow();
@@ -293,7 +293,7 @@ void WorldSession::HandleAuctionSellItem(WorldPacket & recv_data)
if (GetSecurity() > SEC_PLAYER && sWorld->getBoolConfig(CONFIG_GM_LOG_TRADE))
{
sLog->outCommand(GetAccountId(), "GM %s (Account: %u) create auction: %s (Entry: %u Count: %u)",
- GetPlayerName(), GetAccountId(), newItem->GetTemplate()->Name1.c_str(), newItem->GetEntry(), newItem->GetCount());
+ GetPlayerName().c_str(), GetAccountId(), newItem->GetTemplate()->Name1.c_str(), newItem->GetEntry(), newItem->GetCount());
}
AH->item_guidlow = newItem->GetGUIDLow();
diff --git a/src/server/game/Handlers/BattleGroundHandler.cpp b/src/server/game/Handlers/BattleGroundHandler.cpp
index 2e0bbf786a9..3bae430ad2c 100755
--- a/src/server/game/Handlers/BattleGroundHandler.cpp
+++ b/src/server/game/Handlers/BattleGroundHandler.cpp
@@ -244,7 +244,7 @@ void WorldSession::HandleBattlemasterJoinOpcode(WorldPacket & recv_data)
sBattlegroundMgr->ScheduleQueueUpdate(0, 0, bgQueueTypeId, bgTypeId, bracketEntry->GetBracketId());
}
-void WorldSession::HandleBattlegroundPlayerPositionsOpcode(WorldPacket & /*recv_data*/)
+void WorldSession::HandleBattlegroundPlayerPositionsOpcode(WorldPacket& /*recv_data*/)
{
sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Recvd MSG_BATTLEGROUND_PLAYER_POSITIONS Message");
@@ -252,39 +252,44 @@ void WorldSession::HandleBattlegroundPlayerPositionsOpcode(WorldPacket & /*recv_
if (!bg) // can't be received if player not in battleground
return;
- uint32 count = 0;
- Player* aplr = NULL;
- Player* hplr = NULL;
+ uint32 flagCarrierCount = 0;
+ Player* allianceFlagCarrier = NULL;
+ Player* hordeFlagCarrier = NULL;
if (uint64 guid = bg->GetFlagPickerGUID(BG_TEAM_ALLIANCE))
{
- aplr = ObjectAccessor::FindPlayer(guid);
- if (aplr)
- ++count;
+ allianceFlagCarrier = ObjectAccessor::FindPlayer(guid);
+ if (allianceFlagCarrier)
+ ++flagCarrierCount;
}
if (uint64 guid = bg->GetFlagPickerGUID(BG_TEAM_HORDE))
{
- hplr = ObjectAccessor::FindPlayer(guid);
- if (hplr)
- ++count;
+ hordeFlagCarrier = ObjectAccessor::FindPlayer(guid);
+ if (hordeFlagCarrier)
+ ++flagCarrierCount;
}
- WorldPacket data(MSG_BATTLEGROUND_PLAYER_POSITIONS, 4 + 4 + 16 * count);
- data << 0;
- data << count;
- if (aplr)
+ WorldPacket data(MSG_BATTLEGROUND_PLAYER_POSITIONS, 4 + 4 + 16 * flagCarrierCount);
+ // Used to send several player positions (found used in AV)
+ data << 0; // CGBattlefieldInfo__m_numPlayerPositions
+ /*
+ for (CGBattlefieldInfo__m_numPlayerPositions)
+ data << guid << posx << posy;
+ */
+ data << flagCarrierCount;
+ if (allianceFlagCarrier)
{
- data << uint64(aplr->GetGUID());
- data << float(aplr->GetPositionX());
- data << float(aplr->GetPositionY());
+ data << uint64(allianceFlagCarrier->GetGUID());
+ data << float(allianceFlagCarrier->GetPositionX());
+ data << float(allianceFlagCarrier->GetPositionY());
}
- if (hplr)
+ if (hordeFlagCarrier)
{
- data << uint64(hplr->GetGUID());
- data << float(hplr->GetPositionX());
- data << float(hplr->GetPositionY());
+ data << uint64(hordeFlagCarrier->GetGUID());
+ data << float(hordeFlagCarrier->GetPositionX());
+ data << float(hordeFlagCarrier->GetPositionY());
}
SendPacket(&data);
@@ -457,6 +462,9 @@ void WorldSession::HandleBattleFieldPortOpcode(WorldPacket &recv_data)
sLog->outDebug(LOG_FILTER_BATTLEGROUND, "Battleground: player %s (%u) joined battle for bg %u, bgtype %u, queue type %u.", _player->GetName(), _player->GetGUIDLow(), bg->GetInstanceID(), bg->GetTypeID(), bgQueueTypeId);
break;
case 0: // leave queue
+ if (bg->isArena() && bg->GetStatus() > STATUS_WAIT_QUEUE)
+ return;
+
// if player leaves rated arena match before match start, it is counted as he played but he lost
if (ginfo.IsRated && ginfo.IsInvitedToBGInstanceGUID)
{
@@ -565,46 +573,6 @@ void WorldSession::HandleBattlefieldStatusOpcode(WorldPacket & /*recv_data*/)
}
}
-void WorldSession::HandleAreaSpiritHealerQueryOpcode(WorldPacket & recv_data)
-{
- sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: CMSG_AREA_SPIRIT_HEALER_QUERY");
-
- Battleground* bg = _player->GetBattleground();
-
- uint64 guid;
- recv_data >> guid;
-
- Creature* unit = GetPlayer()->GetMap()->GetCreature(guid);
- if (!unit)
- return;
-
- if (!unit->isSpiritService()) // it's not spirit service
- return;
-
- if (bg)
- sBattlegroundMgr->SendAreaSpiritHealerQueryOpcode(_player, bg, guid);
-}
-
-void WorldSession::HandleAreaSpiritHealerQueueOpcode(WorldPacket & recv_data)
-{
- sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: CMSG_AREA_SPIRIT_HEALER_QUEUE");
-
- Battleground* bg = _player->GetBattleground();
-
- uint64 guid;
- recv_data >> guid;
-
- Creature* unit = GetPlayer()->GetMap()->GetCreature(guid);
- if (!unit)
- return;
-
- if (!unit->isSpiritService()) // it's not spirit service
- return;
-
- if (bg)
- bg->AddPlayerToResurrectQueue(guid, _player->GetGUID());
-}
-
void WorldSession::HandleBattlemasterJoinArena(WorldPacket & recv_data)
{
sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: CMSG_BATTLEMASTER_JOIN_ARENA");
diff --git a/src/server/game/Handlers/CalendarHandler.cpp b/src/server/game/Handlers/CalendarHandler.cpp
index e83f0f55a44..d1209eead22 100755
--- a/src/server/game/Handlers/CalendarHandler.cpp
+++ b/src/server/game/Handlers/CalendarHandler.cpp
@@ -90,9 +90,9 @@ void WorldSession::HandleCalendarGetCalendar(WorldPacket& /*recvData*/)
if (CalendarEvent* calendarEvent = sCalendarMgr->GetEvent(*it))
{
data << uint64(*it);
- data << calendarEvent->GetTitle().c_str();
+ data << calendarEvent->GetTitle();
data << uint32(calendarEvent->GetType());
- data << uint32(calendarEvent->GetTime());
+ data.AppendPackedTime(calendarEvent->GetTime());
data << uint32(calendarEvent->GetFlags());
data << uint32(calendarEvent->GetDungeonId());
data.appendPackGUID(calendarEvent->GetCreatorGUID());
@@ -111,7 +111,7 @@ void WorldSession::HandleCalendarGetCalendar(WorldPacket& /*recvData*/)
}
data << uint32(cur_time); // server time
- data << uint32(secsToTimeBitFields(cur_time)); // server time
+ data.AppendPackedTime(cur_time); // server time
uint32 counter = 0;
size_t p_counter = data.wpos();
@@ -240,7 +240,10 @@ void WorldSession::HandleCalendarAddEvent(WorldPacket& recvData)
uint8 rank;
recvData >> title >> description >> type >> repeatable >> maxInvites;
- recvData >> dungeonId >> eventPackedTime >> unkPackedTime >> flags;
+ recvData >> dungeonId;
+ recvData.ReadPackedTime(eventPackedTime);
+ recvData.ReadPackedTime(unkPackedTime);
+ recvData >> flags;
if (!(flags & CALENDAR_FLAG_WITHOUT_INVITES))
{
@@ -317,7 +320,9 @@ void WorldSession::HandleCalendarUpdateEvent(WorldPacket& recvData)
recvData >> eventId >> inviteId >> title >> description >> type;
recvData >> repeatable >> maxInvites >> dungeonId;
- recvData >> eventPackedTime >> timeZoneTime >> flags;
+ recvData.ReadPackedTime(eventPackedTime);
+ recvData.ReadPackedTime(timeZoneTime);
+ recvData >> flags;
sLog->outDebug(LOG_FILTER_NETWORKIO, "CMSG_CALENDAR_UPDATE_EVENT [" UI64FMTD "] EventId [" UI64FMTD
"], InviteId [" UI64FMTD "] Title %s, Description %s, type %u "
@@ -372,7 +377,8 @@ void WorldSession::HandleCalendarCopyEvent(WorldPacket& recvData)
uint64 inviteId;
uint32 time;
- recvData >> eventId >> inviteId >> time;
+ recvData >> eventId >> inviteId;
+ recvData.ReadPackedTime(time);
sLog->outDebug(LOG_FILTER_NETWORKIO, "CMSG_CALENDAR_COPY_EVENT [" UI64FMTD "], EventId [" UI64FMTD
"] inviteId [" UI64FMTD "] Time: %u", guid, eventId, inviteId, time);
@@ -425,7 +431,7 @@ void WorldSession::HandleCalendarEventInvite(WorldPacket& recvData)
return;
}
- if (_player->GetTeam() != team)
+ if (_player->GetTeam() != team && !sWorld->getBoolConfig(CONFIG_ALLOW_TWO_SIDE_INTERACTION_CALENDAR))
{
SendCalendarCommandResult(CALENDAR_ERROR_NOT_ALLIED);
return;
@@ -607,15 +613,15 @@ void WorldSession::SendCalendarEvent(CalendarEvent const& calendarEvent, Calenda
data << uint8(sendEventType);
data.appendPackGUID(calendarEvent.GetCreatorGUID());
data << uint64(eventId);
- data << calendarEvent.GetTitle().c_str();
- data << calendarEvent.GetDescription().c_str();
+ data << calendarEvent.GetTitle();
+ data << calendarEvent.GetDescription();
data << uint8(calendarEvent.GetType());
data << uint8(calendarEvent.GetRepeatable());
data << uint32(calendarEvent.GetMaxInvites());
data << int32(calendarEvent.GetDungeonId());
data << uint32(calendarEvent.GetFlags());
- data << uint32(calendarEvent.GetTime());
- data << uint32(calendarEvent.GetTimeZoneTime());
+ data.AppendPackedTime(calendarEvent.GetTime());
+ data.AppendPackedTime(calendarEvent.GetTimeZoneTime());
data << uint32(calendarEvent.GetGuildId());
CalendarInviteIdList const& invites = calendarEvent.GetInviteIdList();
@@ -635,7 +641,7 @@ void WorldSession::SendCalendarEvent(CalendarEvent const& calendarEvent, Calenda
data << uint8(calendarEvent.GetGuildId() != 0);
data << uint64(invite->GetInviteId());
data << uint32(invite->GetStatusTime());
- data << invite->GetText().c_str();
+ data << invite->GetText();
}
else
{
@@ -692,7 +698,7 @@ void WorldSession::SendCalendarEventInviteAlert(CalendarEvent const& calendarEve
WorldPacket data(SMSG_CALENDAR_EVENT_INVITE_ALERT);
data << uint64(eventId);
data << calendarEvent.GetTitle().c_str();
- data << uint32(calendarEvent.GetTime());
+ data.AppendPackedTime(calendarEvent.GetTime());
data << uint32(calendarEvent.GetFlags());
data << uint32(calendarEvent.GetType());
data << uint32(calendarEvent.GetDungeonId());
@@ -717,9 +723,9 @@ void WorldSession::SendCalendarEventUpdateAlert(CalendarEvent const& calendarEve
calendarEvent.GetTitle().size() + calendarEvent.GetDescription().size() + 1 + 4 + 4);
data << uint8(sendEventType);
data << uint64(eventId);
- data << uint32(calendarEvent.GetTime());
+ data.AppendPackedTime(calendarEvent.GetTime());
data << uint32(calendarEvent.GetFlags());
- data << uint32(calendarEvent.GetTime());
+ data.AppendPackedTime(calendarEvent.GetTime());
data << uint8(calendarEvent.GetType());
data << uint32(calendarEvent.GetDungeonId());
data << calendarEvent.GetTitle().c_str();
@@ -734,7 +740,7 @@ void WorldSession::SendCalendarEventRemovedAlert(CalendarEvent const& calendarEv
{
uint64 guid = _player->GetGUID();
uint64 eventId = calendarEvent.GetEventId();
- uint32 eventTime = (calendarEvent.GetTime());
+ uint32 eventTime = calendarEvent.GetTime();
sLog->outDebug(LOG_FILTER_NETWORKIO, "SMSG_CALENDAR_EVENT_REMOVED_ALERT [" UI64FMTD "] EventId ["
UI64FMTD "] Time %u", guid, eventId, eventTime);
@@ -742,7 +748,7 @@ void WorldSession::SendCalendarEventRemovedAlert(CalendarEvent const& calendarEv
WorldPacket data(SMSG_CALENDAR_EVENT_REMOVED_ALERT, 1 + 8 + 1);
data << uint8(1); // FIXME: If true does not SignalEvent(EVENT_CALENDAR_ACTION_PENDING)
data << uint64(eventId);
- data << uint32(eventTime);
+ data.AppendPackedTime(eventTime);
SendPacket(&data);
}
@@ -752,11 +758,11 @@ void WorldSession::SendCalendarEventStatus(CalendarEvent const& calendarEvent, C
uint64 eventId = calendarEvent.GetEventId();
uint64 inviteId = invite.GetInviteId();
uint64 invitee = invite.GetInvitee();
- uint32 eventTime = (calendarEvent.GetTime());
+ uint32 eventTime = calendarEvent.GetTime();
uint32 flags = calendarEvent.GetFlags();
uint8 status = invite.GetStatus();
uint8 rank = invite.GetRank();
- uint32 statusTime = secsToTimeBitFields(invite.GetStatusTime());
+ uint32 statusTime = invite.GetStatusTime();
sLog->outDebug(LOG_FILTER_NETWORKIO, "SMSG_CALENDAR_EVENT_STATUS [" UI64FMTD "] EventId ["
@@ -768,11 +774,11 @@ void WorldSession::SendCalendarEventStatus(CalendarEvent const& calendarEvent, C
WorldPacket data(SMSG_CALENDAR_EVENT_STATUS, 8 + 8 + 4 + 4 + 1 + 1 + 4);
data.appendPackGUID(invitee);
data << uint64(eventId);
- data << uint32(eventTime);
+ data.AppendPackedTime(eventTime);
data << uint32(flags);
data << uint8(status);
data << uint8(rank);
- data << uint32(statusTime);
+ data.AppendPackedTime(statusTime);
SendPacket(&data);
}
@@ -801,7 +807,7 @@ void WorldSession::SendCalendarEventInviteRemoveAlert(CalendarEvent const& calen
{
uint64 guid = _player->GetGUID();
uint64 eventId = calendarEvent.GetEventId();
- uint32 eventTime = (calendarEvent.GetTime());
+ uint32 eventTime = calendarEvent.GetTime();
uint32 flags = calendarEvent.GetFlags();
sLog->outDebug(LOG_FILTER_NETWORKIO, "SMSG_CALENDAR_EVENT_INVITE_REMOVED_ALERT ["
@@ -810,7 +816,7 @@ void WorldSession::SendCalendarEventInviteRemoveAlert(CalendarEvent const& calen
WorldPacket data(SMSG_CALENDAR_EVENT_INVITE_REMOVED_ALERT, 8 + 4 + 4 + 1);
data << uint64(eventId);
- data << uint32(eventTime);
+ data.AppendPackedTime(eventTime);
data << uint32(flags);
data << uint8(status);
SendPacket(&data);
@@ -877,7 +883,7 @@ void WorldSession::SendCalendarRaidLockout(InstanceSave const* save, bool add)
if (add)
{
data.SetOpcode(SMSG_CALENDAR_RAID_LOCKOUT_ADDED);
- data << uint32(secsToTimeBitFields(currTime));
+ data.AppendPackedTime(currTime);
}
data << uint32(save->GetMapId());
@@ -899,7 +905,7 @@ void WorldSession::SendCalendarRaidLockoutUpdated(InstanceSave const* save)
time_t cur_time = time_t(time(NULL));
WorldPacket data(SMSG_CALENDAR_RAID_LOCKOUT_UPDATED, 4 + 4 + 4 + 4 + 8);
- data << secsToTimeBitFields(cur_time);
+ data.AppendPackedTime(cur_time);
data << uint32(save->GetMapId());
data << uint32(save->GetDifficulty());
data << uint32(0); // Amount of seconds that has changed to the reset time
diff --git a/src/server/game/Handlers/CharacterHandler.cpp b/src/server/game/Handlers/CharacterHandler.cpp
index df515f879f8..39704828d7f 100644
--- a/src/server/game/Handlers/CharacterHandler.cpp
+++ b/src/server/game/Handlers/CharacterHandler.cpp
@@ -658,8 +658,7 @@ void WorldSession::HandleCharCreateCallback(PreparedQueryResult result, Characte
SendPacket(&data);
std::string IP_str = GetRemoteAddress();
- sLog->outInfo(LOG_FILTER_NETWORKIO, "Account: %d (IP: %s) Create Character:[%s] (GUID: %u)", GetAccountId(), IP_str.c_str(), createInfo->Name.c_str(), newChar.GetGUIDLow());
- sLog->outDebug(LOG_FILTER_PLAYER, "Account: %d (IP: %s) Create Character:[%s] (GUID: %u)", GetAccountId(), IP_str.c_str(), createInfo->Name.c_str(), newChar.GetGUIDLow());
+ sLog->outInfo(LOG_FILTER_CHARACTER, "Account: %d (IP: %s) Create Character:[%s] (GUID: %u)", GetAccountId(), IP_str.c_str(), createInfo->Name.c_str(), newChar.GetGUIDLow());
sScriptMgr->OnPlayerCreate(&newChar);
sWorld->AddCharacterNameData(newChar.GetGUIDLow(), std::string(newChar.GetName()), newChar.getGender(), newChar.getRace(), newChar.getClass());
@@ -687,7 +686,7 @@ void WorldSession::HandleCharDeleteOpcode(WorldPacket & recv_data)
if (sGuildMgr->GetGuildByLeader(guid))
{
WorldPacket data(SMSG_CHAR_DELETE, 1);
- data << (uint8)CHAR_DELETE_FAILED_GUILD_LEADER;
+ data << uint8(CHAR_DELETE_FAILED_GUILD_LEADER);
SendPacket(&data);
return;
}
@@ -696,18 +695,15 @@ void WorldSession::HandleCharDeleteOpcode(WorldPacket & recv_data)
if (sArenaTeamMgr->GetArenaTeamByCaptain(guid))
{
WorldPacket data(SMSG_CHAR_DELETE, 1);
- data << (uint8)CHAR_DELETE_FAILED_ARENA_CAPTAIN;
+ data << uint8(CHAR_DELETE_FAILED_ARENA_CAPTAIN);
SendPacket(&data);
return;
}
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_ACCOUNT_NAME_BY_GUID);
-
stmt->setUInt32(0, GUID_LOPART(guid));
- PreparedQueryResult result = CharacterDatabase.Query(stmt);
-
- if (result)
+ if (PreparedQueryResult result = CharacterDatabase.Query(stmt))
{
Field* fields = result->Fetch();
accountId = fields[0].GetUInt32();
@@ -719,22 +715,21 @@ void WorldSession::HandleCharDeleteOpcode(WorldPacket & recv_data)
return;
std::string IP_str = GetRemoteAddress();
- sLog->outInfo(LOG_FILTER_NETWORKIO, "Account: %d (IP: %s) Delete Character:[%s] (GUID: %u)", GetAccountId(), IP_str.c_str(), name.c_str(), GUID_LOPART(guid));
- sLog->outDebug(LOG_FILTER_PLAYER, "Account: %d (IP: %s) Delete Character:[%s] (GUID: %u)", GetAccountId(), IP_str.c_str(), name.c_str(), GUID_LOPART(guid));
+ sLog->outInfo(LOG_FILTER_CHARACTER, "Account: %d (IP: %s) Delete Character:[%s] (GUID: %u)", GetAccountId(), IP_str.c_str(), name.c_str(), GUID_LOPART(guid));
sScriptMgr->OnPlayerDelete(guid);
sWorld->DeleteCharaceterNameData(GUID_LOPART(guid));
- if (sLog->ShouldLog(LOG_FILTER_PLAYER, LOG_LEVEL_TRACE)) // optimize GetPlayerDump call
+ if (sLog->ShouldLog(LOG_FILTER_PLAYER_DUMP, LOG_LEVEL_INFO)) // optimize GetPlayerDump call
{
std::string dump;
if (PlayerDumpWriter().GetDump(GUID_LOPART(guid), dump))
- sLog->outTrace(LOG_FILTER_PLAYER, dump.c_str(), GetAccountId(), GUID_LOPART(guid), name.c_str());
+ sLog->outCharDump(dump.c_str(), GetAccountId(), GUID_LOPART(guid), name.c_str());
}
Player::DeleteFromDB(guid, GetAccountId());
WorldPacket data(SMSG_CHAR_DELETE, 1);
- data << (uint8)CHAR_DELETE_SUCCESS;
+ data << uint8(CHAR_DELETE_SUCCESS);
SendPacket(&data);
}
@@ -1006,7 +1001,7 @@ void WorldSession::HandlePlayerLogin(LoginQueryHolder* holder)
SendNotification(LANG_GM_ON);
std::string IP_str = GetRemoteAddress();
- sLog->outDebug(LOG_FILTER_PLAYER, "Account: %d (IP: %s) Login Character:[%s] (GUID: %u) Level: %d",
+ sLog->outInfo(LOG_FILTER_CHARACTER, "Account: %d (IP: %s) Login Character:[%s] (GUID: %u) Level: %d",
GetAccountId(), IP_str.c_str(), pCurrChar->GetName(), pCurrChar->GetGUIDLow(), pCurrChar->getLevel());
if (!pCurrChar->IsStandState() && !pCurrChar->HasUnitState(UNIT_STATE_STUNNED))
@@ -1183,7 +1178,7 @@ void WorldSession::HandleChangePlayerNameOpcodeCallBack(PreparedQueryResult resu
CharacterDatabase.Execute(stmt);
- sLog->outDebug(LOG_FILTER_PLAYER, "Account: %d (IP: %s) Character:[%s] (guid:%u) Changed name to: %s", GetAccountId(), GetRemoteAddress().c_str(), oldName.c_str(), guidLow, newName.c_str());
+ sLog->outInfo(LOG_FILTER_CHARACTER, "Account: %d (IP: %s) Character:[%s] (guid:%u) Changed name to: %s", GetAccountId(), GetRemoteAddress().c_str(), oldName.c_str(), guidLow, newName.c_str());
WorldPacket data(SMSG_CHAR_RENAME, 1+8+(newName.size()+1));
data << uint8(RESPONSE_SUCCESS);
@@ -1313,12 +1308,29 @@ void WorldSession::HandleAlterAppearance(WorldPacket & recv_data)
if (bs_skinColor && (bs_skinColor->type != 3 || bs_skinColor->race != _player->getRace() || bs_skinColor->gender != _player->getGender()))
return;
- uint32 Cost = _player->GetBarberShopCost(bs_hair->hair_id, Color, bs_facialHair->hair_id, bs_skinColor);
+ GameObject* go = _player->FindNearestGameObjectOfType(GAMEOBJECT_TYPE_BARBER_CHAIR, 5.0f);
+ if (!go)
+ {
+ WorldPacket data(SMSG_BARBER_SHOP_RESULT, 4);
+ data << uint32(2);
+ SendPacket(&data);
+ return;
+ }
+
+ if (_player->getStandState() != UNIT_STAND_STATE_SIT_LOW_CHAIR + go->GetGOInfo()->barberChair.chairheight)
+ {
+ WorldPacket data(SMSG_BARBER_SHOP_RESULT, 4);
+ data << uint32(2);
+ SendPacket(&data);
+ return;
+ }
+
+ uint32 cost = _player->GetBarberShopCost(bs_hair->hair_id, Color, bs_facialHair->hair_id, bs_skinColor);
// 0 - ok
// 1, 3 - not enough money
// 2 - you have to seat on barber chair
- if (!_player->HasEnoughMoney(Cost))
+ if (!_player->HasEnoughMoney(cost))
{
WorldPacket data(SMSG_BARBER_SHOP_RESULT, 4);
data << uint32(1); // no money
@@ -1332,8 +1344,8 @@ void WorldSession::HandleAlterAppearance(WorldPacket & recv_data)
SendPacket(&data);
}
- _player->ModifyMoney(-int32(Cost)); // it isn't free
- _player->GetAchievementMgr().UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_GOLD_SPENT_AT_BARBER, Cost);
+ _player->ModifyMoney(-int32(cost)); // it isn't free
+ _player->GetAchievementMgr().UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_GOLD_SPENT_AT_BARBER, cost);
_player->SetByteValue(PLAYER_BYTES, 2, uint8(bs_hair->hair_id));
_player->SetByteValue(PLAYER_BYTES, 3, uint8(Color));
@@ -1450,7 +1462,7 @@ void WorldSession::HandleCharCustomize(WorldPacket& recv_data)
if (result)
{
std::string oldname = result->Fetch()[0].GetString();
- sLog->outDebug(LOG_FILTER_PLAYER, "Account: %d (IP: %s), Character[%s] (guid:%u) Customized to: %s", GetAccountId(), GetRemoteAddress().c_str(), oldname.c_str(), GUID_LOPART(guid), newName.c_str());
+ sLog->outInfo(LOG_FILTER_CHARACTER, "Account: %d (IP: %s), Character[%s] (guid:%u) Customized to: %s", GetAccountId(), GetRemoteAddress().c_str(), oldname.c_str(), GUID_LOPART(guid), newName.c_str());
}
Player::Customize(guid, gender, skin, face, hairStyle, hairColor, facialHair);
diff --git a/src/server/game/Handlers/GroupHandler.cpp b/src/server/game/Handlers/GroupHandler.cpp
index e0ff3933c3a..c11a1cfc2aa 100755
--- a/src/server/game/Handlers/GroupHandler.cpp
+++ b/src/server/game/Handlers/GroupHandler.cpp
@@ -859,7 +859,7 @@ void WorldSession::BuildPartyMemberStatsChangedPacket(Player* player, WorldPacke
{
if (auramask & (uint64(1) << i))
{
- AuraApplication const* aurApp = player->GetVisibleAura(i);
+ AuraApplication const* aurApp = pet->GetVisibleAura(i);
*data << uint32(aurApp ? aurApp->GetBase()->GetId() : 0);
*data << uint8(1);
}
diff --git a/src/server/game/Handlers/ItemHandler.cpp b/src/server/game/Handlers/ItemHandler.cpp
index 260220bb8d5..76c719443bb 100755
--- a/src/server/game/Handlers/ItemHandler.cpp
+++ b/src/server/game/Handlers/ItemHandler.cpp
@@ -306,7 +306,7 @@ void WorldSession::HandleItemQuerySingleOpcode(WorldPacket & recv_data)
data << pProto->ItemId;
data << pProto->Class;
data << pProto->SubClass;
- data << int32(pProto->Unk0); // new 2.0.3, not exist in wdb cache?
+ data << pProto->SoundOverrideSubclass;
data << Name;
data << uint8(0x00); //pProto->Name2; // blizz not send name there, just uint8(0x00); <-- \0 = empty string = empty name...
data << uint8(0x00); //pProto->Name3; // blizz not send name there, just uint8(0x00);
diff --git a/src/server/game/Handlers/MailHandler.cpp b/src/server/game/Handlers/MailHandler.cpp
index 2cf27140720..8702b939ca8 100755
--- a/src/server/game/Handlers/MailHandler.cpp
+++ b/src/server/game/Handlers/MailHandler.cpp
@@ -264,7 +264,7 @@ void WorldSession::HandleSendMail(WorldPacket & recv_data)
if (!AccountMgr::IsPlayerAccount(GetSecurity()) && sWorld->getBoolConfig(CONFIG_GM_LOG_TRADE))
{
sLog->outCommand(GetAccountId(), "GM %s (Account: %u) mail item: %s (Entry: %u Count: %u) to player: %s (Account: %u)",
- GetPlayerName(), GetAccountId(), item->GetTemplate()->Name1.c_str(), item->GetEntry(), item->GetCount(), receiver.c_str(), rc_account);
+ GetPlayerName().c_str(), GetAccountId(), item->GetTemplate()->Name1.c_str(), item->GetEntry(), item->GetCount(), receiver.c_str(), rc_account);
}
item->SetNotRefundable(GetPlayer()); // makes the item no longer refundable
@@ -284,7 +284,7 @@ void WorldSession::HandleSendMail(WorldPacket & recv_data)
if (money > 0 && !AccountMgr::IsPlayerAccount(GetSecurity()) && sWorld->getBoolConfig(CONFIG_GM_LOG_TRADE))
{
sLog->outCommand(GetAccountId(), "GM %s (Account: %u) mail money: %u to player: %s (Account: %u)",
- GetPlayerName(), GetAccountId(), money, receiver.c_str(), rc_account);
+ GetPlayerName().c_str(), GetAccountId(), money, receiver.c_str(), rc_account);
}
}
@@ -479,7 +479,7 @@ void WorldSession::HandleMailTakeItem(WorldPacket & recv_data)
sender_name = sObjectMgr->GetTrinityStringForDBCLocale(LANG_UNKNOWN);
}
sLog->outCommand(GetAccountId(), "GM %s (Account: %u) receive mail item: %s (Entry: %u Count: %u) and send COD money: %u to player: %s (Account: %u)",
- GetPlayerName(), GetAccountId(), it->GetTemplate()->Name1.c_str(), it->GetEntry(), it->GetCount(), m->COD, sender_name.c_str(), sender_accId);
+ GetPlayerName().c_str(), GetAccountId(), it->GetTemplate()->Name1.c_str(), it->GetEntry(), it->GetCount(), m->COD, sender_name.c_str(), sender_accId);
}
else if (!receive)
sender_accId = sObjectMgr->GetPlayerAccountIdByGUID(sender_guid);
@@ -500,6 +500,7 @@ void WorldSession::HandleMailTakeItem(WorldPacket & recv_data)
player->RemoveMItem(it->GetGUIDLow());
uint32 count = it->GetCount(); // save counts before store and possible merge with deleting
+ it->SetState(ITEM_UNCHANGED); // need to set this state, otherwise item cannot be removed later, if neccessary
player->MoveItemToInventory(dest, it, true);
player->SaveInventoryAndGoldToDB(trans);
diff --git a/src/server/game/Handlers/MiscHandler.cpp b/src/server/game/Handlers/MiscHandler.cpp
index 02b0ef9fc05..aa353549c10 100755
--- a/src/server/game/Handlers/MiscHandler.cpp
+++ b/src/server/game/Handlers/MiscHandler.cpp
@@ -52,6 +52,9 @@
#include "Group.h"
#include "AccountMgr.h"
#include "Spell.h"
+#include "BattlegroundMgr.h"
+#include "Battlefield.h"
+#include "BattlefieldMgr.h"
void WorldSession::HandleRepopRequestOpcode(WorldPacket & recv_data)
{
@@ -1686,12 +1689,64 @@ void WorldSession::SendSetPhaseShift(uint32 PhaseShift)
data << uint32(PhaseShift);
SendPacket(&data);
}
+// Battlefield and Battleground
+void WorldSession::HandleAreaSpiritHealerQueryOpcode(WorldPacket & recv_data)
+{
+ sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: CMSG_AREA_SPIRIT_HEALER_QUERY");
+
+ Battleground* bg = _player->GetBattleground();
+
+ uint64 guid;
+ recv_data >> guid;
+
+ Creature* unit = GetPlayer()->GetMap()->GetCreature(guid);
+ if (!unit)
+ return;
+
+ if (!unit->isSpiritService()) // it's not spirit service
+ return;
+
+ if (bg)
+ sBattlegroundMgr->SendAreaSpiritHealerQueryOpcode(_player, bg, guid);
+
+ if (Battlefield* bf = sBattlefieldMgr->GetBattlefieldToZoneId(_player->GetZoneId()))
+ bf->SendAreaSpiritHealerQueryOpcode(_player,guid);
+}
+
+void WorldSession::HandleAreaSpiritHealerQueueOpcode(WorldPacket & recv_data)
+{
+ sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: CMSG_AREA_SPIRIT_HEALER_QUEUE");
+
+ Battleground* bg = _player->GetBattleground();
+
+ uint64 guid;
+ recv_data >> guid;
+
+ Creature* unit = GetPlayer()->GetMap()->GetCreature(guid);
+ if (!unit)
+ return;
+
+ if (!unit->isSpiritService()) // it's not spirit service
+ return;
+
+ if (bg)
+ bg->AddPlayerToResurrectQueue(guid, _player->GetGUID());
+
+ if (Battlefield* bf = sBattlefieldMgr->GetBattlefieldToZoneId(_player->GetZoneId()))
+ bf->AddPlayerToResurrectQueue(guid, _player->GetGUID());
+}
void WorldSession::HandleHearthAndResurrect(WorldPacket& /*recv_data*/)
{
if (_player->isInFlight())
return;
+ if (/*Battlefield* bf = */sBattlefieldMgr->GetBattlefieldToZoneId(_player->GetZoneId()))
+ {
+ // bf->PlayerAskToLeave(_player); FIXME
+ return;
+ }
+
AreaTableEntry const* atEntry = GetAreaEntryByAreaID(_player->GetAreaId());
if (!atEntry || !(atEntry->flags & AREA_FLAG_WINTERGRASP_2))
return;
diff --git a/src/server/game/Handlers/NPCHandler.cpp b/src/server/game/Handlers/NPCHandler.cpp
index f0c3093aa25..085e3c49157 100755
--- a/src/server/game/Handlers/NPCHandler.cpp
+++ b/src/server/game/Handlers/NPCHandler.cpp
@@ -44,7 +44,7 @@ enum StableResultCode
STABLE_SUCCESS_STABLE = 0x08, // stable success
STABLE_SUCCESS_UNSTABLE = 0x09, // unstable/swap success
STABLE_SUCCESS_BUY_SLOT = 0x0A, // buy slot success
- STABLE_ERR_EXOTIC = 0x0C, // "you are unable to control exotic creatures"
+ STABLE_ERR_EXOTIC = 0x0C // "you are unable to control exotic creatures"
};
void WorldSession::HandleTabardVendorActivateOpcode(WorldPacket & recv_data)
diff --git a/src/server/game/Handlers/QuestHandler.cpp b/src/server/game/Handlers/QuestHandler.cpp
index 7492edb35fe..db18f2a01c9 100755
--- a/src/server/game/Handlers/QuestHandler.cpp
+++ b/src/server/game/Handlers/QuestHandler.cpp
@@ -122,7 +122,7 @@ void WorldSession::HandleQuestgiverAcceptQuestOpcode(WorldPacket & recv_data)
// no or incorrect quest giver
if (!object || (object->GetTypeId() != TYPEID_PLAYER && !object->hasQuest(questId)) ||
- (object->GetTypeId() == TYPEID_PLAYER && !object->ToPlayer()->CanShareQuest(questId)))
+ (object->GetTypeId() == TYPEID_PLAYER && object != _player && !object->ToPlayer()->CanShareQuest(questId)))
{
_player->PlayerTalkClass->SendCloseGossip();
_player->SetDivider(0);
@@ -582,7 +582,7 @@ void WorldSession::HandlePushQuestToParty(WorldPacket& recvPacket)
continue;
}
- player->PlayerTalkClass->SendQuestGiverQuestDetails(quest, _player->GetGUID(), true);
+ player->PlayerTalkClass->SendQuestGiverQuestDetails(quest, player->GetGUID(), true);
player->SetDivider(_player->GetGUID());
}
}
diff --git a/src/server/game/Handlers/SkillHandler.cpp b/src/server/game/Handlers/SkillHandler.cpp
index f9731ba85db..8872816f87d 100755
--- a/src/server/game/Handlers/SkillHandler.cpp
+++ b/src/server/game/Handlers/SkillHandler.cpp
@@ -84,9 +84,13 @@ void WorldSession::HandleTalentWipeConfirmOpcode(WorldPacket & recv_data)
unit->CastSpell(_player, 14867, true); //spell: "Untalent Visual Effect"
}
-void WorldSession::HandleUnlearnSkillOpcode(WorldPacket & recv_data)
+void WorldSession::HandleUnlearnSkillOpcode(WorldPacket& recvData)
{
- uint32 skill_id;
- recv_data >> skill_id;
- GetPlayer()->SetSkill(skill_id, 0, 0, 0);
+ uint32 skillId;
+ recvData >> skillId;
+
+ if (!IsPrimaryProfessionSkill(skillId))
+ return;
+
+ GetPlayer()->SetSkill(skillId, 0, 0, 0);
}
diff --git a/src/server/game/Handlers/SpellHandler.cpp b/src/server/game/Handlers/SpellHandler.cpp
index d7bb10e8ba3..b9e5523fd23 100755
--- a/src/server/game/Handlers/SpellHandler.cpp
+++ b/src/server/game/Handlers/SpellHandler.cpp
@@ -514,8 +514,8 @@ void WorldSession::HandleTotemDestroyed(WorldPacket& recvPacket)
return;
Creature* totem = GetPlayer()->GetMap()->GetCreature(_player->m_SummonSlot[slotId]);
- // Don't unsummon sentry totem
- if (totem && totem->isTotem() && totem->GetEntry() != SENTRY_TOTEM_ENTRY)
+
+ if (totem && totem->isTotem())
totem->ToTotem()->UnSummon();
}
diff --git a/src/server/game/Instances/InstanceSaveMgr.cpp b/src/server/game/Instances/InstanceSaveMgr.cpp
index 4ca7f97c02b..48ed7bdba1f 100755
--- a/src/server/game/Instances/InstanceSaveMgr.cpp
+++ b/src/server/game/Instances/InstanceSaveMgr.cpp
@@ -275,7 +275,7 @@ void InstanceSaveManager::LoadInstances()
// Load reset times and clean expired instances
sInstanceSaveMgr->LoadResetTimes();
- sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded instances in %u ms", GetMSTimeDiffToNow(oldMSTime));
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded instances in %u ms", GetMSTimeDiffToNow(oldMSTime));
}
diff --git a/src/server/game/Instances/InstanceScript.h b/src/server/game/Instances/InstanceScript.h
index ba6d327e631..f1766833aee 100755
--- a/src/server/game/Instances/InstanceScript.h
+++ b/src/server/game/Instances/InstanceScript.h
@@ -49,7 +49,7 @@ enum EncounterFrameType
ENCOUNTER_FRAME_ENABLE_OBJECTIVE = 4,
ENCOUNTER_FRAME_UPDATE_OBJECTIVE = 5,
ENCOUNTER_FRAME_DISABLE_OBJECTIVE = 6,
- ENCOUNTER_FRAME_UNK7 = 7, // Seems to have something to do with sorting the encounter units
+ ENCOUNTER_FRAME_UNK7 = 7 // Seems to have something to do with sorting the encounter units
};
enum EncounterState
@@ -59,7 +59,7 @@ enum EncounterState
FAIL = 2,
DONE = 3,
SPECIAL = 4,
- TO_BE_DECIDED = 5,
+ TO_BE_DECIDED = 5
};
enum DoorType
@@ -67,7 +67,7 @@ enum DoorType
DOOR_TYPE_ROOM = 0, // Door can open if encounter is not in progress
DOOR_TYPE_PASSAGE = 1, // Door can open if encounter is done
DOOR_TYPE_SPAWN_HOLE = 2, // Door can open if encounter is in progress, typically used for spawning places
- MAX_DOOR_TYPES,
+ MAX_DOOR_TYPES
};
enum BoundaryType
@@ -84,7 +84,7 @@ enum BoundaryType
BOUNDARY_MAX_X = BOUNDARY_N,
BOUNDARY_MIN_X = BOUNDARY_S,
BOUNDARY_MAX_Y = BOUNDARY_W,
- BOUNDARY_MIN_Y = BOUNDARY_E,
+ BOUNDARY_MIN_Y = BOUNDARY_E
};
typedef std::map<BoundaryType, float> BossBoundaryMap;
diff --git a/src/server/game/Loot/LootMgr.cpp b/src/server/game/Loot/LootMgr.cpp
index 6f49a555950..fca8d78a3de 100755
--- a/src/server/game/Loot/LootMgr.cpp
+++ b/src/server/game/Loot/LootMgr.cpp
@@ -524,7 +524,7 @@ QuestItemList* Loot::FillQuestLoot(Player* player)
// increase once if one looter only, looter-times if free for all
if (item.freeforall || !item.is_blocked)
++unlootedCount;
- if (!player->GetGroup() || (player->GetGroup()->GetLootMethod() != GROUP_LOOT || player->GetGroup()->GetLootMethod() != ROUND_ROBIN))
+ if (!player->GetGroup() || (player->GetGroup()->GetLootMethod() != GROUP_LOOT && player->GetGroup()->GetLootMethod() != ROUND_ROBIN))
item.is_blocked = true;
if (items.size() + ql->size() == MAX_NR_LOOT_ITEMS)
@@ -1450,7 +1450,7 @@ bool LootTemplate::isReference(uint32 id)
void LoadLootTemplates_Creature()
{
- sLog->outInfo(LOG_FILTER_LOOT, "Loading creature loot templates...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading creature loot templates...");
uint32 oldMSTime = getMSTime();
@@ -1477,16 +1477,14 @@ void LoadLootTemplates_Creature()
LootTemplates_Creature.ReportUnusedIds(lootIdSet);
if (count)
- sLog->outInfo(LOG_FILTER_LOOT, ">> Loaded %u creature loot templates in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u creature loot templates in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
else
sLog->outError(LOG_FILTER_SQL, ">> Loaded 0 creature loot templates. DB table `creature_loot_template` is empty");
-
-
}
void LoadLootTemplates_Disenchant()
{
- sLog->outInfo(LOG_FILTER_LOOT, "Loading disenchanting loot templates...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading disenchanting loot templates...");
uint32 oldMSTime = getMSTime();
@@ -1512,15 +1510,14 @@ void LoadLootTemplates_Disenchant()
LootTemplates_Disenchant.ReportUnusedIds(lootIdSet);
if (count)
- sLog->outInfo(LOG_FILTER_LOOT, ">> Loaded %u disenchanting loot templates in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u disenchanting loot templates in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
else
sLog->outError(LOG_FILTER_SQL, ">> Loaded 0 disenchanting loot templates. DB table `disenchant_loot_template` is empty");
-
}
void LoadLootTemplates_Fishing()
{
- sLog->outInfo(LOG_FILTER_LOOT, "Loading fishing loot templates...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading fishing loot templates...");
uint32 oldMSTime = getMSTime();
@@ -1537,16 +1534,14 @@ void LoadLootTemplates_Fishing()
LootTemplates_Fishing.ReportUnusedIds(lootIdSet);
if (count)
- sLog->outInfo(LOG_FILTER_LOOT, ">> Loaded %u fishing loot templates in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u fishing loot templates in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
else
sLog->outError(LOG_FILTER_SQL, ">> Loaded 0 fishing loot templates. DB table `fishing_loot_template` is empty");
-
-
}
void LoadLootTemplates_Gameobject()
{
- sLog->outInfo(LOG_FILTER_LOOT, "Loading gameobject loot templates...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading gameobject loot templates...");
uint32 oldMSTime = getMSTime();
@@ -1573,16 +1568,14 @@ void LoadLootTemplates_Gameobject()
LootTemplates_Gameobject.ReportUnusedIds(lootIdSet);
if (count)
- sLog->outInfo(LOG_FILTER_LOOT, ">> Loaded %u gameobject loot templates in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u gameobject loot templates in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
else
sLog->outError(LOG_FILTER_SQL, ">> Loaded 0 gameobject loot templates. DB table `gameobject_loot_template` is empty");
-
-
}
void LoadLootTemplates_Item()
{
- sLog->outInfo(LOG_FILTER_LOOT, "Loading item loot templates...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading item loot templates...");
uint32 oldMSTime = getMSTime();
@@ -1599,16 +1592,14 @@ void LoadLootTemplates_Item()
LootTemplates_Item.ReportUnusedIds(lootIdSet);
if (count)
- sLog->outInfo(LOG_FILTER_LOOT, ">> Loaded %u item loot templates in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u item loot templates in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
else
sLog->outError(LOG_FILTER_SQL, ">> Loaded 0 item loot templates. DB table `item_loot_template` is empty");
-
-
}
void LoadLootTemplates_Milling()
{
- sLog->outInfo(LOG_FILTER_LOOT, "Loading milling loot templates...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading milling loot templates...");
uint32 oldMSTime = getMSTime();
@@ -1630,16 +1621,14 @@ void LoadLootTemplates_Milling()
LootTemplates_Milling.ReportUnusedIds(lootIdSet);
if (count)
- sLog->outInfo(LOG_FILTER_LOOT, ">> Loaded %u milling loot templates in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u milling loot templates in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
else
sLog->outError(LOG_FILTER_SQL, ">> Loaded 0 milling loot templates. DB table `milling_loot_template` is empty");
-
-
}
void LoadLootTemplates_Pickpocketing()
{
- sLog->outInfo(LOG_FILTER_LOOT, "Loading pickpocketing loot templates...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading pickpocketing loot templates...");
uint32 oldMSTime = getMSTime();
@@ -1666,16 +1655,14 @@ void LoadLootTemplates_Pickpocketing()
LootTemplates_Pickpocketing.ReportUnusedIds(lootIdSet);
if (count)
- sLog->outInfo(LOG_FILTER_LOOT, ">> Loaded %u pickpocketing loot templates in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u pickpocketing loot templates in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
else
sLog->outError(LOG_FILTER_SQL, ">> Loaded 0 pickpocketing loot templates. DB table `pickpocketing_loot_template` is empty");
-
-
}
void LoadLootTemplates_Prospecting()
{
- sLog->outInfo(LOG_FILTER_LOOT, "Loading prospecting loot templates...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading prospecting loot templates...");
uint32 oldMSTime = getMSTime();
@@ -1697,16 +1684,14 @@ void LoadLootTemplates_Prospecting()
LootTemplates_Prospecting.ReportUnusedIds(lootIdSet);
if (count)
- sLog->outInfo(LOG_FILTER_LOOT, ">> Loaded %u prospecting loot templates in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u prospecting loot templates in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
else
sLog->outError(LOG_FILTER_SQL, ">> Loaded 0 prospecting loot templates. DB table `prospecting_loot_template` is empty");
-
-
}
void LoadLootTemplates_Mail()
{
- sLog->outInfo(LOG_FILTER_LOOT, "Loading mail loot templates...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading mail loot templates...");
uint32 oldMSTime = getMSTime();
@@ -1723,16 +1708,14 @@ void LoadLootTemplates_Mail()
LootTemplates_Mail.ReportUnusedIds(lootIdSet);
if (count)
- sLog->outInfo(LOG_FILTER_LOOT, ">> Loaded %u mail loot templates in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u mail loot templates in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
else
sLog->outError(LOG_FILTER_SQL, ">> Loaded 0 mail loot templates. DB table `mail_loot_template` is empty");
-
-
}
void LoadLootTemplates_Skinning()
{
- sLog->outInfo(LOG_FILTER_LOOT, "Loading skinning loot templates...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading skinning loot templates...");
uint32 oldMSTime = getMSTime();
@@ -1759,16 +1742,14 @@ void LoadLootTemplates_Skinning()
LootTemplates_Skinning.ReportUnusedIds(lootIdSet);
if (count)
- sLog->outInfo(LOG_FILTER_LOOT, ">> Loaded %u skinning loot templates in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u skinning loot templates in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
else
sLog->outError(LOG_FILTER_SQL, ">> Loaded 0 skinning loot templates. DB table `skinning_loot_template` is empty");
-
-
}
void LoadLootTemplates_Spell()
{
- sLog->outInfo(LOG_FILTER_LOOT, "Loading spell loot templates...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading spell loot templates...");
uint32 oldMSTime = getMSTime();
@@ -1803,15 +1784,14 @@ void LoadLootTemplates_Spell()
LootTemplates_Spell.ReportUnusedIds(lootIdSet);
if (count)
- sLog->outInfo(LOG_FILTER_LOOT, ">> Loaded %u spell loot templates in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u spell loot templates in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
else
sLog->outError(LOG_FILTER_SQL, ">> Loaded 0 spell loot templates. DB table `spell_loot_template` is empty");
-
}
void LoadLootTemplates_Reference()
{
- sLog->outInfo(LOG_FILTER_LOOT, "Loading reference loot templates...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading reference loot templates...");
uint32 oldMSTime = getMSTime();
@@ -1834,6 +1814,5 @@ void LoadLootTemplates_Reference()
// output error for any still listed ids (not referenced from any loot table)
LootTemplates_Reference.ReportUnusedIds(lootIdSet);
- sLog->outInfo(LOG_FILTER_LOOT, ">> Loaded refence loot templates in %u ms", GetMSTimeDiffToNow(oldMSTime));
-
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded refence loot templates in %u ms", GetMSTimeDiffToNow(oldMSTime));
}
diff --git a/src/server/game/Loot/LootMgr.h b/src/server/game/Loot/LootMgr.h
index 1af5bd1ea62..45fc5c7983c 100755
--- a/src/server/game/Loot/LootMgr.h
+++ b/src/server/game/Loot/LootMgr.h
@@ -69,7 +69,7 @@ enum PermissionTypes
MASTER_PERMISSION = 2,
ROUND_ROBIN_PERMISSION = 3,
OWNER_PERMISSION = 4,
- NONE_PERMISSION = 5,
+ NONE_PERMISSION = 5
};
enum LootType
@@ -94,7 +94,7 @@ enum LootSlotType
LOOT_SLOT_TYPE_ROLL_ONGOING = 1, // roll is ongoing. player cannot loot.
LOOT_SLOT_TYPE_MASTER = 2, // item can only be distributed by group loot master.
LOOT_SLOT_TYPE_LOCKED = 3, // item is shown in red. player cannot loot.
- LOOT_SLOT_TYPE_OWNER = 4, // ignore binding confirmation and etc, for single player looting
+ LOOT_SLOT_TYPE_OWNER = 4 // ignore binding confirmation and etc, for single player looting
};
class Player;
diff --git a/src/server/game/Mails/Mail.h b/src/server/game/Mails/Mail.h
index 8efb33bda9a..10095268ead 100755
--- a/src/server/game/Mails/Mail.h
+++ b/src/server/game/Mails/Mail.h
@@ -36,7 +36,7 @@ enum MailMessageType
MAIL_AUCTION = 2,
MAIL_CREATURE = 3, // client send CMSG_CREATURE_QUERY on this mailmessagetype
MAIL_GAMEOBJECT = 4, // client send CMSG_GAMEOBJECT_QUERY on this mailmessagetype
- MAIL_ITEM = 5, // client send CMSG_ITEM_QUERY on this mailmessagetype
+ MAIL_ITEM = 5 // client send CMSG_ITEM_QUERY on this mailmessagetype
};
enum MailCheckMask
@@ -46,7 +46,7 @@ enum MailCheckMask
MAIL_CHECK_MASK_RETURNED = 0x02, /// This mail was returned. Do not allow returning mail back again.
MAIL_CHECK_MASK_COPIED = 0x04, /// This mail was copied. Do not allow making a copy of items in mail.
MAIL_CHECK_MASK_COD_PAYMENT = 0x08,
- MAIL_CHECK_MASK_HAS_BODY = 0x10, /// This mail has body text.
+ MAIL_CHECK_MASK_HAS_BODY = 0x10 /// This mail has body text.
};
// gathered from Stationery.dbc
@@ -58,7 +58,7 @@ enum MailStationery
MAIL_STATIONERY_AUCTION = 62,
MAIL_STATIONERY_VAL = 64, // Valentine
MAIL_STATIONERY_CHR = 65, // Christmas
- MAIL_STATIONERY_ORP = 67, // Orphan
+ MAIL_STATIONERY_ORP = 67 // Orphan
};
enum MailState
@@ -74,7 +74,7 @@ enum MailShowFlags
MAIL_SHOW_DELETE = 0x0002, // forced show delete button instead return button
MAIL_SHOW_AUCTION = 0x0004, // from old comment
MAIL_SHOW_UNK2 = 0x0008, // unknown, COD will be shown even without that flag
- MAIL_SHOW_RETURN = 0x0010,
+ MAIL_SHOW_RETURN = 0x0010
};
class MailSender
diff --git a/src/server/game/Maps/Map.cpp b/src/server/game/Maps/Map.cpp
index 53b2f9cf437..aee516f6f1d 100755
--- a/src/server/game/Maps/Map.cpp
+++ b/src/server/game/Maps/Map.cpp
@@ -711,7 +711,7 @@ void Map::PlayerRelocation(Player* player, float x, float y, float z, float orie
player->Relocate(x, y, z, orientation);
if (player->IsVehicle())
- player->GetVehicleKit()->RelocatePassengers(x, y, z, orientation);
+ player->GetVehicleKit()->RelocatePassengers();
if (old_cell.DiffGrid(new_cell) || old_cell.DiffCell(new_cell))
{
@@ -757,7 +757,7 @@ void Map::CreatureRelocation(Creature* creature, float x, float y, float z, floa
{
creature->Relocate(x, y, z, ang);
if (creature->IsVehicle())
- creature->GetVehicleKit()->RelocatePassengers(x, y, z, ang);
+ creature->GetVehicleKit()->RelocatePassengers();
creature->UpdateObjectVisibility(false);
RemoveCreatureFromMoveList(creature);
}
@@ -1223,8 +1223,8 @@ bool GridMap::loadLiquidData(FILE* in, uint32 offset, uint32 /*size*/)
}
if (!(header.flags & MAP_LIQUID_NO_HEIGHT))
{
- _liquidMap = new float[_liquidWidth*_liquidHeight];
- if (fread(_liquidMap, sizeof(float), _liquidWidth*_liquidHeight, in) != _liquidWidth*_liquidHeight)
+ _liquidMap = new float[uint32(_liquidWidth) * uint32(_liquidHeight)];
+ if (fread(_liquidMap, sizeof(float), _liquidWidth*_liquidHeight, in) != (uint32(_liquidWidth) * uint32(_liquidHeight)))
return false;
}
return true;
@@ -2688,7 +2688,7 @@ uint32 InstanceMap::GetMaxResetDelay() const
/* ******* Battleground Instance Maps ******* */
BattlegroundMap::BattlegroundMap(uint32 id, time_t expiry, uint32 InstanceId, Map* _parent, uint8 spawnMode)
- : Map(id, expiry, InstanceId, spawnMode, _parent)
+ : Map(id, expiry, InstanceId, spawnMode, _parent), m_bg(NULL)
{
//lets initialize visibility distance for BG/Arenas
BattlegroundMap::InitVisibilityDistance();
diff --git a/src/server/game/Maps/Map.h b/src/server/game/Maps/Map.h
index 6d526f23a94..0743c4e545f 100755
--- a/src/server/game/Maps/Map.h
+++ b/src/server/game/Maps/Map.h
@@ -439,9 +439,9 @@ class Map : public GridRefManager<NGridType>
float GetHeight(uint32 phasemask, float x, float y, float z, bool vmap = true, float maxSearchDist = DEFAULT_HEIGHT_SEARCH) const;
bool isInLineOfSight(float x1, float y1, float z1, float x2, float y2, float z2, uint32 phasemask) const;
void Balance() { _dynamicTree.balance(); }
- void Remove(const GameObjectModel& mdl) { _dynamicTree.remove(mdl); }
- void Insert(const GameObjectModel& mdl) { _dynamicTree.insert(mdl); }
- bool Contains(const GameObjectModel& mdl) const { return _dynamicTree.contains(mdl);}
+ void RemoveGameObjectModel(const GameObjectModel& model) { _dynamicTree.remove(model); }
+ void InsertGameObjectModel(const GameObjectModel& model) { _dynamicTree.insert(model); }
+ bool ContainsGameObjectModel(const GameObjectModel& model) const { return _dynamicTree.contains(model);}
bool getObjectHitPos(uint32 phasemask, float x1, float y1, float z1, float x2, float y2, float z2, float& rx, float &ry, float& rz, float modifyDist);
/*
diff --git a/src/server/game/Miscellaneous/Language.h b/src/server/game/Miscellaneous/Language.h
index aec72835d86..5893bbd6564 100755
--- a/src/server/game/Miscellaneous/Language.h
+++ b/src/server/game/Miscellaneous/Language.h
@@ -86,7 +86,8 @@ enum TrinityStrings
LANG_CONNECTED_PLAYERS = 60,
LANG_ACCOUNT_ADDON = 61,
LANG_IMPROPER_VALUE = 62,
- // Room for more level 0 63-99 not used
+ LANG_CANT_DO_NOW = 63,
+ // Room for more level 0 64-99 not used
// level 1 chat
LANG_GLOBAL_NOTIFY = 100,
@@ -337,7 +338,13 @@ enum TrinityStrings
LANG_TITLE_REMOVE_RES = 354,
LANG_TITLE_CURRENT_RES = 355,
LANG_CURRENT_TITLE_RESET = 356,
- // Room for more level 2 357-399 not used
+ LANG_COMMAND_CHEAT_STATUS = 357,
+ LANG_COMMAND_CHEAT_GOD = 358,
+ LANG_COMMAND_CHEAT_CT = 359,
+ LANG_COMMAND_CHEAT_CD = 360,
+ LANG_COMMAND_CHEAT_POWER = 361,
+ LANG_COMMAND_CHEAT_WW = 362,
+ // Room for more level 2 363-399 not used
// level 3 chat
LANG_SCRIPTS_RELOADED = 400,
@@ -957,7 +964,10 @@ enum TrinityStrings
LANG_COMMAND_LOOKUP_MAX_RESULTS = 5029,
LANG_FLEE = 5030,
LANG_NPCINFO_AIINFO = 5031,
- // Room for more Trinity strings 5032-9999
+ LANG_COMMAND_NO_BATTLEGROUND_FOUND = 5032,
+ LANG_COMMAND_NO_ACHIEVEMENT_CRITERIA_FOUND = 5033,
+ LANG_COMMAND_NO_OUTDOOR_PVP_FORUND = 5034,
+ // Room for more Trinity strings 5035-9999
// Level requirement notifications
LANG_SAY_REQ = 6604,
@@ -1066,7 +1076,7 @@ enum TrinityStrings
// Use for custom patches 11000-11999
LANG_AUTO_BROADCAST = 11000,
- LANG_INVALID_REALMID = 11001,
+ LANG_INVALID_REALMID = 11001
// NOT RESERVED IDS 12000-1999999999
// `db_script_string` table index 2000000000-2000009999 (MIN_DB_SCRIPT_STRING_ID-MAX_DB_SCRIPT_STRING_ID)
diff --git a/src/server/game/Miscellaneous/SharedDefines.h b/src/server/game/Miscellaneous/SharedDefines.h
index f74d6c44be7..4f6ad917423 100755
--- a/src/server/game/Miscellaneous/SharedDefines.h
+++ b/src/server/game/Miscellaneous/SharedDefines.h
@@ -26,7 +26,7 @@ enum SpellEffIndex
{
EFFECT_0 = 0,
EFFECT_1 = 1,
- EFFECT_2 = 2,
+ EFFECT_2 = 2
};
// used in script definitions
@@ -124,7 +124,7 @@ enum UnitClass
UNIT_CLASS_WARRIOR = 1,
UNIT_CLASS_PALADIN = 2,
UNIT_CLASS_ROGUE = 4,
- UNIT_CLASS_MAGE = 8,
+ UNIT_CLASS_MAGE = 8
};
#define CLASSMASK_ALL_CREATURES ((1<<(UNIT_CLASS_WARRIOR-1)) | (1<<(UNIT_CLASS_PALADIN-1)) | (1<<(UNIT_CLASS_ROGUE-1)) | (1<<(UNIT_CLASS_MAGE-1)))
@@ -245,7 +245,7 @@ enum ItemQualities
enum SpellCategory
{
SPELL_CATEGORY_FOOD = 11,
- SPELL_CATEGORY_DRINK = 59,
+ SPELL_CATEGORY_DRINK = 59
};
const uint32 ItemQualityColors[MAX_ITEM_QUALITY] =
@@ -465,7 +465,7 @@ enum SpellAttr5
SPELL_ATTR5_SPECIAL_ITEM_CLASS_CHECK = 0x00010000, // 16 this allows spells with EquippedItemClass to affect spells from other items if the required item is equipped
SPELL_ATTR5_USABLE_WHILE_FEARED = 0x00020000, // 17 usable while feared
SPELL_ATTR5_USABLE_WHILE_CONFUSED = 0x00040000, // 18 usable while confused
- SPELL_ATTR5_UNK19 = 0x00080000, // 19
+ SPELL_ATTR5_DONT_TURN_DURING_CAST = 0x00080000, // 19 Blocks caster's turning when casting (client does not automatically turn caster's model to face UNIT_FIELD_TARGET)
SPELL_ATTR5_UNK20 = 0x00100000, // 20
SPELL_ATTR5_UNK21 = 0x00200000, // 21
SPELL_ATTR5_UNK22 = 0x00400000, // 22
@@ -572,7 +572,7 @@ enum SpellClickCastFlags
{
NPC_CLICK_CAST_CASTER_CLICKER = 0x01,
NPC_CLICK_CAST_TARGET_CLICKER = 0x02,
- NPC_CLICK_CAST_ORIG_CASTER_OWNER = 0x04,
+ NPC_CLICK_CAST_ORIG_CASTER_OWNER = 0x04
};
enum SheathTypes
@@ -642,7 +642,7 @@ enum TeamId
{
TEAM_ALLIANCE = 0,
TEAM_HORDE,
- TEAM_NEUTRAL,
+ TEAM_NEUTRAL
};
enum Team
@@ -654,7 +654,7 @@ enum Team
//TEAM_HORDE_FORCES = 892,
//TEAM_SANCTUARY = 936,
//TEAM_OUTLAND = 980,
- TEAM_OTHER = 0, // if ReputationListId > 0 && Flags != FACTION_FLAG_TEAM_HEADER
+ TEAM_OTHER = 0 // if ReputationListId > 0 && Flags != FACTION_FLAG_TEAM_HEADER
};
enum SpellEffects
@@ -1121,7 +1121,7 @@ enum SpellCustomErrors
SPELL_CUSTOM_ERROR_MAX_NUMBER_OF_RECRUITS = 96, // You already have the max number of recruits.
SPELL_CUSTOM_ERROR_MAX_NUMBER_OF_VOLUNTEERS = 97, // You already have the max number of volunteers.
SPELL_CUSTOM_ERROR_FROSTMOURNE_RENDERED_RESSURECT = 98, // Frostmourne has rendered you unable to ressurect.
- SPELL_CUSTOM_ERROR_CANT_MOUNT_WITH_SHAPESHIFT = 99, // You can't mount while affected by that shapeshift.
+ SPELL_CUSTOM_ERROR_CANT_MOUNT_WITH_SHAPESHIFT = 99 // You can't mount while affected by that shapeshift.
};
enum StealthType
@@ -1192,7 +1192,7 @@ enum AuraStateType
//AURA_STATE_UNKNOWN20 = 20, // c | only (45317 Suicide)
//AURA_STATE_UNKNOWN21 = 21, // | not used
AURA_STATE_UNKNOWN22 = 22, // C t| varius spells (63884, 50240)
- AURA_STATE_HEALTH_ABOVE_75_PERCENT = 23, // C |
+ AURA_STATE_HEALTH_ABOVE_75_PERCENT = 23 // C |
};
#define PER_CASTER_AURA_STATE_MASK (\
@@ -1485,7 +1485,7 @@ enum GameObjectFlags
GO_FLAG_NODESPAWN = 0x00000020, // never despawn, typically for doors, they just change state
GO_FLAG_TRIGGERED = 0x00000040, // typically, summoned objects. Triggered by spell or other events
GO_FLAG_DAMAGED = 0x00000200,
- GO_FLAG_DESTROYED = 0x00000400,
+ GO_FLAG_DESTROYED = 0x00000400
};
enum GameObjectDynamicLowFlags
@@ -1493,7 +1493,7 @@ enum GameObjectDynamicLowFlags
GO_DYNFLAG_LO_ACTIVATE = 0x01, // enables interaction with GO
GO_DYNFLAG_LO_ANIMATE = 0x02, // possibly more distinct animation of GO
GO_DYNFLAG_LO_NO_INTERACT = 0x04, // appears to disable interaction (not fully verified)
- GO_DYNFLAG_LO_SPARKLE = 0x08, // makes GO sparkle
+ GO_DYNFLAG_LO_SPARKLE = 0x08 // makes GO sparkle
};
enum GameObjectDestructibleState
@@ -1501,7 +1501,7 @@ enum GameObjectDestructibleState
GO_DESTRUCTIBLE_INTACT = 0,
GO_DESTRUCTIBLE_DAMAGED = 1,
GO_DESTRUCTIBLE_DESTROYED = 2,
- GO_DESTRUCTIBLE_REBUILDING = 3,
+ GO_DESTRUCTIBLE_REBUILDING = 3
};
// EmotesText.dbc
@@ -1758,7 +1758,7 @@ enum TextEmotes
TEXT_EMOTE_LOOK = 449,
TEXT_EMOTE_OBJECT = 450,
TEXT_EMOTE_SWEAT = 451,
- TEXT_EMOTE_YW = 453,
+ TEXT_EMOTE_YW = 453
};
// Emotes.dbc
@@ -2595,7 +2595,7 @@ enum CreatureTypeFlags
CREATURE_TYPEFLAGS_UNK28 = 0x10000000,
CREATURE_TYPEFLAGS_UNK29 = 0x20000000,
CREATURE_TYPEFLAGS_UNK30 = 0x40000000,
- CREATURE_TYPEFLAGS_UNK31 = 0x80000000,
+ CREATURE_TYPEFLAGS_UNK31 = 0x80000000
};
enum CreatureEliteType
@@ -2700,7 +2700,7 @@ enum QuestSort
QUEST_SORT_JEWELCRAFTING = 373,
QUEST_SORT_NOBLEGARDEN = 374,
QUEST_SORT_PILGRIMS_BOUNTY = 375,
- QUEST_SORT_LOVE_IS_IN_THE_AIR = 376,
+ QUEST_SORT_LOVE_IS_IN_THE_AIR = 376
};
inline uint8 ClassByQuestSort(int32 QuestSort)
@@ -3085,7 +3085,7 @@ enum AiReaction
AI_REACTION_FRIENDLY = 1, // (NOT used in client packet handler)
AI_REACTION_HOSTILE = 2, // sent on every attack, triggers aggro sound (used in client packet handler)
AI_REACTION_AFRAID = 3, // seen for polymorph (when AI not in control of self?) (NOT used in client packet handler)
- AI_REACTION_DESTROY = 4, // used on object destroy (NOT used in client packet handler)
+ AI_REACTION_DESTROY = 4 // used on object destroy (NOT used in client packet handler)
};
// Diminishing Returns Types
@@ -3119,7 +3119,7 @@ enum DiminishingGroup
DIMINISHING_SLEEP = 17,
DIMINISHING_TAUNT = 18,
DIMINISHING_LIMITONLY = 19,
- DIMINISHING_DRAGONS_BREATH = 20,
+ DIMINISHING_DRAGONS_BREATH = 20
};
enum SummonCategory
@@ -3129,7 +3129,7 @@ enum SummonCategory
SUMMON_CATEGORY_PET = 2,
SUMMON_CATEGORY_PUPPET = 3,
SUMMON_CATEGORY_VEHICLE = 4,
- SUMMON_CATEGORY_UNK = 5, // as of patch 3.3.5a only Bone Spike in Icecrown Citadel
+ SUMMON_CATEGORY_UNK = 5 // as of patch 3.3.5a only Bone Spike in Icecrown Citadel
// uses this category
};
@@ -3146,12 +3146,12 @@ enum SummonType
SUMMON_TYPE_WILD3 = 8,
SUMMON_TYPE_VEHICLE = 9,
SUMMON_TYPE_VEHICLE2 = 10,
- SUMMON_TYPE_OBJECT = 11,
+ SUMMON_TYPE_OBJECT = 11
};
enum EventId
{
- EVENT_CHARGE = 1003,
+ EVENT_CHARGE = 1003
};
enum ResponseCodes
@@ -3335,7 +3335,7 @@ enum MailResponseResult
MAIL_ERR_MAIL_AND_CHAT_SUSPENDED = 17,
MAIL_ERR_TOO_MANY_ATTACHMENTS = 18,
MAIL_ERR_MAIL_ATTACHMENT_INVALID = 19,
- MAIL_ERR_ITEM_HAS_EXPIRED = 21,
+ MAIL_ERR_ITEM_HAS_EXPIRED = 21
};
enum SpellFamilyNames
@@ -3401,7 +3401,7 @@ enum RemoveMethod
{
GROUP_REMOVEMETHOD_DEFAULT = 0,
GROUP_REMOVEMETHOD_KICK = 1,
- GROUP_REMOVEMETHOD_LEAVE = 2,
+ GROUP_REMOVEMETHOD_LEAVE = 2
};
enum ActivateTaxiReply
@@ -3428,7 +3428,7 @@ enum CalendarFlags
CALENDAR_FLAG_ALL_ALLOWED = 0x001,
CALENDAR_FLAG_INVITES_LOCKED = 0x010,
CALENDAR_FLAG_WITHOUT_INVITES = 0x040,
- CALENDAR_FLAG_GUILD_ONLY = 0x400,
+ CALENDAR_FLAG_GUILD_ONLY = 0x400
};
enum CalendarActionData
@@ -3442,21 +3442,21 @@ enum CalendarActionData
CALENDAR_ACTION_MODIFY_EVENT_INVITE,
CALENDAR_ACTION_MODIFY_MODERATOR_EVENT_INVITE,
CALENDAR_ACTION_REMOVE_EVENT_INVITE,
- CALENDAR_ACTION_SIGNUP_TO_EVENT,
+ CALENDAR_ACTION_SIGNUP_TO_EVENT
};
enum CalendarModerationRank
{
CALENDAR_RANK_PLAYER,
CALENDAR_RANK_MODERATOR,
- CALENDAR_RANK_OWNER,
+ CALENDAR_RANK_OWNER
};
enum CalendarSendEventType
{
CALENDAR_SENDTYPE_GET,
CALENDAR_SENDTYPE_ADD,
- CALENDAR_SENDTYPE_COPY,
+ CALENDAR_SENDTYPE_COPY
};
enum CalendarEventType
@@ -3465,7 +3465,7 @@ enum CalendarEventType
CALENDAR_TYPE_DUNGEON,
CALENDAR_TYPE_PVP,
CALENDAR_TYPE_MEETING,
- CALENDAR_TYPE_OTHER,
+ CALENDAR_TYPE_OTHER
};
enum CalendarInviteStatus
@@ -3479,7 +3479,7 @@ enum CalendarInviteStatus
CALENDAR_STATUS_CONFIRMED,
CALENDAR_STATUS_NO_OWNER,
CALENDAR_STATUS_8,
- CALENDAR_STATUS_9,
+ CALENDAR_STATUS_9
};
enum CalendarError
diff --git a/src/server/game/Movement/MotionMaster.h b/src/server/game/Movement/MotionMaster.h
index 727f626cdea..8d7fdee7ad2 100755
--- a/src/server/game/Movement/MotionMaster.h
+++ b/src/server/game/Movement/MotionMaster.h
@@ -51,7 +51,7 @@ enum MovementGeneratorType
FOLLOW_MOTION_TYPE = 14,
ROTATE_MOTION_TYPE = 15,
EFFECT_MOTION_TYPE = 16,
- NULL_MOTION_TYPE = 17,
+ NULL_MOTION_TYPE = 17
};
enum MovementSlot
@@ -59,7 +59,7 @@ enum MovementSlot
MOTION_SLOT_IDLE,
MOTION_SLOT_ACTIVE,
MOTION_SLOT_CONTROLLED,
- MAX_MOTION_SLOT,
+ MAX_MOTION_SLOT
};
enum MMCleanFlag
@@ -72,7 +72,7 @@ enum MMCleanFlag
enum RotateDirection
{
ROTATE_DIRECTION_LEFT,
- ROTATE_DIRECTION_RIGHT,
+ ROTATE_DIRECTION_RIGHT
};
// assume it is 25 yard per 0.6 second
diff --git a/src/server/game/Movement/MovementGenerators/FleeingMovementGenerator.cpp b/src/server/game/Movement/MovementGenerators/FleeingMovementGenerator.cpp
index 08e27abf050..56818e95a2b 100755
--- a/src/server/game/Movement/MovementGenerators/FleeingMovementGenerator.cpp
+++ b/src/server/game/Movement/MovementGenerators/FleeingMovementGenerator.cpp
@@ -140,7 +140,12 @@ bool FleeingMovementGenerator<T>::_getPoint(T &owner, float &x, float &y, float
angle = i_cur_angle + static_cast<float>(M_PI);
distance /= 2;
break;
+ default:
+ angle = 0.0f;
+ distance = 0.0f;
+ break;
}
+
temp_x = x + distance * cos(angle);
temp_y = y + distance * sin(angle);
Trinity::NormalizeMapCoord(temp_x);
@@ -407,10 +412,6 @@ bool TimedFleeingMovementGenerator::Update(Unit & owner, const uint32& time_diff
if (i_totalFleeTime.Passed())
return false;
- i_totalFleeTime.Update(time_diff);
- if (i_totalFleeTime.Passed())
- return false;
-
// This calls grant-parent Update method hiden by FleeingMovementGenerator::Update(Creature &, const uint32 &) version
// This is done instead of casting Unit& to Creature& and call parent method, then we can use Unit directly
return MovementGeneratorMedium< Creature, FleeingMovementGenerator<Creature> >::Update(owner, time_diff);
diff --git a/src/server/game/Movement/MovementGenerators/TargetedMovementGenerator.cpp b/src/server/game/Movement/MovementGenerators/TargetedMovementGenerator.cpp
index fdff5a92564..2cd3d745750 100755
--- a/src/server/game/Movement/MovementGenerators/TargetedMovementGenerator.cpp
+++ b/src/server/game/Movement/MovementGenerators/TargetedMovementGenerator.cpp
@@ -89,6 +89,7 @@ void TargetedMovementGeneratorMedium<T,D>::_setTargetLocation(T &owner)
Movement::MoveSplineInit init(owner);
init.MoveTo(x,y,z);
+ init.SetFacing(i_target.getTarget());
init.SetWalk(((D*)this)->EnableWalking());
init.Launch();
}
diff --git a/src/server/game/Movement/Spline/MoveSpline.cpp b/src/server/game/Movement/Spline/MoveSpline.cpp
index 61bd3900b9d..699d054be4b 100644
--- a/src/server/game/Movement/Spline/MoveSpline.cpp
+++ b/src/server/game/Movement/Spline/MoveSpline.cpp
@@ -107,7 +107,7 @@ struct FallInitializer
};
enum{
- minimal_duration = 1,
+ minimal_duration = 1
};
struct CommonInitializer
@@ -167,6 +167,7 @@ void MoveSpline::Initialize(const MoveSplineInitArgs& args)
point_Idx_offset = args.path_Idx_offset;
initialOrientation = args.initialOrientation;
+ onTransport = false;
time_passed = 0;
vertical_acceleration = 0.f;
effect_start_time = 0;
@@ -217,7 +218,7 @@ bool MoveSplineInitArgs::_checkPathBounds() const
if (!(flags & MoveSplineFlag::Mask_CatmullRom) && path.size() > 2)
{
enum{
- MAX_OFFSET = (1 << 11) / 2,
+ MAX_OFFSET = (1 << 11) / 2
};
Vector3 middle = (path.front()+path.back()) / 2;
Vector3 offset;
diff --git a/src/server/game/Movement/Spline/MoveSpline.h b/src/server/game/Movement/Spline/MoveSpline.h
index d4b19b21634..945adf6d9f8 100644
--- a/src/server/game/Movement/Spline/MoveSpline.h
+++ b/src/server/game/Movement/Spline/MoveSpline.h
@@ -45,7 +45,7 @@ namespace Movement
Result_None = 0x01,
Result_Arrived = 0x02,
Result_NextCycle = 0x04,
- Result_NextSegment = 0x08,
+ Result_NextSegment = 0x08
};
friend class PacketBuilder;
protected:
@@ -119,6 +119,7 @@ namespace Movement
const Vector3 CurrentDestination() const { return Initialized() ? spline.getPoint(point_Idx+1) : Vector3();}
int32 currentPathIdx() const;
+ bool onTransport;
std::string ToString() const;
};
}
diff --git a/src/server/game/Movement/Spline/MoveSplineFlag.h b/src/server/game/Movement/Spline/MoveSplineFlag.h
index cfc2fdee450..a7262182391 100644
--- a/src/server/game/Movement/Spline/MoveSplineFlag.h
+++ b/src/server/game/Movement/Spline/MoveSplineFlag.h
@@ -70,7 +70,7 @@ namespace Movement
// CatmullRom interpolation mode used
Mask_CatmullRom = Flying | Catmullrom,
// Unused, not suported flags
- Mask_Unused = No_Spline|Enter_Cycle|Frozen|Unknown7|Unknown8|Unknown10|Unknown11|Unknown12|Unknown13,
+ Mask_Unused = No_Spline|Enter_Cycle|Frozen|Unknown7|Unknown8|Unknown10|Unknown11|Unknown12|Unknown13
};
inline uint32& raw() { return (uint32&)*this;}
diff --git a/src/server/game/Movement/Spline/MoveSplineInit.cpp b/src/server/game/Movement/Spline/MoveSplineInit.cpp
index c539dd3cc39..fec629c3329 100644
--- a/src/server/game/Movement/Spline/MoveSplineInit.cpp
+++ b/src/server/game/Movement/Spline/MoveSplineInit.cpp
@@ -74,7 +74,8 @@ namespace Movement
// there is a big chance that current position is unknown if current state is not finalized, need compute it
// this also allows calculate spline position and update map position in much greater intervals
- if (!move_spline.Finalized())
+ // Don't compute for transport movement if the unit is in a motion between two transports
+ if (!move_spline.Finalized() && move_spline.onTransport == transport)
real_position = move_spline.ComputePosition();
// should i do the things that user should do? - no.
@@ -84,6 +85,7 @@ namespace Movement
// corrent first vertex
args.path[0] = real_position;
args.initialOrientation = real_position.orientation;
+ move_spline.onTransport = transport;
uint32 moveFlags = unit.m_movementInfo.GetMovementFlags();
if (args.flags.walkmode)
@@ -158,17 +160,9 @@ namespace Movement
{
if (_transformForTransport)
{
- if (Unit* vehicle = _owner.GetVehicleBase())
- {
- input.x -= vehicle->GetPositionX();
- input.y -= vehicle->GetPositionY();
- input.z -= vehicle->GetPositionZMinusOffset();
- }
- else if (Transport* transport = _owner.GetTransport())
- {
- float unused = 0.0f;
+ float unused = 0.0f;
+ if (TransportBase* transport = _owner.GetDirectTransport())
transport->CalculatePassengerOffset(input.x, input.y, input.z, unused);
- }
}
return input;
diff --git a/src/server/game/Movement/Spline/MoveSplineInit.h b/src/server/game/Movement/Spline/MoveSplineInit.h
index ef847809ac8..cae9f1321d2 100644
--- a/src/server/game/Movement/Spline/MoveSplineInit.h
+++ b/src/server/game/Movement/Spline/MoveSplineInit.h
@@ -30,7 +30,7 @@ namespace Movement
ToGround = 0, // 460 = ToGround, index of AnimationData.dbc
FlyToFly = 1, // 461 = FlyToFly?
ToFly = 2, // 458 = ToFly
- FlyToGround = 3, // 463 = FlyToGround
+ FlyToGround = 3 // 463 = FlyToGround
};
// Transforms coordinates from global to transport offsets
diff --git a/src/server/game/Movement/Spline/Spline.h b/src/server/game/Movement/Spline/Spline.h
index 627cdcf3e3b..63e61b84579 100644
--- a/src/server/game/Movement/Spline/Spline.h
+++ b/src/server/game/Movement/Spline/Spline.h
@@ -53,7 +53,7 @@ protected:
// lesser value saves more performance in cost of lover precision
// minimal value is 1
// client's value is 20, blizzs use 2-3 steps to compute length
- STEPS_PER_SEGMENT = 3,
+ STEPS_PER_SEGMENT = 3
};
static_assert(STEPS_PER_SEGMENT > 0, "shouldn't be lesser than 1");
diff --git a/src/server/game/Movement/Waypoints/WaypointManager.cpp b/src/server/game/Movement/Waypoints/WaypointManager.cpp
index 214fd23fc8a..a01e18347f6 100755
--- a/src/server/game/Movement/Waypoints/WaypointManager.cpp
+++ b/src/server/game/Movement/Waypoints/WaypointManager.cpp
@@ -86,7 +86,7 @@ void WaypointMgr::Load()
}
while (result->NextRow());
- sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded %u waypoints in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u waypoints in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
}
diff --git a/src/server/game/OutdoorPvP/OutdoorPvP.cpp b/src/server/game/OutdoorPvP/OutdoorPvP.cpp
index 4db35d5bc79..9919a47642e 100755
--- a/src/server/game/OutdoorPvP/OutdoorPvP.cpp
+++ b/src/server/game/OutdoorPvP/OutdoorPvP.cpp
@@ -29,8 +29,8 @@
#include "GridNotifiersImpl.h"
#include "CellImpl.h"
-OPvPCapturePoint::OPvPCapturePoint(OutdoorPvP* pvp):
-m_capturePointGUID(0), m_capturePoint(NULL), m_maxValue(0), m_maxSpeed(0),
+OPvPCapturePoint::OPvPCapturePoint(OutdoorPvP* pvp) :
+m_capturePointGUID(0), m_capturePoint(NULL), m_maxValue(0.0f), m_minValue(0.0f), m_maxSpeed(0),
m_value(0), m_team(TEAM_NEUTRAL), m_OldState(OBJECTIVESTATE_NEUTRAL),
m_State(OBJECTIVESTATE_NEUTRAL), m_neutralValuePct(0), m_PvP(pvp)
{
diff --git a/src/server/game/OutdoorPvP/OutdoorPvP.h b/src/server/game/OutdoorPvP/OutdoorPvP.h
index 6ea13d353c5..e896fa2acf6 100755
--- a/src/server/game/OutdoorPvP/OutdoorPvP.h
+++ b/src/server/game/OutdoorPvP/OutdoorPvP.h
@@ -31,7 +31,7 @@ enum OutdoorPvPTypes
OUTDOOR_PVP_TF = 3,
OUTDOOR_PVP_ZM = 4,
OUTDOOR_PVP_SI = 5,
- OUTDOOR_PVP_EP = 6,
+ OUTDOOR_PVP_EP = 6
};
#define MAX_OUTDOORPVP_TYPES 7
@@ -44,7 +44,7 @@ enum ObjectiveStates
OBJECTIVESTATE_NEUTRAL_ALLIANCE_CHALLENGE,
OBJECTIVESTATE_NEUTRAL_HORDE_CHALLENGE,
OBJECTIVESTATE_ALLIANCE_HORDE_CHALLENGE,
- OBJECTIVESTATE_HORDE_ALLIANCE_CHALLENGE,
+ OBJECTIVESTATE_HORDE_ALLIANCE_CHALLENGE
};
#define OTHER_TEAM(a) (a == TEAM_ALLIANCE ? TEAM_HORDE : TEAM_ALLIANCE)
diff --git a/src/server/game/OutdoorPvP/OutdoorPvPMgr.cpp b/src/server/game/OutdoorPvP/OutdoorPvPMgr.cpp
index 5ada88cdf7a..ce987e25eed 100755
--- a/src/server/game/OutdoorPvP/OutdoorPvPMgr.cpp
+++ b/src/server/game/OutdoorPvP/OutdoorPvPMgr.cpp
@@ -46,8 +46,7 @@ void OutdoorPvPMgr::InitOutdoorPvP()
if (!result)
{
- sLog->outError(LOG_FILTER_SQL, ">> Loaded 0 outdoor PvP definitions. DB table `outdoorpvp_template` is empty.");
-
+ sLog->outError(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 outdoor PvP definitions. DB table `outdoorpvp_template` is empty.");
return;
}
@@ -106,8 +105,7 @@ void OutdoorPvPMgr::InitOutdoorPvP()
m_OutdoorPvPSet.push_back(pvp);
}
- sLog->outInfo(LOG_FILTER_OUTDOORPVP, ">> Loaded %u outdoor PvP definitions in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
-
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u outdoor PvP definitions in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
}
void OutdoorPvPMgr::AddZone(uint32 zoneid, OutdoorPvP* handle)
diff --git a/src/server/game/Pools/PoolMgr.cpp b/src/server/game/Pools/PoolMgr.cpp
index 6ee70101af7..79e8d47aa94 100755
--- a/src/server/game/Pools/PoolMgr.cpp
+++ b/src/server/game/Pools/PoolMgr.cpp
@@ -571,7 +571,7 @@ void PoolMgr::LoadFromDB()
if (!result)
{
mPoolTemplate.clear();
- sLog->outInfo(LOG_FILTER_POOLSYS, ">> Loaded 0 object pools. DB table `pool_template` is empty.");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 object pools. DB table `pool_template` is empty.");
return;
}
@@ -589,12 +589,12 @@ void PoolMgr::LoadFromDB()
}
while (result->NextRow());
- sLog->outInfo(LOG_FILTER_POOLSYS, ">> Loaded %u objects pools in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u objects pools in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
}
// Creatures
- sLog->outInfo(LOG_FILTER_POOLSYS, "Loading Creatures Pooling Data...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Creatures Pooling Data...");
{
uint32 oldMSTime = getMSTime();
@@ -603,7 +603,7 @@ void PoolMgr::LoadFromDB()
if (!result)
{
- sLog->outInfo(LOG_FILTER_POOLSYS, ">> Loaded 0 creatures in pools. DB table `pool_creature` is empty.");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 creatures in pools. DB table `pool_creature` is empty.");
}
else
{
@@ -644,13 +644,13 @@ void PoolMgr::LoadFromDB()
}
while (result->NextRow());
- sLog->outInfo(LOG_FILTER_POOLSYS, ">> Loaded %u creatures in pools in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u creatures in pools in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
}
}
// Gameobjects
- sLog->outInfo(LOG_FILTER_POOLSYS, "Loading Gameobject Pooling Data...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Gameobject Pooling Data...");
{
uint32 oldMSTime = getMSTime();
@@ -659,7 +659,7 @@ void PoolMgr::LoadFromDB()
if (!result)
{
- sLog->outInfo(LOG_FILTER_POOLSYS, ">> Loaded 0 gameobjects in pools. DB table `pool_gameobject` is empty.");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 gameobjects in pools. DB table `pool_gameobject` is empty.");
}
else
{
@@ -712,13 +712,13 @@ void PoolMgr::LoadFromDB()
}
while (result->NextRow());
- sLog->outInfo(LOG_FILTER_POOLSYS, ">> Loaded %u gameobject in pools in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u gameobject in pools in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
}
}
// Pool of pools
- sLog->outInfo(LOG_FILTER_POOLSYS, "Loading Mother Pooling Data...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Mother Pooling Data...");
{
uint32 oldMSTime = getMSTime();
@@ -727,7 +727,7 @@ void PoolMgr::LoadFromDB()
if (!result)
{
- sLog->outInfo(LOG_FILTER_POOLSYS, ">> Loaded 0 pools in pools");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 pools in pools");
}
else
{
@@ -796,11 +796,11 @@ void PoolMgr::LoadFromDB()
}
}
- sLog->outInfo(LOG_FILTER_POOLSYS, ">> Loaded %u pools in mother pools in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u pools in mother pools in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
}
}
- sLog->outInfo(LOG_FILTER_POOLSYS, "Loading Quest Pooling Data...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Quest Pooling Data...");
{
uint32 oldMSTime = getMSTime();
@@ -809,7 +809,7 @@ void PoolMgr::LoadFromDB()
if (!result)
{
- sLog->outInfo(LOG_FILTER_POOLSYS, ">> Loaded 0 quests in pools");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 quests in pools");
}
else
{
@@ -884,12 +884,12 @@ void PoolMgr::LoadFromDB()
}
while (result->NextRow());
- sLog->outInfo(LOG_FILTER_POOLSYS, ">> Loaded %u quests in pools in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u quests in pools in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
}
}
// The initialize method will spawn all pools not in an event and not in another pool, this is why there is 2 left joins with 2 null checks
- sLog->outInfo(LOG_FILTER_POOLSYS, "Starting objects pooling system...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Starting objects pooling system...");
{
uint32 oldMSTime = getMSTime();
@@ -899,7 +899,7 @@ void PoolMgr::LoadFromDB()
if (!result)
{
- sLog->outInfo(LOG_FILTER_POOLSYS, ">> Pool handling system initialized, 0 pools spawned.");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Pool handling system initialized, 0 pools spawned.");
}
else
{
diff --git a/src/server/game/Quests/QuestDef.cpp b/src/server/game/Quests/QuestDef.cpp
index 9221da53003..b58011efe42 100755
--- a/src/server/game/Quests/QuestDef.cpp
+++ b/src/server/game/Quests/QuestDef.cpp
@@ -238,10 +238,11 @@ uint32 Quest::CalculateHonorGain(uint8 level) const
if (GetRewHonorAddition() > 0 || GetRewHonorMultiplier() > 0.0f)
{
// values stored from 0.. for 1...
- TeamContributionPointsEntry const* tc = sTeamContributionPointsStore.LookupEntry(level-1);
+ TeamContributionPointsEntry const* tc = sTeamContributionPointsStore.LookupEntry(level);
if (!tc)
return 0;
- honor = uint32(tc->value * GetRewHonorMultiplier() * 0.1000000014901161);
+
+ honor = uint32(tc->value * GetRewHonorMultiplier() * 0.1f);
honor += GetRewHonorAddition();
}
diff --git a/src/server/game/Quests/QuestDef.h b/src/server/game/Quests/QuestDef.h
index 7f22b441afe..5a8891d888c 100755
--- a/src/server/game/Quests/QuestDef.h
+++ b/src/server/game/Quests/QuestDef.h
@@ -90,7 +90,7 @@ enum __QuestTradeSkill
QUEST_TRSKILL_MINING = 11,
QUEST_TRSKILL_FISHING = 12,
QUEST_TRSKILL_SKINNING = 13,
- QUEST_TRSKILL_JEWELCRAFTING = 14,
+ QUEST_TRSKILL_JEWELCRAFTING = 14
};
enum QuestStatus
@@ -158,7 +158,7 @@ enum __QuestFlags
QUEST_TRINITY_FLAGS_SPEAKTO = 0x08000000, // Internal flag computed only
QUEST_TRINITY_FLAGS_KILL_OR_CAST = 0x10000000, // Internal flag computed only
QUEST_TRINITY_FLAGS_TIMED = 0x20000000, // Internal flag computed only
- QUEST_TRINITY_FLAGS_PLAYER_KILL = 0x40000000, // Internal flag computed only
+ QUEST_TRINITY_FLAGS_PLAYER_KILL = 0x40000000 // Internal flag computed only
};
struct QuestLocale
@@ -194,7 +194,7 @@ class Quest
int32 GetZoneOrSort() const { return ZoneOrSort; }
uint32 GetMinLevel() const { return MinLevel; }
uint32 GetMaxLevel() const { return MaxLevel; }
- uint32 GetQuestLevel() const { return Level; }
+ int32 GetQuestLevel() const { return Level; }
uint32 GetType() const { return Type; }
uint32 GetRequiredClasses() const { return RequiredClasses; }
uint32 GetRequiredRaces() const { return RequiredRaces; }
diff --git a/src/server/game/Reputation/ReputationMgr.h b/src/server/game/Reputation/ReputationMgr.h
index a073845ea73..f950cbb82c2 100755
--- a/src/server/game/Reputation/ReputationMgr.h
+++ b/src/server/game/Reputation/ReputationMgr.h
@@ -65,7 +65,7 @@ class ReputationMgr
{
public: // constructors and global modifiers
explicit ReputationMgr(Player* owner) : _player(owner),
- _visibleFactionCount(0), _honoredFactionCount(0), _reveredFactionCount(0), _exaltedFactionCount(0) {}
+ _visibleFactionCount(0), _honoredFactionCount(0), _reveredFactionCount(0), _exaltedFactionCount(0), _sendFactionIncreased(false) {}
~ReputationMgr() {}
void SaveToDB(SQLTransaction& trans);
diff --git a/src/server/game/Scripting/ScriptLoader.cpp b/src/server/game/Scripting/ScriptLoader.cpp
index 319fd1eb702..fc56106ab6f 100755
--- a/src/server/game/Scripting/ScriptLoader.cpp
+++ b/src/server/game/Scripting/ScriptLoader.cpp
@@ -47,8 +47,10 @@ void AddSC_SmartSCripts();
void AddSC_account_commandscript();
void AddSC_achievement_commandscript();
void AddSC_ban_commandscript();
+void AddSC_bf_commandscript();
void AddSC_cast_commandscript();
void AddSC_character_commandscript();
+void AddSC_cheat_commandscript();
void AddSC_debug_commandscript();
void AddSC_disable_commandscript();
void AddSC_event_commandscript();
@@ -323,6 +325,7 @@ void AddSC_bug_trio();
void AddSC_boss_sartura();
void AddSC_boss_skeram();
void AddSC_boss_twinemperors();
+void AddSC_boss_ouro();
void AddSC_mob_anubisath_sentinel();
void AddSC_instance_temple_of_ahnqiraj();
void AddSC_wailing_caverns(); //Wailing caverns
@@ -508,6 +511,7 @@ void AddSC_howling_fjord();
void AddSC_icecrown();
void AddSC_sholazar_basin();
void AddSC_storm_peaks();
+void AddSC_wintergrasp();
void AddSC_zuldrak();
void AddSC_crystalsong_forest();
void AddSC_isle_of_conquest();
@@ -661,8 +665,10 @@ void AddCommandScripts()
AddSC_account_commandscript();
AddSC_achievement_commandscript();
AddSC_ban_commandscript();
+ AddSC_bf_commandscript();
AddSC_cast_commandscript();
AddSC_character_commandscript();
+ AddSC_cheat_commandscript();
AddSC_debug_commandscript();
AddSC_disable_commandscript();
AddSC_event_commandscript();
@@ -948,6 +954,7 @@ void AddKalimdorScripts()
AddSC_boss_sartura();
AddSC_boss_skeram();
AddSC_boss_twinemperors();
+ AddSC_boss_ouro();
AddSC_mob_anubisath_sentinel();
AddSC_instance_temple_of_ahnqiraj();
AddSC_wailing_caverns(); //Wailing caverns
@@ -1224,6 +1231,7 @@ void AddNorthrendScripts()
AddSC_icecrown();
AddSC_sholazar_basin();
AddSC_storm_peaks();
+ AddSC_wintergrasp();
AddSC_zuldrak();
AddSC_crystalsong_forest();
AddSC_isle_of_conquest();
diff --git a/src/server/game/Scripting/ScriptMgr.cpp b/src/server/game/Scripting/ScriptMgr.cpp
index f5adf67a9ab..47ce6c17b28 100755
--- a/src/server/game/Scripting/ScriptMgr.cpp
+++ b/src/server/game/Scripting/ScriptMgr.cpp
@@ -251,13 +251,12 @@ void ScriptMgr::Initialize()
LoadDatabase();
- sLog->outInfo(LOG_FILTER_TSCR, "Loading C++ scripts");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading C++ scripts");
FillSpellSummary();
AddScripts();
- sLog->outInfo(LOG_FILTER_TSCR, ">> Loaded %u C++ scripts in %u ms", GetScriptCount(), GetMSTimeDiffToNow(oldMSTime));
-
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u C++ scripts in %u ms", GetScriptCount(), GetMSTimeDiffToNow(oldMSTime));
}
void ScriptMgr::Unload()
@@ -854,6 +853,14 @@ CreatureAI* ScriptMgr::GetCreatureAI(Creature* creature)
return tmpscript->GetAI(creature);
}
+GameObjectAI* ScriptMgr::GetGameObjectAI(GameObject* gameobject)
+{
+ ASSERT(gameobject);
+
+ GET_SCRIPT_RET(GameObjectScript, gameobject->GetScriptId(), tmpscript, NULL);
+ return tmpscript->GetAI(gameobject);
+}
+
void ScriptMgr::OnCreatureUpdate(Creature* creature, uint32 diff)
{
ASSERT(creature);
@@ -973,14 +980,6 @@ bool ScriptMgr::OnDummyEffect(Unit* caster, uint32 spellId, SpellEffIndex effInd
return tmpscript->OnDummyEffect(caster, spellId, effIndex, target);
}
-GameObjectAI* ScriptMgr::GetGameObjectAI(GameObject* go)
-{
- ASSERT(go);
-
- GET_SCRIPT_RET(GameObjectScript, go->GetScriptId(), tmpscript, NULL);
- return tmpscript->GetAI(go);
-}
-
bool ScriptMgr::OnAreaTrigger(Player* player, AreaTriggerEntry const* trigger)
{
ASSERT(player);
diff --git a/src/server/game/Scripting/ScriptMgr.h b/src/server/game/Scripting/ScriptMgr.h
index 3c2ee81afff..270182509f9 100755
--- a/src/server/game/Scripting/ScriptMgr.h
+++ b/src/server/game/Scripting/ScriptMgr.h
@@ -164,7 +164,7 @@ class ScriptObject
protected:
ScriptObject(const char* name)
- : _name(std::string(name))
+ : _name(name)
{
}
diff --git a/src/server/game/Scripting/ScriptSystem.cpp b/src/server/game/Scripting/ScriptSystem.cpp
index f24b01306c5..41b41b91808 100755
--- a/src/server/game/Scripting/ScriptSystem.cpp
+++ b/src/server/game/Scripting/ScriptSystem.cpp
@@ -25,10 +25,10 @@ ScriptPointVector const SystemMgr::_empty;
void SystemMgr::LoadScriptTexts()
{
- sLog->outInfo(LOG_FILTER_TSCR, "TSCR: Loading Script Texts...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Script Texts...");
LoadTrinityStrings("script_texts", TEXT_SOURCE_RANGE, 1+(TEXT_SOURCE_RANGE*2));
- sLog->outInfo(LOG_FILTER_TSCR, "TSCR: Loading Script Texts additional data...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Script Texts additional data...");
uint32 oldMSTime = getMSTime();
// 0 1 2 3
@@ -36,8 +36,7 @@ void SystemMgr::LoadScriptTexts()
if (!result)
{
- sLog->outInfo(LOG_FILTER_TSCR, ">> Loaded 0 additional Script Texts data. DB table `script_texts` is empty.");
-
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 additional Script Texts data. DB table `script_texts` is empty.");
return;
}
@@ -83,23 +82,21 @@ void SystemMgr::LoadScriptTexts()
}
while (result->NextRow());
- sLog->outInfo(LOG_FILTER_TSCR, ">> Loaded %u additional Script Texts data in %u ms", uiCount, GetMSTimeDiffToNow(oldMSTime));
-
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u additional Script Texts data in %u ms", uiCount, GetMSTimeDiffToNow(oldMSTime));
}
void SystemMgr::LoadScriptTextsCustom()
{
- sLog->outInfo(LOG_FILTER_TSCR, "TSCR: Loading Custom Texts...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Custom Texts...");
LoadTrinityStrings("custom_texts", TEXT_SOURCE_RANGE*2, 1+(TEXT_SOURCE_RANGE*3));
- sLog->outInfo(LOG_FILTER_TSCR, "TSCR: Loading Custom Texts additional data...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Custom Texts additional data...");
QueryResult result = WorldDatabase.Query("SELECT entry, sound, type, language, emote FROM custom_texts");
if (!result)
{
- sLog->outInfo(LOG_FILTER_TSCR, ">> Loaded 0 additional Custom Texts data. DB table `custom_texts` is empty.");
-
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 additional Custom Texts data. DB table `custom_texts` is empty.");
return;
}
@@ -145,8 +142,7 @@ void SystemMgr::LoadScriptTextsCustom()
}
while (result->NextRow());
- sLog->outInfo(LOG_FILTER_TSCR, ">> Loaded %u additional Custom Texts data.", uiCount);
-
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u additional Custom Texts data.", uiCount);
}
void SystemMgr::LoadScriptWaypoints()
@@ -163,15 +159,14 @@ void SystemMgr::LoadScriptWaypoints()
if (result)
uiCreatureCount = result->GetRowCount();
- sLog->outInfo(LOG_FILTER_TSCR, "TSCR: Loading Script Waypoints for " UI64FMTD " creature(s)...", uiCreatureCount);
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Script Waypoints for " UI64FMTD " creature(s)...", uiCreatureCount);
// 0 1 2 3 4 5
result = WorldDatabase.Query("SELECT entry, pointid, location_x, location_y, location_z, waittime FROM script_waypoint ORDER BY pointid");
if (!result)
{
- sLog->outInfo(LOG_FILTER_TSCR, ">> Loaded 0 Script Waypoints. DB table `script_waypoint` is empty.");
-
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 Script Waypoints. DB table `script_waypoint` is empty.");
return;
}
@@ -206,6 +201,5 @@ void SystemMgr::LoadScriptWaypoints()
}
while (result->NextRow());
- sLog->outInfo(LOG_FILTER_TSCR, ">> Loaded %u Script Waypoint nodes in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
-
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u Script Waypoint nodes in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
}
diff --git a/src/server/game/Server/Protocol/Opcodes.cpp b/src/server/game/Server/Protocol/Opcodes.cpp
index 8fb8ea0298b..a229d3ed536 100755
--- a/src/server/game/Server/Protocol/Opcodes.cpp
+++ b/src/server/game/Server/Protocol/Opcodes.cpp
@@ -1273,15 +1273,15 @@ OpcodeHandler opcodeTable[NUM_MSG_TYPES] =
/*0x4DC*/ { "SMSG_PVP_QUEUE_STATS", STATUS_NEVER, PROCESS_INPLACE, &WorldSession::Handle_ServerSide },
/*0x4DD*/ { "CMSG_SET_PAID_SERVICE_CHEAT", STATUS_NEVER, PROCESS_INPLACE, &WorldSession::Handle_NULL },
/*0x4DE*/ { "SMSG_BATTLEFIELD_MGR_ENTRY_INVITE", STATUS_NEVER, PROCESS_INPLACE, &WorldSession::Handle_ServerSide },
- /*0x4DF*/ { "CMSG_BATTLEFIELD_MGR_ENTRY_INVITE_RESPONSE", STATUS_NEVER, PROCESS_INPLACE, &WorldSession::Handle_NULL },
+ /*0x4DF*/ { "CMSG_BATTLEFIELD_MGR_ENTRY_INVITE_RESPONSE", STATUS_LOGGEDIN, PROCESS_INPLACE, &WorldSession::HandleBfEntryInviteResponse },
/*0x4E0*/ { "SMSG_BATTLEFIELD_MGR_ENTERED", STATUS_NEVER, PROCESS_INPLACE, &WorldSession::Handle_ServerSide },
/*0x4E1*/ { "SMSG_BATTLEFIELD_MGR_QUEUE_INVITE", STATUS_NEVER, PROCESS_INPLACE, &WorldSession::Handle_ServerSide },
- /*0x4E2*/ { "CMSG_BATTLEFIELD_MGR_QUEUE_INVITE_RESPONSE", STATUS_NEVER, PROCESS_INPLACE, &WorldSession::Handle_NULL },
+ /*0x4E2*/ { "CMSG_BATTLEFIELD_MGR_QUEUE_INVITE_RESPONSE", STATUS_LOGGEDIN, PROCESS_INPLACE, &WorldSession::HandleBfQueueInviteResponse },
/*0x4E3*/ { "CMSG_BATTLEFIELD_MGR_QUEUE_REQUEST", STATUS_NEVER, PROCESS_INPLACE, &WorldSession::Handle_NULL },
/*0x4E4*/ { "SMSG_BATTLEFIELD_MGR_QUEUE_REQUEST_RESPONSE", STATUS_NEVER, PROCESS_INPLACE, &WorldSession::Handle_ServerSide },
/*0x4E5*/ { "SMSG_BATTLEFIELD_MGR_EJECT_PENDING", STATUS_NEVER, PROCESS_INPLACE, &WorldSession::Handle_ServerSide },
/*0x4E6*/ { "SMSG_BATTLEFIELD_MGR_EJECTED", STATUS_NEVER, PROCESS_INPLACE, &WorldSession::Handle_ServerSide },
- /*0x4E7*/ { "CMSG_BATTLEFIELD_MGR_EXIT_REQUEST", STATUS_NEVER, PROCESS_INPLACE, &WorldSession::Handle_NULL },
+ /*0x4E7*/ { "CMSG_BATTLEFIELD_MGR_EXIT_REQUEST", STATUS_LOGGEDIN, PROCESS_INPLACE, &WorldSession::HandleBfExitRequest },
/*0x4E8*/ { "SMSG_BATTLEFIELD_MGR_STATE_CHANGE", STATUS_NEVER, PROCESS_INPLACE, &WorldSession::Handle_ServerSide },
/*0x4E9*/ { "CMSG_BATTLEFIELD_MANAGER_ADVANCE_STATE", STATUS_NEVER, PROCESS_INPLACE, &WorldSession::Handle_NULL },
/*0x4EA*/ { "CMSG_BATTLEFIELD_MANAGER_SET_NEXT_TRANSITION_TIME", STATUS_NEVER, PROCESS_INPLACE, &WorldSession::Handle_NULL },
diff --git a/src/server/game/Server/Protocol/Opcodes.h b/src/server/game/Server/Protocol/Opcodes.h
index 65e7b3597ce..625ee88a853 100755
--- a/src/server/game/Server/Protocol/Opcodes.h
+++ b/src/server/game/Server/Protocol/Opcodes.h
@@ -1356,7 +1356,7 @@ enum SessionStatus
STATUS_TRANSFER, // Player transferring to another map (_player != NULL, m_GUID == _player->GetGUID(), !inWorld())
STATUS_LOGGEDIN_OR_RECENTLY_LOGGOUT, // _player != NULL or _player == NULL && m_playerRecentlyLogout && m_playerLogout, m_GUID store last _player guid)
STATUS_NEVER, // Opcode not accepted from client (deprecated or server side only)
- STATUS_UNHANDLED, // Opcode not handled yet
+ STATUS_UNHANDLED // Opcode not handled yet
};
enum PacketProcessing
@@ -1385,5 +1385,13 @@ inline const char* LookupOpcodeName(uint16 id)
return "Received unknown opcode, it's more than max!";
return opcodeTable[id].name;
}
+
+inline std::string GetOpcodeNameForLogging(uint16 opcode)
+{
+ std::ostringstream ss;
+ ss << '[' << LookupOpcodeName(opcode) << " 0x" << std::hex << std::uppercase << opcode << std::nouppercase << " (" << std::dec << opcode << ")]";
+ return ss.str();
+}
+
#endif
/// @}
diff --git a/src/server/game/Server/Protocol/PacketLog.cpp b/src/server/game/Server/Protocol/PacketLog.cpp
new file mode 100644
index 00000000000..cb6dcdbdb9e
--- /dev/null
+++ b/src/server/game/Server/Protocol/PacketLog.cpp
@@ -0,0 +1,62 @@
+/*
+ * Copyright (C) 2008-2012 TrinityCore <http://www.trinitycore.org/>
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation; either version 2 of the License, or (at your
+ * option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
+ * more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#include "PacketLog.h"
+#include "Config.h"
+#include "ByteBuffer.h"
+#include "WorldPacket.h"
+
+PacketLog::PacketLog() : _file(NULL)
+{
+ Initialize();
+}
+
+PacketLog::~PacketLog()
+{
+ if (_file)
+ fclose(_file);
+
+ _file = NULL;
+}
+
+void PacketLog::Initialize()
+{
+ std::string logsDir = ConfigMgr::GetStringDefault("LogsDir", "");
+
+ if (!logsDir.empty())
+ if ((logsDir.at(logsDir.length()-1) != '/') && (logsDir.at(logsDir.length()-1) != '\\'))
+ logsDir.push_back('/');
+
+ std::string logname = ConfigMgr::GetStringDefault("PacketLogFile", "");
+ if (!logname.empty())
+ _file = fopen((logsDir + logname).c_str(), "wb");
+}
+
+void PacketLog::LogPacket(WorldPacket const& packet, Direction direction)
+{
+ ByteBuffer data(4+4+4+1+packet.size());
+ data << int32(packet.GetOpcode());
+ data << int32(packet.size());
+ data << uint32(time(NULL));
+ data << uint8(direction);
+
+ for (uint32 i = 0; i < packet.size(); i++)
+ data << const_cast<WorldPacket&>(packet)[i];
+
+ fwrite(data.contents(), 1, data.size(), _file);
+ fflush(_file);
+}
diff --git a/src/server/game/Server/Protocol/PacketLog.h b/src/server/game/Server/Protocol/PacketLog.h
new file mode 100644
index 00000000000..b899daae198
--- /dev/null
+++ b/src/server/game/Server/Protocol/PacketLog.h
@@ -0,0 +1,50 @@
+/*
+ * Copyright (C) 2008-2012 TrinityCore <http://www.trinitycore.org/>
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation; either version 2 of the License, or (at your
+ * option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
+ * more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef TRINITY_PACKETLOG_H
+#define TRINITY_PACKETLOG_H
+
+#include "Common.h"
+#include <ace/Singleton.h>
+
+enum Direction
+{
+ CLIENT_TO_SERVER,
+ SERVER_TO_CLIENT
+};
+
+class WorldPacket;
+
+class PacketLog
+{
+ friend class ACE_Singleton<PacketLog, ACE_Thread_Mutex>;
+
+ private:
+ PacketLog();
+ ~PacketLog();
+
+ public:
+ void Initialize();
+ bool CanLogPacket() const { return (_file != NULL); }
+ void LogPacket(WorldPacket const& packet, Direction direction);
+
+ private:
+ FILE* _file;
+};
+
+#define sPacketLog ACE_Singleton<PacketLog, ACE_Thread_Mutex>::instance()
+#endif
diff --git a/src/server/game/Server/WorldSession.cpp b/src/server/game/Server/WorldSession.cpp
index 6e45ebf37c1..6a2c7e64446 100755
--- a/src/server/game/Server/WorldSession.cpp
+++ b/src/server/game/Server/WorldSession.cpp
@@ -137,16 +137,29 @@ WorldSession::~WorldSession()
LoginDatabase.PExecute("UPDATE account SET online = 0 WHERE id = %u;", GetAccountId()); // One-time query
}
-void WorldSession::SizeError(WorldPacket const& packet, uint32 size) const
-{
- sLog->outError(LOG_FILTER_GENERAL, "Client (account %u) send packet %s (%u) with size " SIZEFMTD " but expected %u (attempt to crash server?), skipped",
- GetAccountId(), LookupOpcodeName(packet.GetOpcode()), packet.GetOpcode(), packet.size(), size);
-}
-
/// Get the player name
-char const* WorldSession::GetPlayerName() const
-{
- return GetPlayer() ? GetPlayer()->GetName() : "<none>";
+std::string WorldSession::GetPlayerName(bool simple /* = true */) const
+ {
+ std::string name = "[Player: ";
+ uint32 guidLow = 0;
+
+ if (Player* player = GetPlayer())
+ {
+ name.append(player->GetName());
+ guidLow = player->GetGUIDLow();
+ }
+ else
+ name.append("<none>");
+
+ if (!simple)
+ {
+ std::ostringstream ss;
+ ss << " (Guid: " << guidLow << ", Account: " << GetAccountId() << ")";
+ name.append(ss.str());
+ }
+
+ name.append("]");
+ return name;
}
/// Get player guid if available. Use for logging purposes only
@@ -208,16 +221,15 @@ void WorldSession::QueuePacket(WorldPacket* new_packet)
/// Logging helper for unexpected opcodes
void WorldSession::LogUnexpectedOpcode(WorldPacket* packet, const char* status, const char *reason)
{
- sLog->outDebug(LOG_FILTER_NETWORKIO, "SESSION (account: %u, guidlow: %u, char: %s): received unexpected opcode %s (0x%.4X, status: %s) %s",
- GetAccountId(), m_GUIDLow, _player ? _player->GetName() : "<none>",
- LookupOpcodeName(packet->GetOpcode()), packet->GetOpcode(), status, reason);
+ sLog->outError(LOG_FILTER_OPCODES, "Received unexpected opcode %s Status: %s Reason: %s from %s",
+ GetOpcodeNameForLogging(packet->GetOpcode()).c_str(), status, reason, GetPlayerName(false).c_str());
}
/// Logging helper for unexpected opcodes
void WorldSession::LogUnprocessedTail(WorldPacket* packet)
{
- sLog->outDebug(LOG_FILTER_NETWORKIO, "SESSION: opcode %s (0x%.4X) have unprocessed tail data (read stop at %u from %u)",
- LookupOpcodeName(packet->GetOpcode()), packet->GetOpcode(), uint32(packet->rpos()), uint32(packet->wpos()));
+ sLog->outError(LOG_FILTER_OPCODES, "Unprocessed tail data (read stop at %u from %u) Opcode %s from %s",
+ uint32(packet->rpos()), uint32(packet->wpos()), GetOpcodeNameForLogging(packet->GetOpcode()).c_str(), GetPlayerName(false).c_str());
packet->print_storage();
}
@@ -250,7 +262,8 @@ bool WorldSession::Update(uint32 diff, PacketFilter& updater)
{
if (packet->GetOpcode() >= NUM_MSG_TYPES)
{
- sLog->outError(LOG_FILTER_GENERAL, "SESSION: received non-existed opcode %s (0x%.4X)", LookupOpcodeName(packet->GetOpcode()), packet->GetOpcode());
+ sLog->outError(LOG_FILTER_OPCODES, "Received non-existed opcode %s from %s", GetOpcodeNameForLogging(packet->GetOpcode()).c_str()
+ , GetPlayerName(false).c_str());
sScriptMgr->OnUnknownPacketReceive(m_Socket, WorldPacket(*packet));
}
else
@@ -275,10 +288,9 @@ bool WorldSession::Update(uint32 diff, PacketFilter& updater)
deletePacket = false;
QueuePacket(packet);
//! Log
- sLog->outDebug(LOG_FILTER_NETWORKIO, "Re-enqueueing packet with opcode %s (0x%.4X) with with status STATUS_LOGGEDIN. "
- "Player is currently not in world yet.", opHandle.name, packet->GetOpcode());
+ sLog->outDebug(LOG_FILTER_NETWORKIO, "Re-enqueueing packet with opcode %s with with status STATUS_LOGGEDIN. "
+ "Player is currently not in world yet.", GetOpcodeNameForLogging(packet->GetOpcode()).c_str());
}
-
}
else if (_player->IsInWorld())
{
@@ -334,14 +346,12 @@ bool WorldSession::Update(uint32 diff, PacketFilter& updater)
LogUnprocessedTail(packet);
break;
case STATUS_NEVER:
- sLog->outDebug(LOG_FILTER_NETWORKIO, "SESSION (account: %u, guidlow: %u, char: %s): received not allowed opcode %s (0x%.4X)",
- GetAccountId(), m_GUIDLow, _player ? _player->GetName() : "<none>",
- LookupOpcodeName(packet->GetOpcode()), packet->GetOpcode());
+ sLog->outError(LOG_FILTER_OPCODES, "Received not allowed opcode %s from %s", GetOpcodeNameForLogging(packet->GetOpcode()).c_str()
+ , GetPlayerName(false).c_str());
break;
case STATUS_UNHANDLED:
- sLog->outDebug(LOG_FILTER_NETWORKIO, "SESSION (account: %u, guidlow: %u, char: %s): received not handled opcode %s (0x%.4X)",
- GetAccountId(), m_GUIDLow, _player ? _player->GetName() : "<none>",
- LookupOpcodeName(packet->GetOpcode()), packet->GetOpcode());
+ sLog->outDebug(LOG_FILTER_OPCODES, "Received not handled opcode %s from %s", GetOpcodeNameForLogging(packet->GetOpcode()).c_str()
+ , GetPlayerName(false).c_str());
break;
}
}
@@ -349,7 +359,6 @@ bool WorldSession::Update(uint32 diff, PacketFilter& updater)
{
sLog->outError(LOG_FILTER_GENERAL, "WorldSession::Update ByteBufferException occured while parsing a packet (opcode: %u) from client %s, accountid=%i. Skipped packet.",
packet->GetOpcode(), GetRemoteAddress().c_str(), GetAccountId());
- sLog->outTrace(LOG_FILTER_NETWORKIO, "Dumping error causing packet:");
packet->hexlike();
}
}
@@ -534,7 +543,7 @@ void WorldSession::LogoutPlayer(bool Save)
// e.g if he got disconnected during a transfer to another map
// calls to GetMap in this case may cause crashes
_player->CleanupsBeforeDelete();
- sLog->outDebug(LOG_FILTER_PLAYER, "Account: %d (IP: %s) Logout Character:[%s] (GUID: %u) Level: %d", GetAccountId(), GetRemoteAddress().c_str(), _player->GetName(), _player->GetGUIDLow(), _player->getLevel());
+ sLog->outInfo(LOG_FILTER_CHARACTER, "Account: %d (IP: %s) Logout Character:[%s] (GUID: %u) Level: %d", GetAccountId(), GetRemoteAddress().c_str(), _player->GetName(), _player->GetGUIDLow(), _player->getLevel());
if (Map* _map = _player->FindMap())
_map->RemovePlayerFromMap(_player, true);
@@ -607,30 +616,26 @@ const char *WorldSession::GetTrinityString(int32 entry) const
void WorldSession::Handle_NULL(WorldPacket& recvPacket)
{
- sLog->outError(LOG_FILTER_GENERAL, "SESSION: received unhandled opcode %s (0x%.4X)",
- LookupOpcodeName(recvPacket.GetOpcode()),
- recvPacket.GetOpcode());
+ sLog->outError(LOG_FILTER_OPCODES, "Received unhandled opcode %s from %s"
+ , GetOpcodeNameForLogging(recvPacket.GetOpcode()).c_str(), GetPlayerName(false).c_str());
}
void WorldSession::Handle_EarlyProccess(WorldPacket& recvPacket)
{
- sLog->outError(LOG_FILTER_GENERAL, "SESSION: received opcode %s (0x%.4X) that must be processed in WorldSocket::OnRead",
- LookupOpcodeName(recvPacket.GetOpcode()),
- recvPacket.GetOpcode());
+ sLog->outError(LOG_FILTER_OPCODES, "Received opcode %s that must be processed in WorldSocket::OnRead from %s"
+ , GetOpcodeNameForLogging(recvPacket.GetOpcode()).c_str(), GetPlayerName(false).c_str());
}
void WorldSession::Handle_ServerSide(WorldPacket& recvPacket)
{
- sLog->outError(LOG_FILTER_GENERAL, "SESSION: received server-side opcode %s (0x%.4X)",
- LookupOpcodeName(recvPacket.GetOpcode()),
- recvPacket.GetOpcode());
+ sLog->outError(LOG_FILTER_OPCODES, "Received server-side opcode %s from %s"
+ , GetOpcodeNameForLogging(recvPacket.GetOpcode()).c_str(), GetPlayerName(false).c_str());
}
void WorldSession::Handle_Deprecated(WorldPacket& recvPacket)
{
- sLog->outError(LOG_FILTER_GENERAL, "SESSION: received deprecated opcode %s (0x%.4X)",
- LookupOpcodeName(recvPacket.GetOpcode()),
- recvPacket.GetOpcode());
+ sLog->outError(LOG_FILTER_OPCODES, "Received deprecated opcode %s from %s"
+ , GetOpcodeNameForLogging(recvPacket.GetOpcode()).c_str(), GetPlayerName(false).c_str());
}
void WorldSession::SendAuthWaitQue(uint32 position)
diff --git a/src/server/game/Server/WorldSession.h b/src/server/game/Server/WorldSession.h
index b8b09531082..bc9e6ac4298 100755
--- a/src/server/game/Server/WorldSession.h
+++ b/src/server/game/Server/WorldSession.h
@@ -68,7 +68,7 @@ enum AccountDataType
GLOBAL_MACROS_CACHE = 4, // 0x10 g
PER_CHARACTER_MACROS_CACHE = 5, // 0x20 p
PER_CHARACTER_LAYOUT_CACHE = 6, // 0x40 p
- PER_CHARACTER_CHAT_CACHE = 7, // 0x80 p
+ PER_CHARACTER_CHAT_CACHE = 7 // 0x80 p
};
#define NUM_ACCOUNT_DATA_TYPES 8
@@ -125,6 +125,16 @@ enum PartyResult
ERR_PARTY_LFG_TELEPORT_IN_COMBAT = 30
};
+
+enum BFLeaveReason
+{
+ BF_LEAVE_REASON_CLOSE = 0x00000001,
+ //BF_LEAVE_REASON_UNK1 = 0x00000002, (not used)
+ //BF_LEAVE_REASON_UNK2 = 0x00000004, (not used)
+ BF_LEAVE_REASON_EXITED = 0x00000008,
+ BF_LEAVE_REASON_LOW_LEVEL = 0x00000010
+};
+
enum ChatRestrictionType
{
ERR_CHAT_RESTRICTED = 0,
@@ -223,8 +233,6 @@ class WorldSession
bool PlayerLogoutWithSave() const { return m_playerLogout && m_playerSave; }
bool PlayerRecentlyLoggedOut() const { return m_playerRecentlyLogout; }
- void SizeError(WorldPacket const& packet, uint32 size) const;
-
void ReadAddonsInfo(WorldPacket& data);
void SendAddonsInfo();
@@ -246,7 +254,7 @@ class WorldSession
AccountTypes GetSecurity() const { return _security; }
uint32 GetAccountId() const { return _accountId; }
Player* GetPlayer() const { return _player; }
- char const* GetPlayerName() const;
+ std::string GetPlayerName(bool simple = true) const;
uint32 GetGuidLow() const;
void SetSecurity(AccountTypes security) { _security = security; }
std::string const& GetRemoteAddress() { return m_Address; }
@@ -786,7 +794,16 @@ class WorldSession
void HandleResetInstancesOpcode(WorldPacket& recv_data);
void HandleHearthAndResurrect(WorldPacket& recv_data);
void HandleInstanceLockResponse(WorldPacket& recvPacket);
- void HandleUpdateMissileTrajectory(WorldPacket& recvPacket);
+
+ // Battlefield
+ void SendBfInvitePlayerToWar(uint32 BattleId,uint32 ZoneId,uint32 time);
+ void SendBfInvitePlayerToQueue(uint32 BattleId);
+ void SendBfQueueInviteResponse(uint32 BattleId,uint32 ZoneId, bool CanQueue = true, bool Full = false);
+ void SendBfEntered(uint32 BattleId);
+ void SendBfLeaveMessage(uint32 BattleId, BFLeaveReason reason = BF_LEAVE_REASON_EXITED);
+ void HandleBfQueueInviteResponse(WorldPacket &recv_data);
+ void HandleBfEntryInviteResponse(WorldPacket &recv_data);
+ void HandleBfExitRequest(WorldPacket &recv_data);
// Looking for Dungeon/Raid
void HandleLfgSetCommentOpcode(WorldPacket& recv_data);
@@ -914,6 +931,7 @@ class WorldSession
void HandleEjectPassenger(WorldPacket& data);
void HandleEnterPlayerVehicle(WorldPacket& data);
void HandleUpdateProjectilePosition(WorldPacket& recvPacket);
+ void HandleUpdateMissileTrajectory(WorldPacket& recvPacket);
private:
void InitializeQueryCallbackParameters();
diff --git a/src/server/game/Server/WorldSocket.cpp b/src/server/game/Server/WorldSocket.cpp
index 5b04c3dc714..92455f8edfe 100755
--- a/src/server/game/Server/WorldSocket.cpp
+++ b/src/server/game/Server/WorldSocket.cpp
@@ -42,6 +42,7 @@
#include "WorldSession.h"
#include "WorldSocketMgr.h"
#include "Log.h"
+#include "PacketLog.h"
#include "ScriptMgr.h"
#include "AccountMgr.h"
@@ -159,30 +160,8 @@ int WorldSocket::SendPacket(WorldPacket const& pct)
return -1;
// Dump outgoing packet.
- if (sLog->ShouldLog(LOG_FILTER_NETWORKIO, LOG_LEVEL_TRACE))
- {
- char buff[250];
- snprintf(buff, 250, "SERVER:\nSOCKET: %u\nLENGTH: %u\nOPCODE: %s (0x%.4X)\nDATA:\n",
- uint32(get_handle()),
- uint32(pct.size()),
- LookupOpcodeName (pct.GetOpcode()),
- pct.GetOpcode());
-
- std::string data(buff);
- uint32 p = 0;
- while (p < pct.size())
- {
- for (uint32 j = 0; j < 16 && p < pct.size(); j++)
- {
- snprintf(buff, 250, "%.2X ", const_cast<WorldPacket&>(pct)[p++]);
- data.append(buff);
- }
- data.append("\n");
- }
-
- data.append("\n");
- sLog->outTrace(LOG_FILTER_NETWORKIO, "%s", data.c_str());
- }
+ if (sPacketLog->CanLogPacket())
+ sPacketLog->LogPacket(pct, SERVER_TO_CLIENT);
// Create a copy of the original packet; this is to avoid issues if a hook modifies it.
sScriptMgr->OnPacketSend(this, WorldPacket(pct));
@@ -214,7 +193,7 @@ int WorldSocket::SendPacket(WorldPacket const& pct)
if (msg_queue()->enqueue_tail(mb, (ACE_Time_Value*)&ACE_Time_Value::zero) == -1)
{
- sLog->outError(LOG_FILTER_GENERAL, "WorldSocket::SendPacket enqueue_tail failed");
+ sLog->outError(LOG_FILTER_NETWORKIO, "WorldSocket::SendPacket enqueue_tail failed");
mb->release();
return -1;
}
@@ -257,7 +236,7 @@ int WorldSocket::open (void *a)
if (peer().get_remote_addr(remote_addr) == -1)
{
- sLog->outError(LOG_FILTER_GENERAL, "WorldSocket::open: peer().get_remote_addr errno = %s", ACE_OS::strerror (errno));
+ sLog->outError(LOG_FILTER_NETWORKIO, "WorldSocket::open: peer().get_remote_addr errno = %s", ACE_OS::strerror (errno));
return -1;
}
@@ -282,7 +261,7 @@ int WorldSocket::open (void *a)
// Register with ACE Reactor
if (reactor()->register_handler(this, ACE_Event_Handler::READ_MASK | ACE_Event_Handler::WRITE_MASK) == -1)
{
- sLog->outError(LOG_FILTER_GENERAL, "WorldSocket::open: unable to register client handler errno = %s", ACE_OS::strerror (errno));
+ sLog->outError(LOG_FILTER_NETWORKIO, "WorldSocket::open: unable to register client handler errno = %s", ACE_OS::strerror (errno));
return -1;
}
@@ -318,14 +297,14 @@ int WorldSocket::handle_input (ACE_HANDLE)
return Update(); // interesting line, isn't it ?
}
- sLog->outDebug(LOG_FILTER_GENERAL, "WorldSocket::handle_input: Peer error closing connection errno = %s", ACE_OS::strerror (errno));
+ sLog->outDebug(LOG_FILTER_NETWORKIO, "WorldSocket::handle_input: Peer error closing connection errno = %s", ACE_OS::strerror (errno));
errno = ECONNRESET;
return -1;
}
case 0:
{
- sLog->outDebug(LOG_FILTER_GENERAL, "WorldSocket::handle_input: Peer has closed connection");
+ sLog->outDebug(LOG_FILTER_NETWORKIO, "WorldSocket::handle_input: Peer has closed connection");
errno = ECONNRESET;
return -1;
@@ -394,7 +373,7 @@ int WorldSocket::handle_output_queue (GuardType& g)
if (msg_queue()->dequeue_head(mblk, (ACE_Time_Value*)&ACE_Time_Value::zero) == -1)
{
- sLog->outError(LOG_FILTER_GENERAL, "WorldSocket::handle_output_queue dequeue_head");
+ sLog->outError(LOG_FILTER_NETWORKIO, "WorldSocket::handle_output_queue dequeue_head");
return -1;
}
@@ -429,7 +408,7 @@ int WorldSocket::handle_output_queue (GuardType& g)
if (msg_queue()->enqueue_head(mblk, (ACE_Time_Value*) &ACE_Time_Value::zero) == -1)
{
- sLog->outError(LOG_FILTER_GENERAL, "WorldSocket::handle_output_queue enqueue_head");
+ sLog->outError(LOG_FILTER_NETWORKIO, "WorldSocket::handle_output_queue enqueue_head");
mblk->release();
return -1;
}
@@ -501,7 +480,7 @@ int WorldSocket::handle_input_header (void)
if ((header.size < 4) || (header.size > 10240) || (header.cmd > 10240))
{
Player* _player = m_Session ? m_Session->GetPlayer() : NULL;
- sLog->outError(LOG_FILTER_GENERAL, "WorldSocket::handle_input_header(): client (account: %u, char [GUID: %u, name: %s]) sent malformed packet (size: %d, cmd: %d)",
+ sLog->outError(LOG_FILTER_NETWORKIO, "WorldSocket::handle_input_header(): client (account: %u, char [GUID: %u, name: %s]) sent malformed packet (size: %d, cmd: %d)",
m_Session ? m_Session->GetAccountId() : 0,
_player ? _player->GetGUIDLow() : 0,
_player ? _player->GetName() : "<none>",
@@ -607,7 +586,7 @@ int WorldSocket::handle_input_missing_data (void)
// hope this is not hack, as proper m_RecvWPct is asserted around
if (!m_RecvWPct)
{
- sLog->outError(LOG_FILTER_GENERAL, "Forcing close on input m_RecvWPct = NULL");
+ sLog->outError(LOG_FILTER_NETWORKIO, "Forcing close on input m_RecvWPct = NULL");
errno = EINVAL;
return -1;
}
@@ -653,7 +632,7 @@ int WorldSocket::cancel_wakeup_output (GuardType& g)
(this, ACE_Event_Handler::WRITE_MASK) == -1)
{
// would be good to store errno from reactor with errno guard
- sLog->outError(LOG_FILTER_GENERAL, "WorldSocket::cancel_wakeup_output");
+ sLog->outError(LOG_FILTER_NETWORKIO, "WorldSocket::cancel_wakeup_output");
return -1;
}
@@ -672,7 +651,7 @@ int WorldSocket::schedule_wakeup_output (GuardType& g)
if (reactor()->schedule_wakeup
(this, ACE_Event_Handler::WRITE_MASK) == -1)
{
- sLog->outError(LOG_FILTER_GENERAL, "WorldSocket::schedule_wakeup_output");
+ sLog->outError(LOG_FILTER_NETWORKIO, "WorldSocket::schedule_wakeup_output");
return -1;
}
@@ -691,30 +670,9 @@ int WorldSocket::ProcessIncoming(WorldPacket* new_pct)
if (closing_)
return -1;
- if (sLog->ShouldLog(LOG_FILTER_NETWORKIO, LOG_LEVEL_TRACE))
- {
- char buff[250];
- snprintf(buff, 250, "CLIENT:\nSOCKET: %u\nLENGTH: %u\nOPCODE: %s (0x%.4X)\nDATA:\n",
- uint32(get_handle()),
- uint32(new_pct->size()),
- LookupOpcodeName (new_pct->GetOpcode()),
- new_pct->GetOpcode());
-
- std::string data(buff);
- uint32 p = 0;
- while (p < new_pct->size())
- {
- for (uint32 j = 0; j < 16 && p < new_pct->size(); j++)
- {
- snprintf(buff, 250, "%.2X ", const_cast<WorldPacket&>(*new_pct)[p++]);
- data.append(buff);
- }
- data.append("\n");
- }
-
- data.append("\n");
- sLog->outTrace(LOG_FILTER_NETWORKIO, "%s", data.c_str());
- }
+ // Dump received packet.
+ if (sPacketLog->CanLogPacket())
+ sPacketLog->LogPacket(*new_pct, CLIENT_TO_SERVER);
try
{
@@ -725,51 +683,44 @@ int WorldSocket::ProcessIncoming(WorldPacket* new_pct)
case CMSG_AUTH_SESSION:
if (m_Session)
{
- sLog->outError(LOG_FILTER_GENERAL, "WorldSocket::ProcessIncoming: Player send CMSG_AUTH_SESSION again");
+ sLog->outError(LOG_FILTER_NETWORKIO, "WorldSocket::ProcessIncoming: received duplicate CMSG_AUTH_SESSION from %s", m_Session->GetPlayerName(false).c_str());
return -1;
}
sScriptMgr->OnPacketReceive(this, WorldPacket(*new_pct));
return HandleAuthSession (*new_pct);
case CMSG_KEEP_ALIVE:
- sLog->outDebug(LOG_FILTER_GENERAL, "CMSG_KEEP_ALIVE, size: " UI64FMTD, uint64(new_pct->size()));
+ sLog->outDebug(LOG_FILTER_NETWORKIO, "%s", GetOpcodeNameForLogging(opcode).c_str());
sScriptMgr->OnPacketReceive(this, WorldPacket(*new_pct));
return 0;
default:
{
ACE_GUARD_RETURN (LockType, Guard, m_SessionLock, -1);
- if (m_Session != NULL)
+ if (!m_Session)
{
- // Our Idle timer will reset on any non PING opcodes.
- // Catches people idling on the login screen and any lingering ingame connections.
- m_Session->ResetTimeOutTime();
-
- // OK, give the packet to WorldSession
- aptr.release();
- // WARNINIG here we call it with locks held.
- // Its possible to cause deadlock if QueuePacket calls back
- m_Session->QueuePacket (new_pct);
- return 0;
- }
- else
- {
- sLog->outError(LOG_FILTER_GENERAL, "WorldSocket::ProcessIncoming: Client not authed opcode = %u", uint32(opcode));
+ sLog->outError(LOG_FILTER_NETWORKIO, "ProcessIncoming: Client not authed opcode = %u", uint32(opcode));
return -1;
}
+
+ // Our Idle timer will reset on any non PING opcodes.
+ // Catches people idling on the login screen and any lingering ingame connections.
+ m_Session->ResetTimeOutTime();
+
+ // OK, give the packet to WorldSession
+ aptr.release();
+ // WARNINIG here we call it with locks held.
+ // Its possible to cause deadlock if QueuePacket calls back
+ m_Session->QueuePacket(new_pct);
+ return 0;
}
}
}
catch (ByteBufferException &)
{
- sLog->outError(LOG_FILTER_GENERAL, "WorldSocket::ProcessIncoming ByteBufferException occured while parsing an instant handled packet (opcode: %u) from client %s, accountid=%i. Disconnected client.",
+ sLog->outError(LOG_FILTER_NETWORKIO, "WorldSocket::ProcessIncoming ByteBufferException occured while parsing an instant handled packet (opcode: %u) from client %s, accountid=%i. Disconnected client.",
opcode, GetRemoteAddress().c_str(), m_Session ? int32(m_Session->GetAccountId()) : -1);
- if (sLog->ShouldLog(LOG_FILTER_NETWORKIO, LOG_LEVEL_DEBUG))
- {
- sLog->outDebug(LOG_FILTER_NETWORKIO, "Dumping error causing packet:");
- new_pct->hexlike();
- }
-
+ new_pct->hexlike();
return -1;
}
@@ -800,7 +751,7 @@ int WorldSocket::HandleAuthSession(WorldPacket& recvPacket)
packet << uint8(AUTH_REJECT);
SendPacket(packet);
- sLog->outError(LOG_FILTER_GENERAL, "WorldSocket::HandleAuthSession: World closed, denying client (%s).", GetRemoteAddress().c_str());
+ sLog->outError(LOG_FILTER_NETWORKIO, "WorldSocket::HandleAuthSession: World closed, denying client (%s).", GetRemoteAddress().c_str());
return -1;
}
@@ -814,7 +765,7 @@ int WorldSocket::HandleAuthSession(WorldPacket& recvPacket)
recvPacket >> unk4;
recvPacket.read(digest, 20);
- sLog->outDebug(LOG_FILTER_GENERAL, "WorldSocket::HandleAuthSession: client %u, unk2 %u, account %s, unk3 %u, clientseed %u",
+ sLog->outDebug(LOG_FILTER_NETWORKIO, "WorldSocket::HandleAuthSession: client %u, unk2 %u, account %s, unk3 %u, clientseed %u",
BuiltNumberClient,
unk2,
account.c_str(),
@@ -836,7 +787,7 @@ int WorldSocket::HandleAuthSession(WorldPacket& recvPacket)
SendPacket(packet);
- sLog->outError(LOG_FILTER_GENERAL, "WorldSocket::HandleAuthSession: Sent Auth Response (unknown account).");
+ sLog->outError(LOG_FILTER_NETWORKIO, "WorldSocket::HandleAuthSession: Sent Auth Response (unknown account).");
return -1;
}
@@ -856,7 +807,7 @@ int WorldSocket::HandleAuthSession(WorldPacket& recvPacket)
const char* sStr = s.AsHexStr(); //Must be freed by OPENSSL_free()
const char* vStr = v.AsHexStr(); //Must be freed by OPENSSL_free()
- sLog->outDebug(LOG_FILTER_GENERAL, "WorldSocket::HandleAuthSession: (s, v) check s: %s v: %s",
+ sLog->outDebug(LOG_FILTER_NETWORKIO, "WorldSocket::HandleAuthSession: (s, v) check s: %s v: %s",
sStr,
vStr);
@@ -872,7 +823,7 @@ int WorldSocket::HandleAuthSession(WorldPacket& recvPacket)
packet << uint8 (AUTH_FAILED);
SendPacket(packet);
- sLog->outDebug(LOG_FILTER_GENERAL, "WorldSocket::HandleAuthSession: Sent Auth Response (Account IP differs).");
+ sLog->outDebug(LOG_FILTER_NETWORKIO, "WorldSocket::HandleAuthSession: Sent Auth Response (Account IP differs).");
return -1;
}
}
@@ -936,7 +887,7 @@ int WorldSocket::HandleAuthSession(WorldPacket& recvPacket)
packet << uint8 (AUTH_BANNED);
SendPacket(packet);
- sLog->outError(LOG_FILTER_GENERAL, "WorldSocket::HandleAuthSession: Sent Auth Response (Account banned).");
+ sLog->outError(LOG_FILTER_NETWORKIO, "WorldSocket::HandleAuthSession: Sent Auth Response (Account banned).");
return -1;
}
@@ -950,7 +901,7 @@ int WorldSocket::HandleAuthSession(WorldPacket& recvPacket)
SendPacket(packet);
- sLog->outInfo(LOG_FILTER_GENERAL, "WorldSocket::HandleAuthSession: User tries to login but his security level is not enough");
+ sLog->outInfo(LOG_FILTER_NETWORKIO, "WorldSocket::HandleAuthSession: User tries to login but his security level is not enough");
return -1;
}
@@ -974,11 +925,11 @@ int WorldSocket::HandleAuthSession(WorldPacket& recvPacket)
SendPacket(packet);
- sLog->outError(LOG_FILTER_GENERAL, "WorldSocket::HandleAuthSession: Authentication failed for account: %u ('%s') address: %s", id, account.c_str(), address.c_str());
+ sLog->outError(LOG_FILTER_NETWORKIO, "WorldSocket::HandleAuthSession: Authentication failed for account: %u ('%s') address: %s", id, account.c_str(), address.c_str());
return -1;
}
- sLog->outDebug(LOG_FILTER_GENERAL, "WorldSocket::HandleAuthSession: Client '%s' authenticated successfully from %s.",
+ sLog->outDebug(LOG_FILTER_NETWORKIO, "WorldSocket::HandleAuthSession: Client '%s' authenticated successfully from %s.",
account.c_str(),
address.c_str());
@@ -1054,12 +1005,8 @@ int WorldSocket::HandlePing (WorldPacket& recvPacket)
if (m_Session && AccountMgr::IsPlayerAccount(m_Session->GetSecurity()))
{
- Player* _player = m_Session->GetPlayer();
- sLog->outError(LOG_FILTER_GENERAL, "WorldSocket::HandlePing: Player (account: %u, GUID: %u, name: %s) kicked for over-speed pings (address: %s)",
- m_Session->GetAccountId(),
- _player ? _player->GetGUIDLow() : 0,
- _player ? _player->GetName() : "<none>",
- GetRemoteAddress().c_str());
+ sLog->outError(LOG_FILTER_NETWORKIO, "WorldSocket::HandlePing: %s kicked for over-speed pings (address: %s)",
+ m_Session->GetPlayerName(false).c_str(), GetRemoteAddress().c_str());
return -1;
}
@@ -1077,7 +1024,7 @@ int WorldSocket::HandlePing (WorldPacket& recvPacket)
m_Session->SetLatency (latency);
else
{
- sLog->outError(LOG_FILTER_GENERAL, "WorldSocket::HandlePing: peer sent CMSG_PING, "
+ sLog->outError(LOG_FILTER_NETWORKIO, "WorldSocket::HandlePing: peer sent CMSG_PING, "
"but is not authenticated or got recently kicked, "
" address = %s",
GetRemoteAddress().c_str());
diff --git a/src/server/game/Skills/SkillDiscovery.cpp b/src/server/game/Skills/SkillDiscovery.cpp
index d9cfbe6b69c..3eac3d34fd2 100755
--- a/src/server/game/Skills/SkillDiscovery.cpp
+++ b/src/server/game/Skills/SkillDiscovery.cpp
@@ -153,7 +153,7 @@ void LoadSkillDiscoveryTable()
sLog->outError(LOG_FILTER_SQL, "Spell (ID: %u) is 100%% chance random discovery ability but not have data in `skill_discovery_template` table", spell_id);
}
- sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded %u skill discovery definitions in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u skill discovery definitions in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
}
diff --git a/src/server/game/Skills/SkillExtraItems.cpp b/src/server/game/Skills/SkillExtraItems.cpp
index 9cb4c145b3d..9e2648dc943 100755
--- a/src/server/game/Skills/SkillExtraItems.cpp
+++ b/src/server/game/Skills/SkillExtraItems.cpp
@@ -110,7 +110,7 @@ void LoadSkillExtraItemTable()
}
while (result->NextRow());
- sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded %u spell specialization definitions in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u spell specialization definitions in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
}
diff --git a/src/server/game/Spells/Auras/SpellAuraDefines.h b/src/server/game/Spells/Auras/SpellAuraDefines.h
index ddb230d6773..6902dd60c80 100755
--- a/src/server/game/Spells/Auras/SpellAuraDefines.h
+++ b/src/server/game/Spells/Auras/SpellAuraDefines.h
@@ -47,14 +47,14 @@ enum AuraEffectHandleModes
AURA_EFFECT_HANDLE_SEND_FOR_CLIENT_MASK = (AURA_EFFECT_HANDLE_SEND_FOR_CLIENT | AURA_EFFECT_HANDLE_REAL), // any case handler need to send packet
AURA_EFFECT_HANDLE_CHANGE_AMOUNT_MASK = (AURA_EFFECT_HANDLE_CHANGE_AMOUNT | AURA_EFFECT_HANDLE_REAL), // any case handler applies effect depending on amount
AURA_EFFECT_HANDLE_CHANGE_AMOUNT_SEND_FOR_CLIENT_MASK = (AURA_EFFECT_HANDLE_CHANGE_AMOUNT_MASK | AURA_EFFECT_HANDLE_SEND_FOR_CLIENT_MASK),
- AURA_EFFECT_HANDLE_REAL_OR_REAPPLY_MASK = (AURA_EFFECT_HANDLE_REAPPLY | AURA_EFFECT_HANDLE_REAL),
+ AURA_EFFECT_HANDLE_REAL_OR_REAPPLY_MASK = (AURA_EFFECT_HANDLE_REAPPLY | AURA_EFFECT_HANDLE_REAL)
};
//m_schoolAbsorb
enum DAMAGE_ABSORB_TYPE
{
ALL_DAMAGE_ABSORB = -2,
- ONLY_MAGIC_ABSORB = -1,
+ ONLY_MAGIC_ABSORB = -1
};
enum AuraType
@@ -382,6 +382,7 @@ enum AuraType
enum AuraObjectType
{
UNIT_AURA_TYPE,
- DYNOBJ_AURA_TYPE,
+ DYNOBJ_AURA_TYPE
};
+
#endif
diff --git a/src/server/game/Spells/Auras/SpellAuraEffects.cpp b/src/server/game/Spells/Auras/SpellAuraEffects.cpp
index 610cd7d1533..29dcde9d616 100755
--- a/src/server/game/Spells/Auras/SpellAuraEffects.cpp
+++ b/src/server/game/Spells/Auras/SpellAuraEffects.cpp
@@ -36,6 +36,8 @@
#include "CellImpl.h"
#include "ScriptMgr.h"
#include "Vehicle.h"
+#include "Battlefield.h"
+#include "BattlefieldMgr.h"
class Aura;
//
@@ -2956,13 +2958,13 @@ void AuraEffect::HandleForceMoveForward(AuraApplication const* aurApp, uint8 mod
Unit* target = aurApp->GetTarget();
if (apply)
- target->SetFlag(UNIT_FIELD_FLAGS_2, UNIT_FLAG2_FORCE_MOVE);
+ target->SetFlag(UNIT_FIELD_FLAGS_2, UNIT_FLAG2_FORCE_MOVEMENT);
else
{
// do not remove unit flag if there are more than this auraEffect of that kind on unit on unit
if (target->HasAuraType(GetAuraType()))
return;
- target->RemoveFlag(UNIT_FIELD_FLAGS_2, UNIT_FLAG2_FORCE_MOVE);
+ target->RemoveFlag(UNIT_FIELD_FLAGS_2, UNIT_FLAG2_FORCE_MOVEMENT);
}
}
@@ -5016,8 +5018,12 @@ void AuraEffect::HandleAuraDummy(AuraApplication const* aurApp, uint8 mode, bool
case 2584: // Waiting to Resurrect
// Waiting to resurrect spell cancel, we must remove player from resurrect queue
if (target->GetTypeId() == TYPEID_PLAYER)
+ {
if (Battleground* bg = target->ToPlayer()->GetBattleground())
bg->RemovePlayerFromResurrectQueue(target->GetGUID());
+ if (Battlefield* bf = sBattlefieldMgr->GetBattlefieldToZoneId(target->GetZoneId()))
+ bf->RemovePlayerFromResurrectQueue(target->GetGUID());
+ }
break;
case 36730: // Flame Strike
{
@@ -5036,7 +5042,7 @@ void AuraEffect::HandleAuraDummy(AuraApplication const* aurApp, uint8 mode, bool
}
case 43681: // Inactive
{
- if (!target || target->GetTypeId() != TYPEID_PLAYER || aurApp->GetRemoveMode() != AURA_REMOVE_BY_EXPIRE)
+ if (target->GetTypeId() != TYPEID_PLAYER || aurApp->GetRemoveMode() != AURA_REMOVE_BY_EXPIRE)
return;
if (target->GetMap()->IsBattleground())
@@ -5054,6 +5060,7 @@ void AuraEffect::HandleAuraDummy(AuraApplication const* aurApp, uint8 mode, bool
target->CastSpell((Unit*)NULL, GetAmount(), true, NULL, this);
break;
case 58600: // Restricted Flight Area
+ case 58730: // Restricted Flight Area
if (aurApp->GetRemoveMode() == AURA_REMOVE_BY_EXPIRE)
target->CastSpell(target, 58601, true);
break;
diff --git a/src/server/game/Spells/Auras/SpellAuras.cpp b/src/server/game/Spells/Auras/SpellAuras.cpp
index 9ee05b9a2a4..3de11b98e30 100755
--- a/src/server/game/Spells/Auras/SpellAuras.cpp
+++ b/src/server/game/Spells/Auras/SpellAuras.cpp
@@ -425,7 +425,7 @@ void Aura::_UnapplyForTarget(Unit* target, Unit* caster, AuraApplication * auraA
if (itr == m_applications.end())
{
sLog->outError(LOG_FILTER_SPELLS_AURAS, "Aura::_UnapplyForTarget, target:%u, caster:%u, spell:%u was not found in owners application map!",
- target->GetGUIDLow(), caster->GetGUIDLow(), auraApp->GetBase()->GetSpellInfo()->Id);
+ target->GetGUIDLow(), caster ? caster->GetGUIDLow() : 0, auraApp->GetBase()->GetSpellInfo()->Id);
ASSERT(false);
}
@@ -766,7 +766,7 @@ void Aura::SetCharges(uint8 charges)
uint8 Aura::CalcMaxCharges(Unit* caster) const
{
- uint8 maxProcCharges = m_spellInfo->ProcCharges;
+ uint32 maxProcCharges = m_spellInfo->ProcCharges;
if (SpellProcEntry const* procEntry = sSpellMgr->GetSpellProcEntry(GetId()))
maxProcCharges = procEntry->charges;
@@ -1414,10 +1414,16 @@ void Aura::HandleAuraSpecificMods(AuraApplication const* aurApp, Unit* caster, b
if (caster->GetTypeId() == TYPEID_PLAYER)
{
if (caster->ToPlayer()->HasSpellCooldown(aura->GetId()))
- break;
- // and add if needed
- caster->ToPlayer()->AddSpellCooldown(aura->GetId(), 0, uint32(time(NULL) + 12));
+ {
+ // This additional check is needed to add a minimal delay before cooldown in in effect
+ // to allow all bubbles broken by a single damage source proc mana return
+ if (caster->ToPlayer()->GetSpellCooldownDelay(aura->GetId()) <= 11)
+ break;
+ }
+ else // and add if needed
+ caster->ToPlayer()->AddSpellCooldown(aura->GetId(), 0, uint32(time(NULL) + 12));
}
+
// effect on caster
if (AuraEffect const* aurEff = aura->GetEffect(0))
{
@@ -2062,6 +2068,7 @@ void Aura::LoadScripts()
{
std::list<AuraScript*>::iterator bitr = itr;
++itr;
+ delete (*bitr);
m_loadedScripts.erase(bitr);
continue;
}
@@ -2324,7 +2331,7 @@ UnitAura::UnitAura(SpellInfo const* spellproto, uint8 effMask, WorldObject* owne
LoadScripts();
_InitEffects(effMask, caster, baseAmount);
GetUnitOwner()->_AddAura(this, caster);
-};
+}
void UnitAura::_ApplyForTarget(Unit* target, Unit* caster, AuraApplication * aurApp)
{
diff --git a/src/server/game/Spells/Spell.cpp b/src/server/game/Spells/Spell.cpp
index 3742ee5fc52..bac8d2fe4eb 100755
--- a/src/server/game/Spells/Spell.cpp
+++ b/src/server/game/Spells/Spell.cpp
@@ -53,6 +53,8 @@
#include "SpellScript.h"
#include "InstanceScript.h"
#include "SpellInfo.h"
+#include "Battlefield.h"
+#include "BattlefieldMgr.h"
extern pEffect SpellEffects[TOTAL_SPELL_EFFECTS];
@@ -85,7 +87,7 @@ SpellDestination::SpellDestination(WorldObject const& wObj)
}
-SpellCastTargets::SpellCastTargets() : m_elevation(0), m_speed(0)
+SpellCastTargets::SpellCastTargets() : m_elevation(0), m_speed(0), m_strTarget()
{
m_objectTarget = NULL;
m_itemTarget = NULL;
@@ -94,7 +96,6 @@ SpellCastTargets::SpellCastTargets() : m_elevation(0), m_speed(0)
m_itemTargetGUID = 0;
m_itemTargetEntry = 0;
- m_strTarget = "";
m_targetMask = 0;
}
@@ -582,7 +583,7 @@ m_caster((info->AttributesEx6 & SPELL_ATTR6_CAST_BY_CHARMER && caster->GetCharme
&& !m_spellInfo->IsPassive() && !m_spellInfo->IsPositive();
CleanupTargetList();
- CleanupEffectExecuteData();
+ memset(m_effectExecuteData, 0, MAX_SPELL_EFFECTS * sizeof(ByteBuffer*));
for (uint8 i = 0; i < MAX_SPELL_EFFECTS; ++i)
m_destTargets[i] = SpellDestination(*m_caster);
@@ -915,7 +916,7 @@ void Spell::SelectImplicitChannelTargets(SpellEffIndex effIndex, SpellImplicitTa
{
case TARGET_UNIT_CHANNEL_TARGET:
{
- WorldObject* target = ObjectAccessor::GetUnit(*m_caster, channeledSpell->m_targets.GetUnitTargetGUID());
+ WorldObject* target = ObjectAccessor::GetUnit(*m_caster, m_originalCaster->GetUInt64Value(UNIT_FIELD_CHANNEL_OBJECT));
CallScriptObjectTargetSelectHandlers(target, effIndex);
// unit target may be no longer avalible - teleported out of map for example
if (target && target->ToUnit())
@@ -927,7 +928,7 @@ void Spell::SelectImplicitChannelTargets(SpellEffIndex effIndex, SpellImplicitTa
case TARGET_DEST_CHANNEL_TARGET:
if (channeledSpell->m_targets.HasDst())
m_targets.SetDst(channeledSpell->m_targets);
- else if (WorldObject* target = ObjectAccessor::GetWorldObject(*m_caster, channeledSpell->m_targets.GetObjectTargetGUID()))
+ else if (WorldObject* target = ObjectAccessor::GetWorldObject(*m_caster, m_originalCaster->GetUInt64Value(UNIT_FIELD_CHANNEL_OBJECT)))
{
CallScriptObjectTargetSelectHandlers(target, effIndex);
if (target)
@@ -2524,7 +2525,7 @@ void Spell::DoAllEffectOnTarget(TargetInfo* target)
}
}
- if (missInfo != SPELL_MISS_EVADE && m_caster && !m_caster->IsFriendlyTo(unit) && (!m_spellInfo->IsPositive() || m_spellInfo->HasEffect(SPELL_EFFECT_DISPEL)))
+ if (missInfo != SPELL_MISS_EVADE && !m_caster->IsFriendlyTo(unit) && (!m_spellInfo->IsPositive() || m_spellInfo->HasEffect(SPELL_EFFECT_DISPEL)))
{
m_caster->CombatStart(unit, !(m_spellInfo->AttributesEx3 & SPELL_ATTR3_NO_INITIAL_AGGRO));
@@ -3022,8 +3023,14 @@ void Spell::prepare(SpellCastTargets const* targets, AuraEffect const* triggered
// calculate cast time (calculated after first CheckCast check to prevent charge counting for first CheckCast fail)
m_casttime = m_spellInfo->CalcCastTime(m_caster, this);
if (m_caster->GetTypeId() == TYPEID_PLAYER)
+ {
m_caster->ToPlayer()->SetSpellModTakingSpell(this, false);
+ // Set casttime to 0 if .cheat casttime is enabled.
+ if (m_caster->ToPlayer()->GetCommandStatus(CHEAT_CASTTIME))
+ m_casttime = 0;
+ }
+
// don't allow channeled spells / spells with cast time to be casted while moving
// (even if they are interrupted on moving, spells with almost immediate effect get to have their effect processed before movement interrupter kicks in)
if ((m_spellInfo->IsChanneled() || m_casttime) && m_caster->GetTypeId() == TYPEID_PLAYER && m_caster->isMoving() && m_spellInfo->InterruptFlags & SPELL_INTERRUPT_FLAG_MOVEMENT)
@@ -3062,10 +3069,9 @@ void Spell::prepare(SpellCastTargets const* targets, AuraEffect const* triggered
SendSpellStart();
// set target for proper facing
- if (m_casttime && !(_triggeredCastFlags & TRIGGERED_IGNORE_SET_FACING))
- if (uint64 target = m_targets.GetUnitTargetGUID())
- if (m_caster->GetGUID() != target && m_caster->GetTypeId() == TYPEID_UNIT)
- m_caster->FocusTarget(this, target);
+ if ((m_casttime || m_spellInfo->IsChanneled()) && !(_triggeredCastFlags & TRIGGERED_IGNORE_SET_FACING))
+ if (m_caster->GetGUID() != m_targets.GetObjectTargetGUID() && m_caster->GetTypeId() == TYPEID_UNIT)
+ m_caster->FocusTarget(this, m_targets.GetObjectTargetGUID());
if (!(_triggeredCastFlags & TRIGGERED_IGNORE_GCD))
TriggerGlobalCooldown();
@@ -3314,8 +3320,14 @@ void Spell::cast(bool skipCheck)
}
if (m_caster->GetTypeId() == TYPEID_PLAYER)
+ {
m_caster->ToPlayer()->SetSpellModTakingSpell(this, false);
+ //Clear spell cooldowns after every spell is cast if .cheat cooldown is enabled.
+ if (m_caster->ToPlayer()->GetCommandStatus(CHEAT_COOLDOWN))
+ m_caster->ToPlayer()->RemoveSpellCooldown(m_spellInfo->Id, true);
+ }
+
SetExecutedCurrently(false);
}
@@ -4070,41 +4082,47 @@ void Spell::WriteAmmoToPacket(WorldPacket* data)
*data << uint32(ammoInventoryType);
}
+/// Writes miss and hit targets for a SMSG_SPELL_GO packet
void Spell::WriteSpellGoTargets(WorldPacket* data)
{
// This function also fill data for channeled spells:
// m_needAliveTargetMask req for stop channelig if one target die
- uint32 hit = m_UniqueGOTargetInfo.size(); // Always hits on GO
- uint32 miss = 0;
for (std::list<TargetInfo>::iterator ihit = m_UniqueTargetInfo.begin(); ihit != m_UniqueTargetInfo.end(); ++ihit)
{
if ((*ihit).effectMask == 0) // No effect apply - all immuned add state
- {
// possibly SPELL_MISS_IMMUNE2 for this??
ihit->missCondition = SPELL_MISS_IMMUNE2;
- ++miss;
- }
- else if ((*ihit).missCondition == SPELL_MISS_NONE)
- ++hit;
- else
- ++miss;
}
- *data << (uint8)hit;
- for (std::list<TargetInfo>::const_iterator ihit = m_UniqueTargetInfo.begin(); ihit != m_UniqueTargetInfo.end(); ++ihit)
+ // Hit and miss target counts are both uint8, that limits us to 255 targets for each
+ // sending more than 255 targets crashes the client (since count sent would be wrong)
+ // Spells like 40647 (with a huge radius) can easily reach this limit (spell might need
+ // target conditions but we still need to limit the number of targets sent and keeping
+ // correct count for both hit and miss).
+
+ uint32 hit = 0;
+ size_t hitPos = data->wpos();
+ *data << (uint8)0; // placeholder
+ for (std::list<TargetInfo>::const_iterator ihit = m_UniqueTargetInfo.begin(); ihit != m_UniqueTargetInfo.end() && hit <= 255; ++ihit)
{
if ((*ihit).missCondition == SPELL_MISS_NONE) // Add only hits
{
*data << uint64(ihit->targetGUID);
m_channelTargetEffectMask |=ihit->effectMask;
+ ++hit;
}
}
- for (std::list<GOTargetInfo>::const_iterator ighit = m_UniqueGOTargetInfo.begin(); ighit != m_UniqueGOTargetInfo.end(); ++ighit)
+ for (std::list<GOTargetInfo>::const_iterator ighit = m_UniqueGOTargetInfo.begin(); ighit != m_UniqueGOTargetInfo.end() && hit <= 255; ++ighit)
+ {
*data << uint64(ighit->targetGUID); // Always hits
+ ++hit;
+ }
- *data << (uint8)miss;
- for (std::list<TargetInfo>::const_iterator ihit = m_UniqueTargetInfo.begin(); ihit != m_UniqueTargetInfo.end(); ++ihit)
+ uint32 miss = 0;
+ size_t missPos = data->wpos();
+ *data << (uint8)0; // placeholder
+ for (std::list<TargetInfo>::const_iterator ihit = m_UniqueTargetInfo.begin(); ihit != m_UniqueTargetInfo.end() && miss <= 255; ++ihit)
{
if (ihit->missCondition != SPELL_MISS_NONE) // Add only miss
{
@@ -4112,11 +4130,15 @@ void Spell::WriteSpellGoTargets(WorldPacket* data)
*data << uint8(ihit->missCondition);
if (ihit->missCondition == SPELL_MISS_REFLECT)
*data << uint8(ihit->reflectResult);
+ ++miss;
}
}
// Reset m_needAliveTargetMask for non channeled spell
if (!m_spellInfo->IsChanneled())
m_channelTargetEffectMask = 0;
+
+ data->put<uint8>(hitPos, (uint8)hit);
+ data->put<uint8>(missPos, (uint8)miss);
}
void Spell::SendLogExecute()
@@ -4255,6 +4277,9 @@ void Spell::SendChannelUpdate(uint32 time)
void Spell::SendChannelStart(uint32 duration)
{
uint64 channelTarget = m_targets.GetObjectTargetGUID();
+ if (!channelTarget && !m_spellInfo->NeedsExplicitUnitTarget())
+ if (m_UniqueTargetInfo.size() + m_UniqueGOTargetInfo.size() == 1) // this is for TARGET_SELECT_CATEGORY_NEARBY
+ channelTarget = !m_UniqueTargetInfo.empty() ? m_UniqueTargetInfo.front().targetGUID : m_UniqueGOTargetInfo.front().targetGUID;
WorldPacket data(MSG_CHANNEL_START, (8+4+4));
data.append(m_caster->GetPackGUID());
@@ -4357,6 +4382,13 @@ void Spell::TakePower()
if (m_CastItem || m_triggeredByAuraSpell)
return;
+ //Don't take power if the spell is cast while .cheat power is enabled.
+ if (m_caster->GetTypeId() == TYPEID_PLAYER)
+ {
+ if (m_caster->ToPlayer()->GetCommandStatus(CHEAT_POWER))
+ return;
+ }
+
Powers powerType = Powers(m_spellInfo->PowerType);
bool hit = true;
if (m_caster->GetTypeId() == TYPEID_PLAYER)
@@ -5115,6 +5147,10 @@ SpellCastResult Spell::CheckCast(bool strict)
}
if (m_caster->HasUnitState(UNIT_STATE_ROOT))
return SPELL_FAILED_ROOTED;
+ if (m_caster->GetTypeId() == TYPEID_PLAYER)
+ if (Unit* target = m_targets.GetUnitTarget())
+ if (!target->isAlive())
+ return SPELL_FAILED_BAD_TARGETS;
break;
}
case SPELL_EFFECT_SKINNING:
@@ -5442,8 +5478,9 @@ SpellCastResult Spell::CheckCast(bool strict)
// allow always ghost flight spells
if (m_originalCaster && m_originalCaster->GetTypeId() == TYPEID_PLAYER && m_originalCaster->isAlive())
{
- if (AreaTableEntry const* pArea = GetAreaEntryByAreaID(m_originalCaster->GetAreaId()))
- if (pArea->flags & AREA_FLAG_NO_FLY_ZONE)
+ Battlefield* Bf = sBattlefieldMgr->GetBattlefieldToZoneId(m_originalCaster->GetZoneId());
+ if (AreaTableEntry const* area = GetAreaEntryByAreaID(m_originalCaster->GetAreaId()))
+ if (area->flags & AREA_FLAG_NO_FLY_ZONE || (Bf && !Bf->CanFlyIn()))
return (_triggeredCastFlags & TRIGGERED_DONT_REPORT_CAST_ERROR) ? SPELL_FAILED_DONT_REPORT : SPELL_FAILED_NOT_HERE;
}
break;
@@ -5544,7 +5581,7 @@ SpellCastResult Spell::CheckCasterAuras() const
// We use bitmasks so the loop is done only once and not on every aura check below.
if (m_spellInfo->AttributesEx & SPELL_ATTR1_DISPEL_AURAS_ON_IMMUNITY)
{
- for (int i = 0; i < MAX_SPELL_EFFECTS; ++i)
+ for (uint8 i = 0; i < MAX_SPELL_EFFECTS; ++i)
{
if (m_spellInfo->Effects[i].ApplyAuraName == SPELL_AURA_SCHOOL_IMMUNITY)
school_immune |= uint32(m_spellInfo->Effects[i].MiscValue);
@@ -5612,7 +5649,7 @@ SpellCastResult Spell::CheckCasterAuras() const
SpellInfo const* auraInfo = aura->GetSpellInfo();
if (auraInfo->GetAllEffectsMechanicMask() & mechanic_immune)
continue;
- if (auraInfo->GetSchoolMask() & school_immune)
+ if (auraInfo->GetSchoolMask() & school_immune && !(auraInfo->AttributesEx & SPELL_ATTR1_UNAFFECTED_BY_SCHOOL_IMMUNE))
continue;
if (auraInfo->GetDispelMask() & dispel_immune)
continue;
@@ -6823,9 +6860,9 @@ SpellCastResult Spell::CanOpenLock(uint32 effIndex, uint32 lockId, SkillType& sk
0 : m_caster->ToPlayer()->GetSkillValue(skillId);
// skill bonus provided by casting spell (mostly item spells)
- // add the damage modifier from the spell casted (cheat lock / skeleton key etc.)
+ // add the effect base points modifier from the spell casted (cheat lock / skeleton key etc.)
if (m_spellInfo->Effects[effIndex].TargetA.GetTarget() == TARGET_GAMEOBJECT_ITEM_TARGET || m_spellInfo->Effects[effIndex].TargetB.GetTarget() == TARGET_GAMEOBJECT_ITEM_TARGET)
- skillValue += uint32(CalculateDamage(effIndex, NULL));
+ skillValue += m_spellInfo->Effects[effIndex].CalcValue();
if (skillValue < reqSkillValue)
return SPELL_FAILED_LOW_CASTLEVEL;
@@ -6894,12 +6931,6 @@ void Spell::InitEffectExecuteData(uint8 effIndex)
}
}
-void Spell::CleanupEffectExecuteData()
-{
- for (uint8 i = 0; i < MAX_SPELL_EFFECTS; ++i)
- m_effectExecuteData[i] = NULL;
-}
-
void Spell::CheckEffectExecuteData()
{
for (uint8 i = 0; i < MAX_SPELL_EFFECTS; ++i)
@@ -6915,6 +6946,7 @@ void Spell::LoadScripts()
{
std::list<SpellScript*>::iterator bitr = itr;
++itr;
+ delete (*bitr);
m_loadedScripts.erase(bitr);
continue;
}
@@ -7191,6 +7223,10 @@ void Spell::TriggerGlobalCooldown()
if (!gcd)
return;
+ if (m_caster->GetTypeId() == TYPEID_PLAYER)
+ if (m_caster->ToPlayer()->GetCommandStatus(CHEAT_COOLDOWN))
+ return;
+
// Global cooldown can't leave range 1..1.5 secs
// There are some spells (mostly not casted directly by player) that have < 1 sec and > 1.5 sec global cooldowns
// but as tests show are not affected by any spell mods.
diff --git a/src/server/game/Spells/Spell.h b/src/server/game/Spells/Spell.h
index 1376b0fbd40..d2bdf4b8970 100755
--- a/src/server/game/Spells/Spell.h
+++ b/src/server/game/Spells/Spell.h
@@ -69,14 +69,14 @@ enum SpellCastFlags
CAST_FLAG_UNKNOWN_29 = 0x10000000,
CAST_FLAG_UNKNOWN_30 = 0x20000000,
CAST_FLAG_UNKNOWN_31 = 0x40000000,
- CAST_FLAG_UNKNOWN_32 = 0x80000000,
+ CAST_FLAG_UNKNOWN_32 = 0x80000000
};
enum SpellRangeFlag
{
SPELL_RANGE_DEFAULT = 0,
SPELL_RANGE_MELEE = 1, //melee
- SPELL_RANGE_RANGED = 2, //hunter range and ranged weapon
+ SPELL_RANGE_RANGED = 2 //hunter range and ranged weapon
};
struct SpellDestination
@@ -203,7 +203,7 @@ enum SpellEffectHandleMode
SPELL_EFFECT_HANDLE_LAUNCH,
SPELL_EFFECT_HANDLE_LAUNCH_TARGET,
SPELL_EFFECT_HANDLE_HIT,
- SPELL_EFFECT_HANDLE_HIT_TARGET,
+ SPELL_EFFECT_HANDLE_HIT_TARGET
};
class Spell
@@ -616,7 +616,6 @@ class Spell
// spell execution log
void InitEffectExecuteData(uint8 effIndex);
- void CleanupEffectExecuteData();
void CheckEffectExecuteData();
// Scripting system
diff --git a/src/server/game/Spells/SpellEffects.cpp b/src/server/game/Spells/SpellEffects.cpp
index 95f67d05e9a..dcbd1888b03 100755
--- a/src/server/game/Spells/SpellEffects.cpp
+++ b/src/server/game/Spells/SpellEffects.cpp
@@ -277,6 +277,10 @@ void Spell::EffectInstaKill(SpellEffIndex /*effIndex*/)
if (!unitTarget || !unitTarget->isAlive())
return;
+ if (unitTarget->GetTypeId() == TYPEID_PLAYER)
+ if (unitTarget->ToPlayer()->GetCommandStatus(CHEAT_GOD))
+ return;
+
if (m_caster == unitTarget) // prevent interrupt message
finish();
@@ -312,10 +316,9 @@ void Spell::EffectSchoolDMG(SpellEffIndex effIndex)
if (effectHandleMode != SPELL_EFFECT_HANDLE_LAUNCH_TARGET)
return;
- bool apply_direct_bonus = true;
-
if (unitTarget && unitTarget->isAlive())
{
+ bool apply_direct_bonus = true;
switch (m_spellInfo->SpellFamilyName)
{
case SPELLFAMILY_GENERIC:
@@ -1150,6 +1153,14 @@ void Spell::EffectTeleportUnits(SpellEffIndex /*effIndex*/)
if (unitTarget->getLevel() > uiMaxSafeLevel)
{
unitTarget->AddAura(60444, unitTarget); //Apply Lost! Aura
+
+ // ALLIANCE from 60323 to 60330 - HORDE from 60328 to 60335
+ uint32 spellId = 60323;
+ if (m_caster->ToPlayer()->GetTeam() == HORDE)
+ spellId += 5;
+
+ spellId += urand(0, 7);
+ m_caster->CastSpell(m_caster, spellId, true);
return;
}
break;
@@ -1721,8 +1732,7 @@ void Spell::DoCreateItem(uint32 /*i*/, uint32 itemtype)
pItem->SetUInt32Value(ITEM_FIELD_CREATOR, player->GetGUIDLow());
// send info to the client
- if (pItem)
- player->SendNewItem(pItem, num_to_add, true, bgType == 0);
+ player->SendNewItem(pItem, num_to_add, true, bgType == 0);
// we succeeded in creating at least one item, so a levelup is possible
if (bgType == 0)
@@ -2076,7 +2086,8 @@ void Spell::EffectOpenLock(SpellEffIndex effIndex)
bg->EventPlayerClickedOnFlag(player, gameObjTarget);
return;
}
- }else if (m_spellInfo->Id == 1842 && gameObjTarget->GetGOInfo()->type == GAMEOBJECT_TYPE_TRAP && gameObjTarget->GetOwner())
+ }
+ else if (m_spellInfo->Id == 1842 && gameObjTarget->GetGOInfo()->type == GAMEOBJECT_TYPE_TRAP && gameObjTarget->GetOwner())
{
gameObjTarget->SetLootState(GO_JUST_DEACTIVATED);
return;
@@ -2113,7 +2124,7 @@ void Spell::EffectOpenLock(SpellEffIndex effIndex)
if (gameObjTarget)
SendLoot(guid, LOOT_SKINNING);
- else
+ else if (itemTarget)
itemTarget->SetFlag(ITEM_FIELD_FLAGS, ITEM_FLAG_UNLOCKED);
// not allow use skill grow at item base open
@@ -2420,12 +2431,13 @@ void Spell::EffectSummonType(SpellEffIndex effIndex)
return;
// The spell that this effect will trigger. It has SPELL_AURA_CONTROL_VEHICLE
- uint32 spell = VEHICLE_SPELL_RIDE_HARDCODED;
- if (SpellInfo const* spellProto = sSpellMgr->GetSpellInfo(m_spellInfo->Effects[effIndex].CalcValue()))
- spell = spellProto->Id;
+ uint32 spellId = VEHICLE_SPELL_RIDE_HARDCODED;
+ SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(m_spellInfo->Effects[effIndex].CalcValue());
+ if (spellInfo && spellInfo->HasAura(SPELL_AURA_CONTROL_VEHICLE))
+ spellId = spellInfo->Id;
// Hard coded enter vehicle spell
- m_originalCaster->CastSpell(summon, spell, true);
+ m_originalCaster->CastSpell(summon, spellId, true);
uint32 faction = properties->Faction;
if (!faction)
@@ -4137,6 +4149,8 @@ void Spell::EffectScriptEffect(SpellEffIndex effIndex)
return;
}
case 59317: // Teleporting
+ {
+
if (!unitTarget || unitTarget->GetTypeId() != TYPEID_PLAYER)
return;
@@ -4148,20 +4162,6 @@ void Spell::EffectScriptEffect(SpellEffIndex effIndex)
unitTarget->CastSpell(unitTarget, 59314, true);
return;
- // random spell learn instead placeholder
- case 60893: // Northrend Alchemy Research
- case 61177: // Northrend Inscription Research
- case 61288: // Minor Inscription Research
- case 61756: // Northrend Inscription Research (FAST QA VERSION)
- case 64323: // Book of Glyph Mastery
- {
- if (m_caster->GetTypeId() != TYPEID_PLAYER)
- return;
-
- // learn random explicit discovery recipe (if any)
- if (uint32 discoveredSpell = GetExplicitDiscoverySpell(m_spellInfo->Id, m_caster->ToPlayer()))
- m_caster->ToPlayer()->learnSpell(discoveredSpell, false);
- return;
}
case 62482: // Grab Crate
{
@@ -4280,17 +4280,6 @@ void Spell::EffectScriptEffect(SpellEffIndex effIndex)
unitTarget->CastSpell(unitTarget, spellTarget[urand(0, 4)], true);
break;
}
- case 64142: // Upper Deck - Create Foam Sword
- if (unitTarget->GetTypeId() != TYPEID_PLAYER)
- return;
- Player* player = unitTarget->ToPlayer();
- static uint32 const itemId[] = {45061, 45176, 45177, 45178, 45179, 0};
- // player can only have one of these items
- for (uint32 const* itr = &itemId[0]; *itr; ++itr)
- if (player->HasItemCount(*itr, 1, true))
- return;
- DoCreateItem(effIndex, itemId[urand(0, 4)]);
- return;
}
break;
}
@@ -4771,16 +4760,18 @@ void Spell::EffectInebriate(SpellEffIndex /*effIndex*/)
if (!unitTarget || unitTarget->GetTypeId() != TYPEID_PLAYER)
return;
- Player* player = (Player*)unitTarget;
- uint16 currentDrunk = player->GetDrunkValue();
- uint16 drunkMod = damage * 256;
- if (currentDrunk + drunkMod > 0xFFFF)
+ Player* player = unitTarget->ToPlayer();
+ uint8 currentDrunk = player->GetDrunkValue();
+ uint8 drunkMod = damage;
+ if (currentDrunk + drunkMod > 100)
{
- currentDrunk = 0xFFFF;
- player->CastSpell(player, 67468, false);
+ currentDrunk = 100;
+ if (rand_chance() < 25.0f)
+ player->CastSpell(player, 67468, false); // Drunken Vomit
}
else
currentDrunk += drunkMod;
+
player->SetDrunkValue(currentDrunk, m_CastItem ? m_CastItem->GetEntry() : 0);
}
@@ -6193,6 +6184,7 @@ void Spell::EffectPlayerNotification(SpellEffIndex effIndex)
case 58730: // Restricted Flight Area
case 58600: // Restricted Flight Area
unitTarget->ToPlayer()->GetSession()->SendNotification(LANG_ZONE_NOFLYZONE);
+ unitTarget->PlayDirectSound(9417); // Fel Reaver sound
break;
}
diff --git a/src/server/game/Spells/SpellInfo.cpp b/src/server/game/Spells/SpellInfo.cpp
index a397bb13709..0531549cbd3 100644
--- a/src/server/game/Spells/SpellInfo.cpp
+++ b/src/server/game/Spells/SpellInfo.cpp
@@ -361,7 +361,7 @@ bool SpellEffectInfo::IsAura() const
bool SpellEffectInfo::IsAura(AuraType aura) const
{
- return IsAura() && ApplyAuraName == aura;
+ return IsAura() && ApplyAuraName == uint32(aura);
}
bool SpellEffectInfo::IsTargetingArea() const
@@ -1020,7 +1020,7 @@ bool SpellInfo::IsPassiveStackableWithRanks() const
bool SpellInfo::IsMultiSlotAura() const
{
- return IsPassive() || Id == 44413;
+ return IsPassive() || Id == 40075 || Id == 44413; // No other way to make 40075 have more than 1 copy of aura
}
bool SpellInfo::IsDeathPersistent() const
@@ -1127,10 +1127,6 @@ bool SpellInfo::CanPierceImmuneAura(SpellInfo const* aura) const
bool SpellInfo::CanDispelAura(SpellInfo const* aura) const
{
- // These auras (like ressurection sickness) can't be dispelled
- if (aura->Attributes & SPELL_ATTR0_NEGATIVE_1)
- return false;
-
// These spells (like Mass Dispel) can dispell all auras
if (Attributes & SPELL_ATTR0_UNAFFECTED_BY_INVULNERABILITY)
return true;
@@ -2205,14 +2201,15 @@ bool SpellInfo::_IsPositiveEffect(uint8 effIndex, bool deep) const
case SPELLFAMILY_GENERIC:
switch (Id)
{
+ case 29214: // Wrath of the Plaguebringer
case 34700: // Allergic Reaction
+ case 54836: // Wrath of the Plaguebringer
case 61987: // Avenging Wrath Marker
case 61988: // Divine Shield exclude aura
- case 62532: // Conservator's Grip
return false;
+ case 30877: // Tag Murloc
case 61716: // Rabbit Costume
case 61734: // Noblegarden Bunny
- case 30877: // Tag Murloc
case 62344: // Fists of Stone
return true;
default:
@@ -2298,6 +2295,8 @@ bool SpellInfo::_IsPositiveEffect(uint8 effIndex, bool deep) const
case SPELL_EFFECT_HEAL_PCT:
case SPELL_EFFECT_ENERGIZE_PCT:
return true;
+ case SPELL_EFFECT_APPLY_AREA_AURA_ENEMY:
+ return false;
// non-positive aura use
case SPELL_EFFECT_APPLY_AURA:
diff --git a/src/server/game/Spells/SpellInfo.h b/src/server/game/Spells/SpellInfo.h
index 54430cd7116..2d53c7d8ace 100644
--- a/src/server/game/Spells/SpellInfo.h
+++ b/src/server/game/Spells/SpellInfo.h
@@ -67,7 +67,7 @@ enum SpellCastTargetFlags
| TARGET_FLAG_UNIT_ENEMY | TARGET_FLAG_UNIT_ALLY | TARGET_FLAG_UNIT_DEAD | TARGET_FLAG_UNIT_MINIPET | TARGET_FLAG_UNIT_PASSENGER,
TARGET_FLAG_GAMEOBJECT_MASK = TARGET_FLAG_GAMEOBJECT | TARGET_FLAG_GAMEOBJECT_ITEM,
TARGET_FLAG_CORPSE_MASK = TARGET_FLAG_CORPSE_ALLY | TARGET_FLAG_CORPSE_ENEMY,
- TARGET_FLAG_ITEM_MASK = TARGET_FLAG_TRADE_ITEM | TARGET_FLAG_ITEM | TARGET_FLAG_GAMEOBJECT_ITEM,
+ TARGET_FLAG_ITEM_MASK = TARGET_FLAG_TRADE_ITEM | TARGET_FLAG_ITEM | TARGET_FLAG_GAMEOBJECT_ITEM
};
enum SpellTargetSelectionCategories
@@ -77,7 +77,7 @@ enum SpellTargetSelectionCategories
TARGET_SELECT_CATEGORY_CHANNEL,
TARGET_SELECT_CATEGORY_NEARBY,
TARGET_SELECT_CATEGORY_CONE,
- TARGET_SELECT_CATEGORY_AREA,
+ TARGET_SELECT_CATEGORY_AREA
};
enum SpellTargetReferenceTypes
@@ -87,7 +87,7 @@ enum SpellTargetReferenceTypes
TARGET_REFERENCE_TYPE_TARGET,
TARGET_REFERENCE_TYPE_LAST,
TARGET_REFERENCE_TYPE_SRC,
- TARGET_REFERENCE_TYPE_DEST,
+ TARGET_REFERENCE_TYPE_DEST
};
enum SpellTargetObjectTypes
@@ -103,7 +103,7 @@ enum SpellTargetObjectTypes
TARGET_OBJECT_TYPE_CORPSE,
// only for effect target type
TARGET_OBJECT_TYPE_CORPSE_ENEMY,
- TARGET_OBJECT_TYPE_CORPSE_ALLY,
+ TARGET_OBJECT_TYPE_CORPSE_ALLY
};
enum SpellTargetCheckTypes
@@ -115,7 +115,7 @@ enum SpellTargetCheckTypes
TARGET_CHECK_PARTY,
TARGET_CHECK_RAID,
TARGET_CHECK_RAID_CLASS,
- TARGET_CHECK_PASSENGER,
+ TARGET_CHECK_PASSENGER
};
enum SpellTargetDirectionTypes
@@ -130,14 +130,14 @@ enum SpellTargetDirectionTypes
TARGET_DIR_BACK_LEFT,
TARGET_DIR_FRONT_LEFT,
TARGET_DIR_RANDOM,
- TARGET_DIR_ENTRY,
+ TARGET_DIR_ENTRY
};
enum SpellEffectImplicitTargetTypes
{
EFFECT_IMPLICIT_TARGET_NONE = 0,
EFFECT_IMPLICIT_TARGET_EXPLICIT,
- EFFECT_IMPLICIT_TARGET_CASTER,
+ EFFECT_IMPLICIT_TARGET_CASTER
};
// Spell clasification
@@ -165,7 +165,7 @@ enum SpellSpecificType
SPELL_SPECIFIC_MAGE_ARCANE_BRILLANCE = 25,
SPELL_SPECIFIC_WARRIOR_ENRAGE = 26,
SPELL_SPECIFIC_PRIEST_DIVINE_SPIRIT = 27,
- SPELL_SPECIFIC_HAND = 28,
+ SPELL_SPECIFIC_HAND = 28
};
enum SpellCustomAttributes
@@ -187,7 +187,7 @@ enum SpellCustomAttributes
SPELL_ATTR0_CU_REQ_TARGET_FACING_CASTER = 0x00010000,
SPELL_ATTR0_CU_REQ_CASTER_BEHIND_TARGET = 0x00020000,
- SPELL_ATTR0_CU_NEGATIVE = SPELL_ATTR0_CU_NEGATIVE_EFF0 | SPELL_ATTR0_CU_NEGATIVE_EFF1 | SPELL_ATTR0_CU_NEGATIVE_EFF2,
+ SPELL_ATTR0_CU_NEGATIVE = SPELL_ATTR0_CU_NEGATIVE_EFF0 | SPELL_ATTR0_CU_NEGATIVE_EFF1 | SPELL_ATTR0_CU_NEGATIVE_EFF2
};
uint32 GetTargetFlagMask(SpellTargetObjectTypes objType);
diff --git a/src/server/game/Spells/SpellMgr.cpp b/src/server/game/Spells/SpellMgr.cpp
index 3cc3a877337..81807e63fb1 100755
--- a/src/server/game/Spells/SpellMgr.cpp
+++ b/src/server/game/Spells/SpellMgr.cpp
@@ -30,6 +30,8 @@
#include "CreatureAI.h"
#include "MapManager.h"
#include "BattlegroundIC.h"
+#include "BattlefieldWG.h"
+#include "BattlefieldMgr.h"
bool IsPrimaryProfessionSkill(uint32 skill)
{
@@ -1120,10 +1122,20 @@ bool SpellArea::IsFitToRequirements(Player const* player, uint32 newZone, uint32
return false;
break;
}
+ case 58730: // No fly Zone - Wintergrasp
+ {
+ if (!player)
+ return false;
+
+ Battlefield* Bf = sBattlefieldMgr->GetBattlefieldToZoneId(player->GetZoneId());
+ if (!Bf || Bf->CanFlyIn() || (!player->HasAuraType(SPELL_AURA_MOD_INCREASE_MOUNTED_FLIGHT_SPEED) && !player->HasAuraType(SPELL_AURA_FLY)))
+ return false;
+ break;
+ }
case 68719: // Oil Refinery - Isle of Conquest.
case 68720: // Quarry - Isle of Conquest.
{
- if (player->GetBattlegroundTypeId() != BATTLEGROUND_IC || !player->GetBattleground())
+ if (!player || player->GetBattlegroundTypeId() != BATTLEGROUND_IC || !player->GetBattleground())
return false;
uint8 nodeType = spellId == 68719 ? NODE_TYPE_REFINERY : NODE_TYPE_QUARRY;
@@ -1135,6 +1147,46 @@ bool SpellArea::IsFitToRequirements(Player const* player, uint32 newZone, uint32
return false;
}
+ case 56618: // Horde Controls Factory Phase Shift
+ case 56617: // Alliance Controls Factory Phase Shift
+ {
+ if (!player)
+ return false;
+
+ Battlefield* bf = sBattlefieldMgr->GetBattlefieldToZoneId(player->GetZoneId());
+
+ if (!bf || bf->GetTypeId() != BATTLEFIELD_WG)
+ return false;
+
+ // team that controls the workshop in the specified area
+ uint32 team = bf->GetData(newArea);
+
+ if (team == TEAM_HORDE)
+ return spellId == 56618;
+ else if (team == TEAM_ALLIANCE)
+ return spellId == 56617;
+ }
+ break;
+ case 57940: // Essence of Wintergrasp - Northrend
+ case 58045: // Essence of Wintergrasp - Wintergrasp
+ {
+ if (!player)
+ return false;
+
+ if (Battlefield* battlefieldWG = sBattlefieldMgr->GetBattlefieldByBattleId(BATTLEFIELD_BATTLEID_WG))
+ return battlefieldWG->IsEnabled() && (player->GetTeamId() == battlefieldWG->GetDefenderTeam()) && !battlefieldWG->IsWarTime();
+ break;
+ }
+ case 74411: // Battleground - Dampening
+ {
+ if (!player)
+ return false;
+
+ if (Battlefield* bf = sBattlefieldMgr->GetBattlefieldToZoneId(player->GetZoneId()))
+ return bf->IsWarTime();
+ break;
+ }
+
}
return true;
@@ -1155,7 +1207,7 @@ void SpellMgr::LoadSpellRanks()
if (!result)
{
- sLog->outInfo(LOG_FILTER_SPELLS_AURAS, ">> Loaded 0 spell rank records. DB table `spell_ranks` is empty.");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 spell rank records. DB table `spell_ranks` is empty.");
return;
}
@@ -1251,7 +1303,7 @@ void SpellMgr::LoadSpellRanks()
while (true);
} while (!finished);
- sLog->outInfo(LOG_FILTER_SPELLS_AURAS, ">> Loaded %u spell rank records in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u spell rank records in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
}
@@ -1267,7 +1319,7 @@ void SpellMgr::LoadSpellRequired()
if (!result)
{
- sLog->outInfo(LOG_FILTER_SPELLS_AURAS, ">> Loaded 0 spell required records. DB table `spell_required` is empty.");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 spell required records. DB table `spell_required` is empty.");
return;
}
@@ -1312,7 +1364,7 @@ void SpellMgr::LoadSpellRequired()
++count;
} while (result->NextRow());
- sLog->outInfo(LOG_FILTER_SPELLS_AURAS, ">> Loaded %u spell required records in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u spell required records in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
}
@@ -1350,8 +1402,7 @@ void SpellMgr::LoadSpellLearnSkills()
}
}
- sLog->outInfo(LOG_FILTER_SPELLS_AURAS, ">> Loaded %u Spell Learn Skills from DBC in %u ms", dbc_count, GetMSTimeDiffToNow(oldMSTime));
-
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u Spell Learn Skills from DBC in %u ms", dbc_count, GetMSTimeDiffToNow(oldMSTime));
}
void SpellMgr::LoadSpellLearnSpells()
@@ -1364,8 +1415,7 @@ void SpellMgr::LoadSpellLearnSpells()
QueryResult result = WorldDatabase.Query("SELECT entry, SpellID, Active FROM spell_learn_spell");
if (!result)
{
- sLog->outInfo(LOG_FILTER_SPELLS_AURAS, ">> Loaded 0 spell learn spells. DB table `spell_learn_spell` is empty.");
-
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 spell learn spells. DB table `spell_learn_spell` is empty.");
return;
}
@@ -1453,8 +1503,7 @@ void SpellMgr::LoadSpellLearnSpells()
}
}
- sLog->outInfo(LOG_FILTER_SPELLS_AURAS, ">> Loaded %u spell learn spells + %u found in DBC in %u ms", count, dbc_count, GetMSTimeDiffToNow(oldMSTime));
-
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u spell learn spells + %u found in DBC in %u ms", count, dbc_count, GetMSTimeDiffToNow(oldMSTime));
}
void SpellMgr::LoadSpellTargetPositions()
@@ -1467,8 +1516,7 @@ void SpellMgr::LoadSpellTargetPositions()
QueryResult result = WorldDatabase.Query("SELECT id, target_map, target_position_x, target_position_y, target_position_z, target_orientation FROM spell_target_position");
if (!result)
{
- sLog->outInfo(LOG_FILTER_SPELLS_AURAS, ">> Loaded 0 spell target coordinates. DB table `spell_target_position` is empty.");
-
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 spell target coordinates. DB table `spell_target_position` is empty.");
return;
}
@@ -1573,8 +1621,7 @@ void SpellMgr::LoadSpellTargetPositions()
}
}*/
- sLog->outInfo(LOG_FILTER_SPELLS_AURAS, ">> Loaded %u spell teleport coordinates in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
-
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u spell teleport coordinates in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
}
void SpellMgr::LoadSpellGroups()
@@ -1588,8 +1635,7 @@ void SpellMgr::LoadSpellGroups()
QueryResult result = WorldDatabase.Query("SELECT id, spell_id FROM spell_group");
if (!result)
{
- sLog->outInfo(LOG_FILTER_SPELLS_AURAS, ">> Loaded 0 spell group definitions. DB table `spell_group` is empty.");
-
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 spell group definitions. DB table `spell_group` is empty.");
return;
}
@@ -1655,8 +1701,7 @@ void SpellMgr::LoadSpellGroups()
}
}
- sLog->outInfo(LOG_FILTER_SPELLS_AURAS, ">> Loaded %u spell group definitions in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
-
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u spell group definitions in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
}
void SpellMgr::LoadSpellGroupStackRules()
@@ -1669,8 +1714,7 @@ void SpellMgr::LoadSpellGroupStackRules()
QueryResult result = WorldDatabase.Query("SELECT group_id, stack_rule FROM spell_group_stack_rules");
if (!result)
{
- sLog->outInfo(LOG_FILTER_SPELLS_AURAS, ">> Loaded 0 spell group stack rules. DB table `spell_group_stack_rules` is empty.");
-
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 spell group stack rules. DB table `spell_group_stack_rules` is empty.");
return;
}
@@ -1700,8 +1744,7 @@ void SpellMgr::LoadSpellGroupStackRules()
++count;
} while (result->NextRow());
- sLog->outInfo(LOG_FILTER_SPELLS_AURAS, ">> Loaded %u spell group stack rules in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
-
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u spell group stack rules in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
}
void SpellMgr::LoadSpellProcEvents()
@@ -1714,8 +1757,7 @@ void SpellMgr::LoadSpellProcEvents()
QueryResult result = WorldDatabase.Query("SELECT entry, SchoolMask, SpellFamilyName, SpellFamilyMask0, SpellFamilyMask1, SpellFamilyMask2, procFlags, procEx, ppmRate, CustomChance, Cooldown FROM spell_proc_event");
if (!result)
{
- sLog->outInfo(LOG_FILTER_SPELLS_AURAS, ">> Loaded 0 spell proc event conditions. DB table `spell_proc_event` is empty.");
-
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 spell proc event conditions. DB table `spell_proc_event` is empty.");
return;
}
@@ -1762,9 +1804,9 @@ void SpellMgr::LoadSpellProcEvents()
} while (result->NextRow());
if (customProc)
- sLog->outInfo(LOG_FILTER_SPELLS_AURAS, ">> Loaded %u extra and %u custom spell proc event conditions in %u ms", count, customProc, GetMSTimeDiffToNow(oldMSTime));
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u extra and %u custom spell proc event conditions in %u ms", count, customProc, GetMSTimeDiffToNow(oldMSTime));
else
- sLog->outInfo(LOG_FILTER_SPELLS_AURAS, ">> Loaded %u extra spell proc event conditions in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u extra spell proc event conditions in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
}
@@ -1778,8 +1820,7 @@ void SpellMgr::LoadSpellProcs()
QueryResult result = WorldDatabase.Query("SELECT spellId, schoolMask, spellFamilyName, spellFamilyMask0, spellFamilyMask1, spellFamilyMask2, typeMask, spellTypeMask, spellPhaseMask, hitMask, attributesMask, ratePerMinute, chance, cooldown, charges FROM spell_proc");
if (!result)
{
- sLog->outInfo(LOG_FILTER_SPELLS_AURAS, ">> Loaded 0 spell proc conditions and data. DB table `spell_proc` is empty.");
-
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 spell proc conditions and data. DB table `spell_proc` is empty.");
return;
}
@@ -1905,8 +1946,7 @@ void SpellMgr::LoadSpellProcs()
++count;
} while (result->NextRow());
- sLog->outInfo(LOG_FILTER_SPELLS_AURAS, ">> Loaded %u spell proc conditions and data in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
-
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u spell proc conditions and data in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
}
void SpellMgr::LoadSpellBonusess()
@@ -1919,8 +1959,7 @@ void SpellMgr::LoadSpellBonusess()
QueryResult result = WorldDatabase.Query("SELECT entry, direct_bonus, dot_bonus, ap_bonus, ap_dot_bonus FROM spell_bonus_data");
if (!result)
{
- sLog->outInfo(LOG_FILTER_SPELLS_AURAS, ">> Loaded 0 spell bonus data. DB table `spell_bonus_data` is empty.");
-
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 spell bonus data. DB table `spell_bonus_data` is empty.");
return;
}
@@ -1946,8 +1985,7 @@ void SpellMgr::LoadSpellBonusess()
++count;
} while (result->NextRow());
- sLog->outInfo(LOG_FILTER_SPELLS_AURAS, ">> Loaded %u extra spell bonus data in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
-
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u extra spell bonus data in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
}
void SpellMgr::LoadSpellThreats()
@@ -1960,8 +1998,7 @@ void SpellMgr::LoadSpellThreats()
QueryResult result = WorldDatabase.Query("SELECT entry, flatMod, pctMod, apPctMod FROM spell_threat");
if (!result)
{
- sLog->outInfo(LOG_FILTER_SPELLS_AURAS, ">> Loaded 0 aggro generating spells. DB table `spell_threat` is empty.");
-
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 aggro generating spells. DB table `spell_threat` is empty.");
return;
}
@@ -1987,8 +2024,7 @@ void SpellMgr::LoadSpellThreats()
++count;
} while (result->NextRow());
- sLog->outInfo(LOG_FILTER_SPELLS_AURAS, ">> Loaded %u SpellThreatEntries in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
-
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u SpellThreatEntries in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
}
void SpellMgr::LoadSkillLineAbilityMap()
@@ -2009,8 +2045,7 @@ void SpellMgr::LoadSkillLineAbilityMap()
++count;
}
- sLog->outInfo(LOG_FILTER_SPELLS_AURAS, ">> Loaded %u SkillLineAbility MultiMap Data in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
-
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u SkillLineAbility MultiMap Data in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
}
void SpellMgr::LoadSpellPetAuras()
@@ -2023,8 +2058,7 @@ void SpellMgr::LoadSpellPetAuras()
QueryResult result = WorldDatabase.Query("SELECT spell, effectId, pet, aura FROM spell_pet_auras");
if (!result)
{
- sLog->outInfo(LOG_FILTER_SPELLS_AURAS, ">> Loaded 0 spell pet auras. DB table `spell_pet_auras` is empty.");
-
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 spell pet auras. DB table `spell_pet_auras` is empty.");
return;
}
@@ -2071,8 +2105,7 @@ void SpellMgr::LoadSpellPetAuras()
++count;
} while (result->NextRow());
- sLog->outInfo(LOG_FILTER_SPELLS_AURAS, ">> Loaded %u spell pet auras in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
-
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u spell pet auras in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
}
// Fill custom data about enchancments
@@ -2112,8 +2145,7 @@ void SpellMgr::LoadEnchantCustomAttr()
}
}
- sLog->outInfo(LOG_FILTER_SPELLS_AURAS, ">> Loaded %u custom enchant attributes in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
-
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u custom enchant attributes in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
}
void SpellMgr::LoadSpellEnchantProcData()
@@ -2126,8 +2158,7 @@ void SpellMgr::LoadSpellEnchantProcData()
QueryResult result = WorldDatabase.Query("SELECT entry, customChance, PPMChance, procEx FROM spell_enchant_proc_data");
if (!result)
{
- sLog->outInfo(LOG_FILTER_SPELLS_AURAS, ">> Loaded 0 spell enchant proc event conditions. DB table `spell_enchant_proc_data` is empty.");
-
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 spell enchant proc event conditions. DB table `spell_enchant_proc_data` is empty.");
return;
}
@@ -2156,8 +2187,7 @@ void SpellMgr::LoadSpellEnchantProcData()
++count;
} while (result->NextRow());
- sLog->outInfo(LOG_FILTER_SPELLS_AURAS, ">> Loaded %u enchant proc data definitions in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
-
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u enchant proc data definitions in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
}
void SpellMgr::LoadSpellLinked()
@@ -2170,8 +2200,7 @@ void SpellMgr::LoadSpellLinked()
QueryResult result = WorldDatabase.Query("SELECT spell_trigger, spell_effect, type FROM spell_linked_spell");
if (!result)
{
- sLog->outInfo(LOG_FILTER_SPELLS_AURAS, ">> Loaded 0 linked spells. DB table `spell_linked_spell` is empty.");
-
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 linked spells. DB table `spell_linked_spell` is empty.");
return;
}
@@ -2209,8 +2238,7 @@ void SpellMgr::LoadSpellLinked()
++count;
} while (result->NextRow());
- sLog->outInfo(LOG_FILTER_SPELLS_AURAS, ">> Loaded %u linked spells in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
-
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u linked spells in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
}
void SpellMgr::LoadPetLevelupSpellMap()
@@ -2266,8 +2294,7 @@ void SpellMgr::LoadPetLevelupSpellMap()
}
}
- sLog->outInfo(LOG_FILTER_SPELLS_AURAS, ">> Loaded %u pet levelup and default spells for %u families in %u ms", count, family_count, GetMSTimeDiffToNow(oldMSTime));
-
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u pet levelup and default spells for %u families in %u ms", count, family_count, GetMSTimeDiffToNow(oldMSTime));
}
bool LoadPetDefaultSpells_helper(CreatureTemplate const* cInfo, PetDefaultSpellsEntry& petDefSpells)
@@ -2351,10 +2378,9 @@ void SpellMgr::LoadPetDefaultSpells()
}
}
- sLog->outInfo(LOG_FILTER_SPELLS_AURAS, ">> Loaded addition spells for %u pet spell data entries in %u ms", countData, GetMSTimeDiffToNow(oldMSTime));
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded addition spells for %u pet spell data entries in %u ms", countData, GetMSTimeDiffToNow(oldMSTime));
-
- sLog->outInfo(LOG_FILTER_SPELLS_AURAS, "Loading summonable creature templates...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading summonable creature templates...");
oldMSTime = getMSTime();
// different summon spells
@@ -2395,8 +2421,7 @@ void SpellMgr::LoadPetDefaultSpells()
}
}
- sLog->outInfo(LOG_FILTER_SPELLS_AURAS, ">> Loaded %u summonable creature templates in %u ms", countCreature, GetMSTimeDiffToNow(oldMSTime));
-
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u summonable creature templates in %u ms", countCreature, GetMSTimeDiffToNow(oldMSTime));
}
void SpellMgr::LoadSpellAreas()
@@ -2414,7 +2439,7 @@ void SpellMgr::LoadSpellAreas()
if (!result)
{
- sLog->outInfo(LOG_FILTER_SPELLS_AURAS, ">> Loaded 0 spell area requirements. DB table `spell_area` is empty.");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 spell area requirements. DB table `spell_area` is empty.");
return;
}
@@ -2595,8 +2620,7 @@ void SpellMgr::LoadSpellAreas()
++count;
} while (result->NextRow());
- sLog->outInfo(LOG_FILTER_SPELLS_AURAS, ">> Loaded %u spell area requirements in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
-
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u spell area requirements in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
}
void SpellMgr::LoadSpellInfoStore()
@@ -2612,8 +2636,7 @@ void SpellMgr::LoadSpellInfoStore()
mSpellInfoMap[i] = new SpellInfo(spellEntry);
}
- sLog->outInfo(LOG_FILTER_SPELLS_AURAS, ">> Loaded spell custom attributes in %u ms", GetMSTimeDiffToNow(oldMSTime));
-
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded spell custom attributes in %u ms", GetMSTimeDiffToNow(oldMSTime));
}
void SpellMgr::UnloadSpellInfoStore()
@@ -2925,8 +2948,7 @@ void SpellMgr::LoadSpellCustomAttr()
CreatureAI::FillAISpellInfo();
- sLog->outInfo(LOG_FILTER_SPELLS_AURAS, ">> Loaded spell custom attributes in %u ms", GetMSTimeDiffToNow(oldMSTime));
-
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded spell custom attributes in %u ms", GetMSTimeDiffToNow(oldMSTime));
}
void SpellMgr::LoadDbcDataCorrections()
@@ -3241,9 +3263,21 @@ void SpellMgr::LoadDbcDataCorrections()
// this needs research on modifier applying rules, does not seem to be in Attributes fields
spellInfo->EffectSpellClassMask[0] = flag96(0x00000040, 0x00000000, 0x00000000);
break;
- case 63163: // Apply Enchanted Bridle (Argent Tournament)
- spellInfo->EffectDieSides[0] = 0; // was 1, that should probably mean seat 0, but instead it's treated as spell 1
- spellInfo->EffectBasePoints[0] = 52391; // Ride Vehicle (forces seat 0)
+ case 64949: // Idol of the Flourishing Life
+ spellInfo->EffectSpellClassMask[EFFECT_0] = flag96(0x00000000, 0x02000000, 0x00000000);
+ spellInfo->EffectApplyAuraName[EFFECT_0] = SPELL_AURA_ADD_FLAT_MODIFIER;
+ break;
+ case 34231: // Libram of the Lightbringer
+ case 60792: // Libram of Tolerance
+ case 64956: // Libram of the Resolute
+ spellInfo->EffectSpellClassMask[EFFECT_0] = flag96(0x80000000, 0x00000000, 0x00000000);
+ spellInfo->EffectApplyAuraName[EFFECT_0] = SPELL_AURA_ADD_FLAT_MODIFIER;
+ break;
+ case 28851: // Libram of Light
+ case 28853: // Libram of Divinity
+ case 32403: // Blessed Book of Nagrand
+ spellInfo->EffectSpellClassMask[EFFECT_0] = flag96(0x40000000, 0x00000000, 0x00000000);
+ spellInfo->EffectApplyAuraName[EFFECT_0] = SPELL_AURA_ADD_FLAT_MODIFIER;
break;
case 45602: // Ride Carpet
spellInfo->EffectBasePoints[EFFECT_0] = 0; // force seat 0, vehicle doesn't have the required seat flags for "no seat specified (-1)"
@@ -3388,6 +3422,9 @@ void SpellMgr::LoadDbcDataCorrections()
case 71159: // Awaken Plagued Zombies
spellInfo->DurationIndex = 21;
break;
+ case 70530: // Volatile Ooze Beam Protection (Professor Putricide)
+ spellInfo->Effect[0] = SPELL_EFFECT_APPLY_AURA; // for an unknown reason this was SPELL_EFFECT_APPLY_AREA_AURA_RAID
+ break;
// THIS IS HERE BECAUSE COOLDOWN ON CREATURE PROCS IS NOT IMPLEMENTED
case 71604: // Mutated Strength (Professor Putricide)
case 72673: // Mutated Strength (Professor Putricide)
@@ -3569,6 +3606,5 @@ void SpellMgr::LoadDbcDataCorrections()
properties = const_cast<SummonPropertiesEntry*>(sSummonPropertiesStore.LookupEntry(647)); // 52893
properties->Type = SUMMON_TYPE_TOTEM;
- sLog->outInfo(LOG_FILTER_SPELLS_AURAS, ">> Loading spell dbc data corrections in %u ms", GetMSTimeDiffToNow(oldMSTime));
-
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loading spell dbc data corrections in %u ms", GetMSTimeDiffToNow(oldMSTime));
}
diff --git a/src/server/game/Spells/SpellMgr.h b/src/server/game/Spells/SpellMgr.h
index dcf3c38fe4f..9423ebf2893 100755
--- a/src/server/game/Spells/SpellMgr.h
+++ b/src/server/game/Spells/SpellMgr.h
@@ -38,8 +38,8 @@ enum SpellCategories
SPELLCATEGORY_HEALTH_MANA_POTIONS = 4,
SPELLCATEGORY_DEVOUR_MAGIC = 12,
SPELLCATEGORY_JUDGEMENT = 1210, // Judgement (seal trigger)
- SPELLCATEGORY_FOOD = 11,
- SPELLCATEGORY_DRINK = 59,
+ SPELLCATEGORY_FOOD = 11,
+ SPELLCATEGORY_DRINK = 59
};
//SpellFamilyFlags
@@ -85,7 +85,7 @@ enum SpellFamilyFlag
SPELLFAMILYFLAG_DK_DEATH_COIL = 0x00002000,
// TODO: Figure out a more accurate name for the following familyflag(s)
- SPELLFAMILYFLAG_SHAMAN_TOTEM_EFFECTS = 0x04000000, // Seems to be linked to most totems and some totem effects
+ SPELLFAMILYFLAG_SHAMAN_TOTEM_EFFECTS = 0x04000000 // Seems to be linked to most totems and some totem effects
};
@@ -96,7 +96,7 @@ enum SpellLinkedType
SPELL_LINK_CAST = 0, // +: cast; -: remove
SPELL_LINK_HIT = 1 * 200000,
SPELL_LINK_AURA = 2 * 200000, // +: aura; -: immune
- SPELL_LINK_REMOVE = 0,
+ SPELL_LINK_REMOVE = 0
};
@@ -177,7 +177,7 @@ enum ProcFlags
| PROC_FLAG_TAKEN_SPELL_MAGIC_DMG_CLASS_POS | PROC_FLAG_TAKEN_SPELL_MAGIC_DMG_CLASS_NEG
| PROC_FLAG_TAKEN_PERIODIC | PROC_FLAG_TAKEN_DAMAGE,
- REQ_SPELL_PHASE_PROC_FLAG_MASK = SPELL_PROC_FLAG_MASK & DONE_HIT_PROC_FLAG_MASK,
+ REQ_SPELL_PHASE_PROC_FLAG_MASK = SPELL_PROC_FLAG_MASK & DONE_HIT_PROC_FLAG_MASK
};
#define MELEE_BASED_TRIGGER_MASK (PROC_FLAG_DONE_MELEE_AUTO_ATTACK | \
@@ -261,12 +261,12 @@ enum ProcFlagsHit
PROC_HIT_REFLECT = 0x0000800,
PROC_HIT_INTERRUPT = 0x0001000, // (not used atm)
PROC_HIT_FULL_BLOCK = 0x0002000,
- PROC_HIT_MASK_ALL = 0x2FFF,
+ PROC_HIT_MASK_ALL = 0x2FFF
};
enum ProcAttributes
{
- PROC_ATTR_REQ_EXP_OR_HONOR = 0x0000010,
+ PROC_ATTR_REQ_EXP_OR_HONOR = 0x0000010
};
struct SpellProcEventEntry
@@ -322,12 +322,12 @@ typedef UNORDERED_MAP<uint32, SpellBonusEntry> SpellBonusMap;
enum SpellGroup
{
- SPELL_GROUP_NONE = 0,
- SPELL_GROUP_ELIXIR_BATTLE = 1,
- SPELL_GROUP_ELIXIR_GUARDIAN = 2,
- SPELL_GROUP_ELIXIR_UNSTABLE = 3,
+ SPELL_GROUP_NONE = 0,
+ SPELL_GROUP_ELIXIR_BATTLE = 1,
+ SPELL_GROUP_ELIXIR_GUARDIAN = 2,
+ SPELL_GROUP_ELIXIR_UNSTABLE = 3,
SPELL_GROUP_ELIXIR_SHATTRATH = 4,
- SPELL_GROUP_CORE_RANGE_MAX = 5,
+ SPELL_GROUP_CORE_RANGE_MAX = 5
};
#define SPELL_GROUP_DB_RANGE_MIN 1000
@@ -342,11 +342,12 @@ typedef std::pair<SpellGroupSpellMap::const_iterator, SpellGroupSpellMap::const_
enum SpellGroupStackRule
{
- SPELL_GROUP_STACK_RULE_DEFAULT = 0,
- SPELL_GROUP_STACK_RULE_EXCLUSIVE = 1,
+ SPELL_GROUP_STACK_RULE_DEFAULT = 0,
+ SPELL_GROUP_STACK_RULE_EXCLUSIVE = 1,
SPELL_GROUP_STACK_RULE_EXCLUSIVE_FROM_SAME_CASTER = 2,
- SPELL_GROUP_STACK_RULE_EXCLUSIVE_SAME_EFFECT = 3,
+ SPELL_GROUP_STACK_RULE_EXCLUSIVE_SAME_EFFECT = 3
};
+
#define SPELL_GROUP_STACK_RULE_MAX 4
typedef std::map<SpellGroup, SpellGroupStackRule> SpellGroupStackMap;
@@ -441,7 +442,7 @@ class PetAura
typedef UNORDERED_MAP<uint32, uint32> PetAuraMap;
public:
- PetAura()
+ PetAura() : removeOnChangePet(false), damage(0)
{
auras.clear();
}
diff --git a/src/server/game/Spells/SpellScript.h b/src/server/game/Spells/SpellScript.h
index 376e7f18edc..460a4e20d7f 100755
--- a/src/server/game/Spells/SpellScript.h
+++ b/src/server/game/Spells/SpellScript.h
@@ -47,7 +47,7 @@ enum SpellScriptState
SPELL_SCRIPT_STATE_NONE = 0,
SPELL_SCRIPT_STATE_REGISTRATION,
SPELL_SCRIPT_STATE_LOADING,
- SPELL_SCRIPT_STATE_UNLOADING,
+ SPELL_SCRIPT_STATE_UNLOADING
};
#define SPELL_SCRIPT_STATE_END SPELL_SCRIPT_STATE_UNLOADING + 1
@@ -136,7 +136,7 @@ enum SpellScriptHookType
SPELL_SCRIPT_HOOK_CHECK_CAST,
SPELL_SCRIPT_HOOK_BEFORE_CAST,
SPELL_SCRIPT_HOOK_ON_CAST,
- SPELL_SCRIPT_HOOK_AFTER_CAST,
+ SPELL_SCRIPT_HOOK_AFTER_CAST
};
#define HOOK_SPELL_HIT_START SPELL_SCRIPT_HOOK_EFFECT_HIT
@@ -425,7 +425,7 @@ enum AuraScriptHookType
AURA_SCRIPT_HOOK_EFFECT_AFTER_MANASHIELD,
AURA_SCRIPT_HOOK_CHECK_AREA_TARGET,
AURA_SCRIPT_HOOK_DISPEL,
- AURA_SCRIPT_HOOK_AFTER_DISPEL,
+ AURA_SCRIPT_HOOK_AFTER_DISPEL
/*AURA_SCRIPT_HOOK_APPLY,
AURA_SCRIPT_HOOK_REMOVE, */
};
diff --git a/src/server/game/Texts/CreatureTextMgr.cpp b/src/server/game/Texts/CreatureTextMgr.cpp
index f64043b7038..7818527b34b 100755
--- a/src/server/game/Texts/CreatureTextMgr.cpp
+++ b/src/server/game/Texts/CreatureTextMgr.cpp
@@ -77,7 +77,7 @@ void CreatureTextMgr::LoadCreatureTexts()
if (!result)
{
- sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded 0 ceature texts. DB table `creature_texts` is empty.");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 ceature texts. DB table `creature_texts` is empty.");
return;
}
@@ -136,7 +136,7 @@ void CreatureTextMgr::LoadCreatureTexts()
++textCount;
} while (result->NextRow());
- sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded %u creature texts for %u creatures in %u ms", textCount, creatureCount, GetMSTimeDiffToNow(oldMSTime));
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u creature texts for %u creatures in %u ms", textCount, creatureCount, GetMSTimeDiffToNow(oldMSTime));
}
@@ -166,7 +166,7 @@ void CreatureTextMgr::LoadCreatureTextLocales()
++textCount;
} while (result->NextRow());
- sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded %u creature localized texts in %u ms", textCount, GetMSTimeDiffToNow(oldMSTime));
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u creature localized texts in %u ms", textCount, GetMSTimeDiffToNow(oldMSTime));
}
diff --git a/src/server/game/Tickets/TicketMgr.cpp b/src/server/game/Tickets/TicketMgr.cpp
index d03ffbbb1f6..0a4682db759 100755
--- a/src/server/game/Tickets/TicketMgr.cpp
+++ b/src/server/game/Tickets/TicketMgr.cpp
@@ -263,7 +263,7 @@ void TicketMgr::LoadTickets()
PreparedQueryResult result = CharacterDatabase.Query(stmt);
if (!result)
{
- sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded 0 GM tickets. DB table `gm_tickets` is empty!");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 GM tickets. DB table `gm_tickets` is empty!");
return;
}
@@ -290,7 +290,7 @@ void TicketMgr::LoadTickets()
++count;
} while (result->NextRow());
- sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded %u GM tickets in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u GM tickets in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
}
@@ -303,7 +303,7 @@ void TicketMgr::LoadSurveys()
if (QueryResult result = CharacterDatabase.Query("SELECT MAX(surveyId) FROM gm_surveys"))
_lastSurveyId = (*result)[0].GetUInt32();
- sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded GM Survey count from database in %u ms", GetMSTimeDiffToNow(oldMSTime));
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded GM Survey count from database in %u ms", GetMSTimeDiffToNow(oldMSTime));
}
diff --git a/src/server/game/Tickets/TicketMgr.h b/src/server/game/Tickets/TicketMgr.h
index be8b4063d84..ecf315c059c 100755
--- a/src/server/game/Tickets/TicketMgr.h
+++ b/src/server/game/Tickets/TicketMgr.h
@@ -29,13 +29,13 @@ class ChatHandler;
enum GMTicketSystemStatus
{
GMTICKET_QUEUE_STATUS_DISABLED = 0,
- GMTICKET_QUEUE_STATUS_ENABLED = 1,
+ GMTICKET_QUEUE_STATUS_ENABLED = 1
};
enum GMTicketStatus
{
GMTICKET_STATUS_HASTEXT = 0x06,
- GMTICKET_STATUS_DEFAULT = 0x0A,
+ GMTICKET_STATUS_DEFAULT = 0x0A
};
enum GMTicketResponse
@@ -45,7 +45,7 @@ enum GMTicketResponse
GMTICKET_RESPONSE_CREATE_ERROR = 3,
GMTICKET_RESPONSE_UPDATE_SUCCESS = 4,
GMTICKET_RESPONSE_UPDATE_ERROR = 5,
- GMTICKET_RESPONSE_TICKET_DELETED = 9,
+ GMTICKET_RESPONSE_TICKET_DELETED = 9
};
// from Blizzard LUA:
@@ -58,14 +58,14 @@ enum GMTicketEscalationStatus
TICKET_UNASSIGNED = 0,
TICKET_ASSIGNED = 1,
TICKET_IN_ESCALATION_QUEUE = 2,
- TICKET_ESCALATED_ASSIGNED = 3,
+ TICKET_ESCALATED_ASSIGNED = 3
};
// from blizzard lua
enum GMTicketOpenedByGMStatus
{
GMTICKET_OPENEDBYGM_STATUS_NOT_OPENED = 0, // ticket has never been opened by a gm
- GMTICKET_OPENEDBYGM_STATUS_OPENED = 1, // ticket has been opened by a gm
+ GMTICKET_OPENEDBYGM_STATUS_OPENED = 1 // ticket has been opened by a gm
};
enum LagReportType
diff --git a/src/server/game/Tools/CharacterDatabaseCleaner.cpp b/src/server/game/Tools/CharacterDatabaseCleaner.cpp
index 2bd9a157e73..f87b81c8be8 100644
--- a/src/server/game/Tools/CharacterDatabaseCleaner.cpp
+++ b/src/server/game/Tools/CharacterDatabaseCleaner.cpp
@@ -63,7 +63,7 @@ void CharacterDatabaseCleaner::CleanDatabase()
sWorld->SetCleaningFlags(flags);
- sLog->outInfo(LOG_FILTER_GENERAL, ">> Cleaned character database in %u ms", GetMSTimeDiffToNow(oldMSTime));
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Cleaned character database in %u ms", GetMSTimeDiffToNow(oldMSTime));
}
diff --git a/src/server/game/Tools/PlayerDump.h b/src/server/game/Tools/PlayerDump.h
index b5655328507..6662d91fb31 100755
--- a/src/server/game/Tools/PlayerDump.h
+++ b/src/server/game/Tools/PlayerDump.h
@@ -48,7 +48,7 @@ enum DumpTableType
DTT_ITEM_GIFT, // <- item guids // character_gifts
DTT_PET, // -> pet guids collection // character_pet
- DTT_PET_TABLE, // <- pet guids // pet_aura, pet_spell, pet_spell_cooldown
+ DTT_PET_TABLE // <- pet guids // pet_aura, pet_spell, pet_spell_cooldown
};
enum DumpReturn
diff --git a/src/server/game/Warden/Warden.cpp b/src/server/game/Warden/Warden.cpp
index 06f11cfaa2c..d651fbd4ce1 100644
--- a/src/server/game/Warden/Warden.cpp
+++ b/src/server/game/Warden/Warden.cpp
@@ -105,9 +105,8 @@ void Warden::Update()
// Kick player if client response delays more than set in config
if (_clientResponseTimer > maxClientResponseDelay * IN_MILLISECONDS)
{
- sLog->outDebug(LOG_FILTER_WARDEN, "WARDEN: Player %s (guid: %u, account: %u, latency: %u, IP: %s) exceeded Warden module response delay for more than %s - disconnecting client",
- _session->GetPlayerName(), _session->GetGuidLow(), _session->GetAccountId(), _session->GetLatency(), _session->GetRemoteAddress().c_str(),
- secsToTimeString(maxClientResponseDelay, true).c_str());
+ sLog->outWarn(LOG_FILTER_WARDEN, "%s (latency: %u, IP: %s) exceeded Warden module response delay for more than %s - disconnecting client",
+ _session->GetPlayerName(false).c_str(), _session->GetLatency(), _session->GetRemoteAddress().c_str(), secsToTimeString(maxClientResponseDelay, true).c_str());
_session->KickPlayer();
}
else
diff --git a/src/server/game/Warden/Warden.h b/src/server/game/Warden/Warden.h
index d16890b31b9..7a8f0f52315 100644
--- a/src/server/game/Warden/Warden.h
+++ b/src/server/game/Warden/Warden.h
@@ -54,7 +54,7 @@ enum WardenCheckType
DRIVER_CHECK = 0x71, // 113: uint Seed + byte[20] SHA1 + byte driverNameIndex (check to ensure driver isn't loaded)
TIMING_CHECK = 0x57, // 87: empty (check to ensure GetTickCount() isn't detoured)
PROC_CHECK = 0x7E, // 126: uint Seed + byte[20] SHA1 + byte moluleNameIndex + byte procNameIndex + uint Offset + byte Len (check to ensure proc isn't detoured)
- MODULE_CHECK = 0xD9, // 217: uint Seed + byte[20] SHA1 (check to ensure module isn't injected)
+ MODULE_CHECK = 0xD9 // 217: uint Seed + byte[20] SHA1 (check to ensure module isn't injected)
};
#if defined(__GNUC__)
diff --git a/src/server/game/Warden/WardenMac.cpp b/src/server/game/Warden/WardenMac.cpp
index 96b71912421..9c90662105a 100644
--- a/src/server/game/Warden/WardenMac.cpp
+++ b/src/server/game/Warden/WardenMac.cpp
@@ -152,9 +152,7 @@ void WardenMac::HandleHashResult(ByteBuffer &buff)
// Verify key
if (memcmp(buff.contents() + 1, sha1.GetDigest(), 20) != 0)
{
- sLog->outDebug(LOG_FILTER_WARDEN, "Request hash reply: failed");
- sLog->outDebug(LOG_FILTER_WARDEN, "WARDEN: Player %s (guid: %u, account: %u) failed hash reply. Action: %s",
- _session->GetPlayerName(), _session->GetGuidLow(), _session->GetAccountId(), Penalty().c_str());
+ sLog->outWarn(LOG_FILTER_WARDEN, "%s failed hash reply. Action: %s", _session->GetPlayerName(false).c_str(), Penalty().c_str());
return;
}
diff --git a/src/server/game/Warden/WardenWin.cpp b/src/server/game/Warden/WardenWin.cpp
index 7aea6794e01..20f09ec5bda 100644
--- a/src/server/game/Warden/WardenWin.cpp
+++ b/src/server/game/Warden/WardenWin.cpp
@@ -156,9 +156,7 @@ void WardenWin::HandleHashResult(ByteBuffer &buff)
// Verify key
if (memcmp(buff.contents() + 1, Module.ClientKeySeedHash, 20) != 0)
{
- sLog->outDebug(LOG_FILTER_WARDEN, "Request hash reply: failed");
- sLog->outDebug(LOG_FILTER_WARDEN, "WARDEN: Player %s (guid: %u, account: %u) failed hash reply. Action: %s",
- _session->GetPlayerName(), _session->GetGuidLow(), _session->GetAccountId(), Penalty().c_str());
+ sLog->outWarn(LOG_FILTER_WARDEN, "%s failed hash reply. Action: %s", _session->GetPlayerName(false).c_str(), Penalty().c_str());
return;
}
@@ -343,9 +341,7 @@ void WardenWin::HandleData(ByteBuffer &buff)
if (!IsValidCheckSum(Checksum, buff.contents() + buff.rpos(), Length))
{
buff.rpos(buff.wpos());
- sLog->outDebug(LOG_FILTER_WARDEN, "CHECKSUM FAIL");
- sLog->outDebug(LOG_FILTER_WARDEN, "WARDEN: Player %s (guid: %u, account: %u) failed checksum. Action: %s",
- _session->GetPlayerName(), _session->GetGuidLow(), _session->GetAccountId(), Penalty().c_str());
+ sLog->outWarn(LOG_FILTER_WARDEN, "%s failed checksum. Action: %s", _session->GetPlayerName(false).c_str(), Penalty().c_str());
return;
}
@@ -356,9 +352,7 @@ void WardenWin::HandleData(ByteBuffer &buff)
// TODO: test it.
if (result == 0x00)
{
- sLog->outDebug(LOG_FILTER_WARDEN, "TIMING CHECK FAIL result 0x00");
- sLog->outDebug(LOG_FILTER_WARDEN, "WARDEN: Player %s (guid: %u, account: %u) failed timing check. Action: %s",
- _session->GetPlayerName(), _session->GetGuidLow(), _session->GetAccountId(), Penalty().c_str());
+ sLog->outWarn(LOG_FILTER_WARDEN, "%s failed timing check. Action: %s", _session->GetPlayerName(false).c_str(), Penalty().c_str());
return;
}
@@ -500,9 +494,7 @@ void WardenWin::HandleData(ByteBuffer &buff)
if (checkFailed > 0)
{
WardenCheck* check = sWardenCheckMgr->GetWardenDataById(checkFailed);
-
- sLog->outDebug(LOG_FILTER_WARDEN, "WARDEN: Player %s (guid: %u, account: %u) failed Warden check %u. Action: %s",
- _session->GetPlayerName(), _session->GetGuidLow(), _session->GetAccountId(), checkFailed, Penalty(check).c_str());
+ sLog->outWarn(LOG_FILTER_WARDEN, "%s failed Warden check %u. Action: %s", _session->GetPlayerName(false).c_str(), checkFailed, Penalty(check).c_str());
}
// Set hold off timer, minimum timer should at least be 1 second
diff --git a/src/server/game/Weather/Weather.h b/src/server/game/Weather/Weather.h
index dadd1151a53..59bff95d7ea 100755
--- a/src/server/game/Weather/Weather.h
+++ b/src/server/game/Weather/Weather.h
@@ -57,7 +57,7 @@ enum WeatherState
WEATHER_STATE_HEAVY_SANDSTORM = 42,
WEATHER_STATE_THUNDERS = 86,
WEATHER_STATE_BLACKRAIN = 90,
- WEATHER_STATE_BLACKSNOW = 106,
+ WEATHER_STATE_BLACKSNOW = 106
};
/// Weather for one zone
diff --git a/src/server/game/Weather/WeatherMgr.cpp b/src/server/game/Weather/WeatherMgr.cpp
index 0e7f1c87b26..da62122d7a3 100755
--- a/src/server/game/Weather/WeatherMgr.cpp
+++ b/src/server/game/Weather/WeatherMgr.cpp
@@ -137,7 +137,7 @@ void LoadWeatherData()
}
while (result->NextRow());
- sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded %u weather definitions in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u weather definitions in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
}
diff --git a/src/server/game/World/World.cpp b/src/server/game/World/World.cpp
index 3a13f48d807..1d1fb45b74e 100755
--- a/src/server/game/World/World.cpp
+++ b/src/server/game/World/World.cpp
@@ -77,6 +77,7 @@
#include "WardenCheckMgr.h"
#include "Warden.h"
#include "CalendarMgr.h"
+#include "BattlefieldMgr.h"
ACE_Atomic_Op<ACE_Thread_Mutex, bool> World::m_stopEvent = false;
uint8 World::m_ExitCode = SHUTDOWN_EXIT_CODE;
@@ -398,6 +399,7 @@ void World::LoadConfigSettings(bool reload)
sLog->outError(LOG_FILTER_GENERAL, "World settings reload fail: can't read settings from %s.", ConfigMgr::GetFilename().c_str());
return;
}
+ sLog->LoadFromConfig();
}
///- Read the player limit and the Message of the day from the config file
@@ -417,27 +419,27 @@ void World::LoadConfigSettings(bool reload)
rate_values[RATE_HEALTH] = ConfigMgr::GetFloatDefault("Rate.Health", 1);
if (rate_values[RATE_HEALTH] < 0)
{
- sLog->outError(LOG_FILTER_GENERAL, "Rate.Health (%f) must be > 0. Using 1 instead.", rate_values[RATE_HEALTH]);
+ sLog->outError(LOG_FILTER_SERVER_LOADING, "Rate.Health (%f) must be > 0. Using 1 instead.", rate_values[RATE_HEALTH]);
rate_values[RATE_HEALTH] = 1;
}
rate_values[RATE_POWER_MANA] = ConfigMgr::GetFloatDefault("Rate.Mana", 1);
if (rate_values[RATE_POWER_MANA] < 0)
{
- sLog->outError(LOG_FILTER_GENERAL, "Rate.Mana (%f) must be > 0. Using 1 instead.", rate_values[RATE_POWER_MANA]);
+ sLog->outError(LOG_FILTER_SERVER_LOADING, "Rate.Mana (%f) must be > 0. Using 1 instead.", rate_values[RATE_POWER_MANA]);
rate_values[RATE_POWER_MANA] = 1;
}
rate_values[RATE_POWER_RAGE_INCOME] = ConfigMgr::GetFloatDefault("Rate.Rage.Income", 1);
rate_values[RATE_POWER_RAGE_LOSS] = ConfigMgr::GetFloatDefault("Rate.Rage.Loss", 1);
if (rate_values[RATE_POWER_RAGE_LOSS] < 0)
{
- sLog->outError(LOG_FILTER_GENERAL, "Rate.Rage.Loss (%f) must be > 0. Using 1 instead.", rate_values[RATE_POWER_RAGE_LOSS]);
+ sLog->outError(LOG_FILTER_SERVER_LOADING, "Rate.Rage.Loss (%f) must be > 0. Using 1 instead.", rate_values[RATE_POWER_RAGE_LOSS]);
rate_values[RATE_POWER_RAGE_LOSS] = 1;
}
rate_values[RATE_POWER_RUNICPOWER_INCOME] = ConfigMgr::GetFloatDefault("Rate.RunicPower.Income", 1);
rate_values[RATE_POWER_RUNICPOWER_LOSS] = ConfigMgr::GetFloatDefault("Rate.RunicPower.Loss", 1);
if (rate_values[RATE_POWER_RUNICPOWER_LOSS] < 0)
{
- sLog->outError(LOG_FILTER_GENERAL, "Rate.RunicPower.Loss (%f) must be > 0. Using 1 instead.", rate_values[RATE_POWER_RUNICPOWER_LOSS]);
+ sLog->outError(LOG_FILTER_SERVER_LOADING, "Rate.RunicPower.Loss (%f) must be > 0. Using 1 instead.", rate_values[RATE_POWER_RUNICPOWER_LOSS]);
rate_values[RATE_POWER_RUNICPOWER_LOSS] = 1;
}
rate_values[RATE_POWER_FOCUS] = ConfigMgr::GetFloatDefault("Rate.Focus", 1.0f);
@@ -461,7 +463,7 @@ void World::LoadConfigSettings(bool reload)
rate_values[RATE_REPAIRCOST] = ConfigMgr::GetFloatDefault("Rate.RepairCost", 1.0f);
if (rate_values[RATE_REPAIRCOST] < 0.0f)
{
- sLog->outError(LOG_FILTER_GENERAL, "Rate.RepairCost (%f) must be >=0. Using 0.0 instead.", rate_values[RATE_REPAIRCOST]);
+ sLog->outError(LOG_FILTER_SERVER_LOADING, "Rate.RepairCost (%f) must be >=0. Using 0.0 instead.", rate_values[RATE_REPAIRCOST]);
rate_values[RATE_REPAIRCOST] = 0.0f;
}
rate_values[RATE_REPUTATION_GAIN] = ConfigMgr::GetFloatDefault("Rate.Reputation.Gain", 1.0f);
@@ -498,13 +500,13 @@ void World::LoadConfigSettings(bool reload)
rate_values[RATE_TALENT] = ConfigMgr::GetFloatDefault("Rate.Talent", 1.0f);
if (rate_values[RATE_TALENT] < 0.0f)
{
- sLog->outError(LOG_FILTER_GENERAL, "Rate.Talent (%f) must be > 0. Using 1 instead.", rate_values[RATE_TALENT]);
+ sLog->outError(LOG_FILTER_SERVER_LOADING, "Rate.Talent (%f) must be > 0. Using 1 instead.", rate_values[RATE_TALENT]);
rate_values[RATE_TALENT] = 1.0f;
}
rate_values[RATE_MOVESPEED] = ConfigMgr::GetFloatDefault("Rate.MoveSpeed", 1.0f);
if (rate_values[RATE_MOVESPEED] < 0)
{
- sLog->outError(LOG_FILTER_GENERAL, "Rate.MoveSpeed (%f) must be > 0. Using 1 instead.", rate_values[RATE_MOVESPEED]);
+ sLog->outError(LOG_FILTER_SERVER_LOADING, "Rate.MoveSpeed (%f) must be > 0. Using 1 instead.", rate_values[RATE_MOVESPEED]);
rate_values[RATE_MOVESPEED] = 1.0f;
}
for (uint8 i = 0; i < MAX_MOVE_TYPE; ++i) playerBaseMoveSpeed[i] = baseMoveSpeed[i] * rate_values[RATE_MOVESPEED];
@@ -513,12 +515,12 @@ void World::LoadConfigSettings(bool reload)
rate_values[RATE_TARGET_POS_RECALCULATION_RANGE] = ConfigMgr::GetFloatDefault("TargetPosRecalculateRange", 1.5f);
if (rate_values[RATE_TARGET_POS_RECALCULATION_RANGE] < CONTACT_DISTANCE)
{
- sLog->outError(LOG_FILTER_GENERAL, "TargetPosRecalculateRange (%f) must be >= %f. Using %f instead.", rate_values[RATE_TARGET_POS_RECALCULATION_RANGE], CONTACT_DISTANCE, CONTACT_DISTANCE);
+ sLog->outError(LOG_FILTER_SERVER_LOADING, "TargetPosRecalculateRange (%f) must be >= %f. Using %f instead.", rate_values[RATE_TARGET_POS_RECALCULATION_RANGE], CONTACT_DISTANCE, CONTACT_DISTANCE);
rate_values[RATE_TARGET_POS_RECALCULATION_RANGE] = CONTACT_DISTANCE;
}
else if (rate_values[RATE_TARGET_POS_RECALCULATION_RANGE] > NOMINAL_MELEE_RANGE)
{
- sLog->outError(LOG_FILTER_GENERAL, "TargetPosRecalculateRange (%f) must be <= %f. Using %f instead.",
+ sLog->outError(LOG_FILTER_SERVER_LOADING, "TargetPosRecalculateRange (%f) must be <= %f. Using %f instead.",
rate_values[RATE_TARGET_POS_RECALCULATION_RANGE], NOMINAL_MELEE_RANGE, NOMINAL_MELEE_RANGE);
rate_values[RATE_TARGET_POS_RECALCULATION_RANGE] = NOMINAL_MELEE_RANGE;
}
@@ -526,12 +528,12 @@ void World::LoadConfigSettings(bool reload)
rate_values[RATE_DURABILITY_LOSS_ON_DEATH] = ConfigMgr::GetFloatDefault("DurabilityLoss.OnDeath", 10.0f);
if (rate_values[RATE_DURABILITY_LOSS_ON_DEATH] < 0.0f)
{
- sLog->outError(LOG_FILTER_GENERAL, "DurabilityLoss.OnDeath (%f) must be >=0. Using 0.0 instead.", rate_values[RATE_DURABILITY_LOSS_ON_DEATH]);
+ sLog->outError(LOG_FILTER_SERVER_LOADING, "DurabilityLoss.OnDeath (%f) must be >=0. Using 0.0 instead.", rate_values[RATE_DURABILITY_LOSS_ON_DEATH]);
rate_values[RATE_DURABILITY_LOSS_ON_DEATH] = 0.0f;
}
if (rate_values[RATE_DURABILITY_LOSS_ON_DEATH] > 100.0f)
{
- sLog->outError(LOG_FILTER_GENERAL, "DurabilityLoss.OnDeath (%f) must be <= 100. Using 100.0 instead.", rate_values[RATE_DURABILITY_LOSS_ON_DEATH]);
+ sLog->outError(LOG_FILTER_SERVER_LOADING, "DurabilityLoss.OnDeath (%f) must be <= 100. Using 100.0 instead.", rate_values[RATE_DURABILITY_LOSS_ON_DEATH]);
rate_values[RATE_DURABILITY_LOSS_ON_DEATH] = 0.0f;
}
rate_values[RATE_DURABILITY_LOSS_ON_DEATH] = rate_values[RATE_DURABILITY_LOSS_ON_DEATH] / 100.0f;
@@ -539,25 +541,25 @@ void World::LoadConfigSettings(bool reload)
rate_values[RATE_DURABILITY_LOSS_DAMAGE] = ConfigMgr::GetFloatDefault("DurabilityLossChance.Damage", 0.5f);
if (rate_values[RATE_DURABILITY_LOSS_DAMAGE] < 0.0f)
{
- sLog->outError(LOG_FILTER_GENERAL, "DurabilityLossChance.Damage (%f) must be >=0. Using 0.0 instead.", rate_values[RATE_DURABILITY_LOSS_DAMAGE]);
+ sLog->outError(LOG_FILTER_SERVER_LOADING, "DurabilityLossChance.Damage (%f) must be >=0. Using 0.0 instead.", rate_values[RATE_DURABILITY_LOSS_DAMAGE]);
rate_values[RATE_DURABILITY_LOSS_DAMAGE] = 0.0f;
}
rate_values[RATE_DURABILITY_LOSS_ABSORB] = ConfigMgr::GetFloatDefault("DurabilityLossChance.Absorb", 0.5f);
if (rate_values[RATE_DURABILITY_LOSS_ABSORB] < 0.0f)
{
- sLog->outError(LOG_FILTER_GENERAL, "DurabilityLossChance.Absorb (%f) must be >=0. Using 0.0 instead.", rate_values[RATE_DURABILITY_LOSS_ABSORB]);
+ sLog->outError(LOG_FILTER_SERVER_LOADING, "DurabilityLossChance.Absorb (%f) must be >=0. Using 0.0 instead.", rate_values[RATE_DURABILITY_LOSS_ABSORB]);
rate_values[RATE_DURABILITY_LOSS_ABSORB] = 0.0f;
}
rate_values[RATE_DURABILITY_LOSS_PARRY] = ConfigMgr::GetFloatDefault("DurabilityLossChance.Parry", 0.05f);
if (rate_values[RATE_DURABILITY_LOSS_PARRY] < 0.0f)
{
- sLog->outError(LOG_FILTER_GENERAL, "DurabilityLossChance.Parry (%f) must be >=0. Using 0.0 instead.", rate_values[RATE_DURABILITY_LOSS_PARRY]);
+ sLog->outError(LOG_FILTER_SERVER_LOADING, "DurabilityLossChance.Parry (%f) must be >=0. Using 0.0 instead.", rate_values[RATE_DURABILITY_LOSS_PARRY]);
rate_values[RATE_DURABILITY_LOSS_PARRY] = 0.0f;
}
rate_values[RATE_DURABILITY_LOSS_BLOCK] = ConfigMgr::GetFloatDefault("DurabilityLossChance.Block", 0.05f);
if (rate_values[RATE_DURABILITY_LOSS_BLOCK] < 0.0f)
{
- sLog->outError(LOG_FILTER_GENERAL, "DurabilityLossChance.Block (%f) must be >=0. Using 0.0 instead.", rate_values[RATE_DURABILITY_LOSS_BLOCK]);
+ sLog->outError(LOG_FILTER_SERVER_LOADING, "DurabilityLossChance.Block (%f) must be >=0. Using 0.0 instead.", rate_values[RATE_DURABILITY_LOSS_BLOCK]);
rate_values[RATE_DURABILITY_LOSS_BLOCK] = 0.0f;
}
///- Read other configuration items from the config file
@@ -567,7 +569,7 @@ void World::LoadConfigSettings(bool reload)
m_int_configs[CONFIG_COMPRESSION] = ConfigMgr::GetIntDefault("Compression", 1);
if (m_int_configs[CONFIG_COMPRESSION] < 1 || m_int_configs[CONFIG_COMPRESSION] > 9)
{
- sLog->outError(LOG_FILTER_GENERAL, "Compression level (%i) must be in range 1..9. Using default compression level (1).", m_int_configs[CONFIG_COMPRESSION]);
+ sLog->outError(LOG_FILTER_SERVER_LOADING, "Compression level (%i) must be in range 1..9. Using default compression level (1).", m_int_configs[CONFIG_COMPRESSION]);
m_int_configs[CONFIG_COMPRESSION] = 1;
}
m_bool_configs[CONFIG_ADDON_CHANNEL] = ConfigMgr::GetBoolDefault("AddonChannel", true);
@@ -591,14 +593,14 @@ void World::LoadConfigSettings(bool reload)
m_int_configs[CONFIG_MIN_LEVEL_STAT_SAVE] = ConfigMgr::GetIntDefault("PlayerSave.Stats.MinLevel", 0);
if (m_int_configs[CONFIG_MIN_LEVEL_STAT_SAVE] > MAX_LEVEL)
{
- sLog->outError(LOG_FILTER_GENERAL, "PlayerSave.Stats.MinLevel (%i) must be in range 0..80. Using default, do not save character stats (0).", m_int_configs[CONFIG_MIN_LEVEL_STAT_SAVE]);
+ sLog->outError(LOG_FILTER_SERVER_LOADING, "PlayerSave.Stats.MinLevel (%i) must be in range 0..80. Using default, do not save character stats (0).", m_int_configs[CONFIG_MIN_LEVEL_STAT_SAVE]);
m_int_configs[CONFIG_MIN_LEVEL_STAT_SAVE] = 0;
}
m_int_configs[CONFIG_INTERVAL_GRIDCLEAN] = ConfigMgr::GetIntDefault("GridCleanUpDelay", 5 * MINUTE * IN_MILLISECONDS);
if (m_int_configs[CONFIG_INTERVAL_GRIDCLEAN] < MIN_GRID_DELAY)
{
- sLog->outError(LOG_FILTER_GENERAL, "GridCleanUpDelay (%i) must be greater %u. Use this minimal value.", m_int_configs[CONFIG_INTERVAL_GRIDCLEAN], MIN_GRID_DELAY);
+ sLog->outError(LOG_FILTER_SERVER_LOADING, "GridCleanUpDelay (%i) must be greater %u. Use this minimal value.", m_int_configs[CONFIG_INTERVAL_GRIDCLEAN], MIN_GRID_DELAY);
m_int_configs[CONFIG_INTERVAL_GRIDCLEAN] = MIN_GRID_DELAY;
}
if (reload)
@@ -607,7 +609,7 @@ void World::LoadConfigSettings(bool reload)
m_int_configs[CONFIG_INTERVAL_MAPUPDATE] = ConfigMgr::GetIntDefault("MapUpdateInterval", 100);
if (m_int_configs[CONFIG_INTERVAL_MAPUPDATE] < MIN_MAP_UPDATE_DELAY)
{
- sLog->outError(LOG_FILTER_GENERAL, "MapUpdateInterval (%i) must be greater %u. Use this minimal value.", m_int_configs[CONFIG_INTERVAL_MAPUPDATE], MIN_MAP_UPDATE_DELAY);
+ sLog->outError(LOG_FILTER_SERVER_LOADING, "MapUpdateInterval (%i) must be greater %u. Use this minimal value.", m_int_configs[CONFIG_INTERVAL_MAPUPDATE], MIN_MAP_UPDATE_DELAY);
m_int_configs[CONFIG_INTERVAL_MAPUPDATE] = MIN_MAP_UPDATE_DELAY;
}
if (reload)
@@ -619,7 +621,7 @@ void World::LoadConfigSettings(bool reload)
{
uint32 val = ConfigMgr::GetIntDefault("WorldServerPort", 8085);
if (val != m_int_configs[CONFIG_PORT_WORLD])
- sLog->outError(LOG_FILTER_GENERAL, "WorldServerPort option can't be changed at worldserver.conf reload, using current value (%u).", m_int_configs[CONFIG_PORT_WORLD]);
+ sLog->outError(LOG_FILTER_SERVER_LOADING, "WorldServerPort option can't be changed at worldserver.conf reload, using current value (%u).", m_int_configs[CONFIG_PORT_WORLD]);
}
else
m_int_configs[CONFIG_PORT_WORLD] = ConfigMgr::GetIntDefault("WorldServerPort", 8085);
@@ -638,7 +640,7 @@ void World::LoadConfigSettings(bool reload)
{
uint32 val = ConfigMgr::GetIntDefault("GameType", 0);
if (val != m_int_configs[CONFIG_GAME_TYPE])
- sLog->outError(LOG_FILTER_GENERAL, "GameType option can't be changed at worldserver.conf reload, using current value (%u).", m_int_configs[CONFIG_GAME_TYPE]);
+ sLog->outError(LOG_FILTER_SERVER_LOADING, "GameType option can't be changed at worldserver.conf reload, using current value (%u).", m_int_configs[CONFIG_GAME_TYPE]);
}
else
m_int_configs[CONFIG_GAME_TYPE] = ConfigMgr::GetIntDefault("GameType", 0);
@@ -647,12 +649,13 @@ void World::LoadConfigSettings(bool reload)
{
uint32 val = ConfigMgr::GetIntDefault("RealmZone", REALM_ZONE_DEVELOPMENT);
if (val != m_int_configs[CONFIG_REALM_ZONE])
- sLog->outError(LOG_FILTER_GENERAL, "RealmZone option can't be changed at worldserver.conf reload, using current value (%u).", m_int_configs[CONFIG_REALM_ZONE]);
+ sLog->outError(LOG_FILTER_SERVER_LOADING, "RealmZone option can't be changed at worldserver.conf reload, using current value (%u).", m_int_configs[CONFIG_REALM_ZONE]);
}
else
m_int_configs[CONFIG_REALM_ZONE] = ConfigMgr::GetIntDefault("RealmZone", REALM_ZONE_DEVELOPMENT);
m_bool_configs[CONFIG_ALLOW_TWO_SIDE_ACCOUNTS] = ConfigMgr::GetBoolDefault("AllowTwoSide.Accounts", true);
+ m_bool_configs[CONFIG_ALLOW_TWO_SIDE_INTERACTION_CALENDAR]= ConfigMgr::GetBoolDefault("AllowTwoSide.Interaction.Calendar", false);
m_bool_configs[CONFIG_ALLOW_TWO_SIDE_INTERACTION_CHAT] = ConfigMgr::GetBoolDefault("AllowTwoSide.Interaction.Chat", false);
m_bool_configs[CONFIG_ALLOW_TWO_SIDE_INTERACTION_CHANNEL] = ConfigMgr::GetBoolDefault("AllowTwoSide.Interaction.Channel", false);
m_bool_configs[CONFIG_ALLOW_TWO_SIDE_INTERACTION_GROUP] = ConfigMgr::GetBoolDefault("AllowTwoSide.Interaction.Group", false);
@@ -669,21 +672,21 @@ void World::LoadConfigSettings(bool reload)
m_int_configs[CONFIG_MIN_PLAYER_NAME] = ConfigMgr::GetIntDefault ("MinPlayerName", 2);
if (m_int_configs[CONFIG_MIN_PLAYER_NAME] < 1 || m_int_configs[CONFIG_MIN_PLAYER_NAME] > MAX_PLAYER_NAME)
{
- sLog->outError(LOG_FILTER_GENERAL, "MinPlayerName (%i) must be in range 1..%u. Set to 2.", m_int_configs[CONFIG_MIN_PLAYER_NAME], MAX_PLAYER_NAME);
+ sLog->outError(LOG_FILTER_SERVER_LOADING, "MinPlayerName (%i) must be in range 1..%u. Set to 2.", m_int_configs[CONFIG_MIN_PLAYER_NAME], MAX_PLAYER_NAME);
m_int_configs[CONFIG_MIN_PLAYER_NAME] = 2;
}
m_int_configs[CONFIG_MIN_CHARTER_NAME] = ConfigMgr::GetIntDefault ("MinCharterName", 2);
if (m_int_configs[CONFIG_MIN_CHARTER_NAME] < 1 || m_int_configs[CONFIG_MIN_CHARTER_NAME] > MAX_CHARTER_NAME)
{
- sLog->outError(LOG_FILTER_GENERAL, "MinCharterName (%i) must be in range 1..%u. Set to 2.", m_int_configs[CONFIG_MIN_CHARTER_NAME], MAX_CHARTER_NAME);
+ sLog->outError(LOG_FILTER_SERVER_LOADING, "MinCharterName (%i) must be in range 1..%u. Set to 2.", m_int_configs[CONFIG_MIN_CHARTER_NAME], MAX_CHARTER_NAME);
m_int_configs[CONFIG_MIN_CHARTER_NAME] = 2;
}
m_int_configs[CONFIG_MIN_PET_NAME] = ConfigMgr::GetIntDefault ("MinPetName", 2);
if (m_int_configs[CONFIG_MIN_PET_NAME] < 1 || m_int_configs[CONFIG_MIN_PET_NAME] > MAX_PET_NAME)
{
- sLog->outError(LOG_FILTER_GENERAL, "MinPetName (%i) must be in range 1..%u. Set to 2.", m_int_configs[CONFIG_MIN_PET_NAME], MAX_PET_NAME);
+ sLog->outError(LOG_FILTER_SERVER_LOADING, "MinPetName (%i) must be in range 1..%u. Set to 2.", m_int_configs[CONFIG_MIN_PET_NAME], MAX_PET_NAME);
m_int_configs[CONFIG_MIN_PET_NAME] = 2;
}
@@ -694,7 +697,7 @@ void World::LoadConfigSettings(bool reload)
m_int_configs[CONFIG_CHARACTERS_PER_REALM] = ConfigMgr::GetIntDefault("CharactersPerRealm", 10);
if (m_int_configs[CONFIG_CHARACTERS_PER_REALM] < 1 || m_int_configs[CONFIG_CHARACTERS_PER_REALM] > 10)
{
- sLog->outError(LOG_FILTER_GENERAL, "CharactersPerRealm (%i) must be in range 1..10. Set to 10.", m_int_configs[CONFIG_CHARACTERS_PER_REALM]);
+ sLog->outError(LOG_FILTER_SERVER_LOADING, "CharactersPerRealm (%i) must be in range 1..10. Set to 10.", m_int_configs[CONFIG_CHARACTERS_PER_REALM]);
m_int_configs[CONFIG_CHARACTERS_PER_REALM] = 10;
}
@@ -702,14 +705,14 @@ void World::LoadConfigSettings(bool reload)
m_int_configs[CONFIG_CHARACTERS_PER_ACCOUNT] = ConfigMgr::GetIntDefault("CharactersPerAccount", 50);
if (m_int_configs[CONFIG_CHARACTERS_PER_ACCOUNT] < m_int_configs[CONFIG_CHARACTERS_PER_REALM])
{
- sLog->outError(LOG_FILTER_GENERAL, "CharactersPerAccount (%i) can't be less than CharactersPerRealm (%i).", m_int_configs[CONFIG_CHARACTERS_PER_ACCOUNT], m_int_configs[CONFIG_CHARACTERS_PER_REALM]);
+ sLog->outError(LOG_FILTER_SERVER_LOADING, "CharactersPerAccount (%i) can't be less than CharactersPerRealm (%i).", m_int_configs[CONFIG_CHARACTERS_PER_ACCOUNT], m_int_configs[CONFIG_CHARACTERS_PER_REALM]);
m_int_configs[CONFIG_CHARACTERS_PER_ACCOUNT] = m_int_configs[CONFIG_CHARACTERS_PER_REALM];
}
m_int_configs[CONFIG_HEROIC_CHARACTERS_PER_REALM] = ConfigMgr::GetIntDefault("HeroicCharactersPerRealm", 1);
if (int32(m_int_configs[CONFIG_HEROIC_CHARACTERS_PER_REALM]) < 0 || m_int_configs[CONFIG_HEROIC_CHARACTERS_PER_REALM] > 10)
{
- sLog->outError(LOG_FILTER_GENERAL, "HeroicCharactersPerRealm (%i) must be in range 0..10. Set to 1.", m_int_configs[CONFIG_HEROIC_CHARACTERS_PER_REALM]);
+ sLog->outError(LOG_FILTER_SERVER_LOADING, "HeroicCharactersPerRealm (%i) must be in range 0..10. Set to 1.", m_int_configs[CONFIG_HEROIC_CHARACTERS_PER_REALM]);
m_int_configs[CONFIG_HEROIC_CHARACTERS_PER_REALM] = 1;
}
@@ -718,7 +721,7 @@ void World::LoadConfigSettings(bool reload)
m_int_configs[CONFIG_SKIP_CINEMATICS] = ConfigMgr::GetIntDefault("SkipCinematics", 0);
if (int32(m_int_configs[CONFIG_SKIP_CINEMATICS]) < 0 || m_int_configs[CONFIG_SKIP_CINEMATICS] > 2)
{
- sLog->outError(LOG_FILTER_GENERAL, "SkipCinematics (%i) must be in range 0..2. Set to 0.", m_int_configs[CONFIG_SKIP_CINEMATICS]);
+ sLog->outError(LOG_FILTER_SERVER_LOADING, "SkipCinematics (%i) must be in range 0..2. Set to 0.", m_int_configs[CONFIG_SKIP_CINEMATICS]);
m_int_configs[CONFIG_SKIP_CINEMATICS] = 0;
}
@@ -726,14 +729,14 @@ void World::LoadConfigSettings(bool reload)
{
uint32 val = ConfigMgr::GetIntDefault("MaxPlayerLevel", DEFAULT_MAX_LEVEL);
if (val != m_int_configs[CONFIG_MAX_PLAYER_LEVEL])
- sLog->outError(LOG_FILTER_GENERAL, "MaxPlayerLevel option can't be changed at config reload, using current value (%u).", m_int_configs[CONFIG_MAX_PLAYER_LEVEL]);
+ sLog->outError(LOG_FILTER_SERVER_LOADING, "MaxPlayerLevel option can't be changed at config reload, using current value (%u).", m_int_configs[CONFIG_MAX_PLAYER_LEVEL]);
}
else
m_int_configs[CONFIG_MAX_PLAYER_LEVEL] = ConfigMgr::GetIntDefault("MaxPlayerLevel", DEFAULT_MAX_LEVEL);
if (m_int_configs[CONFIG_MAX_PLAYER_LEVEL] > MAX_LEVEL)
{
- sLog->outError(LOG_FILTER_GENERAL, "MaxPlayerLevel (%i) must be in range 1..%u. Set to %u.", m_int_configs[CONFIG_MAX_PLAYER_LEVEL], MAX_LEVEL, MAX_LEVEL);
+ sLog->outError(LOG_FILTER_SERVER_LOADING, "MaxPlayerLevel (%i) must be in range 1..%u. Set to %u.", m_int_configs[CONFIG_MAX_PLAYER_LEVEL], MAX_LEVEL, MAX_LEVEL);
m_int_configs[CONFIG_MAX_PLAYER_LEVEL] = MAX_LEVEL;
}
@@ -742,25 +745,25 @@ void World::LoadConfigSettings(bool reload)
m_int_configs[CONFIG_START_PLAYER_LEVEL] = ConfigMgr::GetIntDefault("StartPlayerLevel", 1);
if (m_int_configs[CONFIG_START_PLAYER_LEVEL] < 1)
{
- sLog->outError(LOG_FILTER_GENERAL, "StartPlayerLevel (%i) must be in range 1..MaxPlayerLevel(%u). Set to 1.", m_int_configs[CONFIG_START_PLAYER_LEVEL], m_int_configs[CONFIG_MAX_PLAYER_LEVEL]);
+ sLog->outError(LOG_FILTER_SERVER_LOADING, "StartPlayerLevel (%i) must be in range 1..MaxPlayerLevel(%u). Set to 1.", m_int_configs[CONFIG_START_PLAYER_LEVEL], m_int_configs[CONFIG_MAX_PLAYER_LEVEL]);
m_int_configs[CONFIG_START_PLAYER_LEVEL] = 1;
}
else if (m_int_configs[CONFIG_START_PLAYER_LEVEL] > m_int_configs[CONFIG_MAX_PLAYER_LEVEL])
{
- sLog->outError(LOG_FILTER_GENERAL, "StartPlayerLevel (%i) must be in range 1..MaxPlayerLevel(%u). Set to %u.", m_int_configs[CONFIG_START_PLAYER_LEVEL], m_int_configs[CONFIG_MAX_PLAYER_LEVEL], m_int_configs[CONFIG_MAX_PLAYER_LEVEL]);
+ sLog->outError(LOG_FILTER_SERVER_LOADING, "StartPlayerLevel (%i) must be in range 1..MaxPlayerLevel(%u). Set to %u.", m_int_configs[CONFIG_START_PLAYER_LEVEL], m_int_configs[CONFIG_MAX_PLAYER_LEVEL], m_int_configs[CONFIG_MAX_PLAYER_LEVEL]);
m_int_configs[CONFIG_START_PLAYER_LEVEL] = m_int_configs[CONFIG_MAX_PLAYER_LEVEL];
}
m_int_configs[CONFIG_START_HEROIC_PLAYER_LEVEL] = ConfigMgr::GetIntDefault("StartHeroicPlayerLevel", 55);
if (m_int_configs[CONFIG_START_HEROIC_PLAYER_LEVEL] < 1)
{
- sLog->outError(LOG_FILTER_GENERAL, "StartHeroicPlayerLevel (%i) must be in range 1..MaxPlayerLevel(%u). Set to 55.",
+ sLog->outError(LOG_FILTER_SERVER_LOADING, "StartHeroicPlayerLevel (%i) must be in range 1..MaxPlayerLevel(%u). Set to 55.",
m_int_configs[CONFIG_START_HEROIC_PLAYER_LEVEL], m_int_configs[CONFIG_MAX_PLAYER_LEVEL]);
m_int_configs[CONFIG_START_HEROIC_PLAYER_LEVEL] = 55;
}
else if (m_int_configs[CONFIG_START_HEROIC_PLAYER_LEVEL] > m_int_configs[CONFIG_MAX_PLAYER_LEVEL])
{
- sLog->outError(LOG_FILTER_GENERAL, "StartHeroicPlayerLevel (%i) must be in range 1..MaxPlayerLevel(%u). Set to %u.",
+ sLog->outError(LOG_FILTER_SERVER_LOADING, "StartHeroicPlayerLevel (%i) must be in range 1..MaxPlayerLevel(%u). Set to %u.",
m_int_configs[CONFIG_START_HEROIC_PLAYER_LEVEL], m_int_configs[CONFIG_MAX_PLAYER_LEVEL], m_int_configs[CONFIG_MAX_PLAYER_LEVEL]);
m_int_configs[CONFIG_START_HEROIC_PLAYER_LEVEL] = m_int_configs[CONFIG_MAX_PLAYER_LEVEL];
}
@@ -768,12 +771,12 @@ void World::LoadConfigSettings(bool reload)
m_int_configs[CONFIG_START_PLAYER_MONEY] = ConfigMgr::GetIntDefault("StartPlayerMoney", 0);
if (int32(m_int_configs[CONFIG_START_PLAYER_MONEY]) < 0)
{
- sLog->outError(LOG_FILTER_GENERAL, "StartPlayerMoney (%i) must be in range 0..%u. Set to %u.", m_int_configs[CONFIG_START_PLAYER_MONEY], MAX_MONEY_AMOUNT, 0);
+ sLog->outError(LOG_FILTER_SERVER_LOADING, "StartPlayerMoney (%i) must be in range 0..%u. Set to %u.", m_int_configs[CONFIG_START_PLAYER_MONEY], MAX_MONEY_AMOUNT, 0);
m_int_configs[CONFIG_START_PLAYER_MONEY] = 0;
}
else if (m_int_configs[CONFIG_START_PLAYER_MONEY] > MAX_MONEY_AMOUNT)
{
- sLog->outError(LOG_FILTER_GENERAL, "StartPlayerMoney (%i) must be in range 0..%u. Set to %u.",
+ sLog->outError(LOG_FILTER_SERVER_LOADING, "StartPlayerMoney (%i) must be in range 0..%u. Set to %u.",
m_int_configs[CONFIG_START_PLAYER_MONEY], MAX_MONEY_AMOUNT, MAX_MONEY_AMOUNT);
m_int_configs[CONFIG_START_PLAYER_MONEY] = MAX_MONEY_AMOUNT;
}
@@ -781,20 +784,20 @@ void World::LoadConfigSettings(bool reload)
m_int_configs[CONFIG_MAX_HONOR_POINTS] = ConfigMgr::GetIntDefault("MaxHonorPoints", 75000);
if (int32(m_int_configs[CONFIG_MAX_HONOR_POINTS]) < 0)
{
- sLog->outError(LOG_FILTER_GENERAL, "MaxHonorPoints (%i) can't be negative. Set to 0.", m_int_configs[CONFIG_MAX_HONOR_POINTS]);
+ sLog->outError(LOG_FILTER_SERVER_LOADING, "MaxHonorPoints (%i) can't be negative. Set to 0.", m_int_configs[CONFIG_MAX_HONOR_POINTS]);
m_int_configs[CONFIG_MAX_HONOR_POINTS] = 0;
}
m_int_configs[CONFIG_START_HONOR_POINTS] = ConfigMgr::GetIntDefault("StartHonorPoints", 0);
if (int32(m_int_configs[CONFIG_START_HONOR_POINTS]) < 0)
{
- sLog->outError(LOG_FILTER_GENERAL, "StartHonorPoints (%i) must be in range 0..MaxHonorPoints(%u). Set to %u.",
+ sLog->outError(LOG_FILTER_SERVER_LOADING, "StartHonorPoints (%i) must be in range 0..MaxHonorPoints(%u). Set to %u.",
m_int_configs[CONFIG_START_HONOR_POINTS], m_int_configs[CONFIG_MAX_HONOR_POINTS], 0);
m_int_configs[CONFIG_START_HONOR_POINTS] = 0;
}
else if (m_int_configs[CONFIG_START_HONOR_POINTS] > m_int_configs[CONFIG_MAX_HONOR_POINTS])
{
- sLog->outError(LOG_FILTER_GENERAL, "StartHonorPoints (%i) must be in range 0..MaxHonorPoints(%u). Set to %u.",
+ sLog->outError(LOG_FILTER_SERVER_LOADING, "StartHonorPoints (%i) must be in range 0..MaxHonorPoints(%u). Set to %u.",
m_int_configs[CONFIG_START_HONOR_POINTS], m_int_configs[CONFIG_MAX_HONOR_POINTS], m_int_configs[CONFIG_MAX_HONOR_POINTS]);
m_int_configs[CONFIG_START_HONOR_POINTS] = m_int_configs[CONFIG_MAX_HONOR_POINTS];
}
@@ -802,20 +805,20 @@ void World::LoadConfigSettings(bool reload)
m_int_configs[CONFIG_MAX_ARENA_POINTS] = ConfigMgr::GetIntDefault("MaxArenaPoints", 10000);
if (int32(m_int_configs[CONFIG_MAX_ARENA_POINTS]) < 0)
{
- sLog->outError(LOG_FILTER_GENERAL, "MaxArenaPoints (%i) can't be negative. Set to 0.", m_int_configs[CONFIG_MAX_ARENA_POINTS]);
+ sLog->outError(LOG_FILTER_SERVER_LOADING, "MaxArenaPoints (%i) can't be negative. Set to 0.", m_int_configs[CONFIG_MAX_ARENA_POINTS]);
m_int_configs[CONFIG_MAX_ARENA_POINTS] = 0;
}
m_int_configs[CONFIG_START_ARENA_POINTS] = ConfigMgr::GetIntDefault("StartArenaPoints", 0);
if (int32(m_int_configs[CONFIG_START_ARENA_POINTS]) < 0)
{
- sLog->outError(LOG_FILTER_GENERAL, "StartArenaPoints (%i) must be in range 0..MaxArenaPoints(%u). Set to %u.",
+ sLog->outError(LOG_FILTER_SERVER_LOADING, "StartArenaPoints (%i) must be in range 0..MaxArenaPoints(%u). Set to %u.",
m_int_configs[CONFIG_START_ARENA_POINTS], m_int_configs[CONFIG_MAX_ARENA_POINTS], 0);
m_int_configs[CONFIG_START_ARENA_POINTS] = 0;
}
else if (m_int_configs[CONFIG_START_ARENA_POINTS] > m_int_configs[CONFIG_MAX_ARENA_POINTS])
{
- sLog->outError(LOG_FILTER_GENERAL, "StartArenaPoints (%i) must be in range 0..MaxArenaPoints(%u). Set to %u.",
+ sLog->outError(LOG_FILTER_SERVER_LOADING, "StartArenaPoints (%i) must be in range 0..MaxArenaPoints(%u). Set to %u.",
m_int_configs[CONFIG_START_ARENA_POINTS], m_int_configs[CONFIG_MAX_ARENA_POINTS], m_int_configs[CONFIG_MAX_ARENA_POINTS]);
m_int_configs[CONFIG_START_ARENA_POINTS] = m_int_configs[CONFIG_MAX_ARENA_POINTS];
}
@@ -823,7 +826,7 @@ void World::LoadConfigSettings(bool reload)
m_int_configs[CONFIG_MAX_RECRUIT_A_FRIEND_BONUS_PLAYER_LEVEL] = ConfigMgr::GetIntDefault("RecruitAFriend.MaxLevel", 60);
if (m_int_configs[CONFIG_MAX_RECRUIT_A_FRIEND_BONUS_PLAYER_LEVEL] > m_int_configs[CONFIG_MAX_PLAYER_LEVEL])
{
- sLog->outError(LOG_FILTER_GENERAL, "RecruitAFriend.MaxLevel (%i) must be in the range 0..MaxLevel(%u). Set to %u.",
+ sLog->outError(LOG_FILTER_SERVER_LOADING, "RecruitAFriend.MaxLevel (%i) must be in the range 0..MaxLevel(%u). Set to %u.",
m_int_configs[CONFIG_MAX_RECRUIT_A_FRIEND_BONUS_PLAYER_LEVEL], m_int_configs[CONFIG_MAX_PLAYER_LEVEL], 60);
m_int_configs[CONFIG_MAX_RECRUIT_A_FRIEND_BONUS_PLAYER_LEVEL] = 60;
}
@@ -843,7 +846,7 @@ void World::LoadConfigSettings(bool reload)
m_int_configs[CONFIG_MIN_PETITION_SIGNS] = ConfigMgr::GetIntDefault("MinPetitionSigns", 9);
if (m_int_configs[CONFIG_MIN_PETITION_SIGNS] > 9)
{
- sLog->outError(LOG_FILTER_GENERAL, "MinPetitionSigns (%i) must be in range 0..9. Set to 9.", m_int_configs[CONFIG_MIN_PETITION_SIGNS]);
+ sLog->outError(LOG_FILTER_SERVER_LOADING, "MinPetitionSigns (%i) must be in range 0..9. Set to 9.", m_int_configs[CONFIG_MIN_PETITION_SIGNS]);
m_int_configs[CONFIG_MIN_PETITION_SIGNS] = 9;
}
@@ -858,13 +861,13 @@ void World::LoadConfigSettings(bool reload)
m_int_configs[CONFIG_START_GM_LEVEL] = ConfigMgr::GetIntDefault("GM.StartLevel", 1);
if (m_int_configs[CONFIG_START_GM_LEVEL] < m_int_configs[CONFIG_START_PLAYER_LEVEL])
{
- sLog->outError(LOG_FILTER_GENERAL, "GM.StartLevel (%i) must be in range StartPlayerLevel(%u)..%u. Set to %u.",
+ sLog->outError(LOG_FILTER_SERVER_LOADING, "GM.StartLevel (%i) must be in range StartPlayerLevel(%u)..%u. Set to %u.",
m_int_configs[CONFIG_START_GM_LEVEL], m_int_configs[CONFIG_START_PLAYER_LEVEL], MAX_LEVEL, m_int_configs[CONFIG_START_PLAYER_LEVEL]);
m_int_configs[CONFIG_START_GM_LEVEL] = m_int_configs[CONFIG_START_PLAYER_LEVEL];
}
else if (m_int_configs[CONFIG_START_GM_LEVEL] > MAX_LEVEL)
{
- sLog->outError(LOG_FILTER_GENERAL, "GM.StartLevel (%i) must be in range 1..%u. Set to %u.", m_int_configs[CONFIG_START_GM_LEVEL], MAX_LEVEL, MAX_LEVEL);
+ sLog->outError(LOG_FILTER_SERVER_LOADING, "GM.StartLevel (%i) must be in range 1..%u. Set to %u.", m_int_configs[CONFIG_START_GM_LEVEL], MAX_LEVEL, MAX_LEVEL);
m_int_configs[CONFIG_START_GM_LEVEL] = MAX_LEVEL;
}
m_bool_configs[CONFIG_ALLOW_GM_GROUP] = ConfigMgr::GetBoolDefault("GM.AllowInvite", false);
@@ -879,7 +882,7 @@ void World::LoadConfigSettings(bool reload)
m_int_configs[CONFIG_UPTIME_UPDATE] = ConfigMgr::GetIntDefault("UpdateUptimeInterval", 10);
if (int32(m_int_configs[CONFIG_UPTIME_UPDATE]) <= 0)
{
- sLog->outError(LOG_FILTER_GENERAL, "UpdateUptimeInterval (%i) must be > 0, set to default 10.", m_int_configs[CONFIG_UPTIME_UPDATE]);
+ sLog->outError(LOG_FILTER_SERVER_LOADING, "UpdateUptimeInterval (%i) must be > 0, set to default 10.", m_int_configs[CONFIG_UPTIME_UPDATE]);
m_int_configs[CONFIG_UPTIME_UPDATE] = 10;
}
if (reload)
@@ -892,7 +895,7 @@ void World::LoadConfigSettings(bool reload)
m_int_configs[CONFIG_LOGDB_CLEARINTERVAL] = ConfigMgr::GetIntDefault("LogDB.Opt.ClearInterval", 10);
if (int32(m_int_configs[CONFIG_LOGDB_CLEARINTERVAL]) <= 0)
{
- sLog->outError(LOG_FILTER_GENERAL, "LogDB.Opt.ClearInterval (%i) must be > 0, set to default 10.", m_int_configs[CONFIG_LOGDB_CLEARINTERVAL]);
+ sLog->outError(LOG_FILTER_SERVER_LOADING, "LogDB.Opt.ClearInterval (%i) must be > 0, set to default 10.", m_int_configs[CONFIG_LOGDB_CLEARINTERVAL]);
m_int_configs[CONFIG_LOGDB_CLEARINTERVAL] = 10;
}
if (reload)
@@ -901,7 +904,7 @@ void World::LoadConfigSettings(bool reload)
m_timers[WUPDATE_CLEANDB].Reset();
}
m_int_configs[CONFIG_LOGDB_CLEARTIME] = ConfigMgr::GetIntDefault("LogDB.Opt.ClearTime", 1209600); // 14 days default
- sLog->outInfo(LOG_FILTER_GENERAL, "Will clear `logs` table of entries older than %i seconds every %u minutes.",
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Will clear `logs` table of entries older than %i seconds every %u minutes.",
m_int_configs[CONFIG_LOGDB_CLEARTIME], m_int_configs[CONFIG_LOGDB_CLEARINTERVAL]);
m_int_configs[CONFIG_SKILL_CHANCE_ORANGE] = ConfigMgr::GetIntDefault("SkillChance.Orange", 100);
@@ -926,7 +929,7 @@ void World::LoadConfigSettings(bool reload)
m_int_configs[CONFIG_MAX_OVERSPEED_PINGS] = ConfigMgr::GetIntDefault("MaxOverspeedPings", 2);
if (m_int_configs[CONFIG_MAX_OVERSPEED_PINGS] != 0 && m_int_configs[CONFIG_MAX_OVERSPEED_PINGS] < 2)
{
- sLog->outError(LOG_FILTER_GENERAL, "MaxOverspeedPings (%i) must be in range 2..infinity (or 0 to disable check). Set to 2.", m_int_configs[CONFIG_MAX_OVERSPEED_PINGS]);
+ sLog->outError(LOG_FILTER_SERVER_LOADING, "MaxOverspeedPings (%i) must be in range 2..infinity (or 0 to disable check). Set to 2.", m_int_configs[CONFIG_MAX_OVERSPEED_PINGS]);
m_int_configs[CONFIG_MAX_OVERSPEED_PINGS] = 2;
}
@@ -941,7 +944,7 @@ void World::LoadConfigSettings(bool reload)
{
uint32 val = ConfigMgr::GetIntDefault("Expansion", 1);
if (val != m_int_configs[CONFIG_EXPANSION])
- sLog->outError(LOG_FILTER_GENERAL, "Expansion option can't be changed at worldserver.conf reload, using current value (%u).", m_int_configs[CONFIG_EXPANSION]);
+ sLog->outError(LOG_FILTER_SERVER_LOADING, "Expansion option can't be changed at worldserver.conf reload, using current value (%u).", m_int_configs[CONFIG_EXPANSION]);
}
else
m_int_configs[CONFIG_EXPANSION] = ConfigMgr::GetIntDefault("Expansion", 1);
@@ -973,7 +976,7 @@ void World::LoadConfigSettings(bool reload)
m_int_configs[CONFIG_RANDOM_BG_RESET_HOUR] = ConfigMgr::GetIntDefault("Battleground.Random.ResetHour", 6);
if (m_int_configs[CONFIG_RANDOM_BG_RESET_HOUR] > 23)
{
- sLog->outError(LOG_FILTER_GENERAL, "Battleground.Random.ResetHour (%i) can't be load. Set to 6.", m_int_configs[CONFIG_RANDOM_BG_RESET_HOUR]);
+ sLog->outError(LOG_FILTER_SERVER_LOADING, "Battleground.Random.ResetHour (%i) can't be load. Set to 6.", m_int_configs[CONFIG_RANDOM_BG_RESET_HOUR]);
m_int_configs[CONFIG_RANDOM_BG_RESET_HOUR] = 6;
}
@@ -1040,10 +1043,10 @@ void World::LoadConfigSettings(bool reload)
if (clientCacheId > 0)
{
m_int_configs[CONFIG_CLIENTCACHE_VERSION] = clientCacheId;
- sLog->outInfo(LOG_FILTER_GENERAL, "Client cache version set to: %u", clientCacheId);
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Client cache version set to: %u", clientCacheId);
}
else
- sLog->outError(LOG_FILTER_GENERAL, "ClientCacheVersion can't be negative %d, ignored.", clientCacheId);
+ sLog->outError(LOG_FILTER_SERVER_LOADING, "ClientCacheVersion can't be negative %d, ignored.", clientCacheId);
}
m_int_configs[CONFIG_INSTANT_LOGOUT] = ConfigMgr::GetIntDefault("InstantLogout", SEC_MODERATOR);
@@ -1059,12 +1062,12 @@ void World::LoadConfigSettings(bool reload)
m_MaxVisibleDistanceOnContinents = ConfigMgr::GetFloatDefault("Visibility.Distance.Continents", DEFAULT_VISIBILITY_DISTANCE);
if (m_MaxVisibleDistanceOnContinents < 45*sWorld->getRate(RATE_CREATURE_AGGRO))
{
- sLog->outError(LOG_FILTER_GENERAL, "Visibility.Distance.Continents can't be less max aggro radius %f", 45*sWorld->getRate(RATE_CREATURE_AGGRO));
+ sLog->outError(LOG_FILTER_SERVER_LOADING, "Visibility.Distance.Continents can't be less max aggro radius %f", 45*sWorld->getRate(RATE_CREATURE_AGGRO));
m_MaxVisibleDistanceOnContinents = 45*sWorld->getRate(RATE_CREATURE_AGGRO);
}
else if (m_MaxVisibleDistanceOnContinents > MAX_VISIBILITY_DISTANCE)
{
- sLog->outError(LOG_FILTER_GENERAL, "Visibility.Distance.Continents can't be greater %f", MAX_VISIBILITY_DISTANCE);
+ sLog->outError(LOG_FILTER_SERVER_LOADING, "Visibility.Distance.Continents can't be greater %f", MAX_VISIBILITY_DISTANCE);
m_MaxVisibleDistanceOnContinents = MAX_VISIBILITY_DISTANCE;
}
@@ -1072,12 +1075,12 @@ void World::LoadConfigSettings(bool reload)
m_MaxVisibleDistanceInInstances = ConfigMgr::GetFloatDefault("Visibility.Distance.Instances", DEFAULT_VISIBILITY_INSTANCE);
if (m_MaxVisibleDistanceInInstances < 45*sWorld->getRate(RATE_CREATURE_AGGRO))
{
- sLog->outError(LOG_FILTER_GENERAL, "Visibility.Distance.Instances can't be less max aggro radius %f", 45*sWorld->getRate(RATE_CREATURE_AGGRO));
+ sLog->outError(LOG_FILTER_SERVER_LOADING, "Visibility.Distance.Instances can't be less max aggro radius %f", 45*sWorld->getRate(RATE_CREATURE_AGGRO));
m_MaxVisibleDistanceInInstances = 45*sWorld->getRate(RATE_CREATURE_AGGRO);
}
else if (m_MaxVisibleDistanceInInstances > MAX_VISIBILITY_DISTANCE)
{
- sLog->outError(LOG_FILTER_GENERAL, "Visibility.Distance.Instances can't be greater %f", MAX_VISIBILITY_DISTANCE);
+ sLog->outError(LOG_FILTER_SERVER_LOADING, "Visibility.Distance.Instances can't be greater %f", MAX_VISIBILITY_DISTANCE);
m_MaxVisibleDistanceInInstances = MAX_VISIBILITY_DISTANCE;
}
@@ -1085,12 +1088,12 @@ void World::LoadConfigSettings(bool reload)
m_MaxVisibleDistanceInBGArenas = ConfigMgr::GetFloatDefault("Visibility.Distance.BGArenas", DEFAULT_VISIBILITY_BGARENAS);
if (m_MaxVisibleDistanceInBGArenas < 45*sWorld->getRate(RATE_CREATURE_AGGRO))
{
- sLog->outError(LOG_FILTER_GENERAL, "Visibility.Distance.BGArenas can't be less max aggro radius %f", 45*sWorld->getRate(RATE_CREATURE_AGGRO));
+ sLog->outError(LOG_FILTER_SERVER_LOADING, "Visibility.Distance.BGArenas can't be less max aggro radius %f", 45*sWorld->getRate(RATE_CREATURE_AGGRO));
m_MaxVisibleDistanceInBGArenas = 45*sWorld->getRate(RATE_CREATURE_AGGRO);
}
else if (m_MaxVisibleDistanceInBGArenas > MAX_VISIBILITY_DISTANCE)
{
- sLog->outError(LOG_FILTER_GENERAL, "Visibility.Distance.BGArenas can't be greater %f", MAX_VISIBILITY_DISTANCE);
+ sLog->outError(LOG_FILTER_SERVER_LOADING, "Visibility.Distance.BGArenas can't be greater %f", MAX_VISIBILITY_DISTANCE);
m_MaxVisibleDistanceInBGArenas = MAX_VISIBILITY_DISTANCE;
}
@@ -1111,12 +1114,12 @@ void World::LoadConfigSettings(bool reload)
if (reload)
{
if (dataPath != m_dataPath)
- sLog->outError(LOG_FILTER_GENERAL, "DataDir option can't be changed at worldserver.conf reload, using current value (%s).", m_dataPath.c_str());
+ sLog->outError(LOG_FILTER_SERVER_LOADING, "DataDir option can't be changed at worldserver.conf reload, using current value (%s).", m_dataPath.c_str());
}
else
{
m_dataPath = dataPath;
- sLog->outInfo(LOG_FILTER_GENERAL, "Using DataDir %s", m_dataPath.c_str());
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Using DataDir %s", m_dataPath.c_str());
}
m_bool_configs[CONFIG_VMAP_INDOOR_CHECK] = ConfigMgr::GetBoolDefault("vmap.enableIndoorCheck", 0);
@@ -1127,19 +1130,19 @@ void World::LoadConfigSettings(bool reload)
std::string ignoreSpellIds = ConfigMgr::GetStringDefault("vmap.ignoreSpellIds", "");
if (!enableHeight)
- sLog->outError(LOG_FILTER_GENERAL, "VMap height checking disabled! Creatures movements and other various things WILL be broken! Expect no support.");
+ sLog->outError(LOG_FILTER_SERVER_LOADING, "VMap height checking disabled! Creatures movements and other various things WILL be broken! Expect no support.");
VMAP::VMapFactory::createOrGetVMapManager()->setEnableLineOfSightCalc(enableLOS);
VMAP::VMapFactory::createOrGetVMapManager()->setEnableHeightCalc(enableHeight);
VMAP::VMapFactory::preventSpellsFromBeingTestedForLoS(ignoreSpellIds.c_str());
- sLog->outInfo(LOG_FILTER_GENERAL, "WORLD: VMap support included. LineOfSight:%i, getHeight:%i, indoorCheck:%i PetLOS:%i", enableLOS, enableHeight, enableIndoor, enablePetLOS);
- sLog->outInfo(LOG_FILTER_GENERAL, "WORLD: VMap data directory is: %svmaps", m_dataPath.c_str());
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "VMap support included. LineOfSight:%i, getHeight:%i, indoorCheck:%i PetLOS:%i", enableLOS, enableHeight, enableIndoor, enablePetLOS);
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "VMap data directory is: %svmaps", m_dataPath.c_str());
m_int_configs[CONFIG_MAX_WHO] = ConfigMgr::GetIntDefault("MaxWhoListReturns", 49);
m_bool_configs[CONFIG_PET_LOS] = ConfigMgr::GetBoolDefault("vmap.petLOS", true);
m_bool_configs[CONFIG_START_ALL_SPELLS] = ConfigMgr::GetBoolDefault("PlayerStart.AllSpells", false);
if (m_bool_configs[CONFIG_START_ALL_SPELLS])
- sLog->outInfo(LOG_FILTER_GENERAL, "WORLD: WARNING: PlayerStart.AllSpells enabled - may not function as intended!");
+ sLog->outWarn(LOG_FILTER_SERVER_LOADING, "PlayerStart.AllSpells enabled - may not function as intended!");
m_int_configs[CONFIG_HONOR_AFTER_DUEL] = ConfigMgr::GetIntDefault("HonorPointsAfterDuel", 0);
m_bool_configs[CONFIG_START_ALL_EXPLORED] = ConfigMgr::GetBoolDefault("PlayerStart.MapsExplored", false);
m_bool_configs[CONFIG_START_ALL_REP] = ConfigMgr::GetBoolDefault("PlayerStart.AllReputation", false);
@@ -1191,6 +1194,11 @@ void World::LoadConfigSettings(bool reload)
m_bool_configs[CONFIG_AUTOBROADCAST] = ConfigMgr::GetBoolDefault("AutoBroadcast.On", false);
m_int_configs[CONFIG_AUTOBROADCAST_CENTER] = ConfigMgr::GetIntDefault("AutoBroadcast.Center", 0);
m_int_configs[CONFIG_AUTOBROADCAST_INTERVAL] = ConfigMgr::GetIntDefault("AutoBroadcast.Timer", 60000);
+ if (reload)
+ {
+ m_timers[WUPDATE_AUTOBROADCAST].SetInterval(m_int_configs[CONFIG_AUTOBROADCAST_INTERVAL]);
+ m_timers[WUPDATE_AUTOBROADCAST].Reset();
+ }
// MySQL ping time interval
m_int_configs[CONFIG_DB_PING_INTERVAL] = ConfigMgr::GetIntDefault("MaxPingTime", 30);
@@ -1200,6 +1208,14 @@ void World::LoadConfigSettings(bool reload)
m_bool_configs[CONFIG_PDUMP_NO_OVERWRITE] = ConfigMgr::GetBoolDefault("PlayerDump.DisallowOverwrite", true);
// call ScriptMgr if we're reloading the configuration
+ m_bool_configs[CONFIG_WINTERGRASP_ENABLE] = ConfigMgr::GetBoolDefault("Wintergrasp.Enable", false);
+ m_int_configs[CONFIG_WINTERGRASP_PLR_MAX] = ConfigMgr::GetIntDefault("Wintergrasp.PlayerMax", 100);
+ m_int_configs[CONFIG_WINTERGRASP_PLR_MIN] = ConfigMgr::GetIntDefault("Wintergrasp.PlayerMin", 0);
+ m_int_configs[CONFIG_WINTERGRASP_PLR_MIN_LVL] = ConfigMgr::GetIntDefault("Wintergrasp.PlayerMinLvl", 77);
+ m_int_configs[CONFIG_WINTERGRASP_BATTLETIME] = ConfigMgr::GetIntDefault("Wintergrasp.BattleTimer", 30);
+ m_int_configs[CONFIG_WINTERGRASP_NOBATTLETIME] = ConfigMgr::GetIntDefault("Wintergrasp.NoBattleTimer", 150);
+ m_int_configs[CONFIG_WINTERGRASP_RESTART_AFTER_CRASH] = ConfigMgr::GetIntDefault("Wintergrasp.CrashRestartTimer", 10);
+
if (reload)
sScriptMgr->OnConfigLoad(reload);
}
@@ -1235,7 +1251,7 @@ void World::SetInitialWorldSettings()
!MapManager::ExistMapAndVMap(530, 10349.6f, -6357.29f) ||
!MapManager::ExistMapAndVMap(530, -3961.64f, -13931.2f))))
{
- sLog->outError(LOG_FILTER_GENERAL, "Correct *.map files not found in path '%smaps' or *.vmtree/*.vmtile files in '%svmaps'. Please place *.map/*.vmtree/*.vmtile files in appropriate directories or correct the DataDir value in the worldserver.conf file.", m_dataPath.c_str(), m_dataPath.c_str());
+ sLog->outError(LOG_FILTER_SERVER_LOADING, "Correct *.map files not found in path '%smaps' or *.vmtree/*.vmtile files in '%svmaps'. Please place *.map/*.vmtree/*.vmtile files in appropriate directories or correct the DataDir value in the worldserver.conf file.", m_dataPath.c_str(), m_dataPath.c_str());
exit(1);
}
@@ -1247,7 +1263,7 @@ void World::SetInitialWorldSettings()
///- Loading strings. Getting no records means core load has to be canceled because no error message can be output.
- sLog->outInfo(LOG_FILTER_GENERAL, "Loading Trinity strings...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Trinity strings...");
if (!sObjectMgr->LoadTrinityStrings())
exit(1); // Error message displayed in function already
@@ -1271,36 +1287,36 @@ void World::SetInitialWorldSettings()
CharacterDatabase.Execute(stmt);
///- Load the DBC files
- sLog->outInfo(LOG_FILTER_GENERAL, "Initialize data stores...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Initialize data stores...");
LoadDBCStores(m_dataPath);
DetectDBCLang();
- sLog->outInfo(LOG_FILTER_GENERAL, "Loading spell dbc data corrections...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading spell dbc data corrections...");
sSpellMgr->LoadDbcDataCorrections();
- sLog->outInfo(LOG_FILTER_GENERAL, "Loading SpellInfo store...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading SpellInfo store...");
sSpellMgr->LoadSpellInfoStore();
- sLog->outInfo(LOG_FILTER_GENERAL, "Loading SkillLineAbilityMultiMap Data...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading SkillLineAbilityMultiMap Data...");
sSpellMgr->LoadSkillLineAbilityMap();
- sLog->outInfo(LOG_FILTER_GENERAL, "Loading spell custom attributes...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading spell custom attributes...");
sSpellMgr->LoadSpellCustomAttr();
- sLog->outInfo(LOG_FILTER_GENERAL, "Loading GameObject models...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading GameObject models...");
LoadGameObjectModelList();
- sLog->outInfo(LOG_FILTER_GENERAL, "Loading Script Names...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Script Names...");
sObjectMgr->LoadScriptNames();
- sLog->outInfo(LOG_FILTER_GENERAL, "Loading Instance Template...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Instance Template...");
sObjectMgr->LoadInstanceTemplate();
// Must be called before `creature_respawn`/`gameobject_respawn` tables
- sLog->outInfo(LOG_FILTER_GENERAL, "Loading instances...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading instances...");
sInstanceSaveMgr->LoadInstances();
- sLog->outInfo(LOG_FILTER_GENERAL, "Loading Localization strings...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Localization strings...");
uint32 oldMSTime = getMSTime();
sObjectMgr->LoadCreatureLocales();
sObjectMgr->LoadGameObjectLocales();
@@ -1313,308 +1329,308 @@ void World::SetInitialWorldSettings()
sObjectMgr->LoadPointOfInterestLocales();
sObjectMgr->SetDBCLocaleIndex(GetDefaultDbcLocale()); // Get once for all the locale index of DBC language (console/broadcasts)
- sLog->outInfo(LOG_FILTER_GENERAL, ">> Localization strings loaded in %u ms", GetMSTimeDiffToNow(oldMSTime));
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Localization strings loaded in %u ms", GetMSTimeDiffToNow(oldMSTime));
- sLog->outInfo(LOG_FILTER_GENERAL, "Loading Page Texts...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Page Texts...");
sObjectMgr->LoadPageTexts();
- sLog->outInfo(LOG_FILTER_GENERAL, "Loading Game Object Templates..."); // must be after LoadPageTexts
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Game Object Templates..."); // must be after LoadPageTexts
sObjectMgr->LoadGameObjectTemplate();
- sLog->outInfo(LOG_FILTER_GENERAL, "Loading Spell Rank Data...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Spell Rank Data...");
sSpellMgr->LoadSpellRanks();
- sLog->outInfo(LOG_FILTER_GENERAL, "Loading Spell Required Data...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Spell Required Data...");
sSpellMgr->LoadSpellRequired();
- sLog->outInfo(LOG_FILTER_GENERAL, "Loading Spell Group types...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Spell Group types...");
sSpellMgr->LoadSpellGroups();
- sLog->outInfo(LOG_FILTER_GENERAL, "Loading Spell Learn Skills...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Spell Learn Skills...");
sSpellMgr->LoadSpellLearnSkills(); // must be after LoadSpellRanks
- sLog->outInfo(LOG_FILTER_GENERAL, "Loading Spell Learn Spells...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Spell Learn Spells...");
sSpellMgr->LoadSpellLearnSpells();
- sLog->outInfo(LOG_FILTER_GENERAL, "Loading Spell Proc Event conditions...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Spell Proc Event conditions...");
sSpellMgr->LoadSpellProcEvents();
- sLog->outInfo(LOG_FILTER_GENERAL, "Loading Spell Proc conditions and data...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Spell Proc conditions and data...");
sSpellMgr->LoadSpellProcs();
- sLog->outInfo(LOG_FILTER_GENERAL, "Loading Spell Bonus Data...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Spell Bonus Data...");
sSpellMgr->LoadSpellBonusess();
- sLog->outInfo(LOG_FILTER_GENERAL, "Loading Aggro Spells Definitions...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Aggro Spells Definitions...");
sSpellMgr->LoadSpellThreats();
- sLog->outInfo(LOG_FILTER_GENERAL, "Loading Spell Group Stack Rules...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Spell Group Stack Rules...");
sSpellMgr->LoadSpellGroupStackRules();
- sLog->outInfo(LOG_FILTER_GENERAL, "Loading NPC Texts...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading NPC Texts...");
sObjectMgr->LoadGossipText();
- sLog->outInfo(LOG_FILTER_GENERAL, "Loading Enchant Spells Proc datas...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Enchant Spells Proc datas...");
sSpellMgr->LoadSpellEnchantProcData();
- sLog->outInfo(LOG_FILTER_GENERAL, "Loading Item Random Enchantments Table...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Item Random Enchantments Table...");
LoadRandomEnchantmentsTable();
- sLog->outInfo(LOG_FILTER_GENERAL, "Loading Disables");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Disables");
DisableMgr::LoadDisables(); // must be before loading quests and items
- sLog->outInfo(LOG_FILTER_GENERAL, "Loading Items..."); // must be after LoadRandomEnchantmentsTable and LoadPageTexts
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Items..."); // must be after LoadRandomEnchantmentsTable and LoadPageTexts
sObjectMgr->LoadItemTemplates();
- sLog->outInfo(LOG_FILTER_GENERAL, "Loading Item set names..."); // must be after LoadItemPrototypes
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Item set names..."); // must be after LoadItemPrototypes
sObjectMgr->LoadItemSetNames();
- sLog->outInfo(LOG_FILTER_GENERAL, "Loading Creature Model Based Info Data...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Creature Model Based Info Data...");
sObjectMgr->LoadCreatureModelInfo();
- sLog->outInfo(LOG_FILTER_GENERAL, "Loading Equipment templates...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Equipment templates...");
sObjectMgr->LoadEquipmentTemplates();
- sLog->outInfo(LOG_FILTER_GENERAL, "Loading Creature templates...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Creature templates...");
sObjectMgr->LoadCreatureTemplates();
- sLog->outInfo(LOG_FILTER_GENERAL, "Loading Creature template addons...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Creature template addons...");
sObjectMgr->LoadCreatureTemplateAddons();
- sLog->outInfo(LOG_FILTER_GENERAL, "Loading Reputation Reward Rates...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Reputation Reward Rates...");
sObjectMgr->LoadReputationRewardRate();
- sLog->outInfo(LOG_FILTER_GENERAL, "Loading Creature Reputation OnKill Data...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Creature Reputation OnKill Data...");
sObjectMgr->LoadReputationOnKill();
- sLog->outInfo(LOG_FILTER_GENERAL, "Loading Reputation Spillover Data...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Reputation Spillover Data...");
sObjectMgr->LoadReputationSpilloverTemplate();
- sLog->outInfo(LOG_FILTER_GENERAL, "Loading Points Of Interest Data...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Points Of Interest Data...");
sObjectMgr->LoadPointsOfInterest();
- sLog->outInfo(LOG_FILTER_GENERAL, "Loading Creature Base Stats...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Creature Base Stats...");
sObjectMgr->LoadCreatureClassLevelStats();
- sLog->outInfo(LOG_FILTER_GENERAL, "Loading Creature Data...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Creature Data...");
sObjectMgr->LoadCreatures();
- sLog->outInfo(LOG_FILTER_GENERAL, "Loading pet levelup spells...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading pet levelup spells...");
sSpellMgr->LoadPetLevelupSpellMap();
- sLog->outInfo(LOG_FILTER_GENERAL, "Loading pet default spells additional to levelup spells...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading pet default spells additional to levelup spells...");
sSpellMgr->LoadPetDefaultSpells();
- sLog->outInfo(LOG_FILTER_GENERAL, "Loading Creature Addon Data...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Creature Addon Data...");
sObjectMgr->LoadCreatureAddons(); // must be after LoadCreatureTemplates() and LoadCreatures()
- sLog->outInfo(LOG_FILTER_GENERAL, "Loading Gameobject Data...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Gameobject Data...");
sObjectMgr->LoadGameobjects();
- sLog->outInfo(LOG_FILTER_GENERAL, "Loading Creature Linked Respawn...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Creature Linked Respawn...");
sObjectMgr->LoadLinkedRespawn(); // must be after LoadCreatures(), LoadGameObjects()
- sLog->outInfo(LOG_FILTER_GENERAL, "Loading Weather Data...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Weather Data...");
WeatherMgr::LoadWeatherData();
- sLog->outInfo(LOG_FILTER_GENERAL, "Loading Quests...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Quests...");
sObjectMgr->LoadQuests(); // must be loaded after DBCs, creature_template, item_template, gameobject tables
- sLog->outInfo(LOG_FILTER_GENERAL, "Checking Quest Disables");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Checking Quest Disables");
DisableMgr::CheckQuestDisables(); // must be after loading quests
- sLog->outInfo(LOG_FILTER_GENERAL, "Loading Quest POI");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Quest POI");
sObjectMgr->LoadQuestPOI();
- sLog->outInfo(LOG_FILTER_GENERAL, "Loading Quests Relations...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Quests Relations...");
sObjectMgr->LoadQuestRelations(); // must be after quest load
- sLog->outInfo(LOG_FILTER_GENERAL, "Loading Objects Pooling Data...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Objects Pooling Data...");
sPoolMgr->LoadFromDB();
- sLog->outInfo(LOG_FILTER_GENERAL, "Loading Game Event Data..."); // must be after loading pools fully
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Game Event Data..."); // must be after loading pools fully
sGameEventMgr->LoadFromDB();
- sLog->outInfo(LOG_FILTER_GENERAL, "Loading UNIT_NPC_FLAG_SPELLCLICK Data..."); // must be after LoadQuests
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading UNIT_NPC_FLAG_SPELLCLICK Data..."); // must be after LoadQuests
sObjectMgr->LoadNPCSpellClickSpells();
- sLog->outInfo(LOG_FILTER_GENERAL, "Loading Vehicle Template Accessories...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Vehicle Template Accessories...");
sObjectMgr->LoadVehicleTemplateAccessories(); // must be after LoadCreatureTemplates() and LoadNPCSpellClickSpells()
- sLog->outInfo(LOG_FILTER_GENERAL, "Loading Vehicle Accessories...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Vehicle Accessories...");
sObjectMgr->LoadVehicleAccessories(); // must be after LoadCreatureTemplates() and LoadNPCSpellClickSpells()
- sLog->outInfo(LOG_FILTER_GENERAL, "Loading Dungeon boss data...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Dungeon boss data...");
sObjectMgr->LoadInstanceEncounters();
- sLog->outInfo(LOG_FILTER_GENERAL, "Loading LFG rewards...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading LFG rewards...");
sLFGMgr->LoadRewards();
- sLog->outInfo(LOG_FILTER_GENERAL, "Loading SpellArea Data..."); // must be after quest load
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading SpellArea Data..."); // must be after quest load
sSpellMgr->LoadSpellAreas();
- sLog->outInfo(LOG_FILTER_GENERAL, "Loading AreaTrigger definitions...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading AreaTrigger definitions...");
sObjectMgr->LoadAreaTriggerTeleports();
- sLog->outInfo(LOG_FILTER_GENERAL, "Loading Access Requirements...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Access Requirements...");
sObjectMgr->LoadAccessRequirements(); // must be after item template load
- sLog->outInfo(LOG_FILTER_GENERAL, "Loading Quest Area Triggers...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Quest Area Triggers...");
sObjectMgr->LoadQuestAreaTriggers(); // must be after LoadQuests
- sLog->outInfo(LOG_FILTER_GENERAL, "Loading Tavern Area Triggers...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Tavern Area Triggers...");
sObjectMgr->LoadTavernAreaTriggers();
- sLog->outInfo(LOG_FILTER_GENERAL, "Loading AreaTrigger script names...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading AreaTrigger script names...");
sObjectMgr->LoadAreaTriggerScripts();
- sLog->outInfo(LOG_FILTER_GENERAL, "Loading Graveyard-zone links...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Graveyard-zone links...");
sObjectMgr->LoadGraveyardZones();
- sLog->outInfo(LOG_FILTER_GENERAL, "Loading spell pet auras...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading spell pet auras...");
sSpellMgr->LoadSpellPetAuras();
- sLog->outInfo(LOG_FILTER_GENERAL, "Loading Spell target coordinates...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Spell target coordinates...");
sSpellMgr->LoadSpellTargetPositions();
- sLog->outInfo(LOG_FILTER_GENERAL, "Loading enchant custom attributes...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading enchant custom attributes...");
sSpellMgr->LoadEnchantCustomAttr();
- sLog->outInfo(LOG_FILTER_GENERAL, "Loading linked spells...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading linked spells...");
sSpellMgr->LoadSpellLinked();
- sLog->outInfo(LOG_FILTER_GENERAL, "Loading Player Create Data...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Player Create Data...");
sObjectMgr->LoadPlayerInfo();
- sLog->outInfo(LOG_FILTER_GENERAL, "Loading Exploration BaseXP Data...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Exploration BaseXP Data...");
sObjectMgr->LoadExplorationBaseXP();
- sLog->outInfo(LOG_FILTER_GENERAL, "Loading Pet Name Parts...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Pet Name Parts...");
sObjectMgr->LoadPetNames();
CharacterDatabaseCleaner::CleanDatabase();
- sLog->outInfo(LOG_FILTER_GENERAL, "Loading the max pet number...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading the max pet number...");
sObjectMgr->LoadPetNumber();
- sLog->outInfo(LOG_FILTER_GENERAL, "Loading pet level stats...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading pet level stats...");
sObjectMgr->LoadPetLevelInfo();
- sLog->outInfo(LOG_FILTER_GENERAL, "Loading Player Corpses...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Player Corpses...");
sObjectMgr->LoadCorpses();
- sLog->outInfo(LOG_FILTER_GENERAL, "Loading Player level dependent mail rewards...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Player level dependent mail rewards...");
sObjectMgr->LoadMailLevelRewards();
// Loot tables
LoadLootTables();
- sLog->outInfo(LOG_FILTER_GENERAL, "Loading Skill Discovery Table...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Skill Discovery Table...");
LoadSkillDiscoveryTable();
- sLog->outInfo(LOG_FILTER_GENERAL, "Loading Skill Extra Item Table...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Skill Extra Item Table...");
LoadSkillExtraItemTable();
- sLog->outInfo(LOG_FILTER_GENERAL, "Loading Skill Fishing base level requirements...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Skill Fishing base level requirements...");
sObjectMgr->LoadFishingBaseSkillLevel();
- sLog->outInfo(LOG_FILTER_GENERAL, "Loading Achievements...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Achievements...");
sAchievementMgr->LoadAchievementReferenceList();
- sLog->outInfo(LOG_FILTER_GENERAL, "Loading Achievement Criteria Lists...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Achievement Criteria Lists...");
sAchievementMgr->LoadAchievementCriteriaList();
- sLog->outInfo(LOG_FILTER_GENERAL, "Loading Achievement Criteria Data...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Achievement Criteria Data...");
sAchievementMgr->LoadAchievementCriteriaData();
- sLog->outInfo(LOG_FILTER_GENERAL, "Loading Achievement Rewards...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Achievement Rewards...");
sAchievementMgr->LoadRewards();
- sLog->outInfo(LOG_FILTER_GENERAL, "Loading Achievement Reward Locales...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Achievement Reward Locales...");
sAchievementMgr->LoadRewardLocales();
- sLog->outInfo(LOG_FILTER_GENERAL, "Loading Completed Achievements...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Completed Achievements...");
sAchievementMgr->LoadCompletedAchievements();
// Delete expired auctions before loading
- sLog->outInfo(LOG_FILTER_GENERAL, "Deleting expired auctions...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Deleting expired auctions...");
sAuctionMgr->DeleteExpiredAuctionsAtStartup();
///- Load dynamic data tables from the database
- sLog->outInfo(LOG_FILTER_GENERAL, "Loading Item Auctions...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Item Auctions...");
sAuctionMgr->LoadAuctionItems();
- sLog->outInfo(LOG_FILTER_GENERAL, "Loading Auctions...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Auctions...");
sAuctionMgr->LoadAuctions();
sGuildMgr->LoadGuilds();
- sLog->outInfo(LOG_FILTER_GENERAL, "Loading ArenaTeams...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading ArenaTeams...");
sArenaTeamMgr->LoadArenaTeams();
- sLog->outInfo(LOG_FILTER_GENERAL, "Loading Groups...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Groups...");
sGroupMgr->LoadGroups();
- sLog->outInfo(LOG_FILTER_GENERAL, "Loading ReservedNames...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading ReservedNames...");
sObjectMgr->LoadReservedPlayersNames();
- sLog->outInfo(LOG_FILTER_GENERAL, "Loading GameObjects for quests...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading GameObjects for quests...");
sObjectMgr->LoadGameObjectForQuests();
- sLog->outInfo(LOG_FILTER_GENERAL, "Loading BattleMasters...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading BattleMasters...");
sBattlegroundMgr->LoadBattleMastersEntry();
- sLog->outInfo(LOG_FILTER_GENERAL, "Loading GameTeleports...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading GameTeleports...");
sObjectMgr->LoadGameTele();
- sLog->outInfo(LOG_FILTER_GENERAL, "Loading Gossip menu...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Gossip menu...");
sObjectMgr->LoadGossipMenu();
- sLog->outInfo(LOG_FILTER_GENERAL, "Loading Gossip menu options...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Gossip menu options...");
sObjectMgr->LoadGossipMenuItems();
- sLog->outInfo(LOG_FILTER_GENERAL, "Loading Vendors...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Vendors...");
sObjectMgr->LoadVendors(); // must be after load CreatureTemplate and ItemTemplate
- sLog->outInfo(LOG_FILTER_GENERAL, "Loading Trainers...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Trainers...");
sObjectMgr->LoadTrainerSpell(); // must be after load CreatureTemplate
- sLog->outInfo(LOG_FILTER_GENERAL, "Loading Waypoints...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Waypoints...");
sWaypointMgr->Load();
- sLog->outInfo(LOG_FILTER_GENERAL, "Loading SmartAI Waypoints...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading SmartAI Waypoints...");
sSmartWaypointMgr->LoadFromDB();
- sLog->outInfo(LOG_FILTER_GENERAL, "Loading Creature Formations...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Creature Formations...");
sFormationMgr->LoadCreatureFormations();
- sLog->outInfo(LOG_FILTER_GENERAL, "Loading World States..."); // must be loaded before battleground, outdoor PvP and conditions
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading World States..."); // must be loaded before battleground, outdoor PvP and conditions
LoadWorldStates();
- sLog->outInfo(LOG_FILTER_GENERAL, "Loading Conditions...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Conditions...");
sConditionMgr->LoadConditions();
- sLog->outInfo(LOG_FILTER_GENERAL, "Loading faction change achievement pairs...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading faction change achievement pairs...");
sObjectMgr->LoadFactionChangeAchievements();
- sLog->outInfo(LOG_FILTER_GENERAL, "Loading faction change spell pairs...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading faction change spell pairs...");
sObjectMgr->LoadFactionChangeSpells();
- sLog->outInfo(LOG_FILTER_GENERAL, "Loading faction change item pairs...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading faction change item pairs...");
sObjectMgr->LoadFactionChangeItems();
- sLog->outInfo(LOG_FILTER_GENERAL, "Loading faction change reputation pairs...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading faction change reputation pairs...");
sObjectMgr->LoadFactionChangeReputations();
- sLog->outInfo(LOG_FILTER_GENERAL, "Loading GM tickets...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading GM tickets...");
sTicketMgr->LoadTickets();
- sLog->outInfo(LOG_FILTER_GENERAL, "Loading GM surveys...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading GM surveys...");
sTicketMgr->LoadSurveys();
- sLog->outInfo(LOG_FILTER_GENERAL, "Loading client addons...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading client addons...");
AddonMgr::LoadFromDB();
///- Handle outdated emails (delete/return)
- sLog->outInfo(LOG_FILTER_GENERAL, "Returning old mails...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Returning old mails...");
sObjectMgr->ReturnOrDeleteOldMails(false);
- sLog->outInfo(LOG_FILTER_GENERAL, "Loading Autobroadcasts...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Autobroadcasts...");
LoadAutobroadcasts();
///- Load and initialize scripts
@@ -1625,42 +1641,42 @@ void World::SetInitialWorldSettings()
sObjectMgr->LoadEventScripts(); // must be after load Creature/Gameobject(Template/Data)
sObjectMgr->LoadWaypointScripts();
- sLog->outInfo(LOG_FILTER_GENERAL, "Loading Scripts text locales..."); // must be after Load*Scripts calls
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Scripts text locales..."); // must be after Load*Scripts calls
sObjectMgr->LoadDbScriptStrings();
- sLog->outInfo(LOG_FILTER_GENERAL, "Loading CreatureEventAI Texts...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading CreatureEventAI Texts...");
sEventAIMgr->LoadCreatureEventAI_Texts();
- sLog->outInfo(LOG_FILTER_GENERAL, "Loading CreatureEventAI Summons...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading CreatureEventAI Summons...");
sEventAIMgr->LoadCreatureEventAI_Summons();
- sLog->outInfo(LOG_FILTER_GENERAL, "Loading CreatureEventAI Scripts...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading CreatureEventAI Scripts...");
sEventAIMgr->LoadCreatureEventAI_Scripts();
- sLog->outInfo(LOG_FILTER_GENERAL, "Loading spell script names...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading spell script names...");
sObjectMgr->LoadSpellScriptNames();
- sLog->outInfo(LOG_FILTER_GENERAL, "Loading Creature Texts...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Creature Texts...");
sCreatureTextMgr->LoadCreatureTexts();
- sLog->outInfo(LOG_FILTER_GENERAL, "Loading Creature Text Locales...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Creature Text Locales...");
sCreatureTextMgr->LoadCreatureTextLocales();
- sLog->outInfo(LOG_FILTER_GENERAL, "Initializing Scripts...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Initializing Scripts...");
sScriptMgr->Initialize();
sScriptMgr->OnConfigLoad(false); // must be done after the ScriptMgr has been properly initialized
- sLog->outInfo(LOG_FILTER_GENERAL, "Validating spell scripts...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Validating spell scripts...");
sObjectMgr->ValidateSpellScripts();
- sLog->outInfo(LOG_FILTER_GENERAL, "Loading SmartAI scripts...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading SmartAI scripts...");
sSmartScriptMgr->LoadSmartAIFromDB();
- sLog->outInfo(LOG_FILTER_GENERAL, "Loading Calendar data...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Calendar data...");
sCalendarMgr->LoadFromDB();
///- Initialize game time and timers
- sLog->outInfo(LOG_FILTER_GENERAL, "Initialize game time and timers");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Initialize game time and timers");
m_gameTime = time(NULL);
m_startTime = m_gameTime;
@@ -1687,16 +1703,16 @@ void World::SetInitialWorldSettings()
mail_timer = ((((localtime(&m_gameTime)->tm_hour + 20) % 24)* HOUR * IN_MILLISECONDS) / m_timers[WUPDATE_AUCTIONS].GetInterval());
//1440
mail_timer_expires = ((DAY * IN_MILLISECONDS) / (m_timers[WUPDATE_AUCTIONS].GetInterval()));
- sLog->outInfo(LOG_FILTER_GENERAL, "Mail timer set to: " UI64FMTD ", mail return is called every " UI64FMTD " minutes", uint64(mail_timer), uint64(mail_timer_expires));
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Mail timer set to: " UI64FMTD ", mail return is called every " UI64FMTD " minutes", uint64(mail_timer), uint64(mail_timer_expires));
///- Initilize static helper structures
AIRegistry::Initialize();
///- Initialize MapManager
- sLog->outInfo(LOG_FILTER_GENERAL, "Starting Map System");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Starting Map System");
sMapMgr->Initialize();
- sLog->outInfo(LOG_FILTER_GENERAL, "Starting Game Event system...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Starting Game Event system...");
uint32 nextGameEvent = sGameEventMgr->StartSystem();
m_timers[WUPDATE_EVENTS].SetInterval(nextGameEvent); //depend on next event
@@ -1706,50 +1722,54 @@ void World::SetInitialWorldSettings()
// Delete all custom channels which haven't been used for PreserveCustomChannelDuration days.
Channel::CleanOldChannelsInDB();
- sLog->outInfo(LOG_FILTER_GENERAL, "Starting Arena Season...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Starting Arena Season...");
sGameEventMgr->StartArenaSeason();
sTicketMgr->Initialize();
///- Initialize Battlegrounds
- sLog->outInfo(LOG_FILTER_GENERAL, "Starting Battleground System");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Starting Battleground System");
sBattlegroundMgr->CreateInitialBattlegrounds();
sBattlegroundMgr->InitAutomaticArenaPointDistribution();
///- Initialize outdoor pvp
- sLog->outInfo(LOG_FILTER_GENERAL, "Starting Outdoor PvP System");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Starting Outdoor PvP System");
sOutdoorPvPMgr->InitOutdoorPvP();
- sLog->outInfo(LOG_FILTER_GENERAL, "Loading Transports...");
+ ///- Initialize Battlefield
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Starting Battlefield System");
+ sBattlefieldMgr->InitBattlefield();
+
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Transports...");
sMapMgr->LoadTransports();
- sLog->outInfo(LOG_FILTER_GENERAL, "Loading Transport NPCs...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Transport NPCs...");
sMapMgr->LoadTransportNPCs();
///- Initialize Warden
- sLog->outInfo(LOG_FILTER_GENERAL, "Loading Warden Checks...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Warden Checks...");
sWardenCheckMgr->LoadWardenChecks();
- sLog->outInfo(LOG_FILTER_GENERAL, "Loading Warden Action Overrides...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Warden Action Overrides...");
sWardenCheckMgr->LoadWardenOverrides();
- sLog->outInfo(LOG_FILTER_GENERAL, "Deleting expired bans...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Deleting expired bans...");
LoginDatabase.Execute("DELETE FROM ip_banned WHERE unbandate <= UNIX_TIMESTAMP() AND unbandate<>bandate"); // One-time query
- sLog->outInfo(LOG_FILTER_GENERAL, "Calculate next daily quest reset time...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Calculate next daily quest reset time...");
InitDailyQuestResetTime();
- sLog->outInfo(LOG_FILTER_GENERAL, "Calculate next weekly quest reset time...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Calculate next weekly quest reset time...");
InitWeeklyQuestResetTime();
- sLog->outInfo(LOG_FILTER_GENERAL, "Calculate random battleground reset time...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Calculate random battleground reset time...");
InitRandomBGResetTime();
LoadCharacterNameData();
uint32 startupDuration = GetMSTimeDiffToNow(startupBegin);
- sLog->outInfo(LOG_FILTER_GENERAL, "WORLD: World initialized in %u minutes %u seconds", (startupDuration / 60000), ((startupDuration % 60000) / 1000));
+ sLog->outInfo(LOG_FILTER_WORLDSERVER, "World initialized in %u minutes %u seconds", (startupDuration / 60000), ((startupDuration % 60000) / 1000));
sLog->EnableDBAppenders();
}
@@ -1759,7 +1779,7 @@ void World::DetectDBCLang()
if (m_lang_confid != 255 && m_lang_confid >= TOTAL_LOCALES)
{
- sLog->outError(LOG_FILTER_GENERAL, "Incorrect DBC.Locale! Must be >= 0 and < %d (set to 0)", TOTAL_LOCALES);
+ sLog->outError(LOG_FILTER_SERVER_LOADING, "Incorrect DBC.Locale! Must be >= 0 and < %d (set to 0)", TOTAL_LOCALES);
m_lang_confid = LOCALE_enUS;
}
@@ -1787,13 +1807,13 @@ void World::DetectDBCLang()
if (default_locale >= TOTAL_LOCALES)
{
- sLog->outError(LOG_FILTER_GENERAL, "Unable to determine your DBC Locale! (corrupt DBC?)");
+ sLog->outError(LOG_FILTER_SERVER_LOADING, "Unable to determine your DBC Locale! (corrupt DBC?)");
exit(1);
}
m_defaultDbcLocale = LocaleConstant(default_locale);
- sLog->outInfo(LOG_FILTER_GENERAL, "Using %s DBC Locale as default. All available DBC locales: %s", localeNames[m_defaultDbcLocale], availableLocalsStr.empty() ? "<none>" : availableLocalsStr.c_str());
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Using %s DBC Locale as default. All available DBC locales: %s", localeNames[m_defaultDbcLocale], availableLocalsStr.empty() ? "<none>" : availableLocalsStr.c_str());
}
@@ -1833,7 +1853,7 @@ void World::LoadAutobroadcasts()
if (!result)
{
- sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded 0 autobroadcasts definitions. DB table `autobroadcast` is empty!");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 autobroadcasts definitions. DB table `autobroadcast` is empty!");
return;
}
@@ -1851,7 +1871,7 @@ void World::LoadAutobroadcasts()
++count;
} while (result->NextRow());
- sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded %u autobroadcasts definitions in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u autobroadcasts definitions in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
}
@@ -1984,6 +2004,9 @@ void World::Update(uint32 diff)
sOutdoorPvPMgr->Update(diff);
RecordTimeDiff("UpdateOutdoorPvPMgr");
+ sBattlefieldMgr->Update(diff);
+ RecordTimeDiff("BattlefieldMgr");
+
///- Delete all characters which have been deleted X days before
if (m_timers[WUPDATE_DELETECHARS].Passed())
{
@@ -2018,7 +2041,7 @@ void World::Update(uint32 diff)
if (m_timers[WUPDATE_PINGDB].Passed())
{
m_timers[WUPDATE_PINGDB].Reset();
- sLog->outInfo(LOG_FILTER_GENERAL, "Ping MySQL to keep connection alive");
+ sLog->outDebug(LOG_FILTER_GENERAL, "Ping MySQL to keep connection alive");
CharacterDatabase.KeepAlive();
LoginDatabase.KeepAlive();
WorldDatabase.KeepAlive();
@@ -2607,7 +2630,7 @@ void World::SendAutoBroadcast()
sWorld->SendGlobalMessage(&data);
}
- sLog->outInfo(LOG_FILTER_GENERAL, "AutoBroadcast: '%s'", msg.c_str());
+ sLog->outDebug(LOG_FILTER_GENERAL, "AutoBroadcast: '%s'", msg.c_str());
}
void World::UpdateRealmCharCount(uint32 accountId)
@@ -2834,7 +2857,7 @@ void World::LoadWorldStates()
if (!result)
{
- sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded 0 world states. DB table `worldstates` is empty!");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 world states. DB table `worldstates` is empty!");
return;
}
@@ -2849,7 +2872,7 @@ void World::LoadWorldStates()
}
while (result->NextRow());
- sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded %u world states in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u world states in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
}
@@ -2906,12 +2929,12 @@ void World::ProcessQueryCallbacks()
void World::LoadCharacterNameData()
{
- sLog->outInfo(LOG_FILTER_GENERAL, "Loading character name data");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading character name data");
QueryResult result = CharacterDatabase.Query("SELECT guid, name, race, gender, class FROM characters WHERE deleteDate IS NULL");
if (!result)
{
- sLog->outError(LOG_FILTER_GENERAL, "No character name data loaded, empty query");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "No character name data loaded, empty query");
return;
}
@@ -2925,7 +2948,7 @@ void World::LoadCharacterNameData()
++count;
} while (result->NextRow());
- sLog->outInfo(LOG_FILTER_GENERAL, "Loaded name data for %u characters", count);
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loaded name data for %u characters", count);
}
void World::AddCharacterNameData(uint32 guid, std::string const& name, uint8 gender, uint8 race, uint8 playerClass)
diff --git a/src/server/game/World/World.h b/src/server/game/World/World.h
index f0dbc3c84ad..90bb82f1c2e 100755
--- a/src/server/game/World/World.h
+++ b/src/server/game/World/World.h
@@ -55,14 +55,14 @@ enum ServerMessageType
enum ShutdownMask
{
SHUTDOWN_MASK_RESTART = 1,
- SHUTDOWN_MASK_IDLE = 2,
+ SHUTDOWN_MASK_IDLE = 2
};
enum ShutdownExitCode
{
SHUTDOWN_EXIT_CODE = 0,
ERROR_EXIT_CODE = 1,
- RESTART_EXIT_CODE = 2,
+ RESTART_EXIT_CODE = 2
};
/// Timers for different object refresh rates
@@ -91,6 +91,7 @@ enum WorldBoolConfigs
CONFIG_GRID_UNLOAD,
CONFIG_STATS_SAVE_ONLY_ON_LOGOUT,
CONFIG_ALLOW_TWO_SIDE_ACCOUNTS,
+ CONFIG_ALLOW_TWO_SIDE_INTERACTION_CALENDAR,
CONFIG_ALLOW_TWO_SIDE_INTERACTION_CHAT,
CONFIG_ALLOW_TWO_SIDE_INTERACTION_CHANNEL,
CONFIG_ALLOW_TWO_SIDE_INTERACTION_GROUP,
@@ -164,6 +165,7 @@ enum WorldBoolConfigs
CONFIG_QUEST_IGNORE_AUTO_ACCEPT,
CONFIG_QUEST_IGNORE_AUTO_COMPLETE,
CONFIG_WARDEN_ENABLED,
+ CONFIG_WINTERGRASP_ENABLE,
BOOL_CONFIG_VALUE_COUNT
};
@@ -318,6 +320,12 @@ enum WorldIntConfigs
CONFIG_WARDEN_CLIENT_BAN_DURATION,
CONFIG_WARDEN_NUM_MEM_CHECKS,
CONFIG_WARDEN_NUM_OTHER_CHECKS,
+ CONFIG_WINTERGRASP_PLR_MAX,
+ CONFIG_WINTERGRASP_PLR_MIN,
+ CONFIG_WINTERGRASP_PLR_MIN_LVL,
+ CONFIG_WINTERGRASP_BATTLETIME,
+ CONFIG_WINTERGRASP_NOBATTLETIME,
+ CONFIG_WINTERGRASP_RESTART_AFTER_CRASH,
INT_CONFIG_VALUE_COUNT
};
@@ -401,18 +409,18 @@ enum BillingPlanFlags
SESSION_USAGE = 0x10,
SESSION_TIME_MIXTURE = 0x20,
SESSION_RESTRICTED = 0x40,
- SESSION_ENABLE_CAIS = 0x80,
+ SESSION_ENABLE_CAIS = 0x80
};
/// Type of server, this is values from second column of Cfg_Configs.dbc
enum RealmType
{
- REALM_TYPE_NORMAL = 0,
- REALM_TYPE_PVP = 1,
- REALM_TYPE_NORMAL2 = 4,
- REALM_TYPE_RP = 6,
- REALM_TYPE_RPPVP = 8,
- REALM_TYPE_FFA_PVP = 16 // custom, free for all pvp mode like arena PvP in all zones except rest activated places and sanctuaries
+ REALM_TYPE_NORMAL = 0,
+ REALM_TYPE_PVP = 1,
+ REALM_TYPE_NORMAL2 = 4,
+ REALM_TYPE_RP = 6,
+ REALM_TYPE_RPPVP = 8,
+ REALM_TYPE_FFA_PVP = 16 // custom, free for all pvp mode like arena PvP in all zones except rest activated places and sanctuaries
// replaced by REALM_PVP in realm list
};
diff --git a/src/server/scripts/CMakeLists.txt b/src/server/scripts/CMakeLists.txt
index 792fdeb3e7b..f148ae2b3ee 100644
--- a/src/server/scripts/CMakeLists.txt
+++ b/src/server/scripts/CMakeLists.txt
@@ -80,6 +80,8 @@ include_directories(
${CMAKE_SOURCE_DIR}/src/server/game/AI/ScriptedAI
${CMAKE_SOURCE_DIR}/src/server/game/AI/SmartScripts
${CMAKE_SOURCE_DIR}/src/server/game/AuctionHouse
+ ${CMAKE_SOURCE_DIR}/src/server/game/Battlefield
+ ${CMAKE_SOURCE_DIR}/src/server/game/Battlefield/Zones
${CMAKE_SOURCE_DIR}/src/server/game/Battlegrounds
${CMAKE_SOURCE_DIR}/src/server/game/Battlegrounds/Zones
${CMAKE_SOURCE_DIR}/src/server/game/Calendar
diff --git a/src/server/scripts/Commands/CMakeLists.txt b/src/server/scripts/Commands/CMakeLists.txt
index bd439c2c473..177b3a479f5 100644
--- a/src/server/scripts/Commands/CMakeLists.txt
+++ b/src/server/scripts/Commands/CMakeLists.txt
@@ -13,8 +13,10 @@ set(scripts_STAT_SRCS
Commands/cs_account.cpp
Commands/cs_achievement.cpp
Commands/cs_ban.cpp
+ Commands/cs_bf.cpp
Commands/cs_cast.cpp
Commands/cs_character.cpp
+ Commands/cs_cheat.cpp
Commands/cs_debug.cpp
Commands/cs_disable.cpp
Commands/cs_event.cpp
diff --git a/src/server/scripts/Commands/cs_account.cpp b/src/server/scripts/Commands/cs_account.cpp
index db975419a23..1024a3acf15 100644
--- a/src/server/scripts/Commands/cs_account.cpp
+++ b/src/server/scripts/Commands/cs_account.cpp
@@ -111,7 +111,7 @@ public:
handler->PSendSysMessage(LANG_ACCOUNT_CREATED, accountName);
if (handler->GetSession())
{
- sLog->outDebug(LOG_FILTER_PLAYER, "Account: %d (IP: %s) Character:[%s] (GUID: %u) Change Password."
+ sLog->outInfo(LOG_FILTER_CHARACTER, "Account: %d (IP: %s) Character:[%s] (GUID: %u) Change Password."
, handler->GetSession()->GetAccountId(),handler->GetSession()->GetRemoteAddress().c_str()
, handler->GetSession()->GetPlayer()->GetName(), handler->GetSession()->GetPlayer()->GetGUIDLow());
}
diff --git a/src/server/scripts/Commands/cs_ban.cpp b/src/server/scripts/Commands/cs_ban.cpp
index b84a7e5544a..bfb52d342e1 100644
--- a/src/server/scripts/Commands/cs_ban.cpp
+++ b/src/server/scripts/Commands/cs_ban.cpp
@@ -107,7 +107,7 @@ public:
return false;
}
- switch (sWorld->BanCharacter(name, durationStr, reasonStr, handler->GetSession() ? handler->GetSession()->GetPlayerName() : ""))
+ switch (sWorld->BanCharacter(name, durationStr, reasonStr, handler->GetSession() ? handler->GetSession()->GetPlayerName().c_str() : ""))
{
case BAN_SUCCESS:
{
@@ -183,7 +183,7 @@ public:
break;
}
- switch (sWorld->BanAccount(mode, nameOrIP, durationStr, reasonStr, handler->GetSession() ? handler->GetSession()->GetPlayerName() : ""))
+ switch (sWorld->BanAccount(mode, nameOrIP, durationStr, reasonStr, handler->GetSession() ? handler->GetSession()->GetPlayerName().c_str() : ""))
{
case BAN_SUCCESS:
if (atoi(durationStr) > 0)
diff --git a/src/server/scripts/Commands/cs_bf.cpp b/src/server/scripts/Commands/cs_bf.cpp
new file mode 100644
index 00000000000..7284e6ad6b7
--- /dev/null
+++ b/src/server/scripts/Commands/cs_bf.cpp
@@ -0,0 +1,180 @@
+/*
+ * Copyright (C) 2008-2011 TrinityCore <http://www.trinitycore.org/>
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation; either version 2 of the License, or (at your
+ * option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
+ * more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+/* ScriptData
+Name: bf_commandscript
+%Complete: 100
+Comment: All bf related commands
+Category: commandscripts
+EndScriptData */
+
+#include "ScriptMgr.h"
+#include "Chat.h"
+#include "BattlefieldMgr.h"
+
+class bf_commandscript : public CommandScript
+{
+public:
+ bf_commandscript() : CommandScript("bf_commandscript") { }
+
+ ChatCommand* GetCommands() const
+ {
+ static ChatCommand battlefieldcommandTable[] =
+ {
+ { "start", SEC_ADMINISTRATOR, false, &HandleBattlefieldStart, "", NULL },
+ { "stop", SEC_ADMINISTRATOR, false, &HandleBattlefieldEnd, "", NULL },
+ { "switch", SEC_ADMINISTRATOR, false, &HandleBattlefieldSwitch, "", NULL },
+ { "timer", SEC_ADMINISTRATOR, false, &HandleBattlefieldTimer, "", NULL },
+ { "enable", SEC_ADMINISTRATOR, false, &HandleBattlefieldEnable, "", NULL },
+ { NULL, 0, false, NULL, "", NULL }
+ };
+ static ChatCommand commandTable[] =
+ {
+ { "bf", SEC_ADMINISTRATOR, false, NULL, "", battlefieldcommandTable },
+ { NULL, 0, false, NULL, "", NULL }
+ };
+ return commandTable;
+ }
+
+ static bool HandleBattlefieldStart(ChatHandler* handler, const char* args)
+ {
+ uint32 battleid = 0;
+ char* battleid_str = strtok((char*)args, " ");
+ if (!battleid_str)
+ return false;
+
+ battleid = atoi(battleid_str);
+
+ Battlefield* bf = sBattlefieldMgr->GetBattlefieldByBattleId(battleid);
+
+ if (!bf)
+ return false;
+
+ bf->StartBattle();
+
+ if (battleid == 1)
+ handler->SendGlobalGMSysMessage("Wintergrasp (Command start used)");
+
+ return true;
+ }
+
+ static bool HandleBattlefieldEnd(ChatHandler* handler, const char* args)
+ {
+ uint32 battleid = 0;
+ char* battleid_str = strtok((char*)args, " ");
+ if (!battleid_str)
+ return false;
+
+ battleid = atoi(battleid_str);
+
+ Battlefield* bf = sBattlefieldMgr->GetBattlefieldByBattleId(battleid);
+
+ if (!bf)
+ return false;
+
+ bf->EndBattle(true);
+
+ if (battleid == 1)
+ handler->SendGlobalGMSysMessage("Wintergrasp (Command stop used)");
+
+ return true;
+ }
+
+ static bool HandleBattlefieldEnable(ChatHandler* handler, const char* args)
+ {
+ uint32 battleid = 0;
+ char* battleid_str = strtok((char*)args, " ");
+ if (!battleid_str)
+ return false;
+
+ battleid = atoi(battleid_str);
+
+ Battlefield* bf = sBattlefieldMgr->GetBattlefieldByBattleId(battleid);
+
+ if (!bf)
+ return false;
+
+ if (bf->IsEnabled())
+ {
+ bf->ToggleBattlefield(false);
+ if (battleid == 1)
+ handler->SendGlobalGMSysMessage("Wintergrasp is disabled");
+ }
+ else
+ {
+ bf->ToggleBattlefield(true);
+ if (battleid == 1)
+ handler->SendGlobalGMSysMessage("Wintergrasp is enabled");
+ }
+
+ return true;
+ }
+
+ static bool HandleBattlefieldSwitch(ChatHandler* handler, const char* args)
+ {
+ uint32 battleid = 0;
+ char* battleid_str = strtok((char*)args, " ");
+ if (!battleid_str)
+ return false;
+
+ battleid = atoi(battleid_str);
+
+ Battlefield* bf = sBattlefieldMgr->GetBattlefieldByBattleId(battleid);
+
+ if (!bf)
+ return false;
+
+ bf->EndBattle(false);
+ if (battleid == 1)
+ handler->SendGlobalGMSysMessage("Wintergrasp (Command switch used)");
+
+ return true;
+ }
+
+ static bool HandleBattlefieldTimer(ChatHandler* handler, const char* args)
+ {
+ uint32 battleid = 0;
+ uint32 time = 0;
+ char* battleid_str = strtok((char*)args, " ");
+ if (!battleid_str)
+ return false;
+ char* time_str = strtok(NULL, " ");
+ if (!time_str)
+ return false;
+
+ battleid = atoi(battleid_str);
+
+ time = atoi(time_str);
+
+ Battlefield* bf = sBattlefieldMgr->GetBattlefieldByBattleId(battleid);
+
+ if (!bf)
+ return false;
+
+ bf->SetTimer(time * IN_MILLISECONDS);
+ bf->SendInitWorldStatesToAll();
+ if (battleid == 1)
+ handler->SendGlobalGMSysMessage("Wintergrasp (Command timer used)");
+
+ return true;
+ }
+};
+
+void AddSC_bf_commandscript()
+{
+ new bf_commandscript();
+}
diff --git a/src/server/scripts/Commands/cs_cheat.cpp b/src/server/scripts/Commands/cs_cheat.cpp
new file mode 100644
index 00000000000..4f503fdbb76
--- /dev/null
+++ b/src/server/scripts/Commands/cs_cheat.cpp
@@ -0,0 +1,298 @@
+/*
+ * Copyright (C) 2008-2012 TrinityCore <http://www.trinitycore.org/>
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation; either version 2 of the License, or (at your
+ * option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
+ * more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+/* ScriptData
+Name: cheat_commandscript
+%Complete: 100
+Comment: All cheat related commands
+Category: commandscripts
+EndScriptData */
+
+#include "ScriptMgr.h"
+#include "ObjectMgr.h"
+#include "Chat.h"
+
+class cheat_commandscript : public CommandScript
+{
+public:
+ cheat_commandscript() : CommandScript("cheat_commandscript") { }
+
+ ChatCommand* GetCommands() const
+ {
+
+ static ChatCommand cheatCommandTable[] =
+ {
+ { "god", SEC_GAMEMASTER, false, &HandleGodModeCheatCommand, "", NULL },
+ { "casttime", SEC_GAMEMASTER, false, &HandleCasttimeCheatCommand, "", NULL },
+ { "cooldown", SEC_GAMEMASTER, false, &HandleCoolDownCheatCommand, "", NULL },
+ { "power", SEC_GAMEMASTER, false, &HandlePowerCheatCommand, "", NULL },
+ { "waterwalk", SEC_GAMEMASTER, false, &HandleWaterWalkCheatCommand, "", NULL },
+ { "status", SEC_GAMEMASTER, false, &HandleCheatStatusCommand, "", NULL },
+ { "taxi", SEC_GAMEMASTER, false, &HandleTaxiCheatCommand, "", NULL },
+ { "explore", SEC_GAMEMASTER, false, &HandleExploreCheatCommand, "", NULL },
+ { NULL, 0, false, NULL, "", NULL }
+
+ };
+
+ static ChatCommand commandTable[] =
+ {
+ { "cheat", SEC_GAMEMASTER, false, NULL, "", cheatCommandTable },
+ { NULL, 0, false, NULL, "", NULL }
+ };
+ return commandTable;
+ }
+
+ static bool HandleGodModeCheatCommand(ChatHandler* handler, const char* args)
+ {
+ if (!handler->GetSession() && !handler->GetSession()->GetPlayer())
+ return false;
+
+ std::string argstr = (char*)args;
+
+ if (!*args)
+ argstr = (handler->GetSession()->GetPlayer()->GetCommandStatus(CHEAT_GOD)) ? "off" : "on";
+
+ if (argstr == "off")
+ {
+ handler->GetSession()->GetPlayer()->SetCommandStatusOff(CHEAT_GOD);
+ handler->SendSysMessage("Godmode is OFF. You can take damage.");
+ return true;
+ }
+ else if (argstr == "on")
+ {
+ handler->GetSession()->GetPlayer()->SetCommandStatusOn(CHEAT_GOD);
+ handler->SendSysMessage("Godmode is ON. You won't take damage.");
+ return true;
+ }
+
+ return false;
+ }
+
+ static bool HandleCasttimeCheatCommand(ChatHandler* handler, const char* args)
+ {
+ if (!handler->GetSession() && !handler->GetSession()->GetPlayer())
+ return false;
+
+ std::string argstr = (char*)args;
+
+ if (!*args)
+ argstr = (handler->GetSession()->GetPlayer()->GetCommandStatus(CHEAT_CASTTIME)) ? "off" : "on";
+
+ if (argstr == "off")
+ {
+ handler->GetSession()->GetPlayer()->SetCommandStatusOff(CHEAT_CASTTIME);
+ handler->SendSysMessage("CastTime Cheat is OFF. Your spells will have a casttime.");
+ return true;
+ }
+ else if (argstr == "on")
+ {
+ handler->GetSession()->GetPlayer()->SetCommandStatusOn(CHEAT_CASTTIME);
+ handler->SendSysMessage("CastTime Cheat is ON. Your spells won't have a casttime.");
+ return true;
+ }
+
+ return false;
+ }
+
+ static bool HandleCoolDownCheatCommand(ChatHandler* handler, const char* args)
+ {
+ if (!handler->GetSession() && !handler->GetSession()->GetPlayer())
+ return false;
+
+ std::string argstr = (char*)args;
+
+ if (!*args)
+ argstr = (handler->GetSession()->GetPlayer()->GetCommandStatus(CHEAT_COOLDOWN)) ? "off" : "on";
+
+ if (argstr == "off")
+ {
+ handler->GetSession()->GetPlayer()->SetCommandStatusOff(CHEAT_COOLDOWN);
+ handler->SendSysMessage("Cooldown Cheat is OFF. You are on the global cooldown.");
+ return true;
+ }
+ else if (argstr == "on")
+ {
+ handler->GetSession()->GetPlayer()->SetCommandStatusOn(CHEAT_COOLDOWN);
+ handler->SendSysMessage("Cooldown Cheat is ON. You are not on the global cooldown.");
+ return true;
+ }
+
+ return false;
+ }
+
+ static bool HandlePowerCheatCommand(ChatHandler* handler, const char* args)
+ {
+ if (!handler->GetSession() && !handler->GetSession()->GetPlayer())
+ return false;
+
+ std::string argstr = (char*)args;
+
+ if (!*args)
+ argstr = (handler->GetSession()->GetPlayer()->GetCommandStatus(CHEAT_POWER)) ? "off" : "on";
+
+ if (argstr == "off")
+ {
+ handler->GetSession()->GetPlayer()->SetCommandStatusOff(CHEAT_POWER);
+ handler->SendSysMessage("Power Cheat is OFF. You need mana/rage/energy to use spells.");
+ return true;
+ }
+ else if (argstr == "on")
+ {
+ handler->GetSession()->GetPlayer()->SetCommandStatusOn(CHEAT_POWER);
+ handler->SendSysMessage("Power Cheat is ON. You don't need mana/rage/energy to use spells.");
+ return true;
+ }
+
+ return false;
+ }
+
+ static bool HandleCheatStatusCommand(ChatHandler* handler, const char* /*args*/)
+ {
+ Player* player = handler->GetSession()->GetPlayer();
+
+ const char* enabled = "enabled";
+ const char* disabled = "disabled";
+
+ handler->SendSysMessage(LANG_COMMAND_CHEAT_STATUS);
+ handler->PSendSysMessage(LANG_COMMAND_CHEAT_GOD, player->GetCommandStatus(CHEAT_GOD) ? enabled : disabled);
+ handler->PSendSysMessage(LANG_COMMAND_CHEAT_CD, player->GetCommandStatus(CHEAT_COOLDOWN) ? enabled : disabled);
+ handler->PSendSysMessage(LANG_COMMAND_CHEAT_CT, player->GetCommandStatus(CHEAT_CASTTIME) ? enabled : disabled);
+ handler->PSendSysMessage(LANG_COMMAND_CHEAT_POWER, player->GetCommandStatus(CHEAT_POWER) ? enabled : disabled);
+ handler->PSendSysMessage(LANG_COMMAND_CHEAT_WW, player->GetCommandStatus(CHEAT_WATERWALK) ? enabled : disabled);
+ return true;
+ }
+
+ static bool HandleWaterWalkCheatCommand(ChatHandler* handler, const char* args)
+ {
+ if (!handler->GetSession() && !handler->GetSession()->GetPlayer())
+ return false;
+
+ std::string argstr = (char*)args;
+
+ if (!*args)
+ {
+ argstr = (handler->GetSession()->GetPlayer()->GetCommandStatus(CHEAT_WATERWALK)) ? "off" : "on";
+ if (handler->GetSession()->GetPlayer()->GetCommandStatus(CHEAT_WATERWALK))
+ argstr = "off";
+ else
+ argstr = "on";
+ }
+
+ if (argstr == "off")
+ {
+ handler->GetSession()->GetPlayer()->SetCommandStatusOff(CHEAT_WATERWALK);
+ handler->GetSession()->GetPlayer()->SetMovement(MOVE_LAND_WALK); // OFF
+ handler->SendSysMessage("Waterwalking is OFF. You can't walk on water.");
+ return true;
+ }
+ else if (argstr == "on")
+ {
+ handler->GetSession()->GetPlayer()->SetCommandStatusOn(CHEAT_WATERWALK);
+ handler->GetSession()->GetPlayer()->SetMovement(MOVE_WATER_WALK); // ON
+ handler->SendSysMessage("Waterwalking is ON. You can walk on water.");
+ return true;
+ }
+
+ return false;
+ }
+
+ static bool HandleTaxiCheatCommand(ChatHandler* handler, const char* args)
+ {
+ if (!*args)
+ {
+ handler->SendSysMessage(LANG_USE_BOL);
+ handler->SetSentErrorMessage(true);
+ return false;
+ }
+
+ std::string argstr = (char*)args;
+
+ Player* chr = handler->getSelectedPlayer();
+
+ if (!chr)
+ chr = handler->GetSession()->GetPlayer();
+ else if (handler->HasLowerSecurity(chr, 0)) // check online security
+ return false;
+
+ if (argstr == "on")
+ {
+ chr->SetTaxiCheater(true);
+ handler->PSendSysMessage(LANG_YOU_GIVE_TAXIS, handler->GetNameLink(chr).c_str());
+ if (handler->needReportToTarget(chr))
+ ChatHandler(chr).PSendSysMessage(LANG_YOURS_TAXIS_ADDED, handler->GetNameLink().c_str());
+ return true;
+ }
+
+ if (argstr == "off")
+ {
+ chr->SetTaxiCheater(false);
+ handler->PSendSysMessage(LANG_YOU_REMOVE_TAXIS, handler->GetNameLink(chr).c_str());
+ if (handler->needReportToTarget(chr))
+ ChatHandler(chr).PSendSysMessage(LANG_YOURS_TAXIS_REMOVED, handler->GetNameLink().c_str());
+
+ return true;
+ }
+
+ handler->SendSysMessage(LANG_USE_BOL);
+ handler->SetSentErrorMessage(true);
+ return false;
+ }
+
+ static bool HandleExploreCheatCommand(ChatHandler* handler, const char *args)
+ {
+ if (!*args)
+ return false;
+
+ int flag = atoi((char*)args);
+
+ Player* chr = handler->getSelectedPlayer();
+ if (chr == NULL)
+ {
+ handler->SendSysMessage(LANG_NO_CHAR_SELECTED);
+ handler->SetSentErrorMessage(true);
+ return false;
+ }
+
+ if (flag != 0)
+ {
+ handler->PSendSysMessage(LANG_YOU_SET_EXPLORE_ALL, handler->GetNameLink(chr).c_str());
+ if (handler->needReportToTarget(chr))
+ ChatHandler(chr).PSendSysMessage(LANG_YOURS_EXPLORE_SET_ALL, handler->GetNameLink().c_str());
+ }
+ else
+ {
+ handler->PSendSysMessage(LANG_YOU_SET_EXPLORE_NOTHING, handler->GetNameLink(chr).c_str());
+ if (handler->needReportToTarget(chr))
+ ChatHandler(chr).PSendSysMessage(LANG_YOURS_EXPLORE_SET_NOTHING, handler->GetNameLink().c_str());
+ }
+
+ for (uint8 i = 0; i < PLAYER_EXPLORED_ZONES_SIZE; ++i)
+ {
+ if (flag != 0)
+ handler->GetSession()->GetPlayer()->SetFlag(PLAYER_EXPLORED_ZONES_1+i, 0xFFFFFFFF);
+ else
+ handler->GetSession()->GetPlayer()->SetFlag(PLAYER_EXPLORED_ZONES_1+i, 0);
+ }
+
+ return true;
+ }
+};
+
+void AddSC_cheat_commandscript()
+{
+ new cheat_commandscript();
+}
diff --git a/src/server/scripts/Commands/cs_debug.cpp b/src/server/scripts/Commands/cs_debug.cpp
index 355ff195cf5..7f25a11bcdd 100644
--- a/src/server/scripts/Commands/cs_debug.cpp
+++ b/src/server/scripts/Commands/cs_debug.cpp
@@ -1325,7 +1325,7 @@ public:
{
Player* player = handler->GetSession()->GetPlayer();
- sLog->outInfo(LOG_FILTER_SQL, "(@PATH, XX, %.3f, %.3f, %.5f, 0,0, 0,100, 0),", player->GetPositionX(), player->GetPositionY(), player->GetPositionZ());
+ sLog->outInfo(LOG_FILTER_SQL_DEV, "(@PATH, XX, %.3f, %.3f, %.5f, 0,0, 0,100, 0),", player->GetPositionX(), player->GetPositionY(), player->GetPositionZ());
handler->PSendSysMessage("Waypoint SQL written to SQL Developer log");
return true;
diff --git a/src/server/scripts/Commands/cs_disable.cpp b/src/server/scripts/Commands/cs_disable.cpp
index e7f33885036..0bb376b08dd 100644
--- a/src/server/scripts/Commands/cs_disable.cpp
+++ b/src/server/scripts/Commands/cs_disable.cpp
@@ -26,6 +26,7 @@ EndScriptData */
#include "ObjectMgr.h"
#include "Chat.h"
#include "DisableMgr.h"
+#include "OutdoorPvP.h"
class disable_commandscript : public CommandScript
{
@@ -34,56 +35,230 @@ public:
ChatCommand* GetCommands() const
{
-
+ static ChatCommand removeDisableCommandTable[] =
+ {
+ { "spell", SEC_ADMINISTRATOR, true, &HandleRemoveDisableSpellCommand, "", NULL },
+ { "quest", SEC_ADMINISTRATOR, true, &HandleRemoveDisableQuestCommand, "", NULL },
+ { "map", SEC_ADMINISTRATOR, true, &HandleRemoveDisableMapCommand, "", NULL },
+ { "battleground", SEC_ADMINISTRATOR, true, &HandleRemoveDisableBattlegroundCommand, "", NULL },
+ { "achievement_criteria", SEC_ADMINISTRATOR, true, &HandleRemoveDisableAchievementCriteriaCommand, "", NULL },
+ { "outdoorpvp", SEC_ADMINISTRATOR, true, &HandleRemoveDisableOutdoorPvPCommand, "", NULL },
+ { "vmap", SEC_ADMINISTRATOR, true, &HandleRemoveDisableVmapCommand, "", NULL },
+ { NULL, 0, false, NULL, "", NULL }
+ };
+ static ChatCommand addDisableCommandTable[] =
+ {
+ { "spell", SEC_ADMINISTRATOR, true, &HandleAddDisableSpellCommand, "", NULL },
+ { "quest", SEC_ADMINISTRATOR, true, &HandleAddDisableQuestCommand, "", NULL },
+ { "map", SEC_ADMINISTRATOR, true, &HandleAddDisableMapCommand, "", NULL },
+ { "battleground", SEC_ADMINISTRATOR, true, &HandleAddDisableBattlegroundCommand, "", NULL },
+ { "achievement_criteria", SEC_ADMINISTRATOR, true, &HandleAddDisableAchievementCriteriaCommand, "", NULL },
+ { "outdoorpvp", SEC_ADMINISTRATOR, true, &HandleAddDisableOutdoorPvPCommand, "", NULL },
+ { "vmap", SEC_ADMINISTRATOR, true, &HandleAddDisableVmapCommand, "", NULL },
+ { NULL, 0, false, NULL, "", NULL }
+ };
static ChatCommand disableCommandTable[] =
{
- { "spell", SEC_GAMEMASTER, false, &HandleDisableSpellCommand, "", NULL },
- { "map", SEC_GAMEMASTER, false, &HandleDisableMapCommand, "", NULL },
- { "battleground", SEC_GAMEMASTER, false, &HandleDisableBattlegroundCommand, "", NULL },
- { "achievement_criteria", SEC_GAMEMASTER, false, &HandleDisableAchievementCriteriaCommand, "", NULL },
- { "outdoorpvp", SEC_GAMEMASTER, false, &HandleDisableOutdoorPvPCommand, "", NULL },
- { "vmap", SEC_GAMEMASTER, false, &HandleDisableVmapCommand, "", NULL },
- { NULL, 0, false, NULL, "", NULL }
+ { "add", SEC_ADMINISTRATOR, true, NULL, "", addDisableCommandTable },
+ { "remove", SEC_ADMINISTRATOR, true, NULL, "", removeDisableCommandTable },
+ { NULL, 0, false, NULL, "", NULL }
};
-
static ChatCommand commandTable[] =
{
- { "disable", SEC_GAMEMASTER, false, NULL, "", disableCommandTable },
- { NULL, 0, false, NULL, "", NULL }
+ { "disable", SEC_ADMINISTRATOR, false, NULL, "", disableCommandTable },
+ { NULL, 0, false, NULL, "", NULL }
};
return commandTable;
}
-
- static void HandleDisables(ChatHandler* handler, char const* args, uint8 disableType)
+ static bool HandleAddDisables(ChatHandler* handler, char const* args, uint8 disableType)
{
- char* cEntry = strtok((char*)args, " ");
- if (!cEntry || !atoi(cEntry))
- {
- handler->SendSysMessage("No entry specified.");
- return;
- }
+ char* entryStr = strtok((char*)args, " ");
+ if (!entryStr || !atoi(entryStr))
+ return false;
+
+ char* flagsStr = strtok(NULL, " ");
+ uint8 flags = flagsStr ? uint8(atoi(flagsStr)) : 0;
+
+ char* commentStr = strtok(NULL, "");
+ if (!commentStr)
+ return false;
+
+ std::string disableComment = commentStr;
+ uint32 entry = uint32(atoi(entryStr));
- char* cFlags = strtok(NULL, " ");
- if (!cFlags || !atoi(cFlags))
+ std::string disableTypeStr = "";
+
+ switch (disableType)
{
- handler->SendSysMessage("No flags specified.");
- return;
+ case DISABLE_TYPE_SPELL:
+ {
+ if (!sSpellMgr->GetSpellInfo(entry))
+ {
+ handler->PSendSysMessage(LANG_COMMAND_NOSPELLFOUND);
+ handler->SetSentErrorMessage(true);
+ return false;
+ }
+ disableTypeStr = "spell";
+ break;
+ }
+ case DISABLE_TYPE_QUEST:
+ {
+ if (!sObjectMgr->GetQuestTemplate(entry))
+ {
+ handler->PSendSysMessage(LANG_COMMAND_QUEST_NOTFOUND, entry);
+ handler->SetSentErrorMessage(true);
+ return false;
+ }
+ disableTypeStr = "quest";
+ break;
+ }
+ case DISABLE_TYPE_MAP:
+ {
+ if (!sMapStore.LookupEntry(entry))
+ {
+ handler->PSendSysMessage(LANG_COMMAND_NOMAPFOUND);
+ handler->SetSentErrorMessage(true);
+ return false;
+ }
+ disableTypeStr = "map";
+ break;
+ }
+ case DISABLE_TYPE_BATTLEGROUND:
+ {
+ if (!sBattlemasterListStore.LookupEntry(entry))
+ {
+ handler->PSendSysMessage(LANG_COMMAND_NO_BATTLEGROUND_FOUND);
+ handler->SetSentErrorMessage(true);
+ return false;
+ }
+ disableTypeStr = "battleground";
+ break;
+ }
+ case DISABLE_TYPE_ACHIEVEMENT_CRITERIA:
+ {
+ if (!sAchievementCriteriaStore.LookupEntry(entry))
+ {
+ handler->PSendSysMessage(LANG_COMMAND_NO_ACHIEVEMENT_CRITERIA_FOUND);
+ handler->SetSentErrorMessage(true);
+ return false;
+ }
+ disableTypeStr = "achievement criteria";
+ break;
+ }
+ case DISABLE_TYPE_OUTDOORPVP:
+ {
+ if (entry > MAX_OUTDOORPVP_TYPES)
+ {
+ handler->PSendSysMessage(LANG_COMMAND_NO_OUTDOOR_PVP_FORUND);
+ handler->SetSentErrorMessage(true);
+ return false;
+ }
+ disableTypeStr = "outdoorpvp";
+ break;
+ }
+ case DISABLE_TYPE_VMAP:
+ {
+ if (!sMapStore.LookupEntry(entry))
+ {
+ handler->PSendSysMessage(LANG_COMMAND_NOMAPFOUND);
+ handler->SetSentErrorMessage(true);
+ return false;
+ }
+ disableTypeStr = "vmap";
+ break;
+ }
+ default:
+ break;
}
- char* cComment = strtok(NULL, "");
- if (!cComment)
+ PreparedStatement* stmt = NULL;
+ stmt = WorldDatabase.GetPreparedStatement(WORLD_SEL_DISABLES);
+ stmt->setUInt32(0, entry);
+ stmt->setUInt8(1, disableType);
+ PreparedQueryResult result = WorldDatabase.Query(stmt);
+ if (result)
{
- handler->SendSysMessage("No comment specified.");
- return;
+ handler->PSendSysMessage("This %s (Id: %u) is already disabled.", disableTypeStr.c_str(), entry);
+ handler->SetSentErrorMessage(true);
+ return false;
}
- std::string entryStr = cEntry;
- std::string disableComment = cComment;
- uint32 entry = (uint32)atoi(cEntry);
- uint8 flags = atoi(cFlags);
+ stmt = WorldDatabase.GetPreparedStatement(WORLD_INS_DISABLES);
+ stmt->setUInt32(0, entry);
+ stmt->setUInt8(1, disableType);
+ stmt->setUInt16(2, flags);
+ stmt->setString(3, disableComment);
+ WorldDatabase.Execute(stmt);
+
+ handler->PSendSysMessage("Add Disabled %s (Id: %u) for reason %s", disableTypeStr.c_str(), entry, disableComment.c_str());
+ return true;
+ }
+
+ static bool HandleAddDisableSpellCommand(ChatHandler* handler, char const* args)
+ {
+ if (!*args)
+ return false;
+
+ return HandleAddDisables(handler, args, DISABLE_TYPE_SPELL);
+ }
+
+ static bool HandleAddDisableQuestCommand(ChatHandler* handler, char const* args)
+ {
+ if (!*args)
+ return false;
+
+ return HandleAddDisables(handler, args, DISABLE_TYPE_QUEST);
+ }
+
+ static bool HandleAddDisableMapCommand(ChatHandler* handler, char const* args)
+ {
+ if (!*args)
+ return false;
+
+ return HandleAddDisables(handler, args, DISABLE_TYPE_MAP);
+ }
+
+ static bool HandleAddDisableBattlegroundCommand(ChatHandler* handler, char const* args)
+ {
+ if (!*args)
+ return false;
+
+ return HandleAddDisables(handler, args, DISABLE_TYPE_BATTLEGROUND);
+ }
+
+ static bool HandleAddDisableAchievementCriteriaCommand(ChatHandler* handler, char const* args)
+ {
+ if (!*args)
+ return false;
+
+ return HandleAddDisables(handler, args, DISABLE_TYPE_ACHIEVEMENT_CRITERIA);
+ }
+
+ static bool HandleAddDisableOutdoorPvPCommand(ChatHandler* handler, char const* args)
+ {
+ if (!*args)
+ return false;
+
+ HandleAddDisables(handler, args, DISABLE_TYPE_OUTDOORPVP);
+ return true;
+ }
+
+ static bool HandleAddDisableVmapCommand(ChatHandler* handler, char const* args)
+ {
+ if (!*args)
+ return false;
+ return HandleAddDisables(handler, args, DISABLE_TYPE_VMAP);
+ }
+
+ static bool HandleRemoveDisables(ChatHandler* handler, char const* args, uint8 disableType)
+ {
+ char* entryStr = strtok((char*)args, " ");
+ if (!entryStr || !atoi(entryStr))
+ return false;
+ uint32 entry = uint32(atoi(entryStr));
std::string disableTypeStr = "";
@@ -92,6 +267,9 @@ public:
case DISABLE_TYPE_SPELL:
disableTypeStr = "spell";
break;
+ case DISABLE_TYPE_QUEST:
+ disableTypeStr = "quest";
+ break;
case DISABLE_TYPE_MAP:
disableTypeStr = "map";
break;
@@ -109,87 +287,85 @@ public:
break;
}
- PreparedStatement* stmt = WorldDatabase.GetPreparedStatement(WORLD_SEL_DISABLES);
+ PreparedStatement* stmt = NULL;
+ stmt = WorldDatabase.GetPreparedStatement(WORLD_SEL_DISABLES);
stmt->setUInt32(0, entry);
stmt->setUInt8(1, disableType);
PreparedQueryResult result = WorldDatabase.Query(stmt);
-
-
- if (result)
+ if (!result)
{
- handler->PSendSysMessage("This %s (id %u) is already disabled.", disableTypeStr.c_str(), entry);
- return;
+ handler->PSendSysMessage("This %s (Id: %u) is not disabled.", disableTypeStr.c_str(), entry);
+ handler->SetSentErrorMessage(true);
+ return false;
}
- PreparedStatement* stmt2 = WorldDatabase.GetPreparedStatement(WORLD_INS_DISABLES);
- stmt2->setUInt32(0, entry);
- stmt2->setUInt8(1, disableType);
- stmt2->setUInt16(2, flags);
- stmt2->setString(3, disableComment);
- WorldDatabase.Execute(stmt2);
-
- handler->PSendSysMessage("Disabled %s %u for reason %s", disableTypeStr.c_str(), entry, disableComment.c_str());
- return;
+ stmt = WorldDatabase.GetPreparedStatement(WORLD_DEL_DISABLES);
+ stmt->setUInt32(0, entry);
+ stmt->setUInt8(1, disableType);
+ WorldDatabase.Execute(stmt);
+ handler->PSendSysMessage("Remove Disabled %s (Id: %u)", disableTypeStr.c_str(), entry);
+ return true;
}
- static bool HandleDisableSpellCommand(ChatHandler* handler, char const* args)
+ static bool HandleRemoveDisableSpellCommand(ChatHandler* handler, char const* args)
{
if (!*args)
return false;
- HandleDisables(handler, args, DISABLE_TYPE_SPELL);
- return true;
+ return HandleRemoveDisables(handler, args, DISABLE_TYPE_SPELL);
}
- static bool HandleDisableMapCommand(ChatHandler* handler, char const* args)
+ static bool HandleRemoveDisableQuestCommand(ChatHandler* handler, char const* args)
{
if (!*args)
return false;
- HandleDisables(handler, args, DISABLE_TYPE_MAP);
- return true;
+ return HandleRemoveDisables(handler, args, DISABLE_TYPE_QUEST);
}
- static bool HandleDisableBattlegroundCommand(ChatHandler* handler, char const* args)
+ static bool HandleRemoveDisableMapCommand(ChatHandler* handler, char const* args)
{
if (!*args)
return false;
- HandleDisables(handler, args, DISABLE_TYPE_BATTLEGROUND);
- return true;
+ return HandleAddDisables(handler, args, DISABLE_TYPE_MAP);
}
- static bool HandleDisableAchievementCriteriaCommand(ChatHandler* handler, char const* args)
+ static bool HandleRemoveDisableBattlegroundCommand(ChatHandler* handler, char const* args)
{
if (!*args)
return false;
- HandleDisables(handler, args, DISABLE_TYPE_ACHIEVEMENT_CRITERIA);
- return true;
+ return HandleRemoveDisables(handler, args, DISABLE_TYPE_BATTLEGROUND);
}
- static bool HandleDisableOutdoorPvPCommand(ChatHandler* handler, char const* args)
+ static bool HandleRemoveDisableAchievementCriteriaCommand(ChatHandler* handler, char const* args)
{
if (!*args)
return false;
- HandleDisables(handler, args, DISABLE_TYPE_OUTDOORPVP);
- return true;
+ return HandleRemoveDisables(handler, args, DISABLE_TYPE_ACHIEVEMENT_CRITERIA);
}
- static bool HandleDisableVmapCommand(ChatHandler* handler, char const* args)
+ static bool HandleRemoveDisableOutdoorPvPCommand(ChatHandler* handler, char const* args)
{
if (!*args)
return false;
- HandleDisables(handler, args, DISABLE_TYPE_VMAP);
- return true;
+ return HandleRemoveDisables(handler, args, DISABLE_TYPE_OUTDOORPVP);
}
+ static bool HandleRemoveDisableVmapCommand(ChatHandler* handler, char const* args)
+ {
+ if (!*args)
+ return false;
+
+ return HandleRemoveDisables(handler, args, DISABLE_TYPE_VMAP);
+ }
};
void AddSC_disable_commandscript()
{
new disable_commandscript();
-} \ No newline at end of file
+}
diff --git a/src/server/scripts/Commands/cs_misc.cpp b/src/server/scripts/Commands/cs_misc.cpp
index 80847d7dec4..2c9623b23a6 100644
--- a/src/server/scripts/Commands/cs_misc.cpp
+++ b/src/server/scripts/Commands/cs_misc.cpp
@@ -1,2879 +1,2794 @@
-/*
- * Copyright (C) 2008-2012 TrinityCore <http://www.trinitycore.org/>
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License as published by the
- * Free Software Foundation; either version 2 of the License, or (at your
- * option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
- * more details.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program. If not, see <http://www.gnu.org/licenses/>.
- */
-
-#include "Chat.h"
-#include "ScriptMgr.h"
-#include "AccountMgr.h"
-#include "ArenaTeamMgr.h"
-#include "CellImpl.h"
-#include "GridNotifiers.h"
-#include "Group.h"
-#include "InstanceSaveMgr.h"
-#include "MovementGenerator.h"
-#include "ObjectAccessor.h"
-#include "SpellAuras.h"
-#include "TargetedMovementGenerator.h"
-#include "WeatherMgr.h"
-#include "ace/INET_Addr.h"
-
-class misc_commandscript : public CommandScript
-{
-public:
- misc_commandscript() : CommandScript("misc_commandscript") { }
-
- ChatCommand* GetCommands() const
- {
- static ChatCommand groupCommandTable[] =
- {
- { "leader", SEC_ADMINISTRATOR, false, &HandleGroupLeaderCommand, "", NULL },
- { "disband", SEC_ADMINISTRATOR, false, &HandleGroupDisbandCommand, "", NULL },
- { "remove", SEC_ADMINISTRATOR, false, &HandleGroupRemoveCommand, "", NULL },
- { NULL, 0, false, NULL, "", NULL }
- };
- static ChatCommand petCommandTable[] =
- {
- { "create", SEC_GAMEMASTER, false, &HandleCreatePetCommand, "", NULL },
- { "learn", SEC_GAMEMASTER, false, &HandlePetLearnCommand, "", NULL },
- { "unlearn", SEC_GAMEMASTER, false, &HandlePetUnlearnCommand, "", NULL },
- { NULL, 0, false, NULL, "", NULL }
- };
- static ChatCommand sendCommandTable[] =
- {
- { "items", SEC_ADMINISTRATOR, true, &HandleSendItemsCommand, "", NULL },
- { "mail", SEC_MODERATOR, true, &HandleSendMailCommand, "", NULL },
- { "message", SEC_ADMINISTRATOR, true, &HandleSendMessageCommand, "", NULL },
- { "money", SEC_ADMINISTRATOR, true, &HandleSendMoneyCommand, "", NULL },
- { NULL, 0, false, NULL, "", NULL }
- };
- static ChatCommand commandTable[] =
- {
- { "dev", SEC_ADMINISTRATOR, false, &HandleDevCommand, "", NULL },
- { "gps", SEC_ADMINISTRATOR, false, &HandleGPSCommand, "", NULL },
- { "aura", SEC_ADMINISTRATOR, false, &HandleAuraCommand, "", NULL },
- { "unaura", SEC_ADMINISTRATOR, false, &HandleUnAuraCommand, "", NULL },
- { "appear", SEC_MODERATOR, false, &HandleAppearCommand, "", NULL },
- { "summon", SEC_MODERATOR, false, &HandleSummonCommand, "", NULL },
- { "groupsummon", SEC_MODERATOR, false, &HandleGroupSummonCommand, "", NULL },
- { "commands", SEC_PLAYER, true, &HandleCommandsCommand, "", NULL },
- { "die", SEC_ADMINISTRATOR, false, &HandleDieCommand, "", NULL },
- { "revive", SEC_ADMINISTRATOR, true, &HandleReviveCommand, "", NULL },
- { "dismount", SEC_PLAYER, false, &HandleDismountCommand, "", NULL },
- { "guid", SEC_GAMEMASTER, false, &HandleGUIDCommand, "", NULL },
- { "help", SEC_PLAYER, true, &HandleHelpCommand, "", NULL },
- { "itemmove", SEC_GAMEMASTER, false, &HandleItemMoveCommand, "", NULL },
- { "cooldown", SEC_ADMINISTRATOR, false, &HandleCooldownCommand, "", NULL },
- { "distance", SEC_ADMINISTRATOR, false, &HandleGetDistanceCommand, "", NULL },
- { "recall", SEC_MODERATOR, false, &HandleRecallCommand, "", NULL },
- { "save", SEC_PLAYER, false, &HandleSaveCommand, "", NULL },
- { "saveall", SEC_MODERATOR, true, &HandleSaveAllCommand, "", NULL },
- { "kick", SEC_GAMEMASTER, true, &HandleKickPlayerCommand, "", NULL },
- { "start", SEC_PLAYER, false, &HandleStartCommand, "", NULL },
- { "taxicheat", SEC_MODERATOR, false, &HandleTaxiCheatCommand, "", NULL },
- { "linkgrave", SEC_ADMINISTRATOR, false, &HandleLinkGraveCommand, "", NULL },
- { "neargrave", SEC_ADMINISTRATOR, false, &HandleNearGraveCommand, "", NULL },
- { "explorecheat", SEC_ADMINISTRATOR, false, &HandleExploreCheatCommand, "", NULL },
- { "showarea", SEC_ADMINISTRATOR, false, &HandleShowAreaCommand, "", NULL },
- { "hidearea", SEC_ADMINISTRATOR, false, &HandleHideAreaCommand, "", NULL },
- { "additem", SEC_ADMINISTRATOR, false, &HandleAddItemCommand, "", NULL },
- { "additemset", SEC_ADMINISTRATOR, false, &HandleAddItemSetCommand, "", NULL },
- { "bank", SEC_ADMINISTRATOR, false, &HandleBankCommand, "", NULL },
- { "wchange", SEC_ADMINISTRATOR, false, &HandleChangeWeather, "", NULL },
- { "maxskill", SEC_ADMINISTRATOR, false, &HandleMaxSkillCommand, "", NULL },
- { "setskill", SEC_ADMINISTRATOR, false, &HandleSetSkillCommand, "", NULL },
- { "pinfo", SEC_GAMEMASTER, true, &HandlePInfoCommand, "", NULL },
- { "respawn", SEC_ADMINISTRATOR, false, &HandleRespawnCommand, "", NULL },
- { "send", SEC_MODERATOR, true, NULL, "", sendCommandTable },
- { "pet", SEC_GAMEMASTER, false, NULL, "", petCommandTable },
- { "mute", SEC_MODERATOR, true, &HandleMuteCommand, "", NULL },
- { "unmute", SEC_MODERATOR, true, &HandleUnmuteCommand, "", NULL },
- { "movegens", SEC_ADMINISTRATOR, false, &HandleMovegensCommand, "", NULL },
- { "cometome", SEC_ADMINISTRATOR, false, &HandleComeToMeCommand, "", NULL },
- { "damage", SEC_ADMINISTRATOR, false, &HandleDamageCommand, "", NULL },
- { "combatstop", SEC_GAMEMASTER, true, &HandleCombatStopCommand, "", NULL },
- { "flusharenapoints", SEC_ADMINISTRATOR, false, &HandleFlushArenaPointsCommand, "", NULL },
- { "repairitems", SEC_GAMEMASTER, true, &HandleRepairitemsCommand, "", NULL },
- { "waterwalk", SEC_GAMEMASTER, false, &HandleWaterwalkCommand, "", NULL },
- { "freeze", SEC_MODERATOR, false, &HandleFreezeCommand, "", NULL },
- { "unfreeze", SEC_MODERATOR, false, &HandleUnFreezeCommand, "", NULL },
- { "listfreeze", SEC_MODERATOR, false, &HandleListFreezeCommand, "", NULL },
- { "group", SEC_ADMINISTRATOR, false, NULL, "", groupCommandTable },
- { "possess", SEC_ADMINISTRATOR, false, HandlePossessCommand, "", NULL },
- { "unpossess", SEC_ADMINISTRATOR, false, HandleUnPossessCommand, "", NULL },
- { "bindsight", SEC_ADMINISTRATOR, false, HandleBindSightCommand, "", NULL },
- { "unbindsight", SEC_ADMINISTRATOR, false, HandleUnbindSightCommand, "", NULL },
- { "playall", SEC_GAMEMASTER, false, HandlePlayAllCommand, "", NULL },
- { NULL, 0, false, NULL, "", NULL }
- };
- return commandTable;
- }
-
- static bool HandleDevCommand(ChatHandler* handler, char const* args)
- {
- if (!*args)
- {
- if (handler->GetSession()->GetPlayer()->HasFlag(PLAYER_FLAGS, PLAYER_FLAGS_DEVELOPER))
- handler->GetSession()->SendNotification(LANG_DEV_ON);
- else
- handler->GetSession()->SendNotification(LANG_DEV_OFF);
- return true;
- }
-
- std::string argstr = (char*)args;
-
- if (argstr == "on")
- {
- handler->GetSession()->GetPlayer()->SetFlag(PLAYER_FLAGS, PLAYER_FLAGS_DEVELOPER);
- handler->GetSession()->SendNotification(LANG_DEV_ON);
- return true;
- }
-
- if (argstr == "off")
- {
- handler->GetSession()->GetPlayer()->RemoveFlag(PLAYER_FLAGS, PLAYER_FLAGS_DEVELOPER);
- handler->GetSession()->SendNotification(LANG_DEV_OFF);
- return true;
- }
-
- handler->SendSysMessage(LANG_USE_BOL);
- handler->SetSentErrorMessage(true);
- return false;
- }
-
- static bool HandleGPSCommand(ChatHandler* handler, char const* args)
- {
- WorldObject* object = NULL;
- if (*args)
- {
- uint64 guid = handler->extractGuidFromLink((char*)args);
- if (guid)
- object = (WorldObject*)ObjectAccessor::GetObjectByTypeMask(*handler->GetSession()->GetPlayer(), guid, TYPEMASK_UNIT | TYPEMASK_GAMEOBJECT);
-
- if (!object)
- {
- handler->SendSysMessage(LANG_PLAYER_NOT_FOUND);
- handler->SetSentErrorMessage(true);
- return false;
- }
- }
- else
- {
- object = handler->getSelectedUnit();
-
- if (!object)
- {
- handler->SendSysMessage(LANG_SELECT_CHAR_OR_CREATURE);
- handler->SetSentErrorMessage(true);
- return false;
- }
- }
-
- CellCoord cellCoord = Trinity::ComputeCellCoord(object->GetPositionX(), object->GetPositionY());
- Cell cell(cellCoord);
-
- uint32 zoneId, areaId;
- object->GetZoneAndAreaId(zoneId, areaId);
-
- MapEntry const* mapEntry = sMapStore.LookupEntry(object->GetMapId());
- AreaTableEntry const* zoneEntry = GetAreaEntryByAreaID(zoneId);
- AreaTableEntry const* areaEntry = GetAreaEntryByAreaID(areaId);
-
- float zoneX = object->GetPositionX();
- float zoneY = object->GetPositionY();
-
- Map2ZoneCoordinates(zoneX, zoneY, zoneId);
-
- Map const* map = object->GetMap();
- float groundZ = map->GetHeight(object->GetPhaseMask(), object->GetPositionX(), object->GetPositionY(), MAX_HEIGHT);
- float floorZ = map->GetHeight(object->GetPhaseMask(), object->GetPositionX(), object->GetPositionY(), object->GetPositionZ());
-
- GridCoord gridCoord = Trinity::ComputeGridCoord(object->GetPositionX(), object->GetPositionY());
-
- // 63? WHY?
- int gridX = 63 - gridCoord.x_coord;
- int gridY = 63 - gridCoord.y_coord;
-
- uint32 haveMap = Map::ExistMap(object->GetMapId(), gridX, gridY) ? 1 : 0;
- uint32 haveVMap = Map::ExistVMap(object->GetMapId(), gridX, gridY) ? 1 : 0;
-
- if (haveVMap)
- {
- if (map->IsOutdoors(object->GetPositionX(), object->GetPositionY(), object->GetPositionZ()))
- handler->PSendSysMessage("You are outdoors");
- else
- handler->PSendSysMessage("You are indoors");
- }
- else
- handler->PSendSysMessage("no VMAP available for area info");
-
- handler->PSendSysMessage(LANG_MAP_POSITION,
- object->GetMapId(), (mapEntry ? mapEntry->name[handler->GetSessionDbcLocale()] : "<unknown>"),
- zoneId, (zoneEntry ? zoneEntry->area_name[handler->GetSessionDbcLocale()] : "<unknown>"),
- areaId, (areaEntry ? areaEntry->area_name[handler->GetSessionDbcLocale()] : "<unknown>"),
- object->GetPhaseMask(),
- object->GetPositionX(), object->GetPositionY(), object->GetPositionZ(), object->GetOrientation(),
- cell.GridX(), cell.GridY(), cell.CellX(), cell.CellY(), object->GetInstanceId(),
- zoneX, zoneY, groundZ, floorZ, haveMap, haveVMap);
-
- LiquidData liquidStatus;
- ZLiquidStatus status = map->getLiquidStatus(object->GetPositionX(), object->GetPositionY(), object->GetPositionZ(), MAP_ALL_LIQUIDS, &liquidStatus);
-
- if (status)
- handler->PSendSysMessage(LANG_LIQUID_STATUS, liquidStatus.level, liquidStatus.depth_level, liquidStatus.entry, liquidStatus.type_flags, status);
-
- return true;
- }
-
- static bool HandleAuraCommand(ChatHandler* handler, char const* args)
- {
- Unit* target = handler->getSelectedUnit();
- if (!target)
- {
- handler->SendSysMessage(LANG_SELECT_CHAR_OR_CREATURE);
- handler->SetSentErrorMessage(true);
- return false;
- }
-
- // number or [name] Shift-click form |color|Hspell:spell_id|h[name]|h|r or Htalent form
- uint32 spellId = handler->extractSpellIdFromLink((char*)args);
-
- if (SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(spellId))
- Aura::TryRefreshStackOrCreate(spellInfo, MAX_EFFECT_MASK, target, target);
-
- return true;
- }
-
- static bool HandleUnAuraCommand(ChatHandler* handler, char const* args)
- {
- Unit* target = handler->getSelectedUnit();
- if (!target)
- {
- handler->SendSysMessage(LANG_SELECT_CHAR_OR_CREATURE);
- handler->SetSentErrorMessage(true);
- return false;
- }
-
- std::string argstr = args;
- if (argstr == "all")
- {
- target->RemoveAllAuras();
- return true;
- }
-
- // number or [name] Shift-click form |color|Hspell:spell_id|h[name]|h|r or Htalent form
- uint32 spellId = handler->extractSpellIdFromLink((char*)args);
- if (!spellId)
- return false;
-
- target->RemoveAurasDueToSpell(spellId);
-
- return true;
- }
- // Teleport to Player
- static bool HandleAppearCommand(ChatHandler* handler, char const* args)
- {
- Player* target;
- uint64 targetGuid;
- std::string targetName;
- if (!handler->extractPlayerTarget((char*)args, &target, &targetGuid, &targetName))
- return false;
-
- Player* _player = handler->GetSession()->GetPlayer();
- if (target == _player || targetGuid == _player->GetGUID())
- {
- handler->SendSysMessage(LANG_CANT_TELEPORT_SELF);
- handler->SetSentErrorMessage(true);
- return false;
- }
-
- if (target)
- {
- // check online security
- if (handler->HasLowerSecurity(target, 0))
- return false;
-
- std::string chrNameLink = handler->playerLink(targetName);
-
- Map* map = target->GetMap();
- if (map->IsBattlegroundOrArena())
- {
- // only allow if gm mode is on
- if (!_player->isGameMaster())
- {
- handler->PSendSysMessage(LANG_CANNOT_GO_TO_BG_GM, chrNameLink.c_str());
- handler->SetSentErrorMessage(true);
- return false;
- }
- // if both players are in different bgs
- else if (_player->GetBattlegroundId() && _player->GetBattlegroundId() != target->GetBattlegroundId())
- _player->LeaveBattleground(false); // Note: should be changed so _player gets no Deserter debuff
-
- // all's well, set bg id
- // when porting out from the bg, it will be reset to 0
- _player->SetBattlegroundId(target->GetBattlegroundId(), target->GetBattlegroundTypeId());
- // remember current position as entry point for return at bg end teleportation
- if (!_player->GetMap()->IsBattlegroundOrArena())
- _player->SetBattlegroundEntryPoint();
- }
- else if (map->IsDungeon())
- {
- // we have to go to instance, and can go to player only if:
- // 1) we are in his group (either as leader or as member)
- // 2) we are not bound to any group and have GM mode on
- if (_player->GetGroup())
- {
- // we are in group, we can go only if we are in the player group
- if (_player->GetGroup() != target->GetGroup())
- {
- handler->PSendSysMessage(LANG_CANNOT_GO_TO_INST_PARTY, chrNameLink.c_str());
- handler->SetSentErrorMessage(true);
- return false;
- }
- }
- else
- {
- // we are not in group, let's verify our GM mode
- if (!_player->isGameMaster())
- {
- handler->PSendSysMessage(LANG_CANNOT_GO_TO_INST_GM, chrNameLink.c_str());
- handler->SetSentErrorMessage(true);
- return false;
- }
- }
-
- // if the player or the player's group is bound to another instance
- // the player will not be bound to another one
- InstancePlayerBind* bind = _player->GetBoundInstance(target->GetMapId(), target->GetDifficulty(map->IsRaid()));
- if (!bind)
- {
- Group* group = _player->GetGroup();
- // if no bind exists, create a solo bind
- InstanceGroupBind* gBind = group ? group->GetBoundInstance(target) : NULL; // if no bind exists, create a solo bind
- if (!gBind)
- if (InstanceSave* save = sInstanceSaveMgr->GetInstanceSave(target->GetInstanceId()))
- _player->BindToInstance(save, !save->CanReset());
- }
-
- if (map->IsRaid())
- _player->SetRaidDifficulty(target->GetRaidDifficulty());
- else
- _player->SetDungeonDifficulty(target->GetDungeonDifficulty());
- }
-
- handler->PSendSysMessage(LANG_APPEARING_AT, chrNameLink.c_str());
-
- // stop flight if need
- if (_player->isInFlight())
- {
- _player->GetMotionMaster()->MovementExpired();
- _player->CleanupAfterTaxiFlight();
- }
- // save only in non-flight case
- else
- _player->SaveRecallPosition();
-
- // to point to see at target with same orientation
- float x, y, z;
- target->GetContactPoint(_player, x, y, z);
-
- _player->TeleportTo(target->GetMapId(), x, y, z, _player->GetAngle(target), TELE_TO_GM_MODE);
- _player->SetPhaseMask(target->GetPhaseMask(), true);
- }
- else
- {
- // check offline security
- if (handler->HasLowerSecurity(NULL, targetGuid))
- return false;
-
- std::string nameLink = handler->playerLink(targetName);
-
- handler->PSendSysMessage(LANG_APPEARING_AT, nameLink.c_str());
-
- // to point where player stay (if loaded)
- float x, y, z, o;
- uint32 map;
- bool in_flight;
- if (!Player::LoadPositionFromDB(map, x, y, z, o, in_flight, targetGuid))
- return false;
-
- // stop flight if need
- if (_player->isInFlight())
- {
- _player->GetMotionMaster()->MovementExpired();
- _player->CleanupAfterTaxiFlight();
- }
- // save only in non-flight case
- else
- _player->SaveRecallPosition();
-
- _player->TeleportTo(map, x, y, z, _player->GetOrientation());
- }
-
- return true;
- }
- // Summon Player
- static bool HandleSummonCommand(ChatHandler* handler, char const* args)
- {
- Player* target;
- uint64 targetGuid;
- std::string targetName;
- if (!handler->extractPlayerTarget((char*)args, &target, &targetGuid, &targetName))
- return false;
-
- Player* _player = handler->GetSession()->GetPlayer();
- if (target == _player || targetGuid == _player->GetGUID())
- {
- handler->PSendSysMessage(LANG_CANT_TELEPORT_SELF);
- handler->SetSentErrorMessage(true);
- return false;
- }
-
- if (target)
- {
- std::string nameLink = handler->playerLink(targetName);
- // check online security
- if (handler->HasLowerSecurity(target, 0))
- return false;
-
- if (target->IsBeingTeleported())
- {
- handler->PSendSysMessage(LANG_IS_TELEPORTED, nameLink.c_str());
- handler->SetSentErrorMessage(true);
- return false;
- }
-
- Map* map = handler->GetSession()->GetPlayer()->GetMap();
-
- if (map->IsBattlegroundOrArena())
- {
- // only allow if gm mode is on
- if (!_player->isGameMaster())
- {
- handler->PSendSysMessage(LANG_CANNOT_GO_TO_BG_GM, nameLink.c_str());
- handler->SetSentErrorMessage(true);
- return false;
- }
- // if both players are in different bgs
- else if (target->GetBattlegroundId() && handler->GetSession()->GetPlayer()->GetBattlegroundId() != target->GetBattlegroundId())
- target->LeaveBattleground(false); // Note: should be changed so target gets no Deserter debuff
-
- // all's well, set bg id
- // when porting out from the bg, it will be reset to 0
- target->SetBattlegroundId(handler->GetSession()->GetPlayer()->GetBattlegroundId(), handler->GetSession()->GetPlayer()->GetBattlegroundTypeId());
- // remember current position as entry point for return at bg end teleportation
- if (!target->GetMap()->IsBattlegroundOrArena())
- target->SetBattlegroundEntryPoint();
- }
- else if (map->IsDungeon())
- {
- Map* map = target->GetMap();
-
- if (map->Instanceable() && map->GetInstanceId() != map->GetInstanceId())
- target->UnbindInstance(map->GetInstanceId(), target->GetDungeonDifficulty(), true);
-
- // we are in instance, and can summon only player in our group with us as lead
- if (!handler->GetSession()->GetPlayer()->GetGroup() || !target->GetGroup() ||
- (target->GetGroup()->GetLeaderGUID() != handler->GetSession()->GetPlayer()->GetGUID()) ||
- (handler->GetSession()->GetPlayer()->GetGroup()->GetLeaderGUID() != handler->GetSession()->GetPlayer()->GetGUID()))
- // the last check is a bit excessive, but let it be, just in case
- {
- handler->PSendSysMessage(LANG_CANNOT_SUMMON_TO_INST, nameLink.c_str());
- handler->SetSentErrorMessage(true);
- return false;
- }
- }
-
- handler->PSendSysMessage(LANG_SUMMONING, nameLink.c_str(), "");
- if (handler->needReportToTarget(target))
- ChatHandler(target).PSendSysMessage(LANG_SUMMONED_BY, handler->playerLink(_player->GetName()).c_str());
-
- // stop flight if need
- if (target->isInFlight())
- {
- target->GetMotionMaster()->MovementExpired();
- target->CleanupAfterTaxiFlight();
- }
- // save only in non-flight case
- else
- target->SaveRecallPosition();
-
- // before GM
- float x, y, z;
- handler->GetSession()->GetPlayer()->GetClosePoint(x, y, z, target->GetObjectSize());
- target->TeleportTo(handler->GetSession()->GetPlayer()->GetMapId(), x, y, z, target->GetOrientation());
- target->SetPhaseMask(handler->GetSession()->GetPlayer()->GetPhaseMask(), true);
- }
- else
- {
- // check offline security
- if (handler->HasLowerSecurity(NULL, targetGuid))
- return false;
-
- std::string nameLink = handler->playerLink(targetName);
-
- handler->PSendSysMessage(LANG_SUMMONING, nameLink.c_str(), handler->GetTrinityString(LANG_OFFLINE));
-
- // in point where GM stay
- Player::SavePositionInDB(handler->GetSession()->GetPlayer()->GetMapId(),
- handler->GetSession()->GetPlayer()->GetPositionX(),
- handler->GetSession()->GetPlayer()->GetPositionY(),
- handler->GetSession()->GetPlayer()->GetPositionZ(),
- handler->GetSession()->GetPlayer()->GetOrientation(),
- handler->GetSession()->GetPlayer()->GetZoneId(),
- targetGuid);
- }
-
- return true;
- }
- // Summon group of player
- static bool HandleGroupSummonCommand(ChatHandler* handler, char const* args)
- {
- Player* target;
- if (!handler->extractPlayerTarget((char*)args, &target))
- return false;
-
- // check online security
- if (handler->HasLowerSecurity(target, 0))
- return false;
-
- Group* group = target->GetGroup();
-
- std::string nameLink = handler->GetNameLink(target);
-
- if (!group)
- {
- handler->PSendSysMessage(LANG_NOT_IN_GROUP, nameLink.c_str());
- handler->SetSentErrorMessage(true);
- return false;
- }
-
- Map* gmMap = handler->GetSession()->GetPlayer()->GetMap();
- bool toInstance = gmMap->Instanceable();
-
- // we are in instance, and can summon only player in our group with us as lead
- if (toInstance && (
- !handler->GetSession()->GetPlayer()->GetGroup() || (group->GetLeaderGUID() != handler->GetSession()->GetPlayer()->GetGUID()) ||
- (handler->GetSession()->GetPlayer()->GetGroup()->GetLeaderGUID() != handler->GetSession()->GetPlayer()->GetGUID())))
- // the last check is a bit excessive, but let it be, just in case
- {
- handler->SendSysMessage(LANG_CANNOT_SUMMON_TO_INST);
- handler->SetSentErrorMessage(true);
- return false;
- }
-
- for (GroupReference* itr = group->GetFirstMember(); itr != NULL; itr = itr->next())
- {
- Player* player = itr->getSource();
-
- if (!player || player == handler->GetSession()->GetPlayer() || !player->GetSession())
- continue;
-
- // check online security
- if (handler->HasLowerSecurity(player, 0))
- return false;
-
- std::string plNameLink = handler->GetNameLink(player);
-
- if (player->IsBeingTeleported() == true)
- {
- handler->PSendSysMessage(LANG_IS_TELEPORTED, plNameLink.c_str());
- handler->SetSentErrorMessage(true);
- return false;
- }
-
- if (toInstance)
- {
- Map* playerMap = player->GetMap();
-
- if (playerMap->Instanceable() && playerMap->GetInstanceId() != gmMap->GetInstanceId())
- {
- // cannot summon from instance to instance
- handler->PSendSysMessage(LANG_CANNOT_SUMMON_TO_INST, plNameLink.c_str());
- handler->SetSentErrorMessage(true);
- return false;
- }
- }
-
- handler->PSendSysMessage(LANG_SUMMONING, plNameLink.c_str(), "");
- if (handler->needReportToTarget(player))
- ChatHandler(player).PSendSysMessage(LANG_SUMMONED_BY, handler->GetNameLink().c_str());
-
- // stop flight if need
- if (player->isInFlight())
- {
- player->GetMotionMaster()->MovementExpired();
- player->CleanupAfterTaxiFlight();
- }
- // save only in non-flight case
- else
- player->SaveRecallPosition();
-
- // before GM
- float x, y, z;
- handler->GetSession()->GetPlayer()->GetClosePoint(x, y, z, player->GetObjectSize());
- player->TeleportTo(handler->GetSession()->GetPlayer()->GetMapId(), x, y, z, player->GetOrientation());
- }
-
- return true;
- }
-
- static bool HandleCommandsCommand(ChatHandler* handler, char const* /*args*/)
- {
- handler->ShowHelpForCommand(handler->getCommandTable(), "");
- return true;
- }
-
- static bool HandleDieCommand(ChatHandler* handler, char const* /*args*/)
- {
- Unit* target = handler->getSelectedUnit();
-
- if (!target || !handler->GetSession()->GetPlayer()->GetSelection())
- {
- handler->SendSysMessage(LANG_SELECT_CHAR_OR_CREATURE);
- handler->SetSentErrorMessage(true);
- return false;
- }
-
- if (target->GetTypeId() == TYPEID_PLAYER)
- {
- if (handler->HasLowerSecurity((Player*)target, 0, false))
- return false;
- }
-
- if (target->isAlive())
- {
- if (sWorld->getBoolConfig(CONFIG_DIE_COMMAND_MODE))
- handler->GetSession()->GetPlayer()->Kill(target);
- else
- handler->GetSession()->GetPlayer()->DealDamage(target, target->GetHealth(), NULL, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, NULL, false);
- }
-
- return true;
- }
-
- static bool HandleReviveCommand(ChatHandler* handler, char const* args)
- {
- Player* target;
- uint64 targetGuid;
- if (!handler->extractPlayerTarget((char*)args, &target, &targetGuid))
- return false;
-
- if (target)
- {
- target->ResurrectPlayer(!AccountMgr::IsPlayerAccount(target->GetSession()->GetSecurity()) ? 1.0f : 0.5f);
- target->SpawnCorpseBones();
- target->SaveToDB();
- }
- else
- // will resurrected at login without corpse
- sObjectAccessor->ConvertCorpseForPlayer(targetGuid);
-
- return true;
- }
-
- static bool HandleDismountCommand(ChatHandler* handler, char const* /*args*/)
- {
- Player* player = handler->GetSession()->GetPlayer();
-
- // If player is not mounted, so go out :)
- if (!player->IsMounted())
- {
- handler->SendSysMessage(LANG_CHAR_NON_MOUNTED);
- handler->SetSentErrorMessage(true);
- return false;
- }
-
- if (player->isInFlight())
- {
- handler->SendSysMessage(LANG_YOU_IN_FLIGHT);
- handler->SetSentErrorMessage(true);
- return false;
- }
-
- player->Dismount();
- player->RemoveAurasByType(SPELL_AURA_MOUNTED);
- return true;
- }
-
- static bool HandleGUIDCommand(ChatHandler* handler, char const* /*args*/)
- {
- uint64 guid = handler->GetSession()->GetPlayer()->GetSelection();
-
- if (guid == 0)
- {
- handler->SendSysMessage(LANG_NO_SELECTION);
- handler->SetSentErrorMessage(true);
- return false;
- }
-
- handler->PSendSysMessage(LANG_OBJECT_GUID, GUID_LOPART(guid), GUID_HIPART(guid));
- return true;
- }
-
- static bool HandleHelpCommand(ChatHandler* handler, char const* args)
- {
- char const* cmd = strtok((char*)args, " ");
- if (!cmd)
- {
- handler->ShowHelpForCommand(handler->getCommandTable(), "help");
- handler->ShowHelpForCommand(handler->getCommandTable(), "");
- }
- else
- {
- if (!handler->ShowHelpForCommand(handler->getCommandTable(), cmd))
- handler->SendSysMessage(LANG_NO_HELP_CMD);
- }
-
- return true;
- }
- // move item to other slot
- static bool HandleItemMoveCommand(ChatHandler* handler, char const* args)
- {
- if (!*args)
- return false;
-
- char const* param1 = strtok((char*)args, " ");
- if (!param1)
- return false;
-
- char const* param2 = strtok(NULL, " ");
- if (!param2)
- return false;
-
- uint8 srcSlot = uint8(atoi(param1));
- uint8 dstSlot = uint8(atoi(param2));
-
- if (srcSlot == dstSlot)
- return true;
-
- if (!handler->GetSession()->GetPlayer()->IsValidPos(INVENTORY_SLOT_BAG_0, srcSlot, true))
- return false;
-
- if (!handler->GetSession()->GetPlayer()->IsValidPos(INVENTORY_SLOT_BAG_0, dstSlot, false))
- return false;
-
- uint16 src = ((INVENTORY_SLOT_BAG_0 << 8) | srcSlot);
- uint16 dst = ((INVENTORY_SLOT_BAG_0 << 8) | dstSlot);
-
- handler->GetSession()->GetPlayer()->SwapItem(src, dst);
-
- return true;
- }
-
- static bool HandleCooldownCommand(ChatHandler* handler, char const* args)
- {
- Player* target = handler->getSelectedPlayer();
- if (!target)
- {
- handler->SendSysMessage(LANG_PLAYER_NOT_FOUND);
- handler->SetSentErrorMessage(true);
- return false;
- }
-
- std::string nameLink = handler->GetNameLink(target);
-
- if (!*args)
- {
- target->RemoveAllSpellCooldown();
- handler->PSendSysMessage(LANG_REMOVEALL_COOLDOWN, nameLink.c_str());
- }
- else
- {
- // number or [name] Shift-click form |color|Hspell:spell_id|h[name]|h|r or Htalent form
- uint32 spellIid = handler->extractSpellIdFromLink((char*)args);
- if (!spellIid)
- return false;
-
- if (!sSpellMgr->GetSpellInfo(spellIid))
- {
- handler->PSendSysMessage(LANG_UNKNOWN_SPELL, target == handler->GetSession()->GetPlayer() ? handler->GetTrinityString(LANG_YOU) : nameLink.c_str());
- handler->SetSentErrorMessage(true);
- return false;
- }
-
- target->RemoveSpellCooldown(spellIid, true);
- handler->PSendSysMessage(LANG_REMOVE_COOLDOWN, spellIid, target == handler->GetSession()->GetPlayer() ? handler->GetTrinityString(LANG_YOU) : nameLink.c_str());
- }
- return true;
- }
-
- static bool HandleGetDistanceCommand(ChatHandler* handler, char const* args)
- {
- WorldObject* obj = NULL;
-
- if (*args)
- {
- uint64 guid = handler->extractGuidFromLink((char*)args);
- if (guid)
- obj = (WorldObject*)ObjectAccessor::GetObjectByTypeMask(*handler->GetSession()->GetPlayer(), guid, TYPEMASK_UNIT|TYPEMASK_GAMEOBJECT);
-
- if (!obj)
- {
- handler->SendSysMessage(LANG_PLAYER_NOT_FOUND);
- handler->SetSentErrorMessage(true);
- return false;
- }
- }
- else
- {
- obj = handler->getSelectedUnit();
-
- if (!obj)
- {
- handler->SendSysMessage(LANG_SELECT_CHAR_OR_CREATURE);
- handler->SetSentErrorMessage(true);
- return false;
- }
- }
-
- handler->PSendSysMessage(LANG_DISTANCE, handler->GetSession()->GetPlayer()->GetDistance(obj), handler->GetSession()->GetPlayer()->GetDistance2d(obj), handler->GetSession()->GetPlayer()->GetExactDist(obj), handler->GetSession()->GetPlayer()->GetExactDist2d(obj));
- return true;
- }
- // Teleport player to last position
- static bool HandleRecallCommand(ChatHandler* handler, char const* args)
- {
- Player* target;
- if (!handler->extractPlayerTarget((char*)args, &target))
- return false;
-
- // check online security
- if (handler->HasLowerSecurity(target, 0))
- return false;
-
- if (target->IsBeingTeleported())
- {
- handler->PSendSysMessage(LANG_IS_TELEPORTED, handler->GetNameLink(target).c_str());
- handler->SetSentErrorMessage(true);
- return false;
- }
-
- // stop flight if need
- if (target->isInFlight())
- {
- target->GetMotionMaster()->MovementExpired();
- target->CleanupAfterTaxiFlight();
- }
-
- target->TeleportTo(target->m_recallMap, target->m_recallX, target->m_recallY, target->m_recallZ, target->m_recallO);
- return true;
- }
-
- static bool HandleSaveCommand(ChatHandler* handler, char const* /*args*/)
- {
- Player* player = handler->GetSession()->GetPlayer();
-
- // save GM account without delay and output message
- if (!AccountMgr::IsPlayerAccount(handler->GetSession()->GetSecurity()))
- {
- if (Player* target = handler->getSelectedPlayer())
- target->SaveToDB();
- else
- player->SaveToDB();
- handler->SendSysMessage(LANG_PLAYER_SAVED);
- return true;
- }
-
- // save if the player has last been saved over 20 seconds ago
- uint32 saveInterval = sWorld->getIntConfig(CONFIG_INTERVAL_SAVE);
- if (saveInterval == 0 || (saveInterval > 20 * IN_MILLISECONDS && player->GetSaveTimer() <= saveInterval - 20 * IN_MILLISECONDS))
- player->SaveToDB();
-
- return true;
- }
-
- // Save all players in the world
- static bool HandleSaveAllCommand(ChatHandler* handler, char const* /*args*/)
- {
- sObjectAccessor->SaveAllPlayers();
- handler->SendSysMessage(LANG_PLAYERS_SAVED);
- return true;
- }
-
- // kick player
- static bool HandleKickPlayerCommand(ChatHandler* handler, char const* args)
- {
- Player* target = NULL;
- std::string playerName;
- if (!handler->extractPlayerTarget((char*)args, &target, NULL, &playerName))
- return false;
-
- if (handler->GetSession() && target == handler->GetSession()->GetPlayer())
- {
- handler->SendSysMessage(LANG_COMMAND_KICKSELF);
- handler->SetSentErrorMessage(true);
- return false;
- }
-
- // check online security
- if (handler->HasLowerSecurity(target, 0))
- return false;
-
- if (sWorld->getBoolConfig(CONFIG_SHOW_KICK_IN_WORLD))
- sWorld->SendWorldText(LANG_COMMAND_KICKMESSAGE, playerName.c_str());
- else
- handler->PSendSysMessage(LANG_COMMAND_KICKMESSAGE, playerName.c_str());
-
- target->GetSession()->KickPlayer();
-
- return true;
- }
-
- static bool HandleStartCommand(ChatHandler* handler, char const* /*args*/)
- {
- Player* player = handler->GetSession()->GetPlayer();
-
- if (player->isInFlight())
- {
- handler->SendSysMessage(LANG_YOU_IN_FLIGHT);
- handler->SetSentErrorMessage(true);
- return false;
- }
-
- if (player->isInCombat())
- {
- handler->SendSysMessage(LANG_YOU_IN_COMBAT);
- handler->SetSentErrorMessage(true);
- return false;
- }
-
- if (player->isDead() || player->HasFlag(PLAYER_FLAGS, PLAYER_FLAGS_GHOST))
- {
- // if player is dead and stuck, send ghost to graveyard
- player->RepopAtGraveyard();
- return true;
- }
-
- // cast spell Stuck
- player->CastSpell(player, 7355, false);
- return true;
- }
- // Enable on\off all taxi paths
- static bool HandleTaxiCheatCommand(ChatHandler* handler, char const* args)
- {
- if (!*args)
- {
- handler->SendSysMessage(LANG_USE_BOL);
- handler->SetSentErrorMessage(true);
- return false;
- }
-
- std::string argStr = (char*)args;
-
- Player* chr = handler->getSelectedPlayer();
-
- if (!chr)
- chr = handler->GetSession()->GetPlayer();
- else if (handler->HasLowerSecurity(chr, 0)) // check online security
- return false;
-
- if (argStr == "on")
- {
- chr->SetTaxiCheater(true);
- handler->PSendSysMessage(LANG_YOU_GIVE_TAXIS, handler->GetNameLink(chr).c_str());
- if (handler->needReportToTarget(chr))
- ChatHandler(chr).PSendSysMessage(LANG_YOURS_TAXIS_ADDED, handler->GetNameLink().c_str());
- return true;
- }
-
- if (argStr == "off")
- {
- chr->SetTaxiCheater(false);
- handler->PSendSysMessage(LANG_YOU_REMOVE_TAXIS, handler->GetNameLink(chr).c_str());
- if (handler->needReportToTarget(chr))
- ChatHandler(chr).PSendSysMessage(LANG_YOURS_TAXIS_REMOVED, handler->GetNameLink().c_str());
-
- return true;
- }
-
- handler->SendSysMessage(LANG_USE_BOL);
- handler->SetSentErrorMessage(true);
-
- return false;
- }
-
- static bool HandleLinkGraveCommand(ChatHandler* handler, char const* args)
- {
- if (!*args)
- return false;
-
- char* px = strtok((char*)args, " ");
- if (!px)
- return false;
-
- uint32 graveyardId = uint32(atoi(px));
-
- uint32 team;
-
- char* px2 = strtok(NULL, " ");
-
- if (!px2)
- team = 0;
- else if (strncmp(px2, "horde", 6) == 0)
- team = HORDE;
- else if (strncmp(px2, "alliance", 9) == 0)
- team = ALLIANCE;
- else
- return false;
-
- WorldSafeLocsEntry const* graveyard = sWorldSafeLocsStore.LookupEntry(graveyardId);
-
- if (!graveyard)
- {
- handler->PSendSysMessage(LANG_COMMAND_GRAVEYARDNOEXIST, graveyardId);
- handler->SetSentErrorMessage(true);
- return false;
- }
-
- Player* player = handler->GetSession()->GetPlayer();
-
- uint32 zoneId = player->GetZoneId();
-
- AreaTableEntry const* areaEntry = GetAreaEntryByAreaID(zoneId);
- if (!areaEntry || areaEntry->zone !=0)
- {
- handler->PSendSysMessage(LANG_COMMAND_GRAVEYARDWRONGZONE, graveyardId, zoneId);
- handler->SetSentErrorMessage(true);
- return false;
- }
-
- if (sObjectMgr->AddGraveYardLink(graveyardId, zoneId, team))
- handler->PSendSysMessage(LANG_COMMAND_GRAVEYARDLINKED, graveyardId, zoneId);
- else
- handler->PSendSysMessage(LANG_COMMAND_GRAVEYARDALRLINKED, graveyardId, zoneId);
-
- return true;
- }
-
- static bool HandleNearGraveCommand(ChatHandler* handler, char const* args)
- {
- uint32 team;
-
- size_t argStr = strlen(args);
-
- if (!*args)
- team = 0;
- else if (strncmp((char*)args, "horde", argStr) == 0)
- team = HORDE;
- else if (strncmp((char*)args, "alliance", argStr) == 0)
- team = ALLIANCE;
- else
- return false;
-
- Player* player = handler->GetSession()->GetPlayer();
- uint32 zone_id = player->GetZoneId();
-
- WorldSafeLocsEntry const* graveyard = sObjectMgr->GetClosestGraveYard(
- player->GetPositionX(), player->GetPositionY(), player->GetPositionZ(), player->GetMapId(), team);
-
- if (graveyard)
- {
- uint32 graveyardId = graveyard->ID;
-
- GraveYardData const* data = sObjectMgr->FindGraveYardData(graveyardId, zone_id);
- if (!data)
- {
- handler->PSendSysMessage(LANG_COMMAND_GRAVEYARDERROR, graveyardId);
- handler->SetSentErrorMessage(true);
- return false;
- }
-
- team = data->team;
-
- std::string team_name = handler->GetTrinityString(LANG_COMMAND_GRAVEYARD_NOTEAM);
-
- if (team == 0)
- team_name = handler->GetTrinityString(LANG_COMMAND_GRAVEYARD_ANY);
- else if (team == HORDE)
- team_name = handler->GetTrinityString(LANG_COMMAND_GRAVEYARD_HORDE);
- else if (team == ALLIANCE)
- team_name = handler->GetTrinityString(LANG_COMMAND_GRAVEYARD_ALLIANCE);
-
- handler->PSendSysMessage(LANG_COMMAND_GRAVEYARDNEAREST, graveyardId, team_name.c_str(), zone_id);
- }
- else
- {
- std::string team_name;
-
- if (team == 0)
- team_name = handler->GetTrinityString(LANG_COMMAND_GRAVEYARD_ANY);
- else if (team == HORDE)
- team_name = handler->GetTrinityString(LANG_COMMAND_GRAVEYARD_HORDE);
- else if (team == ALLIANCE)
- team_name = handler->GetTrinityString(LANG_COMMAND_GRAVEYARD_ALLIANCE);
-
- if (team == ~uint32(0))
- handler->PSendSysMessage(LANG_COMMAND_ZONENOGRAVEYARDS, zone_id);
- else
- handler->PSendSysMessage(LANG_COMMAND_ZONENOGRAFACTION, zone_id, team_name.c_str());
- }
-
- return true;
- }
-
- static bool HandleExploreCheatCommand(ChatHandler* handler, char const* args)
- {
- if (!*args)
- return false;
-
- int32 flag = int32(atoi((char*)args));
-
- Player* playerTarget = handler->getSelectedPlayer();
- if (!playerTarget)
- {
- handler->SendSysMessage(LANG_NO_CHAR_SELECTED);
- handler->SetSentErrorMessage(true);
- return false;
- }
-
- if (flag != 0)
- {
- handler->PSendSysMessage(LANG_YOU_SET_EXPLORE_ALL, handler->GetNameLink(playerTarget).c_str());
- if (handler->needReportToTarget(playerTarget))
- ChatHandler(playerTarget).PSendSysMessage(LANG_YOURS_EXPLORE_SET_ALL, handler->GetNameLink().c_str());
- }
- else
- {
- handler->PSendSysMessage(LANG_YOU_SET_EXPLORE_NOTHING, handler->GetNameLink(playerTarget).c_str());
- if (handler->needReportToTarget(playerTarget))
- ChatHandler(playerTarget).PSendSysMessage(LANG_YOURS_EXPLORE_SET_NOTHING, handler->GetNameLink().c_str());
- }
-
- for (uint8 i = 0; i < PLAYER_EXPLORED_ZONES_SIZE; ++i)
- {
- if (flag != 0)
- handler->GetSession()->GetPlayer()->SetFlag(PLAYER_EXPLORED_ZONES_1+i, 0xFFFFFFFF);
- else
- handler->GetSession()->GetPlayer()->SetFlag(PLAYER_EXPLORED_ZONES_1+i, 0);
- }
-
- return true;
- }
-
- static bool HandleShowAreaCommand(ChatHandler* handler, char const* args)
- {
- if (!*args)
- return false;
-
- Player* playerTarget = handler->getSelectedPlayer();
- if (!playerTarget)
- {
- handler->SendSysMessage(LANG_NO_CHAR_SELECTED);
- handler->SetSentErrorMessage(true);
- return false;
- }
-
- int32 area = GetAreaFlagByAreaID(atoi((char*)args));
- int32 offset = area / 32;
- uint32 val = uint32((1 << (area % 32)));
-
- if (area<0 || offset >= PLAYER_EXPLORED_ZONES_SIZE)
- {
- handler->SendSysMessage(LANG_BAD_VALUE);
- handler->SetSentErrorMessage(true);
- return false;
- }
-
- uint32 currFields = playerTarget->GetUInt32Value(PLAYER_EXPLORED_ZONES_1 + offset);
- playerTarget->SetUInt32Value(PLAYER_EXPLORED_ZONES_1 + offset, uint32((currFields | val)));
-
- handler->SendSysMessage(LANG_EXPLORE_AREA);
- return true;
- }
-
- static bool HandleHideAreaCommand(ChatHandler* handler, char const* args)
- {
- if (!*args)
- return false;
-
- Player* playerTarget = handler->getSelectedPlayer();
- if (!playerTarget)
- {
- handler->SendSysMessage(LANG_NO_CHAR_SELECTED);
- handler->SetSentErrorMessage(true);
- return false;
- }
-
- int32 area = GetAreaFlagByAreaID(atoi((char*)args));
- int32 offset = area / 32;
- uint32 val = uint32((1 << (area % 32)));
-
- if (area < 0 || offset >= PLAYER_EXPLORED_ZONES_SIZE)
- {
- handler->SendSysMessage(LANG_BAD_VALUE);
- handler->SetSentErrorMessage(true);
- return false;
- }
-
- uint32 currFields = playerTarget->GetUInt32Value(PLAYER_EXPLORED_ZONES_1 + offset);
- playerTarget->SetUInt32Value(PLAYER_EXPLORED_ZONES_1 + offset, uint32((currFields ^ val)));
-
- handler->SendSysMessage(LANG_UNEXPLORE_AREA);
- return true;
- }
-
- static bool HandleAddItemCommand(ChatHandler* handler, char const* args)
- {
- if (!*args)
- return false;
-
- uint32 itemId = 0;
-
- if (args[0] == '[') // [name] manual form
- {
- char const* itemNameStr = strtok((char*)args, "]");
-
- if (itemNameStr && itemNameStr[0])
- {
- std::string itemName = itemNameStr+1;
- WorldDatabase.EscapeString(itemName);
-
- PreparedStatement* stmt = WorldDatabase.GetPreparedStatement(WORLD_SEL_ITEM_TEMPLATE_BY_NAME);
- stmt->setString(0, itemName);
- PreparedQueryResult result = WorldDatabase.Query(stmt);
-
- if (!result)
- {
- handler->PSendSysMessage(LANG_COMMAND_COULDNOTFIND, itemNameStr+1);
- handler->SetSentErrorMessage(true);
- return false;
- }
- itemId = result->Fetch()->GetUInt32();
- }
- else
- return false;
- }
- else // item_id or [name] Shift-click form |color|Hitem:item_id:0:0:0|h[name]|h|r
- {
- char const* id = handler->extractKeyFromLink((char*)args, "Hitem");
- if (!id)
- return false;
- itemId = uint32(atol(id));
- }
-
- char const* ccount = strtok(NULL, " ");
-
- int32 count = 1;
-
- if (ccount)
- count = strtol(ccount, NULL, 10);
-
- if (count == 0)
- count = 1;
-
- Player* player = handler->GetSession()->GetPlayer();
- Player* playerTarget = handler->getSelectedPlayer();
- if (!playerTarget)
- playerTarget = player;
-
- sLog->outDebug(LOG_FILTER_GENERAL, handler->GetTrinityString(LANG_ADDITEM), itemId, count);
-
- ItemTemplate const* itemTemplate = sObjectMgr->GetItemTemplate(itemId);
- if (!itemTemplate)
- {
- handler->PSendSysMessage(LANG_COMMAND_ITEMIDINVALID, itemId);
- handler->SetSentErrorMessage(true);
- return false;
- }
-
- // Subtract
- if (count < 0)
- {
- playerTarget->DestroyItemCount(itemId, -count, true, false);
- handler->PSendSysMessage(LANG_REMOVEITEM, itemId, -count, handler->GetNameLink(playerTarget).c_str());
- return true;
- }
-
- // Adding items
- uint32 noSpaceForCount = 0;
-
- // check space and find places
- ItemPosCountVec dest;
- InventoryResult msg = playerTarget->CanStoreNewItem(NULL_BAG, NULL_SLOT, dest, itemId, count, &noSpaceForCount);
- if (msg != EQUIP_ERR_OK) // convert to possible store amount
- count -= noSpaceForCount;
-
- if (count == 0 || dest.empty()) // can't add any
- {
- handler->PSendSysMessage(LANG_ITEM_CANNOT_CREATE, itemId, noSpaceForCount);
- handler->SetSentErrorMessage(true);
- return false;
- }
-
- Item* item = playerTarget->StoreNewItem(dest, itemId, true, Item::GenerateItemRandomPropertyId(itemId));
-
- // remove binding (let GM give it to another player later)
- if (player == playerTarget)
- for (ItemPosCountVec::const_iterator itr = dest.begin(); itr != dest.end(); ++itr)
- if (Item* item1 = player->GetItemByPos(itr->pos))
- item1->SetBinding(false);
-
- if (count > 0 && item)
- {
- player->SendNewItem(item, count, false, true);
- if (player != playerTarget)
- playerTarget->SendNewItem(item, count, true, false);
- }
-
- if (noSpaceForCount > 0)
- handler->PSendSysMessage(LANG_ITEM_CANNOT_CREATE, itemId, noSpaceForCount);
-
- return true;
- }
-
- static bool HandleAddItemSetCommand(ChatHandler* handler, char const* args)
- {
- if (!*args)
- return false;
-
- char const* id = handler->extractKeyFromLink((char*)args, "Hitemset"); // number or [name] Shift-click form |color|Hitemset:itemset_id|h[name]|h|r
- if (!id)
- return false;
-
- uint32 itemSetId = atol(id);
-
- // prevent generation all items with itemset field value '0'
- if (itemSetId == 0)
- {
- handler->PSendSysMessage(LANG_NO_ITEMS_FROM_ITEMSET_FOUND, itemSetId);
- handler->SetSentErrorMessage(true);
- return false;
- }
-
- Player* player = handler->GetSession()->GetPlayer();
- Player* playerTarget = handler->getSelectedPlayer();
- if (!playerTarget)
- playerTarget = player;
-
- sLog->outDebug(LOG_FILTER_GENERAL, handler->GetTrinityString(LANG_ADDITEMSET), itemSetId);
-
- bool found = false;
- ItemTemplateContainer const* its = sObjectMgr->GetItemTemplateStore();
- for (ItemTemplateContainer::const_iterator itr = its->begin(); itr != its->end(); ++itr)
- {
- if (itr->second.ItemSet == itemSetId)
- {
- found = true;
- ItemPosCountVec dest;
- InventoryResult msg = playerTarget->CanStoreNewItem(NULL_BAG, NULL_SLOT, dest, itr->second.ItemId, 1);
- if (msg == EQUIP_ERR_OK)
- {
- Item* item = playerTarget->StoreNewItem(dest, itr->second.ItemId, true);
-
- // remove binding (let GM give it to another player later)
- if (player == playerTarget)
- item->SetBinding(false);
-
- player->SendNewItem(item, 1, false, true);
- if (player != playerTarget)
- playerTarget->SendNewItem(item, 1, true, false);
- }
- else
- {
- player->SendEquipError(msg, NULL, NULL, itr->second.ItemId);
- handler->PSendSysMessage(LANG_ITEM_CANNOT_CREATE, itr->second.ItemId, 1);
- }
- }
- }
-
- if (!found)
- {
- handler->PSendSysMessage(LANG_NO_ITEMS_FROM_ITEMSET_FOUND, itemSetId);
- handler->SetSentErrorMessage(true);
- return false;
- }
-
- return true;
- }
-
- static bool HandleBankCommand(ChatHandler* handler, char const* /*args*/)
- {
- handler->GetSession()->SendShowBank(handler->GetSession()->GetPlayer()->GetGUID());
- return true;
- }
-
- static bool HandleChangeWeather(ChatHandler* handler, char const* args)
- {
- if (!*args)
- return false;
-
- // Weather is OFF
- if (!sWorld->getBoolConfig(CONFIG_WEATHER))
- {
- handler->SendSysMessage(LANG_WEATHER_DISABLED);
- handler->SetSentErrorMessage(true);
- return false;
- }
-
- // *Change the weather of a cell
- char const* px = strtok((char*)args, " ");
- char const* py = strtok(NULL, " ");
-
- if (!px || !py)
- return false;
-
- uint32 type = uint32(atoi(px)); //0 to 3, 0: fine, 1: rain, 2: snow, 3: sand
- float grade = float(atof(py)); //0 to 1, sending -1 is instand good weather
-
- Player* player = handler->GetSession()->GetPlayer();
- uint32 zoneid = player->GetZoneId();
-
- Weather* weather = WeatherMgr::FindWeather(zoneid);
-
- if (!weather)
- weather = WeatherMgr::AddWeather(zoneid);
- if (!weather)
- {
- handler->SendSysMessage(LANG_NO_WEATHER);
- handler->SetSentErrorMessage(true);
- return false;
- }
-
- weather->SetWeather(WeatherType(type), grade);
-
- return true;
- }
-
-
- static bool HandleMaxSkillCommand(ChatHandler* handler, char const* /*args*/)
- {
- Player* SelectedPlayer = handler->getSelectedPlayer();
- if (!SelectedPlayer)
- {
- handler->SendSysMessage(LANG_NO_CHAR_SELECTED);
- handler->SetSentErrorMessage(true);
- return false;
- }
-
- // each skills that have max skill value dependent from level seted to current level max skill value
- SelectedPlayer->UpdateSkillsToMaxSkillsForLevel();
- return true;
- }
-
- static bool HandleSetSkillCommand(ChatHandler* handler, char const* args)
- {
- // number or [name] Shift-click form |color|Hskill:skill_id|h[name]|h|r
- char const* skillStr = handler->extractKeyFromLink((char*)args, "Hskill");
- if (!skillStr)
- return false;
-
- char const* levelStr = strtok(NULL, " ");
- if (!levelStr)
- return false;
-
- char const* maxPureSkill = strtok(NULL, " ");
-
- int32 skill = atoi(skillStr);
- if (skill <= 0)
- {
- handler->PSendSysMessage(LANG_INVALID_SKILL_ID, skill);
- handler->SetSentErrorMessage(true);
- return false;
- }
-
- int32 level = uint32(atol(levelStr));
-
- Player* target = handler->getSelectedPlayer();
- if (!target)
- {
- handler->SendSysMessage(LANG_NO_CHAR_SELECTED);
- handler->SetSentErrorMessage(true);
- return false;
- }
-
- SkillLineEntry const* skillLine = sSkillLineStore.LookupEntry(skill);
- if (!skillLine)
- {
- handler->PSendSysMessage(LANG_INVALID_SKILL_ID, skill);
- handler->SetSentErrorMessage(true);
- return false;
- }
-
- std::string tNameLink = handler->GetNameLink(target);
-
- if (!target->GetSkillValue(skill))
- {
- handler->PSendSysMessage(LANG_SET_SKILL_ERROR, tNameLink.c_str(), skill, skillLine->name[handler->GetSessionDbcLocale()]);
- handler->SetSentErrorMessage(true);
- return false;
- }
-
- uint16 max = maxPureSkill ? atol (maxPureSkill) : target->GetPureMaxSkillValue(skill);
-
- if (level <= 0 || level > max || max <= 0)
- return false;
-
- target->SetSkill(skill, target->GetSkillStep(skill), level, max);
- handler->PSendSysMessage(LANG_SET_SKILL, skill, skillLine->name[handler->GetSessionDbcLocale()], tNameLink.c_str(), level, max);
-
- return true;
- }
- // show info of player
- static bool HandlePInfoCommand(ChatHandler* handler, char const* args)
- {
- Player* target;
- uint64 targetGuid;
- std::string targetName;
-
- uint32 parseGUID = MAKE_NEW_GUID(atol((char*)args), 0, HIGHGUID_PLAYER);
-
- if (sObjectMgr->GetPlayerNameByGUID(parseGUID, targetName))
- {
- target = sObjectMgr->GetPlayerByLowGUID(parseGUID);
- targetGuid = parseGUID;
- }
- else if (!handler->extractPlayerTarget((char*)args, &target, &targetGuid, &targetName))
- return false;
-
- uint32 accId = 0;
- uint32 money = 0;
- uint32 totalPlayerTime = 0;
- uint8 level = 0;
- uint32 latency = 0;
- uint8 race;
- uint8 Class;
- int64 muteTime = 0;
- int64 banTime = -1;
- uint32 mapId;
- uint32 areaId;
- uint32 phase = 0;
-
- // get additional information from Player object
- if (target)
- {
- // check online security
- if (handler->HasLowerSecurity(target, 0))
- return false;
-
- accId = target->GetSession()->GetAccountId();
- money = target->GetMoney();
- totalPlayerTime = target->GetTotalPlayedTime();
- level = target->getLevel();
- latency = target->GetSession()->GetLatency();
- race = target->getRace();
- Class = target->getClass();
- muteTime = target->GetSession()->m_muteTime;
- mapId = target->GetMapId();
- areaId = target->GetAreaId();
- phase = target->GetPhaseMask();
- }
- // get additional information from DB
- else
- {
- // check offline security
- if (handler->HasLowerSecurity(NULL, targetGuid))
- return false;
-
- PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_CHAR_PINFO);
- stmt->setUInt32(0, GUID_LOPART(targetGuid));
- PreparedQueryResult result = CharacterDatabase.Query(stmt);
-
- if (!result)
- return false;
-
- Field* fields = result->Fetch();
- totalPlayerTime = fields[0].GetUInt32();
- level = fields[1].GetUInt8();
- money = fields[2].GetUInt32();
- accId = fields[3].GetUInt32();
- race = fields[4].GetUInt8();
- Class = fields[5].GetUInt8();
- mapId = fields[6].GetUInt16();
- areaId = fields[7].GetUInt16();
- }
-
- std::string userName = handler->GetTrinityString(LANG_ERROR);
- std::string eMail = handler->GetTrinityString(LANG_ERROR);
- std::string lastIp = handler->GetTrinityString(LANG_ERROR);
- uint32 security = 0;
- std::string lastLogin = handler->GetTrinityString(LANG_ERROR);
-
- PreparedStatement* stmt = LoginDatabase.GetPreparedStatement(LOGIN_SEL_PINFO);
- stmt->setInt32(0, int32(realmID));
- stmt->setUInt32(1, accId);
- PreparedQueryResult result = LoginDatabase.Query(stmt);
-
- if (result)
- {
- Field* fields = result->Fetch();
- userName = fields[0].GetString();
- security = fields[1].GetUInt8();
- eMail = fields[2].GetString();
- muteTime = fields[5].GetUInt64();
-
- if (eMail.empty())
- eMail = "-";
-
- if (!handler->GetSession() || handler->GetSession()->GetSecurity() >= AccountTypes(security))
- {
- lastIp = fields[3].GetString();
- lastLogin = fields[4].GetString();
-
- uint32 ip = inet_addr(lastIp.c_str());
-#if TRINITY_ENDIAN == BIGENDIAN
- EndianConvertReverse(ip);
-#endif
-
- PreparedStatement* stmt = WorldDatabase.GetPreparedStatement(WORLD_SEL_IP2NATION_COUNTRY);
-
- stmt->setUInt32(0, ip);
-
- PreparedQueryResult result2 = WorldDatabase.Query(stmt);
-
- if (result2)
- {
- Field* fields2 = result2->Fetch();
- lastIp.append(" (");
- lastIp.append(fields2[0].GetString());
- lastIp.append(")");
- }
- }
- else
- {
- lastIp = "-";
- lastLogin = "-";
- }
- }
-
- std::string nameLink = handler->playerLink(targetName);
-
- handler->PSendSysMessage(LANG_PINFO_ACCOUNT, (target ? "" : handler->GetTrinityString(LANG_OFFLINE)), nameLink.c_str(), GUID_LOPART(targetGuid), userName.c_str(), accId, eMail.c_str(), security, lastIp.c_str(), lastLogin.c_str(), latency);
-
- std::string bannedby = "unknown";
- std::string banreason = "";
-
- stmt = LoginDatabase.GetPreparedStatement(LOGIN_SEL_PINFO_BANS);
- stmt->setUInt32(0, accId);
- PreparedQueryResult result2 = LoginDatabase.Query(stmt);
- if (!result2)
- {
- stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_PINFO_BANS);
- stmt->setUInt32(0, GUID_LOPART(targetGuid));
- result2 = CharacterDatabase.Query(stmt);
- }
-
- if (result2)
- {
- Field* fields = result2->Fetch();
- banTime = int64(fields[1].GetBool() ? 0 : fields[0].GetUInt32());
- bannedby = fields[2].GetString();
- banreason = fields[3].GetString();
- }
-
- if (muteTime > 0)
- handler->PSendSysMessage(LANG_PINFO_MUTE, secsToTimeString(muteTime - time(NULL), true).c_str());
-
- if (banTime >= 0)
- handler->PSendSysMessage(LANG_PINFO_BAN, banTime > 0 ? secsToTimeString(banTime - time(NULL), true).c_str() : "permanently", bannedby.c_str(), banreason.c_str());
-
- std::string raceStr, ClassStr;
- switch (race)
- {
- case RACE_HUMAN:
- raceStr = "Human";
- break;
- case RACE_ORC:
- raceStr = "Orc";
- break;
- case RACE_DWARF:
- raceStr = "Dwarf";
- break;
- case RACE_NIGHTELF:
- raceStr = "Night Elf";
- break;
- case RACE_UNDEAD_PLAYER:
- raceStr = "Undead";
- break;
- case RACE_TAUREN:
- raceStr = "Tauren";
- break;
- case RACE_GNOME:
- raceStr = "Gnome";
- break;
- case RACE_TROLL:
- raceStr = "Troll";
- break;
- case RACE_BLOODELF:
- raceStr = "Blood Elf";
- break;
- case RACE_DRAENEI:
- raceStr = "Draenei";
- break;
- }
-
- switch (Class)
- {
- case CLASS_WARRIOR:
- ClassStr = "Warrior";
- break;
- case CLASS_PALADIN:
- ClassStr = "Paladin";
- break;
- case CLASS_HUNTER:
- ClassStr = "Hunter";
- break;
- case CLASS_ROGUE:
- ClassStr = "Rogue";
- break;
- case CLASS_PRIEST:
- ClassStr = "Priest";
- break;
- case CLASS_DEATH_KNIGHT:
- ClassStr = "Death Knight";
- break;
- case CLASS_SHAMAN:
- ClassStr = "Shaman";
- break;
- case CLASS_MAGE:
- ClassStr = "Mage";
- break;
- case CLASS_WARLOCK:
- ClassStr = "Warlock";
- break;
- case CLASS_DRUID:
- ClassStr = "Druid";
- break;
- }
-
- std::string timeStr = secsToTimeString(totalPlayerTime, true, true);
- uint32 gold = money /GOLD;
- uint32 silv = (money % GOLD) / SILVER;
- uint32 copp = (money % GOLD) % SILVER;
- handler->PSendSysMessage(LANG_PINFO_LEVEL, raceStr.c_str(), ClassStr.c_str(), timeStr.c_str(), level, gold, silv, copp);
-
- // Add map, zone, subzone and phase to output
- int locale = handler->GetSessionDbcLocale();
- std::string areaName = "<unknown>";
- std::string zoneName = "";
-
- MapEntry const* map = sMapStore.LookupEntry(mapId);
-
- AreaTableEntry const* area = GetAreaEntryByAreaID(areaId);
- if (area)
- {
- areaName = area->area_name[locale];
-
- AreaTableEntry const* zone = GetAreaEntryByAreaID(area->zone);
- if (zone)
- zoneName = zone->area_name[locale];
- }
-
- if (target)
- {
- if (!zoneName.empty())
- handler->PSendSysMessage(LANG_PINFO_MAP_ONLINE, map->name[locale], zoneName.c_str(), areaName.c_str(), phase);
- else
- handler->PSendSysMessage(LANG_PINFO_MAP_ONLINE, map->name[locale], areaName.c_str(), "<unknown>", phase);
- }
- else
- handler->PSendSysMessage(LANG_PINFO_MAP_OFFLINE, map->name[locale], areaName.c_str());
-
- return true;
- }
-
- static bool HandleRespawnCommand(ChatHandler* handler, char const* /*args*/)
- {
- Player* player = handler->GetSession()->GetPlayer();
-
- // accept only explicitly selected target (not implicitly self targeting case)
- Unit* target = handler->getSelectedUnit();
- if (player->GetSelection() && target)
- {
- if (target->GetTypeId() != TYPEID_UNIT || target->isPet())
- {
- handler->SendSysMessage(LANG_SELECT_CREATURE);
- handler->SetSentErrorMessage(true);
- return false;
- }
-
- if (target->isDead())
- target->ToCreature()->Respawn();
- return true;
- }
-
- CellCoord p(Trinity::ComputeCellCoord(player->GetPositionX(), player->GetPositionY()));
- Cell cell(p);
- cell.SetNoCreate();
-
- Trinity::RespawnDo u_do;
- Trinity::WorldObjectWorker<Trinity::RespawnDo> worker(player, u_do);
-
- TypeContainerVisitor<Trinity::WorldObjectWorker<Trinity::RespawnDo>, GridTypeMapContainer > obj_worker(worker);
- cell.Visit(p, obj_worker, *player->GetMap(), *player, player->GetGridActivationRange());
-
- return true;
- }
- // mute player for some times
- static bool HandleMuteCommand(ChatHandler* handler, char const* args)
- {
- char* nameStr;
- char* delayStr;
- handler->extractOptFirstArg((char*)args, &nameStr, &delayStr);
- if (!delayStr)
- return false;
-
- char const* muteReason = strtok(NULL, "\r");
- std::string muteReasonStr = "No reason";
- if (muteReason != NULL)
- muteReasonStr = muteReason;
-
- Player* target;
- uint64 targetGuid;
- std::string targetName;
- if (!handler->extractPlayerTarget(nameStr, &target, &targetGuid, &targetName))
- return false;
-
- uint32 accountId = target ? target->GetSession()->GetAccountId() : sObjectMgr->GetPlayerAccountIdByGUID(targetGuid);
-
- // find only player from same account if any
- if (!target)
- if (WorldSession* session = sWorld->FindSession(accountId))
- target = session->GetPlayer();
-
- uint32 notSpeakTime = uint32(atoi(delayStr));
-
- // must have strong lesser security level
- if (handler->HasLowerSecurity (target, targetGuid, true))
- return false;
-
- PreparedStatement* stmt = LoginDatabase.GetPreparedStatement(LOGIN_UPD_MUTE_TIME);
-
- if (target)
- {
- // Target is online, mute will be in effect right away.
- int64 muteTime = time(NULL) + notSpeakTime * MINUTE;
- target->GetSession()->m_muteTime = muteTime;
- stmt->setInt64(0, muteTime);
- ChatHandler(target).PSendSysMessage(LANG_YOUR_CHAT_DISABLED, notSpeakTime, muteReasonStr.c_str());
- }
- else
- {
- // Target is offline, mute will be in effect starting from the next login.
- int32 muteTime = -int32(notSpeakTime * MINUTE);
- stmt->setInt64(0, muteTime);
- }
-
- stmt->setUInt32(1, accountId);
- LoginDatabase.Execute(stmt);
- std::string nameLink = handler->playerLink(targetName);
-
- handler->PSendSysMessage(target ? LANG_YOU_DISABLE_CHAT : LANG_COMMAND_DISABLE_CHAT_DELAYED, nameLink.c_str(), notSpeakTime, muteReasonStr.c_str());
-
- return true;
- }
-
- // unmute player
- static bool HandleUnmuteCommand(ChatHandler* handler, char const* args)
- {
- Player* target;
- uint64 targetGuid;
- std::string targetName;
- if (!handler->extractPlayerTarget((char*)args, &target, &targetGuid, &targetName))
- return false;
-
- uint32 accountId = target ? target->GetSession()->GetAccountId() : sObjectMgr->GetPlayerAccountIdByGUID(targetGuid);
-
- // find only player from same account if any
- if (!target)
- if (WorldSession* session = sWorld->FindSession(accountId))
- target = session->GetPlayer();
-
- // must have strong lesser security level
- if (handler->HasLowerSecurity (target, targetGuid, true))
- return false;
-
- if (target)
- {
- if (target->CanSpeak())
- {
- handler->SendSysMessage(LANG_CHAT_ALREADY_ENABLED);
- handler->SetSentErrorMessage(true);
- return false;
- }
-
- target->GetSession()->m_muteTime = 0;
- }
-
- PreparedStatement* stmt = LoginDatabase.GetPreparedStatement(LOGIN_UPD_MUTE_TIME);
- stmt->setInt64(0, 0);
- stmt->setUInt32(1, accountId);
- LoginDatabase.Execute(stmt);
-
- if (target)
- ChatHandler(target).PSendSysMessage(LANG_YOUR_CHAT_ENABLED);
-
- std::string nameLink = handler->playerLink(targetName);
-
- handler->PSendSysMessage(LANG_YOU_ENABLE_CHAT, nameLink.c_str());
-
- return true;
- }
-
-
- static bool HandleMovegensCommand(ChatHandler* handler, char const* /*args*/)
- {
- Unit* unit = handler->getSelectedUnit();
- if (!unit)
- {
- handler->SendSysMessage(LANG_SELECT_CHAR_OR_CREATURE);
- handler->SetSentErrorMessage(true);
- return false;
- }
-
- handler->PSendSysMessage(LANG_MOVEGENS_LIST, (unit->GetTypeId() == TYPEID_PLAYER ? "Player" : "Creature"), unit->GetGUIDLow());
-
- MotionMaster* motionMaster = unit->GetMotionMaster();
- float x, y, z;
- motionMaster->GetDestination(x, y, z);
-
- for (uint8 i = 0; i < MAX_MOTION_SLOT; ++i)
- {
- MovementGenerator* movementGenerator = motionMaster->GetMotionSlot(i);
- if (!movementGenerator)
- {
- handler->SendSysMessage("Empty");
- continue;
- }
-
- switch (movementGenerator->GetMovementGeneratorType())
- {
- case IDLE_MOTION_TYPE:
- handler->SendSysMessage(LANG_MOVEGENS_IDLE);
- break;
- case RANDOM_MOTION_TYPE:
- handler->SendSysMessage(LANG_MOVEGENS_RANDOM);
- break;
- case WAYPOINT_MOTION_TYPE:
- handler->SendSysMessage(LANG_MOVEGENS_WAYPOINT);
- break;
- case ANIMAL_RANDOM_MOTION_TYPE:
- handler->SendSysMessage(LANG_MOVEGENS_ANIMAL_RANDOM);
- break;
- case CONFUSED_MOTION_TYPE:
- handler->SendSysMessage(LANG_MOVEGENS_CONFUSED);
- break;
- case CHASE_MOTION_TYPE:
- {
- Unit* target = NULL;
- if (unit->GetTypeId() == TYPEID_PLAYER)
- target = static_cast<ChaseMovementGenerator<Player> const*>(movementGenerator)->GetTarget();
- else
- target = static_cast<ChaseMovementGenerator<Creature> const*>(movementGenerator)->GetTarget();
-
- if (!target)
- handler->SendSysMessage(LANG_MOVEGENS_CHASE_NULL);
- else if (target->GetTypeId() == TYPEID_PLAYER)
- handler->PSendSysMessage(LANG_MOVEGENS_CHASE_PLAYER, target->GetName(), target->GetGUIDLow());
- else
- handler->PSendSysMessage(LANG_MOVEGENS_CHASE_CREATURE, target->GetName(), target->GetGUIDLow());
- break;
- }
- case FOLLOW_MOTION_TYPE:
- {
- Unit* target = NULL;
- if (unit->GetTypeId() == TYPEID_PLAYER)
- target = static_cast<FollowMovementGenerator<Player> const*>(movementGenerator)->GetTarget();
- else
- target = static_cast<FollowMovementGenerator<Creature> const*>(movementGenerator)->GetTarget();
-
- if (!target)
- handler->SendSysMessage(LANG_MOVEGENS_FOLLOW_NULL);
- else if (target->GetTypeId() == TYPEID_PLAYER)
- handler->PSendSysMessage(LANG_MOVEGENS_FOLLOW_PLAYER, target->GetName(), target->GetGUIDLow());
- else
- handler->PSendSysMessage(LANG_MOVEGENS_FOLLOW_CREATURE, target->GetName(), target->GetGUIDLow());
- break;
- }
- case HOME_MOTION_TYPE:
- {
- if (unit->GetTypeId() == TYPEID_UNIT)
- handler->PSendSysMessage(LANG_MOVEGENS_HOME_CREATURE, x, y, z);
- else
- handler->SendSysMessage(LANG_MOVEGENS_HOME_PLAYER);
- break;
- }
- case FLIGHT_MOTION_TYPE:
- handler->SendSysMessage(LANG_MOVEGENS_FLIGHT);
- break;
- case POINT_MOTION_TYPE:
- {
- handler->PSendSysMessage(LANG_MOVEGENS_POINT, x, y, z);
- break;
- }
- case FLEEING_MOTION_TYPE:
- handler->SendSysMessage(LANG_MOVEGENS_FEAR);
- break;
- case DISTRACT_MOTION_TYPE:
- handler->SendSysMessage(LANG_MOVEGENS_DISTRACT);
- break;
- case EFFECT_MOTION_TYPE:
- handler->SendSysMessage(LANG_MOVEGENS_EFFECT);
- break;
- default:
- handler->PSendSysMessage(LANG_MOVEGENS_UNKNOWN, movementGenerator->GetMovementGeneratorType());
- break;
- }
- }
- return true;
- }
- /*
- ComeToMe command REQUIRED for 3rd party scripting library to have access to PointMovementGenerator
- Without this function 3rd party scripting library will get linking errors (unresolved external)
- when attempting to use the PointMovementGenerator
- */
- static bool HandleComeToMeCommand(ChatHandler* handler, char const* args)
- {
- char const* newFlagStr = strtok((char*)args, " ");
- if (!newFlagStr)
- return false;
-
- Creature* caster = handler->getSelectedCreature();
- if (!caster)
- {
- handler->SendSysMessage(LANG_SELECT_CREATURE);
- handler->SetSentErrorMessage(true);
- return false;
- }
-
- Player* player = handler->GetSession()->GetPlayer();
-
- caster->GetMotionMaster()->MovePoint(0, player->GetPositionX(), player->GetPositionY(), player->GetPositionZ());
-
- return true;
- }
-
- static bool HandleDamageCommand(ChatHandler* handler, char const* args)
- {
- if (!*args)
- return false;
-
- Unit* target = handler->getSelectedUnit();
- if (!target || !handler->GetSession()->GetPlayer()->GetSelection())
- {
- handler->SendSysMessage(LANG_SELECT_CHAR_OR_CREATURE);
- handler->SetSentErrorMessage(true);
- return false;
- }
-
- if (target->GetTypeId() == TYPEID_PLAYER)
- {
- if (handler->HasLowerSecurity((Player*)target, 0, false))
- return false;
- }
-
- if (!target->isAlive())
- return true;
-
- char* damageStr = strtok((char*)args, " ");
- if (!damageStr)
- return false;
-
- int32 damage_int = atoi((char*)damageStr);
- if (damage_int <= 0)
- return true;
-
- uint32 damage = damage_int;
-
- char* schoolStr = strtok((char*)NULL, " ");
-
- // flat melee damage without resistence/etc reduction
- if (!schoolStr)
- {
- handler->GetSession()->GetPlayer()->DealDamage(target, damage, NULL, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, NULL, false);
- if (target != handler->GetSession()->GetPlayer())
- handler->GetSession()->GetPlayer()->SendAttackStateUpdate (HITINFO_AFFECTS_VICTIM, target, 1, SPELL_SCHOOL_MASK_NORMAL, damage, 0, 0, VICTIMSTATE_HIT, 0);
- return true;
- }
-
- uint32 school = schoolStr ? atoi((char*)schoolStr) : SPELL_SCHOOL_NORMAL;
- if (school >= MAX_SPELL_SCHOOL)
- return false;
-
- SpellSchoolMask schoolmask = SpellSchoolMask(1 << school);
-
- if (Unit::IsDamageReducedByArmor(schoolmask))
- damage = handler->GetSession()->GetPlayer()->CalcArmorReducedDamage(target, damage, NULL, BASE_ATTACK);
-
- char* spellStr = strtok((char*)NULL, " ");
-
- // melee damage by specific school
- if (!spellStr)
- {
- uint32 absorb = 0;
- uint32 resist = 0;
-
- handler->GetSession()->GetPlayer()->CalcAbsorbResist(target, schoolmask, SPELL_DIRECT_DAMAGE, damage, &absorb, &resist);
-
- if (damage <= absorb + resist)
- return true;
-
- damage -= absorb + resist;
-
- handler->GetSession()->GetPlayer()->DealDamageMods(target, damage, &absorb);
- handler->GetSession()->GetPlayer()->DealDamage(target, damage, NULL, DIRECT_DAMAGE, schoolmask, NULL, false);
- handler->GetSession()->GetPlayer()->SendAttackStateUpdate (HITINFO_AFFECTS_VICTIM, target, 1, schoolmask, damage, absorb, resist, VICTIMSTATE_HIT, 0);
- return true;
- }
-
- // non-melee damage
-
- // number or [name] Shift-click form |color|Hspell:spell_id|h[name]|h|r or Htalent form
- uint32 spellid = handler->extractSpellIdFromLink((char*)args);
- if (!spellid || !sSpellMgr->GetSpellInfo(spellid))
- return false;
-
- handler->GetSession()->GetPlayer()->SpellNonMeleeDamageLog(target, spellid, damage);
- return true;
- }
-
- static bool HandleCombatStopCommand(ChatHandler* handler, char const* args)
- {
- Player* target = NULL;
-
- if (args && strlen(args) > 0)
- {
- target = sObjectAccessor->FindPlayerByName(args);
- if (!target)
- {
- handler->SendSysMessage(LANG_PLAYER_NOT_FOUND);
- handler->SetSentErrorMessage(true);
- return false;
- }
- }
-
- if (!target)
- {
- if (!handler->extractPlayerTarget((char*)args, &target))
- return false;
- }
-
- // check online security
- if (handler->HasLowerSecurity(target, 0))
- return false;
-
- target->CombatStop();
- target->getHostileRefManager().deleteReferences();
- return true;
- }
-
- static bool HandleFlushArenaPointsCommand(ChatHandler* /*handler*/, char const* /*args*/)
- {
- sArenaTeamMgr->DistributeArenaPoints();
- return true;
- }
-
- static bool HandleRepairitemsCommand(ChatHandler* handler, char const* args)
- {
- Player* target;
- if (!handler->extractPlayerTarget((char*)args, &target))
- return false;
-
- // check online security
- if (handler->HasLowerSecurity(target, 0))
- return false;
-
- // Repair items
- target->DurabilityRepairAll(false, 0, false);
-
- handler->PSendSysMessage(LANG_YOU_REPAIR_ITEMS, handler->GetNameLink(target).c_str());
- if (handler->needReportToTarget(target))
- ChatHandler(target).PSendSysMessage(LANG_YOUR_ITEMS_REPAIRED, handler->GetNameLink().c_str());
-
- return true;
- }
-
- static bool HandleWaterwalkCommand(ChatHandler* handler, char const* args)
- {
- if (!*args)
- return false;
-
- Player* player = handler->getSelectedPlayer();
- if (!player)
- {
- handler->PSendSysMessage(LANG_NO_CHAR_SELECTED);
- handler->SetSentErrorMessage(true);
- return false;
- }
-
- // check online security
- if (handler->HasLowerSecurity(player, 0))
- return false;
-
- if (strncmp(args, "on", 3) == 0)
- player->SetMovement(MOVE_WATER_WALK); // ON
- else if (strncmp(args, "off", 4) == 0)
- player->SetMovement(MOVE_LAND_WALK); // OFF
- else
- {
- handler->SendSysMessage(LANG_USE_BOL);
- return false;
- }
-
- handler->PSendSysMessage(LANG_YOU_SET_WATERWALK, args, handler->GetNameLink(player).c_str());
- if (handler->needReportToTarget(player))
- ChatHandler(player).PSendSysMessage(LANG_YOUR_WATERWALK_SET, args, handler->GetNameLink().c_str());
- return true;
- }
-
- // Send mail by command
- static bool HandleSendMailCommand(ChatHandler* handler, char const* args)
- {
- // format: name "subject text" "mail text"
- Player* target;
- uint64 targetGuid;
- std::string targetName;
- if (!handler->extractPlayerTarget((char*)args, &target, &targetGuid, &targetName))
- return false;
-
- char* tail1 = strtok(NULL, "");
- if (!tail1)
- return false;
-
- char const* msgSubject = handler->extractQuotedArg(tail1);
- if (!msgSubject)
- return false;
-
- char* tail2 = strtok(NULL, "");
- if (!tail2)
- return false;
-
- char const* msgText = handler->extractQuotedArg(tail2);
- if (!msgText)
- return false;
-
- // msgSubject, msgText isn't NUL after prev. check
- std::string subject = msgSubject;
- std::string text = msgText;
-
- // from console show not existed sender
- MailSender sender(MAIL_NORMAL, handler->GetSession() ? handler->GetSession()->GetPlayer()->GetGUIDLow() : 0, MAIL_STATIONERY_GM);
-
- //- TODO: Fix poor design
- SQLTransaction trans = CharacterDatabase.BeginTransaction();
- MailDraft(subject, text)
- .SendMailTo(trans, MailReceiver(target, GUID_LOPART(targetGuid)), sender);
-
- CharacterDatabase.CommitTransaction(trans);
-
- std::string nameLink = handler->playerLink(targetName);
- handler->PSendSysMessage(LANG_MAIL_SENT, nameLink.c_str());
- return true;
- }
- // Send items by mail
- static bool HandleSendItemsCommand(ChatHandler* handler, char const* args)
- {
- // format: name "subject text" "mail text" item1[:count1] item2[:count2] ... item12[:count12]
- Player* receiver;
- uint64 receiverGuid;
- std::string receiverName;
- if (!handler->extractPlayerTarget((char*)args, &receiver, &receiverGuid, &receiverName))
- return false;
-
- char* tail1 = strtok(NULL, "");
- if (!tail1)
- return false;
-
- char const* msgSubject = handler->extractQuotedArg(tail1);
- if (!msgSubject)
- return false;
-
- char* tail2 = strtok(NULL, "");
- if (!tail2)
- return false;
-
- char const* msgText = handler->extractQuotedArg(tail2);
- if (!msgText)
- return false;
-
- // msgSubject, msgText isn't NUL after prev. check
- std::string subject = msgSubject;
- std::string text = msgText;
-
- // extract items
- typedef std::pair<uint32, uint32> ItemPair;
- typedef std::list< ItemPair > ItemPairs;
- ItemPairs items;
-
- // get all tail string
- char* tail = strtok(NULL, "");
-
- // get from tail next item str
- while (char* itemStr = strtok(tail, " "))
- {
- // and get new tail
- tail = strtok(NULL, "");
-
- // parse item str
- char const* itemIdStr = strtok(itemStr, ":");
- char const* itemCountStr = strtok(NULL, " ");
-
- uint32 itemId = atoi(itemIdStr);
- if (!itemId)
- return false;
-
- ItemTemplate const* item_proto = sObjectMgr->GetItemTemplate(itemId);
- if (!item_proto)
- {
- handler->PSendSysMessage(LANG_COMMAND_ITEMIDINVALID, itemId);
- handler->SetSentErrorMessage(true);
- return false;
- }
-
- uint32 itemCount = itemCountStr ? atoi(itemCountStr) : 1;
- if (itemCount < 1 || (item_proto->MaxCount > 0 && itemCount > uint32(item_proto->MaxCount)))
- {
- handler->PSendSysMessage(LANG_COMMAND_INVALID_ITEM_COUNT, itemCount, itemId);
- handler->SetSentErrorMessage(true);
- return false;
- }
-
- while (itemCount > item_proto->GetMaxStackSize())
- {
- items.push_back(ItemPair(itemId, item_proto->GetMaxStackSize()));
- itemCount -= item_proto->GetMaxStackSize();
- }
-
- items.push_back(ItemPair(itemId, itemCount));
-
- if (items.size() > MAX_MAIL_ITEMS)
- {
- handler->PSendSysMessage(LANG_COMMAND_MAIL_ITEMS_LIMIT, MAX_MAIL_ITEMS);
- handler->SetSentErrorMessage(true);
- return false;
- }
- }
-
- // from console show not existed sender
- MailSender sender(MAIL_NORMAL, handler->GetSession() ? handler->GetSession()->GetPlayer()->GetGUIDLow() : 0, MAIL_STATIONERY_GM);
-
- // fill mail
- MailDraft draft(subject, text);
-
- SQLTransaction trans = CharacterDatabase.BeginTransaction();
-
- for (ItemPairs::const_iterator itr = items.begin(); itr != items.end(); ++itr)
- {
- if (Item* item = Item::CreateItem(itr->first, itr->second, handler->GetSession() ? handler->GetSession()->GetPlayer() : 0))
- {
- item->SaveToDB(trans); // save for prevent lost at next mail load, if send fail then item will deleted
- draft.AddItem(item);
- }
- }
-
- draft.SendMailTo(trans, MailReceiver(receiver, GUID_LOPART(receiverGuid)), sender);
- CharacterDatabase.CommitTransaction(trans);
-
- std::string nameLink = handler->playerLink(receiverName);
- handler->PSendSysMessage(LANG_MAIL_SENT, nameLink.c_str());
- return true;
- }
- /// Send money by mail
- static bool HandleSendMoneyCommand(ChatHandler* handler, char const* args)
- {
- /// format: name "subject text" "mail text" money
-
- Player* receiver;
- uint64 receiverGuid;
- std::string receiverName;
- if (!handler->extractPlayerTarget((char*)args, &receiver, &receiverGuid, &receiverName))
- return false;
-
- char* tail1 = strtok(NULL, "");
- if (!tail1)
- return false;
-
- char* msgSubject = handler->extractQuotedArg(tail1);
- if (!msgSubject)
- return false;
-
- char* tail2 = strtok(NULL, "");
- if (!tail2)
- return false;
-
- char* msgText = handler->extractQuotedArg(tail2);
- if (!msgText)
- return false;
-
- char* moneyStr = strtok(NULL, "");
- int32 money = moneyStr ? atoi(moneyStr) : 0;
- if (money <= 0)
- return false;
-
- // msgSubject, msgText isn't NUL after prev. check
- std::string subject = msgSubject;
- std::string text = msgText;
-
- // from console show not existed sender
- MailSender sender(MAIL_NORMAL, handler->GetSession() ? handler->GetSession()->GetPlayer()->GetGUIDLow() : 0, MAIL_STATIONERY_GM);
-
- SQLTransaction trans = CharacterDatabase.BeginTransaction();
-
- MailDraft(subject, text)
- .AddMoney(money)
- .SendMailTo(trans, MailReceiver(receiver, GUID_LOPART(receiverGuid)), sender);
-
- CharacterDatabase.CommitTransaction(trans);
-
- std::string nameLink = handler->playerLink(receiverName);
- handler->PSendSysMessage(LANG_MAIL_SENT, nameLink.c_str());
- return true;
- }
- /// Send a message to a player in game
- static bool HandleSendMessageCommand(ChatHandler* handler, char const* args)
- {
- /// - Find the player
- Player* player;
- if (!handler->extractPlayerTarget((char*)args, &player))
- return false;
-
- char* msgStr = strtok(NULL, "");
- if (!msgStr)
- return false;
-
- ///- Check that he is not logging out.
- if (player->GetSession()->isLogingOut())
- {
- handler->SendSysMessage(LANG_PLAYER_NOT_FOUND);
- handler->SetSentErrorMessage(true);
- return false;
- }
-
- /// - Send the message
- // Use SendAreaTriggerMessage for fastest delivery.
- player->GetSession()->SendAreaTriggerMessage("%s", msgStr);
- player->GetSession()->SendAreaTriggerMessage("|cffff0000[Message from administrator]:|r");
-
- // Confirmation message
- std::string nameLink = handler->GetNameLink(player);
- handler->PSendSysMessage(LANG_SENDMESSAGE, nameLink.c_str(), msgStr);
-
- return true;
- }
-
- static bool HandleCreatePetCommand(ChatHandler* handler, char const* /*args*/)
- {
- Player* player = handler->GetSession()->GetPlayer();
- Creature* creatureTarget = handler->getSelectedCreature();
-
- if (!creatureTarget || creatureTarget->isPet() || creatureTarget->GetTypeId() == TYPEID_PLAYER)
- {
- handler->PSendSysMessage(LANG_SELECT_CREATURE);
- handler->SetSentErrorMessage(true);
- return false;
- }
-
- CreatureTemplate const* creatrueTemplate = sObjectMgr->GetCreatureTemplate(creatureTarget->GetEntry());
- // Creatures with family 0 crashes the server
- if (!creatrueTemplate->family)
- {
- handler->PSendSysMessage("This creature cannot be tamed. (family id: 0).");
- handler->SetSentErrorMessage(true);
- return false;
- }
-
- if (player->GetPetGUID())
- {
- handler->PSendSysMessage("You already have a pet");
- handler->SetSentErrorMessage(true);
- return false;
- }
-
- // Everything looks OK, create new pet
- Pet* pet = new Pet(player, HUNTER_PET);
- if (!pet->CreateBaseAtCreature(creatureTarget))
- {
- delete pet;
- handler->PSendSysMessage("Error 1");
- return false;
- }
-
- creatureTarget->setDeathState(JUST_DIED);
- creatureTarget->RemoveCorpse();
- creatureTarget->SetHealth(0); // just for nice GM-mode view
-
- pet->SetUInt64Value(UNIT_FIELD_CREATEDBY, player->GetGUID());
- pet->SetUInt32Value(UNIT_FIELD_FACTIONTEMPLATE, player->getFaction());
-
- if (!pet->InitStatsForLevel(creatureTarget->getLevel()))
- {
- sLog->outError(LOG_FILTER_GENERAL, "InitStatsForLevel() in EffectTameCreature failed! Pet deleted.");
- handler->PSendSysMessage("Error 2");
- delete pet;
- return false;
- }
-
- // prepare visual effect for levelup
- pet->SetUInt32Value(UNIT_FIELD_LEVEL, creatureTarget->getLevel()-1);
-
- pet->GetCharmInfo()->SetPetNumber(sObjectMgr->GeneratePetNumber(), true);
- // this enables pet details window (Shift+P)
- pet->InitPetCreateSpells();
- pet->SetFullHealth();
-
- pet->GetMap()->AddToMap(pet->ToCreature());
-
- // visual effect for levelup
- pet->SetUInt32Value(UNIT_FIELD_LEVEL, creatureTarget->getLevel());
-
- player->SetMinion(pet, true);
- pet->SavePetToDB(PET_SAVE_AS_CURRENT);
- player->PetSpellInitialize();
-
- return true;
- }
-
- static bool HandlePetLearnCommand(ChatHandler* handler, char const* args)
- {
- if (!*args)
- return false;
-
- Player* player = handler->GetSession()->GetPlayer();
- Pet* pet = player->GetPet();
-
- if (!pet)
- {
- handler->PSendSysMessage("You have no pet");
- handler->SetSentErrorMessage(true);
- return false;
- }
-
- uint32 spellId = handler->extractSpellIdFromLink((char*)args);
-
- if (!spellId || !sSpellMgr->GetSpellInfo(spellId))
- return false;
-
- // Check if pet already has it
- if (pet->HasSpell(spellId))
- {
- handler->PSendSysMessage("Pet already has spell: %u", spellId);
- handler->SetSentErrorMessage(true);
- return false;
- }
-
- // Check if spell is valid
- SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(spellId);
- if (!spellInfo || !SpellMgr::IsSpellValid(spellInfo))
- {
- handler->PSendSysMessage(LANG_COMMAND_SPELL_BROKEN, spellId);
- handler->SetSentErrorMessage(true);
- return false;
- }
-
- pet->learnSpell(spellId);
-
- handler->PSendSysMessage("Pet has learned spell %u", spellId);
- return true;
- }
-
- static bool HandlePetUnlearnCommand(ChatHandler* handler, char const* args)
- {
- if (!*args)
- return false;
-
- Player* player = handler->GetSession()->GetPlayer();
- Pet* pet = player->GetPet();
- if (!pet)
- {
- handler->PSendSysMessage("You have no pet");
- handler->SetSentErrorMessage(true);
- return false;
- }
-
- uint32 spellId = handler->extractSpellIdFromLink((char*)args);
-
- if (pet->HasSpell(spellId))
- pet->removeSpell(spellId, false);
- else
- handler->PSendSysMessage("Pet doesn't have that spell");
-
- return true;
- }
-
- static bool HandleFreezeCommand(ChatHandler* handler, char const* args)
- {
- std::string name;
- Player* player;
- char const* TargetName = strtok((char*)args, " "); // get entered name
- if (!TargetName) // if no name entered use target
- {
- player = handler->getSelectedPlayer();
- if (player) //prevent crash with creature as target
- {
- name = player->GetName();
- normalizePlayerName(name);
- }
- }
- else // if name entered
- {
- name = TargetName;
- normalizePlayerName(name);
- player = sObjectAccessor->FindPlayerByName(name.c_str());
- }
-
- if (!player)
- {
- handler->SendSysMessage(LANG_COMMAND_FREEZE_WRONG);
- return true;
- }
-
- if (player == handler->GetSession()->GetPlayer())
- {
- handler->SendSysMessage(LANG_COMMAND_FREEZE_ERROR);
- return true;
- }
-
- // effect
- if (player && (player != handler->GetSession()->GetPlayer()))
- {
- handler->PSendSysMessage(LANG_COMMAND_FREEZE, name.c_str());
-
- // stop combat + make player unattackable + duel stop + stop some spells
- player->setFaction(35);
- player->CombatStop();
- if (player->IsNonMeleeSpellCasted(true))
- player->InterruptNonMeleeSpells(true);
- player->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE);
-
- // if player class = hunter || warlock remove pet if alive
- if ((player->getClass() == CLASS_HUNTER) || (player->getClass() == CLASS_WARLOCK))
- {
- if (Pet* pet = player->GetPet())
- {
- pet->SavePetToDB(PET_SAVE_AS_CURRENT);
- // not let dismiss dead pet
- if (pet && pet->isAlive())
- player->RemovePet(pet, PET_SAVE_NOT_IN_SLOT);
- }
- }
-
- if (SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(9454))
- Aura::TryRefreshStackOrCreate(spellInfo, MAX_EFFECT_MASK, player, player);
-
- // save player
- player->SaveToDB();
- }
-
- return true;
- }
-
- static bool HandleUnFreezeCommand(ChatHandler* handler, char const*args)
- {
- std::string name;
- Player* player;
- char* targetName = strtok((char*)args, " "); // Get entered name
-
- if (targetName)
- {
- name = targetName;
- normalizePlayerName(name);
- player = sObjectAccessor->FindPlayerByName(name.c_str());
- }
- else // If no name was entered - use target
- {
- player = handler->getSelectedPlayer();
- if (player)
- name = player->GetName();
- }
-
- if (player)
- {
- handler->PSendSysMessage(LANG_COMMAND_UNFREEZE, name.c_str());
-
- // Reset player faction + allow combat + allow duels
- player->setFactionForRace(player->getRace());
- player->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE);
-
- // Remove Freeze spell (allowing movement and spells)
- player->RemoveAurasDueToSpell(9454);
-
- // Save player
- player->SaveToDB();
- }
- else
- {
- if (targetName)
- {
- // Check for offline players
- PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_CHAR_GUID_BY_NAME);
- stmt->setString(0, name);
- PreparedQueryResult result = CharacterDatabase.Query(stmt);
-
- if (!result)
- {
- handler->SendSysMessage(LANG_COMMAND_FREEZE_WRONG);
- return true;
- }
-
- // If player found: delete his freeze aura
- Field* fields = result->Fetch();
- uint32 lowGuid = fields[0].GetUInt32();
-
- stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_CHAR_AURA_FROZEN);
- stmt->setUInt32(0, lowGuid);
- CharacterDatabase.Execute(stmt);
-
- handler->PSendSysMessage(LANG_COMMAND_UNFREEZE, name.c_str());
- return true;
- }
- else
- {
- handler->SendSysMessage(LANG_COMMAND_FREEZE_WRONG);
- return true;
- }
- }
-
- return true;
- }
-
- static bool HandleListFreezeCommand(ChatHandler* handler, char const* /*args*/)
- {
- // Get names from DB
- PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_CHARACTER_AURA_FROZEN);
- PreparedQueryResult result = CharacterDatabase.Query(stmt);
- if (!result)
- {
- handler->SendSysMessage(LANG_COMMAND_NO_FROZEN_PLAYERS);
- return true;
- }
-
- // Header of the names
- handler->PSendSysMessage(LANG_COMMAND_LIST_FREEZE);
-
- // Output of the results
- do
- {
- Field* fields = result->Fetch();
- std::string player = fields[0].GetString();
- handler->PSendSysMessage(LANG_COMMAND_FROZEN_PLAYERS, player.c_str());
- }
- while (result->NextRow());
-
- return true;
- }
-
- static bool HandleGroupLeaderCommand(ChatHandler* handler, char const* args)
- {
- Player* player = NULL;
- Group* group = NULL;
- uint64 guid = 0;
- char* nameStr = strtok((char*)args, " ");
-
- if (handler->GetPlayerGroupAndGUIDByName(nameStr, player, group, guid))
- if (group && group->GetLeaderGUID() != guid)
- {
- group->ChangeLeader(guid);
- group->SendUpdate();
- }
-
- return true;
- }
-
- static bool HandleGroupDisbandCommand(ChatHandler* handler, char const* args)
- {
- Player* player = NULL;
- Group* group = NULL;
- uint64 guid = 0;
- char* nameStr = strtok((char*)args, " ");
-
- if (handler->GetPlayerGroupAndGUIDByName(nameStr, player, group, guid))
- if (group)
- group->Disband();
-
- return true;
- }
-
- static bool HandleGroupRemoveCommand(ChatHandler* handler, char const* args)
- {
- Player* player = NULL;
- Group* group = NULL;
- uint64 guid = 0;
- char* nameStr = strtok((char*)args, " ");
-
- if (handler->GetPlayerGroupAndGUIDByName(nameStr, player, group, guid, true))
- if (group)
- group->RemoveMember(guid);
-
- return true;
- }
-
- static bool HandlePlayAllCommand(ChatHandler* handler, char const* args)
- {
- if (!*args)
- return false;
-
- uint32 soundId = atoi((char*)args);
-
- if (!sSoundEntriesStore.LookupEntry(soundId))
- {
- handler->PSendSysMessage(LANG_SOUND_NOT_EXIST, soundId);
- handler->SetSentErrorMessage(true);
- return false;
- }
-
- WorldPacket data(SMSG_PLAY_SOUND, 4);
- data << uint32(soundId) << handler->GetSession()->GetPlayer()->GetGUID();
- sWorld->SendGlobalMessage(&data);
-
- handler->PSendSysMessage(LANG_COMMAND_PLAYED_TO_ALL, soundId);
- return true;
- }
-
- static bool HandlePossessCommand(ChatHandler* handler, char const* /*args*/)
- {
- Unit* unit = handler->getSelectedUnit();
- if (!unit)
- return false;
-
- handler->GetSession()->GetPlayer()->CastSpell(unit, 530, true);
- return true;
- }
-
- static bool HandleUnPossessCommand(ChatHandler* handler, char const* /*args*/)
- {
- Unit* unit = handler->getSelectedUnit();
- if (!unit)
- unit = handler->GetSession()->GetPlayer();
-
- unit->RemoveCharmAuras();
-
- return true;
- }
-
- static bool HandleBindSightCommand(ChatHandler* handler, char const* /*args*/)
- {
- Unit* unit = handler->getSelectedUnit();
- if (!unit)
- return false;
-
- handler->GetSession()->GetPlayer()->CastSpell(unit, 6277, true);
- return true;
- }
-
- static bool HandleUnbindSightCommand(ChatHandler* handler, char const* /*args*/)
- {
- Player* player = handler->GetSession()->GetPlayer();
-
- if (player->isPossessing())
- return false;
-
- player->StopCastingBindSight();
- return true;
- }
-};
-
-void AddSC_misc_commandscript()
-{
- new misc_commandscript();
-}
+/*
+ * Copyright (C) 2008-2012 TrinityCore <http://www.trinitycore.org/>
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation; either version 2 of the License, or (at your
+ * option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
+ * more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#include "Chat.h"
+#include "ScriptMgr.h"
+#include "AccountMgr.h"
+#include "ArenaTeamMgr.h"
+#include "CellImpl.h"
+#include "GridNotifiers.h"
+#include "Group.h"
+#include "InstanceSaveMgr.h"
+#include "MovementGenerator.h"
+#include "ObjectAccessor.h"
+#include "SpellAuras.h"
+#include "TargetedMovementGenerator.h"
+#include "WeatherMgr.h"
+#include "ace/INET_Addr.h"
+
+class misc_commandscript : public CommandScript
+{
+public:
+ misc_commandscript() : CommandScript("misc_commandscript") { }
+
+ ChatCommand* GetCommands() const
+ {
+ static ChatCommand groupCommandTable[] =
+ {
+ { "leader", SEC_ADMINISTRATOR, false, &HandleGroupLeaderCommand, "", NULL },
+ { "disband", SEC_ADMINISTRATOR, false, &HandleGroupDisbandCommand, "", NULL },
+ { "remove", SEC_ADMINISTRATOR, false, &HandleGroupRemoveCommand, "", NULL },
+ { NULL, 0, false, NULL, "", NULL }
+ };
+ static ChatCommand petCommandTable[] =
+ {
+ { "create", SEC_GAMEMASTER, false, &HandleCreatePetCommand, "", NULL },
+ { "learn", SEC_GAMEMASTER, false, &HandlePetLearnCommand, "", NULL },
+ { "unlearn", SEC_GAMEMASTER, false, &HandlePetUnlearnCommand, "", NULL },
+ { NULL, 0, false, NULL, "", NULL }
+ };
+ static ChatCommand sendCommandTable[] =
+ {
+ { "items", SEC_ADMINISTRATOR, true, &HandleSendItemsCommand, "", NULL },
+ { "mail", SEC_MODERATOR, true, &HandleSendMailCommand, "", NULL },
+ { "message", SEC_ADMINISTRATOR, true, &HandleSendMessageCommand, "", NULL },
+ { "money", SEC_ADMINISTRATOR, true, &HandleSendMoneyCommand, "", NULL },
+ { NULL, 0, false, NULL, "", NULL }
+ };
+ static ChatCommand commandTable[] =
+ {
+ { "dev", SEC_ADMINISTRATOR, false, &HandleDevCommand, "", NULL },
+ { "gps", SEC_ADMINISTRATOR, false, &HandleGPSCommand, "", NULL },
+ { "aura", SEC_ADMINISTRATOR, false, &HandleAuraCommand, "", NULL },
+ { "unaura", SEC_ADMINISTRATOR, false, &HandleUnAuraCommand, "", NULL },
+ { "appear", SEC_MODERATOR, false, &HandleAppearCommand, "", NULL },
+ { "summon", SEC_MODERATOR, false, &HandleSummonCommand, "", NULL },
+ { "groupsummon", SEC_MODERATOR, false, &HandleGroupSummonCommand, "", NULL },
+ { "commands", SEC_PLAYER, true, &HandleCommandsCommand, "", NULL },
+ { "die", SEC_ADMINISTRATOR, false, &HandleDieCommand, "", NULL },
+ { "revive", SEC_ADMINISTRATOR, true, &HandleReviveCommand, "", NULL },
+ { "dismount", SEC_PLAYER, false, &HandleDismountCommand, "", NULL },
+ { "guid", SEC_GAMEMASTER, false, &HandleGUIDCommand, "", NULL },
+ { "help", SEC_PLAYER, true, &HandleHelpCommand, "", NULL },
+ { "itemmove", SEC_GAMEMASTER, false, &HandleItemMoveCommand, "", NULL },
+ { "cooldown", SEC_ADMINISTRATOR, false, &HandleCooldownCommand, "", NULL },
+ { "distance", SEC_ADMINISTRATOR, false, &HandleGetDistanceCommand, "", NULL },
+ { "recall", SEC_MODERATOR, false, &HandleRecallCommand, "", NULL },
+ { "save", SEC_PLAYER, false, &HandleSaveCommand, "", NULL },
+ { "saveall", SEC_MODERATOR, true, &HandleSaveAllCommand, "", NULL },
+ { "kick", SEC_GAMEMASTER, true, &HandleKickPlayerCommand, "", NULL },
+ { "unstuck", SEC_PLAYER, true, &HandleUnstuckCommand, "", NULL },
+ { "linkgrave", SEC_ADMINISTRATOR, false, &HandleLinkGraveCommand, "", NULL },
+ { "neargrave", SEC_ADMINISTRATOR, false, &HandleNearGraveCommand, "", NULL },
+ { "showarea", SEC_ADMINISTRATOR, false, &HandleShowAreaCommand, "", NULL },
+ { "hidearea", SEC_ADMINISTRATOR, false, &HandleHideAreaCommand, "", NULL },
+ { "additem", SEC_ADMINISTRATOR, false, &HandleAddItemCommand, "", NULL },
+ { "additemset", SEC_ADMINISTRATOR, false, &HandleAddItemSetCommand, "", NULL },
+ { "bank", SEC_ADMINISTRATOR, false, &HandleBankCommand, "", NULL },
+ { "wchange", SEC_ADMINISTRATOR, false, &HandleChangeWeather, "", NULL },
+ { "maxskill", SEC_ADMINISTRATOR, false, &HandleMaxSkillCommand, "", NULL },
+ { "setskill", SEC_ADMINISTRATOR, false, &HandleSetSkillCommand, "", NULL },
+ { "pinfo", SEC_GAMEMASTER, true, &HandlePInfoCommand, "", NULL },
+ { "respawn", SEC_ADMINISTRATOR, false, &HandleRespawnCommand, "", NULL },
+ { "send", SEC_MODERATOR, true, NULL, "", sendCommandTable },
+ { "pet", SEC_GAMEMASTER, false, NULL, "", petCommandTable },
+ { "mute", SEC_MODERATOR, true, &HandleMuteCommand, "", NULL },
+ { "unmute", SEC_MODERATOR, true, &HandleUnmuteCommand, "", NULL },
+ { "movegens", SEC_ADMINISTRATOR, false, &HandleMovegensCommand, "", NULL },
+ { "cometome", SEC_ADMINISTRATOR, false, &HandleComeToMeCommand, "", NULL },
+ { "damage", SEC_ADMINISTRATOR, false, &HandleDamageCommand, "", NULL },
+ { "combatstop", SEC_GAMEMASTER, true, &HandleCombatStopCommand, "", NULL },
+ { "flusharenapoints", SEC_ADMINISTRATOR, false, &HandleFlushArenaPointsCommand, "", NULL },
+ { "repairitems", SEC_GAMEMASTER, true, &HandleRepairitemsCommand, "", NULL },
+ { "freeze", SEC_MODERATOR, false, &HandleFreezeCommand, "", NULL },
+ { "unfreeze", SEC_MODERATOR, false, &HandleUnFreezeCommand, "", NULL },
+ { "listfreeze", SEC_MODERATOR, false, &HandleListFreezeCommand, "", NULL },
+ { "group", SEC_ADMINISTRATOR, false, NULL, "", groupCommandTable },
+ { "possess", SEC_ADMINISTRATOR, false, HandlePossessCommand, "", NULL },
+ { "unpossess", SEC_ADMINISTRATOR, false, HandleUnPossessCommand, "", NULL },
+ { "bindsight", SEC_ADMINISTRATOR, false, HandleBindSightCommand, "", NULL },
+ { "unbindsight", SEC_ADMINISTRATOR, false, HandleUnbindSightCommand, "", NULL },
+ { "playall", SEC_GAMEMASTER, false, HandlePlayAllCommand, "", NULL },
+ { NULL, 0, false, NULL, "", NULL }
+ };
+ return commandTable;
+ }
+
+ static bool HandleDevCommand(ChatHandler* handler, char const* args)
+ {
+ if (!*args)
+ {
+ if (handler->GetSession()->GetPlayer()->HasFlag(PLAYER_FLAGS, PLAYER_FLAGS_DEVELOPER))
+ handler->GetSession()->SendNotification(LANG_DEV_ON);
+ else
+ handler->GetSession()->SendNotification(LANG_DEV_OFF);
+ return true;
+ }
+
+ std::string argstr = (char*)args;
+
+ if (argstr == "on")
+ {
+ handler->GetSession()->GetPlayer()->SetFlag(PLAYER_FLAGS, PLAYER_FLAGS_DEVELOPER);
+ handler->GetSession()->SendNotification(LANG_DEV_ON);
+ return true;
+ }
+
+ if (argstr == "off")
+ {
+ handler->GetSession()->GetPlayer()->RemoveFlag(PLAYER_FLAGS, PLAYER_FLAGS_DEVELOPER);
+ handler->GetSession()->SendNotification(LANG_DEV_OFF);
+ return true;
+ }
+
+ handler->SendSysMessage(LANG_USE_BOL);
+ handler->SetSentErrorMessage(true);
+ return false;
+ }
+
+ static bool HandleGPSCommand(ChatHandler* handler, char const* args)
+ {
+ WorldObject* object = NULL;
+ if (*args)
+ {
+ uint64 guid = handler->extractGuidFromLink((char*)args);
+ if (guid)
+ object = (WorldObject*)ObjectAccessor::GetObjectByTypeMask(*handler->GetSession()->GetPlayer(), guid, TYPEMASK_UNIT | TYPEMASK_GAMEOBJECT);
+
+ if (!object)
+ {
+ handler->SendSysMessage(LANG_PLAYER_NOT_FOUND);
+ handler->SetSentErrorMessage(true);
+ return false;
+ }
+ }
+ else
+ {
+ object = handler->getSelectedUnit();
+
+ if (!object)
+ {
+ handler->SendSysMessage(LANG_SELECT_CHAR_OR_CREATURE);
+ handler->SetSentErrorMessage(true);
+ return false;
+ }
+ }
+
+ CellCoord cellCoord = Trinity::ComputeCellCoord(object->GetPositionX(), object->GetPositionY());
+ Cell cell(cellCoord);
+
+ uint32 zoneId, areaId;
+ object->GetZoneAndAreaId(zoneId, areaId);
+
+ MapEntry const* mapEntry = sMapStore.LookupEntry(object->GetMapId());
+ AreaTableEntry const* zoneEntry = GetAreaEntryByAreaID(zoneId);
+ AreaTableEntry const* areaEntry = GetAreaEntryByAreaID(areaId);
+
+ float zoneX = object->GetPositionX();
+ float zoneY = object->GetPositionY();
+
+ Map2ZoneCoordinates(zoneX, zoneY, zoneId);
+
+ Map const* map = object->GetMap();
+ float groundZ = map->GetHeight(object->GetPhaseMask(), object->GetPositionX(), object->GetPositionY(), MAX_HEIGHT);
+ float floorZ = map->GetHeight(object->GetPhaseMask(), object->GetPositionX(), object->GetPositionY(), object->GetPositionZ());
+
+ GridCoord gridCoord = Trinity::ComputeGridCoord(object->GetPositionX(), object->GetPositionY());
+
+ // 63? WHY?
+ int gridX = 63 - gridCoord.x_coord;
+ int gridY = 63 - gridCoord.y_coord;
+
+ uint32 haveMap = Map::ExistMap(object->GetMapId(), gridX, gridY) ? 1 : 0;
+ uint32 haveVMap = Map::ExistVMap(object->GetMapId(), gridX, gridY) ? 1 : 0;
+
+ if (haveVMap)
+ {
+ if (map->IsOutdoors(object->GetPositionX(), object->GetPositionY(), object->GetPositionZ()))
+ handler->PSendSysMessage("You are outdoors");
+ else
+ handler->PSendSysMessage("You are indoors");
+ }
+ else
+ handler->PSendSysMessage("no VMAP available for area info");
+
+ handler->PSendSysMessage(LANG_MAP_POSITION,
+ object->GetMapId(), (mapEntry ? mapEntry->name[handler->GetSessionDbcLocale()] : "<unknown>"),
+ zoneId, (zoneEntry ? zoneEntry->area_name[handler->GetSessionDbcLocale()] : "<unknown>"),
+ areaId, (areaEntry ? areaEntry->area_name[handler->GetSessionDbcLocale()] : "<unknown>"),
+ object->GetPhaseMask(),
+ object->GetPositionX(), object->GetPositionY(), object->GetPositionZ(), object->GetOrientation(),
+ cell.GridX(), cell.GridY(), cell.CellX(), cell.CellY(), object->GetInstanceId(),
+ zoneX, zoneY, groundZ, floorZ, haveMap, haveVMap);
+
+ LiquidData liquidStatus;
+ ZLiquidStatus status = map->getLiquidStatus(object->GetPositionX(), object->GetPositionY(), object->GetPositionZ(), MAP_ALL_LIQUIDS, &liquidStatus);
+
+ if (status)
+ handler->PSendSysMessage(LANG_LIQUID_STATUS, liquidStatus.level, liquidStatus.depth_level, liquidStatus.entry, liquidStatus.type_flags, status);
+
+ return true;
+ }
+
+ static bool HandleAuraCommand(ChatHandler* handler, char const* args)
+ {
+ Unit* target = handler->getSelectedUnit();
+ if (!target)
+ {
+ handler->SendSysMessage(LANG_SELECT_CHAR_OR_CREATURE);
+ handler->SetSentErrorMessage(true);
+ return false;
+ }
+
+ // number or [name] Shift-click form |color|Hspell:spell_id|h[name]|h|r or Htalent form
+ uint32 spellId = handler->extractSpellIdFromLink((char*)args);
+
+ if (SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(spellId))
+ Aura::TryRefreshStackOrCreate(spellInfo, MAX_EFFECT_MASK, target, target);
+
+ return true;
+ }
+
+ static bool HandleUnAuraCommand(ChatHandler* handler, char const* args)
+ {
+ Unit* target = handler->getSelectedUnit();
+ if (!target)
+ {
+ handler->SendSysMessage(LANG_SELECT_CHAR_OR_CREATURE);
+ handler->SetSentErrorMessage(true);
+ return false;
+ }
+
+ std::string argstr = args;
+ if (argstr == "all")
+ {
+ target->RemoveAllAuras();
+ return true;
+ }
+
+ // number or [name] Shift-click form |color|Hspell:spell_id|h[name]|h|r or Htalent form
+ uint32 spellId = handler->extractSpellIdFromLink((char*)args);
+ if (!spellId)
+ return false;
+
+ target->RemoveAurasDueToSpell(spellId);
+
+ return true;
+ }
+ // Teleport to Player
+ static bool HandleAppearCommand(ChatHandler* handler, char const* args)
+ {
+ Player* target;
+ uint64 targetGuid;
+ std::string targetName;
+ if (!handler->extractPlayerTarget((char*)args, &target, &targetGuid, &targetName))
+ return false;
+
+ Player* _player = handler->GetSession()->GetPlayer();
+ if (target == _player || targetGuid == _player->GetGUID())
+ {
+ handler->SendSysMessage(LANG_CANT_TELEPORT_SELF);
+ handler->SetSentErrorMessage(true);
+ return false;
+ }
+
+ if (target)
+ {
+ // check online security
+ if (handler->HasLowerSecurity(target, 0))
+ return false;
+
+ std::string chrNameLink = handler->playerLink(targetName);
+
+ Map* map = target->GetMap();
+ if (map->IsBattlegroundOrArena())
+ {
+ // only allow if gm mode is on
+ if (!_player->isGameMaster())
+ {
+ handler->PSendSysMessage(LANG_CANNOT_GO_TO_BG_GM, chrNameLink.c_str());
+ handler->SetSentErrorMessage(true);
+ return false;
+ }
+ // if both players are in different bgs
+ else if (_player->GetBattlegroundId() && _player->GetBattlegroundId() != target->GetBattlegroundId())
+ _player->LeaveBattleground(false); // Note: should be changed so _player gets no Deserter debuff
+
+ // all's well, set bg id
+ // when porting out from the bg, it will be reset to 0
+ _player->SetBattlegroundId(target->GetBattlegroundId(), target->GetBattlegroundTypeId());
+ // remember current position as entry point for return at bg end teleportation
+ if (!_player->GetMap()->IsBattlegroundOrArena())
+ _player->SetBattlegroundEntryPoint();
+ }
+ else if (map->IsDungeon())
+ {
+ // we have to go to instance, and can go to player only if:
+ // 1) we are in his group (either as leader or as member)
+ // 2) we are not bound to any group and have GM mode on
+ if (_player->GetGroup())
+ {
+ // we are in group, we can go only if we are in the player group
+ if (_player->GetGroup() != target->GetGroup())
+ {
+ handler->PSendSysMessage(LANG_CANNOT_GO_TO_INST_PARTY, chrNameLink.c_str());
+ handler->SetSentErrorMessage(true);
+ return false;
+ }
+ }
+ else
+ {
+ // we are not in group, let's verify our GM mode
+ if (!_player->isGameMaster())
+ {
+ handler->PSendSysMessage(LANG_CANNOT_GO_TO_INST_GM, chrNameLink.c_str());
+ handler->SetSentErrorMessage(true);
+ return false;
+ }
+ }
+
+ // if the player or the player's group is bound to another instance
+ // the player will not be bound to another one
+ InstancePlayerBind* bind = _player->GetBoundInstance(target->GetMapId(), target->GetDifficulty(map->IsRaid()));
+ if (!bind)
+ {
+ Group* group = _player->GetGroup();
+ // if no bind exists, create a solo bind
+ InstanceGroupBind* gBind = group ? group->GetBoundInstance(target) : NULL; // if no bind exists, create a solo bind
+ if (!gBind)
+ if (InstanceSave* save = sInstanceSaveMgr->GetInstanceSave(target->GetInstanceId()))
+ _player->BindToInstance(save, !save->CanReset());
+ }
+
+ if (map->IsRaid())
+ _player->SetRaidDifficulty(target->GetRaidDifficulty());
+ else
+ _player->SetDungeonDifficulty(target->GetDungeonDifficulty());
+ }
+
+ handler->PSendSysMessage(LANG_APPEARING_AT, chrNameLink.c_str());
+
+ // stop flight if need
+ if (_player->isInFlight())
+ {
+ _player->GetMotionMaster()->MovementExpired();
+ _player->CleanupAfterTaxiFlight();
+ }
+ // save only in non-flight case
+ else
+ _player->SaveRecallPosition();
+
+ // to point to see at target with same orientation
+ float x, y, z;
+ target->GetContactPoint(_player, x, y, z);
+
+ _player->TeleportTo(target->GetMapId(), x, y, z, _player->GetAngle(target), TELE_TO_GM_MODE);
+ _player->SetPhaseMask(target->GetPhaseMask(), true);
+ }
+ else
+ {
+ // check offline security
+ if (handler->HasLowerSecurity(NULL, targetGuid))
+ return false;
+
+ std::string nameLink = handler->playerLink(targetName);
+
+ handler->PSendSysMessage(LANG_APPEARING_AT, nameLink.c_str());
+
+ // to point where player stay (if loaded)
+ float x, y, z, o;
+ uint32 map;
+ bool in_flight;
+ if (!Player::LoadPositionFromDB(map, x, y, z, o, in_flight, targetGuid))
+ return false;
+
+ // stop flight if need
+ if (_player->isInFlight())
+ {
+ _player->GetMotionMaster()->MovementExpired();
+ _player->CleanupAfterTaxiFlight();
+ }
+ // save only in non-flight case
+ else
+ _player->SaveRecallPosition();
+
+ _player->TeleportTo(map, x, y, z, _player->GetOrientation());
+ }
+
+ return true;
+ }
+ // Summon Player
+ static bool HandleSummonCommand(ChatHandler* handler, char const* args)
+ {
+ Player* target;
+ uint64 targetGuid;
+ std::string targetName;
+ if (!handler->extractPlayerTarget((char*)args, &target, &targetGuid, &targetName))
+ return false;
+
+ Player* _player = handler->GetSession()->GetPlayer();
+ if (target == _player || targetGuid == _player->GetGUID())
+ {
+ handler->PSendSysMessage(LANG_CANT_TELEPORT_SELF);
+ handler->SetSentErrorMessage(true);
+ return false;
+ }
+
+ if (target)
+ {
+ std::string nameLink = handler->playerLink(targetName);
+ // check online security
+ if (handler->HasLowerSecurity(target, 0))
+ return false;
+
+ if (target->IsBeingTeleported())
+ {
+ handler->PSendSysMessage(LANG_IS_TELEPORTED, nameLink.c_str());
+ handler->SetSentErrorMessage(true);
+ return false;
+ }
+
+ Map* map = handler->GetSession()->GetPlayer()->GetMap();
+
+ if (map->IsBattlegroundOrArena())
+ {
+ // only allow if gm mode is on
+ if (!_player->isGameMaster())
+ {
+ handler->PSendSysMessage(LANG_CANNOT_GO_TO_BG_GM, nameLink.c_str());
+ handler->SetSentErrorMessage(true);
+ return false;
+ }
+ // if both players are in different bgs
+ else if (target->GetBattlegroundId() && handler->GetSession()->GetPlayer()->GetBattlegroundId() != target->GetBattlegroundId())
+ target->LeaveBattleground(false); // Note: should be changed so target gets no Deserter debuff
+
+ // all's well, set bg id
+ // when porting out from the bg, it will be reset to 0
+ target->SetBattlegroundId(handler->GetSession()->GetPlayer()->GetBattlegroundId(), handler->GetSession()->GetPlayer()->GetBattlegroundTypeId());
+ // remember current position as entry point for return at bg end teleportation
+ if (!target->GetMap()->IsBattlegroundOrArena())
+ target->SetBattlegroundEntryPoint();
+ }
+ else if (map->IsDungeon())
+ {
+ Map* map = target->GetMap();
+
+ if (map->Instanceable() && map->GetInstanceId() != map->GetInstanceId())
+ target->UnbindInstance(map->GetInstanceId(), target->GetDungeonDifficulty(), true);
+
+ // we are in instance, and can summon only player in our group with us as lead
+ if (!handler->GetSession()->GetPlayer()->GetGroup() || !target->GetGroup() ||
+ (target->GetGroup()->GetLeaderGUID() != handler->GetSession()->GetPlayer()->GetGUID()) ||
+ (handler->GetSession()->GetPlayer()->GetGroup()->GetLeaderGUID() != handler->GetSession()->GetPlayer()->GetGUID()))
+ // the last check is a bit excessive, but let it be, just in case
+ {
+ handler->PSendSysMessage(LANG_CANNOT_SUMMON_TO_INST, nameLink.c_str());
+ handler->SetSentErrorMessage(true);
+ return false;
+ }
+ }
+
+ handler->PSendSysMessage(LANG_SUMMONING, nameLink.c_str(), "");
+ if (handler->needReportToTarget(target))
+ ChatHandler(target).PSendSysMessage(LANG_SUMMONED_BY, handler->playerLink(_player->GetName()).c_str());
+
+ // stop flight if need
+ if (target->isInFlight())
+ {
+ target->GetMotionMaster()->MovementExpired();
+ target->CleanupAfterTaxiFlight();
+ }
+ // save only in non-flight case
+ else
+ target->SaveRecallPosition();
+
+ // before GM
+ float x, y, z;
+ handler->GetSession()->GetPlayer()->GetClosePoint(x, y, z, target->GetObjectSize());
+ target->TeleportTo(handler->GetSession()->GetPlayer()->GetMapId(), x, y, z, target->GetOrientation());
+ target->SetPhaseMask(handler->GetSession()->GetPlayer()->GetPhaseMask(), true);
+ }
+ else
+ {
+ // check offline security
+ if (handler->HasLowerSecurity(NULL, targetGuid))
+ return false;
+
+ std::string nameLink = handler->playerLink(targetName);
+
+ handler->PSendSysMessage(LANG_SUMMONING, nameLink.c_str(), handler->GetTrinityString(LANG_OFFLINE));
+
+ // in point where GM stay
+ Player::SavePositionInDB(handler->GetSession()->GetPlayer()->GetMapId(),
+ handler->GetSession()->GetPlayer()->GetPositionX(),
+ handler->GetSession()->GetPlayer()->GetPositionY(),
+ handler->GetSession()->GetPlayer()->GetPositionZ(),
+ handler->GetSession()->GetPlayer()->GetOrientation(),
+ handler->GetSession()->GetPlayer()->GetZoneId(),
+ targetGuid);
+ }
+
+ return true;
+ }
+ // Summon group of player
+ static bool HandleGroupSummonCommand(ChatHandler* handler, char const* args)
+ {
+ Player* target;
+ if (!handler->extractPlayerTarget((char*)args, &target))
+ return false;
+
+ // check online security
+ if (handler->HasLowerSecurity(target, 0))
+ return false;
+
+ Group* group = target->GetGroup();
+
+ std::string nameLink = handler->GetNameLink(target);
+
+ if (!group)
+ {
+ handler->PSendSysMessage(LANG_NOT_IN_GROUP, nameLink.c_str());
+ handler->SetSentErrorMessage(true);
+ return false;
+ }
+
+ Map* gmMap = handler->GetSession()->GetPlayer()->GetMap();
+ bool toInstance = gmMap->Instanceable();
+
+ // we are in instance, and can summon only player in our group with us as lead
+ if (toInstance && (
+ !handler->GetSession()->GetPlayer()->GetGroup() || (group->GetLeaderGUID() != handler->GetSession()->GetPlayer()->GetGUID()) ||
+ (handler->GetSession()->GetPlayer()->GetGroup()->GetLeaderGUID() != handler->GetSession()->GetPlayer()->GetGUID())))
+ // the last check is a bit excessive, but let it be, just in case
+ {
+ handler->SendSysMessage(LANG_CANNOT_SUMMON_TO_INST);
+ handler->SetSentErrorMessage(true);
+ return false;
+ }
+
+ for (GroupReference* itr = group->GetFirstMember(); itr != NULL; itr = itr->next())
+ {
+ Player* player = itr->getSource();
+
+ if (!player || player == handler->GetSession()->GetPlayer() || !player->GetSession())
+ continue;
+
+ // check online security
+ if (handler->HasLowerSecurity(player, 0))
+ return false;
+
+ std::string plNameLink = handler->GetNameLink(player);
+
+ if (player->IsBeingTeleported() == true)
+ {
+ handler->PSendSysMessage(LANG_IS_TELEPORTED, plNameLink.c_str());
+ handler->SetSentErrorMessage(true);
+ return false;
+ }
+
+ if (toInstance)
+ {
+ Map* playerMap = player->GetMap();
+
+ if (playerMap->Instanceable() && playerMap->GetInstanceId() != gmMap->GetInstanceId())
+ {
+ // cannot summon from instance to instance
+ handler->PSendSysMessage(LANG_CANNOT_SUMMON_TO_INST, plNameLink.c_str());
+ handler->SetSentErrorMessage(true);
+ return false;
+ }
+ }
+
+ handler->PSendSysMessage(LANG_SUMMONING, plNameLink.c_str(), "");
+ if (handler->needReportToTarget(player))
+ ChatHandler(player).PSendSysMessage(LANG_SUMMONED_BY, handler->GetNameLink().c_str());
+
+ // stop flight if need
+ if (player->isInFlight())
+ {
+ player->GetMotionMaster()->MovementExpired();
+ player->CleanupAfterTaxiFlight();
+ }
+ // save only in non-flight case
+ else
+ player->SaveRecallPosition();
+
+ // before GM
+ float x, y, z;
+ handler->GetSession()->GetPlayer()->GetClosePoint(x, y, z, player->GetObjectSize());
+ player->TeleportTo(handler->GetSession()->GetPlayer()->GetMapId(), x, y, z, player->GetOrientation());
+ }
+
+ return true;
+ }
+
+ static bool HandleCommandsCommand(ChatHandler* handler, char const* /*args*/)
+ {
+ handler->ShowHelpForCommand(handler->getCommandTable(), "");
+ return true;
+ }
+
+ static bool HandleDieCommand(ChatHandler* handler, char const* /*args*/)
+ {
+ Unit* target = handler->getSelectedUnit();
+
+ if (!target || !handler->GetSession()->GetPlayer()->GetSelection())
+ {
+ handler->SendSysMessage(LANG_SELECT_CHAR_OR_CREATURE);
+ handler->SetSentErrorMessage(true);
+ return false;
+ }
+
+ if (target->GetTypeId() == TYPEID_PLAYER)
+ {
+ if (handler->HasLowerSecurity((Player*)target, 0, false))
+ return false;
+ }
+
+ if (target->isAlive())
+ {
+ if (sWorld->getBoolConfig(CONFIG_DIE_COMMAND_MODE))
+ handler->GetSession()->GetPlayer()->Kill(target);
+ else
+ handler->GetSession()->GetPlayer()->DealDamage(target, target->GetHealth(), NULL, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, NULL, false);
+ }
+
+ return true;
+ }
+
+ static bool HandleReviveCommand(ChatHandler* handler, char const* args)
+ {
+ Player* target;
+ uint64 targetGuid;
+ if (!handler->extractPlayerTarget((char*)args, &target, &targetGuid))
+ return false;
+
+ if (target)
+ {
+ target->ResurrectPlayer(!AccountMgr::IsPlayerAccount(target->GetSession()->GetSecurity()) ? 1.0f : 0.5f);
+ target->SpawnCorpseBones();
+ target->SaveToDB();
+ }
+ else
+ // will resurrected at login without corpse
+ sObjectAccessor->ConvertCorpseForPlayer(targetGuid);
+
+ return true;
+ }
+
+ static bool HandleDismountCommand(ChatHandler* handler, char const* /*args*/)
+ {
+ Player* player = handler->GetSession()->GetPlayer();
+
+ // If player is not mounted, so go out :)
+ if (!player->IsMounted())
+ {
+ handler->SendSysMessage(LANG_CHAR_NON_MOUNTED);
+ handler->SetSentErrorMessage(true);
+ return false;
+ }
+
+ if (player->isInFlight())
+ {
+ handler->SendSysMessage(LANG_YOU_IN_FLIGHT);
+ handler->SetSentErrorMessage(true);
+ return false;
+ }
+
+ player->Dismount();
+ player->RemoveAurasByType(SPELL_AURA_MOUNTED);
+ return true;
+ }
+
+ static bool HandleGUIDCommand(ChatHandler* handler, char const* /*args*/)
+ {
+ uint64 guid = handler->GetSession()->GetPlayer()->GetSelection();
+
+ if (guid == 0)
+ {
+ handler->SendSysMessage(LANG_NO_SELECTION);
+ handler->SetSentErrorMessage(true);
+ return false;
+ }
+
+ handler->PSendSysMessage(LANG_OBJECT_GUID, GUID_LOPART(guid), GUID_HIPART(guid));
+ return true;
+ }
+
+ static bool HandleHelpCommand(ChatHandler* handler, char const* args)
+ {
+ char const* cmd = strtok((char*)args, " ");
+ if (!cmd)
+ {
+ handler->ShowHelpForCommand(handler->getCommandTable(), "help");
+ handler->ShowHelpForCommand(handler->getCommandTable(), "");
+ }
+ else
+ {
+ if (!handler->ShowHelpForCommand(handler->getCommandTable(), cmd))
+ handler->SendSysMessage(LANG_NO_HELP_CMD);
+ }
+
+ return true;
+ }
+ // move item to other slot
+ static bool HandleItemMoveCommand(ChatHandler* handler, char const* args)
+ {
+ if (!*args)
+ return false;
+
+ char const* param1 = strtok((char*)args, " ");
+ if (!param1)
+ return false;
+
+ char const* param2 = strtok(NULL, " ");
+ if (!param2)
+ return false;
+
+ uint8 srcSlot = uint8(atoi(param1));
+ uint8 dstSlot = uint8(atoi(param2));
+
+ if (srcSlot == dstSlot)
+ return true;
+
+ if (!handler->GetSession()->GetPlayer()->IsValidPos(INVENTORY_SLOT_BAG_0, srcSlot, true))
+ return false;
+
+ if (!handler->GetSession()->GetPlayer()->IsValidPos(INVENTORY_SLOT_BAG_0, dstSlot, false))
+ return false;
+
+ uint16 src = ((INVENTORY_SLOT_BAG_0 << 8) | srcSlot);
+ uint16 dst = ((INVENTORY_SLOT_BAG_0 << 8) | dstSlot);
+
+ handler->GetSession()->GetPlayer()->SwapItem(src, dst);
+
+ return true;
+ }
+
+ static bool HandleCooldownCommand(ChatHandler* handler, char const* args)
+ {
+ Player* target = handler->getSelectedPlayer();
+ if (!target)
+ {
+ handler->SendSysMessage(LANG_PLAYER_NOT_FOUND);
+ handler->SetSentErrorMessage(true);
+ return false;
+ }
+
+ std::string nameLink = handler->GetNameLink(target);
+
+ if (!*args)
+ {
+ target->RemoveAllSpellCooldown();
+ handler->PSendSysMessage(LANG_REMOVEALL_COOLDOWN, nameLink.c_str());
+ }
+ else
+ {
+ // number or [name] Shift-click form |color|Hspell:spell_id|h[name]|h|r or Htalent form
+ uint32 spellIid = handler->extractSpellIdFromLink((char*)args);
+ if (!spellIid)
+ return false;
+
+ if (!sSpellMgr->GetSpellInfo(spellIid))
+ {
+ handler->PSendSysMessage(LANG_UNKNOWN_SPELL, target == handler->GetSession()->GetPlayer() ? handler->GetTrinityString(LANG_YOU) : nameLink.c_str());
+ handler->SetSentErrorMessage(true);
+ return false;
+ }
+
+ target->RemoveSpellCooldown(spellIid, true);
+ handler->PSendSysMessage(LANG_REMOVE_COOLDOWN, spellIid, target == handler->GetSession()->GetPlayer() ? handler->GetTrinityString(LANG_YOU) : nameLink.c_str());
+ }
+ return true;
+ }
+
+ static bool HandleGetDistanceCommand(ChatHandler* handler, char const* args)
+ {
+ WorldObject* obj = NULL;
+
+ if (*args)
+ {
+ uint64 guid = handler->extractGuidFromLink((char*)args);
+ if (guid)
+ obj = (WorldObject*)ObjectAccessor::GetObjectByTypeMask(*handler->GetSession()->GetPlayer(), guid, TYPEMASK_UNIT|TYPEMASK_GAMEOBJECT);
+
+ if (!obj)
+ {
+ handler->SendSysMessage(LANG_PLAYER_NOT_FOUND);
+ handler->SetSentErrorMessage(true);
+ return false;
+ }
+ }
+ else
+ {
+ obj = handler->getSelectedUnit();
+
+ if (!obj)
+ {
+ handler->SendSysMessage(LANG_SELECT_CHAR_OR_CREATURE);
+ handler->SetSentErrorMessage(true);
+ return false;
+ }
+ }
+
+ handler->PSendSysMessage(LANG_DISTANCE, handler->GetSession()->GetPlayer()->GetDistance(obj), handler->GetSession()->GetPlayer()->GetDistance2d(obj), handler->GetSession()->GetPlayer()->GetExactDist(obj), handler->GetSession()->GetPlayer()->GetExactDist2d(obj));
+ return true;
+ }
+ // Teleport player to last position
+ static bool HandleRecallCommand(ChatHandler* handler, char const* args)
+ {
+ Player* target;
+ if (!handler->extractPlayerTarget((char*)args, &target))
+ return false;
+
+ // check online security
+ if (handler->HasLowerSecurity(target, 0))
+ return false;
+
+ if (target->IsBeingTeleported())
+ {
+ handler->PSendSysMessage(LANG_IS_TELEPORTED, handler->GetNameLink(target).c_str());
+ handler->SetSentErrorMessage(true);
+ return false;
+ }
+
+ // stop flight if need
+ if (target->isInFlight())
+ {
+ target->GetMotionMaster()->MovementExpired();
+ target->CleanupAfterTaxiFlight();
+ }
+
+ target->TeleportTo(target->m_recallMap, target->m_recallX, target->m_recallY, target->m_recallZ, target->m_recallO);
+ return true;
+ }
+
+ static bool HandleSaveCommand(ChatHandler* handler, char const* /*args*/)
+ {
+ Player* player = handler->GetSession()->GetPlayer();
+
+ // save GM account without delay and output message
+ if (!AccountMgr::IsPlayerAccount(handler->GetSession()->GetSecurity()))
+ {
+ if (Player* target = handler->getSelectedPlayer())
+ target->SaveToDB();
+ else
+ player->SaveToDB();
+ handler->SendSysMessage(LANG_PLAYER_SAVED);
+ return true;
+ }
+
+ // save if the player has last been saved over 20 seconds ago
+ uint32 saveInterval = sWorld->getIntConfig(CONFIG_INTERVAL_SAVE);
+ if (saveInterval == 0 || (saveInterval > 20 * IN_MILLISECONDS && player->GetSaveTimer() <= saveInterval - 20 * IN_MILLISECONDS))
+ player->SaveToDB();
+
+ return true;
+ }
+
+ // Save all players in the world
+ static bool HandleSaveAllCommand(ChatHandler* handler, char const* /*args*/)
+ {
+ sObjectAccessor->SaveAllPlayers();
+ handler->SendSysMessage(LANG_PLAYERS_SAVED);
+ return true;
+ }
+
+ // kick player
+ static bool HandleKickPlayerCommand(ChatHandler* handler, char const* args)
+ {
+ Player* target = NULL;
+ std::string playerName;
+ if (!handler->extractPlayerTarget((char*)args, &target, NULL, &playerName))
+ return false;
+
+ if (handler->GetSession() && target == handler->GetSession()->GetPlayer())
+ {
+ handler->SendSysMessage(LANG_COMMAND_KICKSELF);
+ handler->SetSentErrorMessage(true);
+ return false;
+ }
+
+ // check online security
+ if (handler->HasLowerSecurity(target, 0))
+ return false;
+
+ if (sWorld->getBoolConfig(CONFIG_SHOW_KICK_IN_WORLD))
+ sWorld->SendWorldText(LANG_COMMAND_KICKMESSAGE, playerName.c_str());
+ else
+ handler->PSendSysMessage(LANG_COMMAND_KICKMESSAGE, playerName.c_str());
+
+ target->GetSession()->KickPlayer();
+
+ return true;
+ }
+
+ static bool HandleUnstuckCommand(ChatHandler* handler, char const* args)
+ {
+ //No args required for players
+ if (handler->GetSession() && AccountMgr::IsPlayerAccount(handler->GetSession()->GetSecurity()))
+ {
+ Player* player = handler->GetSession()->GetPlayer();
+ if (player->isInFlight() || player->isInCombat())
+ {
+ handler->SendSysMessage(LANG_CANT_DO_NOW);
+ handler->SetSentErrorMessage(true);
+ return false;
+ }
+
+ //7355: "Stuck"
+ player->CastSpell(player, 7355, false);
+ return true;
+ }
+
+ if (!*args)
+ return false;
+
+ char* player_str = strtok((char*)args, " ");
+ if (!player_str)
+ return false;
+
+ std::string location_str = "inn";
+ if (char const* loc = strtok(NULL, " "))
+ location_str = loc;
+
+ Player* player = NULL;
+ if (!handler->extractPlayerTarget(player_str, &player))
+ return false;
+
+ if (player->isInFlight() || player->isInCombat())
+ {
+ handler->SendSysMessage(LANG_CANT_DO_NOW);
+ handler->SetSentErrorMessage(true);
+ return false;
+ }
+
+ if (location_str == "inn")
+ {
+ player->TeleportTo(player->m_homebindMapId, player->m_homebindX, player->m_homebindY, player->m_homebindZ, player->GetOrientation());
+ return true;
+ }
+
+ if (location_str == "graveyard")
+ {
+ player->RepopAtGraveyard();
+ return true;
+ }
+
+ if (location_str == "startzone")
+ {
+ player->TeleportTo(player->GetStartPosition());
+ return true;
+ }
+
+ //Not a supported argument
+ return false;
+
+ }
+
+ static bool HandleLinkGraveCommand(ChatHandler* handler, char const* args)
+ {
+ if (!*args)
+ return false;
+
+ char* px = strtok((char*)args, " ");
+ if (!px)
+ return false;
+
+ uint32 graveyardId = uint32(atoi(px));
+
+ uint32 team;
+
+ char* px2 = strtok(NULL, " ");
+
+ if (!px2)
+ team = 0;
+ else if (strncmp(px2, "horde", 6) == 0)
+ team = HORDE;
+ else if (strncmp(px2, "alliance", 9) == 0)
+ team = ALLIANCE;
+ else
+ return false;
+
+ WorldSafeLocsEntry const* graveyard = sWorldSafeLocsStore.LookupEntry(graveyardId);
+
+ if (!graveyard)
+ {
+ handler->PSendSysMessage(LANG_COMMAND_GRAVEYARDNOEXIST, graveyardId);
+ handler->SetSentErrorMessage(true);
+ return false;
+ }
+
+ Player* player = handler->GetSession()->GetPlayer();
+
+ uint32 zoneId = player->GetZoneId();
+
+ AreaTableEntry const* areaEntry = GetAreaEntryByAreaID(zoneId);
+ if (!areaEntry || areaEntry->zone !=0)
+ {
+ handler->PSendSysMessage(LANG_COMMAND_GRAVEYARDWRONGZONE, graveyardId, zoneId);
+ handler->SetSentErrorMessage(true);
+ return false;
+ }
+
+ if (sObjectMgr->AddGraveYardLink(graveyardId, zoneId, team))
+ handler->PSendSysMessage(LANG_COMMAND_GRAVEYARDLINKED, graveyardId, zoneId);
+ else
+ handler->PSendSysMessage(LANG_COMMAND_GRAVEYARDALRLINKED, graveyardId, zoneId);
+
+ return true;
+ }
+
+ static bool HandleNearGraveCommand(ChatHandler* handler, char const* args)
+ {
+ uint32 team;
+
+ size_t argStr = strlen(args);
+
+ if (!*args)
+ team = 0;
+ else if (strncmp((char*)args, "horde", argStr) == 0)
+ team = HORDE;
+ else if (strncmp((char*)args, "alliance", argStr) == 0)
+ team = ALLIANCE;
+ else
+ return false;
+
+ Player* player = handler->GetSession()->GetPlayer();
+ uint32 zone_id = player->GetZoneId();
+
+ WorldSafeLocsEntry const* graveyard = sObjectMgr->GetClosestGraveYard(
+ player->GetPositionX(), player->GetPositionY(), player->GetPositionZ(), player->GetMapId(), team);
+
+ if (graveyard)
+ {
+ uint32 graveyardId = graveyard->ID;
+
+ GraveYardData const* data = sObjectMgr->FindGraveYardData(graveyardId, zone_id);
+ if (!data)
+ {
+ handler->PSendSysMessage(LANG_COMMAND_GRAVEYARDERROR, graveyardId);
+ handler->SetSentErrorMessage(true);
+ return false;
+ }
+
+ team = data->team;
+
+ std::string team_name = handler->GetTrinityString(LANG_COMMAND_GRAVEYARD_NOTEAM);
+
+ if (team == 0)
+ team_name = handler->GetTrinityString(LANG_COMMAND_GRAVEYARD_ANY);
+ else if (team == HORDE)
+ team_name = handler->GetTrinityString(LANG_COMMAND_GRAVEYARD_HORDE);
+ else if (team == ALLIANCE)
+ team_name = handler->GetTrinityString(LANG_COMMAND_GRAVEYARD_ALLIANCE);
+
+ handler->PSendSysMessage(LANG_COMMAND_GRAVEYARDNEAREST, graveyardId, team_name.c_str(), zone_id);
+ }
+ else
+ {
+ std::string team_name;
+
+ if (team == 0)
+ team_name = handler->GetTrinityString(LANG_COMMAND_GRAVEYARD_ANY);
+ else if (team == HORDE)
+ team_name = handler->GetTrinityString(LANG_COMMAND_GRAVEYARD_HORDE);
+ else if (team == ALLIANCE)
+ team_name = handler->GetTrinityString(LANG_COMMAND_GRAVEYARD_ALLIANCE);
+
+ if (team == ~uint32(0))
+ handler->PSendSysMessage(LANG_COMMAND_ZONENOGRAVEYARDS, zone_id);
+ else
+ handler->PSendSysMessage(LANG_COMMAND_ZONENOGRAFACTION, zone_id, team_name.c_str());
+ }
+
+ return true;
+ }
+
+ static bool HandleShowAreaCommand(ChatHandler* handler, char const* args)
+ {
+ if (!*args)
+ return false;
+
+ Player* playerTarget = handler->getSelectedPlayer();
+ if (!playerTarget)
+ {
+ handler->SendSysMessage(LANG_NO_CHAR_SELECTED);
+ handler->SetSentErrorMessage(true);
+ return false;
+ }
+
+ int32 area = GetAreaFlagByAreaID(atoi((char*)args));
+ int32 offset = area / 32;
+ uint32 val = uint32((1 << (area % 32)));
+
+ if (area<0 || offset >= PLAYER_EXPLORED_ZONES_SIZE)
+ {
+ handler->SendSysMessage(LANG_BAD_VALUE);
+ handler->SetSentErrorMessage(true);
+ return false;
+ }
+
+ uint32 currFields = playerTarget->GetUInt32Value(PLAYER_EXPLORED_ZONES_1 + offset);
+ playerTarget->SetUInt32Value(PLAYER_EXPLORED_ZONES_1 + offset, uint32((currFields | val)));
+
+ handler->SendSysMessage(LANG_EXPLORE_AREA);
+ return true;
+ }
+
+ static bool HandleHideAreaCommand(ChatHandler* handler, char const* args)
+ {
+ if (!*args)
+ return false;
+
+ Player* playerTarget = handler->getSelectedPlayer();
+ if (!playerTarget)
+ {
+ handler->SendSysMessage(LANG_NO_CHAR_SELECTED);
+ handler->SetSentErrorMessage(true);
+ return false;
+ }
+
+ int32 area = GetAreaFlagByAreaID(atoi((char*)args));
+ int32 offset = area / 32;
+ uint32 val = uint32((1 << (area % 32)));
+
+ if (area < 0 || offset >= PLAYER_EXPLORED_ZONES_SIZE)
+ {
+ handler->SendSysMessage(LANG_BAD_VALUE);
+ handler->SetSentErrorMessage(true);
+ return false;
+ }
+
+ uint32 currFields = playerTarget->GetUInt32Value(PLAYER_EXPLORED_ZONES_1 + offset);
+ playerTarget->SetUInt32Value(PLAYER_EXPLORED_ZONES_1 + offset, uint32((currFields ^ val)));
+
+ handler->SendSysMessage(LANG_UNEXPLORE_AREA);
+ return true;
+ }
+
+ static bool HandleAddItemCommand(ChatHandler* handler, char const* args)
+ {
+ if (!*args)
+ return false;
+
+ uint32 itemId = 0;
+
+ if (args[0] == '[') // [name] manual form
+ {
+ char const* itemNameStr = strtok((char*)args, "]");
+
+ if (itemNameStr && itemNameStr[0])
+ {
+ std::string itemName = itemNameStr+1;
+ WorldDatabase.EscapeString(itemName);
+
+ PreparedStatement* stmt = WorldDatabase.GetPreparedStatement(WORLD_SEL_ITEM_TEMPLATE_BY_NAME);
+ stmt->setString(0, itemName);
+ PreparedQueryResult result = WorldDatabase.Query(stmt);
+
+ if (!result)
+ {
+ handler->PSendSysMessage(LANG_COMMAND_COULDNOTFIND, itemNameStr+1);
+ handler->SetSentErrorMessage(true);
+ return false;
+ }
+ itemId = result->Fetch()->GetUInt32();
+ }
+ else
+ return false;
+ }
+ else // item_id or [name] Shift-click form |color|Hitem:item_id:0:0:0|h[name]|h|r
+ {
+ char const* id = handler->extractKeyFromLink((char*)args, "Hitem");
+ if (!id)
+ return false;
+ itemId = uint32(atol(id));
+ }
+
+ char const* ccount = strtok(NULL, " ");
+
+ int32 count = 1;
+
+ if (ccount)
+ count = strtol(ccount, NULL, 10);
+
+ if (count == 0)
+ count = 1;
+
+ Player* player = handler->GetSession()->GetPlayer();
+ Player* playerTarget = handler->getSelectedPlayer();
+ if (!playerTarget)
+ playerTarget = player;
+
+ sLog->outDebug(LOG_FILTER_GENERAL, handler->GetTrinityString(LANG_ADDITEM), itemId, count);
+
+ ItemTemplate const* itemTemplate = sObjectMgr->GetItemTemplate(itemId);
+ if (!itemTemplate)
+ {
+ handler->PSendSysMessage(LANG_COMMAND_ITEMIDINVALID, itemId);
+ handler->SetSentErrorMessage(true);
+ return false;
+ }
+
+ // Subtract
+ if (count < 0)
+ {
+ playerTarget->DestroyItemCount(itemId, -count, true, false);
+ handler->PSendSysMessage(LANG_REMOVEITEM, itemId, -count, handler->GetNameLink(playerTarget).c_str());
+ return true;
+ }
+
+ // Adding items
+ uint32 noSpaceForCount = 0;
+
+ // check space and find places
+ ItemPosCountVec dest;
+ InventoryResult msg = playerTarget->CanStoreNewItem(NULL_BAG, NULL_SLOT, dest, itemId, count, &noSpaceForCount);
+ if (msg != EQUIP_ERR_OK) // convert to possible store amount
+ count -= noSpaceForCount;
+
+ if (count == 0 || dest.empty()) // can't add any
+ {
+ handler->PSendSysMessage(LANG_ITEM_CANNOT_CREATE, itemId, noSpaceForCount);
+ handler->SetSentErrorMessage(true);
+ return false;
+ }
+
+ Item* item = playerTarget->StoreNewItem(dest, itemId, true, Item::GenerateItemRandomPropertyId(itemId));
+
+ // remove binding (let GM give it to another player later)
+ if (player == playerTarget)
+ for (ItemPosCountVec::const_iterator itr = dest.begin(); itr != dest.end(); ++itr)
+ if (Item* item1 = player->GetItemByPos(itr->pos))
+ item1->SetBinding(false);
+
+ if (count > 0 && item)
+ {
+ player->SendNewItem(item, count, false, true);
+ if (player != playerTarget)
+ playerTarget->SendNewItem(item, count, true, false);
+ }
+
+ if (noSpaceForCount > 0)
+ handler->PSendSysMessage(LANG_ITEM_CANNOT_CREATE, itemId, noSpaceForCount);
+
+ return true;
+ }
+
+ static bool HandleAddItemSetCommand(ChatHandler* handler, char const* args)
+ {
+ if (!*args)
+ return false;
+
+ char const* id = handler->extractKeyFromLink((char*)args, "Hitemset"); // number or [name] Shift-click form |color|Hitemset:itemset_id|h[name]|h|r
+ if (!id)
+ return false;
+
+ uint32 itemSetId = atol(id);
+
+ // prevent generation all items with itemset field value '0'
+ if (itemSetId == 0)
+ {
+ handler->PSendSysMessage(LANG_NO_ITEMS_FROM_ITEMSET_FOUND, itemSetId);
+ handler->SetSentErrorMessage(true);
+ return false;
+ }
+
+ Player* player = handler->GetSession()->GetPlayer();
+ Player* playerTarget = handler->getSelectedPlayer();
+ if (!playerTarget)
+ playerTarget = player;
+
+ sLog->outDebug(LOG_FILTER_GENERAL, handler->GetTrinityString(LANG_ADDITEMSET), itemSetId);
+
+ bool found = false;
+ ItemTemplateContainer const* its = sObjectMgr->GetItemTemplateStore();
+ for (ItemTemplateContainer::const_iterator itr = its->begin(); itr != its->end(); ++itr)
+ {
+ if (itr->second.ItemSet == itemSetId)
+ {
+ found = true;
+ ItemPosCountVec dest;
+ InventoryResult msg = playerTarget->CanStoreNewItem(NULL_BAG, NULL_SLOT, dest, itr->second.ItemId, 1);
+ if (msg == EQUIP_ERR_OK)
+ {
+ Item* item = playerTarget->StoreNewItem(dest, itr->second.ItemId, true);
+
+ // remove binding (let GM give it to another player later)
+ if (player == playerTarget)
+ item->SetBinding(false);
+
+ player->SendNewItem(item, 1, false, true);
+ if (player != playerTarget)
+ playerTarget->SendNewItem(item, 1, true, false);
+ }
+ else
+ {
+ player->SendEquipError(msg, NULL, NULL, itr->second.ItemId);
+ handler->PSendSysMessage(LANG_ITEM_CANNOT_CREATE, itr->second.ItemId, 1);
+ }
+ }
+ }
+
+ if (!found)
+ {
+ handler->PSendSysMessage(LANG_NO_ITEMS_FROM_ITEMSET_FOUND, itemSetId);
+ handler->SetSentErrorMessage(true);
+ return false;
+ }
+
+ return true;
+ }
+
+ static bool HandleBankCommand(ChatHandler* handler, char const* /*args*/)
+ {
+ handler->GetSession()->SendShowBank(handler->GetSession()->GetPlayer()->GetGUID());
+ return true;
+ }
+
+ static bool HandleChangeWeather(ChatHandler* handler, char const* args)
+ {
+ if (!*args)
+ return false;
+
+ // Weather is OFF
+ if (!sWorld->getBoolConfig(CONFIG_WEATHER))
+ {
+ handler->SendSysMessage(LANG_WEATHER_DISABLED);
+ handler->SetSentErrorMessage(true);
+ return false;
+ }
+
+ // *Change the weather of a cell
+ char const* px = strtok((char*)args, " ");
+ char const* py = strtok(NULL, " ");
+
+ if (!px || !py)
+ return false;
+
+ uint32 type = uint32(atoi(px)); //0 to 3, 0: fine, 1: rain, 2: snow, 3: sand
+ float grade = float(atof(py)); //0 to 1, sending -1 is instand good weather
+
+ Player* player = handler->GetSession()->GetPlayer();
+ uint32 zoneid = player->GetZoneId();
+
+ Weather* weather = WeatherMgr::FindWeather(zoneid);
+
+ if (!weather)
+ weather = WeatherMgr::AddWeather(zoneid);
+ if (!weather)
+ {
+ handler->SendSysMessage(LANG_NO_WEATHER);
+ handler->SetSentErrorMessage(true);
+ return false;
+ }
+
+ weather->SetWeather(WeatherType(type), grade);
+
+ return true;
+ }
+
+
+ static bool HandleMaxSkillCommand(ChatHandler* handler, char const* /*args*/)
+ {
+ Player* SelectedPlayer = handler->getSelectedPlayer();
+ if (!SelectedPlayer)
+ {
+ handler->SendSysMessage(LANG_NO_CHAR_SELECTED);
+ handler->SetSentErrorMessage(true);
+ return false;
+ }
+
+ // each skills that have max skill value dependent from level seted to current level max skill value
+ SelectedPlayer->UpdateSkillsToMaxSkillsForLevel();
+ return true;
+ }
+
+ static bool HandleSetSkillCommand(ChatHandler* handler, char const* args)
+ {
+ // number or [name] Shift-click form |color|Hskill:skill_id|h[name]|h|r
+ char const* skillStr = handler->extractKeyFromLink((char*)args, "Hskill");
+ if (!skillStr)
+ return false;
+
+ char const* levelStr = strtok(NULL, " ");
+ if (!levelStr)
+ return false;
+
+ char const* maxPureSkill = strtok(NULL, " ");
+
+ int32 skill = atoi(skillStr);
+ if (skill <= 0)
+ {
+ handler->PSendSysMessage(LANG_INVALID_SKILL_ID, skill);
+ handler->SetSentErrorMessage(true);
+ return false;
+ }
+
+ int32 level = uint32(atol(levelStr));
+
+ Player* target = handler->getSelectedPlayer();
+ if (!target)
+ {
+ handler->SendSysMessage(LANG_NO_CHAR_SELECTED);
+ handler->SetSentErrorMessage(true);
+ return false;
+ }
+
+ SkillLineEntry const* skillLine = sSkillLineStore.LookupEntry(skill);
+ if (!skillLine)
+ {
+ handler->PSendSysMessage(LANG_INVALID_SKILL_ID, skill);
+ handler->SetSentErrorMessage(true);
+ return false;
+ }
+
+ std::string tNameLink = handler->GetNameLink(target);
+
+ if (!target->GetSkillValue(skill))
+ {
+ handler->PSendSysMessage(LANG_SET_SKILL_ERROR, tNameLink.c_str(), skill, skillLine->name[handler->GetSessionDbcLocale()]);
+ handler->SetSentErrorMessage(true);
+ return false;
+ }
+
+ uint16 max = maxPureSkill ? atol (maxPureSkill) : target->GetPureMaxSkillValue(skill);
+
+ if (level <= 0 || level > max || max <= 0)
+ return false;
+
+ target->SetSkill(skill, target->GetSkillStep(skill), level, max);
+ handler->PSendSysMessage(LANG_SET_SKILL, skill, skillLine->name[handler->GetSessionDbcLocale()], tNameLink.c_str(), level, max);
+
+ return true;
+ }
+ // show info of player
+ static bool HandlePInfoCommand(ChatHandler* handler, char const* args)
+ {
+ Player* target;
+ uint64 targetGuid;
+ std::string targetName;
+
+ uint32 parseGUID = MAKE_NEW_GUID(atol((char*)args), 0, HIGHGUID_PLAYER);
+
+ if (sObjectMgr->GetPlayerNameByGUID(parseGUID, targetName))
+ {
+ target = sObjectMgr->GetPlayerByLowGUID(parseGUID);
+ targetGuid = parseGUID;
+ }
+ else if (!handler->extractPlayerTarget((char*)args, &target, &targetGuid, &targetName))
+ return false;
+
+ uint32 accId = 0;
+ uint32 money = 0;
+ uint32 totalPlayerTime = 0;
+ uint8 level = 0;
+ uint32 latency = 0;
+ uint8 race;
+ uint8 Class;
+ int64 muteTime = 0;
+ int64 banTime = -1;
+ uint32 mapId;
+ uint32 areaId;
+ uint32 phase = 0;
+
+ // get additional information from Player object
+ if (target)
+ {
+ // check online security
+ if (handler->HasLowerSecurity(target, 0))
+ return false;
+
+ accId = target->GetSession()->GetAccountId();
+ money = target->GetMoney();
+ totalPlayerTime = target->GetTotalPlayedTime();
+ level = target->getLevel();
+ latency = target->GetSession()->GetLatency();
+ race = target->getRace();
+ Class = target->getClass();
+ muteTime = target->GetSession()->m_muteTime;
+ mapId = target->GetMapId();
+ areaId = target->GetAreaId();
+ phase = target->GetPhaseMask();
+ }
+ // get additional information from DB
+ else
+ {
+ // check offline security
+ if (handler->HasLowerSecurity(NULL, targetGuid))
+ return false;
+
+ PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_CHAR_PINFO);
+ stmt->setUInt32(0, GUID_LOPART(targetGuid));
+ PreparedQueryResult result = CharacterDatabase.Query(stmt);
+
+ if (!result)
+ return false;
+
+ Field* fields = result->Fetch();
+ totalPlayerTime = fields[0].GetUInt32();
+ level = fields[1].GetUInt8();
+ money = fields[2].GetUInt32();
+ accId = fields[3].GetUInt32();
+ race = fields[4].GetUInt8();
+ Class = fields[5].GetUInt8();
+ mapId = fields[6].GetUInt16();
+ areaId = fields[7].GetUInt16();
+ }
+
+ std::string userName = handler->GetTrinityString(LANG_ERROR);
+ std::string eMail = handler->GetTrinityString(LANG_ERROR);
+ std::string lastIp = handler->GetTrinityString(LANG_ERROR);
+ uint32 security = 0;
+ std::string lastLogin = handler->GetTrinityString(LANG_ERROR);
+
+ PreparedStatement* stmt = LoginDatabase.GetPreparedStatement(LOGIN_SEL_PINFO);
+ stmt->setInt32(0, int32(realmID));
+ stmt->setUInt32(1, accId);
+ PreparedQueryResult result = LoginDatabase.Query(stmt);
+
+ if (result)
+ {
+ Field* fields = result->Fetch();
+ userName = fields[0].GetString();
+ security = fields[1].GetUInt8();
+ eMail = fields[2].GetString();
+ muteTime = fields[5].GetUInt64();
+
+ if (eMail.empty())
+ eMail = "-";
+
+ if (!handler->GetSession() || handler->GetSession()->GetSecurity() >= AccountTypes(security))
+ {
+ lastIp = fields[3].GetString();
+ lastLogin = fields[4].GetString();
+
+ uint32 ip = inet_addr(lastIp.c_str());
+#if TRINITY_ENDIAN == BIGENDIAN
+ EndianConvertReverse(ip);
+#endif
+
+ PreparedStatement* stmt = WorldDatabase.GetPreparedStatement(WORLD_SEL_IP2NATION_COUNTRY);
+
+ stmt->setUInt32(0, ip);
+
+ PreparedQueryResult result2 = WorldDatabase.Query(stmt);
+
+ if (result2)
+ {
+ Field* fields2 = result2->Fetch();
+ lastIp.append(" (");
+ lastIp.append(fields2[0].GetString());
+ lastIp.append(")");
+ }
+ }
+ else
+ {
+ lastIp = "-";
+ lastLogin = "-";
+ }
+ }
+
+ std::string nameLink = handler->playerLink(targetName);
+
+ handler->PSendSysMessage(LANG_PINFO_ACCOUNT, (target ? "" : handler->GetTrinityString(LANG_OFFLINE)), nameLink.c_str(), GUID_LOPART(targetGuid), userName.c_str(), accId, eMail.c_str(), security, lastIp.c_str(), lastLogin.c_str(), latency);
+
+ std::string bannedby = "unknown";
+ std::string banreason = "";
+
+ stmt = LoginDatabase.GetPreparedStatement(LOGIN_SEL_PINFO_BANS);
+ stmt->setUInt32(0, accId);
+ PreparedQueryResult result2 = LoginDatabase.Query(stmt);
+ if (!result2)
+ {
+ stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_PINFO_BANS);
+ stmt->setUInt32(0, GUID_LOPART(targetGuid));
+ result2 = CharacterDatabase.Query(stmt);
+ }
+
+ if (result2)
+ {
+ Field* fields = result2->Fetch();
+ banTime = int64(fields[1].GetBool() ? 0 : fields[0].GetUInt32());
+ bannedby = fields[2].GetString();
+ banreason = fields[3].GetString();
+ }
+
+ if (muteTime > 0)
+ handler->PSendSysMessage(LANG_PINFO_MUTE, secsToTimeString(muteTime - time(NULL), true).c_str());
+
+ if (banTime >= 0)
+ handler->PSendSysMessage(LANG_PINFO_BAN, banTime > 0 ? secsToTimeString(banTime - time(NULL), true).c_str() : "permanently", bannedby.c_str(), banreason.c_str());
+
+ std::string raceStr, ClassStr;
+ switch (race)
+ {
+ case RACE_HUMAN:
+ raceStr = "Human";
+ break;
+ case RACE_ORC:
+ raceStr = "Orc";
+ break;
+ case RACE_DWARF:
+ raceStr = "Dwarf";
+ break;
+ case RACE_NIGHTELF:
+ raceStr = "Night Elf";
+ break;
+ case RACE_UNDEAD_PLAYER:
+ raceStr = "Undead";
+ break;
+ case RACE_TAUREN:
+ raceStr = "Tauren";
+ break;
+ case RACE_GNOME:
+ raceStr = "Gnome";
+ break;
+ case RACE_TROLL:
+ raceStr = "Troll";
+ break;
+ case RACE_BLOODELF:
+ raceStr = "Blood Elf";
+ break;
+ case RACE_DRAENEI:
+ raceStr = "Draenei";
+ break;
+ }
+
+ switch (Class)
+ {
+ case CLASS_WARRIOR:
+ ClassStr = "Warrior";
+ break;
+ case CLASS_PALADIN:
+ ClassStr = "Paladin";
+ break;
+ case CLASS_HUNTER:
+ ClassStr = "Hunter";
+ break;
+ case CLASS_ROGUE:
+ ClassStr = "Rogue";
+ break;
+ case CLASS_PRIEST:
+ ClassStr = "Priest";
+ break;
+ case CLASS_DEATH_KNIGHT:
+ ClassStr = "Death Knight";
+ break;
+ case CLASS_SHAMAN:
+ ClassStr = "Shaman";
+ break;
+ case CLASS_MAGE:
+ ClassStr = "Mage";
+ break;
+ case CLASS_WARLOCK:
+ ClassStr = "Warlock";
+ break;
+ case CLASS_DRUID:
+ ClassStr = "Druid";
+ break;
+ }
+
+ std::string timeStr = secsToTimeString(totalPlayerTime, true, true);
+ uint32 gold = money /GOLD;
+ uint32 silv = (money % GOLD) / SILVER;
+ uint32 copp = (money % GOLD) % SILVER;
+ handler->PSendSysMessage(LANG_PINFO_LEVEL, raceStr.c_str(), ClassStr.c_str(), timeStr.c_str(), level, gold, silv, copp);
+
+ // Add map, zone, subzone and phase to output
+ int locale = handler->GetSessionDbcLocale();
+ std::string areaName = "<unknown>";
+ std::string zoneName = "";
+
+ MapEntry const* map = sMapStore.LookupEntry(mapId);
+
+ AreaTableEntry const* area = GetAreaEntryByAreaID(areaId);
+ if (area)
+ {
+ areaName = area->area_name[locale];
+
+ AreaTableEntry const* zone = GetAreaEntryByAreaID(area->zone);
+ if (zone)
+ zoneName = zone->area_name[locale];
+ }
+
+ if (target)
+ {
+ if (!zoneName.empty())
+ handler->PSendSysMessage(LANG_PINFO_MAP_ONLINE, map->name[locale], zoneName.c_str(), areaName.c_str(), phase);
+ else
+ handler->PSendSysMessage(LANG_PINFO_MAP_ONLINE, map->name[locale], areaName.c_str(), "<unknown>", phase);
+ }
+ else
+ handler->PSendSysMessage(LANG_PINFO_MAP_OFFLINE, map->name[locale], areaName.c_str());
+
+ return true;
+ }
+
+ static bool HandleRespawnCommand(ChatHandler* handler, char const* /*args*/)
+ {
+ Player* player = handler->GetSession()->GetPlayer();
+
+ // accept only explicitly selected target (not implicitly self targeting case)
+ Unit* target = handler->getSelectedUnit();
+ if (player->GetSelection() && target)
+ {
+ if (target->GetTypeId() != TYPEID_UNIT || target->isPet())
+ {
+ handler->SendSysMessage(LANG_SELECT_CREATURE);
+ handler->SetSentErrorMessage(true);
+ return false;
+ }
+
+ if (target->isDead())
+ target->ToCreature()->Respawn();
+ return true;
+ }
+
+ CellCoord p(Trinity::ComputeCellCoord(player->GetPositionX(), player->GetPositionY()));
+ Cell cell(p);
+ cell.SetNoCreate();
+
+ Trinity::RespawnDo u_do;
+ Trinity::WorldObjectWorker<Trinity::RespawnDo> worker(player, u_do);
+
+ TypeContainerVisitor<Trinity::WorldObjectWorker<Trinity::RespawnDo>, GridTypeMapContainer > obj_worker(worker);
+ cell.Visit(p, obj_worker, *player->GetMap(), *player, player->GetGridActivationRange());
+
+ return true;
+ }
+ // mute player for some times
+ static bool HandleMuteCommand(ChatHandler* handler, char const* args)
+ {
+ char* nameStr;
+ char* delayStr;
+ handler->extractOptFirstArg((char*)args, &nameStr, &delayStr);
+ if (!delayStr)
+ return false;
+
+ char const* muteReason = strtok(NULL, "\r");
+ std::string muteReasonStr = "No reason";
+ if (muteReason != NULL)
+ muteReasonStr = muteReason;
+
+ Player* target;
+ uint64 targetGuid;
+ std::string targetName;
+ if (!handler->extractPlayerTarget(nameStr, &target, &targetGuid, &targetName))
+ return false;
+
+ uint32 accountId = target ? target->GetSession()->GetAccountId() : sObjectMgr->GetPlayerAccountIdByGUID(targetGuid);
+
+ // find only player from same account if any
+ if (!target)
+ if (WorldSession* session = sWorld->FindSession(accountId))
+ target = session->GetPlayer();
+
+ uint32 notSpeakTime = uint32(atoi(delayStr));
+
+ // must have strong lesser security level
+ if (handler->HasLowerSecurity (target, targetGuid, true))
+ return false;
+
+ PreparedStatement* stmt = LoginDatabase.GetPreparedStatement(LOGIN_UPD_MUTE_TIME);
+
+ if (target)
+ {
+ // Target is online, mute will be in effect right away.
+ int64 muteTime = time(NULL) + notSpeakTime * MINUTE;
+ target->GetSession()->m_muteTime = muteTime;
+ stmt->setInt64(0, muteTime);
+ ChatHandler(target).PSendSysMessage(LANG_YOUR_CHAT_DISABLED, notSpeakTime, muteReasonStr.c_str());
+ }
+ else
+ {
+ // Target is offline, mute will be in effect starting from the next login.
+ int32 muteTime = -int32(notSpeakTime * MINUTE);
+ stmt->setInt64(0, muteTime);
+ }
+
+ stmt->setUInt32(1, accountId);
+ LoginDatabase.Execute(stmt);
+ std::string nameLink = handler->playerLink(targetName);
+
+ handler->PSendSysMessage(target ? LANG_YOU_DISABLE_CHAT : LANG_COMMAND_DISABLE_CHAT_DELAYED, nameLink.c_str(), notSpeakTime, muteReasonStr.c_str());
+
+ return true;
+ }
+
+ // unmute player
+ static bool HandleUnmuteCommand(ChatHandler* handler, char const* args)
+ {
+ Player* target;
+ uint64 targetGuid;
+ std::string targetName;
+ if (!handler->extractPlayerTarget((char*)args, &target, &targetGuid, &targetName))
+ return false;
+
+ uint32 accountId = target ? target->GetSession()->GetAccountId() : sObjectMgr->GetPlayerAccountIdByGUID(targetGuid);
+
+ // find only player from same account if any
+ if (!target)
+ if (WorldSession* session = sWorld->FindSession(accountId))
+ target = session->GetPlayer();
+
+ // must have strong lesser security level
+ if (handler->HasLowerSecurity (target, targetGuid, true))
+ return false;
+
+ if (target)
+ {
+ if (target->CanSpeak())
+ {
+ handler->SendSysMessage(LANG_CHAT_ALREADY_ENABLED);
+ handler->SetSentErrorMessage(true);
+ return false;
+ }
+
+ target->GetSession()->m_muteTime = 0;
+ }
+
+ PreparedStatement* stmt = LoginDatabase.GetPreparedStatement(LOGIN_UPD_MUTE_TIME);
+ stmt->setInt64(0, 0);
+ stmt->setUInt32(1, accountId);
+ LoginDatabase.Execute(stmt);
+
+ if (target)
+ ChatHandler(target).PSendSysMessage(LANG_YOUR_CHAT_ENABLED);
+
+ std::string nameLink = handler->playerLink(targetName);
+
+ handler->PSendSysMessage(LANG_YOU_ENABLE_CHAT, nameLink.c_str());
+
+ return true;
+ }
+
+
+ static bool HandleMovegensCommand(ChatHandler* handler, char const* /*args*/)
+ {
+ Unit* unit = handler->getSelectedUnit();
+ if (!unit)
+ {
+ handler->SendSysMessage(LANG_SELECT_CHAR_OR_CREATURE);
+ handler->SetSentErrorMessage(true);
+ return false;
+ }
+
+ handler->PSendSysMessage(LANG_MOVEGENS_LIST, (unit->GetTypeId() == TYPEID_PLAYER ? "Player" : "Creature"), unit->GetGUIDLow());
+
+ MotionMaster* motionMaster = unit->GetMotionMaster();
+ float x, y, z;
+ motionMaster->GetDestination(x, y, z);
+
+ for (uint8 i = 0; i < MAX_MOTION_SLOT; ++i)
+ {
+ MovementGenerator* movementGenerator = motionMaster->GetMotionSlot(i);
+ if (!movementGenerator)
+ {
+ handler->SendSysMessage("Empty");
+ continue;
+ }
+
+ switch (movementGenerator->GetMovementGeneratorType())
+ {
+ case IDLE_MOTION_TYPE:
+ handler->SendSysMessage(LANG_MOVEGENS_IDLE);
+ break;
+ case RANDOM_MOTION_TYPE:
+ handler->SendSysMessage(LANG_MOVEGENS_RANDOM);
+ break;
+ case WAYPOINT_MOTION_TYPE:
+ handler->SendSysMessage(LANG_MOVEGENS_WAYPOINT);
+ break;
+ case ANIMAL_RANDOM_MOTION_TYPE:
+ handler->SendSysMessage(LANG_MOVEGENS_ANIMAL_RANDOM);
+ break;
+ case CONFUSED_MOTION_TYPE:
+ handler->SendSysMessage(LANG_MOVEGENS_CONFUSED);
+ break;
+ case CHASE_MOTION_TYPE:
+ {
+ Unit* target = NULL;
+ if (unit->GetTypeId() == TYPEID_PLAYER)
+ target = static_cast<ChaseMovementGenerator<Player> const*>(movementGenerator)->GetTarget();
+ else
+ target = static_cast<ChaseMovementGenerator<Creature> const*>(movementGenerator)->GetTarget();
+
+ if (!target)
+ handler->SendSysMessage(LANG_MOVEGENS_CHASE_NULL);
+ else if (target->GetTypeId() == TYPEID_PLAYER)
+ handler->PSendSysMessage(LANG_MOVEGENS_CHASE_PLAYER, target->GetName(), target->GetGUIDLow());
+ else
+ handler->PSendSysMessage(LANG_MOVEGENS_CHASE_CREATURE, target->GetName(), target->GetGUIDLow());
+ break;
+ }
+ case FOLLOW_MOTION_TYPE:
+ {
+ Unit* target = NULL;
+ if (unit->GetTypeId() == TYPEID_PLAYER)
+ target = static_cast<FollowMovementGenerator<Player> const*>(movementGenerator)->GetTarget();
+ else
+ target = static_cast<FollowMovementGenerator<Creature> const*>(movementGenerator)->GetTarget();
+
+ if (!target)
+ handler->SendSysMessage(LANG_MOVEGENS_FOLLOW_NULL);
+ else if (target->GetTypeId() == TYPEID_PLAYER)
+ handler->PSendSysMessage(LANG_MOVEGENS_FOLLOW_PLAYER, target->GetName(), target->GetGUIDLow());
+ else
+ handler->PSendSysMessage(LANG_MOVEGENS_FOLLOW_CREATURE, target->GetName(), target->GetGUIDLow());
+ break;
+ }
+ case HOME_MOTION_TYPE:
+ {
+ if (unit->GetTypeId() == TYPEID_UNIT)
+ handler->PSendSysMessage(LANG_MOVEGENS_HOME_CREATURE, x, y, z);
+ else
+ handler->SendSysMessage(LANG_MOVEGENS_HOME_PLAYER);
+ break;
+ }
+ case FLIGHT_MOTION_TYPE:
+ handler->SendSysMessage(LANG_MOVEGENS_FLIGHT);
+ break;
+ case POINT_MOTION_TYPE:
+ {
+ handler->PSendSysMessage(LANG_MOVEGENS_POINT, x, y, z);
+ break;
+ }
+ case FLEEING_MOTION_TYPE:
+ handler->SendSysMessage(LANG_MOVEGENS_FEAR);
+ break;
+ case DISTRACT_MOTION_TYPE:
+ handler->SendSysMessage(LANG_MOVEGENS_DISTRACT);
+ break;
+ case EFFECT_MOTION_TYPE:
+ handler->SendSysMessage(LANG_MOVEGENS_EFFECT);
+ break;
+ default:
+ handler->PSendSysMessage(LANG_MOVEGENS_UNKNOWN, movementGenerator->GetMovementGeneratorType());
+ break;
+ }
+ }
+ return true;
+ }
+ /*
+ ComeToMe command REQUIRED for 3rd party scripting library to have access to PointMovementGenerator
+ Without this function 3rd party scripting library will get linking errors (unresolved external)
+ when attempting to use the PointMovementGenerator
+ */
+ static bool HandleComeToMeCommand(ChatHandler* handler, char const* args)
+ {
+ char const* newFlagStr = strtok((char*)args, " ");
+ if (!newFlagStr)
+ return false;
+
+ Creature* caster = handler->getSelectedCreature();
+ if (!caster)
+ {
+ handler->SendSysMessage(LANG_SELECT_CREATURE);
+ handler->SetSentErrorMessage(true);
+ return false;
+ }
+
+ Player* player = handler->GetSession()->GetPlayer();
+
+ caster->GetMotionMaster()->MovePoint(0, player->GetPositionX(), player->GetPositionY(), player->GetPositionZ());
+
+ return true;
+ }
+
+ static bool HandleDamageCommand(ChatHandler* handler, char const* args)
+ {
+ if (!*args)
+ return false;
+
+ Unit* target = handler->getSelectedUnit();
+ if (!target || !handler->GetSession()->GetPlayer()->GetSelection())
+ {
+ handler->SendSysMessage(LANG_SELECT_CHAR_OR_CREATURE);
+ handler->SetSentErrorMessage(true);
+ return false;
+ }
+
+ if (target->GetTypeId() == TYPEID_PLAYER)
+ {
+ if (handler->HasLowerSecurity((Player*)target, 0, false))
+ return false;
+ }
+
+ if (!target->isAlive())
+ return true;
+
+ char* damageStr = strtok((char*)args, " ");
+ if (!damageStr)
+ return false;
+
+ int32 damage_int = atoi((char*)damageStr);
+ if (damage_int <= 0)
+ return true;
+
+ uint32 damage = damage_int;
+
+ char* schoolStr = strtok((char*)NULL, " ");
+
+ // flat melee damage without resistence/etc reduction
+ if (!schoolStr)
+ {
+ handler->GetSession()->GetPlayer()->DealDamage(target, damage, NULL, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, NULL, false);
+ if (target != handler->GetSession()->GetPlayer())
+ handler->GetSession()->GetPlayer()->SendAttackStateUpdate (HITINFO_AFFECTS_VICTIM, target, 1, SPELL_SCHOOL_MASK_NORMAL, damage, 0, 0, VICTIMSTATE_HIT, 0);
+ return true;
+ }
+
+ uint32 school = schoolStr ? atoi((char*)schoolStr) : SPELL_SCHOOL_NORMAL;
+ if (school >= MAX_SPELL_SCHOOL)
+ return false;
+
+ SpellSchoolMask schoolmask = SpellSchoolMask(1 << school);
+
+ if (Unit::IsDamageReducedByArmor(schoolmask))
+ damage = handler->GetSession()->GetPlayer()->CalcArmorReducedDamage(target, damage, NULL, BASE_ATTACK);
+
+ char* spellStr = strtok((char*)NULL, " ");
+
+ // melee damage by specific school
+ if (!spellStr)
+ {
+ uint32 absorb = 0;
+ uint32 resist = 0;
+
+ handler->GetSession()->GetPlayer()->CalcAbsorbResist(target, schoolmask, SPELL_DIRECT_DAMAGE, damage, &absorb, &resist);
+
+ if (damage <= absorb + resist)
+ return true;
+
+ damage -= absorb + resist;
+
+ handler->GetSession()->GetPlayer()->DealDamageMods(target, damage, &absorb);
+ handler->GetSession()->GetPlayer()->DealDamage(target, damage, NULL, DIRECT_DAMAGE, schoolmask, NULL, false);
+ handler->GetSession()->GetPlayer()->SendAttackStateUpdate (HITINFO_AFFECTS_VICTIM, target, 1, schoolmask, damage, absorb, resist, VICTIMSTATE_HIT, 0);
+ return true;
+ }
+
+ // non-melee damage
+
+ // number or [name] Shift-click form |color|Hspell:spell_id|h[name]|h|r or Htalent form
+ uint32 spellid = handler->extractSpellIdFromLink((char*)args);
+ if (!spellid || !sSpellMgr->GetSpellInfo(spellid))
+ return false;
+
+ handler->GetSession()->GetPlayer()->SpellNonMeleeDamageLog(target, spellid, damage);
+ return true;
+ }
+
+ static bool HandleCombatStopCommand(ChatHandler* handler, char const* args)
+ {
+ Player* target = NULL;
+
+ if (args && strlen(args) > 0)
+ {
+ target = sObjectAccessor->FindPlayerByName(args);
+ if (!target)
+ {
+ handler->SendSysMessage(LANG_PLAYER_NOT_FOUND);
+ handler->SetSentErrorMessage(true);
+ return false;
+ }
+ }
+
+ if (!target)
+ {
+ if (!handler->extractPlayerTarget((char*)args, &target))
+ return false;
+ }
+
+ // check online security
+ if (handler->HasLowerSecurity(target, 0))
+ return false;
+
+ target->CombatStop();
+ target->getHostileRefManager().deleteReferences();
+ return true;
+ }
+
+ static bool HandleFlushArenaPointsCommand(ChatHandler* /*handler*/, char const* /*args*/)
+ {
+ sArenaTeamMgr->DistributeArenaPoints();
+ return true;
+ }
+
+ static bool HandleRepairitemsCommand(ChatHandler* handler, char const* args)
+ {
+ Player* target;
+ if (!handler->extractPlayerTarget((char*)args, &target))
+ return false;
+
+ // check online security
+ if (handler->HasLowerSecurity(target, 0))
+ return false;
+
+ // Repair items
+ target->DurabilityRepairAll(false, 0, false);
+
+ handler->PSendSysMessage(LANG_YOU_REPAIR_ITEMS, handler->GetNameLink(target).c_str());
+ if (handler->needReportToTarget(target))
+ ChatHandler(target).PSendSysMessage(LANG_YOUR_ITEMS_REPAIRED, handler->GetNameLink().c_str());
+
+ return true;
+ }
+
+ // Send mail by command
+ static bool HandleSendMailCommand(ChatHandler* handler, char const* args)
+ {
+ // format: name "subject text" "mail text"
+ Player* target;
+ uint64 targetGuid;
+ std::string targetName;
+ if (!handler->extractPlayerTarget((char*)args, &target, &targetGuid, &targetName))
+ return false;
+
+ char* tail1 = strtok(NULL, "");
+ if (!tail1)
+ return false;
+
+ char const* msgSubject = handler->extractQuotedArg(tail1);
+ if (!msgSubject)
+ return false;
+
+ char* tail2 = strtok(NULL, "");
+ if (!tail2)
+ return false;
+
+ char const* msgText = handler->extractQuotedArg(tail2);
+ if (!msgText)
+ return false;
+
+ // msgSubject, msgText isn't NUL after prev. check
+ std::string subject = msgSubject;
+ std::string text = msgText;
+
+ // from console show not existed sender
+ MailSender sender(MAIL_NORMAL, handler->GetSession() ? handler->GetSession()->GetPlayer()->GetGUIDLow() : 0, MAIL_STATIONERY_GM);
+
+ //- TODO: Fix poor design
+ SQLTransaction trans = CharacterDatabase.BeginTransaction();
+ MailDraft(subject, text)
+ .SendMailTo(trans, MailReceiver(target, GUID_LOPART(targetGuid)), sender);
+
+ CharacterDatabase.CommitTransaction(trans);
+
+ std::string nameLink = handler->playerLink(targetName);
+ handler->PSendSysMessage(LANG_MAIL_SENT, nameLink.c_str());
+ return true;
+ }
+ // Send items by mail
+ static bool HandleSendItemsCommand(ChatHandler* handler, char const* args)
+ {
+ // format: name "subject text" "mail text" item1[:count1] item2[:count2] ... item12[:count12]
+ Player* receiver;
+ uint64 receiverGuid;
+ std::string receiverName;
+ if (!handler->extractPlayerTarget((char*)args, &receiver, &receiverGuid, &receiverName))
+ return false;
+
+ char* tail1 = strtok(NULL, "");
+ if (!tail1)
+ return false;
+
+ char const* msgSubject = handler->extractQuotedArg(tail1);
+ if (!msgSubject)
+ return false;
+
+ char* tail2 = strtok(NULL, "");
+ if (!tail2)
+ return false;
+
+ char const* msgText = handler->extractQuotedArg(tail2);
+ if (!msgText)
+ return false;
+
+ // msgSubject, msgText isn't NUL after prev. check
+ std::string subject = msgSubject;
+ std::string text = msgText;
+
+ // extract items
+ typedef std::pair<uint32, uint32> ItemPair;
+ typedef std::list< ItemPair > ItemPairs;
+ ItemPairs items;
+
+ // get all tail string
+ char* tail = strtok(NULL, "");
+
+ // get from tail next item str
+ while (char* itemStr = strtok(tail, " "))
+ {
+ // and get new tail
+ tail = strtok(NULL, "");
+
+ // parse item str
+ char const* itemIdStr = strtok(itemStr, ":");
+ char const* itemCountStr = strtok(NULL, " ");
+
+ uint32 itemId = atoi(itemIdStr);
+ if (!itemId)
+ return false;
+
+ ItemTemplate const* item_proto = sObjectMgr->GetItemTemplate(itemId);
+ if (!item_proto)
+ {
+ handler->PSendSysMessage(LANG_COMMAND_ITEMIDINVALID, itemId);
+ handler->SetSentErrorMessage(true);
+ return false;
+ }
+
+ uint32 itemCount = itemCountStr ? atoi(itemCountStr) : 1;
+ if (itemCount < 1 || (item_proto->MaxCount > 0 && itemCount > uint32(item_proto->MaxCount)))
+ {
+ handler->PSendSysMessage(LANG_COMMAND_INVALID_ITEM_COUNT, itemCount, itemId);
+ handler->SetSentErrorMessage(true);
+ return false;
+ }
+
+ while (itemCount > item_proto->GetMaxStackSize())
+ {
+ items.push_back(ItemPair(itemId, item_proto->GetMaxStackSize()));
+ itemCount -= item_proto->GetMaxStackSize();
+ }
+
+ items.push_back(ItemPair(itemId, itemCount));
+
+ if (items.size() > MAX_MAIL_ITEMS)
+ {
+ handler->PSendSysMessage(LANG_COMMAND_MAIL_ITEMS_LIMIT, MAX_MAIL_ITEMS);
+ handler->SetSentErrorMessage(true);
+ return false;
+ }
+ }
+
+ // from console show not existed sender
+ MailSender sender(MAIL_NORMAL, handler->GetSession() ? handler->GetSession()->GetPlayer()->GetGUIDLow() : 0, MAIL_STATIONERY_GM);
+
+ // fill mail
+ MailDraft draft(subject, text);
+
+ SQLTransaction trans = CharacterDatabase.BeginTransaction();
+
+ for (ItemPairs::const_iterator itr = items.begin(); itr != items.end(); ++itr)
+ {
+ if (Item* item = Item::CreateItem(itr->first, itr->second, handler->GetSession() ? handler->GetSession()->GetPlayer() : 0))
+ {
+ item->SaveToDB(trans); // save for prevent lost at next mail load, if send fail then item will deleted
+ draft.AddItem(item);
+ }
+ }
+
+ draft.SendMailTo(trans, MailReceiver(receiver, GUID_LOPART(receiverGuid)), sender);
+ CharacterDatabase.CommitTransaction(trans);
+
+ std::string nameLink = handler->playerLink(receiverName);
+ handler->PSendSysMessage(LANG_MAIL_SENT, nameLink.c_str());
+ return true;
+ }
+ /// Send money by mail
+ static bool HandleSendMoneyCommand(ChatHandler* handler, char const* args)
+ {
+ /// format: name "subject text" "mail text" money
+
+ Player* receiver;
+ uint64 receiverGuid;
+ std::string receiverName;
+ if (!handler->extractPlayerTarget((char*)args, &receiver, &receiverGuid, &receiverName))
+ return false;
+
+ char* tail1 = strtok(NULL, "");
+ if (!tail1)
+ return false;
+
+ char* msgSubject = handler->extractQuotedArg(tail1);
+ if (!msgSubject)
+ return false;
+
+ char* tail2 = strtok(NULL, "");
+ if (!tail2)
+ return false;
+
+ char* msgText = handler->extractQuotedArg(tail2);
+ if (!msgText)
+ return false;
+
+ char* moneyStr = strtok(NULL, "");
+ int32 money = moneyStr ? atoi(moneyStr) : 0;
+ if (money <= 0)
+ return false;
+
+ // msgSubject, msgText isn't NUL after prev. check
+ std::string subject = msgSubject;
+ std::string text = msgText;
+
+ // from console show not existed sender
+ MailSender sender(MAIL_NORMAL, handler->GetSession() ? handler->GetSession()->GetPlayer()->GetGUIDLow() : 0, MAIL_STATIONERY_GM);
+
+ SQLTransaction trans = CharacterDatabase.BeginTransaction();
+
+ MailDraft(subject, text)
+ .AddMoney(money)
+ .SendMailTo(trans, MailReceiver(receiver, GUID_LOPART(receiverGuid)), sender);
+
+ CharacterDatabase.CommitTransaction(trans);
+
+ std::string nameLink = handler->playerLink(receiverName);
+ handler->PSendSysMessage(LANG_MAIL_SENT, nameLink.c_str());
+ return true;
+ }
+ /// Send a message to a player in game
+ static bool HandleSendMessageCommand(ChatHandler* handler, char const* args)
+ {
+ /// - Find the player
+ Player* player;
+ if (!handler->extractPlayerTarget((char*)args, &player))
+ return false;
+
+ char* msgStr = strtok(NULL, "");
+ if (!msgStr)
+ return false;
+
+ ///- Check that he is not logging out.
+ if (player->GetSession()->isLogingOut())
+ {
+ handler->SendSysMessage(LANG_PLAYER_NOT_FOUND);
+ handler->SetSentErrorMessage(true);
+ return false;
+ }
+
+ /// - Send the message
+ // Use SendAreaTriggerMessage for fastest delivery.
+ player->GetSession()->SendAreaTriggerMessage("%s", msgStr);
+ player->GetSession()->SendAreaTriggerMessage("|cffff0000[Message from administrator]:|r");
+
+ // Confirmation message
+ std::string nameLink = handler->GetNameLink(player);
+ handler->PSendSysMessage(LANG_SENDMESSAGE, nameLink.c_str(), msgStr);
+
+ return true;
+ }
+
+ static bool HandleCreatePetCommand(ChatHandler* handler, char const* /*args*/)
+ {
+ Player* player = handler->GetSession()->GetPlayer();
+ Creature* creatureTarget = handler->getSelectedCreature();
+
+ if (!creatureTarget || creatureTarget->isPet() || creatureTarget->GetTypeId() == TYPEID_PLAYER)
+ {
+ handler->PSendSysMessage(LANG_SELECT_CREATURE);
+ handler->SetSentErrorMessage(true);
+ return false;
+ }
+
+ CreatureTemplate const* creatrueTemplate = sObjectMgr->GetCreatureTemplate(creatureTarget->GetEntry());
+ // Creatures with family 0 crashes the server
+ if (!creatrueTemplate->family)
+ {
+ handler->PSendSysMessage("This creature cannot be tamed. (family id: 0).");
+ handler->SetSentErrorMessage(true);
+ return false;
+ }
+
+ if (player->GetPetGUID())
+ {
+ handler->PSendSysMessage("You already have a pet");
+ handler->SetSentErrorMessage(true);
+ return false;
+ }
+
+ // Everything looks OK, create new pet
+ Pet* pet = new Pet(player, HUNTER_PET);
+ if (!pet->CreateBaseAtCreature(creatureTarget))
+ {
+ delete pet;
+ handler->PSendSysMessage("Error 1");
+ return false;
+ }
+
+ creatureTarget->setDeathState(JUST_DIED);
+ creatureTarget->RemoveCorpse();
+ creatureTarget->SetHealth(0); // just for nice GM-mode view
+
+ pet->SetUInt64Value(UNIT_FIELD_CREATEDBY, player->GetGUID());
+ pet->SetUInt32Value(UNIT_FIELD_FACTIONTEMPLATE, player->getFaction());
+
+ if (!pet->InitStatsForLevel(creatureTarget->getLevel()))
+ {
+ sLog->outError(LOG_FILTER_GENERAL, "InitStatsForLevel() in EffectTameCreature failed! Pet deleted.");
+ handler->PSendSysMessage("Error 2");
+ delete pet;
+ return false;
+ }
+
+ // prepare visual effect for levelup
+ pet->SetUInt32Value(UNIT_FIELD_LEVEL, creatureTarget->getLevel()-1);
+
+ pet->GetCharmInfo()->SetPetNumber(sObjectMgr->GeneratePetNumber(), true);
+ // this enables pet details window (Shift+P)
+ pet->InitPetCreateSpells();
+ pet->SetFullHealth();
+
+ pet->GetMap()->AddToMap(pet->ToCreature());
+
+ // visual effect for levelup
+ pet->SetUInt32Value(UNIT_FIELD_LEVEL, creatureTarget->getLevel());
+
+ player->SetMinion(pet, true);
+ pet->SavePetToDB(PET_SAVE_AS_CURRENT);
+ player->PetSpellInitialize();
+
+ return true;
+ }
+
+ static bool HandlePetLearnCommand(ChatHandler* handler, char const* args)
+ {
+ if (!*args)
+ return false;
+
+ Player* player = handler->GetSession()->GetPlayer();
+ Pet* pet = player->GetPet();
+
+ if (!pet)
+ {
+ handler->PSendSysMessage("You have no pet");
+ handler->SetSentErrorMessage(true);
+ return false;
+ }
+
+ uint32 spellId = handler->extractSpellIdFromLink((char*)args);
+
+ if (!spellId || !sSpellMgr->GetSpellInfo(spellId))
+ return false;
+
+ // Check if pet already has it
+ if (pet->HasSpell(spellId))
+ {
+ handler->PSendSysMessage("Pet already has spell: %u", spellId);
+ handler->SetSentErrorMessage(true);
+ return false;
+ }
+
+ // Check if spell is valid
+ SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(spellId);
+ if (!spellInfo || !SpellMgr::IsSpellValid(spellInfo))
+ {
+ handler->PSendSysMessage(LANG_COMMAND_SPELL_BROKEN, spellId);
+ handler->SetSentErrorMessage(true);
+ return false;
+ }
+
+ pet->learnSpell(spellId);
+
+ handler->PSendSysMessage("Pet has learned spell %u", spellId);
+ return true;
+ }
+
+ static bool HandlePetUnlearnCommand(ChatHandler* handler, char const* args)
+ {
+ if (!*args)
+ return false;
+
+ Player* player = handler->GetSession()->GetPlayer();
+ Pet* pet = player->GetPet();
+ if (!pet)
+ {
+ handler->PSendSysMessage("You have no pet");
+ handler->SetSentErrorMessage(true);
+ return false;
+ }
+
+ uint32 spellId = handler->extractSpellIdFromLink((char*)args);
+
+ if (pet->HasSpell(spellId))
+ pet->removeSpell(spellId, false);
+ else
+ handler->PSendSysMessage("Pet doesn't have that spell");
+
+ return true;
+ }
+
+ static bool HandleFreezeCommand(ChatHandler* handler, char const* args)
+ {
+ std::string name;
+ Player* player;
+ char const* TargetName = strtok((char*)args, " "); // get entered name
+ if (!TargetName) // if no name entered use target
+ {
+ player = handler->getSelectedPlayer();
+ if (player) //prevent crash with creature as target
+ {
+ name = player->GetName();
+ normalizePlayerName(name);
+ }
+ }
+ else // if name entered
+ {
+ name = TargetName;
+ normalizePlayerName(name);
+ player = sObjectAccessor->FindPlayerByName(name.c_str());
+ }
+
+ if (!player)
+ {
+ handler->SendSysMessage(LANG_COMMAND_FREEZE_WRONG);
+ return true;
+ }
+
+ if (player == handler->GetSession()->GetPlayer())
+ {
+ handler->SendSysMessage(LANG_COMMAND_FREEZE_ERROR);
+ return true;
+ }
+
+ // effect
+ if (player && (player != handler->GetSession()->GetPlayer()))
+ {
+ handler->PSendSysMessage(LANG_COMMAND_FREEZE, name.c_str());
+
+ // stop combat + make player unattackable + duel stop + stop some spells
+ player->setFaction(35);
+ player->CombatStop();
+ if (player->IsNonMeleeSpellCasted(true))
+ player->InterruptNonMeleeSpells(true);
+ player->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE);
+
+ // if player class = hunter || warlock remove pet if alive
+ if ((player->getClass() == CLASS_HUNTER) || (player->getClass() == CLASS_WARLOCK))
+ {
+ if (Pet* pet = player->GetPet())
+ {
+ pet->SavePetToDB(PET_SAVE_AS_CURRENT);
+ // not let dismiss dead pet
+ if (pet && pet->isAlive())
+ player->RemovePet(pet, PET_SAVE_NOT_IN_SLOT);
+ }
+ }
+
+ if (SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(9454))
+ Aura::TryRefreshStackOrCreate(spellInfo, MAX_EFFECT_MASK, player, player);
+
+ // save player
+ player->SaveToDB();
+ }
+
+ return true;
+ }
+
+ static bool HandleUnFreezeCommand(ChatHandler* handler, char const*args)
+ {
+ std::string name;
+ Player* player;
+ char* targetName = strtok((char*)args, " "); // Get entered name
+
+ if (targetName)
+ {
+ name = targetName;
+ normalizePlayerName(name);
+ player = sObjectAccessor->FindPlayerByName(name.c_str());
+ }
+ else // If no name was entered - use target
+ {
+ player = handler->getSelectedPlayer();
+ if (player)
+ name = player->GetName();
+ }
+
+ if (player)
+ {
+ handler->PSendSysMessage(LANG_COMMAND_UNFREEZE, name.c_str());
+
+ // Reset player faction + allow combat + allow duels
+ player->setFactionForRace(player->getRace());
+ player->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE);
+
+ // Remove Freeze spell (allowing movement and spells)
+ player->RemoveAurasDueToSpell(9454);
+
+ // Save player
+ player->SaveToDB();
+ }
+ else
+ {
+ if (targetName)
+ {
+ // Check for offline players
+ PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_CHAR_GUID_BY_NAME);
+ stmt->setString(0, name);
+ PreparedQueryResult result = CharacterDatabase.Query(stmt);
+
+ if (!result)
+ {
+ handler->SendSysMessage(LANG_COMMAND_FREEZE_WRONG);
+ return true;
+ }
+
+ // If player found: delete his freeze aura
+ Field* fields = result->Fetch();
+ uint32 lowGuid = fields[0].GetUInt32();
+
+ stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_CHAR_AURA_FROZEN);
+ stmt->setUInt32(0, lowGuid);
+ CharacterDatabase.Execute(stmt);
+
+ handler->PSendSysMessage(LANG_COMMAND_UNFREEZE, name.c_str());
+ return true;
+ }
+ else
+ {
+ handler->SendSysMessage(LANG_COMMAND_FREEZE_WRONG);
+ return true;
+ }
+ }
+
+ return true;
+ }
+
+ static bool HandleListFreezeCommand(ChatHandler* handler, char const* /*args*/)
+ {
+ // Get names from DB
+ PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_CHARACTER_AURA_FROZEN);
+ PreparedQueryResult result = CharacterDatabase.Query(stmt);
+ if (!result)
+ {
+ handler->SendSysMessage(LANG_COMMAND_NO_FROZEN_PLAYERS);
+ return true;
+ }
+
+ // Header of the names
+ handler->PSendSysMessage(LANG_COMMAND_LIST_FREEZE);
+
+ // Output of the results
+ do
+ {
+ Field* fields = result->Fetch();
+ std::string player = fields[0].GetString();
+ handler->PSendSysMessage(LANG_COMMAND_FROZEN_PLAYERS, player.c_str());
+ }
+ while (result->NextRow());
+
+ return true;
+ }
+
+ static bool HandleGroupLeaderCommand(ChatHandler* handler, char const* args)
+ {
+ Player* player = NULL;
+ Group* group = NULL;
+ uint64 guid = 0;
+ char* nameStr = strtok((char*)args, " ");
+
+ if (handler->GetPlayerGroupAndGUIDByName(nameStr, player, group, guid))
+ if (group && group->GetLeaderGUID() != guid)
+ {
+ group->ChangeLeader(guid);
+ group->SendUpdate();
+ }
+
+ return true;
+ }
+
+ static bool HandleGroupDisbandCommand(ChatHandler* handler, char const* args)
+ {
+ Player* player = NULL;
+ Group* group = NULL;
+ uint64 guid = 0;
+ char* nameStr = strtok((char*)args, " ");
+
+ if (handler->GetPlayerGroupAndGUIDByName(nameStr, player, group, guid))
+ if (group)
+ group->Disband();
+
+ return true;
+ }
+
+ static bool HandleGroupRemoveCommand(ChatHandler* handler, char const* args)
+ {
+ Player* player = NULL;
+ Group* group = NULL;
+ uint64 guid = 0;
+ char* nameStr = strtok((char*)args, " ");
+
+ if (handler->GetPlayerGroupAndGUIDByName(nameStr, player, group, guid, true))
+ if (group)
+ group->RemoveMember(guid);
+
+ return true;
+ }
+
+ static bool HandlePlayAllCommand(ChatHandler* handler, char const* args)
+ {
+ if (!*args)
+ return false;
+
+ uint32 soundId = atoi((char*)args);
+
+ if (!sSoundEntriesStore.LookupEntry(soundId))
+ {
+ handler->PSendSysMessage(LANG_SOUND_NOT_EXIST, soundId);
+ handler->SetSentErrorMessage(true);
+ return false;
+ }
+
+ WorldPacket data(SMSG_PLAY_SOUND, 4);
+ data << uint32(soundId) << handler->GetSession()->GetPlayer()->GetGUID();
+ sWorld->SendGlobalMessage(&data);
+
+ handler->PSendSysMessage(LANG_COMMAND_PLAYED_TO_ALL, soundId);
+ return true;
+ }
+
+ static bool HandlePossessCommand(ChatHandler* handler, char const* /*args*/)
+ {
+ Unit* unit = handler->getSelectedUnit();
+ if (!unit)
+ return false;
+
+ handler->GetSession()->GetPlayer()->CastSpell(unit, 530, true);
+ return true;
+ }
+
+ static bool HandleUnPossessCommand(ChatHandler* handler, char const* /*args*/)
+ {
+ Unit* unit = handler->getSelectedUnit();
+ if (!unit)
+ unit = handler->GetSession()->GetPlayer();
+
+ unit->RemoveCharmAuras();
+
+ return true;
+ }
+
+ static bool HandleBindSightCommand(ChatHandler* handler, char const* /*args*/)
+ {
+ Unit* unit = handler->getSelectedUnit();
+ if (!unit)
+ return false;
+
+ handler->GetSession()->GetPlayer()->CastSpell(unit, 6277, true);
+ return true;
+ }
+
+ static bool HandleUnbindSightCommand(ChatHandler* handler, char const* /*args*/)
+ {
+ Player* player = handler->GetSession()->GetPlayer();
+
+ if (player->isPossessing())
+ return false;
+
+ player->StopCastingBindSight();
+ return true;
+ }
+};
+
+void AddSC_misc_commandscript()
+{
+ new misc_commandscript();
+}
diff --git a/src/server/scripts/Commands/cs_modify.cpp b/src/server/scripts/Commands/cs_modify.cpp
index 1747b80efd5..a88c765c596 100644
--- a/src/server/scripts/Commands/cs_modify.cpp
+++ b/src/server/scripts/Commands/cs_modify.cpp
@@ -1130,20 +1130,15 @@ public:
static bool HandleModifyDrunkCommand(ChatHandler* handler, const char* args)
{
- if (!*args) return false;
+ if (!*args)
+ return false;
- uint32 drunklevel = (uint32)atoi(args);
+ uint8 drunklevel = (uint8)atoi(args);
if (drunklevel > 100)
drunklevel = 100;
- uint16 drunkMod = drunklevel * 0xFFFF / 100;
-
- Player* target = handler->getSelectedPlayer();
- if (!target)
- target = handler->GetSession()->GetPlayer();
-
- if (target)
- target->SetDrunkValue(drunkMod);
+ if (Player* target = handler->getSelectedPlayer())
+ target->SetDrunkValue(drunklevel);
return true;
}
diff --git a/src/server/scripts/Commands/cs_quest.cpp b/src/server/scripts/Commands/cs_quest.cpp
index 2472a29e595..7e489a5781e 100644
--- a/src/server/scripts/Commands/cs_quest.cpp
+++ b/src/server/scripts/Commands/cs_quest.cpp
@@ -38,6 +38,7 @@ public:
{ "add", SEC_ADMINISTRATOR, false, &HandleQuestAdd, "", NULL },
{ "complete", SEC_ADMINISTRATOR, false, &HandleQuestComplete, "", NULL },
{ "remove", SEC_ADMINISTRATOR, false, &HandleQuestRemove, "", NULL },
+ { "reward", SEC_ADMINISTRATOR, false, &HandleQuestReward, "", NULL },
{ NULL, 0, false, NULL, "", NULL }
};
static ChatCommand commandTable[] =
@@ -77,7 +78,7 @@ public:
// check item starting quest (it can work incorrectly if added without item in inventory)
ItemTemplateContainer const* itc = sObjectMgr->GetItemTemplateStore();
- ItemTemplateContainer::const_iterator result = find_if (itc->begin(), itc->end(), Finder<uint32, ItemTemplate>(entry, &ItemTemplate::StartQuest));
+ ItemTemplateContainer::const_iterator result = find_if(itc->begin(), itc->end(), Finder<uint32, ItemTemplate>(entry, &ItemTemplate::StartQuest));
if (result != itc->end())
{
@@ -244,6 +245,38 @@ public:
player->CompleteQuest(entry);
return true;
}
+
+ static bool HandleQuestReward(ChatHandler* handler, char const* args)
+ {
+ Player* player = handler->getSelectedPlayer();
+ if (!player)
+ {
+ handler->SendSysMessage(LANG_NO_CHAR_SELECTED);
+ handler->SetSentErrorMessage(true);
+ return false;
+ }
+
+ // .quest reward #entry
+ // number or [name] Shift-click form |color|Hquest:quest_id:quest_level|h[name]|h|r
+ char* cId = handler->extractKeyFromLink((char*)args, "Hquest");
+ if (!cId)
+ return false;
+
+ uint32 entry = atol(cId);
+
+ Quest const* quest = sObjectMgr->GetQuestTemplate(entry);
+
+ // If player doesn't have the quest
+ if (!quest || player->GetQuestStatus(entry) != QUEST_STATUS_COMPLETE)
+ {
+ handler->PSendSysMessage(LANG_COMMAND_QUEST_NOTFOUND, entry);
+ handler->SetSentErrorMessage(true);
+ return false;
+ }
+
+ player->RewardQuest(quest, 0, player);
+ return true;
+ }
};
void AddSC_quest_commandscript()
diff --git a/src/server/scripts/Commands/cs_reload.cpp b/src/server/scripts/Commands/cs_reload.cpp
index c8568feaeb6..7d2a4304054 100644
--- a/src/server/scripts/Commands/cs_reload.cpp
+++ b/src/server/scripts/Commands/cs_reload.cpp
@@ -467,56 +467,57 @@ public:
cInfo->rangeattacktime = fields[29].GetUInt32();
cInfo->unit_class = fields[30].GetUInt8();
cInfo->unit_flags = fields[31].GetUInt32();
- cInfo->dynamicflags = fields[32].GetUInt32();
- cInfo->family = fields[33].GetUInt8();
- cInfo->trainer_type = fields[34].GetUInt8();
- cInfo->trainer_spell = fields[35].GetUInt32();
- cInfo->trainer_class = fields[36].GetUInt8();
- cInfo->trainer_race = fields[37].GetUInt8();
- cInfo->minrangedmg = fields[38].GetFloat();
- cInfo->maxrangedmg = fields[39].GetFloat();
- cInfo->rangedattackpower = fields[40].GetUInt16();
- cInfo->type = fields[41].GetUInt8();
- cInfo->type_flags = fields[42].GetUInt32();
- cInfo->lootid = fields[43].GetUInt32();
- cInfo->pickpocketLootId = fields[44].GetUInt32();
- cInfo->SkinLootId = fields[45].GetUInt32();
+ cInfo->unit_flags2 = fields[32].GetUInt32();
+ cInfo->dynamicflags = fields[33].GetUInt32();
+ cInfo->family = fields[34].GetUInt8();
+ cInfo->trainer_type = fields[35].GetUInt8();
+ cInfo->trainer_spell = fields[36].GetUInt32();
+ cInfo->trainer_class = fields[37].GetUInt8();
+ cInfo->trainer_race = fields[38].GetUInt8();
+ cInfo->minrangedmg = fields[39].GetFloat();
+ cInfo->maxrangedmg = fields[40].GetFloat();
+ cInfo->rangedattackpower = fields[41].GetUInt16();
+ cInfo->type = fields[42].GetUInt8();
+ cInfo->type_flags = fields[43].GetUInt32();
+ cInfo->lootid = fields[44].GetUInt32();
+ cInfo->pickpocketLootId = fields[45].GetUInt32();
+ cInfo->SkinLootId = fields[46].GetUInt32();
for (uint8 i = SPELL_SCHOOL_HOLY; i < MAX_SPELL_SCHOOL; ++i)
- cInfo->resistance[i] = fields[46 + i -1].GetUInt16();
-
- cInfo->spells[0] = fields[52].GetUInt32();
- cInfo->spells[1] = fields[53].GetUInt32();
- cInfo->spells[2] = fields[54].GetUInt32();
- cInfo->spells[3] = fields[55].GetUInt32();
- cInfo->spells[4] = fields[56].GetUInt32();
- cInfo->spells[5] = fields[57].GetUInt32();
- cInfo->spells[6] = fields[58].GetUInt32();
- cInfo->spells[7] = fields[59].GetUInt32();
- cInfo->PetSpellDataId = fields[60].GetUInt32();
- cInfo->VehicleId = fields[61].GetUInt32();
- cInfo->mingold = fields[62].GetUInt32();
- cInfo->maxgold = fields[63].GetUInt32();
- cInfo->AIName = fields[64].GetString();
- cInfo->MovementType = fields[65].GetUInt8();
- cInfo->InhabitType = fields[66].GetUInt8();
- cInfo->HoverHeight = fields[67].GetFloat();
- cInfo->ModHealth = fields[68].GetFloat();
- cInfo->ModMana = fields[69].GetFloat();
- cInfo->ModArmor = fields[70].GetFloat();
- cInfo->RacialLeader = fields[71].GetBool();
- cInfo->questItems[0] = fields[72].GetUInt32();
- cInfo->questItems[1] = fields[73].GetUInt32();
- cInfo->questItems[2] = fields[74].GetUInt32();
- cInfo->questItems[3] = fields[75].GetUInt32();
- cInfo->questItems[4] = fields[76].GetUInt32();
- cInfo->questItems[5] = fields[77].GetUInt32();
- cInfo->movementId = fields[78].GetUInt32();
- cInfo->RegenHealth = fields[79].GetBool();
- cInfo->equipmentId = fields[80].GetUInt32();
- cInfo->MechanicImmuneMask = fields[81].GetUInt32();
- cInfo->flags_extra = fields[82].GetUInt32();
- cInfo->ScriptID = sObjectMgr->GetScriptId(fields[83].GetCString());
+ cInfo->resistance[i] = fields[47 + i -1].GetUInt16();
+
+ cInfo->spells[0] = fields[53].GetUInt32();
+ cInfo->spells[1] = fields[54].GetUInt32();
+ cInfo->spells[2] = fields[55].GetUInt32();
+ cInfo->spells[3] = fields[56].GetUInt32();
+ cInfo->spells[4] = fields[57].GetUInt32();
+ cInfo->spells[5] = fields[58].GetUInt32();
+ cInfo->spells[6] = fields[59].GetUInt32();
+ cInfo->spells[7] = fields[60].GetUInt32();
+ cInfo->PetSpellDataId = fields[61].GetUInt32();
+ cInfo->VehicleId = fields[62].GetUInt32();
+ cInfo->mingold = fields[63].GetUInt32();
+ cInfo->maxgold = fields[64].GetUInt32();
+ cInfo->AIName = fields[65].GetString();
+ cInfo->MovementType = fields[66].GetUInt8();
+ cInfo->InhabitType = fields[67].GetUInt8();
+ cInfo->HoverHeight = fields[68].GetFloat();
+ cInfo->ModHealth = fields[69].GetFloat();
+ cInfo->ModMana = fields[70].GetFloat();
+ cInfo->ModArmor = fields[71].GetFloat();
+ cInfo->RacialLeader = fields[72].GetBool();
+ cInfo->questItems[0] = fields[73].GetUInt32();
+ cInfo->questItems[1] = fields[74].GetUInt32();
+ cInfo->questItems[2] = fields[75].GetUInt32();
+ cInfo->questItems[3] = fields[76].GetUInt32();
+ cInfo->questItems[4] = fields[77].GetUInt32();
+ cInfo->questItems[5] = fields[78].GetUInt32();
+ cInfo->movementId = fields[79].GetUInt32();
+ cInfo->RegenHealth = fields[80].GetBool();
+ cInfo->equipmentId = fields[81].GetUInt32();
+ cInfo->MechanicImmuneMask = fields[82].GetUInt32();
+ cInfo->flags_extra = fields[83].GetUInt32();
+ cInfo->ScriptID = sObjectMgr->GetScriptId(fields[84].GetCString());
sObjectMgr->CheckCreatureTemplate(cInfo);
}
@@ -949,7 +950,7 @@ public:
static bool HandleReloadItemSetNamesCommand(ChatHandler* handler, const char* /*args*/)
{
sLog->outInfo(LOG_FILTER_GENERAL, "Re-Loading Item set names...");
- LoadRandomEnchantmentsTable();
+ sObjectMgr->LoadItemSetNames();
handler->SendGlobalGMSysMessage("DB table `item_set_names` reloaded.");
return true;
}
diff --git a/src/server/scripts/Commands/cs_wp.cpp b/src/server/scripts/Commands/cs_wp.cpp
index 99ec263b8f9..e3cd185e4a3 100644
--- a/src/server/scripts/Commands/cs_wp.cpp
+++ b/src/server/scripts/Commands/cs_wp.cpp
@@ -642,19 +642,13 @@ public:
{
handler->PSendSysMessage("|cff00ff00DEBUG: wp modify del, PathID: |r|cff00ffff%u|r", pathid);
- // wpCreature
- Creature* wpCreature = NULL;
-
if (wpGuid != 0)
- {
- wpCreature = handler->GetSession()->GetPlayer()->GetMap()->GetCreature(MAKE_NEW_GUID(wpGuid, VISUAL_WAYPOINT, HIGHGUID_UNIT));
- if (wpCreature)
+ if (Creature* wpCreature = handler->GetSession()->GetPlayer()->GetMap()->GetCreature(MAKE_NEW_GUID(wpGuid, VISUAL_WAYPOINT, HIGHGUID_UNIT)))
{
wpCreature->CombatStop();
wpCreature->DeleteFromDB();
wpCreature->AddObjectToRemoveList();
}
- }
PreparedStatement* stmt = WorldDatabase.GetPreparedStatement(WORLD_DEL_WAYPOINT_DATA);
@@ -681,15 +675,12 @@ public:
Player* chr = handler->GetSession()->GetPlayer();
Map* map = chr->GetMap();
{
- // wpCreature
- Creature* wpCreature = NULL;
// What to do:
// Move the visual spawnpoint
// Respawn the owner of the waypoints
if (wpGuid != 0)
{
- wpCreature = map->GetCreature(MAKE_NEW_GUID(wpGuid, VISUAL_WAYPOINT, HIGHGUID_UNIT));
- if (wpCreature)
+ if (Creature* wpCreature = map->GetCreature(MAKE_NEW_GUID(wpGuid, VISUAL_WAYPOINT, HIGHGUID_UNIT)))
{
wpCreature->CombatStop();
wpCreature->DeleteFromDB();
diff --git a/src/server/scripts/EasternKingdoms/BlackwingLair/boss_chromaggus.cpp b/src/server/scripts/EasternKingdoms/BlackwingLair/boss_chromaggus.cpp
index 204fbe5223b..25c3f2e41e3 100644
--- a/src/server/scripts/EasternKingdoms/BlackwingLair/boss_chromaggus.cpp
+++ b/src/server/scripts/EasternKingdoms/BlackwingLair/boss_chromaggus.cpp
@@ -243,11 +243,9 @@ public:
std::list<HostileReference*> threatlist = me->getThreatManager().getThreatList();
for (std::list<HostileReference*>::const_iterator i = threatlist.begin(); i != threatlist.end(); ++i)
{
- Unit* unit;
if ((*i) && (*i)->getSource())
{
- unit = Unit::GetUnit(*me, (*i)->getUnitGuid());
- if (unit)
+ if (Unit* unit = Unit::GetUnit(*me, (*i)->getUnitGuid()))
{
//Cast affliction
DoCast(unit, RAND(SPELL_BROODAF_BLUE, SPELL_BROODAF_BLACK,
diff --git a/src/server/scripts/EasternKingdoms/Karazhan/boss_moroes.cpp b/src/server/scripts/EasternKingdoms/Karazhan/boss_moroes.cpp
index bc29a6f1f3c..533a1aac2f0 100644
--- a/src/server/scripts/EasternKingdoms/Karazhan/boss_moroes.cpp
+++ b/src/server/scripts/EasternKingdoms/Karazhan/boss_moroes.cpp
@@ -75,8 +75,8 @@ public:
{
boss_moroesAI(Creature* creature) : ScriptedAI(creature)
{
- for (uint8 i = 0; i < 4; ++i)
- AddId[i] = 0;
+ memset(AddId, 0, sizeof(AddId));
+ memset(AddGUID, 0, sizeof(AddGUID));
instance = creature->GetInstanceScript();
}
@@ -105,10 +105,8 @@ public:
Enrage = false;
InVanish = false;
- if (me->GetHealth() > 0)
- {
+ if (me->GetHealth())
SpawnAdds();
- }
if (instance)
instance->SetData(TYPE_MOROES, NOT_STARTED);
@@ -193,10 +191,9 @@ public:
bool isAddlistEmpty()
{
for (uint8 i = 0; i < 4; ++i)
- {
if (AddId[i] == 0)
return true;
- }
+
return false;
}
@@ -204,12 +201,11 @@ public:
{
for (uint8 i = 0; i < 4; ++i)
{
- Creature* Temp = NULL;
if (AddGUID[i])
{
- Temp = Creature::GetCreature((*me), AddGUID[i]);
- if (Temp && Temp->isAlive())
- Temp->DisappearAndDie();
+ Creature* temp = Creature::GetCreature((*me), AddGUID[i]);
+ if (temp && temp->isAlive())
+ temp->DisappearAndDie();
}
}
}
@@ -218,14 +214,13 @@ public:
{
for (uint8 i = 0; i < 4; ++i)
{
- Creature* Temp = NULL;
if (AddGUID[i])
{
- Temp = Creature::GetCreature((*me), AddGUID[i]);
- if (Temp && Temp->isAlive())
+ Creature* temp = Creature::GetCreature((*me), AddGUID[i]);
+ if (temp && temp->isAlive())
{
- Temp->AI()->AttackStart(me->getVictim());
- DoZoneInCombat(Temp);
+ temp->AI()->AttackStart(me->getVictim());
+ DoZoneInCombat(temp);
} else
EnterEvadeMode();
}
@@ -253,13 +248,12 @@ public:
{
for (uint8 i = 0; i < 4; ++i)
{
- Creature* Temp = NULL;
if (AddGUID[i])
{
- Temp = Unit::GetCreature((*me), AddGUID[i]);
- if (Temp && Temp->isAlive())
- if (!Temp->getVictim())
- Temp->AI()->AttackStart(me->getVictim());
+ Creature* temp = Unit::GetCreature((*me), AddGUID[i]);
+ if (temp && temp->isAlive())
+ if (!temp->getVictim())
+ temp->AI()->AttackStart(me->getVictim());
}
}
CheckAdds_Timer = 5000;
@@ -341,17 +335,10 @@ struct boss_moroes_guestAI : public ScriptedAI
if (!instance)
return;
- uint64 MoroesGUID = instance->GetData64(DATA_MOROES);
- Creature* Moroes = (Unit::GetCreature((*me), MoroesGUID));
- if (Moroes)
- {
+ if (Creature* Moroes = Unit::GetCreature(*me, instance->GetData64(DATA_MOROES)))
for (uint8 i = 0; i < 4; ++i)
- {
- uint64 GUID = CAST_AI(boss_moroes::boss_moroesAI, Moroes->AI())->AddGUID[i];
- if (GUID)
+ if (uint64 GUID = CAST_AI(boss_moroes::boss_moroesAI, Moroes->AI())->AddGUID[i])
GuestGUID[i] = GUID;
- }
- }
}
Unit* SelectGuestTarget()
diff --git a/src/server/scripts/EasternKingdoms/Karazhan/boss_prince_malchezaar.cpp b/src/server/scripts/EasternKingdoms/Karazhan/boss_prince_malchezaar.cpp
index 1ed4da1f25e..f4195620dda 100644
--- a/src/server/scripts/EasternKingdoms/Karazhan/boss_prince_malchezaar.cpp
+++ b/src/server/scripts/EasternKingdoms/Karazhan/boss_prince_malchezaar.cpp
@@ -187,6 +187,7 @@ public:
boss_malchezaarAI(Creature* creature) : ScriptedAI(creature)
{
instance = creature->GetInstanceScript();
+ memset(axes, 0, sizeof(axes));
}
InstanceScript* instance;
@@ -218,7 +219,10 @@ public:
positions.clear();
for (uint8 i = 0; i < 5; ++i)
+ {
enfeeble_targets[i] = 0;
+ enfeeble_health[i] = 0;
+ }
for (uint8 i = 0; i < TOTAL_INFERNAL_POINTS; ++i)
positions.push_back(&InfernalPoints[i]);
@@ -229,7 +233,7 @@ public:
SWPainTimer = 20000;
AmplifyDamageTimer = 5000;
Cleave_Timer = 8000;
- InfernalTimer = 45000;
+ InfernalTimer = 40000;
InfernalCleanupTimer = 47000;
AxesTargetSwitchTimer = urand(7500, 20000);
SunderArmorTimer = urand(5000, 10000);
diff --git a/src/server/scripts/EasternKingdoms/MoltenCore/boss_golemagg.cpp b/src/server/scripts/EasternKingdoms/MoltenCore/boss_golemagg.cpp
index 84e9957a60c..fa99078cedb 100644
--- a/src/server/scripts/EasternKingdoms/MoltenCore/boss_golemagg.cpp
+++ b/src/server/scripts/EasternKingdoms/MoltenCore/boss_golemagg.cpp
@@ -77,7 +77,7 @@ class boss_golemagg : public CreatureScript
void DamageTaken(Unit* /*attacker*/, uint32& /*damage*/)
{
- if (HealthBelowPct(10) || me->HasAura(SPELL_ENRAGE))
+ if (!HealthBelowPct(10) || me->HasAura(SPELL_ENRAGE))
return;
DoCast(me, SPELL_ENRAGE, true);
diff --git a/src/server/scripts/EasternKingdoms/ScarletMonastery/boss_mograine_and_whitemane.cpp b/src/server/scripts/EasternKingdoms/ScarletMonastery/boss_mograine_and_whitemane.cpp
index 46fb62eae7f..0aad2857a45 100644
--- a/src/server/scripts/EasternKingdoms/ScarletMonastery/boss_mograine_and_whitemane.cpp
+++ b/src/server/scripts/EasternKingdoms/ScarletMonastery/boss_mograine_and_whitemane.cpp
@@ -283,6 +283,12 @@ public:
DoScriptText(SAY_WH_KILL, me);
}
+ void DamageTaken(Unit* /*attacker*/, uint32& damage)
+ {
+ if (!_bCanResurrectCheck && damage >= me->GetHealth())
+ damage = me->GetHealth() - 1;
+ }
+
void UpdateAI(const uint32 diff)
{
if (!UpdateVictim())
diff --git a/src/server/scripts/EasternKingdoms/ShadowfangKeep/instance_shadowfang_keep.cpp b/src/server/scripts/EasternKingdoms/ShadowfangKeep/instance_shadowfang_keep.cpp
index d4c037d45c3..b405f9eba85 100644
--- a/src/server/scripts/EasternKingdoms/ShadowfangKeep/instance_shadowfang_keep.cpp
+++ b/src/server/scripts/EasternKingdoms/ShadowfangKeep/instance_shadowfang_keep.cpp
@@ -240,7 +240,6 @@ public:
return;
Creature* pArchmage = instance->GetCreature(uiArchmageArugalGUID);
- Creature* summon = NULL;
if (!pArchmage || !pArchmage->isAlive())
return;
@@ -252,7 +251,8 @@ public:
switch (uiPhase)
{
case 1:
- summon = pArchmage->SummonCreature(pArchmage->GetEntry(), SpawnLocation[4], TEMPSUMMON_TIMED_DESPAWN, 10000);
+ {
+ Creature* summon = pArchmage->SummonCreature(pArchmage->GetEntry(), SpawnLocation[4], TEMPSUMMON_TIMED_DESPAWN, 10000);
summon->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC);
summon->SetReactState(REACT_DEFENSIVE);
summon->CastSpell(summon, SPELL_ASHCROMBE_TELEPORT, true);
@@ -260,13 +260,16 @@ public:
uiTimer = 2000;
uiPhase = 2;
break;
+ }
case 2:
+ {
pArchmage->SummonCreature(NPC_ARUGAL_VOIDWALKER, SpawnLocation[0], TEMPSUMMON_CORPSE_TIMED_DESPAWN, 60000);
pArchmage->SummonCreature(NPC_ARUGAL_VOIDWALKER, SpawnLocation[1], TEMPSUMMON_CORPSE_TIMED_DESPAWN, 60000);
pArchmage->SummonCreature(NPC_ARUGAL_VOIDWALKER, SpawnLocation[2], TEMPSUMMON_CORPSE_TIMED_DESPAWN, 60000);
pArchmage->SummonCreature(NPC_ARUGAL_VOIDWALKER, SpawnLocation[3], TEMPSUMMON_CORPSE_TIMED_DESPAWN, 60000);
uiPhase = 0;
break;
+ }
}
} else uiTimer -= uiDiff;
diff --git a/src/server/scripts/EasternKingdoms/SunwellPlateau/instance_sunwell_plateau.cpp b/src/server/scripts/EasternKingdoms/SunwellPlateau/instance_sunwell_plateau.cpp
index 68b3bdb9b7e..6324c5adf16 100644
--- a/src/server/scripts/EasternKingdoms/SunwellPlateau/instance_sunwell_plateau.cpp
+++ b/src/server/scripts/EasternKingdoms/SunwellPlateau/instance_sunwell_plateau.cpp
@@ -276,14 +276,9 @@ public:
std::ostringstream stream;
stream << m_auiEncounter[0] << ' ' << m_auiEncounter[1] << ' ' << m_auiEncounter[2] << ' ' << m_auiEncounter[3] << ' '
<< m_auiEncounter[4] << ' ' << m_auiEncounter[5];
- char* out = new char[stream.str().length() + 1];
- strcpy(out, stream.str().c_str());
- if (out)
- {
- OUT_SAVE_INST_DATA_COMPLETE;
- return out;
- }
- return NULL;
+
+ OUT_SAVE_INST_DATA_COMPLETE;
+ return stream.str();
}
void Load(const char* in)
diff --git a/src/server/scripts/EasternKingdoms/Uldaman/boss_archaedas.cpp b/src/server/scripts/EasternKingdoms/Uldaman/boss_archaedas.cpp
index 3ffb873e4d2..74fad4f94d8 100644
--- a/src/server/scripts/EasternKingdoms/Uldaman/boss_archaedas.cpp
+++ b/src/server/scripts/EasternKingdoms/Uldaman/boss_archaedas.cpp
@@ -95,14 +95,17 @@ class boss_archaedas : public CreatureScript
me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_DISABLE_MOVE);
}
- void ActivateMinion(uint64 uiGuid, bool bFlag)
+ void ActivateMinion(uint64 uiGuid, bool flag)
{
- Unit* pMinion = Unit::GetUnit(*me, uiGuid);
+ Unit* minion = Unit::GetUnit(*me, uiGuid);
- if (pMinion && pMinion->isAlive())
+ if (minion && minion->isAlive())
{
- DoCast(pMinion, SPELL_AWAKEN_VAULT_WALKER, bFlag);
- pMinion->CastSpell(pMinion, SPELL_ARCHAEDAS_AWAKEN, true);
+ DoCast(minion, SPELL_AWAKEN_VAULT_WALKER, flag);
+ minion->CastSpell(minion, SPELL_ARCHAEDAS_AWAKEN, true);
+ minion->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);
+ minion->RemoveFlag(UNIT_FIELD_FLAGS,UNIT_FLAG_DISABLE_MOVE);
+ minion->setFaction(14);
}
}
diff --git a/src/server/scripts/EasternKingdoms/Uldaman/instance_uldaman.cpp b/src/server/scripts/EasternKingdoms/Uldaman/instance_uldaman.cpp
index ade07039a23..ee82da668f8 100644
--- a/src/server/scripts/EasternKingdoms/Uldaman/instance_uldaman.cpp
+++ b/src/server/scripts/EasternKingdoms/Uldaman/instance_uldaman.cpp
@@ -202,6 +202,9 @@ class instance_uldaman : public InstanceMapScript
continue;
archaedas->CastSpell(target, SPELL_AWAKEN_VAULT_WALKER, true);
target->CastSpell(target, SPELL_ARCHAEDAS_AWAKEN, true);
+ target->RemoveFlag(UNIT_FIELD_FLAGS,UNIT_FLAG_DISABLE_MOVE);
+ target->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);
+ target->setFaction(14);
return; // only want the first one we find
}
}
diff --git a/src/server/scripts/EasternKingdoms/ZulAman/boss_akilzon.cpp b/src/server/scripts/EasternKingdoms/ZulAman/boss_akilzon.cpp
index c7d6e2fb6e4..068d00f550f 100644
--- a/src/server/scripts/EasternKingdoms/ZulAman/boss_akilzon.cpp
+++ b/src/server/scripts/EasternKingdoms/ZulAman/boss_akilzon.cpp
@@ -80,7 +80,9 @@ class boss_akilzon : public CreatureScript
boss_akilzonAI(Creature* creature) : ScriptedAI(creature)
{
instance = creature->GetInstanceScript();
+ memset(BirdGUIDs, 0, sizeof(BirdGUIDs));
}
+
InstanceScript* instance;
uint64 BirdGUIDs[8];
@@ -116,8 +118,7 @@ class boss_akilzon : public CreatureScript
CloudGUID = 0;
CycloneGUID = 0;
DespawnSummons();
- for (uint8 i = 0; i < 8; ++i)
- BirdGUIDs[i] = 0;
+ memset(BirdGUIDs, 0, sizeof(BirdGUIDs));
StormCount = 0;
StormSequenceTimer = 0;
diff --git a/src/server/scripts/EasternKingdoms/ZulAman/boss_halazzi.cpp b/src/server/scripts/EasternKingdoms/ZulAman/boss_halazzi.cpp
index ecf173b02e5..a8afd19cd96 100644
--- a/src/server/scripts/EasternKingdoms/ZulAman/boss_halazzi.cpp
+++ b/src/server/scripts/EasternKingdoms/ZulAman/boss_halazzi.cpp
@@ -109,6 +109,7 @@ class boss_halazzi : public CreatureScript
if (instance)
instance->SetData(DATA_HALAZZIEVENT, NOT_STARTED);
+ LynxGUID = 0;
TransformCount = 0;
BerserkTimer = 600000;
CheckTimer = 1000;
diff --git a/src/server/scripts/EasternKingdoms/ZulAman/boss_zuljin.cpp b/src/server/scripts/EasternKingdoms/ZulAman/boss_zuljin.cpp
index 1009d3e0a0a..8fb3dd55077 100644
--- a/src/server/scripts/EasternKingdoms/ZulAman/boss_zuljin.cpp
+++ b/src/server/scripts/EasternKingdoms/ZulAman/boss_zuljin.cpp
@@ -315,14 +315,12 @@ class boss_zuljin : public CreatureScript
{
for (uint8 i = 0; i < 4; ++i)
{
- Unit* Temp = NULL;
if (SpiritGUID[i])
{
- Temp = Unit::GetUnit(*me, SpiritGUID[i]);
- if (Temp)
+ if (Unit* temp = Unit::GetUnit(*me, SpiritGUID[i]))
{
- Temp->SetVisible(false);
- Temp->setDeathState(DEAD);
+ temp->SetVisible(false);
+ temp->setDeathState(DEAD);
}
}
SpiritGUID[i] = 0;
diff --git a/src/server/scripts/EasternKingdoms/ZulAman/instance_zulaman.cpp b/src/server/scripts/EasternKingdoms/ZulAman/instance_zulaman.cpp
index 305e3813ebc..235bec7cc8a 100644
--- a/src/server/scripts/EasternKingdoms/ZulAman/instance_zulaman.cpp
+++ b/src/server/scripts/EasternKingdoms/ZulAman/instance_zulaman.cpp
@@ -180,12 +180,13 @@ class instance_zulaman : public InstanceMapScript
std::string GetSaveData()
{
+ OUT_SAVE_INST_DATA;
+
std::ostringstream ss;
ss << "S " << BossKilled << ' ' << ChestLooted << ' ' << QuestMinute;
- char* data = new char[ss.str().length()+1];
- strcpy(data, ss.str().c_str());
- //sLog->outError(LOG_FILTER_TSCR, "Zul'aman saved, %s.", data);
- return data;
+
+ OUT_SAVE_INST_DATA_COMPLETE;
+ return ss.str();
}
void Load(const char* load)
diff --git a/src/server/scripts/EasternKingdoms/ZulGurub/boss_mandokir.cpp b/src/server/scripts/EasternKingdoms/ZulGurub/boss_mandokir.cpp
index 83cd0b46fb8..32831eb047b 100644
--- a/src/server/scripts/EasternKingdoms/ZulGurub/boss_mandokir.cpp
+++ b/src/server/scripts/EasternKingdoms/ZulGurub/boss_mandokir.cpp
@@ -45,6 +45,8 @@ EndScriptData */
//Ohgans Spells
#define SPELL_SUNDERARMOR 24317
+#define NPC_SPEAKER 11391
+
class boss_mandokir : public CreatureScript
{
public:
@@ -79,6 +81,7 @@ class boss_mandokir : public CreatureScript
bool someWatched;
bool RaptorDead;
bool CombatStart;
+ bool SpeakerDead;
uint64 WatchTarget;
@@ -103,6 +106,7 @@ class boss_mandokir : public CreatureScript
endWatch = false;
RaptorDead = false;
CombatStart = false;
+ SpeakerDead = false;
DoCast(me, 23243);
}
@@ -129,19 +133,31 @@ class boss_mandokir : public CreatureScript
}
}
}
- DoCast(me, SPELL_LEVEL_UP, true);
- KillCount = 0;
+ DoCast(me, SPELL_LEVEL_UP, true);
+ KillCount = 0;
}
}
}
void EnterCombat(Unit* /*who*/)
{
- DoScriptText(SAY_AGGRO, me);
+ DoScriptText(SAY_AGGRO, me);
}
void UpdateAI(const uint32 diff)
{
+ if (!SpeakerDead)
+ {
+ if (!me->FindNearestCreature(NPC_SPEAKER, 100.0f, true))
+ {
+ me->GetMotionMaster()->MovePoint(0, -12196.3f, -1948.37f, 130.36f);
+ SpeakerDead = true;
+ }
+ }
+
+ if (me->GetMotionMaster()->GetCurrentMovementGeneratorType() != POINT_MOTION_TYPE && SpeakerDead)
+ me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC);
+
if (!UpdateVictim())
return;
diff --git a/src/server/scripts/EasternKingdoms/silverpine_forest.cpp b/src/server/scripts/EasternKingdoms/silverpine_forest.cpp
index 870cb29c28d..c52e69787d4 100644
--- a/src/server/scripts/EasternKingdoms/silverpine_forest.cpp
+++ b/src/server/scripts/EasternKingdoms/silverpine_forest.cpp
@@ -230,13 +230,11 @@ public:
{
if (Creature* summoned = me->SummonCreature(creatureId, PyrewoodSpawnPoints[position][0], PyrewoodSpawnPoints[position][1], PyrewoodSpawnPoints[position][2], PyrewoodSpawnPoints[position][3], TEMPSUMMON_CORPSE_TIMED_DESPAWN, 15000))
{
- Player* player = NULL;
Unit* target = NULL;
if (PlayerGUID)
{
- player = Unit::GetPlayer(*me, PlayerGUID);
- if (player)
- target = RAND((Unit*)me, (Unit*)player);
+ if (Unit* player = Unit::GetPlayer(*me, PlayerGUID)->ToUnit())
+ target = RAND((Unit*)me, player);
} else
target = me;
diff --git a/src/server/scripts/EasternKingdoms/wetlands.cpp b/src/server/scripts/EasternKingdoms/wetlands.cpp
index fac8fb51c2d..34e6e7c9ddf 100644
--- a/src/server/scripts/EasternKingdoms/wetlands.cpp
+++ b/src/server/scripts/EasternKingdoms/wetlands.cpp
@@ -60,12 +60,12 @@ public:
{
npc_tapoke_slim_jahnAI(Creature* creature) : npc_escortAI(creature) { }
- bool m_bFriendSummoned;
+ bool IsFriendSummoned;
void Reset()
{
if (!HasEscortState(STATE_ESCORT_ESCORTING))
- m_bFriendSummoned = false;
+ IsFriendSummoned = false;
}
void WaypointReached(uint32 waypointId)
@@ -83,14 +83,12 @@ public:
void EnterCombat(Unit* /*who*/)
{
- Player* player = GetPlayerForEscort();
-
- if (HasEscortState(STATE_ESCORT_ESCORTING) && !m_bFriendSummoned && player)
+ if (HasEscortState(STATE_ESCORT_ESCORTING) && !IsFriendSummoned && GetPlayerForEscort())
{
for (uint8 i = 0; i < 3; ++i)
DoCast(me, SPELL_CALL_FRIENDS, true);
- m_bFriendSummoned = true;
+ IsFriendSummoned = true;
}
}
diff --git a/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/hyjal.cpp b/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/hyjal.cpp
index 5b6dc784113..ee7ef383603 100644
--- a/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/hyjal.cpp
+++ b/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/hyjal.cpp
@@ -222,11 +222,9 @@ public:
ItemPosCountVec dest;
uint8 msg = player->CanStoreNewItem(NULL_BAG, NULL_SLOT, dest, ITEM_TEAR_OF_GODDESS, 1);
if (msg == EQUIP_ERR_OK)
- {
- Item* item = player->StoreNewItem(dest, ITEM_TEAR_OF_GODDESS, true);
- if (item && player)
+ if (Item* item = player->StoreNewItem(dest, ITEM_TEAR_OF_GODDESS, true))
player->SendNewItem(item, 1, true, false, true);
- }
+
player->SEND_GOSSIP_MENU(907, creature->GetGUID());
}
return true;
diff --git a/src/server/scripts/Kalimdor/CavernsOfTime/CullingOfStratholme/boss_mal_ganis.cpp b/src/server/scripts/Kalimdor/CavernsOfTime/CullingOfStratholme/boss_mal_ganis.cpp
index d4359a100b4..88b2a766671 100644
--- a/src/server/scripts/Kalimdor/CavernsOfTime/CullingOfStratholme/boss_mal_ganis.cpp
+++ b/src/server/scripts/Kalimdor/CavernsOfTime/CullingOfStratholme/boss_mal_ganis.cpp
@@ -36,6 +36,7 @@ enum Spells
SPELL_SLEEP = 52721, //Puts an enemy to sleep for up to 10 sec. Any damage caused will awaken the target.
H_SPELL_SLEEP = 58849,
SPELL_VAMPIRIC_TOUCH = 52723, //Heals the caster for half the damage dealt by a melee attack.
+ SPELL_MAL_GANIS_KILL_CREDIT = 58124, // Quest credit
SPELL_KILL_CREDIT = 58630 // Non-existing spell as encounter credit, created in spell_dbc
};
@@ -238,9 +239,9 @@ public:
if (instance)
{
instance->SetData(DATA_MAL_GANIS_EVENT, DONE);
-
+ DoCastAOE(SPELL_MAL_GANIS_KILL_CREDIT);
// give achievement credit and LFG rewards to players. criteria use spell 58630 which doesn't exist, but it was created in spell_dbc
- DoCast(me, SPELL_KILL_CREDIT);
+ DoCastAOE(SPELL_KILL_CREDIT);
}
}
diff --git a/src/server/scripts/Kalimdor/OnyxiasLair/boss_onyxia.cpp b/src/server/scripts/Kalimdor/OnyxiasLair/boss_onyxia.cpp
index 1fdf941d75c..c243682cc61 100644
--- a/src/server/scripts/Kalimdor/OnyxiasLair/boss_onyxia.cpp
+++ b/src/server/scripts/Kalimdor/OnyxiasLair/boss_onyxia.cpp
@@ -35,11 +35,14 @@ EndScriptData */
enum Yells
{
- SAY_AGGRO = -1249000,
- SAY_KILL = -1249001,
- SAY_PHASE_2_TRANS = -1249002,
- SAY_PHASE_3_TRANS = -1249003,
- EMOTE_BREATH = -1249004,
+ // Say
+ SAY_AGGRO = 0,
+ SAY_KILL = 1,
+ SAY_PHASE_2_TRANS = 2,
+ SAY_PHASE_3_TRANS = 3,
+
+ // Emote
+ EMOTE_BREATH = 4,
};
enum Spells
@@ -184,7 +187,7 @@ public:
void EnterCombat(Unit* /*who*/)
{
- DoScriptText(SAY_AGGRO, me);
+ Talk(SAY_AGGRO);
me->SetInCombatWithZone();
if (instance)
@@ -227,7 +230,7 @@ public:
void KilledUnit(Unit* /*victim*/)
{
- DoScriptText(SAY_KILL, me);
+ Talk(SAY_KILL);
}
void SpellHit(Unit* /*pCaster*/, const SpellInfo* Spell)
@@ -269,7 +272,7 @@ public:
me->SetCanFly(true);
me->GetMotionMaster()->MovePoint(11, Phase2Location.GetPositionX(), Phase2Location.GetPositionY(), Phase2Location.GetPositionZ()+25);
me->SetSpeed(MOVE_FLIGHT, 1.0f);
- DoScriptText(SAY_PHASE_2_TRANS, me);
+ Talk(SAY_PHASE_2_TRANS);
if (instance)
instance->SetData(DATA_ONYXIA_PHASE, Phase);
WhelpTimer = 5000;
@@ -416,7 +419,7 @@ public:
Phase = PHASE_END;
if (instance)
instance->SetData(DATA_ONYXIA_PHASE, Phase);
- DoScriptText(SAY_PHASE_3_TRANS, me);
+ Talk(SAY_PHASE_3_TRANS);
SetCombatMovement(true);
me->SetCanFly(false);
@@ -432,7 +435,7 @@ public:
if (me->IsNonMeleeSpellCasted(false))
me->InterruptNonMeleeSpells(false);
- DoScriptText(EMOTE_BREATH, me);
+ Talk(EMOTE_BREATH);
DoCast(me, PointData->SpellId);
DeepBreathTimer = 70000;
}
diff --git a/src/server/scripts/Kalimdor/ZulFarrak/instance_zulfarrak.cpp b/src/server/scripts/Kalimdor/ZulFarrak/instance_zulfarrak.cpp
index 6c0d43b053e..3a6a3f6241c 100644
--- a/src/server/scripts/Kalimdor/ZulFarrak/instance_zulfarrak.cpp
+++ b/src/server/scripts/Kalimdor/ZulFarrak/instance_zulfarrak.cpp
@@ -119,6 +119,18 @@ public:
void Initialize()
{
GahzRillaEncounter = NOT_STARTED;
+ ZumrahGUID = 0;
+ BlyGUID = 0;
+ WeegliGUID = 0;
+ OroGUID = 0;
+ RavenGUID = 0;
+ MurtaGUID = 0;
+ EndDoorGUID = 0;
+ PyramidPhase = 0;
+ major_wave_Timer = 0;
+ minor_wave_Timer = 0;
+ addGroupSize = 0;
+ waypoint = 0;
}
void OnCreatureCreate(Creature* creature)
diff --git a/src/server/scripts/Kalimdor/ashenvale.cpp b/src/server/scripts/Kalimdor/ashenvale.cpp
index 248932ecbb6..6a9dd77433a 100644
--- a/src/server/scripts/Kalimdor/ashenvale.cpp
+++ b/src/server/scripts/Kalimdor/ashenvale.cpp
@@ -447,7 +447,7 @@ class npc_muglash : public CreatureScript
DoScriptText(SAY_MUG_START1, creature);
creature->setFaction(113);
- pEscortAI->Start(true, true, player->GetGUID());
+ pEscortAI->Start(true, false, player->GetGUID());
}
}
return true;
diff --git a/src/server/scripts/Kalimdor/moonglade.cpp b/src/server/scripts/Kalimdor/moonglade.cpp
index 9df208d2578..3c8d2267903 100644
--- a/src/server/scripts/Kalimdor/moonglade.cpp
+++ b/src/server/scripts/Kalimdor/moonglade.cpp
@@ -296,7 +296,10 @@ public:
struct npc_clintar_spiritAI : public npc_escortAI
{
public:
- npc_clintar_spiritAI(Creature* creature) : npc_escortAI(creature) {}
+ npc_clintar_spiritAI(Creature* creature) : npc_escortAI(creature)
+ {
+ PlayerGUID = 0;
+ }
uint8 Step;
uint32 CurrWP;
diff --git a/src/server/scripts/Kalimdor/silithus.cpp b/src/server/scripts/Kalimdor/silithus.cpp
index 639de3dc3b2..bad278f51c7 100644
--- a/src/server/scripts/Kalimdor/silithus.cpp
+++ b/src/server/scripts/Kalimdor/silithus.cpp
@@ -537,7 +537,6 @@ public:
if (!Fandral || !Arygos || !Caelestrasz || !Merithra)
return;
- Unit* mob = NULL;
AnimationTimer = EventAnim[AnimationCount].Timer;
if (eventEnd == false)
{
@@ -720,6 +719,7 @@ public:
case 51:
{
uint32 entries[4] = { 15423, 15424, 15414, 15422 };
+ Unit* mob = NULL;
for (uint8 i = 0; i < 4; ++i)
{
mob = player->FindNearestCreature(entries[i], 50, me);
@@ -844,9 +844,6 @@ public:
void UpdateAI(const uint32 diff)
{
- Unit* target = NULL;
- //Player* player = me->GetPlayer(PlayerGUID);
-
if (!Timers)
{
if (me->GetEntry() == 15424 || me->GetEntry() == 15422 || me->GetEntry() == 15414) //all but Kaldorei Soldiers
@@ -890,6 +887,7 @@ public:
}
if (!hasTarget)
{
+ Unit* target = NULL;
if (me->GetEntry() == 15424 || me->GetEntry() == 15422 || me->GetEntry() == 15414)
target = me->FindNearestCreature(15423, 20, true);
if (me->GetEntry() == 15423)
diff --git a/src/server/scripts/Northrend/CMakeLists.txt b/src/server/scripts/Northrend/CMakeLists.txt
index 3502e7fb104..dd8dd17c947 100644
--- a/src/server/scripts/Northrend/CMakeLists.txt
+++ b/src/server/scripts/Northrend/CMakeLists.txt
@@ -10,6 +10,7 @@
set(scripts_STAT_SRCS
${scripts_STAT_SRCS}
+ Northrend/wintergrasp.cpp
Northrend/isle_of_conquest.cpp
Northrend/storm_peaks.cpp
Northrend/Ulduar/HallsOfLightning/instance_halls_of_lightning.cpp
diff --git a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheChampion/boss_argent_challenge.cpp b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheChampion/boss_argent_challenge.cpp
index 76d5949eb44..d77c84b2978 100644
--- a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheChampion/boss_argent_challenge.cpp
+++ b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheChampion/boss_argent_challenge.cpp
@@ -219,8 +219,6 @@ public:
}
InstanceScript* instance;
-
- Creature* pMemory;
uint64 MemoryGUID;
bool bHealth;
diff --git a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_anubarak_trial.cpp b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_anubarak_trial.cpp
index b3b9801fd00..564df34462b 100755
--- a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_anubarak_trial.cpp
+++ b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_anubarak_trial.cpp
@@ -37,15 +37,17 @@ EndScriptData */
enum Yells
{
- SAY_INTRO = -1649055,
- SAY_AGGRO = -1649056,
- SAY_KILL1 = -1649057,
- SAY_KILL2 = -1649058,
- SAY_DEATH = -1649059,
- EMOTE_SPIKE = -1649060,
- SAY_BURROWER = -1649061,
- EMOTE_LEECHING_SWARM = -1649062,
- SAY_LEECHING_SWARM = -1649063,
+ SAY_INTRO = 0,
+ SAY_AGGRO = 1,
+ EMOTE_SUBMERGE = 2,
+ EMOTE_BURROWER = 3,
+ SAY_EMERGE = 4,
+ SAY_LEECHING_SWARM = 5,
+ EMOTE_LEECHING_SWARM = 6,
+ SAY_KILL_PLAYER = 7,
+ SAY_DEATH = 8,
+
+ EMOTE_SPIKE = 0,
};
enum Summons
@@ -83,8 +85,10 @@ enum BossSpells
SPELL_SPIDER_FRENZY = 66128,
SPELL_EXPOSE_WEAKNESS = 67720, //Passive - Triggered
SPELL_SHADOW_STRIKE = 66134,
- SPELL_SUBMERGE_EFFECT = 53421,
- SPELL_EMERGE_EFFECT = 66947,
+ SPELL_SUBMERGE_EFFECT = 68394,
+ SPELL_EMERGE_EFFECT = 65982,
+ SPELL_AWAKENED = 66311,
+ SPELL_PERSISTENT_DIRT = 68048,
SUMMON_SCARAB = NPC_SCARAB,
SUMMON_FROSTSPHERE = NPC_FROST_SPHERE,
@@ -94,6 +98,7 @@ enum BossSpells
SPELL_FROST_SPHERE = 67539,
SPELL_PERMAFROST = 66193,
SPELL_PERMAFROST_VISUAL = 65882,
+ SPELL_PERMAFROST_MODEL = 66185,
//Spike
SPELL_SUMMON_SPIKE = 66169,
@@ -115,12 +120,12 @@ enum SummonActions
const Position SphereSpawn[6] =
{
- { 786.6439f, 108.2498f, 155.6701f, 0 },
- { 806.8429f, 150.5902f, 155.6701f, 0 },
- { 759.1386f, 163.9654f, 155.6701f, 0 },
- { 744.3701f, 119.5211f, 155.6701f, 0 },
- { 710.0211f, 120.8152f, 155.6701f, 0 },
- { 706.6383f, 161.5266f, 155.6701f, 0 },
+ {779.8038f, 150.6580f, 158.1426f, 0},
+ {736.0243f, 113.4201f, 158.0226f, 0},
+ {712.5712f, 160.9948f, 158.4368f, 0},
+ {701.4271f, 126.4740f, 158.0205f, 0},
+ {747.9202f, 155.0920f, 158.0613f, 0},
+ {769.6285f, 121.1024f, 158.0504f, 0},
};
enum MovementPoints
@@ -195,7 +200,7 @@ public:
{
if (who->GetTypeId() == TYPEID_PLAYER)
{
- DoScriptText(urand(0, 1) ? SAY_KILL1 : SAY_KILL2, me);
+ Talk(SAY_KILL_PLAYER);
if (instance)
instance->SetData(DATA_TRIBUTE_TO_IMMORTALITY_ELEGIBLE, 0);
}
@@ -205,7 +210,7 @@ public:
{
if (!m_bIntro)
{
- DoScriptText(SAY_INTRO, me);
+ Talk(SAY_INTRO);
m_bIntro = false;
}
}
@@ -217,13 +222,16 @@ public:
//Summon Scarab Swarms neutral at random places
for (int i=0; i < 10; i++)
if (Creature* temp = me->SummonCreature(NPC_SCARAB, AnubarakLoc[1].GetPositionX()+urand(0, 50)-25, AnubarakLoc[1].GetPositionY()+urand(0, 50)-25, AnubarakLoc[1].GetPositionZ()))
+ {
temp->setFaction(31);
+ temp->GetMotionMaster()->MoveRandom(10);
+ }
}
void JustDied(Unit* /*killer*/)
{
Summons.DespawnAll();
- DoScriptText(SAY_DEATH, me);
+ Talk(SAY_DEATH);
if (instance)
instance->SetData(TYPE_ANUBARAK, DONE);
}
@@ -240,7 +248,7 @@ public:
break;
case NPC_SPIKE:
summoned->CombatStart(target);
- DoScriptText(EMOTE_SPIKE, me, target);
+ Talk(EMOTE_SPIKE, target->GetGUID());
break;
}
Summons.Summon(summoned);
@@ -258,7 +266,7 @@ public:
void EnterCombat(Unit* /*who*/)
{
- DoScriptText(SAY_AGGRO, me);
+ Talk(SAY_AGGRO);
me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_NOT_SELECTABLE);
me->SetInCombatWithZone();
if (instance)
@@ -321,7 +329,7 @@ public:
DoCast(me, SPELL_SUBMERGE_ANUBARAK);
DoCast(me, SPELL_CLEAR_ALL_DEBUFFS);
me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_NOT_SELECTABLE);
- DoScriptText(SAY_BURROWER, me);
+ Talk(EMOTE_BURROWER);
m_uiScarabSummoned = 0;
m_uiSummonScarabTimer = 4*IN_MILLISECONDS;
m_uiStage = 2;
@@ -403,8 +411,8 @@ public:
{
m_bReachedPhase3 = true;
DoCastAOE(SPELL_LEECHING_SWARM);
- DoScriptText(EMOTE_LEECHING_SWARM, me);
- DoScriptText(SAY_LEECHING_SWARM, me);
+ Talk(EMOTE_LEECHING_SWARM);
+ Talk(SAY_LEECHING_SWARM);
}
if (m_uiBerserkTimer <= uiDiff && !me->HasAura(SPELL_BERSERK))
@@ -445,10 +453,9 @@ public:
m_uiDeterminationTimer = urand(5*IN_MILLISECONDS, 60*IN_MILLISECONDS);
DoCast(me, SPELL_ACID_MANDIBLE);
me->SetInCombatWithZone();
- if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM))
- me->AddThreat(target, 20000.0f);
- if (!me->isInCombat())
- me->DisappearAndDie();
+ if (me->isInCombat())
+ if (Creature* Anubarak = ObjectAccessor::GetCreature(*me, instance->GetData64(NPC_ANUBARAK)))
+ Anubarak->AI()->JustSummoned(me);
}
void DoAction(const int32 actionId)
@@ -509,14 +516,16 @@ public:
void Reset()
{
- me->SetCorpseDelay(0);
+ me->SetCorpseDelay(10);
m_uiSpiderFrenzyTimer = urand(10*IN_MILLISECONDS, 20*IN_MILLISECONDS);
m_uiSubmergeTimer = 30*IN_MILLISECONDS;
DoCast(me, SPELL_EXPOSE_WEAKNESS);
DoCast(me, SPELL_SPIDER_FRENZY);
+ DoCast(me, SPELL_AWAKENED);
me->SetInCombatWithZone();
- if (!me->isInCombat())
- me->DisappearAndDie();
+ if (me->isInCombat())
+ if (Creature* Anubarak = ObjectAccessor::GetCreature(*me, instance->GetData64(NPC_ANUBARAK)))
+ Anubarak->AI()->JustSummoned(me);
}
void DoAction(const int32 actionId)
@@ -524,8 +533,9 @@ public:
switch (actionId)
{
case ACTION_SHADOW_STRIKE:
- if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0))
- DoCast(target, SPELL_SHADOW_STRIKE);
+ if (!me->HasAura(SPELL_AWAKENED))
+ if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0))
+ DoCast(target, SPELL_SHADOW_STRIKE);
break;
}
}
@@ -535,22 +545,25 @@ public:
if (!UpdateVictim())
return;
+ if (me->HasUnitState(UNIT_STATE_CASTING))
+ return;
+
if ((m_uiSubmergeTimer <= uiDiff) && HealthBelowPct(80))
{
if (me->HasAura(SPELL_SUBMERGE_EFFECT))
{
me->RemoveAurasDueToSpell(SPELL_SUBMERGE_EFFECT);
DoCast(me, SPELL_EMERGE_EFFECT);
- me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_NOT_SELECTABLE);
- me->CombatStart(me->SelectNearestTarget());
+ DoCast(me, SPELL_AWAKENED);
+ me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);
}
else
{
if (!me->HasAura(SPELL_PERMAFROST_HELPER))
{
DoCast(me, SPELL_SUBMERGE_EFFECT);
- me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_NOT_SELECTABLE);
- me->CombatStop();
+ me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);
+ DoCast(me, SPELL_PERSISTENT_DIRT, true);
}
}
m_uiSubmergeTimer = 20*IN_MILLISECONDS;
@@ -575,16 +588,10 @@ class mob_frost_sphere : public CreatureScript
void Reset()
{
- _isFalling = false;
me->SetReactState(REACT_PASSIVE);
- //! Confirmed sniff 3.3.5.a
- me->SetDisableGravity(true);
- me->SetByteValue(UNIT_FIELD_BYTES_1, 3, UNIT_BYTE1_FLAG_ALWAYS_STAND | UNIT_BYTE1_FLAG_HOVER);
- //! end
+ DoCast(SPELL_FROST_SPHERE);
me->SetDisplayId(me->GetCreatureTemplate()->Modelid2);
- me->SetSpeed(MOVE_RUN, 0.5f, false);
me->GetMotionMaster()->MoveRandom(20.0f);
- DoCast(SPELL_FROST_SPHERE);
}
void DamageTaken(Unit* /*who*/, uint32& damage)
@@ -592,9 +599,20 @@ class mob_frost_sphere : public CreatureScript
if (me->GetHealth() <= damage)
{
damage = 0;
- if (!_isFalling)
+ float floorZ = me->GetMap()->GetHeight(me->GetPhaseMask(), me->GetPositionX(), me->GetPositionY(), me->GetPositionZ());
+ if (fabs(me->GetPositionZ() - floorZ) < 0.1f)
{
- _isFalling = true;
+ // we are close to the ground
+ me->GetMotionMaster()->MoveIdle();
+ me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);
+ me->RemoveAurasDueToSpell(SPELL_FROST_SPHERE);
+ DoCast(SPELL_PERMAFROST_MODEL);
+ DoCast(SPELL_PERMAFROST);
+ me->SetObjectScale(2.0f);
+ }
+ else
+ {
+ // we are in air
me->GetMotionMaster()->MoveIdle();
me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);
//At hit the ground
@@ -613,16 +631,13 @@ class mob_frost_sphere : public CreatureScript
{
case POINT_FALL_GROUND:
me->RemoveAurasDueToSpell(SPELL_FROST_SPHERE);
- me->SetDisplayId(me->GetCreatureTemplate()->Modelid1);
+ DoCast(SPELL_PERMAFROST_MODEL);
DoCast(SPELL_PERMAFROST_VISUAL);
DoCast(SPELL_PERMAFROST);
me->SetObjectScale(2.0f);
break;
}
}
-
- private:
- bool _isFalling;
};
CreatureAI* GetAI(Creature* creature) const
@@ -669,6 +684,7 @@ public:
{
m_uiTargetGUID = who->GetGUID();
DoCast(who, SPELL_MARK);
+ Talk(EMOTE_SPIKE, who->GetGUID());
me->SetSpeed(MOVE_RUN, 0.5f);
m_uiSpeed = 0;
m_uiIncreaseSpeedTimer = 1*IN_MILLISECONDS;
diff --git a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_faction_champions.cpp b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_faction_champions.cpp
index 3b0aeb958cb..c662daf3671 100755
--- a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_faction_champions.cpp
+++ b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_faction_champions.cpp
@@ -33,10 +33,9 @@ EndScriptData */
#include "SpellAuraEffects.h"
#include "trial_of_the_crusader.h"
-enum eYell
+enum Yells
{
- SAY_GARROSH_KILL_ALLIANCE_PLAYER4 = -1649118,
- SAY_VARIAN_KILL_HORDE_PLAYER4 = -1649123,
+ SAY_KILL_PLAYER = 6,
};
enum eAIs
@@ -359,11 +358,12 @@ struct boss_faction_championsAI : public ScriptedAI
if (TeamInInstance == ALLIANCE)
{
if (Creature* temp = Unit::GetCreature(*me, instance->GetData64(NPC_VARIAN)))
- DoScriptText(SAY_VARIAN_KILL_HORDE_PLAYER4+urand(0, 3), temp); // + cause we are on negative
+ temp->AI()->Talk(SAY_KILL_PLAYER);
}
else
- if (Creature* temp = me->FindNearestCreature(NPC_GARROSH, 300.f))
- DoScriptText(SAY_GARROSH_KILL_ALLIANCE_PLAYER4+urand(0, 3), temp); // + cause we are on negative
+ if (Creature* temp = Unit::GetCreature(*me, instance->GetData64(NPC_GARROSH)))
+ temp->AI()->Talk(SAY_KILL_PLAYER);
+
instance->SetData(DATA_TRIBUTE_TO_IMMORTALITY_ELEGIBLE, 0);
}
diff --git a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_lord_jaraxxus.cpp b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_lord_jaraxxus.cpp
index 4e791dfc22f..87e7801566e 100755
--- a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_lord_jaraxxus.cpp
+++ b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_lord_jaraxxus.cpp
@@ -36,16 +36,18 @@ EndScriptData */
enum Yells
{
- SAY_INTRO = -1649030,
- SAY_AGGRO = -1649031,
- SAY_DEATH = -1649032,
- EMOTE_INCINERATE = -1649033,
- SAY_INCINERATE = -1649034,
- EMOTE_LEGION_FLAME = -1649035,
- EMOTE_NETHER_PORTAL = -1649036,
- SAY_NETHER_PORTAL = -1649037,
- EMOTE_INFERNAL_ERUPTION = -1649038,
- SAY_INFERNAL_ERUPTION = -1649039,
+ SAY_INTRO = 0,
+ SAY_AGGRO = 1,
+ EMOTE_LEGION_FLAME = 2,
+ EMOTE_NETHER_PORTAL = 3,
+ SAY_MISTRESS_OF_PAIN = 4,
+ EMOTE_INCINERATE = 5,
+ SAY_INCINERATE = 6,
+ EMOTE_INFERNAL_ERUPTION = 7,
+ SAY_INFERNAL_ERUPTION = 8,
+ SAY_KILL_PLAYER = 9,
+ SAY_DEATH = 10,
+ SAY_BERSERK = 11,
};
enum Equipment
@@ -159,7 +161,7 @@ public:
void JustDied(Unit* /*killer*/)
{
Summons.DespawnAll();
- DoScriptText(SAY_DEATH, me);
+ Talk(SAY_DEATH);
if (instance)
instance->SetData(TYPE_JARAXXUS, DONE);
}
@@ -174,7 +176,7 @@ public:
me->SetInCombatWithZone();
if (instance)
instance->SetData(TYPE_JARAXXUS, IN_PROGRESS);
- DoScriptText(SAY_AGGRO, me);
+ Talk(SAY_AGGRO);
}
void UpdateAI(const uint32 uiDiff)
@@ -184,16 +186,16 @@ public:
if (m_uiSummonInfernalEruptionTimer <= uiDiff)
{
- DoScriptText(EMOTE_INFERNAL_ERUPTION, me);
- DoScriptText(SAY_INFERNAL_ERUPTION, me);
+ Talk(EMOTE_INFERNAL_ERUPTION);
+ Talk(SAY_INFERNAL_ERUPTION);
DoCast(SPELL_INFERNAL_ERUPTION);
m_uiSummonInfernalEruptionTimer = 2*MINUTE*IN_MILLISECONDS;
} else m_uiSummonInfernalEruptionTimer -= uiDiff;
if (m_uiSummonNetherPortalTimer <= uiDiff)
{
- DoScriptText(EMOTE_NETHER_PORTAL, me);
- DoScriptText(SAY_NETHER_PORTAL, me);
+ Talk(EMOTE_NETHER_PORTAL);
+ Talk(SAY_MISTRESS_OF_PAIN);
DoCast(SPELL_NETHER_PORTAL);
m_uiSummonNetherPortalTimer = 2*MINUTE*IN_MILLISECONDS;
} else m_uiSummonNetherPortalTimer -= uiDiff;
@@ -215,8 +217,8 @@ public:
{
if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 1, 0, true))
{
- DoScriptText(EMOTE_INCINERATE, me, target);
- DoScriptText(SAY_INCINERATE, me);
+ Talk(EMOTE_INCINERATE, target->GetGUID());
+ Talk(SAY_INCINERATE);
DoCast(target, SPELL_INCINERATE_FLESH);
}
m_uiIncinerateFleshTimer = urand(20*IN_MILLISECONDS, 25*IN_MILLISECONDS);
@@ -232,7 +234,7 @@ public:
{
if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 1, 0, true))
{
- DoScriptText(EMOTE_LEGION_FLAME, me, target);
+ Talk(EMOTE_LEGION_FLAME, target->GetGUID());
DoCast(target, SPELL_LEGION_FLAME);
}
m_uiLegionFlameTimer = 30*IN_MILLISECONDS;
@@ -327,6 +329,8 @@ public:
// used to despawn corpse immediately
me->DespawnOrUnsummon();
}
+
+ void UpdateAI(uint32 const /*diff*/) {}
};
};
@@ -436,6 +440,8 @@ public:
// used to despawn corpse immediately
me->DespawnOrUnsummon();
}
+
+ void UpdateAI(uint32 const /*diff*/) {}
};
};
diff --git a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_northrend_beasts.cpp b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_northrend_beasts.cpp
index 6c69ccbc72d..506467be8a5 100755
--- a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_northrend_beasts.cpp
+++ b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_northrend_beasts.cpp
@@ -35,16 +35,16 @@ EndScriptData */
enum Yells
{
- //Gormok
- SAY_SNOBOLLED = -1649000,
- //Acidmaw & Dreadscale
- SAY_SUBMERGE = -1649010,
- SAY_EMERGE = -1649011,
- SAY_BERSERK = -1649012,
- //Icehowl
- SAY_TRAMPLE_STARE = -1649020,
- SAY_TRAMPLE_FAIL = -1649021,
- SAY_TRAMPLE_START = -1649022,
+ // Gormok
+ EMOTE_SNOBOLLED = 0,
+
+ // Acidmaw & Dreadscale
+ EMOTE_ENRAGE = 0,
+
+ // Icehowl
+ EMOTE_TRAMPLE_START = 0,
+ EMOTE_TRAMPLE_CRASH = 1,
+ EMOTE_TRAMPLE_FAIL = 2,
};
enum Equipment
@@ -239,7 +239,7 @@ public:
if (m_uiSummonCount > 0)
{
me->SummonCreature(NPC_SNOBOLD_VASSAL, me->GetPositionX(), me->GetPositionY(), me->GetPositionZ(), 0, TEMPSUMMON_CORPSE_DESPAWN);
- DoScriptText(SAY_SNOBOLLED, me);
+ Talk(EMOTE_SNOBOLLED);
}
m_uiSummonTimer = urand(15*IN_MILLISECONDS, 30*IN_MILLISECONDS);
} else m_uiSummonTimer -= diff;
@@ -460,12 +460,11 @@ struct boss_jormungarAI : public ScriptedAI
if (instanceScript && instanceScript->GetData(TYPE_NORTHREND_BEASTS) == SNAKES_SPECIAL && !enraged)
{
- DoScriptText(SAY_EMERGE, me);
me->RemoveAurasDueToSpell(SPELL_SUBMERGE_0);
me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_NOT_SELECTABLE);
DoCast(SPELL_ENRAGE);
enraged = true;
- DoScriptText(SAY_BERSERK, me);
+ Talk(EMOTE_ENRAGE);
switch (stage)
{
case 0:
@@ -512,7 +511,6 @@ struct boss_jormungarAI : public ScriptedAI
case 1: // Submerge
me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_NOT_SELECTABLE);
DoCast(me, SPELL_SUBMERGE_0);
- DoScriptText(SAY_SUBMERGE, me);
me->GetMotionMaster()->MovePoint(0, ToCCommonLoc[1].GetPositionX()+ frand(-40.0f, 40.0f), ToCCommonLoc[1].GetPositionY() + frand(-40.0f, 40.0f), ToCCommonLoc[1].GetPositionZ());
stage = 2;
case 2: // Wait til emerge
@@ -524,7 +522,6 @@ struct boss_jormungarAI : public ScriptedAI
break;
case 3: // Emerge
me->SetDisplayId(modelStationary);
- DoScriptText(SAY_EMERGE, me);
me->RemoveAurasDueToSpell(SPELL_SUBMERGE_0);
DoCast(me, SPELL_EMERGE_0);
me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_NOT_SELECTABLE);
@@ -558,7 +555,6 @@ struct boss_jormungarAI : public ScriptedAI
case 5: // Submerge
me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_NOT_SELECTABLE);
DoCast(me, SPELL_SUBMERGE_0);
- DoScriptText(SAY_SUBMERGE, me);
me->GetMotionMaster()->MovePoint(0, ToCCommonLoc[1].GetPositionX() + frand(-40.0f, 40.0f), ToCCommonLoc[1].GetPositionY() + frand(-40.0f, 40.0f), ToCCommonLoc[1].GetPositionZ());
stage = 6;
case 6: // Wait til emerge
@@ -570,7 +566,6 @@ struct boss_jormungarAI : public ScriptedAI
break;
case 7: // Emerge
me->SetDisplayId(modelMobile);
- DoScriptText(SAY_EMERGE, me);
me->RemoveAurasDueToSpell(SPELL_SUBMERGE_0);
DoCast(me, SPELL_EMERGE_0);
me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_NOT_SELECTABLE);
@@ -910,6 +905,8 @@ public:
if (m_uiMassiveCrashTimer <= diff)
{
me->GetMotionMaster()->MoveJump(ToCCommonLoc[1].GetPositionX(), ToCCommonLoc[1].GetPositionY(), ToCCommonLoc[1].GetPositionZ(), 10.0f, 20.0f); // 1: Middle of the room
+ SetCombatMovement(false);
+ me->AttackStop();
m_uiStage = 7; //Invalid (Do nothing more than move)
m_uiMassiveCrashTimer = 30*IN_MILLISECONDS;
} else m_uiMassiveCrashTimer -= diff;
@@ -918,23 +915,28 @@ public:
break;
case 1:
DoCastAOE(SPELL_MASSIVE_CRASH);
+ me->StopMoving();
+ me->AttackStop();
m_uiStage = 2;
break;
case 2:
if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 0, true))
{
+ me->StopMoving();
+ me->AttackStop();
m_uiTrampleTargetGUID = target->GetGUID();
me->SetTarget(m_uiTrampleTargetGUID);
- DoScriptText(SAY_TRAMPLE_STARE, me, target);
m_bTrampleCasted = false;
- SetCombatMovement(false);
- me->GetMotionMaster()->MoveIdle();
+ //SetCombatMovement(false);
+ //me->GetMotionMaster()->MoveIdle();
me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE);
m_uiTrampleTimer = 4*IN_MILLISECONDS;
m_uiStage = 3;
} else m_uiStage = 6;
break;
case 3:
+ me->StopMoving();
+ me->AttackStop();
if (m_uiTrampleTimer <= diff)
{
if (Unit* target = Unit::GetPlayer(*me, m_uiTrampleTargetGUID))
@@ -947,13 +949,15 @@ public:
me->GetMotionMaster()->MoveJump(2*me->GetPositionX()-m_fTrampleTargetX,
2*me->GetPositionY()-m_fTrampleTargetY,
me->GetPositionZ(),
- 10.0f, 20.0f); // 2: Hop Backwards
+ 20.0f, 30.0f); // 2: Hop Backwards
m_uiStage = 7; //Invalid (Do nothing more than move)
} else m_uiStage = 6;
} else m_uiTrampleTimer -= diff;
break;
case 4:
- DoScriptText(SAY_TRAMPLE_START, me);
+ me->StopMoving();
+ me->AttackStop();
+ Talk(EMOTE_TRAMPLE_START, m_uiTrampleTargetGUID);
me->GetMotionMaster()->MoveCharge(m_fTrampleTargetX, m_fTrampleTargetY, m_fTrampleTargetZ+2, 42, 1);
me->SetTarget(0);
m_uiStage = 5;
@@ -985,7 +989,12 @@ public:
if (!m_bTrampleCasted)
{
DoCast(me, SPELL_STAGGERED_DAZE);
- DoScriptText(SAY_TRAMPLE_FAIL, me);
+ Talk(EMOTE_TRAMPLE_CRASH);
+ }
+ else
+ {
+ DoCast(me, SPELL_FROTHING_RAGE, true);
+ Talk(EMOTE_TRAMPLE_FAIL);
}
m_bMovementStarted = false;
me->GetMotionMaster()->MovementExpired();
diff --git a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_twin_valkyr.cpp b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_twin_valkyr.cpp
index 4cfe4f61dbb..a65eaebbc0c 100755
--- a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_twin_valkyr.cpp
+++ b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_twin_valkyr.cpp
@@ -40,17 +40,15 @@ EndScriptData */
enum Yells
{
- SAY_AGGRO = -1649040,
- SAY_DEATH = -1649041,
- SAY_BERSERK = -1649042,
- EMOTE_SHIELD = -1649043,
- SAY_SHIELD = -1649044,
- SAY_KILL1 = -1649045,
- SAY_KILL2 = -1649046,
- EMOTE_LIGHT_VORTEX = -1649047,
- SAY_LIGHT_VORTEX = -1649048,
- EMOTE_DARK_VORTEX = -1649049,
- SAY_DARK_VORTEX = -1649050,
+ SAY_AGGRO = 0,
+ SAY_NIGHT = 1,
+ SAY_LIGHT = 2,
+ EMOTE_VORTEX = 3,
+ EMOTE_TWINK_PACT = 4,
+ SAY_TWINK_PACT = 5,
+ SAY_KILL_PLAYER = 6,
+ SAY_BERSERK = 7,
+ SAY_DEATH = 8,
};
enum Equipment
@@ -167,7 +165,6 @@ struct boss_twin_baseAI : public ScriptedAI
uint32 m_uiTouchTimer;
uint32 m_uiBerserkTimer;
- int32 m_uiVortexSay;
int32 m_uiVortexEmote;
uint32 m_uiSisterNpcId;
uint32 m_uiMyEmphatySpellId;
@@ -179,7 +176,8 @@ struct boss_twin_baseAI : public ScriptedAI
uint32 m_uiSpikeSpellId;
uint32 m_uiTouchSpellId;
- void Reset() {
+ void Reset()
+ {
me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_NOT_SELECTABLE);
me->SetReactState(REACT_PASSIVE);
me->ModifyAuraState(m_uiAuraState, true);
@@ -224,7 +222,7 @@ struct boss_twin_baseAI : public ScriptedAI
{
if (who->GetTypeId() == TYPEID_PLAYER)
{
- DoScriptText(urand(0, 1) ? SAY_KILL1 : SAY_KILL2, me);
+ Talk(SAY_KILL_PLAYER);
if (instance)
instance->SetData(DATA_TRIBUTE_TO_IMMORTALITY_ELEGIBLE, 0);
}
@@ -256,7 +254,7 @@ struct boss_twin_baseAI : public ScriptedAI
void JustDied(Unit* /*killer*/)
{
- DoScriptText(SAY_DEATH, me);
+ Talk(SAY_DEATH);
if (instance)
{
if (Creature* pSister = GetSister())
@@ -298,7 +296,7 @@ struct boss_twin_baseAI : public ScriptedAI
instance->SetData(TYPE_VALKIRIES, IN_PROGRESS);
}
- DoScriptText(SAY_AGGRO, me);
+ Talk(SAY_AGGRO);
DoCast(me, m_uiSurgeSpellId);
}
@@ -336,8 +334,7 @@ struct boss_twin_baseAI : public ScriptedAI
{
if (Creature* pSister = GetSister())
pSister->AI()->DoAction(ACTION_VORTEX);
- DoScriptText(m_uiVortexEmote, me);
- DoScriptText(m_uiVortexSay, me);
+ Talk(m_uiVortexEmote);
DoCastAOE(m_uiVortexSpellId);
m_uiStage = 0;
m_uiSpecialAbilityTimer = MINUTE*IN_MILLISECONDS;
@@ -348,8 +345,8 @@ struct boss_twin_baseAI : public ScriptedAI
case 2: // Shield+Pact
if (m_uiSpecialAbilityTimer <= uiDiff)
{
- DoScriptText(EMOTE_SHIELD, me);
- DoScriptText(SAY_SHIELD, me);
+ Talk(EMOTE_TWINK_PACT);
+ Talk(SAY_TWINK_PACT);
if (Creature* pSister = GetSister())
{
pSister->AI()->DoAction(ACTION_PACT);
@@ -387,7 +384,7 @@ struct boss_twin_baseAI : public ScriptedAI
if (!m_bIsBerserk && m_uiBerserkTimer <= uiDiff)
{
DoCast(me, SPELL_BERSERK);
- DoScriptText(SAY_BERSERK, me);
+ Talk(SAY_BERSERK);
m_bIsBerserk = true;
}
else
@@ -426,8 +423,7 @@ public:
m_uiStage = 0;
m_uiWeapon = EQUIP_MAIN_1;
m_uiAuraState = AURA_STATE_UNKNOWN22;
- m_uiVortexEmote = EMOTE_LIGHT_VORTEX;
- m_uiVortexSay = SAY_LIGHT_VORTEX;
+ m_uiVortexEmote = EMOTE_VORTEX;
m_uiSisterNpcId = NPC_DARKBANE;
m_uiMyEmphatySpellId = SPELL_TWIN_EMPATHY_DARK;
m_uiOtherEssenceSpellId = SPELL_DARK_ESSENCE_HELPER;
@@ -496,8 +492,7 @@ public:
m_uiStage = 1;
m_uiWeapon = EQUIP_MAIN_2;
m_uiAuraState = AURA_STATE_UNKNOWN19;
- m_uiVortexEmote = EMOTE_DARK_VORTEX;
- m_uiVortexSay = SAY_DARK_VORTEX;
+ m_uiVortexEmote = EMOTE_VORTEX;
m_uiSisterNpcId = NPC_LIGHTBANE;
m_uiMyEmphatySpellId = SPELL_TWIN_EMPATHY_LIGHT;
m_uiOtherEssenceSpellId = SPELL_LIGHT_ESSENCE_HELPER;
diff --git a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/instance_trial_of_the_crusader.cpp b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/instance_trial_of_the_crusader.cpp
index 4dfe5708025..af6104008ff 100755
--- a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/instance_trial_of_the_crusader.cpp
+++ b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/instance_trial_of_the_crusader.cpp
@@ -47,6 +47,7 @@ class instance_trial_of_the_crusader : public InstanceMapScript
uint64 BarrentGUID;
uint64 TirionGUID;
+ uint64 TirionFordringGUID;
uint64 FizzlebangGUID;
uint64 GarroshGUID;
uint64 VarianGUID;
@@ -85,6 +86,8 @@ class instance_trial_of_the_crusader : public InstanceMapScript
TrialCounter = 50;
EventStage = 0;
+ TirionFordringGUID = 0;
+
TributeChestGUID = 0;
MainGateDoorGUID = 0;
@@ -147,6 +150,9 @@ class instance_trial_of_the_crusader : public InstanceMapScript
case NPC_TIRION:
TirionGUID = creature->GetGUID();
break;
+ case NPC_TIRION_FORDRING:
+ TirionFordringGUID = creature->GetGUID();
+ break;
case NPC_FIZZLEBANG:
FizzlebangGUID = creature->GetGUID();
break;
@@ -238,10 +244,18 @@ class instance_trial_of_the_crusader : public InstanceMapScript
switch (type)
{
case TYPE_JARAXXUS:
+ // Cleanup Icehowl
+ if (Creature* icehowl = instance->GetCreature(IcehowlGUID))
+ icehowl->DespawnOrUnsummon();
if (data == DONE)
EventStage = 2000;
break;
case TYPE_CRUSADERS:
+ // Cleanup Jaraxxus
+ if (Creature* jaraxxus = instance->GetCreature(JaraxxusGUID))
+ jaraxxus->DespawnOrUnsummon();
+ if (Creature* fizzlebang = instance->GetCreature(FizzlebangGUID))
+ fizzlebang->DespawnOrUnsummon();
switch (data)
{
case IN_PROGRESS:
@@ -261,6 +275,9 @@ class instance_trial_of_the_crusader : public InstanceMapScript
}
break;
case TYPE_VALKIRIES:
+ // Cleanup chest
+ if (GameObject* cache = instance->GetGameObject(CrusadersCacheGUID))
+ cache->Delete();
switch (data)
{
case FAIL:
@@ -315,7 +332,8 @@ class instance_trial_of_the_crusader : public InstanceMapScript
}
if (tributeChest)
if (Creature* tirion = instance->GetCreature(TirionGUID))
- if (GameObject* chest = tirion->SummonGameObject(tributeChest, 805.62f, 134.87f, 142.16f, 3.27f, 0, 0, 0, 0, 90000000))
+ // need proper location.this one is guessed based on videos
+ if (GameObject* chest = tirion->SummonGameObject(tributeChest, 643.814f, 136.027f, 141.295f, 0, 0, 0, 0, 0, 90000000))
chest->SetRespawnTime(chest->GetRespawnDelay());
break;
}
@@ -422,6 +440,8 @@ class instance_trial_of_the_crusader : public InstanceMapScript
return BarrentGUID;
case NPC_TIRION:
return TirionGUID;
+ case NPC_TIRION_FORDRING:
+ return TirionFordringGUID;
case NPC_FIZZLEBANG:
return FizzlebangGUID;
case NPC_GARROSH:
diff --git a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/trial_of_the_crusader.cpp b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/trial_of_the_crusader.cpp
index 4ad93c0afe1..0476b2cbacb 100755
--- a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/trial_of_the_crusader.cpp
+++ b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/trial_of_the_crusader.cpp
@@ -25,7 +25,6 @@ EndScriptData */
//Known Bugs:
// - Need better implementation of Gossip and correct gossip text and option
-// - Misses Dalaran Teleport at the end.
#include "ScriptMgr.h"
#include "ScriptedCreature.h"
@@ -34,45 +33,58 @@ EndScriptData */
enum eYells
{
- SAY_STAGE_0_01 = -1649070,
- SAY_STAGE_0_02 = -1649071,
- SAY_STAGE_0_03a = -1649072,
- SAY_STAGE_0_03h = -1649073,
- SAY_STAGE_0_04 = -1649074,
- SAY_STAGE_0_05 = -1649075,
- SAY_STAGE_0_06 = -1649076,
- SAY_STAGE_0_WIPE = -1649077,
- SAY_STAGE_1_01 = -1649080,
- SAY_STAGE_1_02 = -1649081,
- SAY_STAGE_1_03 = -1649082,
- SAY_STAGE_1_04 = -1649083,
- SAY_STAGE_1_05 = -1649030, //INTRO Jaraxxus
- SAY_STAGE_1_06 = -1649084,
- SAY_STAGE_1_07 = -1649086,
- SAY_STAGE_1_08 = -1649087,
- SAY_STAGE_1_09 = -1649088,
- SAY_STAGE_1_10 = -1649089,
- SAY_STAGE_1_11 = -1649090,
- SAY_STAGE_2_01 = -1649091,
- SAY_STAGE_2_02a = -1649092,
- SAY_STAGE_2_02h = -1649093,
- SAY_STAGE_2_03 = -1649094,
- SAY_STAGE_2_04a = -1649095,
- SAY_STAGE_2_04h = -1649096,
- SAY_STAGE_2_05a = -1649097,
- SAY_STAGE_2_05h = -1649098,
- SAY_STAGE_2_06 = -1649099,
- SAY_STAGE_3_01 = -1649100,
- SAY_STAGE_3_02 = -1649101,
- SAY_STAGE_3_03a = -1649102,
- SAY_STAGE_3_03h = -1649103,
- SAY_STAGE_4_01 = -1649104,
- SAY_STAGE_4_02 = -1649105,
- SAY_STAGE_4_03 = -1649106,
- SAY_STAGE_4_04 = -1649107,
- SAY_STAGE_4_05 = -1649108,
- SAY_STAGE_4_06 = -1649109,
- SAY_STAGE_4_07 = -1649110,
+ // Highlord Tirion Fordring - 34996
+ SAY_STAGE_0_01 = 0,
+ SAY_STAGE_0_02 = 1,
+ SAY_STAGE_0_04 = 2,
+ SAY_STAGE_0_05 = 3,
+ SAY_STAGE_0_06 = 4,
+ SAY_STAGE_0_WIPE = 5,
+ SAY_STAGE_1_01 = 6,
+ SAY_STAGE_1_07 = 7,
+ SAY_STAGE_1_08 = 8,
+ SAY_STAGE_1_11 = 9,
+ SAY_STAGE_2_01 = 10,
+ SAY_STAGE_2_03 = 11,
+ SAY_STAGE_2_06 = 12,
+ SAY_STAGE_3_01 = 13,
+ SAY_STAGE_3_02 = 14,
+ SAY_STAGE_4_01 = 15,
+ SAY_STAGE_4_03 = 16,
+
+ // Varian Wrynn
+ SAY_STAGE_0_03a = 0,
+ SAY_STAGE_1_10 = 1,
+ SAY_STAGE_2_02a = 2,
+ SAY_STAGE_2_04a = 3,
+ SAY_STAGE_2_05a = 4,
+ SAY_STAGE_3_03a = 5,
+
+ // Garrosh
+ SAY_STAGE_0_03h = 0,
+ SAY_STAGE_1_09 = 1,
+ SAY_STAGE_2_02h = 2,
+ SAY_STAGE_2_04h = 3,
+ SAY_STAGE_2_05h = 4,
+ SAY_STAGE_3_03h = 5,
+
+ // Wilfred Fizzlebang
+ SAY_STAGE_1_02 = 0,
+ SAY_STAGE_1_03 = 1,
+ SAY_STAGE_1_04 = 2,
+ SAY_STAGE_1_06 = 3,
+
+ // Lord Jaraxxus
+ SAY_STAGE_1_05 = 0,
+
+ // The Lich King
+ SAY_STAGE_4_02 = 0,
+ SAY_STAGE_4_05 = 1,
+ SAY_STAGE_4_04 = 2,
+
+ // Highlord Tirion Fordring - 36095
+ SAY_STAGE_4_06 = 0,
+ SAY_STAGE_4_07 = 1,
};
struct _Messages
@@ -108,11 +120,8 @@ class npc_announcer_toc10 : public CreatureScript
{
npc_announcer_toc10AI(Creature* creature) : ScriptedAI(creature)
{
- instance = creature->GetInstanceScript();
}
- InstanceScript* instance;
-
void Reset()
{
me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE);
@@ -206,7 +215,7 @@ class npc_announcer_toc10 : public CreatureScript
return true;
if (GameObject* floor = GameObject::GetGameObject(*player, instanceScript->GetData64(GO_ARGENT_COLISEUM_FLOOR)))
- floor->SetDestructibleState(GO_DESTRUCTIBLE_DESTROYED);
+ floor->SetDestructibleState(GO_DESTRUCTIBLE_DAMAGED);
creature->CastSpell(creature, 69016, false);
@@ -262,7 +271,7 @@ class boss_lich_king_toc : public CreatureScript
void MovementInform(uint32 uiType, uint32 uiId)
{
- if (uiType != POINT_MOTION_TYPE)
+ if (uiType != POINT_MOTION_TYPE || !instance)
return;
switch (uiId)
{
@@ -289,13 +298,13 @@ class boss_lich_king_toc : public CreatureScript
switch (instance->GetData(TYPE_EVENT))
{
case 5010:
- DoScriptText(SAY_STAGE_4_02, me);
+ Talk(SAY_STAGE_4_02);
m_uiUpdateTimer = 3000;
me->GetMotionMaster()->MovePoint(0, LichKingLoc[0]);
instance->SetData(TYPE_EVENT, 5020);
break;
case 5030:
- DoScriptText(SAY_STAGE_4_04, me);
+ Talk(SAY_STAGE_4_04);
me->SetUInt32Value(UNIT_NPC_EMOTESTATE, EMOTE_STATE_TALK);
m_uiUpdateTimer = 10000;
instance->SetData(TYPE_EVENT, 5040);
@@ -312,7 +321,7 @@ class boss_lich_king_toc : public CreatureScript
instance->SetData(TYPE_EVENT, 5060);
break;
case 5060:
- DoScriptText(SAY_STAGE_4_05, me);
+ Talk(SAY_STAGE_4_05);
me->HandleEmoteCommand(EMOTE_ONESHOT_KNEEL);
m_uiUpdateTimer = 2500;
instance->SetData(TYPE_EVENT, 5070);
@@ -324,22 +333,20 @@ class boss_lich_king_toc : public CreatureScript
break;
case 5080:
if (GameObject* go = instance->instance->GetGameObject(instance->GetData64(GO_ARGENT_COLISEUM_FLOOR)))
- go->SetDestructibleState(GO_DESTRUCTIBLE_DESTROYED);
+ go->SetDestructibleState(GO_DESTRUCTIBLE_DAMAGED);
me->CastSpell(me, 69016, false);
- if (instance)
- {
- instance->SetData(TYPE_LICH_KING, DONE);
- Creature* temp = Unit::GetCreature(*me, instance->GetData64(NPC_ANUBARAK));
- if (!temp || !temp->isAlive())
- temp = me->SummonCreature(NPC_ANUBARAK, AnubarakLoc[0].GetPositionX(), AnubarakLoc[0].GetPositionY(), AnubarakLoc[0].GetPositionZ(), 3, TEMPSUMMON_CORPSE_TIMED_DESPAWN, DESPAWN_TIME);
+ instance->SetData(TYPE_LICH_KING, DONE);
+ Creature* temp = Unit::GetCreature(*me, instance->GetData64(NPC_ANUBARAK));
+ if (!temp || !temp->isAlive())
+ temp = me->SummonCreature(NPC_ANUBARAK, AnubarakLoc[0].GetPositionX(), AnubarakLoc[0].GetPositionY(), AnubarakLoc[0].GetPositionZ(), 3, TEMPSUMMON_CORPSE_TIMED_DESPAWN, DESPAWN_TIME);
- instance->SetData(TYPE_EVENT, 0);
- }
+ instance->SetData(TYPE_EVENT, 0);
me->DespawnOrUnsummon();
m_uiUpdateTimer = 20000;
break;
}
} else m_uiUpdateTimer -= uiDiff;
+
instance->SetData(TYPE_EVENT_TIMER, m_uiUpdateTimer);
}
};
@@ -371,7 +378,7 @@ class npc_fizzlebang_toc : public CreatureScript
void JustDied(Unit* killer)
{
- DoScriptText(SAY_STAGE_1_06, me, killer);
+ Talk(SAY_STAGE_1_06, killer->GetGUID());
instance->SetData(TYPE_EVENT, 1180);
if (Creature* temp = Unit::GetCreature(*me, instance->GetData64(NPC_JARAXXUS)))
{
@@ -430,13 +437,13 @@ class npc_fizzlebang_toc : public CreatureScript
m_uiUpdateTimer = 4000;
break;
case 1120:
- DoScriptText(SAY_STAGE_1_02, me);
+ Talk(SAY_STAGE_1_02);
instance->SetData(TYPE_EVENT, 1130);
m_uiUpdateTimer = 12000;
break;
case 1130:
me->GetMotionMaster()->MovementExpired();
- DoScriptText(SAY_STAGE_1_03, me);
+ Talk(SAY_STAGE_1_03);
me->HandleEmoteCommand(EMOTE_ONESHOT_SPELL_CAST_OMNI);
if (Unit* pTrigger = me->SummonCreature(NPC_TRIGGER, ToCCommonLoc[1].GetPositionX(), ToCCommonLoc[1].GetPositionY(), ToCCommonLoc[1].GetPositionZ(), 4.69494f, TEMPSUMMON_MANUAL_DESPAWN))
{
@@ -470,7 +477,7 @@ class npc_fizzlebang_toc : public CreatureScript
m_uiUpdateTimer = 3000;
break;
case 1140:
- DoScriptText(SAY_STAGE_1_04, me);
+ Talk(SAY_STAGE_1_04);
if (Creature* temp = me->SummonCreature(NPC_JARAXXUS, ToCCommonLoc[1].GetPositionX(), ToCCommonLoc[1].GetPositionY(), ToCCommonLoc[1].GetPositionZ(), 5.0f, TEMPSUMMON_CORPSE_TIMED_DESPAWN, DESPAWN_TIME))
{
temp->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE);
@@ -492,7 +499,7 @@ class npc_fizzlebang_toc : public CreatureScript
break;
case 1144:
if (Creature* temp = Unit::GetCreature(*me, instance->GetData64(NPC_JARAXXUS)))
- DoScriptText(SAY_STAGE_1_05, temp);
+ temp->AI()->Talk(SAY_STAGE_1_05);
instance->SetData(TYPE_EVENT, 1150);
m_uiUpdateTimer = 5000;
break;
@@ -555,13 +562,13 @@ class npc_tirion_toc : public CreatureScript
{
case 110:
me->SetUInt32Value(UNIT_NPC_EMOTESTATE, EMOTE_ONESHOT_TALK);
- DoScriptText(SAY_STAGE_0_01, me);
+ Talk(SAY_STAGE_0_01);
m_uiUpdateTimer = 22000;
instance->SetData(TYPE_EVENT, 120);
break;
case 140:
me->SetUInt32Value(UNIT_NPC_EMOTESTATE, EMOTE_ONESHOT_TALK);
- DoScriptText(SAY_STAGE_0_02, me);
+ Talk(SAY_STAGE_0_02);
m_uiUpdateTimer = 5000;
instance->SetData(TYPE_EVENT, 150);
break;
@@ -587,7 +594,7 @@ class npc_tirion_toc : public CreatureScript
instance->SetData(TYPE_EVENT, 160);
break;
case 200:
- DoScriptText(SAY_STAGE_0_04, me);
+ Talk(SAY_STAGE_0_04);
m_uiUpdateTimer = 8000;
instance->SetData(TYPE_EVENT, 205);
break;
@@ -619,7 +626,7 @@ class npc_tirion_toc : public CreatureScript
instance->SetData(TYPE_EVENT, 230);
break;
case 300:
- DoScriptText(SAY_STAGE_0_05, me);
+ Talk(SAY_STAGE_0_05);
m_uiUpdateTimer = 8000;
instance->SetData(TYPE_EVENT, 305);
break;
@@ -646,54 +653,54 @@ class npc_tirion_toc : public CreatureScript
instance->SetData(TYPE_EVENT, 320);
break;
case 400:
- DoScriptText(SAY_STAGE_0_06, me);
+ Talk(SAY_STAGE_0_06);
m_uiUpdateTimer = 5000;
instance->SetData(TYPE_EVENT, 0);
break;
case 666:
- DoScriptText(SAY_STAGE_0_WIPE, me);
+ Talk(SAY_STAGE_0_WIPE);
m_uiUpdateTimer = 5000;
instance->SetData(TYPE_EVENT, 0);
break;
case 1010:
- DoScriptText(SAY_STAGE_1_01, me);
+ Talk(SAY_STAGE_1_01);
m_uiUpdateTimer = 7000;
instance->DoUseDoorOrButton(instance->GetData64(GO_MAIN_GATE_DOOR));
me->SummonCreature(NPC_FIZZLEBANG, ToCSpawnLoc[0].GetPositionX(), ToCSpawnLoc[0].GetPositionY(), ToCSpawnLoc[0].GetPositionZ(), 2, TEMPSUMMON_CORPSE_TIMED_DESPAWN, DESPAWN_TIME);
instance->SetData(TYPE_EVENT, 0);
break;
case 1180:
- DoScriptText(SAY_STAGE_1_07, me);
+ Talk(SAY_STAGE_1_07);
m_uiUpdateTimer = 3000;
instance->SetData(TYPE_EVENT, 0);
break;
case 2000:
- DoScriptText(SAY_STAGE_1_08, me);
+ Talk(SAY_STAGE_1_08);
m_uiUpdateTimer = 18000;
instance->SetData(TYPE_EVENT, 2010);
break;
case 2030:
- DoScriptText(SAY_STAGE_1_11, me);
+ Talk(SAY_STAGE_1_11);
m_uiUpdateTimer = 5000;
instance->SetData(TYPE_EVENT, 0);
break;
case 3000:
- DoScriptText(SAY_STAGE_2_01, me);
+ Talk(SAY_STAGE_2_01);
m_uiUpdateTimer = 12000;
instance->SetData(TYPE_EVENT, 3050);
break;
case 3001:
- DoScriptText(SAY_STAGE_2_01, me);
+ Talk(SAY_STAGE_2_01);
m_uiUpdateTimer = 12000;
instance->SetData(TYPE_EVENT, 3051);
break;
case 3060:
- DoScriptText(SAY_STAGE_2_03, me);
+ Talk(SAY_STAGE_2_03);
m_uiUpdateTimer = 5000;
instance->SetData(TYPE_EVENT, 3070);
break;
case 3061:
- DoScriptText(SAY_STAGE_2_03, me);
+ Talk(SAY_STAGE_2_03);
m_uiUpdateTimer = 5000;
instance->SetData(TYPE_EVENT, 3071);
break;
@@ -718,17 +725,17 @@ class npc_tirion_toc : public CreatureScript
break;
//Crusaders battle end
case 3100:
- DoScriptText(SAY_STAGE_2_06, me);
+ Talk(SAY_STAGE_2_06);
m_uiUpdateTimer = 5000;
instance->SetData(TYPE_EVENT, 0);
break;
case 4000:
- DoScriptText(SAY_STAGE_3_01, me);
+ Talk(SAY_STAGE_3_01);
m_uiUpdateTimer = 13000;
instance->SetData(TYPE_EVENT, 4010);
break;
case 4010:
- DoScriptText(SAY_STAGE_3_02, me);
+ Talk(SAY_STAGE_3_02);
if (Creature* temp = me->SummonCreature(NPC_LIGHTBANE, ToCSpawnLoc[1].GetPositionX(), ToCSpawnLoc[1].GetPositionY(), ToCSpawnLoc[1].GetPositionZ(), 5, TEMPSUMMON_CORPSE_TIMED_DESPAWN, DESPAWN_TIME))
{
temp->SetVisible(false);
@@ -769,34 +776,38 @@ class npc_tirion_toc : public CreatureScript
instance->SetData(TYPE_EVENT, 5000);
break;
case 5000:
- DoScriptText(SAY_STAGE_4_01, me);
+ Talk(SAY_STAGE_4_01);
m_uiUpdateTimer = 10000;
instance->SetData(TYPE_EVENT, 5005);
break;
case 5005:
m_uiUpdateTimer = 8000;
instance->SetData(TYPE_EVENT, 5010);
- me->SummonCreature(NPC_LICH_KING_1, ToCSpawnLoc[0].GetPositionX(), ToCSpawnLoc[0].GetPositionY(), ToCSpawnLoc[0].GetPositionZ(), 5);
+ me->SummonCreature(NPC_LICH_KING_1, ToCCommonLoc[2].GetPositionX(), ToCCommonLoc[2].GetPositionY(), ToCCommonLoc[2].GetPositionZ(), 5);
break;
case 5020:
- DoScriptText(SAY_STAGE_4_03, me);
+ Talk(SAY_STAGE_4_03);
m_uiUpdateTimer = 1000;
instance->SetData(TYPE_EVENT, 0);
break;
case 6000:
- me->NearTeleportTo(AnubarakLoc[0].GetPositionX(), AnubarakLoc[0].GetPositionY(), AnubarakLoc[0].GetPositionZ(), 4.0f);
+ me->SummonCreature(NPC_TIRION_FORDRING, EndSpawnLoc[0].GetPositionX(), EndSpawnLoc[0].GetPositionY(), EndSpawnLoc[0].GetPositionZ());
+ me->SummonCreature(NPC_ARGENT_MAGE, EndSpawnLoc[1].GetPositionX(), EndSpawnLoc[1].GetPositionY(), EndSpawnLoc[1].GetPositionZ());
+ me->SummonGameObject(GO_PORTAL_TO_DALARAN, EndSpawnLoc[2].GetPositionX(), EndSpawnLoc[2].GetPositionY(), EndSpawnLoc[2].GetPositionZ(), 5, 0, 0, 0, 0, 0);
m_uiUpdateTimer = 20000;
instance->SetData(TYPE_EVENT, 6005);
break;
case 6005:
- DoScriptText(SAY_STAGE_4_06, me);
+ if (Creature* tirionFordring = Unit::GetCreature((*me), instance->GetData64(NPC_TIRION_FORDRING)))
+ tirionFordring->AI()->Talk(SAY_STAGE_4_06);
m_uiUpdateTimer = 20000;
instance->SetData(TYPE_EVENT, 6010);
break;
case 6010:
if (IsHeroic())
{
- DoScriptText(SAY_STAGE_4_07, me);
+ if (Creature* tirionFordring = Unit::GetCreature((*me), instance->GetData64(NPC_TIRION_FORDRING)))
+ tirionFordring->AI()->Talk(SAY_STAGE_4_07);
m_uiUpdateTimer = 60000;
instance->SetData(TYPE_ANUBARAK, SPECIAL);
instance->SetData(TYPE_EVENT, 6020);
@@ -854,7 +865,7 @@ class npc_garrosh_toc : public CreatureScript
{
case 130:
me->SetUInt32Value(UNIT_NPC_EMOTESTATE, EMOTE_ONESHOT_TALK);
- DoScriptText(SAY_STAGE_0_03h, me);
+ Talk(SAY_STAGE_0_03h);
m_uiUpdateTimer = 3000;
instance->SetData(TYPE_EVENT, 132);
break;
@@ -864,27 +875,27 @@ class npc_garrosh_toc : public CreatureScript
instance->SetData(TYPE_EVENT, 140);
break;
case 2010:
- DoScriptText(SAY_STAGE_1_09, me);
+ Talk(SAY_STAGE_1_09);
m_uiUpdateTimer = 9000;
instance->SetData(TYPE_EVENT, 2020);
break;
case 3050:
- DoScriptText(SAY_STAGE_2_02h, me);
+ Talk(SAY_STAGE_2_02h);
m_uiUpdateTimer = 15000;
instance->SetData(TYPE_EVENT, 3060);
break;
case 3070:
- DoScriptText(SAY_STAGE_2_04h, me);
+ Talk(SAY_STAGE_2_04h);
m_uiUpdateTimer = 6000;
instance->SetData(TYPE_EVENT, 3080);
break;
case 3081:
- DoScriptText(SAY_STAGE_2_05h, me);
+ Talk(SAY_STAGE_2_05h);
m_uiUpdateTimer = 3000;
instance->SetData(TYPE_EVENT, 3091);
break;
case 4030:
- DoScriptText(SAY_STAGE_3_03h, me);
+ Talk(SAY_STAGE_3_03h);
m_uiUpdateTimer = 5000;
instance->SetData(TYPE_EVENT, 4040);
break;
@@ -935,7 +946,7 @@ class npc_varian_toc : public CreatureScript
{
case 120:
me->SetUInt32Value(UNIT_NPC_EMOTESTATE, EMOTE_ONESHOT_TALK);
- DoScriptText(SAY_STAGE_0_03a, me);
+ Talk(SAY_STAGE_0_03a);
m_uiUpdateTimer = 2000;
instance->SetData(TYPE_EVENT, 122);
break;
@@ -945,27 +956,27 @@ class npc_varian_toc : public CreatureScript
instance->SetData(TYPE_EVENT, 130);
break;
case 2020:
- DoScriptText(SAY_STAGE_1_10, me);
+ Talk(SAY_STAGE_1_10);
m_uiUpdateTimer = 5000;
instance->SetData(TYPE_EVENT, 2030);
break;
case 3051:
- DoScriptText(SAY_STAGE_2_02a, me);
+ Talk(SAY_STAGE_2_02a);
m_uiUpdateTimer = 10000;
instance->SetData(TYPE_EVENT, 3061);
break;
case 3071:
- DoScriptText(SAY_STAGE_2_04a, me);
+ Talk(SAY_STAGE_2_04a);
m_uiUpdateTimer = 5000;
instance->SetData(TYPE_EVENT, 3081);
break;
case 3080:
- DoScriptText(SAY_STAGE_2_05a, me);
+ Talk(SAY_STAGE_2_05a);
m_uiUpdateTimer = 3000;
instance->SetData(TYPE_EVENT, 3090);
break;
case 4020:
- DoScriptText(SAY_STAGE_3_03a, me);
+ Talk(SAY_STAGE_3_03a);
m_uiUpdateTimer = 5000;
instance->SetData(TYPE_EVENT, 4040);
break;
diff --git a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/trial_of_the_crusader.h b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/trial_of_the_crusader.h
index 99525b6fb32..58cbd727963 100644
--- a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/trial_of_the_crusader.h
+++ b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/trial_of_the_crusader.h
@@ -53,8 +53,8 @@ const Position ToCCommonLoc[]=
{563.833008f, 195.244995f, 394.585561f, 0}, // 5 - Center
{573.5f, 180.5f, 395.14f, 0}, // 6 Move 0 Right
{553.5f, 180.5f, 395.14f, 0}, // 7 Move 0 Left
- {585.5f, 170.0f, 395.14f, 0}, // 8 Move 1 Right
- {545.5f, 170.0f, 395.14f, 0}, // 9 Move 1 Left
+ {573.0f, 170.0f, 395.14f, 0}, // 8 Move 1 Right
+ {555.5f, 170.0f, 395.14f, 0}, // 9 Move 1 Left
{563.8f, 216.1f, 395.1f, 0}, // 10 Behind the door
{575.042358f, 195.260727f, 395.137146f, 0}, // 5
@@ -129,6 +129,13 @@ const Position AnubarakLoc[]=
{740.184509f, 193.443390f, 142.117584f, 0}, // 4 - Nerub Spawn
};
+const Position EndSpawnLoc[]=
+{
+ {648.9167f, 131.0208f, 141.6161f, 0}, // 0 - Highlord Tirion Fordring
+ {649.1614f, 142.0399f, 141.3057f ,0}, // 1 - Argent Mage
+ {644.6250f, 149.2743f, 140.6015f ,0}, // 2 - Portal to Dalaran
+};
+
enum euiWorldStates
{
UPDATE_STATE_UI_SHOW = 4390,
@@ -162,6 +169,8 @@ enum eCreature
{
NPC_BARRENT = 34816,
NPC_TIRION = 34996,
+ NPC_TIRION_FORDRING = 36095,
+ NPC_ARGENT_MAGE = 36097,
NPC_FIZZLEBANG = 35458,
NPC_GARROSH = 34995,
NPC_VARIAN = 34990,
@@ -244,6 +253,7 @@ enum eGameObject
GO_MAIN_GATE_DOOR = 195647,
GO_EAST_PORTCULLIS = 195648,
GO_WEB_DOOR = 195485,
+ GO_PORTAL_TO_DALARAN = 195682,
};
enum eAchievementData
diff --git a/src/server/scripts/Northrend/DraktharonKeep/instance_drak_tharon_keep.cpp b/src/server/scripts/Northrend/DraktharonKeep/instance_drak_tharon_keep.cpp
index 7778a79a816..99401c1d944 100644
--- a/src/server/scripts/Northrend/DraktharonKeep/instance_drak_tharon_keep.cpp
+++ b/src/server/scripts/Northrend/DraktharonKeep/instance_drak_tharon_keep.cpp
@@ -70,6 +70,7 @@ public:
void Initialize()
{
+ memset(&m_auiEncounter, 0, sizeof(m_auiEncounter));
uiTrollgore = 0;
uiNovos = 0;
uiDred = 0;
@@ -190,16 +191,12 @@ public:
{
OUT_SAVE_INST_DATA;
- std::string str_data;
-
std::ostringstream saveStream;
saveStream << "D K " << m_auiEncounter[0] << ' ' << m_auiEncounter[1] << ' '
<< m_auiEncounter[2] << ' ' << m_auiEncounter[3];
- str_data = saveStream.str();
-
OUT_SAVE_INST_DATA_COMPLETE;
- return str_data;
+ return saveStream.str();
}
void Load(const char* in)
diff --git a/src/server/scripts/Northrend/FrozenHalls/PitOfSaron/boss_krickandick.cpp b/src/server/scripts/Northrend/FrozenHalls/PitOfSaron/boss_krickandick.cpp
index 57d99908bfb..0d6e779c006 100644
--- a/src/server/scripts/Northrend/FrozenHalls/PitOfSaron/boss_krickandick.cpp
+++ b/src/server/scripts/Northrend/FrozenHalls/PitOfSaron/boss_krickandick.cpp
@@ -228,13 +228,13 @@ class boss_ick : public CreatureScript
case EVENT_TOXIC_WASTE:
if (Creature* krick = GetKrick())
if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0))
- krick->CastSpell(target, SPELL_TOXIC_WASTE, false);
+ krick->CastSpell(target, SPELL_TOXIC_WASTE, TRIGGERED_IGNORE_CASTER_MOUNTED_OR_ON_VEHICLE);
events.ScheduleEvent(EVENT_TOXIC_WASTE, urand(7000, 10000));
break;
case EVENT_SHADOW_BOLT:
if (Creature* krick = GetKrick())
if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 1))
- krick->CastSpell(target, SPELL_SHADOW_BOLT, false);
+ krick->CastSpell(target, SPELL_SHADOW_BOLT, TRIGGERED_IGNORE_CASTER_MOUNTED_OR_ON_VEHICLE);
events.ScheduleEvent(EVENT_SHADOW_BOLT, 15000);
return;
case EVENT_MIGHTY_KICK:
diff --git a/src/server/scripts/Northrend/IcecrownCitadel/boss_professor_putricide.cpp b/src/server/scripts/Northrend/IcecrownCitadel/boss_professor_putricide.cpp
index a9ba0baa86f..489616332c8 100755
--- a/src/server/scripts/Northrend/IcecrownCitadel/boss_professor_putricide.cpp
+++ b/src/server/scripts/Northrend/IcecrownCitadel/boss_professor_putricide.cpp
@@ -23,6 +23,7 @@
#include "Spell.h"
#include "icecrown_citadel.h"
#include "Vehicle.h"
+#include "GridNotifiers.h"
enum ScriptTexts
{
@@ -185,12 +186,15 @@ class AbominationDespawner
if (Vehicle* veh = summon->GetVehicleKit())
veh->RemoveAllPassengers(); // also despawns the vehicle
+ // Found unit is Mutated Abomination, remove it
return true;
}
+ // Found unit is not Mutated Abomintaion, leave it
return false;
}
+ // No unit found, remove from SummonList
return true;
}
@@ -198,6 +202,19 @@ class AbominationDespawner
Unit* _owner;
};
+struct RotfaceHeightCheck
+{
+ RotfaceHeightCheck(Creature* rotface) : _rotface(rotface) { }
+
+ bool operator()(Creature* stalker) const
+ {
+ return stalker->GetPositionZ() < _rotface->GetPositionZ() + 5.0f;
+ }
+
+private:
+ Creature* _rotface;
+};
+
class boss_professor_putricide : public CreatureScript
{
public:
@@ -246,7 +263,7 @@ class boss_professor_putricide : public CreatureScript
events.Reset();
events.ScheduleEvent(EVENT_BERSERK, 600000);
events.ScheduleEvent(EVENT_SLIME_PUDDLE, 10000);
- events.ScheduleEvent(EVENT_UNSTABLE_EXPERIMENT, urand(25000, 30000));
+ events.ScheduleEvent(EVENT_UNSTABLE_EXPERIMENT, urand(30000, 35000));
if (IsHeroic())
events.ScheduleEvent(EVENT_UNBOUND_PLAGUE, 20000);
@@ -295,18 +312,16 @@ class boss_professor_putricide : public CreatureScript
// no possible aura seen in sniff adding the aurastate
summon->ModifyAuraState(AURA_STATE_UNKNOWN22, true);
summon->CastSpell(summon, SPELL_GASEOUS_BLOAT_PROC, true);
- summon->CastCustomSpell(SPELL_GASEOUS_BLOAT, SPELLVALUE_AURA_STACK, 10, summon, false);
summon->ApplySpellImmune(0, IMMUNITY_EFFECT, SPELL_EFFECT_KNOCK_BACK, true);
summon->SetReactState(REACT_PASSIVE);
- return;
+ break;
case NPC_VOLATILE_OOZE:
// no possible aura seen in sniff adding the aurastate
summon->ModifyAuraState(AURA_STATE_UNKNOWN19, true);
summon->CastSpell(summon, SPELL_OOZE_ERUPTION_SEARCH_PERIODIC, true);
- summon->CastSpell(summon, SPELL_VOLATILE_OOZE_ADHESIVE, false);
summon->ApplySpellImmune(0, IMMUNITY_EFFECT, SPELL_EFFECT_KNOCK_BACK, true);
summon->SetReactState(REACT_PASSIVE);
- return;
+ break;
case NPC_CHOKING_GAS_BOMB:
summon->CastSpell(summon, SPELL_CHOKING_GAS_BOMB_PERIODIC, true);
summon->CastSpell(summon, SPELL_CHOKING_GAS_EXPLOSION_TRIGGER, true);
@@ -428,7 +443,8 @@ class boss_professor_putricide : public CreatureScript
if (Creature* rotface = Unit::GetCreature(*me, instance->GetData64(DATA_ROTFACE)))
{
std::list<Creature*> list;
- GetCreatureListWithEntryInGrid(list, rotface, NPC_PUDDLE_STALKER, 36.0f);
+ GetCreatureListWithEntryInGrid(list, rotface, NPC_PUDDLE_STALKER, 50.0f);
+ list.remove_if(RotfaceHeightCheck(rotface));
if (list.size() > 4)
{
list.sort(Trinity::ObjectDistanceOrderPred(rotface));
@@ -510,7 +526,6 @@ class boss_professor_putricide : public CreatureScript
SetPhase(PHASE_COMBAT_3);
events.ScheduleEvent(EVENT_MUTATED_PLAGUE, 25000);
events.CancelEvent(EVENT_UNSTABLE_EXPERIMENT);
- summons.remove_if(AbominationDespawner(me));
break;
default:
break;
@@ -643,7 +658,7 @@ class boss_professor_putricide : public CreatureScript
case EVENT_UNBOUND_PLAGUE:
if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, NonTankTargetSelector(me)))
{
- me->CastCustomSpell(SPELL_UNBOUND_PLAGUE, SPELLVALUE_BASE_POINT0, 775, target);
+ DoCast(target, SPELL_UNBOUND_PLAGUE);
DoCast(target, SPELL_UNBOUND_PLAGUE_SEARCHER);
}
events.ScheduleEvent(EVENT_UNBOUND_PLAGUE, 90000);
@@ -668,6 +683,7 @@ class boss_professor_putricide : public CreatureScript
me->SetFacingToObject(face);
me->HandleEmoteCommand(EMOTE_ONESHOT_KNEEL);
Talk(SAY_TRANSFORM_2);
+ summons.remove_if(AbominationDespawner(me));
events.ScheduleEvent(EVENT_RESUME_ATTACK, 8500, 0, PHASE_COMBAT_3);
break;
default:
@@ -702,57 +718,78 @@ class boss_professor_putricide : public CreatureScript
}
};
-class npc_volatile_ooze : public CreatureScript
+class npc_putricide_oozeAI : public ScriptedAI
{
public:
- npc_volatile_ooze() : CreatureScript("npc_volatile_ooze") { }
+ npc_putricide_oozeAI(Creature* creature, uint32 hitTargetSpellId) : ScriptedAI(creature),
+ _newTargetSelectTimer(0), _hitTargetSpellId(hitTargetSpellId)
+ {
+ }
- struct npc_putricide_oozeAI : public ScriptedAI
+ void SpellHitTarget(Unit* /*target*/, SpellInfo const* spell)
{
- npc_putricide_oozeAI(Creature* creature) : ScriptedAI(creature)
- {
- _newTargetSelectTimer = 0;
- }
+ if (!_newTargetSelectTimer && spell->Id == sSpellMgr->GetSpellIdForDifficulty(_hitTargetSpellId, me))
+ _newTargetSelectTimer = 1000;
+ }
- void SpellHitTarget(Unit* /*target*/, SpellInfo const* spell)
- {
- if (!_newTargetSelectTimer && spell->Id == sSpellMgr->GetSpellIdForDifficulty(SPELL_OOZE_ERUPTION, me))
- _newTargetSelectTimer = 1000;
- }
+ void SpellHit(Unit* /*caster*/, SpellInfo const* spell)
+ {
+ if (spell->Id == SPELL_TEAR_GAS_CREATURE)
+ _newTargetSelectTimer = 1000;
+ }
+
+ void UpdateAI(uint32 const diff)
+ {
+ if (!UpdateVictim() && !_newTargetSelectTimer)
+ return;
+
+ if (!_newTargetSelectTimer && !me->IsNonMeleeSpellCasted(false, false, true, false, true))
+ _newTargetSelectTimer = 1000;
+
+ DoMeleeAttackIfReady();
- void SpellHit(Unit* /*caster*/, SpellInfo const* spell)
+ if (!_newTargetSelectTimer)
+ return;
+
+ if (me->HasAura(SPELL_TEAR_GAS_CREATURE))
+ return;
+
+ if (_newTargetSelectTimer <= diff)
{
- if (spell->Id == SPELL_TEAR_GAS_CREATURE)
- _newTargetSelectTimer = 1000;
+ _newTargetSelectTimer = 0;
+ CastMainSpell();
}
+ else
+ _newTargetSelectTimer -= diff;
+ }
- void UpdateAI(uint32 const diff)
- {
- if (!UpdateVictim() && !_newTargetSelectTimer)
- return;
+ virtual void CastMainSpell() = 0;
- if (!_newTargetSelectTimer)
- return;
+ private:
+ uint32 _hitTargetSpellId;
+ uint32 _newTargetSelectTimer;
+};
- if (me->HasAura(SPELL_TEAR_GAS_CREATURE))
- return;
+class npc_volatile_ooze : public CreatureScript
+{
+ public:
+ npc_volatile_ooze() : CreatureScript("npc_volatile_ooze") { }
- if (_newTargetSelectTimer <= diff)
- {
- _newTargetSelectTimer = 0;
- me->CastSpell(me, SPELL_VOLATILE_OOZE_ADHESIVE, false);
- }
- else
- _newTargetSelectTimer -= diff;
+ struct npc_volatile_oozeAI : public npc_putricide_oozeAI
+ {
+ npc_volatile_oozeAI(Creature* creature) : npc_putricide_oozeAI(creature, SPELL_OOZE_ERUPTION)
+ {
}
- private:
- uint32 _newTargetSelectTimer;
+ void CastMainSpell()
+ {
+ me->CastSpell(me, SPELL_VOLATILE_OOZE_ADHESIVE, false);
+ }
};
CreatureAI* GetAI(Creature* creature) const
{
- return GetIcecrownCitadelAI<npc_putricide_oozeAI>(creature);
+ return GetIcecrownCitadelAI<npc_volatile_oozeAI>(creature);
}
};
@@ -761,45 +798,16 @@ class npc_gas_cloud : public CreatureScript
public:
npc_gas_cloud() : CreatureScript("npc_gas_cloud") { }
- struct npc_gas_cloudAI : public ScriptedAI
+ struct npc_gas_cloudAI : public npc_putricide_oozeAI
{
- npc_gas_cloudAI(Creature* creature) : ScriptedAI(creature)
+ npc_gas_cloudAI(Creature* creature) : npc_putricide_oozeAI(creature, SPELL_EXPUNGED_GAS)
{
_newTargetSelectTimer = 0;
}
- void SpellHitTarget(Unit* /*target*/, SpellInfo const* spell)
- {
- if (!_newTargetSelectTimer && spell->Id == sSpellMgr->GetSpellIdForDifficulty(SPELL_EXPUNGED_GAS, me))
- _newTargetSelectTimer = 1000;
- }
-
- void SpellHit(Unit* /*caster*/, SpellInfo const* spell)
+ void CastMainSpell()
{
- if (spell->Id == SPELL_TEAR_GAS_CREATURE)
- _newTargetSelectTimer = 1000;
- }
-
- void UpdateAI(uint32 const diff)
- {
- if (!UpdateVictim() && !_newTargetSelectTimer)
- return;
-
- DoMeleeAttackIfReady();
-
- if (!_newTargetSelectTimer)
- return;
-
- if (me->HasAura(SPELL_TEAR_GAS_CREATURE))
- return;
-
- if (_newTargetSelectTimer <= diff)
- {
- _newTargetSelectTimer = 0;
- me->CastCustomSpell(SPELL_GASEOUS_BLOAT, SPELLVALUE_AURA_STACK, 10, me, false);
- }
- else
- _newTargetSelectTimer -= diff;
+ me->CastCustomSpell(SPELL_GASEOUS_BLOAT, SPELLVALUE_AURA_STACK, 10, me, false);
}
private:
@@ -900,23 +908,12 @@ class spell_putricide_ooze_channel : public SpellScriptLoader
GetCaster()->AddThreat(GetHitUnit(), 500000000.0f); // value seen in sniff
}
- // temporary, until SelectTarget are not called on empty lists
- void CheckTarget()
- {
- if (_target)
- return;
-
- FinishCast(SPELL_FAILED_NO_VALID_TARGETS);
- GetCaster()->ToCreature()->DespawnOrUnsummon(1); // despawn next update
- }
-
void Register()
{
OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_putricide_ooze_channel_SpellScript::SelectTarget, EFFECT_0, TARGET_UNIT_SRC_AREA_ENEMY);
OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_putricide_ooze_channel_SpellScript::SetTarget, EFFECT_1, TARGET_UNIT_SRC_AREA_ENEMY);
OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_putricide_ooze_channel_SpellScript::SetTarget, EFFECT_2, TARGET_UNIT_SRC_AREA_ENEMY);
AfterHit += SpellHitFn(spell_putricide_ooze_channel_SpellScript::StartAttack);
- OnCast += SpellCastFn(spell_putricide_ooze_channel_SpellScript::CheckTarget);
}
WorldObject* _target;
@@ -1125,6 +1122,21 @@ class spell_putricide_unbound_plague : public SpellScriptLoader
return true;
}
+ SpellCastResult CheckCast()
+ {
+ if (AuraEffect const* eff = GetCaster()->GetAuraEffect(SPELL_UNBOUND_PLAGUE_SEARCHER, EFFECT_0))
+ if (eff->GetTickNumber() < 2)
+ return SPELL_FAILED_DONT_REPORT;
+
+ return SPELL_CAST_OK;
+ }
+
+ void FilterTargets(std::list<WorldObject*>& targets)
+ {
+ targets.remove_if(Trinity::UnitAuraCheck(true, sSpellMgr->GetSpellIdForDifficulty(SPELL_UNBOUND_PLAGUE, GetCaster())));
+ Trinity::Containers::RandomResizeList(targets, 1);
+ }
+
void HandleScript(SpellEffIndex /*effIndex*/)
{
if (!GetHitUnit())
@@ -1159,6 +1171,8 @@ class spell_putricide_unbound_plague : public SpellScriptLoader
void Register()
{
+ OnCheckCast += SpellCheckCastFn(spell_putricide_unbound_plague_SpellScript::CheckCast);
+ OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_putricide_unbound_plague_SpellScript::FilterTargets, EFFECT_0, TARGET_UNIT_SRC_AREA_ALLY);
OnEffectHitTarget += SpellEffectFn(spell_putricide_unbound_plague_SpellScript::HandleScript, EFFECT_0, SPELL_EFFECT_SCRIPT_EFFECT);
}
};
diff --git a/src/server/scripts/Northrend/IcecrownCitadel/boss_the_lich_king.cpp b/src/server/scripts/Northrend/IcecrownCitadel/boss_the_lich_king.cpp
index a8657925131..ba1a0614cdf 100644
--- a/src/server/scripts/Northrend/IcecrownCitadel/boss_the_lich_king.cpp
+++ b/src/server/scripts/Northrend/IcecrownCitadel/boss_the_lich_king.cpp
@@ -2112,7 +2112,7 @@ class spell_the_lich_king_necrotic_plague : public SpellScriptLoader
CustomSpellValues values;
//values.AddSpellMod(SPELLVALUE_AURA_STACK, 2);
values.AddSpellMod(SPELLVALUE_MAX_TARGETS, 1);
- GetTarget()->CastCustomSpell(SPELL_NECROTIC_PLAGUE_JUMP, values, NULL, true, NULL, NULL, GetCasterGUID());
+ GetTarget()->CastCustomSpell(SPELL_NECROTIC_PLAGUE_JUMP, values, NULL, TRIGGERED_FULL_MASK, NULL, NULL, GetCasterGUID());
if (Unit* caster = GetCaster())
caster->CastSpell(caster, SPELL_PLAGUE_SIPHON, true);
}
@@ -2204,7 +2204,7 @@ class spell_the_lich_king_necrotic_plague_jump : public SpellScriptLoader
CustomSpellValues values;
values.AddSpellMod(SPELLVALUE_AURA_STACK, GetStackAmount());
- GetTarget()->CastCustomSpell(SPELL_NECROTIC_PLAGUE_JUMP, values, NULL, true, NULL, NULL, GetCasterGUID());
+ GetTarget()->CastCustomSpell(SPELL_NECROTIC_PLAGUE_JUMP, values, NULL, TRIGGERED_FULL_MASK, NULL, NULL, GetCasterGUID());
if (Unit* caster = GetCaster())
caster->CastSpell(caster, SPELL_PLAGUE_SIPHON, true);
}
@@ -2223,7 +2223,7 @@ class spell_the_lich_king_necrotic_plague_jump : public SpellScriptLoader
CustomSpellValues values;
values.AddSpellMod(SPELLVALUE_AURA_STACK, GetStackAmount());
values.AddSpellMod(SPELLVALUE_BASE_POINT1, AURA_REMOVE_BY_ENEMY_SPELL); // add as marker (spell has no effect 1)
- GetTarget()->CastCustomSpell(SPELL_NECROTIC_PLAGUE_JUMP, values, NULL, true, NULL, NULL, GetCasterGUID());
+ GetTarget()->CastCustomSpell(SPELL_NECROTIC_PLAGUE_JUMP, values, NULL, TRIGGERED_FULL_MASK, NULL, NULL, GetCasterGUID());
if (Unit* caster = GetCaster())
caster->CastSpell(caster, SPELL_PLAGUE_SIPHON, true);
diff --git a/src/server/scripts/Northrend/Naxxramas/boss_four_horsemen.cpp b/src/server/scripts/Northrend/Naxxramas/boss_four_horsemen.cpp
index f81ddbf6bf8..29a0a11af9b 100644
--- a/src/server/scripts/Northrend/Naxxramas/boss_four_horsemen.cpp
+++ b/src/server/scripts/Northrend/Naxxramas/boss_four_horsemen.cpp
@@ -104,6 +104,7 @@ public:
if (me->GetEntry() == MOB_HORSEMEN[i])
id = Horsemen(i);
caster = (id == HORSEMEN_LADY || id == HORSEMEN_SIR);
+ encounterActionReset = false;
}
Horsemen id;
diff --git a/src/server/scripts/Northrend/Naxxramas/boss_gothik.cpp b/src/server/scripts/Northrend/Naxxramas/boss_gothik.cpp
index 2ea234775c0..d335d36e112 100644
--- a/src/server/scripts/Northrend/Naxxramas/boss_gothik.cpp
+++ b/src/server/scripts/Northrend/Naxxramas/boss_gothik.cpp
@@ -314,15 +314,14 @@ class boss_gothik : public CreatureScript
bool CheckGroupSplitted()
{
- bool checklife = false;
- bool checkdead = false;
-
Map* map = me->GetMap();
if (map && map->IsDungeon())
{
Map::PlayerList const &PlayerList = map->GetPlayers();
if (!PlayerList.isEmpty())
{
+ bool checklife = false;
+ bool checkdead = false;
for (Map::PlayerList::const_iterator i = PlayerList.begin(); i != PlayerList.end(); ++i)
{
if (i->getSource() && i->getSource()->isAlive() &&
diff --git a/src/server/scripts/Northrend/Nexus/Nexus/instance_nexus.cpp b/src/server/scripts/Northrend/Nexus/Nexus/instance_nexus.cpp
index 152f0b2d647..5d430ae048d 100644
--- a/src/server/scripts/Northrend/Nexus/Nexus/instance_nexus.cpp
+++ b/src/server/scripts/Northrend/Nexus/Nexus/instance_nexus.cpp
@@ -58,6 +58,9 @@ public:
Anomalus = 0;
Keristrasza = 0;
+ AnomalusContainmentSphere = 0;
+ OrmoroksContainmentSphere = 0;
+ TelestrasContainmentSphere = 0;
}
void OnCreatureCreate(Creature* creature)
diff --git a/src/server/scripts/Northrend/Nexus/Oculus/boss_eregos.cpp b/src/server/scripts/Northrend/Nexus/Oculus/boss_eregos.cpp
index 708ed600933..e68e28be99b 100644
--- a/src/server/scripts/Northrend/Nexus/Oculus/boss_eregos.cpp
+++ b/src/server/scripts/Northrend/Nexus/Oculus/boss_eregos.cpp
@@ -113,6 +113,13 @@ enum EmeraldDrake
SPELL_EMERALD_DREAM_FUNNEL = 50344 //(60 yds) - Channeled - Transfers 5% of the caster's max health to a friendly drake every second for 10 seconds as long as the caster channels.
};
+enum EregosData
+{
+ DATA_RUBY_VOID = 0, // http://www.wowhead.com/achievement=2044
+ DATA_EMERALD_VOID = 1, // http://www.wowhead.com/achievement=2045
+ DATA_AMBER_VOID = 2 // http://www.wowhead.com/achievement=2046
+};
+
class boss_eregos : public CreatureScript
{
public:
@@ -126,12 +133,15 @@ public:
struct boss_eregosAI : public BossAI
{
boss_eregosAI(Creature* creature) : BossAI(creature, DATA_EREGOS_EVENT) { }
-
+
void Reset()
{
_Reset();
+ _phase = PHASE_NORMAL;
- phase = PHASE_NORMAL;
+ _rubyVoid = true;
+ _emeraldVoid = true;
+ _amberVoid = true;
DoAction(ACTION_SET_NORMAL_EVENTS);
}
@@ -141,6 +151,31 @@ public:
_EnterCombat();
Talk(SAY_AGGRO);
+ /* Checks for present drakes vehicles from each type and deactivate achievement that corresponds to each found
+ The checks are so big in case some party try weird things like pulling boss down or hiding out of check range, the only thing player need is to get the boss kill credit after the check /even if he or his drake die/
+ Drakes mechanic would despawn all after unmount and also drakes should be auto mounted after item use, item use after Eregos is engaged leads to his despawn - based on retail data. */
+ if (me->FindNearestCreature(NPC_RUBY_DRAKE_VEHICLE, 500.0f, true))
+ _rubyVoid = false;
+ if (me->FindNearestCreature(NPC_EMERALD_DRAKE_VEHICLE, 500.0f, true))
+ _emeraldVoid = false;
+ if (me->FindNearestCreature(NPC_AMBER_DRAKE_VEHICLE, 500.0f, true))
+ _amberVoid = false;
+ }
+
+ uint32 GetData(uint32 type)
+ {
+ switch (type)
+ {
+ case DATA_RUBY_VOID:
+ return _rubyVoid;
+ case DATA_EMERALD_VOID:
+ return _emeraldVoid;
+ case DATA_AMBER_VOID:
+ return _amberVoid;
+ default:
+ break;
+ }
+ return 0;
}
void DoAction(const int32 action)
@@ -180,11 +215,11 @@ public:
if (!me->GetMap()->IsHeroic())
return;
- if ( (me->GetHealthPct() < 60.0f && me->GetHealthPct() > 20.0f && phase < PHASE_FIRST_PLANAR)
- || (me->GetHealthPct() < 20.0f && phase < PHASE_SECOND_PLANAR) )
+ if ( (me->GetHealthPct() < 60.0f && me->GetHealthPct() > 20.0f && _phase < PHASE_FIRST_PLANAR)
+ || (me->GetHealthPct() < 20.0f && _phase < PHASE_SECOND_PLANAR) )
{
events.Reset();
- phase = (me->GetHealthPct() < 60.0f && me->GetHealthPct() > 20.0f) ? PHASE_FIRST_PLANAR : PHASE_SECOND_PLANAR;
+ _phase = (me->GetHealthPct() < 60.0f && me->GetHealthPct() > 20.0f) ? PHASE_FIRST_PLANAR : PHASE_SECOND_PLANAR;
DoCast(SPELL_PLANAR_SHIFT);
@@ -241,8 +276,11 @@ public:
_JustDied();
}
- private:
- uint8 phase;
+ private:
+ uint8 _phase;
+ bool _rubyVoid;
+ bool _emeraldVoid;
+ bool _amberVoid;
};
};
@@ -274,8 +312,25 @@ class spell_eregos_planar_shift : public SpellScriptLoader
}
};
-void AddSC_boss_eregos()
+class achievement_gen_eregos_void : public AchievementCriteriaScript
{
+ public:
+ achievement_gen_eregos_void(char const* name, uint32 data) : AchievementCriteriaScript(name), _data(data) { }
+
+ bool OnCheck(Player* /*player*/, Unit* target)
+ {
+ return target && target->GetAI()->GetData(_data);
+ }
+
+ private:
+ uint32 _data;
+};
+
+ void AddSC_boss_eregos()
+ {
new boss_eregos();
new spell_eregos_planar_shift();
-}
+ new achievement_gen_eregos_void("achievement_ruby_void", DATA_RUBY_VOID);
+ new achievement_gen_eregos_void("achievement_emerald_void", DATA_EMERALD_VOID);
+ new achievement_gen_eregos_void("achievement_amber_void", DATA_AMBER_VOID);
+ }
diff --git a/src/server/scripts/Northrend/Ulduar/Ulduar/instance_ulduar.cpp b/src/server/scripts/Northrend/Ulduar/Ulduar/instance_ulduar.cpp
index 654d763ddbc..2f37fb06f24 100644
--- a/src/server/scripts/Northrend/Ulduar/Ulduar/instance_ulduar.cpp
+++ b/src/server/scripts/Northrend/Ulduar/Ulduar/instance_ulduar.cpp
@@ -134,6 +134,7 @@ class instance_ulduar : public InstanceMapScript
elderCount = 0;
conSpeedAtory = false;
Unbroken = true;
+ _algalonSummoned = false;
_summonAlgalon = false;
memset(AlgalonSigilDoorGUID, 0, sizeof(AlgalonSigilDoorGUID));
diff --git a/src/server/scripts/Northrend/UtgardeKeep/UtgardeKeep/boss_ingvar_the_plunderer.cpp b/src/server/scripts/Northrend/UtgardeKeep/UtgardeKeep/boss_ingvar_the_plunderer.cpp
index 191f4530e65..48667053373 100644
--- a/src/server/scripts/Northrend/UtgardeKeep/UtgardeKeep/boss_ingvar_the_plunderer.cpp
+++ b/src/server/scripts/Northrend/UtgardeKeep/UtgardeKeep/boss_ingvar_the_plunderer.cpp
@@ -101,6 +101,7 @@ public:
boss_ingvar_the_plundererAI(Creature* creature) : ScriptedAI(creature)
{
instance = creature->GetInstanceScript();
+ bIsUndead = false;
}
InstanceScript* instance;
diff --git a/src/server/scripts/Northrend/UtgardeKeep/UtgardeKeep/boss_keleseth.cpp b/src/server/scripts/Northrend/UtgardeKeep/UtgardeKeep/boss_keleseth.cpp
index f53020a72c4..b987b00fa5b 100644
--- a/src/server/scripts/Northrend/UtgardeKeep/UtgardeKeep/boss_keleseth.cpp
+++ b/src/server/scripts/Northrend/UtgardeKeep/UtgardeKeep/boss_keleseth.cpp
@@ -125,7 +125,8 @@ public:
void Reset()
{
- instance->SetData(DATA_PRINCEKELESETH_EVENT, NOT_STARTED);
+ if (instance)
+ instance->SetData(DATA_PRINCEKELESETH_EVENT, NOT_STARTED);
events.Reset();
events.ScheduleEvent(EVENT_SHADOWBOLT, urand(2,3)*IN_MILLISECONDS);
@@ -140,13 +141,15 @@ public:
void EnterCombat(Unit* /*who*/)
{
me->SetInCombatWithZone();
- instance->SetData(DATA_PRINCEKELESETH_EVENT, IN_PROGRESS);
+ if (instance)
+ instance->SetData(DATA_PRINCEKELESETH_EVENT, IN_PROGRESS);
Talk(SAY_START_COMBAT);
}
void JustDied(Unit* /*killer*/)
{
- instance->SetData(DATA_PRINCEKELESETH_EVENT, DONE);
+ if (instance)
+ instance->SetData(DATA_PRINCEKELESETH_EVENT, DONE);
summons.DespawnAll();
Talk(SAY_DEATH);
}
diff --git a/src/server/scripts/Northrend/UtgardeKeep/UtgardePinnacle/boss_skadi.cpp b/src/server/scripts/Northrend/UtgardeKeep/UtgardePinnacle/boss_skadi.cpp
index f0d64bb8344..a6ad7befc38 100644
--- a/src/server/scripts/Northrend/UtgardeKeep/UtgardePinnacle/boss_skadi.cpp
+++ b/src/server/scripts/Northrend/UtgardeKeep/UtgardePinnacle/boss_skadi.cpp
@@ -172,6 +172,7 @@ public:
boss_skadiAI(Creature* creature) : ScriptedAI(creature), Summons(me)
{
instance = creature->GetInstanceScript();
+ m_uiGraufGUID = 0;
}
InstanceScript* instance;
@@ -207,7 +208,7 @@ public:
Summons.DespawnAll();
me->SetSpeed(MOVE_FLIGHT, 3.0f);
- if ((Unit::GetCreature((*me), m_uiGraufGUID) == NULL) && !me->IsMounted())
+ if ((Unit::GetCreature(*me, m_uiGraufGUID) == NULL) && !me->IsMounted())
me->SummonCreature(CREATURE_GRAUF, Location[0].GetPositionX(), Location[0].GetPositionY(), Location[0].GetPositionZ(), 3.0f);
if (instance)
{
@@ -221,7 +222,7 @@ public:
me->SetCanFly(false);
me->Dismount();
me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE | UNIT_FLAG_NON_ATTACKABLE);
- if (Unit::GetCreature((*me), m_uiGraufGUID) == NULL)
+ if (!Unit::GetCreature(*me, m_uiGraufGUID))
me->SummonCreature(CREATURE_GRAUF, Location[0].GetPositionX(), Location[0].GetPositionY(), Location[0].GetPositionZ(), 3.0f);
}
diff --git a/src/server/scripts/Northrend/UtgardeKeep/UtgardePinnacle/boss_ymiron.cpp b/src/server/scripts/Northrend/UtgardeKeep/UtgardePinnacle/boss_ymiron.cpp
index 5dacaff2d6b..39fd01a9269 100644
--- a/src/server/scripts/Northrend/UtgardeKeep/UtgardePinnacle/boss_ymiron.cpp
+++ b/src/server/scripts/Northrend/UtgardeKeep/UtgardePinnacle/boss_ymiron.cpp
@@ -121,6 +121,9 @@ public:
m_uiActiveOrder[i] = m_uiActiveOrder[r];
m_uiActiveOrder[r] = temp;
}
+
+ m_uiActivedCreatureGUID = 0;
+ m_uiOrbGUID = 0;
}
bool m_bIsWalking;
diff --git a/src/server/scripts/Northrend/VioletHold/violet_hold.cpp b/src/server/scripts/Northrend/VioletHold/violet_hold.cpp
index 122d051f1dd..870ea893b78 100644
--- a/src/server/scripts/Northrend/VioletHold/violet_hold.cpp
+++ b/src/server/scripts/Northrend/VioletHold/violet_hold.cpp
@@ -782,10 +782,13 @@ struct violet_hold_trashAI : public npc_escortAI
void JustDied(Unit* /*killer*/)
{
- if (Creature* portal = Unit::GetCreature((*me), instance->GetData64(DATA_TELEPORTATION_PORTAL)))
- CAST_AI(npc_teleportation_portal_vh::npc_teleportation_portalAI, portal->AI())->SummonedMobDied(me);
if (instance)
+ {
+ if (Creature* portal = Unit::GetCreature((*me), instance->GetData64(DATA_TELEPORTATION_PORTAL)))
+ CAST_AI(npc_teleportation_portal_vh::npc_teleportation_portalAI, portal->AI())->SummonedMobDied(me);
+
instance->SetData(DATA_NPC_PRESENCE_AT_DOOR_REMOVE, 1);
+ }
}
void CreatureStartAttackDoor()
diff --git a/src/server/scripts/Northrend/dragonblight.cpp b/src/server/scripts/Northrend/dragonblight.cpp
index ecc012eb25d..a26ee4e9270 100644
--- a/src/server/scripts/Northrend/dragonblight.cpp
+++ b/src/server/scripts/Northrend/dragonblight.cpp
@@ -79,16 +79,16 @@ public:
enum StrengthenAncientsMisc
{
- SAY_WALKER_FRIENDLY = 0,
- SAY_WALKER_ENEMY = 1,
- SAY_LOTHALOR = 0,
+ SAY_WALKER_FRIENDLY = 0,
+ SAY_WALKER_ENEMY = 1,
+ SAY_LOTHALOR = 0,
- SPELL_CREATE_ITEM_BARK = 47550,
- SPELL_CONFUSED = 47044,
+ SPELL_CREATE_ITEM_BARK = 47550,
+ SPELL_CONFUSED = 47044,
- NPC_LOTHALOR = 26321,
+ NPC_LOTHALOR = 26321,
- FACTION_WALKER_ENEMY = 14,
+ FACTION_WALKER_ENEMY = 14,
};
class spell_q12096_q12092_dummy : public SpellScriptLoader // Strengthen the Ancients: On Interact Dummy to Woodlands Walker
@@ -170,9 +170,56 @@ public:
}
};
+/*######
+## wyrmrest_defender
+######*/
+
+enum WyrmDefenderEnum
+{
+ QUEST_DEFENDING_WYRMREST_TEMPLE = 12372,
+ GOSSIP_TEXTID_DEF1 = 12899,
+ GOSSIP_TEXTID_DEF2 = 12900,
+ SPELL_CHARACTER_SCRIPT = 49213
+};
+
+#define GOSSIP_ITEM_1 "We need to get into the fight. Are you ready?"
+
+class npc_wyrmrest_defender : public CreatureScript
+{
+ public:
+ npc_wyrmrest_defender() : CreatureScript("npc_wyrmrest_defender") { }
+
+ bool OnGossipHello(Player* player, Creature* creature)
+ {
+ if (player->GetQuestStatus(QUEST_DEFENDING_WYRMREST_TEMPLE) == QUEST_STATUS_INCOMPLETE)
+ {
+ player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_1, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+1);
+ player->SEND_GOSSIP_MENU(GOSSIP_TEXTID_DEF1, creature->GetGUID());
+ }
+ else
+ player->SEND_GOSSIP_MENU(player->GetGossipTextId(creature), creature->GetGUID());
+
+ return true;
+ }
+
+ bool OnGossipSelect(Player* player, Creature* creature, uint32 /*sender*/, uint32 action)
+ {
+ player->PlayerTalkClass->ClearMenus();
+ if (action == GOSSIP_ACTION_INFO_DEF+1)
+ {
+ player->SEND_GOSSIP_MENU(GOSSIP_TEXTID_DEF2, creature->GetGUID());
+ // Makes player cast trigger spell for 49207 on self
+ player->CastSpell(player, SPELL_CHARACTER_SCRIPT, true);
+ }
+
+ return true;
+ }
+};
+
void AddSC_dragonblight()
{
new npc_alexstrasza_wr_gate;
new spell_q12096_q12092_dummy;
new spell_q12096_q12092_bark;
+ new npc_wyrmrest_defender;
}
diff --git a/src/server/scripts/Northrend/grizzly_hills.cpp b/src/server/scripts/Northrend/grizzly_hills.cpp
index 1a0f6b57375..4ca12bc82a1 100644
--- a/src/server/scripts/Northrend/grizzly_hills.cpp
+++ b/src/server/scripts/Northrend/grizzly_hills.cpp
@@ -600,100 +600,99 @@ enum eSmokeEmOut
QUEST_SMOKE_EM_OUT_H = 12324,
SPELL_SMOKE_BOMB = 49075,
SPELL_CHOP = 43410,
- NPC_VENTURE_CO_STABLES_KC = 27568,
+ SPELL_VENTURE_STRAGGLER_CREDIT = 49093,
};
class npc_venture_co_straggler : public CreatureScript
{
-public:
- npc_venture_co_straggler() : CreatureScript("npc_venture_co_straggler") { }
-
- CreatureAI* GetAI(Creature* creature) const
- {
- return new npc_venture_co_stragglerAI(creature);
- }
+ public:
+ npc_venture_co_straggler() : CreatureScript("npc_venture_co_straggler") { }
- struct npc_venture_co_stragglerAI : public ScriptedAI
- {
- npc_venture_co_stragglerAI(Creature* creature) : ScriptedAI(creature) { }
+ struct npc_venture_co_stragglerAI : public ScriptedAI
+ {
+ npc_venture_co_stragglerAI(Creature* creature) : ScriptedAI(creature) { }
- uint64 uiPlayerGUID;
- uint32 uiRunAwayTimer;
- uint32 uiTimer;
- uint32 uiChopTimer;
+ uint64 uiPlayerGUID;
+ uint32 uiRunAwayTimer;
+ uint32 uiTimer;
+ uint32 uiChopTimer;
- void Reset()
- {
- uiPlayerGUID = 0;
- uiTimer = 0;
- uiChopTimer = urand(10000, 12500);
- me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_IMMUNE_TO_PC);
- me->SetReactState(REACT_AGGRESSIVE);
- }
+ void Reset()
+ {
+ uiPlayerGUID = 0;
+ uiTimer = 0;
+ uiRunAwayTimer = 0;
+ uiChopTimer = urand(10000, 12500);
+ me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_IMMUNE_TO_PC);
+ me->SetReactState(REACT_AGGRESSIVE);
+ }
- void UpdateAI(const uint32 uiDiff)
- {
- if (uiRunAwayTimer <= uiDiff)
+ void UpdateAI(const uint32 uiDiff)
{
- if (Player* player = Unit::GetPlayer(*me, uiPlayerGUID))
+ if (uiPlayerGUID && uiRunAwayTimer <= uiDiff)
{
- switch (uiTimer)
+ if (Player* player = Unit::GetPlayer(*me, uiPlayerGUID))
{
- case 0:
- if (player->GetQuestStatus(QUEST_SMOKE_EM_OUT_A) == QUEST_STATUS_INCOMPLETE ||
- player->GetQuestStatus(QUEST_SMOKE_EM_OUT_H) == QUEST_STATUS_INCOMPLETE)
- player->KilledMonsterCredit(NPC_VENTURE_CO_STABLES_KC, 0);
- me->GetMotionMaster()->MovePoint(0, me->GetPositionX()-7, me->GetPositionY()+7, me->GetPositionZ());
- uiRunAwayTimer = 2500;
- ++uiTimer;
- break;
- case 1:
- DoScriptText(RAND(SAY_SEO1, SAY_SEO2, SAY_SEO3, SAY_SEO4, SAY_SEO5), me);
- me->GetMotionMaster()->MovePoint(0, me->GetPositionX()-7, me->GetPositionY()-5, me->GetPositionZ());
- uiRunAwayTimer = 2500;
- ++uiTimer;
- break;
- case 2:
- me->GetMotionMaster()->MovePoint(0, me->GetPositionX()-5, me->GetPositionY()-5, me->GetPositionZ());
- uiRunAwayTimer = 2500;
- ++uiTimer;
- break;
- case 3:
- me->DisappearAndDie();
- uiTimer = 0;
- break;
+ switch (uiTimer)
+ {
+ case 0:
+ DoCast(player, SPELL_VENTURE_STRAGGLER_CREDIT);
+ me->GetMotionMaster()->MovePoint(0, me->GetPositionX()-7, me->GetPositionY()+7, me->GetPositionZ());
+ uiRunAwayTimer = 2500;
+ ++uiTimer;
+ break;
+ case 1:
+ DoScriptText(RAND(SAY_SEO1, SAY_SEO2, SAY_SEO3, SAY_SEO4, SAY_SEO5), me);
+ me->GetMotionMaster()->MovePoint(0, me->GetPositionX()-7, me->GetPositionY()-5, me->GetPositionZ());
+ uiRunAwayTimer = 2500;
+ ++uiTimer;
+ break;
+ case 2:
+ me->GetMotionMaster()->MovePoint(0, me->GetPositionX()-5, me->GetPositionY()-5, me->GetPositionZ());
+ uiRunAwayTimer = 2500;
+ ++uiTimer;
+ break;
+ case 3:
+ me->DisappearAndDie();
+ uiTimer = 0;
+ break;
+ }
}
}
- }
- else
- uiRunAwayTimer -= uiDiff;
+ else if (uiRunAwayTimer)
+ uiRunAwayTimer -= uiDiff;
- if (!UpdateVictim())
- return;
+ if (!UpdateVictim())
+ return;
- if (uiChopTimer <= uiDiff)
- {
- DoCast(me->getVictim(), SPELL_CHOP);
- uiChopTimer = urand(10000, 12000);
- }
- else
- uiChopTimer -= uiDiff;
+ if (uiChopTimer <= uiDiff)
+ {
+ DoCast(me->getVictim(), SPELL_CHOP);
+ uiChopTimer = urand(10000, 12000);
+ }
+ else
+ uiChopTimer -= uiDiff;
- DoMeleeAttackIfReady();
- }
+ DoMeleeAttackIfReady();
+ }
- void SpellHit(Unit* pCaster, const SpellInfo* pSpell)
- {
- if (pCaster && pCaster->GetTypeId() == TYPEID_PLAYER && pSpell->Id == SPELL_SMOKE_BOMB)
+ void SpellHit(Unit* caster, SpellInfo const* spell)
{
- me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_IMMUNE_TO_PC);
- me->SetReactState(REACT_PASSIVE);
- me->CombatStop(false);
- uiPlayerGUID = pCaster->GetGUID();
- uiRunAwayTimer = 3500;
+ if (spell->Id == SPELL_SMOKE_BOMB && caster->GetTypeId() == TYPEID_PLAYER)
+ {
+ me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_IMMUNE_TO_PC);
+ me->SetReactState(REACT_PASSIVE);
+ me->CombatStop(false);
+ uiPlayerGUID = caster->GetGUID();
+ uiRunAwayTimer = 3500;
+ }
}
+ };
+
+ CreatureAI* GetAI(Creature* creature) const
+ {
+ return new npc_venture_co_stragglerAI(creature);
}
- };
};
void AddSC_grizzly_hills()
diff --git a/src/server/scripts/Northrend/storm_peaks.cpp b/src/server/scripts/Northrend/storm_peaks.cpp
index 6bf342e4643..976a6e5dba5 100644
--- a/src/server/scripts/Northrend/storm_peaks.cpp
+++ b/src/server/scripts/Northrend/storm_peaks.cpp
@@ -20,6 +20,7 @@
#include "ScriptedGossip.h"
#include "ScriptedEscortAI.h"
#include "Vehicle.h"
+#include "CombatAI.h"
/*######
## npc_agnetta_tyrsdottar
@@ -131,229 +132,6 @@ public:
}
};
-/*######
-## npc_thorim
-######*/
-
-#define GOSSIP_HN "Thorim?"
-#define GOSSIP_SN1 "Can you tell me what became of Sif?"
-#define GOSSIP_SN2 "He did more than that, Thorim. He controls Ulduar now."
-#define GOSSIP_SN3 "It needn't end this way."
-
-enum eThorim
-{
- QUEST_SIBLING_RIVALRY = 13064,
- NPC_THORIM = 29445,
- GOSSIP_TEXTID_THORIM1 = 13799,
- GOSSIP_TEXTID_THORIM2 = 13801,
- GOSSIP_TEXTID_THORIM3 = 13802,
- GOSSIP_TEXTID_THORIM4 = 13803
-};
-
-class npc_thorim : public CreatureScript
-{
-public:
- npc_thorim() : CreatureScript("npc_thorim") { }
-
- bool OnGossipHello(Player* player, Creature* creature)
- {
- if (creature->isQuestGiver())
- player->PrepareQuestMenu(creature->GetGUID());
-
- if (player->GetQuestStatus(QUEST_SIBLING_RIVALRY) == QUEST_STATUS_INCOMPLETE) {
- player->ADD_GOSSIP_ITEM(0, GOSSIP_HN, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+1);
- player->SEND_GOSSIP_MENU(GOSSIP_TEXTID_THORIM1, creature->GetGUID());
- return true;
- }
- return false;
- }
-
- bool OnGossipSelect(Player* player, Creature* creature, uint32 /*sender*/, uint32 action)
- {
- player->PlayerTalkClass->ClearMenus();
- switch (action)
- {
- case GOSSIP_ACTION_INFO_DEF+1:
- player->ADD_GOSSIP_ITEM(0, GOSSIP_SN1, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+2);
- player->SEND_GOSSIP_MENU(GOSSIP_TEXTID_THORIM2, creature->GetGUID());
- break;
- case GOSSIP_ACTION_INFO_DEF+2:
- player->ADD_GOSSIP_ITEM(0, GOSSIP_SN2, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+3);
- player->SEND_GOSSIP_MENU(GOSSIP_TEXTID_THORIM3, creature->GetGUID());
- break;
- case GOSSIP_ACTION_INFO_DEF+3:
- player->ADD_GOSSIP_ITEM(0, GOSSIP_SN3, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+4);
- player->SEND_GOSSIP_MENU(GOSSIP_TEXTID_THORIM4, creature->GetGUID());
- break;
- case GOSSIP_ACTION_INFO_DEF+4:
- player->CLOSE_GOSSIP_MENU();
- player->CompleteQuest(QUEST_SIBLING_RIVALRY);
- break;
- }
- return true;
- }
-};
-
-/*######
-## npc_victorious_challenger
-######*/
-
-#define GOSSIP_CHALLENGER "Let's do this, sister."
-
-enum eVictoriousChallenger
-{
- QUEST_TAKING_ALL_CHALLENGERS = 12971,
- QUEST_DEFENDING_YOUR_TITLE = 13423,
-
- SPELL_SUNDER_ARMOR = 11971,
- SPELL_REND_VC = 11977
-};
-
-class npc_victorious_challenger : public CreatureScript
-{
-public:
- npc_victorious_challenger() : CreatureScript("npc_victorious_challenger") { }
-
- struct npc_victorious_challengerAI : public ScriptedAI
- {
- npc_victorious_challengerAI(Creature* creature) : ScriptedAI(creature) {}
-
- uint32 SunderArmorTimer;
- uint32 RendTimer;
-
- void Reset()
- {
- me->RestoreFaction();
-
- SunderArmorTimer = 10000;
- RendTimer = 15000;
- }
-
- void UpdateAI(const uint32 diff)
- {
- //Return since we have no target
- if (!UpdateVictim())
- return;
-
- if (RendTimer < diff)
- {
- DoCast(me->getVictim(), SPELL_REND_VC, true);
- RendTimer = 15000;
- }else RendTimer -= diff;
-
- if (SunderArmorTimer < diff)
- {
- DoCast(me->getVictim(), SPELL_SUNDER_ARMOR, true);
- SunderArmorTimer = 10000;
- }else SunderArmorTimer -= diff;
-
- DoMeleeAttackIfReady();
- }
-
- void KilledUnit(Unit* /*victim*/)
- {
- me->RestoreFaction();
- }
-
- };
-
- bool OnGossipHello(Player* player, Creature* creature)
- {
- if (creature->isQuestGiver())
- player->PrepareQuestMenu(creature->GetGUID());
-
- if (player->GetQuestStatus(QUEST_TAKING_ALL_CHALLENGERS) == QUEST_STATUS_INCOMPLETE || player->GetQuestStatus(QUEST_DEFENDING_YOUR_TITLE) == QUEST_STATUS_INCOMPLETE)
- {
- player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_CHALLENGER, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+1);
- player->SEND_GOSSIP_MENU(player->GetGossipTextId(creature), creature->GetGUID());
- return true;
- }
-
- return false;
- }
-
- bool OnGossipSelect(Player* player, Creature* creature, uint32 /*sender*/, uint32 action)
- {
- player->PlayerTalkClass->ClearMenus();
- if (action == GOSSIP_ACTION_INFO_DEF+1)
- {
- player->CLOSE_GOSSIP_MENU();
- creature->setFaction(14);
- creature->AI()->AttackStart(player);
- }
-
- return true;
- }
-
- CreatureAI* GetAI(Creature* creature) const
- {
- return new npc_victorious_challengerAI(creature);
- }
-};
-
-/*######
-## npc_loklira_crone
-######*/
-
-#define GOSSIP_LOKLIRACRONE "Tell me about this proposal"
-#define GOSSIP_LOKLIRACRONE1 "What happened then?"
-#define GOSSIP_LOKLIRACRONE2 "You want me to take part in the Hyldsmeet to end the war?"
-#define GOSSIP_LOKLIRACRONE3 "Very well. I'll take part in this competition."
-
-enum eLokliraCrone
-{
- QUEST_HYLDSMEET = 12970,
-
- GOSSIP_TEXTID_LOK1 = 13778,
- GOSSIP_TEXTID_LOK2 = 13779,
- GOSSIP_TEXTID_LOK3 = 13780
-};
-
-class npc_loklira_crone : public CreatureScript
-{
-public:
- npc_loklira_crone() : CreatureScript("npc_loklira_crone") { }
-
- bool OnGossipHello(Player* player, Creature* creature)
- {
- if (creature->isQuestGiver())
- player->PrepareQuestMenu(creature->GetGUID());
-
- if (player->GetQuestStatus(QUEST_HYLDSMEET) == QUEST_STATUS_INCOMPLETE)
- {
- player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_LOKLIRACRONE, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+1);
- player->SEND_GOSSIP_MENU(player->GetGossipTextId(creature), creature->GetGUID());
- return true;
- }
- return false;
- }
-
- bool OnGossipSelect(Player* player, Creature* creature, uint32 /*sender*/, uint32 action)
- {
- player->PlayerTalkClass->ClearMenus();
- switch (action)
- {
- case GOSSIP_ACTION_INFO_DEF+1:
- player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_LOKLIRACRONE1, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+2);
- player->SEND_GOSSIP_MENU(GOSSIP_TEXTID_LOK1, creature->GetGUID());
- break;
- case GOSSIP_ACTION_INFO_DEF+2:
- player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_LOKLIRACRONE2, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+3);
- player->SEND_GOSSIP_MENU(GOSSIP_TEXTID_LOK2, creature->GetGUID());
- break;
- case GOSSIP_ACTION_INFO_DEF+3:
- player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_LOKLIRACRONE3, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+4);
- player->SEND_GOSSIP_MENU(GOSSIP_TEXTID_LOK3, creature->GetGUID());
- break;
- case GOSSIP_ACTION_INFO_DEF+4:
- player->CLOSE_GOSSIP_MENU();
- player->CompleteQuest(QUEST_HYLDSMEET);
- break;
- }
- return true;
- }
-};
-
/////////////////////
///npc_injured_goblin
/////////////////////
@@ -506,14 +284,12 @@ public:
## npc_brunnhildar_prisoner
######*/
-enum brunhildar {
- NPC_QUEST_GIVER = 29592,
-
+enum BrunnhildarPrisoner {
SPELL_ICE_PRISON = 54894,
- SPELL_KILL_CREDIT_PRISONER = 55144,
- SPELL_KILL_CREDIT_DRAKE = 55143,
- SPELL_SUMMON_LIBERATED = 55073,
- SPELL_ICE_LANCE = 55046
+ SPELL_ICE_LANCE = 55046,
+ SPELL_FREE_PRISONER = 55048,
+ SPELL_RIDE_DRAKE = 55074,
+ SPELL_SHARD_IMPACT = 55047
};
class npc_brunnhildar_prisoner : public CreatureScript
@@ -525,129 +301,169 @@ public:
{
npc_brunnhildar_prisonerAI(Creature* creature) : ScriptedAI(creature) {}
- uint64 drakeGUID;
- uint16 enter_timer;
- bool hasEmptySeats;
+ bool freed;
void Reset()
{
+ freed = false;
me->CastSpell(me, SPELL_ICE_PRISON, true);
- enter_timer = 0;
- drakeGUID = 0;
- hasEmptySeats = false;
}
- void UpdateAI(const uint32 diff)
+ void JustRespawned()
+ {
+ Reset();
+ }
+
+ void UpdateAI(const uint32 /*diff*/)
{
- //TODO: not good script
- if (!drakeGUID)
+ if (!freed)
return;
- Creature* drake = Unit::GetCreature(*me, drakeGUID);
- if (!drake)
+ if (!me->HasUnitState(UNIT_STATE_ONVEHICLE))
{
- drakeGUID = 0;
- return;
+ me->DespawnOrUnsummon();
}
+ }
- // drake unsummoned, passengers dropped
- if (!me->IsOnVehicle(drake) && !hasEmptySeats)
- me->DespawnOrUnsummon(3000);
-
- if (enter_timer <= 0)
+ void SpellHit(Unit* caster, const SpellInfo* spell)
+ {
+ if (spell->Id != SPELL_ICE_LANCE)
return;
- if (enter_timer < diff)
+ if (caster->GetVehicleKit()->GetAvailableSeatCount() != 0)
{
- enter_timer = 0;
- if (hasEmptySeats)
- me->JumpTo(drake, 25.0f);
- else
- Reset();
+ me->CastSpell(me, SPELL_FREE_PRISONER, true);
+ me->CastSpell(caster, SPELL_RIDE_DRAKE, true);
+ me->CastSpell(me, SPELL_SHARD_IMPACT, true);
+ freed = true;
}
- else
- enter_timer -= diff;
+ }
+ };
+
+ CreatureAI* GetAI(Creature* creature) const
+ {
+ return new npc_brunnhildar_prisonerAI(creature);
+ }
+};
+
+/*######
+## npc_freed_protodrake
+######*/
+
+enum FreedProtoDrake
+{
+ AREA_VALLEY_OF_ANCIENT_WINTERS = 4437,
+ TEXT_EMOTE = 0,
+ SPELL_KILL_CREDIT_PRISONER = 55144,
+ SPELL_SUMMON_LIBERATED = 55073,
+ SPELL_KILL_CREDIT_DRAKE = 55143
+};
+
+const Position FreedDrakeWaypoints[16] =
+{
+ {7294.96f, -2418.733f, 823.869f, 0.0f},
+ {7315.984f, -2331.46f, 826.3972f, 0.0f},
+ {7271.826f, -2271.479f, 833.5917f, 0.0f},
+ {7186.253f, -2218.475f, 847.5632f, 0.0f},
+ {7113.195f, -2164.288f, 850.2301f, 0.0f},
+ {7078.018f, -2063.106f, 854.7581f, 0.0f},
+ {7073.221f, -1983.382f, 861.9246f, 0.0f},
+ {7061.455f, -1885.899f, 865.119f, 0.0f},
+ {7033.32f, -1826.775f, 876.2578f, 0.0f},
+ {6999.902f, -1784.012f, 897.4521f, 0.0f},
+ {6954.913f, -1747.043f, 897.4521f, 0.0f},
+ {6933.856f, -1720.698f, 882.2022f, 0.0f},
+ {6932.729f, -1687.306f, 866.1189f, 0.0f},
+ {6952.458f, -1663.802f, 849.8133f, 0.0f},
+ {7002.819f, -1651.681f, 831.397f, 0.0f},
+ {7026.531f, -1649.239f, 828.8406f, 0.0f}
+};
+
+
+class npc_freed_protodrake : public CreatureScript
+{
+public:
+ npc_freed_protodrake() : CreatureScript("npc_freed_protodrake") { }
+
+ struct npc_freed_protodrakeAI : public VehicleAI
+ {
+ npc_freed_protodrakeAI(Creature* creature) : VehicleAI(creature) {}
+
+ bool autoMove;
+ bool wpReached;
+ uint16 CheckTimer;
+ uint16 countWP;
+
+ void Reset()
+ {
+ autoMove = false;
+ wpReached = false;
+ CheckTimer = 5000;
+ countWP = 0;
}
- void MoveInLineOfSight(Unit* who)
+ void MovementInform(uint32 type, uint32 id)
{
- if (!who || !drakeGUID)
+ if (type != POINT_MOTION_TYPE)
return;
- Creature* drake = Unit::GetCreature(*me, drakeGUID);
- if (!drake)
+ if (id < 15)
{
- drakeGUID = 0;
- return;
+ ++countWP;
+ wpReached = true;
}
-
- if (!me->IsOnVehicle(drake) && !me->HasAura(SPELL_ICE_PRISON))
+ else
+ // drake reached village
{
- if (who->IsVehicle() && me->IsWithinDist(who, 25.0f, true) && who->ToCreature() && who->ToCreature()->GetEntry() == 29709)
+ // get player that rides drake (from seat 0)
+ Unit* player = me->GetVehicleKit()->GetPassenger(0);
+ if (player && player->GetTypeId() == TYPEID_PLAYER)
{
- uint8 seat = who->GetVehicleKit()->GetNextEmptySeat(0, true);
- if (seat <= 0)
- return;
-
- me->EnterVehicle(who, seat);
- me->SendMovementFlagUpdate();
- hasEmptySeats = false;
+ // for each prisoner on drake,give credit
+ for (uint8 i = 1; i < 4; ++i)
+ if (Unit* prisoner = me->GetVehicleKit()->GetPassenger(i))
+ {
+ if (prisoner->GetTypeId() != TYPEID_UNIT)
+ return;
+ prisoner->CastSpell(player, SPELL_KILL_CREDIT_PRISONER, true);
+ prisoner->CastSpell(prisoner, SPELL_SUMMON_LIBERATED, true);
+ prisoner->ExitVehicle();
+ }
+ me->CastSpell(me, SPELL_KILL_CREDIT_DRAKE, true);
+ player->ExitVehicle();
}
}
+ }
- if (who->ToCreature() && me->IsOnVehicle(drake))
+ void UpdateAI(const uint32 diff)
+ {
+ if (!autoMove)
{
- if (who->ToCreature()->GetEntry() == NPC_QUEST_GIVER && me->IsWithinDist(who, 15.0f, false))
+ if (CheckTimer < diff)
{
- Unit* rider = drake->GetVehicleKit()->GetPassenger(0);
- if (!rider)
- return;
-
- rider->CastSpell(rider, SPELL_KILL_CREDIT_PRISONER, true);
-
- me->ExitVehicle();
- me->CastSpell(me, SPELL_SUMMON_LIBERATED, true);
- me->DespawnOrUnsummon(500);
-
- // drake is empty now, deliver credit for drake and despawn him
- if (drake->GetVehicleKit()->HasEmptySeat(1) &&
- drake->GetVehicleKit()->HasEmptySeat(2) &&
- drake->GetVehicleKit()->HasEmptySeat(3))
+ CheckTimer = 5000;
+ if (me->GetAreaId() == AREA_VALLEY_OF_ANCIENT_WINTERS)
{
- // not working rider->CastSpell(rider, SPELL_KILL_CREDIT_DRAKE, true);
- if (rider->ToPlayer())
- rider->ToPlayer()->KilledMonsterCredit(29709, 0);
-
- drake->DespawnOrUnsummon(0);
+ Talk(TEXT_EMOTE, me->GetVehicleKit()->GetPassenger(0)->GetGUID());
+ autoMove = true;
+ wpReached = true;
}
}
+ else
+ CheckTimer -= diff;
}
- }
-
- void SpellHit(Unit* hitter, const SpellInfo* spell)
- {
- if (!hitter || !spell)
- return;
-
- if (spell->Id != SPELL_ICE_LANCE)
- return;
-
- me->RemoveAura(SPELL_ICE_PRISON);
- enter_timer = 500;
- if (hitter->IsVehicle())
- drakeGUID = hitter->GetGUID();
- else
- return;
-
- if (hitter->GetVehicleKit()->GetNextEmptySeat(0, true))
- hasEmptySeats = true;
+ if (wpReached && autoMove)
+ {
+ wpReached = false;
+ me->GetMotionMaster()->MovePoint(countWP, FreedDrakeWaypoints[countWP]);
+ }
}
};
CreatureAI* GetAI(Creature* creature) const
{
- return new npc_brunnhildar_prisonerAI(creature);
+ return new npc_freed_protodrakeAI(creature);
}
};
@@ -752,12 +568,10 @@ void AddSC_storm_peaks()
{
new npc_agnetta_tyrsdottar();
new npc_frostborn_scout();
- new npc_thorim();
- new npc_victorious_challenger();
- new npc_loklira_crone();
new npc_injured_goblin();
new npc_roxi_ramrocket();
new npc_brunnhildar_prisoner();
+ new npc_freed_protodrake();
new npc_icefang();
new npc_hyldsmeet_protodrake();
}
diff --git a/src/server/scripts/Northrend/wintergrasp.cpp b/src/server/scripts/Northrend/wintergrasp.cpp
new file mode 100644
index 00000000000..59e9a31c4cf
--- /dev/null
+++ b/src/server/scripts/Northrend/wintergrasp.cpp
@@ -0,0 +1,585 @@
+/* Copyright (C) 2008 - 2009 Trinity <http://www.trinitycore.org/>
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+#include "BattlefieldMgr.h"
+#include "BattlefieldWG.h"
+#include "Battlefield.h"
+#include "ScriptSystem.h"
+#include "WorldSession.h"
+#include "ObjectMgr.h"
+#include "Vehicle.h"
+#include "GameObjectAI.h"
+#include "ScriptedCreature.h"
+#include "ScriptedGossip.h"
+#include "SpellScript.h"
+
+#define GOSSIP_HELLO_DEMO1 "Build catapult."
+#define GOSSIP_HELLO_DEMO2 "Build demolisher."
+#define GOSSIP_HELLO_DEMO3 "Build siege engine."
+#define GOSSIP_HELLO_DEMO4 "I cannot build more!"
+
+enum WGqueuenpctext
+{
+ WG_NPCQUEUE_TEXT_H_NOWAR = 14775,
+ WG_NPCQUEUE_TEXT_H_QUEUE = 14790,
+ WG_NPCQUEUE_TEXT_H_WAR = 14777,
+ WG_NPCQUEUE_TEXT_A_NOWAR = 14782,
+ WG_NPCQUEUE_TEXT_A_QUEUE = 14791,
+ WG_NPCQUEUE_TEXT_A_WAR = 14781,
+ WG_NPCQUEUE_TEXTOPTION_JOIN = -1850507,
+};
+
+enum Spells
+{
+ // Demolisher engineers spells
+ SPELL_BUILD_SIEGE_VEHICLE_FORCE_HORDE = 61409,
+ SPELL_BUILD_SIEGE_VEHICLE_FORCE_ALLIANCE = 56662,
+ SPELL_BUILD_CATAPULT_FORCE = 56664,
+ SPELL_BUILD_DEMOLISHER_FORCE = 56659,
+ SPELL_ACTIVATE_CONTROL_ARMS = 49899,
+ SPELL_RIDE_WG_VEHICLE = 60968,
+
+ SPELL_VEHICLE_TELEPORT = 49759,
+
+ // Spirit guide
+ SPELL_CHANNEL_SPIRIT_HEAL = 22011,
+};
+
+enum CreatureIds
+{
+ NPC_GOBLIN_MECHANIC = 30400,
+ NPC_GNOMISH_ENGINEER = 30499,
+
+ NPC_WINTERGRASP_CONTROL_ARMS = 27852,
+
+ NPC_WORLD_TRIGGER_LARGE_AOI_NOT_IMMUNE_PC_NPC = 23472,
+};
+
+enum QuestIds
+{
+ QUEST_BONES_AND_ARROWS_HORDE_ATT = 13193,
+ QUEST_JINXING_THE_WALLS_HORDE_ATT = 13202,
+ QUEST_SLAY_THEM_ALL_HORDE_ATT = 13180,
+ QUEST_FUELING_THE_DEMOLISHERS_HORDE_ATT = 13200,
+ QUEST_HEALING_WITH_ROSES_HORDE_ATT = 13201,
+ QUEST_DEFEND_THE_SIEGE_HORDE_ATT = 13223,
+
+ QUEST_BONES_AND_ARROWS_HORDE_DEF = 13199,
+ QUEST_WARDING_THE_WALLS_HORDE_DEF = 13192,
+ QUEST_SLAY_THEM_ALL_HORDE_DEF = 13178,
+ QUEST_FUELING_THE_DEMOLISHERS_HORDE_DEF = 13191,
+ QUEST_HEALING_WITH_ROSES_HORDE_DEF = 13194,
+ QUEST_TOPPLING_THE_TOWERS_HORDE_DEF = 13539,
+ QUEST_STOP_THE_SIEGE_HORDE_DEF = 13185,
+
+ QUEST_BONES_AND_ARROWS_ALLIANCE_ATT = 13196,
+ QUEST_WARDING_THE_WARRIORS_ALLIANCE_ATT = 13198,
+ QUEST_NO_MERCY_FOR_THE_MERCILESS_ALLIANCE_ATT = 13179,
+ QUEST_DEFEND_THE_SIEGE_ALLIANCE_ATT = 13222,
+ QUEST_A_RARE_HERB_ALLIANCE_ATT = 13195,
+
+ QUEST_BONES_AND_ARROWS_ALLIANCE_DEF = 13154,
+ QUEST_WARDING_THE_WARRIORS_ALLIANCE_DEF = 13153,
+ QUEST_NO_MERCY_FOR_THE_MERCILESS_ALLIANCE_DEF = 13177,
+ QUEST_SHOUTHERN_SABOTAGE_ALLIANCE_DEF = 13538,
+ QUEST_STOP_THE_SIEGE_ALLIANCE_DEF = 13186,
+ QUEST_A_RARE_HERB_ALLIANCE_DEF = 13156,
+};
+
+uint8 const MAX_WINTERGRASP_VEHICLES = 4;
+
+uint32 const vehiclesList[MAX_WINTERGRASP_VEHICLES] =
+{
+ NPC_WINTERGRASP_CATAPULT,
+ NPC_WINTERGRASP_DEMOLISHER,
+ NPC_WINTERGRASP_SIEGE_ENGINE_ALLIANCE,
+ NPC_WINTERGRASP_SIEGE_ENGINE_HORDE
+};
+
+class npc_wg_demolisher_engineer : public CreatureScript
+{
+ public:
+ npc_wg_demolisher_engineer() : CreatureScript("npc_wg_demolisher_engineer") { }
+
+ bool OnGossipHello(Player* player, Creature* creature)
+ {
+ if (creature->isQuestGiver())
+ player->PrepareQuestMenu(creature->GetGUID());
+
+ if (canBuild(creature))
+ {
+ if (player->HasAura(SPELL_CORPORAL))
+ player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_HELLO_DEMO1, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF);
+ else if (player->HasAura(SPELL_LIEUTENANT))
+ {
+ player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_HELLO_DEMO1, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF);
+ player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_HELLO_DEMO2, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 1);
+ player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_HELLO_DEMO3, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 2);
+ }
+ }
+ else
+ player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_HELLO_DEMO4, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 9);
+
+ player->SEND_GOSSIP_MENU(player->GetGossipTextId(creature), creature->GetGUID());
+ return true;
+ }
+
+ bool OnGossipSelect(Player* player, Creature* creature, uint32 /*sender*/, uint32 action)
+ {
+ player->CLOSE_GOSSIP_MENU();
+
+ if (canBuild(creature))
+ {
+ switch (action - GOSSIP_ACTION_INFO_DEF)
+ {
+ case 0:
+ creature->CastSpell(player, SPELL_BUILD_CATAPULT_FORCE, true);
+ break;
+ case 1:
+ creature->CastSpell(player, SPELL_BUILD_DEMOLISHER_FORCE, true);
+ break;
+ case 2:
+ creature->CastSpell(player, player->GetTeamId() == TEAM_ALLIANCE ? SPELL_BUILD_SIEGE_VEHICLE_FORCE_ALLIANCE : SPELL_BUILD_SIEGE_VEHICLE_FORCE_HORDE, true);
+ break;
+ }
+ if (Creature* controlArms = creature->FindNearestCreature(NPC_WINTERGRASP_CONTROL_ARMS, 30.0f, true))
+ creature->CastSpell(controlArms, SPELL_ACTIVATE_CONTROL_ARMS, true);
+ }
+ return true;
+ }
+
+ private:
+ bool canBuild(Creature* creature)
+ {
+ Battlefield* wintergrasp = sBattlefieldMgr->GetBattlefieldByBattleId(BATTLEFIELD_BATTLEID_WG);
+ if (!wintergrasp)
+ return false;
+
+ switch (creature->GetEntry())
+ {
+ case NPC_GOBLIN_MECHANIC:
+ return (wintergrasp->GetData(BATTLEFIELD_WG_DATA_MAX_VEHICLE_H) > wintergrasp->GetData(BATTLEFIELD_WG_DATA_VEHICLE_H));
+ case NPC_GNOMISH_ENGINEER:
+ return (wintergrasp->GetData(BATTLEFIELD_WG_DATA_MAX_VEHICLE_A) > wintergrasp->GetData(BATTLEFIELD_WG_DATA_VEHICLE_A));
+ default:
+ return false;
+ }
+ }
+};
+
+class npc_wg_spirit_guide : public CreatureScript
+{
+ public:
+ npc_wg_spirit_guide() : CreatureScript("npc_wg_spirit_guide") { }
+
+ bool OnGossipHello(Player* player, Creature* creature)
+ {
+ if (creature->isQuestGiver())
+ player->PrepareQuestMenu(creature->GetGUID());
+
+ Battlefield* wintergrasp = sBattlefieldMgr->GetBattlefieldByBattleId(BATTLEFIELD_BATTLEID_WG);
+ if (!wintergrasp)
+ return true;
+
+ GraveyardVect graveyard = wintergrasp->GetGraveyardVector();
+ for (uint8 i = 0; i < graveyard.size(); i++)
+ if (graveyard[i]->GetControlTeamId() == player->GetTeamId())
+ player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, sObjectMgr->GetTrinityStringForDBCLocale(((BfGraveyardWG*)graveyard[i])->GetTextId()), GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + i);
+
+ player->SEND_GOSSIP_MENU(player->GetGossipTextId(creature), creature->GetGUID());
+ return true;
+ }
+
+ bool OnGossipSelect(Player* player, Creature* /*creature*/, uint32 /*sender*/, uint32 action)
+ {
+ player->CLOSE_GOSSIP_MENU();
+
+ Battlefield* wintergrasp = sBattlefieldMgr->GetBattlefieldByBattleId(BATTLEFIELD_BATTLEID_WG);
+ if (wintergrasp)
+ {
+ GraveyardVect gy = wintergrasp->GetGraveyardVector();
+ for (uint8 i = 0; i < gy.size(); i++)
+ if (action - GOSSIP_ACTION_INFO_DEF == i && gy[i]->GetControlTeamId() == player->GetTeamId())
+ if (WorldSafeLocsEntry const* safeLoc = sWorldSafeLocsStore.LookupEntry(gy[i]->GetGraveyardId()))
+ player->TeleportTo(safeLoc->map_id, safeLoc->x, safeLoc->y, safeLoc->z, 0);
+ }
+ return true;
+ }
+
+ struct npc_wg_spirit_guideAI : public ScriptedAI
+ {
+ npc_wg_spirit_guideAI(Creature* creature) : ScriptedAI(creature) { }
+
+ void UpdateAI(uint32 const /*diff*/)
+ {
+ if (!me->HasUnitState(UNIT_STATE_CASTING))
+ DoCast(me, SPELL_CHANNEL_SPIRIT_HEAL);
+ }
+ };
+
+ CreatureAI* GetAI(Creature* creature) const
+ {
+ return new npc_wg_spirit_guideAI(creature);
+ }
+};
+
+class npc_wg_queue : public CreatureScript
+{
+ public:
+ npc_wg_queue() : CreatureScript("npc_wg_queue") { }
+
+ bool OnGossipHello(Player* player, Creature* creature)
+ {
+ if (creature->isQuestGiver())
+ player->PrepareQuestMenu(creature->GetGUID());
+
+ Battlefield* wintergrasp = sBattlefieldMgr->GetBattlefieldByBattleId(BATTLEFIELD_BATTLEID_WG);
+ if (!wintergrasp)
+ return true;
+
+ if (wintergrasp->IsWarTime())
+ {
+ player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, sObjectMgr->GetTrinityStringForDBCLocale(WG_NPCQUEUE_TEXTOPTION_JOIN), GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF);
+ player->SEND_GOSSIP_MENU(wintergrasp->GetDefenderTeam() ? WG_NPCQUEUE_TEXT_H_WAR : WG_NPCQUEUE_TEXT_A_WAR, creature->GetGUID());
+ }
+ else
+ {
+ uint32 timer = wintergrasp->GetTimer() / 1000;
+ player->SendUpdateWorldState(4354, time(NULL) + timer);
+ if (timer < 15 * MINUTE)
+ {
+ player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, sObjectMgr->GetTrinityStringForDBCLocale(WG_NPCQUEUE_TEXTOPTION_JOIN), GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF);
+ player->SEND_GOSSIP_MENU(wintergrasp->GetDefenderTeam() ? WG_NPCQUEUE_TEXT_H_QUEUE : WG_NPCQUEUE_TEXT_A_QUEUE, creature->GetGUID());
+ }
+ else
+ player->SEND_GOSSIP_MENU(wintergrasp->GetDefenderTeam() ? WG_NPCQUEUE_TEXT_H_NOWAR : WG_NPCQUEUE_TEXT_A_NOWAR, creature->GetGUID());
+ }
+ return true;
+ }
+
+ bool OnGossipSelect(Player* player, Creature* /*creature*/ , uint32 /*sender*/ , uint32 /*action*/)
+ {
+ player->CLOSE_GOSSIP_MENU();
+
+ Battlefield* wintergrasp = sBattlefieldMgr->GetBattlefieldByBattleId(BATTLEFIELD_BATTLEID_WG);
+ if (!wintergrasp)
+ return true;
+
+ if (wintergrasp->IsWarTime())
+ wintergrasp->InvitePlayerToWar(player);
+ else
+ {
+ uint32 timer = wintergrasp->GetTimer() / 1000;
+ if (timer < 15 * MINUTE)
+ wintergrasp->InvitePlayerToQueue(player);
+ }
+ return true;
+ }
+};
+
+class go_wg_vehicle_teleporter : public GameObjectScript
+{
+ public:
+ go_wg_vehicle_teleporter() : GameObjectScript("go_wg_vehicle_teleporter") { }
+
+ struct go_wg_vehicle_teleporterAI : public GameObjectAI
+ {
+ go_wg_vehicle_teleporterAI(GameObject* gameObject) : GameObjectAI(gameObject), _checkTimer(1000) { }
+
+ void UpdateAI(uint32 diff)
+ {
+ if (_checkTimer <= diff)
+ {
+ if (Battlefield* wg = sBattlefieldMgr->GetBattlefieldByBattleId(BATTLEFIELD_BATTLEID_WG))
+ // Tabulation madness in the hole!
+ for (uint8 i = 0; i < MAX_WINTERGRASP_VEHICLES; i++)
+ if (Creature* vehicleCreature = go->FindNearestCreature(vehiclesList[i], 3.0f, true))
+ if (!vehicleCreature->HasAura(SPELL_VEHICLE_TELEPORT) && vehicleCreature->getFaction() == WintergraspFaction[wg->GetDefenderTeam()])
+ if (Creature* teleportTrigger = vehicleCreature->FindNearestCreature(NPC_WORLD_TRIGGER_LARGE_AOI_NOT_IMMUNE_PC_NPC, 100.0f, true))
+ teleportTrigger->CastSpell(vehicleCreature, SPELL_VEHICLE_TELEPORT, true);
+
+ _checkTimer = 1000;
+ }
+ else _checkTimer -= diff;
+ }
+
+ private:
+ uint32 _checkTimer;
+ };
+
+ GameObjectAI* GetAI(GameObject* go) const
+ {
+ return new go_wg_vehicle_teleporterAI(go);
+ }
+};
+
+class npc_wg_quest_giver : public CreatureScript
+{
+ public:
+ npc_wg_quest_giver() : CreatureScript("npc_wg_quest_giver") { }
+
+ bool OnGossipHello(Player* player, Creature* creature)
+ {
+ if (creature->isQuestGiver())
+ player->PrepareQuestMenu(creature->GetGUID());
+
+ Battlefield* wintergrasp = sBattlefieldMgr->GetBattlefieldByBattleId(BATTLEFIELD_BATTLEID_WG);
+ if (!wintergrasp)
+ return true;
+
+ if (creature->isQuestGiver())
+ {
+ QuestRelationBounds objectQR = sObjectMgr->GetCreatureQuestRelationBounds(creature->GetEntry());
+ QuestRelationBounds objectQIR = sObjectMgr->GetCreatureQuestInvolvedRelationBounds(creature->GetEntry());
+
+ QuestMenu& qm = player->PlayerTalkClass->GetQuestMenu();
+ qm.ClearMenu();
+
+ for (QuestRelations::const_iterator i = objectQIR.first; i != objectQIR.second; ++i)
+ {
+ uint32 questId = i->second;
+ QuestStatus status = player->GetQuestStatus(questId);
+ if (status == QUEST_STATUS_COMPLETE)
+ qm.AddMenuItem(questId, 4);
+ else if (status == QUEST_STATUS_INCOMPLETE)
+ qm.AddMenuItem(questId, 4);
+ //else if (status == QUEST_STATUS_AVAILABLE)
+ // qm.AddMenuItem(quest_id, 2);
+ }
+
+ for (QuestRelations::const_iterator i = objectQR.first; i != objectQR.second; ++i)
+ {
+ uint32 questId = i->second;
+ Quest const* quest = sObjectMgr->GetQuestTemplate(questId);
+ if (!quest)
+ continue;
+
+ switch (questId)
+ {
+ // Horde attacker
+ case QUEST_BONES_AND_ARROWS_HORDE_ATT:
+ case QUEST_JINXING_THE_WALLS_HORDE_ATT:
+ case QUEST_SLAY_THEM_ALL_HORDE_ATT:
+ case QUEST_FUELING_THE_DEMOLISHERS_HORDE_ATT:
+ case QUEST_HEALING_WITH_ROSES_HORDE_ATT:
+ case QUEST_DEFEND_THE_SIEGE_HORDE_ATT:
+ if (wintergrasp->GetAttackerTeam() == TEAM_HORDE)
+ {
+ QuestStatus status = player->GetQuestStatus(questId);
+
+ if (quest->IsAutoComplete() && player->CanTakeQuest(quest, false))
+ qm.AddMenuItem(questId, 4);
+ else if (status == QUEST_STATUS_NONE && player->CanTakeQuest(quest, false))
+ qm.AddMenuItem(questId, 2);
+ }
+ break;
+ // Horde defender
+ case QUEST_BONES_AND_ARROWS_HORDE_DEF:
+ case QUEST_WARDING_THE_WALLS_HORDE_DEF:
+ case QUEST_SLAY_THEM_ALL_HORDE_DEF:
+ case QUEST_FUELING_THE_DEMOLISHERS_HORDE_DEF:
+ case QUEST_HEALING_WITH_ROSES_HORDE_DEF:
+ case QUEST_TOPPLING_THE_TOWERS_HORDE_DEF:
+ case QUEST_STOP_THE_SIEGE_HORDE_DEF:
+ if (wintergrasp->GetDefenderTeam() == TEAM_HORDE)
+ {
+ QuestStatus status = player->GetQuestStatus(questId);
+
+ if (quest->IsAutoComplete() && player->CanTakeQuest(quest, false))
+ qm.AddMenuItem(questId, 4);
+ else if (status == QUEST_STATUS_NONE && player->CanTakeQuest(quest, false))
+ qm.AddMenuItem(questId, 2);
+ }
+ break;
+ // Alliance attacker
+ case QUEST_BONES_AND_ARROWS_ALLIANCE_ATT:
+ case QUEST_WARDING_THE_WARRIORS_ALLIANCE_ATT:
+ case QUEST_NO_MERCY_FOR_THE_MERCILESS_ALLIANCE_ATT:
+ case QUEST_DEFEND_THE_SIEGE_ALLIANCE_ATT:
+ case QUEST_A_RARE_HERB_ALLIANCE_ATT:
+ if (wintergrasp->GetAttackerTeam() == TEAM_ALLIANCE)
+ {
+ QuestStatus status = player->GetQuestStatus(questId);
+
+ if (quest->IsAutoComplete() && player->CanTakeQuest(quest, false))
+ qm.AddMenuItem(questId, 4);
+ else if (status == QUEST_STATUS_NONE && player->CanTakeQuest(quest, false))
+ qm.AddMenuItem(questId, 2);
+ }
+ break;
+ // Alliance defender
+ case QUEST_BONES_AND_ARROWS_ALLIANCE_DEF:
+ case QUEST_WARDING_THE_WARRIORS_ALLIANCE_DEF:
+ case QUEST_NO_MERCY_FOR_THE_MERCILESS_ALLIANCE_DEF:
+ case QUEST_SHOUTHERN_SABOTAGE_ALLIANCE_DEF:
+ case QUEST_STOP_THE_SIEGE_ALLIANCE_DEF:
+ case QUEST_A_RARE_HERB_ALLIANCE_DEF:
+ if (wintergrasp->GetDefenderTeam() == TEAM_ALLIANCE)
+ {
+ QuestStatus status = player->GetQuestStatus(questId);
+
+ if (quest->IsAutoComplete() && player->CanTakeQuest(quest, false))
+ qm.AddMenuItem(questId, 4);
+ else if (status == QUEST_STATUS_NONE && player->CanTakeQuest(quest, false))
+ qm.AddMenuItem(questId, 2);
+ }
+ break;
+ default:
+ QuestStatus status = player->GetQuestStatus(questId);
+
+ if (quest->IsAutoComplete() && player->CanTakeQuest(quest, false))
+ qm.AddMenuItem(questId, 4);
+ else if (status == QUEST_STATUS_NONE && player->CanTakeQuest(quest, false))
+ qm.AddMenuItem(questId, 2);
+ break;
+ }
+ }
+ }
+ player->SEND_GOSSIP_MENU(player->GetGossipTextId(creature), creature->GetGUID());
+ return true;
+ }
+};
+
+class spell_wintergrasp_force_building : public SpellScriptLoader
+{
+ public:
+ spell_wintergrasp_force_building() : SpellScriptLoader("spell_wintergrasp_force_building") { }
+
+ class spell_wintergrasp_force_building_SpellScript : public SpellScript
+ {
+ PrepareSpellScript(spell_wintergrasp_force_building_SpellScript);
+
+ bool Validate(SpellInfo const* /*spell*/)
+ {
+ if (!sSpellMgr->GetSpellInfo(SPELL_BUILD_CATAPULT_FORCE)
+ || !sSpellMgr->GetSpellInfo(SPELL_BUILD_DEMOLISHER_FORCE)
+ || !sSpellMgr->GetSpellInfo(SPELL_BUILD_SIEGE_VEHICLE_FORCE_HORDE)
+ || !sSpellMgr->GetSpellInfo(SPELL_BUILD_SIEGE_VEHICLE_FORCE_ALLIANCE))
+ return false;
+ return true;
+ }
+
+ void HandleScript(SpellEffIndex effIndex)
+ {
+ PreventHitDefaultEffect(effIndex);
+ GetHitUnit()->CastSpell(GetHitUnit(), GetEffectValue(), false);
+ }
+
+ void Register()
+ {
+ OnEffectHitTarget += SpellEffectFn(spell_wintergrasp_force_building_SpellScript::HandleScript, EFFECT_0, SPELL_EFFECT_SCRIPT_EFFECT);
+ }
+ };
+
+ SpellScript* GetSpellScript() const
+ {
+ return new spell_wintergrasp_force_building_SpellScript();
+ }
+};
+
+class spell_wintergrasp_grab_passenger : public SpellScriptLoader
+{
+ public:
+ spell_wintergrasp_grab_passenger() : SpellScriptLoader("spell_wintergrasp_grab_passenger") { }
+
+ class spell_wintergrasp_grab_passenger_SpellScript : public SpellScript
+ {
+ PrepareSpellScript(spell_wintergrasp_grab_passenger_SpellScript);
+
+ void HandleScript(SpellEffIndex /*effIndex*/)
+ {
+ if (Player* target = GetHitPlayer())
+ target->CastSpell(GetCaster(), SPELL_RIDE_WG_VEHICLE, false);
+ }
+
+ void Register()
+ {
+ OnEffectHitTarget += SpellEffectFn(spell_wintergrasp_grab_passenger_SpellScript::HandleScript, EFFECT_0, SPELL_EFFECT_SCRIPT_EFFECT);
+ }
+ };
+
+ SpellScript* GetSpellScript() const
+ {
+ return new spell_wintergrasp_grab_passenger_SpellScript();
+ }
+};
+
+class achievement_wg_didnt_stand_a_chance : public AchievementCriteriaScript
+{
+public:
+ achievement_wg_didnt_stand_a_chance() : AchievementCriteriaScript("achievement_wg_didnt_stand_a_chance") { }
+
+ bool OnCheck(Player* source, Unit* target)
+ {
+ if (!target)
+ return false;
+
+ if (Player* victim = target->ToPlayer())
+ {
+ if (!victim->IsMounted())
+ return false;
+
+ if (Vehicle* vehicle = source->GetVehicle())
+ if (vehicle->GetVehicleInfo()->m_ID == 244) // Wintergrasp Tower Cannon
+ return true;
+ }
+
+ return false;
+ }
+};
+
+class spell_wintergrasp_defender_teleport : public SpellScriptLoader
+{
+public:
+ spell_wintergrasp_defender_teleport() : SpellScriptLoader("spell_wintergrasp_defender_teleport") { }
+
+ class spell_wintergrasp_defender_teleport_SpellScript : public SpellScript
+ {
+ PrepareSpellScript(spell_wintergrasp_defender_teleport_SpellScript);
+
+ SpellCastResult CheckCast()
+ {
+ if (Battlefield* wg = sBattlefieldMgr->GetBattlefieldByBattleId(BATTLEFIELD_BATTLEID_WG))
+ if (Player* target = GetExplTargetUnit()->ToPlayer())
+ if (target->GetTeamId() != wg->GetDefenderTeam())
+ return SPELL_FAILED_BAD_TARGETS;
+ return SPELL_CAST_OK;
+ }
+
+ void Register()
+ {
+ OnCheckCast += SpellCheckCastFn(spell_wintergrasp_defender_teleport_SpellScript::CheckCast);
+ }
+ };
+
+ SpellScript* GetSpellScript() const
+ {
+ return new spell_wintergrasp_defender_teleport_SpellScript();
+ }
+};
+
+void AddSC_wintergrasp()
+{
+ new npc_wg_queue();
+ new npc_wg_spirit_guide();
+ new npc_wg_demolisher_engineer();
+ new go_wg_vehicle_teleporter();
+ new npc_wg_quest_giver();
+ new spell_wintergrasp_force_building();
+ new spell_wintergrasp_grab_passenger();
+ new achievement_wg_didnt_stand_a_chance();
+ new spell_wintergrasp_defender_teleport();
+}
diff --git a/src/server/scripts/Outland/Auchindoun/ShadowLabyrinth/boss_grandmaster_vorpil.cpp b/src/server/scripts/Outland/Auchindoun/ShadowLabyrinth/boss_grandmaster_vorpil.cpp
index c1850ee821c..a1780d1d4a8 100644
--- a/src/server/scripts/Outland/Auchindoun/ShadowLabyrinth/boss_grandmaster_vorpil.cpp
+++ b/src/server/scripts/Outland/Auchindoun/ShadowLabyrinth/boss_grandmaster_vorpil.cpp
@@ -171,6 +171,7 @@ public:
summonTraveler_Timer = 90000;
banish_Timer = 17000;
HelpYell = false;
+ sumportals = false;
destroyPortals();
if (instance)
diff --git a/src/server/scripts/Outland/BlackTemple/boss_mother_shahraz.cpp b/src/server/scripts/Outland/BlackTemple/boss_mother_shahraz.cpp
index 1b2fe61e87c..ec25a8f9f60 100644
--- a/src/server/scripts/Outland/BlackTemple/boss_mother_shahraz.cpp
+++ b/src/server/scripts/Outland/BlackTemple/boss_mother_shahraz.cpp
@@ -248,11 +248,9 @@ public:
{
for (uint8 i = 0; i < 3; ++i)
{
- Unit* unit = NULL;
if (TargetGUID[i])
{
- unit = Unit::GetUnit(*me, TargetGUID[i]);
- if (unit)
+ if (Unit* unit = Unit::GetUnit(*me, TargetGUID[i]))
unit->CastSpell(unit, SPELL_ATTRACTION, true);
TargetGUID[i] = 0;
}
diff --git a/src/server/scripts/Outland/BlackTemple/boss_reliquary_of_souls.cpp b/src/server/scripts/Outland/BlackTemple/boss_reliquary_of_souls.cpp
index 44c37fc9753..ec9e4e116bf 100644
--- a/src/server/scripts/Outland/BlackTemple/boss_reliquary_of_souls.cpp
+++ b/src/server/scripts/Outland/BlackTemple/boss_reliquary_of_souls.cpp
@@ -181,6 +181,23 @@ public:
me->RemoveAurasDueToSpell(SPELL_SUBMERGE);
}
+ void MoveInLineOfSight(Unit* who)
+ {
+ if (!who)
+ return;
+
+ if (me->isInCombat())
+ return;
+
+ if (who->GetTypeId() != TYPEID_PLAYER)
+ return;
+
+ if (me->GetDistance(who) > 50.0f)
+ return;
+
+ AttackStartNoMove(who);
+ }
+
void EnterCombat(Unit* who)
{
me->AddThreat(who, 10000.0f);
@@ -412,6 +429,7 @@ public:
me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);
me->Yell(SUFF_SAY_RECAP, LANG_UNIVERSAL, 0);
DoScriptText(SUFF_SAY_RECAP, me);
+ me->SetReactState(REACT_PASSIVE);
}
}
@@ -532,6 +550,7 @@ public:
damage = 0;
me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);
DoScriptText(SUFF_SAY_RECAP, me);
+ me->SetReactState(REACT_PASSIVE);
}
else
{
diff --git a/src/server/scripts/Outland/BlackTemple/illidari_council.cpp b/src/server/scripts/Outland/BlackTemple/illidari_council.cpp
index 710f5c82fab..673d4bcc96f 100644
--- a/src/server/scripts/Outland/BlackTemple/illidari_council.cpp
+++ b/src/server/scripts/Outland/BlackTemple/illidari_council.cpp
@@ -299,12 +299,11 @@ public:
for (uint8 i = 0; i < 4; ++i)
{
- Unit* Member = NULL;
if (Council[i])
{
- Member = Unit::GetUnit(*me, Council[i]);
- if (Member && Member->isAlive())
- CAST_CRE(Member)->AI()->AttackStart(target);
+ Unit* member = Unit::GetUnit(*me, Council[i]);
+ if (member && member->isAlive())
+ CAST_CRE(member)->AI()->AttackStart(target);
}
}
diff --git a/src/server/scripts/Outland/CoilfangReservoir/SteamVault/instance_steam_vault.cpp b/src/server/scripts/Outland/CoilfangReservoir/SteamVault/instance_steam_vault.cpp
index 26ab54746be..dd0b5ea9160 100644
--- a/src/server/scripts/Outland/CoilfangReservoir/SteamVault/instance_steam_vault.cpp
+++ b/src/server/scripts/Outland/CoilfangReservoir/SteamVault/instance_steam_vault.cpp
@@ -200,16 +200,12 @@ public:
std::string GetSaveData()
{
OUT_SAVE_INST_DATA;
+
std::ostringstream stream;
stream << m_auiEncounter[0] << ' ' << m_auiEncounter[1] << ' ' << m_auiEncounter[2] << ' ' << m_auiEncounter[3];
- char* out = new char[stream.str().length() + 1];
- strcpy(out, stream.str().c_str());
- if (out)
- {
- OUT_SAVE_INST_DATA_COMPLETE;
- return out;
- }
- return NULL;
+
+ OUT_SAVE_INST_DATA_COMPLETE;
+ return stream.str();
}
void Load(const char* in)
diff --git a/src/server/scripts/Outland/GruulsLair/instance_gruuls_lair.cpp b/src/server/scripts/Outland/GruulsLair/instance_gruuls_lair.cpp
index fdb386372d4..fa67659ca66 100644
--- a/src/server/scripts/Outland/GruulsLair/instance_gruuls_lair.cpp
+++ b/src/server/scripts/Outland/GruulsLair/instance_gruuls_lair.cpp
@@ -171,15 +171,9 @@ public:
OUT_SAVE_INST_DATA;
std::ostringstream stream;
stream << m_auiEncounter[0] << ' ' << m_auiEncounter[1];
- char* out = new char[stream.str().length() + 1];
- strcpy(out, stream.str().c_str());
- if (out)
- {
- OUT_SAVE_INST_DATA_COMPLETE;
- return out;
- }
- return NULL;
+ OUT_SAVE_INST_DATA_COMPLETE;
+ return stream.str();
}
void Load(const char* in)
diff --git a/src/server/scripts/Outland/HellfireCitadel/BloodFurnace/blood_furnace.h b/src/server/scripts/Outland/HellfireCitadel/BloodFurnace/blood_furnace.h
index e34e86c16a7..ed8c5351493 100644
--- a/src/server/scripts/Outland/HellfireCitadel/BloodFurnace/blood_furnace.h
+++ b/src/server/scripts/Outland/HellfireCitadel/BloodFurnace/blood_furnace.h
@@ -39,5 +39,9 @@
#define DATA_PRISON_CELL6 18
#define DATA_PRISON_CELL7 19
#define DATA_PRISON_CELL8 20
+#define DATA_BROGGOK_LEVER 21
+#define ACTION_ACTIVATE_BROGGOK 22
+#define ACTION_RESET_BROGGOK 23
+#define ACTION_PREPARE_BROGGOK 24
#endif
diff --git a/src/server/scripts/Outland/HellfireCitadel/BloodFurnace/boss_broggok.cpp b/src/server/scripts/Outland/HellfireCitadel/BloodFurnace/boss_broggok.cpp
index 3a2e0834fed..b42641c5171 100644
--- a/src/server/scripts/Outland/HellfireCitadel/BloodFurnace/boss_broggok.cpp
+++ b/src/server/scripts/Outland/HellfireCitadel/BloodFurnace/boss_broggok.cpp
@@ -47,9 +47,9 @@ class boss_broggok : public CreatureScript
{
}
- struct boss_broggokAI : public ScriptedAI
+ struct boss_broggokAI : public BossAI
{
- boss_broggokAI(Creature* creature) : ScriptedAI(creature)
+ boss_broggokAI(Creature* creature) : BossAI(creature, DATA_BROGGOK)
{
instance = creature->GetInstanceScript();
}
@@ -59,27 +59,21 @@ class boss_broggok : public CreatureScript
uint32 AcidSpray_Timer;
uint32 PoisonSpawn_Timer;
uint32 PoisonBolt_Timer;
+ bool canAttack;
void Reset()
{
+ _Reset();
AcidSpray_Timer = 10000;
PoisonSpawn_Timer = 5000;
PoisonBolt_Timer = 7000;
- if (instance)
- {
- instance->SetData(TYPE_BROGGOK_EVENT, NOT_STARTED);
- instance->HandleGameObject(instance->GetData64(DATA_DOOR4), true);
- }
+ DoAction(ACTION_RESET_BROGGOK);
+ instance->SetData(TYPE_BROGGOK_EVENT, NOT_STARTED);
}
void EnterCombat(Unit* /*who*/)
{
DoScriptText(SAY_AGGRO, me);
- if (instance)
- {
- instance->SetData(TYPE_BROGGOK_EVENT, IN_PROGRESS);
- instance->HandleGameObject(instance->GetData64(DATA_DOOR4), false);
- }
}
void JustSummoned(Creature* summoned)
@@ -94,7 +88,8 @@ class boss_broggok : public CreatureScript
{
if (!UpdateVictim())
return;
-
+ if (!canAttack)
+ return;
if (AcidSpray_Timer <= diff)
{
DoCast(me->getVictim(), SPELL_SLIME_SPRAY);
@@ -132,6 +127,26 @@ class boss_broggok : public CreatureScript
}
}
+ void DoAction(int32 const action)
+ {
+ switch (action)
+ {
+ case ACTION_PREPARE_BROGGOK:
+ me->SetInCombatWithZone();
+ break;
+ case ACTION_ACTIVATE_BROGGOK:
+ me->SetReactState(REACT_AGGRESSIVE);
+ me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_IMMUNE_TO_NPC | UNIT_FLAG_NON_ATTACKABLE);
+ canAttack = true;
+ break;
+ case ACTION_RESET_BROGGOK:
+ me->SetReactState(REACT_PASSIVE);
+ me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_IMMUNE_TO_NPC | UNIT_FLAG_NON_ATTACKABLE);
+ canAttack = false;
+ break;
+ }
+ }
+
};
CreatureAI* GetAI(Creature* creature) const
@@ -140,7 +155,27 @@ class boss_broggok : public CreatureScript
}
};
+class go_broggok_lever : public GameObjectScript
+{
+ public:
+ go_broggok_lever() : GameObjectScript("go_broggok_lever") {}
+
+ bool OnGossipHello(Player* /*player*/, GameObject* go)
+ {
+ if (InstanceScript* instance = go->GetInstanceScript())
+ if (instance->GetData(TYPE_BROGGOK_EVENT) != DONE && instance->GetData(TYPE_BROGGOK_EVENT) != IN_PROGRESS)
+ {
+ instance->SetData(TYPE_BROGGOK_EVENT, IN_PROGRESS);
+ if (Creature* broggok = Creature::GetCreature(*go, instance->GetData64(DATA_BROGGOK)))
+ broggok->AI()->DoAction(ACTION_PREPARE_BROGGOK);
+ }
+ go->UseDoorOrButton();
+ return false;
+ }
+};
+
void AddSC_boss_broggok()
{
new boss_broggok();
+ new go_broggok_lever();
}
diff --git a/src/server/scripts/Outland/HellfireCitadel/BloodFurnace/boss_kelidan_the_breaker.cpp b/src/server/scripts/Outland/HellfireCitadel/BloodFurnace/boss_kelidan_the_breaker.cpp
index a0bcc396fdb..3c07862e0f6 100644
--- a/src/server/scripts/Outland/HellfireCitadel/BloodFurnace/boss_kelidan_the_breaker.cpp
+++ b/src/server/scripts/Outland/HellfireCitadel/BloodFurnace/boss_kelidan_the_breaker.cpp
@@ -57,7 +57,9 @@ enum eKelidan
SPELL_VORTEX = 37370,
ENTRY_KELIDAN = 17377,
- ENTRY_CHANNELER = 17653
+ ENTRY_CHANNELER = 17653,
+
+ ACTION_ACTIVATE_ADDS = 92
};
const float ShadowmoonChannelers[5][4]=
@@ -107,6 +109,8 @@ class boss_kelidan_the_breaker : public CreatureScript
Firenova = false;
addYell = false;
SummonChannelers();
+ me->SetReactState(REACT_PASSIVE);
+ me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_IMMUNE_TO_NPC | UNIT_FLAG_NON_ATTACKABLE);
if (instance)
instance->SetData(TYPE_KELIDAN_THE_BREAKER_EVENT, NOT_STARTED);
}
@@ -152,7 +156,8 @@ class boss_kelidan_the_breaker : public CreatureScript
if (channeler && channeler->isAlive())
return;
}
-
+ me->SetReactState(REACT_AGGRESSIVE);
+ me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_IMMUNE_TO_NPC | UNIT_FLAG_NON_ATTACKABLE);
if (killer)
me->AI()->AttackStart(killer);
}
@@ -269,7 +274,6 @@ class boss_kelidan_the_breaker : public CreatureScript
DoMeleeAttackIfReady();
}
-
};
CreatureAI* GetAI(Creature* creature) const
@@ -295,16 +299,11 @@ class mob_shadowmoon_channeler : public CreatureScript
{
public:
- mob_shadowmoon_channeler()
- : CreatureScript("mob_shadowmoon_channeler")
- {
- }
+ mob_shadowmoon_channeler() : CreatureScript("mob_shadowmoon_channeler") {}
struct mob_shadowmoon_channelerAI : public ScriptedAI
{
- mob_shadowmoon_channelerAI(Creature* creature) : ScriptedAI(creature)
- {
- }
+ mob_shadowmoon_channelerAI(Creature* creature) : ScriptedAI(creature){}
uint32 ShadowBolt_Timer;
uint32 MarkOfShadow_Timer;
diff --git a/src/server/scripts/Outland/HellfireCitadel/BloodFurnace/instance_blood_furnace.cpp b/src/server/scripts/Outland/HellfireCitadel/BloodFurnace/instance_blood_furnace.cpp
index 4c434feb4ec..233a8d82497 100644
--- a/src/server/scripts/Outland/HellfireCitadel/BloodFurnace/instance_blood_furnace.cpp
+++ b/src/server/scripts/Outland/HellfireCitadel/BloodFurnace/instance_blood_furnace.cpp
@@ -26,6 +26,7 @@ EndScriptData */
#include "ScriptMgr.h"
#include "InstanceScript.h"
#include "blood_furnace.h"
+#include "CreatureAI.h"
#define ENTRY_SEWER1 181823
#define ENTRY_SEWER2 181766
@@ -35,9 +36,7 @@ class instance_blood_furnace : public InstanceMapScript
{
public:
instance_blood_furnace()
- : InstanceMapScript("instance_blood_furnace", 542)
- {
- }
+ : InstanceMapScript("instance_blood_furnace", 542) {}
struct instance_blood_furnace_InstanceMapScript : public InstanceScript
{
@@ -63,6 +62,18 @@ class instance_blood_furnace : public InstanceMapScript
uint64 PrisonCell7GUID;
uint64 PrisonCell8GUID;
+ std::set<uint64> PrisonersCell5;
+ std::set<uint64> PrisonersCell6;
+ std::set<uint64> PrisonersCell7;
+ std::set<uint64> PrisonersCell8;
+
+ uint8 PrisonerCounter5;
+ uint8 PrisonerCounter6;
+ uint8 PrisonerCounter7;
+ uint8 PrisonerCounter8;
+
+ uint64 BroggokLeverGUID;
+
uint32 m_auiEncounter[MAX_ENCOUNTER];
std::string str_data;
@@ -89,24 +100,45 @@ class instance_blood_furnace : public InstanceMapScript
PrisonCell6GUID = 0;
PrisonCell7GUID = 0;
PrisonCell8GUID = 0;
+
+ PrisonersCell5.clear();
+ PrisonersCell6.clear();
+ PrisonersCell7.clear();
+ PrisonersCell8.clear();
+
+ PrisonerCounter5 = 0;
+ PrisonerCounter6 = 0;
+ PrisonerCounter7 = 0;
+ PrisonerCounter8 = 0;
+
+ BroggokLeverGUID = 0;
}
void OnCreatureCreate(Creature* creature)
{
switch (creature->GetEntry())
{
- case 17381:
- The_MakerGUID = creature->GetGUID();
- break;
- case 17380:
- BroggokGUID = creature->GetGUID();
- break;
- case 17377:
- Kelidan_The_BreakerGUID = creature->GetGUID();
- break;
+ case 17381:
+ The_MakerGUID = creature->GetGUID();
+ break;
+ case 17380:
+ BroggokGUID = creature->GetGUID();
+ break;
+ case 17377:
+ Kelidan_The_BreakerGUID = creature->GetGUID();
+ break;
+ case 17398:
+ StorePrisoner(creature);
+ break;
}
}
+ void OnUnitDeath(Unit* unit)
+ {
+ if (unit && unit->GetTypeId() == TYPEID_UNIT && unit->GetEntry() == 17398)
+ PrisonerDied(unit->GetGUID());
+ }
+
void OnGameObjectCreate(GameObject* go)
{
if (go->GetEntry() == 181766) //Final exit door
@@ -138,6 +170,9 @@ class instance_blood_furnace : public InstanceMapScript
PrisonCell7GUID = go->GetGUID();
if (go->GetEntry() == 181817) //Broggok prison cell back left
PrisonCell8GUID = go->GetGUID();
+
+ if (go->GetEntry() == 181982)
+ BroggokLeverGUID = go->GetGUID(); //Broggok lever
}
uint64 GetData64(uint32 data)
@@ -161,18 +196,25 @@ class instance_blood_furnace : public InstanceMapScript
case DATA_PRISON_CELL6: return PrisonCell6GUID;
case DATA_PRISON_CELL7: return PrisonCell7GUID;
case DATA_PRISON_CELL8: return PrisonCell8GUID;
+ case DATA_BROGGOK_LEVER: return BroggokLeverGUID;
}
-
return 0;
}
- void SetData(uint32 /*type*/, uint32 data)
+ void SetData(uint32 type, uint32 data)
{
- switch (data)
+ switch (type)
{
- case TYPE_THE_MAKER_EVENT: m_auiEncounter[0] = data; break;
- case TYPE_BROGGOK_EVENT: m_auiEncounter[1] = data; break;
- case TYPE_KELIDAN_THE_BREAKER_EVENT: m_auiEncounter[2] = data; break;
+ case TYPE_THE_MAKER_EVENT:
+ m_auiEncounter[0] = data;
+ break;
+ case TYPE_BROGGOK_EVENT:
+ m_auiEncounter[1] = data;
+ UpdateBroggokEvent(data);
+ break;
+ case TYPE_KELIDAN_THE_BREAKER_EVENT:
+ m_auiEncounter[2] = data;
+ break;
}
if (data == DONE)
@@ -189,15 +231,14 @@ class instance_blood_furnace : public InstanceMapScript
}
}
- uint32 GetData(uint32 data)
+ uint32 GetData(uint32 type)
{
- switch (data)
+ switch (type)
{
case TYPE_THE_MAKER_EVENT: return m_auiEncounter[0];
case TYPE_BROGGOK_EVENT: return m_auiEncounter[1];
case TYPE_KELIDAN_THE_BREAKER_EVENT: return m_auiEncounter[2];
}
-
return 0;
}
@@ -225,6 +266,147 @@ class instance_blood_furnace : public InstanceMapScript
OUT_LOAD_INST_DATA_COMPLETE;
}
+
+ void UpdateBroggokEvent(uint32 data)
+ {
+ switch (data)
+ {
+ case IN_PROGRESS:
+ ActivateCell(DATA_PRISON_CELL5);
+ HandleGameObject(Door4GUID, false);
+ break;
+ case NOT_STARTED:
+ ResetPrisons();
+ HandleGameObject(Door5GUID, false);
+ HandleGameObject(Door4GUID, true);
+ if (GameObject* lever = instance->GetGameObject(BroggokLeverGUID))
+ lever->Respawn();
+ break;
+ }
+ }
+
+ void ResetPrisons()
+ {
+ PrisonerCounter5 = PrisonersCell5.size();
+ ResetPrisoners(PrisonersCell5);
+ HandleGameObject(PrisonCell5GUID, false);
+
+ PrisonerCounter6 = PrisonersCell6.size();
+ ResetPrisoners(PrisonersCell6);
+ HandleGameObject(PrisonCell6GUID, false);
+
+ PrisonerCounter7 = PrisonersCell7.size();
+ ResetPrisoners(PrisonersCell7);
+ HandleGameObject(PrisonCell7GUID, false);
+
+ PrisonerCounter8 = PrisonersCell8.size();
+ ResetPrisoners(PrisonersCell8);
+ HandleGameObject(PrisonCell8GUID, false);
+ }
+
+ void ResetPrisoners(std::set<uint64> prisoners)
+ {
+ for (std::set<uint64>::iterator i = prisoners.begin(); i != prisoners.end(); ++i)
+ if (Creature* prisoner = instance->GetCreature(*i))
+ ResetPrisoner(prisoner);
+ }
+
+ void ResetPrisoner(Creature* prisoner)
+ {
+ if (!prisoner->isAlive())
+ prisoner->Respawn(true);
+ prisoner->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_IMMUNE_TO_NPC | UNIT_FLAG_NON_ATTACKABLE);
+ }
+
+ void StorePrisoner(Creature* creature)
+ {
+ float posX = creature->GetPositionX();
+ float posY = creature->GetPositionY();
+
+ if (posX >= 405.0f && posX <= 423.0f)
+ {
+ if (posY >= 106.0f && posY <= 123.0f)
+ {
+ PrisonersCell5.insert(creature->GetGUID());
+ ++PrisonerCounter5;
+ }
+ else if (posY >= 76.0f && posY <= 91.0f)
+ {
+ PrisonersCell6.insert(creature->GetGUID());
+ ++PrisonerCounter6;
+ }
+ else return;
+ }
+ else if (posX >= 490.0f && posX <= 506.0f)
+ {
+ if (posY >= 106.0f && posY <= 123.0f)
+ {
+ PrisonersCell7.insert(creature->GetGUID());
+ ++PrisonerCounter7;
+ }
+ else if (posY >= 76.0f && posY <= 91.0f)
+ {
+ PrisonersCell8.insert(creature->GetGUID());
+ ++PrisonerCounter8;
+ }
+ else
+ return;
+ }
+ else
+ return;
+
+ ResetPrisoner(creature);
+ }
+
+ void PrisonerDied(uint64 guid)
+ {
+ if (PrisonersCell5.find(guid) != PrisonersCell5.end() && --PrisonerCounter5 <= 0)
+ ActivateCell(DATA_PRISON_CELL6);
+ else if (PrisonersCell6.find(guid) != PrisonersCell6.end() && --PrisonerCounter6 <= 0)
+ ActivateCell(DATA_PRISON_CELL7);
+ else if (PrisonersCell7.find(guid) != PrisonersCell7.end() && --PrisonerCounter7 <= 0)
+ ActivateCell(DATA_PRISON_CELL8);
+ else if (PrisonersCell8.find(guid) != PrisonersCell8.end() && --PrisonerCounter8 <= 0)
+ ActivateCell(DATA_DOOR5);
+ }
+
+ void ActivateCell(uint8 id)
+ {
+ switch (id)
+ {
+ case DATA_PRISON_CELL5:
+ HandleGameObject(PrisonCell5GUID,true);
+ ActivatePrisoners(PrisonersCell5);
+ break;
+ case DATA_PRISON_CELL6:
+ HandleGameObject(PrisonCell6GUID,true);
+ ActivatePrisoners(PrisonersCell6);
+ break;
+ case DATA_PRISON_CELL7:
+ HandleGameObject(PrisonCell7GUID,true);
+ ActivatePrisoners(PrisonersCell7);
+ break;
+ case DATA_PRISON_CELL8:
+ HandleGameObject(PrisonCell8GUID,true);
+ ActivatePrisoners(PrisonersCell8);
+ break;
+ case DATA_DOOR5:
+ HandleGameObject(Door5GUID,true);
+ if (Creature* broggok = instance->GetCreature(BroggokGUID))
+ broggok->AI()->DoAction(ACTION_ACTIVATE_BROGGOK);
+ break;
+ }
+ }
+
+ void ActivatePrisoners(std::set<uint64> prisoners)
+ {
+ for (std::set<uint64>::iterator i = prisoners.begin(); i != prisoners.end(); ++i)
+ if (Creature* prisoner = instance->GetCreature(*i))
+ {
+ prisoner->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_IMMUNE_TO_NPC | UNIT_FLAG_NON_ATTACKABLE);
+ prisoner->SetInCombatWithZone();
+ }
+ }
};
InstanceScript* GetInstanceScript(InstanceMap* map) const
diff --git a/src/server/scripts/Outland/TempestKeep/Eye/instance_the_eye.cpp b/src/server/scripts/Outland/TempestKeep/Eye/instance_the_eye.cpp
index 78ffddca4d8..1230b7e88cf 100644
--- a/src/server/scripts/Outland/TempestKeep/Eye/instance_the_eye.cpp
+++ b/src/server/scripts/Outland/TempestKeep/Eye/instance_the_eye.cpp
@@ -166,16 +166,12 @@ class instance_the_eye : public InstanceMapScript
std::string GetSaveData()
{
OUT_SAVE_INST_DATA;
+
std::ostringstream stream;
stream << m_auiEncounter[0] << ' ' << m_auiEncounter[1] << ' ' << m_auiEncounter[2] << ' ' << m_auiEncounter[3];
- char* out = new char[stream.str().length() + 1];
- strcpy(out, stream.str().c_str());
- if (out)
- {
- OUT_SAVE_INST_DATA_COMPLETE;
- return out;
- }
- return NULL;
+
+ OUT_SAVE_INST_DATA_COMPLETE;
+ return stream.str();
}
void Load(const char* in)
diff --git a/src/server/scripts/Outland/shadowmoon_valley.cpp b/src/server/scripts/Outland/shadowmoon_valley.cpp
index c79bf74aab6..078f8f5a4f0 100644
--- a/src/server/scripts/Outland/shadowmoon_valley.cpp
+++ b/src/server/scripts/Outland/shadowmoon_valley.cpp
@@ -45,6 +45,7 @@ EndContentData */
#include "ScriptedGossip.h"
#include "ScriptedEscortAI.h"
#include "Group.h"
+#include "SpellScript.h"
/*#####
# mob_mature_netherwing_drake
@@ -838,19 +839,10 @@ public:
return 1500;
break;
case 16:
- if (player)
- {
- Illi->CastSpell(player, SPELL_TWO, true);
- player->RemoveAurasDueToSpell(SPELL_THREE);
- player->RemoveAurasDueToSpell(SPELL_FOUR);
- return 5000;
- }
- else
- {
- player->FailQuest(QUEST_LORD_ILLIDAN_STORMRAGE);
- Step = 30;
- return 100;
- }
+ Illi->CastSpell(player, SPELL_TWO, true);
+ player->RemoveAurasDueToSpell(SPELL_THREE);
+ player->RemoveAurasDueToSpell(SPELL_FOUR);
+ return 5000;
break;
case 17:
DoScriptText(LORD_ILLIDAN_SAY_5, Illi);
@@ -1868,9 +1860,44 @@ public:
};
};
-/*#####
-#
-######*/
+enum ZuluhedChains
+{
+ QUEST_ZULUHED = 10866,
+ NPC_KARYNAKU = 22112,
+};
+
+class spell_unlocking_zuluheds_chains : public SpellScriptLoader
+{
+ public:
+ spell_unlocking_zuluheds_chains() : SpellScriptLoader("spell_unlocking_zuluheds_chains") { }
+
+ class spell_unlocking_zuluheds_chains_SpellScript : public SpellScript
+ {
+ PrepareSpellScript(spell_unlocking_zuluheds_chains_SpellScript);
+
+ bool Load()
+ {
+ return GetCaster()->GetTypeId() == TYPEID_PLAYER;
+ }
+
+ void HandleAfterHit()
+ {
+ Player* caster = GetCaster()->ToPlayer();
+ if (caster->GetQuestStatus(QUEST_ZULUHED) == QUEST_STATUS_INCOMPLETE)
+ caster->KilledMonsterCredit(NPC_KARYNAKU, 0);
+ }
+
+ void Register()
+ {
+ AfterHit += SpellHitFn(spell_unlocking_zuluheds_chains_SpellScript::HandleAfterHit);
+ }
+ };
+
+ SpellScript* GetSpellScript() const
+ {
+ return new spell_unlocking_zuluheds_chains_SpellScript();
+ }
+};
void AddSC_shadowmoon_valley()
{
@@ -1889,4 +1916,5 @@ void AddSC_shadowmoon_valley()
new mob_illidari_spawn();
new mob_torloth_the_magnificent();
new npc_enraged_spirit();
+ new spell_unlocking_zuluheds_chains();
}
diff --git a/src/server/scripts/Spells/spell_generic.cpp b/src/server/scripts/Spells/spell_generic.cpp
index 9cbf81b39af..d10d7725e2e 100644
--- a/src/server/scripts/Spells/spell_generic.cpp
+++ b/src/server/scripts/Spells/spell_generic.cpp
@@ -907,9 +907,22 @@ class spell_gen_profession_research : public SpellScriptLoader
return SPELL_CAST_OK;
}
+ void HandleScript(SpellEffIndex /*effIndex*/)
+ {
+ Player* caster = GetCaster()->ToPlayer();
+ uint32 spellId = GetSpellInfo()->Id;
+
+ // learn random explicit discovery recipe (if any)
+ if (uint32 discoveredSpellId = GetExplicitDiscoverySpell(spellId, caster))
+ caster->learnSpell(discoveredSpellId, false);
+
+ caster->UpdateCraftSkill(spellId);
+ }
+
void Register()
{
OnCheckCast += SpellCheckCastFn(spell_gen_profession_research_SpellScript::CheckRequirement);
+ OnEffectHitTarget += SpellEffectFn(spell_gen_profession_research_SpellScript::HandleScript, EFFECT_1, SPELL_EFFECT_SCRIPT_EFFECT);
}
};
@@ -950,14 +963,14 @@ class spell_generic_clone : public SpellScriptLoader
enum CloneWeaponSpells
{
- SPELL_COPY_WEAPON = 41055,
- SPELL_COPY_WEAPON_2 = 63416,
- SPELL_COPY_WEAPON_3 = 69891,
+ SPELL_COPY_WEAPON_AURA = 41054,
+ SPELL_COPY_WEAPON_2_AURA = 63418,
+ SPELL_COPY_WEAPON_3_AURA = 69893,
- SPELL_COPY_OFFHAND = 45206,
- SPELL_COPY_OFFHAND_2 = 69892,
+ SPELL_COPY_OFFHAND_AURA = 45205,
+ SPELL_COPY_OFFHAND_2_AURA = 69896,
- SPELL_COPY_RANGED = 57593
+ SPELL_COPY_RANGED_AURA = 57594
};
class spell_generic_clone_weapon : public SpellScriptLoader
@@ -969,80 +982,147 @@ class spell_generic_clone_weapon : public SpellScriptLoader
{
PrepareSpellScript(spell_generic_clone_weapon_SpellScript);
- bool Validate(SpellInfo const* /*spellEntry*/)
- {
- if (!sSpellMgr->GetSpellInfo(SPELL_COPY_WEAPON) || !sSpellMgr->GetSpellInfo(SPELL_COPY_WEAPON_2) || !sSpellMgr->GetSpellInfo(SPELL_COPY_WEAPON_3) || !sSpellMgr->GetSpellInfo(SPELL_COPY_OFFHAND)
- || !sSpellMgr->GetSpellInfo(SPELL_COPY_OFFHAND_2) || !sSpellMgr->GetSpellInfo(SPELL_COPY_RANGED))
- return false;
- return true;
- }
-
void HandleScriptEffect(SpellEffIndex effIndex)
{
PreventHitDefaultEffect(effIndex);
Unit* caster = GetCaster();
+
if (Unit* target = GetHitUnit())
{
uint32 spellId = uint32(GetSpellInfo()->Effects[EFFECT_0].CalcValue());
- target->CastSpell(caster, spellId, true);
+ caster->CastSpell(target, spellId, true);
+ }
+ }
- if (target->GetTypeId() == TYPEID_PLAYER)
- return;
+ void Register()
+ {
+ OnEffectHitTarget += SpellEffectFn(spell_generic_clone_weapon_SpellScript::HandleScriptEffect, EFFECT_0, SPELL_EFFECT_SCRIPT_EFFECT);
+ }
+ };
+
+ SpellScript* GetSpellScript() const
+ {
+ return new spell_generic_clone_weapon_SpellScript();
+ }
+};
+
+class spell_gen_clone_weapon_aura : public SpellScriptLoader
+{
+ public:
+ spell_gen_clone_weapon_aura() : SpellScriptLoader("spell_gen_clone_weapon_aura") { }
+
+ class spell_gen_clone_weapon_auraScript : public AuraScript
+ {
+ PrepareAuraScript(spell_gen_clone_weapon_auraScript);
+
+ uint32 prevItem;
+
+ bool Validate(SpellInfo const* /*spellEntry*/)
+ {
+ if (!sSpellMgr->GetSpellInfo(SPELL_COPY_WEAPON_AURA) || !sSpellMgr->GetSpellInfo(SPELL_COPY_WEAPON_2_AURA) || !sSpellMgr->GetSpellInfo(SPELL_COPY_WEAPON_3_AURA)
+ || !sSpellMgr->GetSpellInfo(SPELL_COPY_OFFHAND_AURA) || !sSpellMgr->GetSpellInfo(SPELL_COPY_OFFHAND_2_AURA) || !sSpellMgr->GetSpellInfo(SPELL_COPY_RANGED_AURA))
+ return false;
+ return true;
+ }
+
+ void OnApply(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
+ {
+ Unit* caster = GetCaster();
+ Unit* target = GetTarget();
- switch (GetSpellInfo()->Id)
+ if (!caster)
+ return;
+
+ switch (GetSpellInfo()->Id)
+ {
+ case SPELL_COPY_WEAPON_AURA:
+ case SPELL_COPY_WEAPON_2_AURA:
+ case SPELL_COPY_WEAPON_3_AURA:
{
- case SPELL_COPY_WEAPON:
- case SPELL_COPY_WEAPON_2:
- case SPELL_COPY_WEAPON_3:
+ prevItem = target->GetUInt32Value(UNIT_VIRTUAL_ITEM_SLOT_ID);
+
+ if (Player* player = caster->ToPlayer())
{
- if (Player* player = caster->ToPlayer())
- {
- if (Item* mainItem = player->GetItemByPos(INVENTORY_SLOT_BAG_0, EQUIPMENT_SLOT_MAINHAND))
- target->SetUInt32Value(UNIT_VIRTUAL_ITEM_SLOT_ID, mainItem->GetEntry());
- }
- else
- target->SetUInt32Value(UNIT_VIRTUAL_ITEM_SLOT_ID, caster->GetUInt32Value(UNIT_VIRTUAL_ITEM_SLOT_ID));
- break;
+ if (Item* mainItem = player->GetItemByPos(INVENTORY_SLOT_BAG_0, EQUIPMENT_SLOT_MAINHAND))
+ target->SetUInt32Value(UNIT_VIRTUAL_ITEM_SLOT_ID, mainItem->GetEntry());
}
- case SPELL_COPY_OFFHAND:
- case SPELL_COPY_OFFHAND_2:
+ else
+ target->SetUInt32Value(UNIT_VIRTUAL_ITEM_SLOT_ID, caster->GetUInt32Value(UNIT_VIRTUAL_ITEM_SLOT_ID));
+ break;
+ }
+ case SPELL_COPY_OFFHAND_AURA:
+ case SPELL_COPY_OFFHAND_2_AURA:
+ {
+ prevItem = target->GetUInt32Value(UNIT_VIRTUAL_ITEM_SLOT_ID) + 1;
+
+ if (Player* player = caster->ToPlayer())
{
- if (Player* player = caster->ToPlayer())
- {
- if (Item* offItem = player->GetItemByPos(INVENTORY_SLOT_BAG_0, EQUIPMENT_SLOT_OFFHAND))
- target->SetUInt32Value(UNIT_VIRTUAL_ITEM_SLOT_ID + 1, offItem->GetEntry());
- }
- else
- target->SetUInt32Value(UNIT_VIRTUAL_ITEM_SLOT_ID + 1, caster->GetUInt32Value(UNIT_VIRTUAL_ITEM_SLOT_ID + 1));
- break;
+ if (Item* offItem = player->GetItemByPos(INVENTORY_SLOT_BAG_0, EQUIPMENT_SLOT_OFFHAND))
+ target->SetUInt32Value(UNIT_VIRTUAL_ITEM_SLOT_ID + 1, offItem->GetEntry());
}
- case SPELL_COPY_RANGED:
+ else
+ target->SetUInt32Value(UNIT_VIRTUAL_ITEM_SLOT_ID + 1, caster->GetUInt32Value(UNIT_VIRTUAL_ITEM_SLOT_ID + 1));
+ break;
+ }
+ case SPELL_COPY_RANGED_AURA:
+ {
+ prevItem = target->GetUInt32Value(UNIT_VIRTUAL_ITEM_SLOT_ID) + 2;
+
+ if (Player* player = caster->ToPlayer())
{
- if (Player* player = caster->ToPlayer())
- {
- if (Item* rangedItem = player->GetItemByPos(INVENTORY_SLOT_BAG_0, EQUIPMENT_SLOT_RANGED))
- target->SetUInt32Value(UNIT_VIRTUAL_ITEM_SLOT_ID + 2, rangedItem->GetEntry());
- }
- else
- target->SetUInt32Value(UNIT_VIRTUAL_ITEM_SLOT_ID + 2, caster->GetUInt32Value(UNIT_VIRTUAL_ITEM_SLOT_ID + 2));
- break;
+ if (Item* rangedItem = player->GetItemByPos(INVENTORY_SLOT_BAG_0, EQUIPMENT_SLOT_RANGED))
+ target->SetUInt32Value(UNIT_VIRTUAL_ITEM_SLOT_ID + 2, rangedItem->GetEntry());
}
- default:
- break;
+ else
+ target->SetUInt32Value(UNIT_VIRTUAL_ITEM_SLOT_ID + 2, caster->GetUInt32Value(UNIT_VIRTUAL_ITEM_SLOT_ID + 2));
+ break;
+ }
+ default:
+ break;
+ }
+ }
+
+ void OnRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
+ {
+ Unit* target = GetTarget();
+
+ switch (GetSpellInfo()->Id)
+ {
+ case SPELL_COPY_WEAPON_AURA:
+ case SPELL_COPY_WEAPON_2_AURA:
+ case SPELL_COPY_WEAPON_3_AURA:
+ {
+ target->SetUInt32Value(UNIT_VIRTUAL_ITEM_SLOT_ID, prevItem);
+ break;
+ }
+ case SPELL_COPY_OFFHAND_AURA:
+ case SPELL_COPY_OFFHAND_2_AURA:
+ {
+ target->SetUInt32Value(UNIT_VIRTUAL_ITEM_SLOT_ID + 1, prevItem);
+ break;
+ }
+ case SPELL_COPY_RANGED_AURA:
+ {
+ target->SetUInt32Value(UNIT_VIRTUAL_ITEM_SLOT_ID + 2, prevItem);
+ break;
}
+ default:
+ break;
}
}
void Register()
{
- OnEffectHitTarget += SpellEffectFn(spell_generic_clone_weapon_SpellScript::HandleScriptEffect, EFFECT_0, SPELL_EFFECT_SCRIPT_EFFECT);
+ OnEffectApply += AuraEffectApplyFn(spell_gen_clone_weapon_auraScript::OnApply, EFFECT_0, SPELL_AURA_PERIODIC_DUMMY, AURA_EFFECT_HANDLE_REAL_OR_REAPPLY_MASK);
+ OnEffectRemove += AuraEffectRemoveFn(spell_gen_clone_weapon_auraScript::OnRemove, EFFECT_0, SPELL_AURA_PERIODIC_DUMMY, AURA_EFFECT_HANDLE_REAL_OR_REAPPLY_MASK);
}
+
};
- SpellScript* GetSpellScript() const
+ AuraScript* GetAuraScript() const
{
- return new spell_generic_clone_weapon_SpellScript();
+ return new spell_gen_clone_weapon_auraScript();
}
};
@@ -1844,16 +1924,18 @@ class spell_gen_break_shield: public SpellScriptLoader
Unit::AuraApplicationMap const& auras = target->GetAppliedAuras();
for (Unit::AuraApplicationMap::const_iterator itr = auras.begin(); itr != auras.end(); ++itr)
{
- Aura* aura = itr->second->GetBase();
- SpellInfo const* auraInfo = aura->GetSpellInfo();
- if (aura && auraInfo->SpellIconID == 2007 && aura->HasEffectType(SPELL_AURA_MOD_DAMAGE_PERCENT_TAKEN))
+ if (Aura* aura = itr->second->GetBase())
{
- aura->ModStackAmount(-1, AURA_REMOVE_BY_ENEMY_SPELL);
- // Remove dummys from rider (Necessary for updating visual shields)
- if (Unit* rider = target->GetCharmer())
- if (Aura* defend = rider->GetAura(aura->GetId()))
- defend->ModStackAmount(-1, AURA_REMOVE_BY_ENEMY_SPELL);
- break;
+ SpellInfo const* auraInfo = aura->GetSpellInfo();
+ if (auraInfo && auraInfo->SpellIconID == 2007 && aura->HasEffectType(SPELL_AURA_MOD_DAMAGE_PERCENT_TAKEN))
+ {
+ aura->ModStackAmount(-1, AURA_REMOVE_BY_ENEMY_SPELL);
+ // Remove dummys from rider (Necessary for updating visual shields)
+ if (Unit* rider = target->GetCharmer())
+ if (Aura* defend = rider->GetAura(aura->GetId()))
+ defend->ModStackAmount(-1, AURA_REMOVE_BY_ENEMY_SPELL);
+ break;
+ }
}
}
break;
@@ -1972,16 +2054,18 @@ class spell_gen_mounted_charge: public SpellScriptLoader
Unit::AuraApplicationMap const& auras = target->GetAppliedAuras();
for (Unit::AuraApplicationMap::const_iterator itr = auras.begin(); itr != auras.end(); ++itr)
{
- Aura* aura = itr->second->GetBase();
- SpellInfo const* auraInfo = aura->GetSpellInfo();
- if (aura && auraInfo->SpellIconID == 2007 && aura->HasEffectType(SPELL_AURA_MOD_DAMAGE_PERCENT_TAKEN))
+ if (Aura* aura = itr->second->GetBase())
{
- aura->ModStackAmount(-1, AURA_REMOVE_BY_ENEMY_SPELL);
- // Remove dummys from rider (Necessary for updating visual shields)
- if (Unit* rider = target->GetCharmer())
- if (Aura* defend = rider->GetAura(aura->GetId()))
- defend->ModStackAmount(-1, AURA_REMOVE_BY_ENEMY_SPELL);
- break;
+ SpellInfo const* auraInfo = aura->GetSpellInfo();
+ if (auraInfo && auraInfo->SpellIconID == 2007 && aura->HasEffectType(SPELL_AURA_MOD_DAMAGE_PERCENT_TAKEN))
+ {
+ aura->ModStackAmount(-1, AURA_REMOVE_BY_ENEMY_SPELL);
+ // Remove dummys from rider (Necessary for updating visual shields)
+ if (Unit* rider = target->GetCharmer())
+ if (Aura* defend = rider->GetAura(aura->GetId()))
+ defend->ModStackAmount(-1, AURA_REMOVE_BY_ENEMY_SPELL);
+ break;
+ }
}
}
break;
@@ -3076,6 +3160,148 @@ class spell_gen_mount : public SpellScriptLoader
uint32 _mount310;
};
+enum FoamSword
+{
+ ITEM_FOAM_SWORD_GREEN = 45061,
+ ITEM_FOAM_SWORD_PINK = 45176,
+ ITEM_FOAM_SWORD_BLUE = 45177,
+ ITEM_FOAM_SWORD_RED = 45178,
+ ITEM_FOAM_SWORD_YELLOW = 45179,
+
+ SPELL_BONKED = 62991,
+ SPELL_FOAM_SWORD_DEFEAT = 62994,
+ SPELL_ON_GUARD = 62972,
+};
+
+class spell_gen_upper_deck_create_foam_sword : public SpellScriptLoader
+{
+ public:
+ spell_gen_upper_deck_create_foam_sword() : SpellScriptLoader("spell_gen_upper_deck_create_foam_sword") { }
+
+ class spell_gen_upper_deck_create_foam_sword_SpellScript : public SpellScript
+ {
+ PrepareSpellScript(spell_gen_upper_deck_create_foam_sword_SpellScript);
+
+ void HandleScript(SpellEffIndex effIndex)
+ {
+ if (Player* player = GetHitPlayer())
+ {
+ static uint32 const itemId[5] = { ITEM_FOAM_SWORD_GREEN, ITEM_FOAM_SWORD_PINK, ITEM_FOAM_SWORD_BLUE, ITEM_FOAM_SWORD_RED, ITEM_FOAM_SWORD_YELLOW };
+ // player can only have one of these items
+ for (uint8 i = 0; i < 5; ++i)
+ {
+ if (player->HasItemCount(itemId[i], 1, true))
+ return;
+ }
+
+ CreateItem(effIndex, itemId[urand(0, 4)]);
+ }
+ }
+
+ void Register()
+ {
+ OnEffectHitTarget += SpellEffectFn(spell_gen_upper_deck_create_foam_sword_SpellScript::HandleScript, EFFECT_0, SPELL_EFFECT_SCRIPT_EFFECT);
+ }
+ };
+
+ SpellScript* GetSpellScript() const
+ {
+ return new spell_gen_upper_deck_create_foam_sword_SpellScript();
+ }
+};
+
+class spell_gen_bonked : public SpellScriptLoader
+{
+ public:
+ spell_gen_bonked() : SpellScriptLoader("spell_gen_bonked") { }
+
+ class spell_gen_bonked_SpellScript : public SpellScript
+ {
+ PrepareSpellScript(spell_gen_bonked_SpellScript);
+
+ void HandleScript(SpellEffIndex /*effIndex*/)
+ {
+ if (Player* target = GetHitPlayer())
+ {
+ Aura const* aura = GetHitAura();
+ if (!(aura && aura->GetStackAmount() == 3))
+ return;
+
+ target->CastSpell(target, SPELL_FOAM_SWORD_DEFEAT, true);
+ target->RemoveAurasDueToSpell(SPELL_BONKED);
+
+ if (Aura const* aura = target->GetAura(SPELL_ON_GUARD))
+ {
+ if (Item* item = target->GetItemByGuid(aura->GetCastItemGUID()))
+ target->DestroyItemCount(item->GetEntry(), 1, true);
+ }
+ }
+ }
+
+ void Register()
+ {
+ OnEffectHitTarget += SpellEffectFn(spell_gen_bonked_SpellScript::HandleScript, EFFECT_1, SPELL_EFFECT_SCRIPT_EFFECT);
+ }
+ };
+
+ SpellScript* GetSpellScript() const
+ {
+ return new spell_gen_bonked_SpellScript();
+ }
+};
+
+class spell_gen_gift_of_naaru : public SpellScriptLoader
+{
+ public:
+ spell_gen_gift_of_naaru() : SpellScriptLoader("spell_gen_gift_of_naaru") { }
+
+ class spell_gen_gift_of_naaru_AuraScript : public AuraScript
+ {
+ PrepareAuraScript(spell_gen_gift_of_naaru_AuraScript);
+
+ void CalculateAmount(AuraEffect const* aurEff, int32& amount, bool& /*canBeRecalculated*/)
+ {
+ if (!GetCaster())
+ return;
+
+ float heal = 0.0f;
+ switch (GetSpellInfo()->SpellFamilyName)
+ {
+ case SPELLFAMILY_MAGE:
+ case SPELLFAMILY_WARLOCK:
+ case SPELLFAMILY_PRIEST:
+ heal = 1.885f * float(GetCaster()->SpellBaseDamageBonusDone(GetSpellInfo()->GetSchoolMask()));
+ break;
+ case SPELLFAMILY_PALADIN:
+ case SPELLFAMILY_SHAMAN:
+ heal = std::max(1.885f * float(GetCaster()->SpellBaseDamageBonusDone(GetSpellInfo()->GetSchoolMask())), 1.1f * float(GetCaster()->GetTotalAttackPowerValue(BASE_ATTACK)));
+ break;
+ case SPELLFAMILY_WARRIOR:
+ case SPELLFAMILY_HUNTER:
+ case SPELLFAMILY_DEATHKNIGHT:
+ heal = 1.1f * float(std::max(GetCaster()->GetTotalAttackPowerValue(BASE_ATTACK), GetCaster()->GetTotalAttackPowerValue(RANGED_ATTACK)));
+ break;
+ case SPELLFAMILY_GENERIC:
+ default:
+ break;
+ }
+
+ int32 healTick = floor(heal / aurEff->GetTotalTicks());
+ amount += int32(std::max(healTick, 0));
+ }
+
+ void Register()
+ {
+ DoEffectCalcAmount += AuraEffectCalcAmountFn(spell_gen_gift_of_naaru_AuraScript::CalculateAmount, EFFECT_0, SPELL_AURA_PERIODIC_HEAL);
+ }
+ };
+
+ AuraScript* GetAuraScript() const
+ {
+ return new spell_gen_gift_of_naaru_AuraScript();
+ }
+};
+
void AddSC_generic_spell_scripts()
{
new spell_gen_absorb0_hitlimit1();
@@ -3099,6 +3325,7 @@ void AddSC_generic_spell_scripts()
new spell_gen_profession_research();
new spell_generic_clone();
new spell_generic_clone_weapon();
+ new spell_gen_clone_weapon_aura();
new spell_gen_seaforium_blast();
new spell_gen_turkey_marker();
new spell_gen_lifeblood();
@@ -3148,4 +3375,7 @@ void AddSC_generic_spell_scripts()
new spell_gen_mount("spell_blazing_hippogryph", 0, 0, 0, SPELL_BLAZING_HIPPOGRYPH_150, SPELL_BLAZING_HIPPOGRYPH_280);
new spell_gen_mount("spell_celestial_steed", 0, SPELL_CELESTIAL_STEED_60, SPELL_CELESTIAL_STEED_100, SPELL_CELESTIAL_STEED_150, SPELL_CELESTIAL_STEED_280, SPELL_CELESTIAL_STEED_310);
new spell_gen_mount("spell_x53_touring_rocket", 0, 0, 0, SPELL_X53_TOURING_ROCKET_150, SPELL_X53_TOURING_ROCKET_280, SPELL_X53_TOURING_ROCKET_310);
+ new spell_gen_upper_deck_create_foam_sword();
+ new spell_gen_bonked();
+ new spell_gen_gift_of_naaru();
}
diff --git a/src/server/scripts/Spells/spell_item.cpp b/src/server/scripts/Spells/spell_item.cpp
index 3c89cb7005a..0508d95a60b 100644
--- a/src/server/scripts/Spells/spell_item.cpp
+++ b/src/server/scripts/Spells/spell_item.cpp
@@ -836,9 +836,20 @@ class spell_item_book_of_glyph_mastery : public SpellScriptLoader
return SPELL_CAST_OK;
}
+ void HandleScript(SpellEffIndex /*effIndex*/)
+ {
+ Player* caster = GetCaster()->ToPlayer();
+ uint32 spellId = GetSpellInfo()->Id;
+
+ // learn random explicit discovery recipe (if any)
+ if (uint32 discoveredSpellId = GetExplicitDiscoverySpell(spellId, caster))
+ caster->learnSpell(discoveredSpellId, false);
+ }
+
void Register()
{
OnCheckCast += SpellCheckCastFn(spell_item_book_of_glyph_mastery_SpellScript::CheckRequirement);
+ OnEffectHitTarget += SpellEffectFn(spell_item_book_of_glyph_mastery_SpellScript::HandleScript, EFFECT_0, SPELL_EFFECT_SCRIPT_EFFECT);
}
};
diff --git a/src/server/scripts/Spells/spell_paladin.cpp b/src/server/scripts/Spells/spell_paladin.cpp
index 7d248b35853..0bf2e5664a0 100644
--- a/src/server/scripts/Spells/spell_paladin.cpp
+++ b/src/server/scripts/Spells/spell_paladin.cpp
@@ -531,6 +531,41 @@ class spell_pal_righteous_defense : public SpellScriptLoader
}
};
+class spell_pal_exorcism_and_holy_wrath_damage : public SpellScriptLoader
+{
+ public:
+ spell_pal_exorcism_and_holy_wrath_damage() : SpellScriptLoader("spell_pal_exorcism_and_holy_wrath_damage") { }
+
+ class spell_pal_exorcism_and_holy_wrath_damage_AuraScript : public AuraScript
+ {
+ PrepareAuraScript(spell_pal_exorcism_and_holy_wrath_damage_AuraScript);
+
+ void HandleEffectCalcSpellMod(AuraEffect const* aurEff, SpellModifier*& spellMod)
+ {
+ if (!spellMod)
+ {
+ spellMod = new SpellModifier(aurEff->GetBase());
+ spellMod->op = SPELLMOD_DAMAGE;
+ spellMod->type = SPELLMOD_FLAT;
+ spellMod->spellId = GetId();
+ spellMod->mask[1] = 0x200002;
+ }
+
+ spellMod->value = aurEff->GetAmount();
+ }
+
+ void Register()
+ {
+ DoEffectCalcSpellMod += AuraEffectCalcSpellModFn(spell_pal_exorcism_and_holy_wrath_damage_AuraScript::HandleEffectCalcSpellMod, EFFECT_0, SPELL_AURA_DUMMY);
+ }
+ };
+
+ AuraScript* GetAuraScript() const
+ {
+ return new spell_pal_exorcism_and_holy_wrath_damage_AuraScript();
+ }
+};
+
void AddSC_paladin_spell_scripts()
{
new spell_pal_ardent_defender();
@@ -543,4 +578,5 @@ void AddSC_paladin_spell_scripts()
new spell_pal_divine_storm_dummy();
new spell_pal_lay_on_hands();
new spell_pal_righteous_defense();
+ new spell_pal_exorcism_and_holy_wrath_damage();
}
diff --git a/src/server/scripts/Spells/spell_quest.cpp b/src/server/scripts/Spells/spell_quest.cpp
index 5648c510413..06d3602d8e8 100644
--- a/src/server/scripts/Spells/spell_quest.cpp
+++ b/src/server/scripts/Spells/spell_quest.cpp
@@ -25,6 +25,9 @@
#include "ScriptedCreature.h"
#include "SpellScript.h"
#include "Vehicle.h"
+#include "GridNotifiers.h"
+#include "GridNotifiersImpl.h"
+#include "CellImpl.h"
class spell_generic_quest_update_entry_SpellScript : public SpellScript
{
@@ -1245,6 +1248,243 @@ class spell_q12735_song_of_cleansing : public SpellScriptLoader
}
};
+enum DefendingWyrmrestTemple
+{
+ SPELL_SUMMON_WYRMREST_DEFENDER = 49207
+};
+
+class spell_q12372_cast_from_gossip_trigger : public SpellScriptLoader
+{
+ public:
+ spell_q12372_cast_from_gossip_trigger() : SpellScriptLoader("spell_q12372_cast_from_gossip_trigger") { }
+
+ class spell_q12372_cast_from_gossip_trigger_SpellScript : public SpellScript
+ {
+ PrepareSpellScript(spell_q12372_cast_from_gossip_trigger_SpellScript);
+
+ void HandleScript(SpellEffIndex /*effIndex*/)
+ {
+ GetCaster()->CastSpell(GetCaster(), SPELL_SUMMON_WYRMREST_DEFENDER, true);
+ }
+
+ void Register()
+ {
+ OnEffectHitTarget += SpellEffectFn(spell_q12372_cast_from_gossip_trigger_SpellScript::HandleScript, EFFECT_0, SPELL_EFFECT_SCRIPT_EFFECT);
+ }
+ };
+
+ SpellScript* GetSpellScript() const
+ {
+ return new spell_q12372_cast_from_gossip_trigger_SpellScript();
+ }
+};
+
+// http://www.wowhead.com/quest=12372 Defending Wyrmrest Temple
+// 49370 - Wyrmrest Defender: Destabilize Azure Dragonshrine Effect
+enum Quest12372Data
+{
+ NPC_WYRMREST_TEMPLE_CREDIT = 27698,
+};
+
+class spell_q12372_destabilize_azure_dragonshrine_dummy : public SpellScriptLoader
+{
+ public:
+ spell_q12372_destabilize_azure_dragonshrine_dummy() : SpellScriptLoader("spell_q12372_destabilize_azure_dragonshrine_dummy") { }
+
+ class spell_q12372_destabilize_azure_dragonshrine_dummy_SpellScript : public SpellScript
+ {
+ PrepareSpellScript(spell_q12372_destabilize_azure_dragonshrine_dummy_SpellScript);
+
+ void HandleDummy(SpellEffIndex /*effIndex*/)
+ {
+ if (GetHitCreature())
+ if (Unit* caster = GetOriginalCaster())
+ if (Vehicle* vehicle = caster->GetVehicleKit())
+ if (Unit* passenger = vehicle->GetPassenger(0))
+ if (Player* player = passenger->ToPlayer())
+ player->KilledMonsterCredit(NPC_WYRMREST_TEMPLE_CREDIT, 0);
+ }
+
+ void Register()
+ {
+ OnEffectHitTarget += SpellEffectFn(spell_q12372_destabilize_azure_dragonshrine_dummy_SpellScript::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY);
+ }
+ };
+
+ SpellScript* GetSpellScript() const
+ {
+ return new spell_q12372_destabilize_azure_dragonshrine_dummy_SpellScript();
+ }
+};
+
+// "Bombing Run" and "Bomb Them Again!"
+enum Quest11010_11102_11023Data
+{
+ // Spell
+ SPELL_FLAK_CANNON_TRIGGER = 40110,
+ SPELL_CHOOSE_LOC = 40056,
+ SPELL_AGGRO_CHECK = 40112,
+ // NPCs
+ NPC_FEL_CANNON2 = 23082
+};
+
+// 40113 Knockdown Fel Cannon: The Aggro Check Aura
+class spell_q11010_q11102_q11023_aggro_check_aura : public SpellScriptLoader
+{
+ public:
+ spell_q11010_q11102_q11023_aggro_check_aura() : SpellScriptLoader("spell_q11010_q11102_q11023_aggro_check_aura") { }
+
+ class spell_q11010_q11102_q11023_aggro_check_aura_AuraScript : public AuraScript
+ {
+ PrepareAuraScript(spell_q11010_q11102_q11023_aggro_check_aura_AuraScript);
+
+ void HandleTriggerSpell(AuraEffect const* /*aurEff*/)
+ {
+ if (Unit* target = GetTarget())
+ // On trigger proccing
+ target->CastSpell(target, SPELL_AGGRO_CHECK);
+ }
+
+ void Register()
+ {
+ OnEffectPeriodic += AuraEffectPeriodicFn(spell_q11010_q11102_q11023_aggro_check_aura_AuraScript::HandleTriggerSpell, EFFECT_0, SPELL_AURA_PERIODIC_TRIGGER_SPELL);
+ }
+ };
+
+ AuraScript* GetAuraScript() const
+ {
+ return new spell_q11010_q11102_q11023_aggro_check_aura_AuraScript();
+ }
+};
+
+// 40112 Knockdown Fel Cannon: The Aggro Check
+class spell_q11010_q11102_q11023_aggro_check : public SpellScriptLoader
+{
+ public:
+ spell_q11010_q11102_q11023_aggro_check() : SpellScriptLoader("spell_q11010_q11102_q11023_aggro_check") { }
+
+ class spell_q11010_q11102_q11023_aggro_check_SpellScript : public SpellScript
+ {
+ PrepareSpellScript(spell_q11010_q11102_q11023_aggro_check_SpellScript);
+
+ void HandleDummy(SpellEffIndex /*effIndex*/)
+ {
+ if (Player* playerTarget = GetHitPlayer())
+ // Check if found player target is on fly mount or using flying form
+ if (playerTarget->HasAuraType(SPELL_AURA_FLY) || playerTarget->HasAuraType(SPELL_AURA_MOD_INCREASE_MOUNTED_FLIGHT_SPEED))
+ playerTarget->CastSpell(playerTarget, SPELL_FLAK_CANNON_TRIGGER, TRIGGERED_IGNORE_CASTER_MOUNTED_OR_ON_VEHICLE);
+ }
+
+ void Register()
+ {
+ OnEffectHitTarget += SpellEffectFn(spell_q11010_q11102_q11023_aggro_check_SpellScript::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY);
+ }
+ };
+
+ SpellScript* GetSpellScript() const
+ {
+ return new spell_q11010_q11102_q11023_aggro_check_SpellScript();
+ }
+};
+
+// 40119 Knockdown Fel Cannon: The Aggro Burst
+class spell_q11010_q11102_q11023_aggro_burst : public SpellScriptLoader
+{
+ public:
+ spell_q11010_q11102_q11023_aggro_burst() : SpellScriptLoader("spell_q11010_q11102_q11023_aggro_burst") { }
+
+ class spell_q11010_q11102_q11023_aggro_burst_AuraScript : public AuraScript
+ {
+ PrepareAuraScript(spell_q11010_q11102_q11023_aggro_burst_AuraScript);
+
+ void HandleEffectPeriodic(AuraEffect const* /*aurEff*/)
+ {
+ if (Unit* target = GetTarget())
+ // On each tick cast Choose Loc to trigger summon
+ target->CastSpell(target, SPELL_CHOOSE_LOC);
+ }
+
+ void Register()
+ {
+ OnEffectPeriodic += AuraEffectPeriodicFn(spell_q11010_q11102_q11023_aggro_burst_AuraScript::HandleEffectPeriodic, EFFECT_0, SPELL_AURA_PERIODIC_DUMMY);
+ }
+ };
+
+ AuraScript* GetAuraScript() const
+ {
+ return new spell_q11010_q11102_q11023_aggro_burst_AuraScript();
+ }
+};
+
+// 40056 Knockdown Fel Cannon: Choose Loc
+class spell_q11010_q11102_q11023_choose_loc : public SpellScriptLoader
+{
+ public:
+ spell_q11010_q11102_q11023_choose_loc() : SpellScriptLoader("spell_q11010_q11102_q11023_choose_loc") { }
+
+ class spell_q11010_q11102_q11023_choose_loc_SpellScript : public SpellScript
+ {
+ PrepareSpellScript(spell_q11010_q11102_q11023_choose_loc_SpellScript);
+
+ void HandleDummy(SpellEffIndex /*effIndex*/)
+ {
+ Unit* caster = GetCaster();
+ // Check for player that is in 65 y range
+ std::list<Player*> playerList;
+ Trinity::AnyPlayerInObjectRangeCheck checker(caster, 765.0f);
+ Trinity::PlayerListSearcher<Trinity::AnyPlayerInObjectRangeCheck> searcher(caster, playerList, checker);
+ caster->VisitNearbyWorldObject(65.0f, searcher);
+ for (std::list<Player*>::const_iterator itr = playerList.begin(); itr != playerList.end(); ++itr)
+ // Check if found player target is on fly mount or using flying form
+ if ((*itr)->HasAuraType(SPELL_AURA_FLY) || (*itr)->HasAuraType(SPELL_AURA_MOD_INCREASE_MOUNTED_FLIGHT_SPEED))
+ // Summom Fel Cannon (bunny version) at found player
+ caster->SummonCreature(NPC_FEL_CANNON2, (*itr)->GetPositionX(), (*itr)->GetPositionY(), (*itr)->GetPositionZ());
+ }
+
+ void Register()
+ {
+ OnEffectHit += SpellEffectFn(spell_q11010_q11102_q11023_choose_loc_SpellScript::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY);
+ }
+ };
+
+ SpellScript* GetSpellScript() const
+ {
+ return new spell_q11010_q11102_q11023_choose_loc_SpellScript();
+ }
+};
+
+// 39844 - Skyguard Blasting Charge
+// 40160 - Throw Bomb
+class spell_q11010_q11102_q11023_q11008_check_fly_mount : public SpellScriptLoader
+{
+ public:
+ spell_q11010_q11102_q11023_q11008_check_fly_mount() : SpellScriptLoader("spell_q11010_q11102_q11023_q11008_check_fly_mount") { }
+
+ class spell_q11010_q11102_q11023_q11008_check_fly_mount_SpellScript : public SpellScript
+ {
+ PrepareSpellScript(spell_q11010_q11102_q11023_q11008_check_fly_mount_SpellScript);
+
+ SpellCastResult CheckRequirement()
+ {
+ Unit* caster = GetCaster();
+ // This spell will be cast only if caster has one of these auras
+ if (!(caster->HasAuraType(SPELL_AURA_FLY) || caster->HasAuraType(SPELL_AURA_MOD_INCREASE_MOUNTED_FLIGHT_SPEED)))
+ return SPELL_FAILED_CANT_DO_THAT_RIGHT_NOW;
+ return SPELL_CAST_OK;
+ }
+
+ void Register()
+ {
+ OnCheckCast += SpellCheckCastFn(spell_q11010_q11102_q11023_q11008_check_fly_mount_SpellScript::CheckRequirement);
+ }
+ };
+
+ SpellScript* GetSpellScript() const
+ {
+ return new spell_q11010_q11102_q11023_q11008_check_fly_mount_SpellScript();
+ }
+};
+
void AddSC_quest_spell_scripts()
{
new spell_q55_sacred_cleansing();
@@ -1274,4 +1514,11 @@ void AddSC_quest_spell_scripts()
new spell_q12277_wintergarde_mine_explosion();
new spell_q12066_bunny_kill_credit();
new spell_q12735_song_of_cleansing();
+ new spell_q12372_cast_from_gossip_trigger();
+ new spell_q12372_destabilize_azure_dragonshrine_dummy();
+ new spell_q11010_q11102_q11023_aggro_check_aura();
+ new spell_q11010_q11102_q11023_aggro_check();
+ new spell_q11010_q11102_q11023_aggro_burst();
+ new spell_q11010_q11102_q11023_choose_loc();
+ new spell_q11010_q11102_q11023_q11008_check_fly_mount();
}
diff --git a/src/server/scripts/Spells/spell_rogue.cpp b/src/server/scripts/Spells/spell_rogue.cpp
index bb0fd1e73ab..ad437c5e431 100644
--- a/src/server/scripts/Spells/spell_rogue.cpp
+++ b/src/server/scripts/Spells/spell_rogue.cpp
@@ -386,6 +386,34 @@ class spell_rog_deadly_poison : public SpellScriptLoader
}
};
+class spell_rog_shadowstep : public SpellScriptLoader
+{
+ public:
+ spell_rog_shadowstep() : SpellScriptLoader("spell_rog_shadowstep") { }
+
+ class spell_rog_shadowstep_SpellScript : public SpellScript
+ {
+ PrepareSpellScript(spell_rog_shadowstep_SpellScript);
+
+ SpellCastResult CheckCast()
+ {
+ if (GetCaster()->HasUnitState(UNIT_STATE_ROOT))
+ return SPELL_FAILED_ROOTED;
+ return SPELL_CAST_OK;
+ }
+
+ void Register()
+ {
+ OnCheckCast += SpellCheckCastFn(spell_rog_shadowstep_SpellScript::CheckCast);
+ }
+ };
+
+ SpellScript* GetSpellScript() const
+ {
+ return new spell_rog_shadowstep_SpellScript();
+ }
+};
+
void AddSC_rogue_spell_scripts()
{
new spell_rog_cheat_death();
@@ -394,4 +422,5 @@ void AddSC_rogue_spell_scripts()
new spell_rog_prey_on_the_weak();
new spell_rog_shiv();
new spell_rog_deadly_poison();
+ new spell_rog_shadowstep();
}
diff --git a/src/server/scripts/Spells/spell_warlock.cpp b/src/server/scripts/Spells/spell_warlock.cpp
index e0131190916..0def62b7d3a 100644
--- a/src/server/scripts/Spells/spell_warlock.cpp
+++ b/src/server/scripts/Spells/spell_warlock.cpp
@@ -41,6 +41,10 @@ enum WarlockSpells
WARLOCK_HAUNT_HEAL = 48210,
WARLOCK_UNSTABLE_AFFLICTION_DISPEL = 31117,
WARLOCK_CURSE_OF_DOOM_EFFECT = 18662,
+ WARLOCK_IMPROVED_HEALTH_FUNNEL_R1 = 18703,
+ WARLOCK_IMPROVED_HEALTH_FUNNEL_R2 = 18704,
+ WARLOCK_IMPROVED_HEALTH_FUNNEL_BUFF_R1 = 60955,
+ WARLOCK_IMPROVED_HEALTH_FUNNEL_BUFF_R2 = 60956,
};
class spell_warl_banish : public SpellScriptLoader
@@ -671,6 +675,48 @@ class spell_warl_curse_of_doom : public SpellScriptLoader
}
};
+class spell_warl_health_funnel : public SpellScriptLoader
+{
+public:
+ spell_warl_health_funnel() : SpellScriptLoader("spell_warl_health_funnel") { }
+
+ class spell_warl_health_funnel_AuraScript : public AuraScript
+ {
+ PrepareAuraScript(spell_warl_health_funnel_AuraScript);
+
+ void ApplyEffect(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
+ {
+ Unit* caster = GetCaster();
+ if (!caster)
+ return;
+
+ Unit* target = GetTarget();
+ if (caster->HasAura(WARLOCK_IMPROVED_HEALTH_FUNNEL_R2))
+ target->CastSpell(target, WARLOCK_IMPROVED_HEALTH_FUNNEL_BUFF_R2, true);
+ else if (caster->HasAura(WARLOCK_IMPROVED_HEALTH_FUNNEL_R1))
+ target->CastSpell(target, WARLOCK_IMPROVED_HEALTH_FUNNEL_BUFF_R1, true);
+ }
+
+ void RemoveEffect(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
+ {
+ Unit* target = GetTarget();
+ target->RemoveAurasDueToSpell(WARLOCK_IMPROVED_HEALTH_FUNNEL_BUFF_R1);
+ target->RemoveAurasDueToSpell(WARLOCK_IMPROVED_HEALTH_FUNNEL_BUFF_R2);
+ }
+
+ void Register()
+ {
+ OnEffectRemove += AuraEffectRemoveFn(spell_warl_health_funnel_AuraScript::RemoveEffect, EFFECT_0, SPELL_AURA_PERIODIC_HEAL, AURA_EFFECT_HANDLE_REAL);
+ OnEffectApply += AuraEffectApplyFn(spell_warl_health_funnel_AuraScript::ApplyEffect, EFFECT_0, SPELL_AURA_PERIODIC_HEAL, AURA_EFFECT_HANDLE_REAL);
+ }
+ };
+
+ AuraScript* GetAuraScript() const
+ {
+ return new spell_warl_health_funnel_AuraScript();
+ }
+};
+
void AddSC_warlock_spell_scripts()
{
new spell_warl_banish();
@@ -686,4 +732,5 @@ void AddSC_warlock_spell_scripts()
new spell_warl_haunt();
new spell_warl_unstable_affliction();
new spell_warl_curse_of_doom();
+ new spell_warl_health_funnel();
}
diff --git a/src/server/scripts/World/achievement_scripts.cpp b/src/server/scripts/World/achievement_scripts.cpp
index 3dc737f0c95..a6f4f7f64f9 100755
--- a/src/server/scripts/World/achievement_scripts.cpp
+++ b/src/server/scripts/World/achievement_scripts.cpp
@@ -235,30 +235,6 @@ class achievement_bg_av_perfection : public AchievementCriteriaScript
}
};
-class achievement_wg_didnt_stand_a_chance : public AchievementCriteriaScript
-{
-public:
- achievement_wg_didnt_stand_a_chance() : AchievementCriteriaScript("achievement_wg_didnt_stand_a_chance") { }
-
- bool OnCheck(Player* source, Unit* target)
- {
- if (!target)
- return false;
-
- if (Player* victim = target->ToPlayer())
- {
- if (!victim->IsMounted())
- return false;
-
- if (Vehicle* vehicle = source->GetVehicle())
- if (vehicle->GetVehicleInfo()->m_ID == 244) // Wintergrasp Tower Cannon
- return true;
- }
-
- return false;
- }
-};
-
class achievement_bg_sa_defense_of_ancients : public AchievementCriteriaScript
{
public:
@@ -302,6 +278,9 @@ class achievement_tilted : public AchievementCriteriaScript
bool OnCheck(Player* player, Unit* /*target*/)
{
+ if (!player)
+ return false;
+
bool checkArea = player->GetAreaId() == AREA_ARGENT_TOURNAMENT_FIELDS ||
player->GetAreaId() == AREA_RING_OF_ASPIRANTS ||
player->GetAreaId() == AREA_RING_OF_ARGENT_VALIANTS ||
@@ -309,7 +288,7 @@ class achievement_tilted : public AchievementCriteriaScript
player->GetAreaId() == AREA_RING_OF_HORDE_VALIANTS ||
player->GetAreaId() == AREA_RING_OF_CHAMPIONS;
- return player && checkArea && player->duel && player->duel->isMounted;
+ return checkArea && player->duel && player->duel->isMounted;
}
};
@@ -344,7 +323,6 @@ void AddSC_achievement_scripts()
new achievement_bg_ic_mowed_down();
new achievement_bg_sa_artillery();
new achievement_sickly_gazelle();
- new achievement_wg_didnt_stand_a_chance();
new achievement_everything_counts();
new achievement_bg_av_perfection();
new achievement_arena_kills("achievement_arena_2v2_kills", ARENA_TYPE_2v2);
diff --git a/src/server/shared/AutoPtr.h b/src/server/shared/AutoPtr.h
index 19f0680c267..f4199880abd 100644
--- a/src/server/shared/AutoPtr.h
+++ b/src/server/shared/AutoPtr.h
@@ -48,6 +48,6 @@ namespace Trinity
return ACE_Strong_Bound_Ptr<Pointer, Lock>::get() != x;
}
};
-};
+}
-#endif \ No newline at end of file
+#endif
diff --git a/src/server/shared/Containers.h b/src/server/shared/Containers.h
index f0242cbff0e..0a1b6738f1a 100644
--- a/src/server/shared/Containers.h
+++ b/src/server/shared/Containers.h
@@ -63,9 +63,9 @@ namespace Trinity
std::advance(it, urand(0, container.size() - 1));
return *it;
}
- };
+ }
//! namespace Containers
-};
+}
//! namespace Trinity
-#endif //! #ifdef TRINITY_CONTAINERS_H \ No newline at end of file
+#endif //! #ifdef TRINITY_CONTAINERS_H
diff --git a/src/server/shared/Cryptography/BigNumber.cpp b/src/server/shared/Cryptography/BigNumber.cpp
index 364ee76ec75..8e424e9bcdb 100755
--- a/src/server/shared/Cryptography/BigNumber.cpp
+++ b/src/server/shared/Cryptography/BigNumber.cpp
@@ -75,7 +75,7 @@ void BigNumber::SetRand(int numbits)
BN_rand(_bn, numbits, 0, 1);
}
-BigNumber BigNumber::operator=(const BigNumber &bn)
+BigNumber& BigNumber::operator=(const BigNumber &bn)
{
if (this == &bn)
return *this;
@@ -164,7 +164,7 @@ uint32 BigNumber::AsDword()
bool BigNumber::isZero() const
{
- return BN_is_zero(_bn)!=0;
+ return BN_is_zero(_bn);
}
uint8 *BigNumber::AsByteArray(int minSize, bool reverse)
diff --git a/src/server/shared/Cryptography/BigNumber.h b/src/server/shared/Cryptography/BigNumber.h
index 6646245a6a0..a27d74fb5c7 100755
--- a/src/server/shared/Cryptography/BigNumber.h
+++ b/src/server/shared/Cryptography/BigNumber.h
@@ -39,7 +39,7 @@ class BigNumber
void SetRand(int numbits);
- BigNumber operator=(const BigNumber &bn);
+ BigNumber& operator=(const BigNumber &bn);
BigNumber operator+=(const BigNumber &bn);
BigNumber operator+(const BigNumber &bn)
diff --git a/src/server/shared/DataStores/DBCFileLoader.cpp b/src/server/shared/DataStores/DBCFileLoader.cpp
index f909c8566bb..6f78ce5a02d 100755
--- a/src/server/shared/DataStores/DBCFileLoader.cpp
+++ b/src/server/shared/DataStores/DBCFileLoader.cpp
@@ -23,10 +23,8 @@
#include "DBCFileLoader.h"
#include "Errors.h"
-DBCFileLoader::DBCFileLoader()
+DBCFileLoader::DBCFileLoader() : fieldsOffset(NULL), data(NULL), stringTable(NULL)
{
- data = NULL;
- fieldsOffset = NULL;
}
bool DBCFileLoader::Load(const char* filename, const char* fmt)
diff --git a/src/server/shared/DataStores/DBCFileLoader.h b/src/server/shared/DataStores/DBCFileLoader.h
index a43807a3b59..eb8317fbefd 100755
--- a/src/server/shared/DataStores/DBCFileLoader.h
+++ b/src/server/shared/DataStores/DBCFileLoader.h
@@ -32,8 +32,8 @@ enum
FT_BYTE='b', //uint8
FT_SORT='d', //sorted by this field, field is not included
FT_IND='n', //the same, but parsed to data
- FT_LOGIC='l', //Logical (boolean)
- FT_SQL_PRESENT='p', //Used in sql format to mark column present in sql dbc
+ FT_LOGIC='l', //Logical (boolean)
+ FT_SQL_PRESENT='p', //Used in sql format to mark column present in sql dbc
FT_SQL_ABSENT='a' //Used in sql format to mark column absent in sql dbc
};
diff --git a/src/server/shared/Database/AdhocStatement.cpp b/src/server/shared/Database/AdhocStatement.cpp
index 9e795ae853a..95dce77e53c 100755
--- a/src/server/shared/Database/AdhocStatement.cpp
+++ b/src/server/shared/Database/AdhocStatement.cpp
@@ -44,6 +44,7 @@ bool BasicStatementTask::Execute()
ResultSet* result = m_conn->Query(m_sql);
if (!result || !result->GetRowCount())
{
+ delete result;
m_result.set(QueryResult(NULL));
return false;
}
diff --git a/src/server/shared/Database/DatabaseWorkerPool.h b/src/server/shared/Database/DatabaseWorkerPool.h
index d86b99a062a..a0816686734 100755
--- a/src/server/shared/Database/DatabaseWorkerPool.h
+++ b/src/server/shared/Database/DatabaseWorkerPool.h
@@ -64,7 +64,7 @@ class DatabaseWorkerPool
bool res = true;
_connectionInfo = MySQLConnectionInfo(infoString);
- sLog->outWarn(LOG_FILTER_SQL, "Opening DatabasePool '%s'. Asynchronous connections: %u, synchronous connections: %u.",
+ sLog->outInfo(LOG_FILTER_SQL_DRIVER, "Opening DatabasePool '%s'. Asynchronous connections: %u, synchronous connections: %u.",
GetDatabaseName(), async_threads, synch_threads);
//! Open asynchronous connections (delayed operations)
@@ -88,17 +88,17 @@ class DatabaseWorkerPool
}
if (res)
- sLog->outWarn(LOG_FILTER_SQL, "DatabasePool '%s' opened successfully. %u total connections running.", GetDatabaseName(),
+ sLog->outInfo(LOG_FILTER_SQL_DRIVER, "DatabasePool '%s' opened successfully. %u total connections running.", GetDatabaseName(),
(_connectionCount[IDX_SYNCH] + _connectionCount[IDX_ASYNC]));
else
- sLog->outError(LOG_FILTER_SQL, "DatabasePool %s NOT opened. There were errors opening the MySQL connections. Check your SQLDriverLogFile "
+ sLog->outError(LOG_FILTER_SQL_DRIVER, "DatabasePool %s NOT opened. There were errors opening the MySQL connections. Check your SQLDriverLogFile "
"for specific errors.", GetDatabaseName());
return res;
}
void Close()
{
- sLog->outWarn(LOG_FILTER_SQL, "Closing down DatabasePool '%s'.", GetDatabaseName());
+ sLog->outInfo(LOG_FILTER_SQL_DRIVER, "Closing down DatabasePool '%s'.", GetDatabaseName());
//! Shuts down delaythreads for this connection pool by underlying deactivate().
//! The next dequeue attempt in the worker thread tasks will result in an error,
@@ -114,7 +114,7 @@ class DatabaseWorkerPool
t->Close(); //! Closes the actualy MySQL connection.
}
- sLog->outWarn(LOG_FILTER_SQL, "Asynchronous connections on DatabasePool '%s' terminated. Proceeding with synchronous connections.",
+ sLog->outInfo(LOG_FILTER_SQL_DRIVER, "Asynchronous connections on DatabasePool '%s' terminated. Proceeding with synchronous connections.",
GetDatabaseName());
//! Shut down the synchronous connections
@@ -127,7 +127,7 @@ class DatabaseWorkerPool
//! Deletes the ACE_Activation_Queue object and its underlying ACE_Message_Queue
delete _queue;
- sLog->outWarn(LOG_FILTER_SQL, "All connections on DatabasePool '%s' closed.", GetDatabaseName());
+ sLog->outInfo(LOG_FILTER_SQL_DRIVER, "All connections on DatabasePool '%s' closed.", GetDatabaseName());
}
/**
@@ -224,7 +224,10 @@ class DatabaseWorkerPool
ResultSet* result = conn->Query(sql);
conn->Unlock();
if (!result || !result->GetRowCount())
+ {
+ delete result;
return QueryResult(NULL);
+ }
result->NextRow();
return QueryResult(result);
@@ -275,7 +278,10 @@ class DatabaseWorkerPool
delete stmt;
if (!ret || !ret->GetRowCount())
+ {
+ delete ret;
return PreparedQueryResult(NULL);
+ }
return PreparedQueryResult(ret);
}
@@ -351,10 +357,10 @@ class DatabaseWorkerPool
switch (transaction->GetSize())
{
case 0:
- sLog->outWarn(LOG_FILTER_SQL, "Transaction contains 0 queries. Not executing.");
+ sLog->outDebug(LOG_FILTER_SQL_DRIVER, "Transaction contains 0 queries. Not executing.");
return;
case 1:
- sLog->outWarn(LOG_FILTER_SQL, "Warning: Transaction only holds 1 query, consider removing Transaction context in code.");
+ sLog->outDebug(LOG_FILTER_SQL_DRIVER, "Warning: Transaction only holds 1 query, consider removing Transaction context in code.");
break;
default:
break;
@@ -501,7 +507,7 @@ class DatabaseWorkerPool
{
IDX_ASYNC,
IDX_SYNCH,
- IDX_SIZE,
+ IDX_SIZE
};
ACE_Activation_Queue* _queue; //! Queue shared by async worker threads.
diff --git a/src/server/shared/Database/Implementation/CharacterDatabase.h b/src/server/shared/Database/Implementation/CharacterDatabase.h
index e1530f36e44..823ad874de9 100644
--- a/src/server/shared/Database/Implementation/CharacterDatabase.h
+++ b/src/server/shared/Database/Implementation/CharacterDatabase.h
@@ -513,7 +513,7 @@ enum CharacterDatabaseStatements
CHAR_DEL_CHAR_ACTION_EXCEPT_SPEC,
CHAR_SEL_CHAR_PET_BY_ENTRY_AND_SLOT,
- MAX_CHARACTERDATABASE_STATEMENTS,
+ MAX_CHARACTERDATABASE_STATEMENTS
};
#endif
diff --git a/src/server/shared/Database/Implementation/LoginDatabase.cpp b/src/server/shared/Database/Implementation/LoginDatabase.cpp
index 028d927a720..31d9f5ec1f6 100755
--- a/src/server/shared/Database/Implementation/LoginDatabase.cpp
+++ b/src/server/shared/Database/Implementation/LoginDatabase.cpp
@@ -59,7 +59,7 @@ void LoginDatabaseConnection::DoPrepareStatements()
PREPARE_STATEMENT(LOGIN_INS_REALM_CHARACTERS_INIT, "INSERT INTO realmcharacters (realmid, acctid, numchars) SELECT realmlist.id, account.id, 0 FROM realmlist, account LEFT JOIN realmcharacters ON acctid=account.id WHERE acctid IS NULL", CONNECTION_ASYNC);
PREPARE_STATEMENT(LOGIN_UPD_EXPANSION, "UPDATE account SET expansion = ? WHERE id = ?", CONNECTION_ASYNC);
PREPARE_STATEMENT(LOGIN_UPD_ACCOUNT_LOCK, "UPDATE account SET locked = ? WHERE id = ?", CONNECTION_ASYNC);
- PREPARE_STATEMENT(LOGIN_INS_LOG, "INSERT INTO logs (time, realm, type, string) VALUES (UNIX_TIMESTAMP(), ? , ?, ?)", CONNECTION_ASYNC);
+ PREPARE_STATEMENT(LOGIN_INS_LOG, "INSERT INTO logs (time, realm, type, level, string) VALUES (?, ?, ?, ?, ?)", CONNECTION_ASYNC);
PREPARE_STATEMENT(LOGIN_UPD_USERNAME, "UPDATE account SET v = 0, s = 0, username = ?, sha_pass_hash = ? WHERE id = ?", CONNECTION_ASYNC);
PREPARE_STATEMENT(LOGIN_UPD_PASSWORD, "UPDATE account SET v = 0, s = 0, sha_pass_hash = ? WHERE id = ?", CONNECTION_ASYNC);
PREPARE_STATEMENT(LOGIN_UPD_MUTE_TIME, "UPDATE account SET mutetime = ? WHERE id = ?", CONNECTION_ASYNC);
diff --git a/src/server/shared/Database/Implementation/LoginDatabase.h b/src/server/shared/Database/Implementation/LoginDatabase.h
index 7c2a94eec94..b4f6713d118 100755
--- a/src/server/shared/Database/Implementation/LoginDatabase.h
+++ b/src/server/shared/Database/Implementation/LoginDatabase.h
@@ -108,7 +108,7 @@ enum LoginDatabaseStatements
LOGIN_SEL_REALMLIST_SECURITY_LEVEL,
LOGIN_DEL_ACCOUNT,
- MAX_LOGINDATABASE_STATEMENTS,
+ MAX_LOGINDATABASE_STATEMENTS
};
#endif
diff --git a/src/server/shared/Database/Implementation/WorldDatabase.cpp b/src/server/shared/Database/Implementation/WorldDatabase.cpp
index 3b59f283ddb..c491852b1bd 100755
--- a/src/server/shared/Database/Implementation/WorldDatabase.cpp
+++ b/src/server/shared/Database/Implementation/WorldDatabase.cpp
@@ -78,7 +78,7 @@ void WorldDatabaseConnection::DoPrepareStatements()
PREPARE_STATEMENT(WORLD_INS_CREATURE_TRANSPORT, "INSERT INTO creature_transport (guid, npc_entry, transport_entry, TransOffsetX, TransOffsetY, TransOffsetZ, TransOffsetO) values (?, ?, ?, ?, ?, ?, ?)", CONNECTION_ASYNC);
PREPARE_STATEMENT(WORLD_UPD_CREATURE_TRANSPORT_EMOTE, "UPDATE creature_transport SET emote = ? WHERE transport_entry = ? AND guid = ?", CONNECTION_ASYNC);
PREPARE_STATEMENT(WORLD_SEL_COMMANDS, "SELECT name, security, help FROM command", CONNECTION_SYNCH);
- PREPARE_STATEMENT(WORLD_SEL_CREATURE_TEMPLATE, "SELECT difficulty_entry_1, difficulty_entry_2, difficulty_entry_3, KillCredit1, KillCredit2, modelid1, modelid2, modelid3, modelid4, name, subname, IconName, gossip_menu_id, minlevel, maxlevel, exp, faction_A, faction_H, npcflag, speed_walk, speed_run, scale, rank, mindmg, maxdmg, dmgschool, attackpower, dmg_multiplier, baseattacktime, rangeattacktime, unit_class, unit_flags, dynamicflags, family, trainer_type, trainer_spell, trainer_class, trainer_race, minrangedmg, maxrangedmg, rangedattackpower, type, type_flags, lootid, pickpocketloot, skinloot, resistance1, resistance2, resistance3, resistance4, resistance5, resistance6, spell1, spell2, spell3, spell4, spell5, spell6, spell7, spell8, PetSpellDataId, VehicleId, mingold, maxgold, AIName, MovementType, InhabitType, HoverHeight, Health_mod, Mana_mod, Armor_mod, RacialLeader, questItem1, questItem2, questItem3, questItem4, questItem5, questItem6, movementId, RegenHealth, equipment_id, mechanic_immune_mask, flags_extra, ScriptName FROM creature_template WHERE entry = ?", CONNECTION_SYNCH);
+ PREPARE_STATEMENT(WORLD_SEL_CREATURE_TEMPLATE, "SELECT difficulty_entry_1, difficulty_entry_2, difficulty_entry_3, KillCredit1, KillCredit2, modelid1, modelid2, modelid3, modelid4, name, subname, IconName, gossip_menu_id, minlevel, maxlevel, exp, faction_A, faction_H, npcflag, speed_walk, speed_run, scale, rank, mindmg, maxdmg, dmgschool, attackpower, dmg_multiplier, baseattacktime, rangeattacktime, unit_class, unit_flags, unit_flags2, dynamicflags, family, trainer_type, trainer_spell, trainer_class, trainer_race, minrangedmg, maxrangedmg, rangedattackpower, type, type_flags, lootid, pickpocketloot, skinloot, resistance1, resistance2, resistance3, resistance4, resistance5, resistance6, spell1, spell2, spell3, spell4, spell5, spell6, spell7, spell8, PetSpellDataId, VehicleId, mingold, maxgold, AIName, MovementType, InhabitType, HoverHeight, Health_mod, Mana_mod, Armor_mod, RacialLeader, questItem1, questItem2, questItem3, questItem4, questItem5, questItem6, movementId, RegenHealth, equipment_id, mechanic_immune_mask, flags_extra, ScriptName FROM creature_template WHERE entry = ?", CONNECTION_SYNCH);
PREPARE_STATEMENT(WORLD_SEL_WAYPOINT_SCRIPT_BY_ID, "SELECT guid, delay, command, datalong, datalong2, dataint, x, y, z, o FROM waypoint_scripts WHERE id = ?", CONNECTION_SYNCH);
PREPARE_STATEMENT(WORLD_SEL_IP2NATION_COUNTRY, "SELECT c.country FROM ip2nationCountries c, ip2nation i WHERE i.ip < ? AND c.code = i.country ORDER BY i.ip DESC LIMIT 0,1", CONNECTION_SYNCH);
PREPARE_STATEMENT(WORLD_SEL_ITEM_TEMPLATE_BY_NAME, "SELECT entry FROM item_template WHERE name = ?", CONNECTION_SYNCH);
@@ -89,5 +89,6 @@ void WorldDatabaseConnection::DoPrepareStatements()
PREPARE_STATEMENT(WORLD_DEL_GAME_EVENT_MODEL_EQUIP, "DELETE FROM game_event_model_equip WHERE guid = ?", CONNECTION_ASYNC);
PREPARE_STATEMENT(WORLD_INS_GAMEOBJECT, "INSERT INTO gameobject (guid, id, map, spawnMask, phaseMask, position_x, position_y, position_z, orientation, rotation0, rotation1, rotation2, rotation3, spawntimesecs, animprogress, state) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)", CONNECTION_ASYNC);
PREPARE_STATEMENT(WORLD_INS_DISABLES, "INSERT INTO disables (entry, sourceType, flags, comment) VALUES (?, ?, ?, ?)", CONNECTION_ASYNC);
- PREPARE_STATEMENT(WORLD_SEL_DISABLES, "SELECT entry FROM disables WHERE entry = ? AND sourceType = ? AND flags > 0", CONNECTION_SYNCH);
+ PREPARE_STATEMENT(WORLD_SEL_DISABLES, "SELECT entry FROM disables WHERE entry = ? AND sourceType = ?", CONNECTION_SYNCH);
+ PREPARE_STATEMENT(WORLD_DEL_DISABLES, "DELETE FROM disables WHERE entry = ? AND sourceType = ?", CONNECTION_ASYNC);
}
diff --git a/src/server/shared/Database/Implementation/WorldDatabase.h b/src/server/shared/Database/Implementation/WorldDatabase.h
index 10163d33c83..195d2ea8da5 100755
--- a/src/server/shared/Database/Implementation/WorldDatabase.h
+++ b/src/server/shared/Database/Implementation/WorldDatabase.h
@@ -111,8 +111,9 @@ enum WorldDatabaseStatements
WORLD_INS_GAMEOBJECT,
WORLD_SEL_DISABLES,
WORLD_INS_DISABLES,
+ WORLD_DEL_DISABLES,
- MAX_WORLDDATABASE_STATEMENTS,
+ MAX_WORLDDATABASE_STATEMENTS
};
#endif
diff --git a/src/server/shared/Database/MySQLConnection.cpp b/src/server/shared/Database/MySQLConnection.cpp
index 7332cb3ec01..c6d2a165ca2 100755
--- a/src/server/shared/Database/MySQLConnection.cpp
+++ b/src/server/shared/Database/MySQLConnection.cpp
@@ -520,7 +520,11 @@ bool MySQLConnection::_HandleMySQLErrno(uint32 errNo)
ACE_OS::sleep(10);
std::abort();
return false;
-
+ case ER_PARSE_ERROR:
+ sLog->outError(LOG_FILTER_SQL, "Error while parsing SQL. Core fix required.");
+ ACE_OS::sleep(10);
+ std::abort();
+ return false;
default:
sLog->outError(LOG_FILTER_SQL, "Unhandled MySQL errno %u. Unexpected behaviour possible.", errNo);
return false;
diff --git a/src/server/shared/Database/MySQLConnection.h b/src/server/shared/Database/MySQLConnection.h
index c05c4e62c96..c597476967d 100755
--- a/src/server/shared/Database/MySQLConnection.h
+++ b/src/server/shared/Database/MySQLConnection.h
@@ -33,7 +33,7 @@ enum ConnectionFlags
{
CONNECTION_ASYNC = 0x1,
CONNECTION_SYNCH = 0x2,
- CONNECTION_BOTH = CONNECTION_ASYNC | CONNECTION_SYNCH,
+ CONNECTION_BOTH = CONNECTION_ASYNC | CONNECTION_SYNCH
};
struct MySQLConnectionInfo
diff --git a/src/server/shared/Database/PreparedStatement.cpp b/src/server/shared/Database/PreparedStatement.cpp
index a72532e928b..21aef0f1834 100755
--- a/src/server/shared/Database/PreparedStatement.cpp
+++ b/src/server/shared/Database/PreparedStatement.cpp
@@ -440,6 +440,7 @@ bool PreparedStatementTask::Execute()
PreparedResultSet* result = m_conn->Query(m_stmt);
if (!result || !result->GetRowCount())
{
+ delete result;
m_result.set(PreparedQueryResult(NULL));
return false;
}
diff --git a/src/server/shared/Database/QueryHolder.cpp b/src/server/shared/Database/QueryHolder.cpp
index 99772c7e323..ed228c74667 100755
--- a/src/server/shared/Database/QueryHolder.cpp
+++ b/src/server/shared/Database/QueryHolder.cpp
@@ -24,7 +24,7 @@ bool SQLQueryHolder::SetQuery(size_t index, const char *sql)
{
if (m_queries.size() <= index)
{
- sLog->outError(LOG_FILTER_SQL, "Query index (%zu) out of range (size: %u) for query: %s", index, (uint32)m_queries.size(), sql);
+ sLog->outError(LOG_FILTER_SQL, "Query index (%u) out of range (size: %u) for query: %s", uint32(index), (uint32)m_queries.size(), sql);
return false;
}
@@ -44,7 +44,7 @@ bool SQLQueryHolder::SetPQuery(size_t index, const char *format, ...)
{
if (!format)
{
- sLog->outError(LOG_FILTER_SQL, "Query (index: %zu) is empty.", index);
+ sLog->outError(LOG_FILTER_SQL, "Query (index: %u) is empty.", uint32(index));
return false;
}
@@ -67,7 +67,7 @@ bool SQLQueryHolder::SetPreparedQuery(size_t index, PreparedStatement* stmt)
{
if (m_queries.size() <= index)
{
- sLog->outError(LOG_FILTER_SQL, "Query index (%zu) out of range (size: %u) for prepared statement", index, (uint32)m_queries.size());
+ sLog->outError(LOG_FILTER_SQL, "Query index (%u) out of range (size: %u) for prepared statement", uint32(index), (uint32)m_queries.size());
return false;
}
@@ -116,6 +116,12 @@ PreparedQueryResult SQLQueryHolder::GetPreparedResult(size_t index)
void SQLQueryHolder::SetResult(size_t index, ResultSet* result)
{
+ if (result && !result->GetRowCount())
+ {
+ delete result;
+ result = NULL;
+ }
+
/// store the result in the holder
if (index < m_queries.size())
m_queries[index].second.qresult = result;
@@ -123,6 +129,12 @@ void SQLQueryHolder::SetResult(size_t index, ResultSet* result)
void SQLQueryHolder::SetPreparedResult(size_t index, PreparedResultSet* result)
{
+ if (result && !result->GetRowCount())
+ {
+ delete result;
+ result = NULL;
+ }
+
/// store the result in the holder
if (index < m_queries.size())
m_queries[index].second.presult = result;
diff --git a/src/server/shared/Database/SQLOperation.h b/src/server/shared/Database/SQLOperation.h
index b911c1c92aa..401535e39f7 100755
--- a/src/server/shared/Database/SQLOperation.h
+++ b/src/server/shared/Database/SQLOperation.h
@@ -37,7 +37,7 @@ union SQLElementUnion
enum SQLElementDataType
{
SQL_ELEMENT_RAW,
- SQL_ELEMENT_PREPARED,
+ SQL_ELEMENT_PREPARED
};
//- The element
diff --git a/src/server/shared/Debugging/WheatyExceptionReport.cpp b/src/server/shared/Debugging/WheatyExceptionReport.cpp
index febc5ef3573..96a115f8057 100644
--- a/src/server/shared/Debugging/WheatyExceptionReport.cpp
+++ b/src/server/shared/Debugging/WheatyExceptionReport.cpp
@@ -409,11 +409,12 @@ void WheatyExceptionReport::printTracesForAllThreads()
CONTEXT context;
context.ContextFlags = 0xffffffff;
HANDLE threadHandle = OpenThread(THREAD_GET_CONTEXT | THREAD_QUERY_INFORMATION, false, te32.th32ThreadID);
- if (threadHandle && GetThreadContext(threadHandle, &context))
+ if (threadHandle)
{
- WriteStackDetails(&context, false, threadHandle);
+ if (GetThreadContext(threadHandle, &context))
+ WriteStackDetails(&context, false, threadHandle);
+ CloseHandle(threadHandle);
}
- CloseHandle(threadHandle);
}
} while (Thread32Next(hThreadSnap, &te32));
@@ -521,7 +522,7 @@ PEXCEPTION_POINTERS pExceptionInfo)
_tprintf(_T("Global Variables\r\n"));
SymEnumSymbols(GetCurrentProcess(),
- (DWORD64)GetModuleHandle(szFaultingModule),
+ (UINT_PTR)GetModuleHandle(szFaultingModule),
0, EnumerateSymbolsCallback, 0);
// #endif // X86 Only!
@@ -989,7 +990,7 @@ PVOID pAddress)
if (!IsBadStringPtr(*(PSTR*)pAddress, 32))
{
pszCurrBuffer += sprintf(pszCurrBuffer, " = \"%.31s\"",
- *(PDWORD)pAddress);
+ *(PSTR*)pAddress);
}
else
pszCurrBuffer += sprintf(pszCurrBuffer, " = %X",
diff --git a/src/server/shared/Dynamic/TypeContainerFunctions.h b/src/server/shared/Dynamic/TypeContainerFunctions.h
index 19ebfb3adfc..5011ec1c1be 100755
--- a/src/server/shared/Dynamic/TypeContainerFunctions.h
+++ b/src/server/shared/Dynamic/TypeContainerFunctions.h
@@ -36,7 +36,7 @@ namespace Trinity
template<class SPECIFIC_TYPE> size_t Count(const ContainerMapList<SPECIFIC_TYPE> &elements, SPECIFIC_TYPE* /*fake*/)
{
return elements._element.getSize();
- };
+ }
template<class SPECIFIC_TYPE> size_t Count(const ContainerMapList<TypeNull> &/*elements*/, SPECIFIC_TYPE* /*fake*/)
{
@@ -64,7 +64,7 @@ namespace Trinity
//elements._element[hdl] = obj;
obj->AddToGrid(elements._element);
return obj;
- };
+ }
template<class SPECIFIC_TYPE> SPECIFIC_TYPE* Insert(ContainerMapList<TypeNull> &/*elements*/, SPECIFIC_TYPE * /*obj*/)
{
diff --git a/src/server/shared/Dynamic/TypeContainerVisitor.h b/src/server/shared/Dynamic/TypeContainerVisitor.h
index beddb31f343..155989f15f6 100755
--- a/src/server/shared/Dynamic/TypeContainerVisitor.h
+++ b/src/server/shared/Dynamic/TypeContainerVisitor.h
@@ -35,7 +35,7 @@ template<class T, class Y> class TypeContainerVisitor;
template<class VISITOR, class TYPE_CONTAINER> void VisitorHelper(VISITOR &v, TYPE_CONTAINER &c)
{
v.Visit(c);
-};
+}
// terminate condition for container list
template<class VISITOR> void VisitorHelper(VISITOR &v, ContainerList<TypeNull> &c)
diff --git a/src/server/shared/Logging/Appender.cpp b/src/server/shared/Logging/Appender.cpp
index 0b92e74c1e9..348ec4b3c7c 100644
--- a/src/server/shared/Logging/Appender.cpp
+++ b/src/server/shared/Logging/Appender.cpp
@@ -31,8 +31,8 @@ std::string LogMessage::getTimeStr()
return getTimeStr(mtime);
}
-Appender::Appender(uint8 _id, std::string const& _name, AppenderType _type /* = APPENDER_NONE*/, LogLevel _level /* = LOG_LEVEL_DISABLED */):
-id(_id), name(_name), type(_type), level(_level)
+Appender::Appender(uint8 _id, std::string const& _name, AppenderType _type /* = APPENDER_NONE*/, LogLevel _level /* = LOG_LEVEL_DISABLED */, AppenderFlags _flags /* = APPENDER_FLAGS_NONE */):
+id(_id), name(_name), type(_type), level(_level), flags(_flags)
{
}
@@ -60,6 +60,11 @@ LogLevel Appender::getLogLevel() const
return level;
}
+AppenderFlags Appender::getFlags() const
+{
+ return flags;
+}
+
void Appender::setLogLevel(LogLevel _level)
{
level = _level;
@@ -67,9 +72,40 @@ void Appender::setLogLevel(LogLevel _level)
void Appender::write(LogMessage& message)
{
- if (level && level <= message.level)
- _write(message);
- //else fprintf(stderr, "Appender::write: Appender %s, Level %s. Msg %s Level %s Type %s WRONG LEVEL MASK\n", getName().c_str(), getLogLevelString(level), message.text.c_str(), getLogLevelString(message.level), getLogFilterTypeString(message.type)); // DEBUG - RemoveMe
+ if (!level || level > message.level)
+ {
+ //fprintf(stderr, "Appender::write: Appender %s, Level %s. Msg %s Level %s Type %s WRONG LEVEL MASK\n", getName().c_str(), getLogLevelString(level), message.text.c_str(), getLogLevelString(message.level), getLogFilterTypeString(message.type)); // DEBUG - RemoveMe
+ return;
+ }
+
+ message.prefix.clear();
+ if (flags & APPENDER_FLAGS_PREFIX_TIMESTAMP)
+ message.prefix.append(message.getTimeStr().c_str());
+
+ if (flags & APPENDER_FLAGS_PREFIX_LOGLEVEL)
+ {
+ if (!message.prefix.empty())
+ message.prefix.push_back(' ');
+
+ char text[MAX_QUERY_LEN];
+ snprintf(text, MAX_QUERY_LEN, "%-5s", Appender::getLogLevelString(message.level));
+ message.prefix.append(text);
+ }
+
+ if (flags & APPENDER_FLAGS_PREFIX_LOGFILTERTYPE)
+ {
+ if (!message.prefix.empty())
+ message.prefix.push_back(' ');
+
+ char text[MAX_QUERY_LEN];
+ snprintf(text, MAX_QUERY_LEN, "[%s]", Appender::getLogFilterTypeString(message.type));
+ message.prefix.append(text);
+ }
+
+ if (!message.prefix.empty())
+ message.prefix.push_back(' ');
+
+ _write(message);
}
const char* Appender::getLogLevelString(LogLevel level)
@@ -136,13 +172,13 @@ char const* Appender::getLogFilterTypeString(LogFilterType type)
case LOG_FILTER_PLAYER:
return "PLAYER";
case LOG_FILTER_PLAYER_LOADING:
- return "PLAYER_LOADING";
+ return "PLAYER LOADING";
case LOG_FILTER_PLAYER_ITEMS:
- return "PLAYER_ITEMS";
+ return "PLAYER ITEMS";
case LOG_FILTER_PLAYER_SKILLS:
- return "PLAYER_SKILLS";
+ return "PLAYER SKILLS";
case LOG_FILTER_PLAYER_CHATLOG:
- return "PLAYER_CHATLOG";
+ return "PLAYER CHATLOG";
case LOG_FILTER_LOOT:
return "LOOT";
case LOG_FILTER_GUILD:
@@ -163,6 +199,24 @@ char const* Appender::getLogFilterTypeString(LogFilterType type)
return "WORLDSERVER";
case LOG_FILTER_GAMEEVENTS:
return "GAMEEVENTS";
+ case LOG_FILTER_CALENDAR:
+ return "CALENDAR";
+ case LOG_FILTER_CHARACTER:
+ return "CHARACTER";
+ case LOG_FILTER_ARENAS:
+ return "ARENAS";
+ case LOG_FILTER_SQL_DRIVER:
+ return "SQL DRIVER";
+ case LOG_FILTER_SQL_DEV:
+ return "SQL DEV";
+ case LOG_FILTER_PLAYER_DUMP:
+ return "PLAYER DUMP";
+ case LOG_FILTER_BATTLEFIELD:
+ return "BATTLEFIELD";
+ case LOG_FILTER_SERVER_LOADING:
+ return "SERVER LOADING";
+ case LOG_FILTER_OPCODES:
+ return "OPCODE";
default:
break;
}
diff --git a/src/server/shared/Logging/Appender.h b/src/server/shared/Logging/Appender.h
index 3105f0e6bb4..5c4b009ef67 100644
--- a/src/server/shared/Logging/Appender.h
+++ b/src/server/shared/Logging/Appender.h
@@ -58,10 +58,18 @@ enum LogFilterType
LOG_FILTER_AUTHSERVER,
LOG_FILTER_WORLDSERVER,
LOG_FILTER_GAMEEVENTS,
- LOG_FILTER_CALENDAR
+ LOG_FILTER_CALENDAR,
+ LOG_FILTER_CHARACTER,
+ LOG_FILTER_ARENAS,
+ LOG_FILTER_SQL_DRIVER,
+ LOG_FILTER_SQL_DEV,
+ LOG_FILTER_PLAYER_DUMP,
+ LOG_FILTER_BATTLEFIELD,
+ LOG_FILTER_SERVER_LOADING,
+ LOG_FILTER_OPCODES
};
-const uint8 MaxLogFilter = uint8(LOG_FILTER_CALENDAR) + 1;
+const uint8 MaxLogFilter = uint8(LOG_FILTER_OPCODES) + 1;
// Values assigned have their equivalent in enum ACE_Log_Priority
enum LogLevel
@@ -72,7 +80,7 @@ enum LogLevel
LOG_LEVEL_INFO = 3,
LOG_LEVEL_WARN = 4,
LOG_LEVEL_ERROR = 5,
- LOG_LEVEL_FATAL = 6,
+ LOG_LEVEL_FATAL = 6
};
const uint8 MaxLogLevels = 6;
@@ -82,12 +90,25 @@ enum AppenderType
APPENDER_NONE,
APPENDER_CONSOLE,
APPENDER_FILE,
- APPENDER_DB,
+ APPENDER_DB
+};
+
+enum AppenderFlags
+{
+ APPENDER_FLAGS_NONE = 0x00,
+ APPENDER_FLAGS_PREFIX_TIMESTAMP = 0x01,
+ APPENDER_FLAGS_PREFIX_LOGLEVEL = 0x02,
+ APPENDER_FLAGS_PREFIX_LOGFILTERTYPE = 0x04,
+ APPENDER_FLAGS_USE_TIMESTAMP = 0x08, // only used by FileAppender
+ APPENDER_FLAGS_MAKE_FILE_BACKUP = 0x10 // only used by FileAppender
};
struct LogMessage
{
- LogMessage(LogLevel _level, LogFilterType _type, std::string _text): level(_level), type(_type), text(_text)
+ LogMessage(LogLevel _level, LogFilterType _type, std::string _text)
+ : level(_level)
+ , type(_type)
+ , text(_text)
{
mtime = time(NULL);
}
@@ -98,20 +119,22 @@ struct LogMessage
LogLevel level;
LogFilterType type;
std::string text;
- uint32 param1;
+ std::string prefix;
+ std::string param1;
time_t mtime;
};
class Appender
{
public:
- Appender(uint8 _id, std::string const& name, AppenderType type = APPENDER_NONE, LogLevel level = LOG_LEVEL_DISABLED);
+ Appender(uint8 _id, std::string const& name, AppenderType type = APPENDER_NONE, LogLevel level = LOG_LEVEL_DISABLED, AppenderFlags flags = APPENDER_FLAGS_NONE);
virtual ~Appender();
uint8 getId() const;
std::string const& getName() const;
AppenderType getType() const;
LogLevel getLogLevel() const;
+ AppenderFlags getFlags() const;
void setLogLevel(LogLevel);
void write(LogMessage& message);
@@ -119,12 +142,13 @@ class Appender
static const char* getLogFilterTypeString(LogFilterType type);
private:
- virtual void _write(LogMessage& /*message*/) {};
+ virtual void _write(LogMessage& /*message*/) = 0;
uint8 id;
std::string name;
AppenderType type;
LogLevel level;
+ AppenderFlags flags;
};
typedef std::map<uint8, Appender*> AppenderMap;
diff --git a/src/server/shared/Logging/AppenderConsole.cpp b/src/server/shared/Logging/AppenderConsole.cpp
index 30c7cc4d135..be6dc6c807f 100644
--- a/src/server/shared/Logging/AppenderConsole.cpp
+++ b/src/server/shared/Logging/AppenderConsole.cpp
@@ -21,9 +21,11 @@
#include <sstream>
-AppenderConsole::AppenderConsole(uint8 id, std::string const& name, LogLevel level):
-Appender(id, name, APPENDER_CONSOLE, level), _colored(false), _colors()
+AppenderConsole::AppenderConsole(uint8 id, std::string const& name, LogLevel level, AppenderFlags flags):
+Appender(id, name, APPENDER_CONSOLE, level, flags), _colored(false)
{
+ for (uint8 i = 0; i < MaxLogLevels; ++i)
+ _colors[i] = ColorTypes(MaxColors);
}
void AppenderConsole::InitColors(std::string const& str)
@@ -57,7 +59,7 @@ void AppenderConsole::InitColors(std::string const& str)
void AppenderConsole::SetColor(bool stdout_stream, ColorTypes color)
{
- #if PLATFORM == PLATFORWINDOWS
+ #if PLATFORM == PLATFORM_WINDOWS
static WORD WinColorFG[MaxColors] =
{
0, // BLACK
@@ -144,7 +146,7 @@ void AppenderConsole::SetColor(bool stdout_stream, ColorTypes color)
void AppenderConsole::ResetColor(bool stdout_stream)
{
- #if PLATFORM == PLATFORWINDOWS
+ #if PLATFORM == PLATFORM_WINDOWS
HANDLE hConsole = GetStdHandle(stdout_stream ? STD_OUTPUT_HANDLE : STD_ERROR_HANDLE);
SetConsoleTextAttribute(hConsole, FOREGROUND_BLUE | FOREGROUND_GREEN | FOREGROUND_RED);
#else
@@ -183,9 +185,9 @@ void AppenderConsole::_write(LogMessage& message)
}
SetColor(stdout_stream, _colors[index]);
- utf8printf(stdout_stream ? stdout : stderr, "%s %-5s [%-15s] %s", message.getTimeStr().c_str(), Appender::getLogLevelString(message.level), Appender::getLogFilterTypeString(message.type), message.text.c_str());
+ utf8printf(stdout_stream ? stdout : stderr, "%s%s", message.prefix.c_str(), message.text.c_str());
ResetColor(stdout_stream);
}
else
- utf8printf(stdout_stream ? stdout : stderr, "%s %-5s [%-15s] %s", message.getTimeStr().c_str(), Appender::getLogLevelString(message.level), Appender::getLogFilterTypeString(message.type), message.text.c_str());
+ utf8printf(stdout_stream ? stdout : stderr, "%s%s", message.prefix.c_str(), message.text.c_str());
}
diff --git a/src/server/shared/Logging/AppenderConsole.h b/src/server/shared/Logging/AppenderConsole.h
index b81fe6dde57..ad7d9543cdb 100644
--- a/src/server/shared/Logging/AppenderConsole.h
+++ b/src/server/shared/Logging/AppenderConsole.h
@@ -45,7 +45,7 @@ const uint8 MaxColors = uint8(WHITE) + 1;
class AppenderConsole: public Appender
{
public:
- AppenderConsole(uint8 _id, std::string const& name, LogLevel level);
+ AppenderConsole(uint8 _id, std::string const& name, LogLevel level, AppenderFlags flags);
void InitColors(const std::string& init_str);
private:
diff --git a/src/server/shared/Logging/AppenderDB.cpp b/src/server/shared/Logging/AppenderDB.cpp
index 63af9176193..d85a4db9f7a 100644
--- a/src/server/shared/Logging/AppenderDB.cpp
+++ b/src/server/shared/Logging/AppenderDB.cpp
@@ -16,12 +16,7 @@
*/
#include "AppenderDB.h"
-
-/* FIXME
-#include "DatabaseWorkerPool.h"
-#include "Implementation/LoginDatabase.h" // For logging
-extern DatabaseWorkerPool LoginDatabase;
-*/
+#include "Database/DatabaseEnv.h"
AppenderDB::AppenderDB(uint8 id, std::string const& name, LogLevel level, uint8 realmId):
Appender(id, name, APPENDER_DB, level), realm(realmId), enable(false)
@@ -32,13 +27,26 @@ AppenderDB::~AppenderDB()
{
}
-void AppenderDB::_write(LogMessage& /*message*/)
+void AppenderDB::_write(LogMessage& message)
{
-/* FIXME
- if (enable)
- LoginDatabase.PExecute("INSERT INTO logs (time, realm, type, severity, string) "
- "VALUES (" UI64FMTD ", %u, %u, '%s');", message.mtime, realm, message.type, message.level, message.text.c_str());
-*/
+ if (!enable)
+ return;
+ switch (message.type)
+ {
+ case LOG_FILTER_SQL:
+ case LOG_FILTER_SQL_DRIVER:
+ case LOG_FILTER_SQL_DEV:
+ break; // Avoid infinite loop, PExecute triggers Logging with LOG_FILTER_SQL type
+ default:
+ PreparedStatement* stmt = LoginDatabase.GetPreparedStatement(LOGIN_INS_LOG);
+ stmt->setUInt64(0, message.mtime);
+ stmt->setUInt32(1, realm);
+ stmt->setUInt8(2, message.type);
+ stmt->setUInt8(3, message.level);
+ stmt->setString(4, message.text);
+ LoginDatabase.Execute(stmt);
+ break;
+ }
}
void AppenderDB::setEnable(bool _enable)
diff --git a/src/server/shared/Logging/AppenderFile.cpp b/src/server/shared/Logging/AppenderFile.cpp
index cb875240c46..67adff39aae 100644
--- a/src/server/shared/Logging/AppenderFile.cpp
+++ b/src/server/shared/Logging/AppenderFile.cpp
@@ -18,16 +18,16 @@
#include "AppenderFile.h"
#include "Common.h"
-AppenderFile::AppenderFile(uint8 id, std::string const& name, LogLevel level, const char* _filename, const char* _logDir, const char* _mode, bool _backup)
- : Appender(id, name, APPENDER_FILE, level)
+AppenderFile::AppenderFile(uint8 id, std::string const& name, LogLevel level, const char* _filename, const char* _logDir, const char* _mode, AppenderFlags _flags)
+ : Appender(id, name, APPENDER_FILE, level, _flags)
, filename(_filename)
, logDir(_logDir)
, mode(_mode)
- , backup(_backup)
{
- dynamicName = std::string::npos != filename.find("%u");
- if (!dynamicName)
- logfile = OpenFile(_filename, _mode, _backup);
+ dynamicName = std::string::npos != filename.find("%s");
+ backup = _flags & APPENDER_FLAGS_MAKE_FILE_BACKUP;
+
+ logfile = !dynamicName ? OpenFile(_filename, _mode, backup) : NULL;
}
AppenderFile::~AppenderFile()
@@ -44,18 +44,20 @@ void AppenderFile::_write(LogMessage& message)
if (dynamicName)
{
char namebuf[TRINITY_PATH_MAX];
- snprintf(namebuf, TRINITY_PATH_MAX, filename.c_str(), message.param1);
+ snprintf(namebuf, TRINITY_PATH_MAX, filename.c_str(), message.param1.c_str());
logfile = OpenFile(namebuf, mode, backup);
}
if (logfile)
{
- fprintf(logfile, "%s %-5s [%-15s] %s", message.getTimeStr().c_str(), Appender::getLogLevelString(message.level), Appender::getLogFilterTypeString(message.type), message.text.c_str());
-
+ fprintf(logfile, "%s%s", message.prefix.c_str(), message.text.c_str());
fflush(logfile);
if (dynamicName)
+ {
fclose(logfile);
+ logfile = NULL;
+ }
}
}
diff --git a/src/server/shared/Logging/AppenderFile.h b/src/server/shared/Logging/AppenderFile.h
index 8d8b0c43a54..e9cb858f625 100644
--- a/src/server/shared/Logging/AppenderFile.h
+++ b/src/server/shared/Logging/AppenderFile.h
@@ -23,7 +23,7 @@
class AppenderFile: public Appender
{
public:
- AppenderFile(uint8 _id, std::string const& _name, LogLevel level, const char* filename, const char* logDir, const char* mode, bool backup);
+ AppenderFile(uint8 _id, std::string const& _name, LogLevel level, const char* filename, const char* logDir, const char* mode, AppenderFlags flags);
~AppenderFile();
FILE* OpenFile(std::string const& _name, std::string const& _mode, bool _backup);
diff --git a/src/server/shared/Logging/Log.cpp b/src/server/shared/Logging/Log.cpp
index 2ced38847be..ed65104d6ac 100755
--- a/src/server/shared/Logging/Log.cpp
+++ b/src/server/shared/Logging/Log.cpp
@@ -19,7 +19,7 @@
#include "Log.h"
#include "Common.h"
#include "Config.h"
-
+#include "Util.h"
#include "AppenderConsole.h"
#include "AppenderFile.h"
#include "AppenderDB.h"
@@ -29,21 +29,11 @@
#include <cstdio>
#include <sstream>
-Log::Log()
+Log::Log() : worker(NULL)
{
SetRealmID(0);
- AppenderId = 0;
- /// Common log files data
- m_logsDir = ConfigMgr::GetStringDefault("LogsDir", "");
- if (!m_logsDir.empty())
- if ((m_logsDir.at(m_logsDir.length() - 1) != '/') && (m_logsDir.at(m_logsDir.length() - 1) != '\\'))
- m_logsDir.push_back('/');
-
m_logsTimestamp = "_" + GetTimestampStr();
-
- ReadAppendersFromConfig();
- ReadLoggersFromConfig();
- worker = new LogWorker();
+ LoadFromConfig();
}
Log::~Log()
@@ -92,32 +82,62 @@ void Log::CreateAppenderFromConfig(const char* name)
if (!name || *name == '\0')
return;
- std::string base = "Appender.";
- base.append(name);
- base.push_back('.');
+ // Format=type,level,flags,optional1,optional2
+ // if type = File. optional1 = file and option2 = mode
+ // if type = Console. optional1 = Color
+ std::string options = "Appender.";
+ options.append(name);
+ options = ConfigMgr::GetStringDefault(options.c_str(), "");
+ Tokens tokens(options, ',');
+ Tokens::iterator iter = tokens.begin();
- LogLevel level = LogLevel(GetConfigIntDefault(base, "Level", 0));
- AppenderType type = AppenderType(GetConfigIntDefault(base, "Type", 0));
+ if (tokens.size() < 2)
+ {
+ fprintf(stderr, "Log::CreateAppenderFromConfig: Wrong configuration for appender %s. Config line: %s\n", name, options.c_str());
+ return;
+ }
- switch(type)
+ AppenderFlags flags = APPENDER_FLAGS_NONE;
+ AppenderType type = AppenderType(atoi(*iter));
+ ++iter;
+ LogLevel level = LogLevel(atoi(*iter));
+ if (level > LOG_LEVEL_FATAL)
+ {
+ fprintf(stderr, "Log::CreateAppenderFromConfig: Wrong Log Level %d for appender %s\n", level, name);
+ return;
+ }
+
+ if (++iter != tokens.end())
+ flags = AppenderFlags(atoi(*iter));
+
+ switch (type)
{
case APPENDER_CONSOLE:
{
- AppenderConsole* appender = new AppenderConsole(NextAppenderId(), name, level);
+ AppenderConsole* appender = new AppenderConsole(NextAppenderId(), name, level, flags);
appenders[appender->getId()] = appender;
-
- appender->InitColors(GetConfigStringDefault(base, "Colors", ""));
+ if (++iter != tokens.end())
+ appender->InitColors(*iter);
//fprintf(stdout, "Log::CreateAppenderFromConfig: Created Appender %s (%u), Type CONSOLE, Mask %u\n", appender->getName().c_str(), appender->getId(), appender->getLogLevel()); // DEBUG - RemoveMe
break;
}
case APPENDER_FILE:
{
- std::string filename = GetConfigStringDefault(base, "File", "");
- std::string mode = GetConfigStringDefault(base, "Mode", "a");
- std::string timestamp = GetConfigStringDefault(base, "Timestamp", "");
- bool backup = GetConfigIntDefault(base, "Backup", 0);
+ std::string filename;
+ std::string mode = "a";
- if (!timestamp.empty())
+ if (++iter == tokens.end())
+ {
+ fprintf(stderr, "Log::CreateAppenderFromConfig: Missing file name for appender %s\n", name);
+ return;
+ }
+
+ filename = *iter;
+
+ if (++iter != tokens.end())
+ mode = *iter;
+
+ if (flags & APPENDER_FLAGS_USE_TIMESTAMP)
{
size_t dot_pos = filename.find_last_of(".");
if (dot_pos != filename.npos)
@@ -127,17 +147,18 @@ void Log::CreateAppenderFromConfig(const char* name)
}
uint8 id = NextAppenderId();
- appenders[id] = new AppenderFile(id, name, level, filename.c_str(), m_logsDir.c_str(), mode.c_str(), backup);
+ appenders[id] = new AppenderFile(id, name, level, filename.c_str(), m_logsDir.c_str(), mode.c_str(), flags);
//fprintf(stdout, "Log::CreateAppenderFromConfig: Created Appender %s (%u), Type FILE, Mask %u, File %s, Mode %s\n", name, id, level, filename.c_str(), mode.c_str()); // DEBUG - RemoveMe
break;
}
- case APPENDER_DB: // TODO Set realm!
+ case APPENDER_DB:
{
uint8 id = NextAppenderId();
appenders[id] = new AppenderDB(id, name, level, realm);
break;
}
default:
+ fprintf(stderr, "Log::CreateAppenderFromConfig: Unknown type %d for appender %s\n", type, name);
break;
}
}
@@ -147,29 +168,55 @@ void Log::CreateLoggerFromConfig(const char* name)
if (!name || *name == '\0')
return;
- std::string base = "Logger.";
- base.append(name);
- base.push_back('.');
+ LogLevel level = LOG_LEVEL_DISABLED;
+ int32 type = -1;
- LogLevel level = LogLevel(GetConfigIntDefault(base, "Level", 0));
- int32 type = GetConfigIntDefault(base, "Type", -1);
+ std::string options = "Logger.";
+ options.append(name);
+ options = ConfigMgr::GetStringDefault(options.c_str(), "");
- if (type < 0)
+ if (options.empty())
{
- fprintf(stderr, "Log::CreateLoggerFromConfig: Missing entry %sType in config. Logger ignored\n", name);
+ fprintf(stderr, "Log::CreateLoggerFromConfig: Missing config option Logger.%s\n", name);
return;
}
- Logger& logger = loggers[type];
+ Tokens tokens(options, ',');
+ Tokens::iterator iter = tokens.begin();
+ if (tokens.size() != 3)
+ {
+ fprintf(stderr, "Log::CreateLoggerFromConfig: Wrong config option Logger.%s=%s\n", name, options.c_str());
+ return;
+ }
+
+ type = atoi(*iter);
+ if (type > MaxLogFilter)
+ {
+ fprintf(stderr, "Log::CreateLoggerFromConfig: Wrong type %u for logger %s\n", type, name);
+ return;
+ }
+
+ Logger& logger = loggers[type];
if (!logger.getName().empty())
- fprintf(stderr, "Error while configuring Logger %s. Replacing (name: %s, Type: %u, Level: %u) with (name: %s, Type: %u, Level: %u)\n",
- name, logger.getName().c_str(), logger.getType(), logger.getLogLevel(), name, type, level);
+ {
+ fprintf(stderr, "Error while configuring Logger %s. Already defined\n", name);
+ return;
+ }
+
+ ++iter;
+ level = LogLevel(atoi(*iter));
+ if (level > LOG_LEVEL_FATAL)
+ {
+ fprintf(stderr, "Log::CreateLoggerFromConfig: Wrong Log Level %u for logger %s\n", type, name);
+ return;
+ }
logger.Create(name, LogFilterType(type), level);
//fprintf(stdout, "Log::CreateLoggerFromConfig: Created Logger %s, Type %u, mask %u\n", name, LogFilterType(type), level); // DEBUG - RemoveMe
- std::istringstream ss(GetConfigStringDefault(base, "Appenders", ""));
+ ++iter;
+ std::istringstream ss(*iter);
std::string str;
ss >> str;
@@ -213,14 +260,9 @@ void Log::ReadLoggersFromConfig()
}
while (ss);
- LoggerMap::const_iterator it = loggers.begin();
-
- while (it != loggers.end() && it->first)
- ++it;
-
// root logger must exist. Marking as disabled as its not configured
- if (it == loggers.end())
- loggers[0].Create("root", LOG_FILTER_GENERAL, LOG_LEVEL_DISABLED);
+ if (loggers.find(LOG_FILTER_GENERAL) == loggers.end())
+ loggers[LOG_FILTER_GENERAL].Create("root", LOG_FILTER_GENERAL, LOG_LEVEL_DISABLED);
}
void Log::EnableDBAppenders()
@@ -228,20 +270,6 @@ void Log::EnableDBAppenders()
for (AppenderMap::iterator it = appenders.begin(); it != appenders.end(); ++it)
if (it->second && it->second->getType() == APPENDER_DB)
((AppenderDB *)it->second)->setEnable(true);
-
-}
-
-void Log::log(LogFilterType filter, LogLevel level, char const* str, ...)
-{
- if (!str || !ShouldLog(filter, level))
- return;
-
- va_list ap;
- va_start(ap, str);
-
- vlog(filter, level, str, ap);
-
- va_end(ap);
}
void Log::vlog(LogFilterType filter, LogLevel level, char const* str, va_list argptr)
@@ -303,10 +331,7 @@ bool Log::SetLogLevel(std::string const& name, const char* newLevelc, bool isLog
bool Log::ShouldLog(LogFilterType type, LogLevel level) const
{
- LoggerMap::const_iterator it = loggers.begin();
- while (it != loggers.end() && it->second.getType() != type)
- ++it;
-
+ LoggerMap::const_iterator it = loggers.find(type);
if (it != loggers.end())
{
LogLevel loggerLevel = it->second.getLogLevel();
@@ -397,6 +422,24 @@ void Log::outFatal(LogFilterType filter, const char * str, ...)
va_end(ap);
}
+void Log::outCharDump(char const* str, uint32 accountId, uint32 guid, char const* name)
+{
+ if (!str || !ShouldLog(LOG_FILTER_PLAYER_DUMP, LOG_LEVEL_INFO))
+ return;
+
+ std::ostringstream ss;
+ ss << "== START DUMP == (account: " << accountId << " guid: " << guid << " name: " << name
+ << ")\n" << str << "\n== END DUMP ==\n";
+
+ LogMessage* msg = new LogMessage(LOG_LEVEL_INFO, LOG_FILTER_PLAYER_DUMP, ss.str());
+ ss.clear();
+ ss << guid << '_' << name;
+
+ msg->param1 = ss.str();
+
+ write(msg);
+}
+
void Log::outCommand(uint32 account, const char * str, ...)
{
if (!str || !ShouldLog(LOG_FILTER_GMCOMMAND, LOG_LEVEL_INFO))
@@ -409,7 +452,10 @@ void Log::outCommand(uint32 account, const char * str, ...)
va_end(ap);
LogMessage* msg = new LogMessage(LOG_LEVEL_INFO, LOG_FILTER_GMCOMMAND, text);
- msg->param1 = account;
+
+ std::ostringstream ss;
+ ss << account;
+ msg->param1 = ss.str();
write(msg);
}
@@ -421,12 +467,26 @@ void Log::SetRealmID(uint32 id)
void Log::Close()
{
+ delete worker;
+ worker = NULL;
+ loggers.clear();
for (AppenderMap::iterator it = appenders.begin(); it != appenders.end(); ++it)
{
delete it->second;
it->second = NULL;
}
appenders.clear();
- delete worker;
- worker = NULL;
+}
+
+void Log::LoadFromConfig()
+{
+ Close();
+ AppenderId = 0;
+ m_logsDir = ConfigMgr::GetStringDefault("LogsDir", "");
+ if (!m_logsDir.empty())
+ if ((m_logsDir.at(m_logsDir.length() - 1) != '/') && (m_logsDir.at(m_logsDir.length() - 1) != '\\'))
+ m_logsDir.push_back('/');
+ ReadAppendersFromConfig();
+ ReadLoggersFromConfig();
+ worker = new LogWorker();
}
diff --git a/src/server/shared/Logging/Log.h b/src/server/shared/Logging/Log.h
index 5e2b7972dc8..b66e774b527 100755
--- a/src/server/shared/Logging/Log.h
+++ b/src/server/shared/Logging/Log.h
@@ -40,12 +40,11 @@ class Log
~Log();
public:
+ void LoadFromConfig();
void Close();
bool ShouldLog(LogFilterType type, LogLevel level) const;
bool SetLogLevel(std::string const& name, char const* level, bool isLogger = true);
- void log(LogFilterType f, LogLevel level, char const* str, ...) ATTR_PRINTF(4,5);
-
void outTrace(LogFilterType f, char const* str, ...) ATTR_PRINTF(3,4);
void outDebug(LogFilterType f, char const* str, ...) ATTR_PRINTF(3,4);
void outInfo(LogFilterType f, char const* str, ...) ATTR_PRINTF(3,4);
@@ -55,6 +54,7 @@ class Log
void EnableDBAppenders();
void outCommand(uint32 account, const char * str, ...) ATTR_PRINTF(3, 4);
+ void outCharDump(char const* str, uint32 account_id, uint32 guid, char const* name);
static std::string GetTimestampStr();
void SetRealmID(uint32 id);
diff --git a/src/server/shared/Packets/ByteBuffer.h b/src/server/shared/Packets/ByteBuffer.h
index 045c5fd91c8..1fa3148504a 100755
--- a/src/server/shared/Packets/ByteBuffer.h
+++ b/src/server/shared/Packets/ByteBuffer.h
@@ -50,8 +50,10 @@ class ByteBufferPositionException : public ByteBufferException
protected:
void PrintError() const
{
- sLog->outError(LOG_FILTER_GENERAL, "Attempted to %s value with size: "SIZEFMTD" in ByteBuffer (pos: " SIZEFMTD " size: "SIZEFMTD") " ,
- (_add ? "put" : "get"), ValueSize, Pos, Size);
+ ACE_Stack_Trace trace;
+
+ sLog->outError(LOG_FILTER_GENERAL, "Attempted to %s value with size: "SIZEFMTD" in ByteBuffer (pos: " SIZEFMTD " size: "SIZEFMTD")\n[Stacktrace: %s]" ,
+ (_add ? "put" : "get"), ValueSize, Pos, Size, trace.c_str());
}
private:
@@ -70,8 +72,10 @@ class ByteBufferSourceException : public ByteBufferException
protected:
void PrintError() const
{
- sLog->outError(LOG_FILTER_GENERAL, "Attempted to put a %s in ByteBuffer (pos: "SIZEFMTD" size: "SIZEFMTD")",
- (ValueSize > 0 ? "NULL-pointer" : "zero-sized value"), Pos, Size);
+ ACE_Stack_Trace trace;
+
+ sLog->outError(LOG_FILTER_GENERAL, "Attempted to put a %s in ByteBuffer (pos: "SIZEFMTD" size: "SIZEFMTD")\n[Stacktrace: %s]",
+ (ValueSize > 0 ? "NULL-pointer" : "zero-sized value"), Pos, Size, trace.c_str());
}
};
@@ -355,6 +359,28 @@ class ByteBuffer
}
}
+ uint32 ReadPackedTime()
+ {
+ uint32 packedDate = read<uint32>();
+ tm lt;
+ memset(&lt, 0, sizeof(lt));
+
+ lt.tm_min = packedDate & 0x3F;
+ lt.tm_hour = (packedDate >> 6) & 0x1F;
+ //lt.tm_wday = (packedDate >> 11) & 7;
+ lt.tm_mday = ((packedDate >> 14) & 0x3F) + 1;
+ lt.tm_mon = (packedDate >> 20) & 0xF;
+ lt.tm_year = ((packedDate >> 24) & 0x1F) + 100;
+
+ return mktime(&lt) + timezone;
+ }
+
+ ByteBuffer& ReadPackedTime(uint32& time)
+ {
+ time = ReadPackedTime();
+ return *this;
+ }
+
const uint8 *contents() const { return &_storage[0]; }
size_t size() const { return _storage.size(); }
@@ -434,6 +460,12 @@ class ByteBuffer
append(packGUID, size);
}
+ void AppendPackedTime(time_t time)
+ {
+ tm* lt = localtime(&time);
+ append<uint32>((lt->tm_year - 100) << 24 | lt->tm_mon << 20 | (lt->tm_mday - 1) << 14 | lt->tm_wday << 11 | lt->tm_hour << 6 | lt->tm_min);
+ }
+
void put(size_t pos, const uint8 *src, size_t cnt)
{
if (pos + cnt > size())
diff --git a/src/server/shared/Threading/Threading.h b/src/server/shared/Threading/Threading.h
index 8b10e223828..7cc74574873 100755
--- a/src/server/shared/Threading/Threading.h
+++ b/src/server/shared/Threading/Threading.h
@@ -51,7 +51,7 @@ namespace ACE_Based
Normal,
High,
Highest,
- Realtime,
+ Realtime
};
#define MAXPRIORITYNUM (Realtime + 1)
diff --git a/src/server/shared/Utilities/ServiceWin32.cpp b/src/server/shared/Utilities/ServiceWin32.cpp
index c6e9d385be3..91a78af1adc 100755
--- a/src/server/shared/Utilities/ServiceWin32.cpp
+++ b/src/server/shared/Utilities/ServiceWin32.cpp
@@ -52,8 +52,6 @@ typedef WINADVAPI BOOL (WINAPI *CSD_T)(SC_HANDLE, DWORD, LPCVOID);
bool WinServiceInstall()
{
- CSD_T ChangeService_Config2;
- HMODULE advapi32;
SC_HANDLE serviceControlManager = OpenSCManager(0, 0, SC_MANAGER_CREATE_SERVICE);
if (serviceControlManager)
@@ -79,7 +77,7 @@ bool WinServiceInstall()
0); // no password
if (service)
{
- advapi32 = GetModuleHandle("ADVAPI32.DLL");
+ HMODULE advapi32 = GetModuleHandle("ADVAPI32.DLL");
if (!advapi32)
{
CloseServiceHandle(service);
@@ -87,7 +85,7 @@ bool WinServiceInstall()
return false;
}
- ChangeService_Config2 = (CSD_T) GetProcAddress(advapi32, "ChangeServiceConfig2A");
+ CSD_T ChangeService_Config2 = (CSD_T) GetProcAddress(advapi32, "ChangeServiceConfig2A");
if (!ChangeService_Config2)
{
CloseServiceHandle(service);
diff --git a/src/server/shared/Utilities/Util.cpp b/src/server/shared/Utilities/Util.cpp
index 7bedf9690ca..89942b978df 100755
--- a/src/server/shared/Utilities/Util.cpp
+++ b/src/server/shared/Utilities/Util.cpp
@@ -92,7 +92,7 @@ Tokens::Tokens(const std::string &src, const char sep, uint32 vectorReserve)
void stripLineInvisibleChars(std::string &str)
{
- static std::string invChars = " \t\7\n";
+ static std::string const invChars = " \t\7\n";
size_t wpos = 0;
@@ -217,7 +217,7 @@ uint32 CreatePIDFile(const std::string& filename)
pid_t pid = getpid();
#endif
- fprintf(pid_file, "%d", pid );
+ fprintf(pid_file, "%u", pid );
fclose(pid_file);
return (uint32)pid;
diff --git a/src/server/shared/Utilities/Util.h b/src/server/shared/Utilities/Util.h
index 196882dc2a0..37782c31d8b 100755
--- a/src/server/shared/Utilities/Util.h
+++ b/src/server/shared/Utilities/Util.h
@@ -48,12 +48,6 @@ std::string secsToTimeString(uint64 timeInSecs, bool shortText = false, bool hou
uint32 TimeStringToSecs(const std::string& timestring);
std::string TimeToTimestampStr(time_t t);
-inline uint32 secsToTimeBitFields(time_t secs)
-{
- tm* lt = localtime(&secs);
- return (lt->tm_year - 100) << 24 | lt->tm_mon << 20 | (lt->tm_mday - 1) << 14 | lt->tm_wday << 11 | lt->tm_hour << 6 | lt->tm_min;
-}
-
/* Return a random number in the range min..max; (max-min) must be smaller than 32768. */
int32 irand(int32 min, int32 max);
@@ -89,22 +83,6 @@ inline bool roll_chance_i(int chance)
return chance > irand(0, 99);
}
-inline void ApplyModUInt32Var(uint32& var, int32 val, bool apply)
-{
- int32 cur = var;
- cur += (apply ? val : -val);
- if (cur < 0)
- cur = 0;
- var = cur;
-}
-
-inline void ApplyModFloatVar(float& var, float val, bool apply)
-{
- var += (apply ? val : -val);
- if (var < 0)
- var = 0;
-}
-
inline void ApplyPercentModFloatVar(float& var, float val, bool apply)
{
if (val == -100.0f) // prevent set var to zero
@@ -475,7 +453,7 @@ public:
return 0;
}
return 0;
- };
+ }
template<class type>
inline bool operator < (type & right) const
@@ -488,7 +466,7 @@ public:
return 0;
}
return 0;
- };
+ }
template<class type>
inline bool operator != (type & right)
@@ -508,7 +486,7 @@ public:
|| part[2]!=right.part[2])
return true;
return false;
- };
+ }
template<class type>
inline bool operator == (type & right)
@@ -518,7 +496,7 @@ public:
|| part[2]!=right.part[2])
return false;
return true;
- };
+ }
template<class type>
inline bool operator == (type & right) const
@@ -528,7 +506,7 @@ public:
|| part[2]!=right.part[2])
return false;
return true;
- };
+ }
template<class type>
inline void operator = (type & right)
@@ -536,7 +514,7 @@ public:
part[0]=right.part[0];
part[1]=right.part[1];
part[2]=right.part[2];
- };
+ }
template<class type>
inline flag96 operator & (type & right)
@@ -544,20 +522,21 @@ public:
flag96 ret(part[0] & right.part[0], part[1] & right.part[1], part[2] & right.part[2]);
return
ret;
- };
+ }
+
template<class type>
inline flag96 operator & (type & right) const
{
flag96 ret(part[0] & right.part[0], part[1] & right.part[1], part[2] & right.part[2]);
return
ret;
- };
+ }
template<class type>
inline void operator &= (type & right)
{
*this=*this & right;
- };
+ }
template<class type>
inline flag96 operator | (type & right)
@@ -565,7 +544,7 @@ public:
flag96 ret(part[0] | right.part[0], part[1] | right.part[1], part[2] | right.part[2]);
return
ret;
- };
+ }
template<class type>
inline flag96 operator | (type & right) const
@@ -573,13 +552,13 @@ public:
flag96 ret(part[0] | right.part[0], part[1] | right.part[1], part[2] | right.part[2]);
return
ret;
- };
+ }
template<class type>
inline void operator |= (type & right)
{
*this=*this | right;
- };
+ }
inline void operator ~ ()
{
@@ -594,7 +573,7 @@ public:
flag96 ret(part[0] ^ right.part[0], part[1] ^ right.part[1], part[2] ^ right.part[2]);
return
ret;
- };
+ }
template<class type>
inline flag96 operator ^ (type & right) const
@@ -602,13 +581,13 @@ public:
flag96 ret(part[0] ^ right.part[0], part[1] ^ right.part[1], part[2] ^ right.part[2]);
return
ret;
- };
+ }
template<class type>
inline void operator ^= (type & right)
{
*this=*this^right;
- };
+ }
inline operator bool() const
{
diff --git a/src/server/worldserver/Main.cpp b/src/server/worldserver/Main.cpp
index 862ed28f2d3..7e43cf87dfc 100755
--- a/src/server/worldserver/Main.cpp
+++ b/src/server/worldserver/Main.cpp
@@ -81,7 +81,7 @@ extern int main(int argc, char **argv)
{
if (++c >= argc)
{
- sLog->outError(LOG_FILTER_WORLDSERVER, "Runtime-Error: -c option requires an input argument");
+ printf("Runtime-Error: -c option requires an input argument");
usage(argv[0]);
return 1;
}
@@ -97,25 +97,25 @@ extern int main(int argc, char **argv)
{
if (++c >= argc)
{
- sLog->outError(LOG_FILTER_WORLDSERVER, "Runtime-Error: -s option requires an input argument");
+ printf("Runtime-Error: -s option requires an input argument");
usage(argv[0]);
return 1;
}
if (strcmp(argv[c], "install") == 0)
{
if (WinServiceInstall())
- sLog->outInfo(LOG_FILTER_WORLDSERVER, "Installing service");
+ printf("Installing service");
return 1;
}
else if (strcmp(argv[c], "uninstall") == 0)
{
if (WinServiceUninstall())
- sLog->outInfo(LOG_FILTER_WORLDSERVER, "Uninstalling service");
+ printf("Uninstalling service");
return 1;
}
else
{
- sLog->outError(LOG_FILTER_WORLDSERVER, "Runtime-Error: unsupported option %s", argv[c]);
+ printf("Runtime-Error: unsupported option %s", argv[c]);
usage(argv[0]);
return 1;
}
@@ -131,8 +131,8 @@ extern int main(int argc, char **argv)
if (!ConfigMgr::Load(cfg_file))
{
- sLog->outError(LOG_FILTER_WORLDSERVER, "Invalid or missing configuration file : %s", cfg_file);
- sLog->outError(LOG_FILTER_WORLDSERVER, "Verify that the file exists and has \'[worldserver]' written in the top of the file!");
+ printf("Invalid or missing configuration file : %s", cfg_file);
+ printf("Verify that the file exists and has \'[worldserver]' written in the top of the file!");
return 1;
}
sLog->outInfo(LOG_FILTER_WORLDSERVER, "Using configuration file %s.", cfg_file);
diff --git a/src/server/worldserver/Master.cpp b/src/server/worldserver/Master.cpp
index 48e07c727b4..7587a9d1904 100755
--- a/src/server/worldserver/Master.cpp
+++ b/src/server/worldserver/Master.cpp
@@ -240,7 +240,7 @@ int Master::Run()
if (ConfigMgr::GetBoolDefault("SOAP.Enabled", false))
{
TCSoapRunnable* runnable = new TCSoapRunnable();
- runnable->setListenArguments(ConfigMgr::GetStringDefault("SOAP.IP", "127.0.0.1"), ConfigMgr::GetIntDefault("SOAP.Port", 7878));
+ runnable->setListenArguments(ConfigMgr::GetStringDefault("SOAP.IP", "127.0.0.1"), uint16(ConfigMgr::GetIntDefault("SOAP.Port", 7878)));
soap_thread = new ACE_Based::Thread(runnable);
}
diff --git a/src/server/worldserver/TCSoap/TCSoap.h b/src/server/worldserver/TCSoap/TCSoap.h
index 285adaaaf4b..51ffb3a91c8 100755
--- a/src/server/worldserver/TCSoap/TCSoap.h
+++ b/src/server/worldserver/TCSoap/TCSoap.h
@@ -51,7 +51,7 @@ class SOAPCommand
{
public:
SOAPCommand():
- pendingCommands(0, USYNC_THREAD, "pendingCommands")
+ pendingCommands(0, USYNC_THREAD, "pendingCommands"), m_success(false)
{
}
diff --git a/src/server/worldserver/worldserver.conf.dist b/src/server/worldserver/worldserver.conf.dist
index 614d7f95eb2..55443f4253b 100644
--- a/src/server/worldserver/worldserver.conf.dist
+++ b/src/server/worldserver/worldserver.conf.dist
@@ -20,11 +20,13 @@
# SERVER RATES
# AUTO BROADCAST
# BATTLEGROUND CONFIG
+# BATTLEFIELD CONFIG
# ARENA CONFIG
# NETWORK CONFIG
# CONSOLE AND REMOTE ACCESS
# CHARACTER DELETE OPTIONS
# CUSTOM SERVER OPTIONS
+# LOGGING SYSTEM SETTINGS
#
###################################################################################################
@@ -48,7 +50,7 @@
#
# RealmID
# Description: ID of the Realm using this config.
-# Important: RealmID must match the realmlist inside the realmd database.
+# Important: RealmID must match the realmlist inside the auth database.
# Default: 1
RealmID = 1
@@ -173,7 +175,7 @@ Compression = 1
# PlayerLimit
# Description: Maximum number of players in the world. Excluding Mods, GMs and Admins.
# Important: If you want to block players and only allow Mods, GMs or Admins to join the
-# server, use the DB field "realmd.realmlist.allowedSecurityLevel".
+# server, use the DB field "auth.realmlist.allowedSecurityLevel".
# Default: 100 - (Enabled)
# 1+ - (Enabled)
# 0 - (Disabled, No limit)
@@ -398,12 +400,21 @@ PersistentCharacterCleanFlags = 0
#
# PidFile
# Description: World daemon PID file
-# Example: "./worldd.pid" - (Enabled)
-# Default: "" - (Disabled)
+# Example: "./world.pid" - (Enabled)
+# Default: "" - (Disabled)
PidFile = ""
#
+# PacketLogFile
+# Description: Binary packet logging file for the world server.
+# Filename extension must be .bin to be parsable with WowPacketParser.
+# Example: "World.bin" - (Enabled)
+# Default: "" - (Disabled)
+
+PacketLogFile = ""
+
+#
# ChatLogs.Channel
# Description: Log custom channel chat.
# Default: 0 - (Disabled)
@@ -1149,15 +1160,6 @@ Warden.NumMemChecks = 3
Warden.NumOtherChecks = 7
#
-# Warden.LogFile
-# Description: Client check fails will be logged here.
-# Default: "" - (Disabled)
-# "Warden.log" - (Enabled)
-#
-
-Warden.LogFile = ""
-
-#
# Warden.ClientResponseDelay
# Description: Time (in seconds) before client is getting disconnecting for not responding.
# Default: 600 - (10 Minutes)
@@ -1208,6 +1210,14 @@ Warden.BanDuration = 86400
AllowTwoSide.Accounts = 1
#
+# AllowTwoSide.Interaction.Calendar
+# Description: Allow calendar invites between factions.
+# Default: 0 - (Disabled)
+# 1 - (Enabled)
+
+AllowTwoSide.Interaction.Calendar = 0
+
+#
# AllowTwoSide.Interaction.Chat
# Description: Allow say chat between factions.
# Default: 0 - (Disabled)
@@ -2184,6 +2194,62 @@ Battleground.Random.ResetHour = 6
###################################################################################################
###################################################################################################
+# BATTLEFIELD CONFIG
+#
+# Wintergrasp.Enable
+# Description: Enable the Wintergrasp battlefield.
+# Default: 0 - (Disabled)
+# 1 - (Enabled, Experimental as of still being in development)
+
+Wintergrasp.Enable = 0
+
+#
+# Wintergrasp.PlayerMax
+# Description: Maximum number of players allowed in Wintergrasp.
+# Default: 100
+
+Wintergrasp.PlayerMax = 100
+
+#
+# Wintergrasp.PlayerMin
+# Description: Minimum number of players required for Wintergrasp.
+# Default: 0
+
+Wintergrasp.PlayerMin = 0
+
+#
+# Wintergrasp.PlayerMinLvl
+# Description: Required character level for the Wintergrasp battle.
+# Default: 77
+
+Wintergrasp.PlayerMinLvl = 77
+
+#
+# Wintergrasp.BattleTimer
+# Description: Time (in minutes) for the Wintergrasp battle to last.
+# Default: 30
+
+Wintergrasp.BattleTimer = 30
+
+#
+# Wintergrasp.NoBattleTimer
+# Description: Time (in minutes) between Wintergrasp battles.
+# Default: 150
+
+Wintergrasp.NoBattleTimer = 150
+
+#
+# Wintergrasp.CrashRestartTimer
+# Description: Time (in minutes) to delay the restart of Wintergrasp if the world server
+# crashed during a running battle.
+# Default: 10
+
+Wintergrasp.CrashRestartTimer = 10
+
+#
+###################################################################################################
+
+###################################################################################################
# ARENA CONFIG
#
# Arena.MaxRatingDifference
@@ -2270,6 +2336,15 @@ Arena.ArenaStartPersonalRating = 0
Arena.ArenaStartMatchmakerRating = 1500
#
+# ArenaLog.ExtendedInfo
+# Description: Include extended info to ArenaLogFile for each player after rated arena
+# matches (guid, name, team, IP, healing/damage done, killing blows).
+# Default: 0 - (Disabled)
+# 1 - (Enabled)
+
+ArenaLog.ExtendedInfo = 0
+
+#
###################################################################################################
###################################################################################################
@@ -2579,175 +2654,170 @@ PlayerDump.DisallowOverwrite = 1
###################################################################################################
#
-# Logging system options.
-# Note: As it uses dynamic option naming, all options related to one appender or logger are grouped.
-#
-#
-# Appender config values: Given a appender "name" the following options
-# can be read:
-#
-# Appender.name.Type
-# Description: Type of appender. Extra appender config options
-# will be read depending on this value
-# Default: 0 - (None)
-# 1 - (Console)
-# 2 - (File)
-# 3 - (DB)
-#
-# Appender.name.Level
-# Description: Appender level of logging
-# Default: 0 - (Disabled)
-# 1 - (Trace)
-# 2 - (Debug)
-# 3 - (Info)
-# 4 - (Warn)
-# 5 - (Error)
-# 6 - (Fatal)
-#
-# Appender.name.Colors
-# Description: Colors for log messages
-# (Format: "fatal error warn info debug trace").
-# (Only used with Type = 1)
-# Default: "" - no colors
-# Colors: 0 - BLACK
-# 1 - RED
-# 2 - GREEN
-# 3 - BROWN
-# 4 - BLUE
-# 5 - MAGENTA
-# 6 - CYAN
-# 7 - GREY
-# 8 - YELLOW
-# 9 - LRED
-# 10 - LGREEN
-# 11 - LBLUE
-# 12 - LMAGENTA
-# 13 - LCYAN
-# 14 - WHITE
-# Example: "13 11 9 5 3 1"
-#
-# Appender.name.File
-# Description: Name of the file
-# Allows to use one "%u" to create dynamic files
-# (Only used with Type = 2)
-#
-# Appender.name.Mode
-# Description: Mode to open the file
-# (Only used with Type = 2)
-# Default: a - (Append)
-# w - (Overwrite)
-#
-# Appender.name.Backup
-# Description: Make a backup of existing file before overwrite
-# (Only used with Mode = w)
-# Default: 0 - false
-# 1 - true
-#
-# Appender.name.Timestamp
-# Description: Append timestamp to the log file name.
-# Logname_YYYY-MM-DD_HH-MM-SS.Ext for Logname.Ext
-# (Only used with Type = 2)
-#
-# Logger config values: Given a logger "name" the following options
-# can be read:
-#
-# Logger.name.Type
-# Description: Type of logger. Logs anything related to...
-# If no logger with type = 0 exists core will create
-# it but disabled. Logger with type = 0 is the
-# default one, used when there is no other specific
-# logger configured for other logger types
-# Default: 0 - Default. Each type that has no config will
-# rely on this one. Core will create this logger
-# (disabled) if it's not configured
-# 1 - Units that doesn't fit in other categories
-# 2 - Pets
-# 3 - Vehicles
-# 4 - C++ AI, instance scripts, etc.
-# 5 - DB AI, such as SAI, EAI, CreatureAI
-# 6 - DB map scripts
-# 7 - Network input/output,
-# such as packet handlers and netcode logs
-# 8 - Spellsystem and aurasystem
-# 9 - Achievement system
-# 10 - Condition system
-# 11 - Pool system
-# 12 - Auction house
-# 13 - Arena's and battlegrounds
-# 14 - Outdoor PVP
-# 15 - Chat system
-# 16 - LFG system
-# 17 - Maps, instances (not scripts),
-# grids, cells, visibility, etc.
-# 18 - Player that doesn't fit in other categories.
-# 19 - Player loading from DB
-# (Player::_LoadXXX functions)
-# 20 - Items
-# 21 - Player skills (do not confuse with spells)
-# 22 - Player chat logs
-# 23 - loot
-# 24 - guilds
-# 25 - transports
-# 26 - SQL. DB errors and SQL Driver
-# 27 - GM Commands
-# 28 - Remote Access Commands
-# 29 - Warden
-# 30 - Authserver
-# 31 - Worldserver
-# 32 - Game Events
-# 33 - Calendar
-#
-# Logger.name.Level
-# Description: Logger level of logging
-# Default: 0 - (Disabled)
-# 1 - (Trace)
-# 2 - (Debug)
-# 3 - (Info)
-# 4 - (Warn)
-# 5 - (Error)
-# 6 - (Fatal)
-#
-# Logger.name.Appenders
-# Description: List of appenders linked to logger
-# (Using spaces as separator).
-#
+# LOGGING SYSTEM SETTINGS
+#
+# Appender config values: Given a appender "name"
+# Appender.name
+# Description: Defines 'where to log'
+# Format: Type,LogLevel,Flags,optional1,optional2
+#
+# Type
+# 0 - (None)
+# 1 - (Console)
+# 2 - (File)
+# 3 - (DB)
+#
+# LogLevel
+# 0 - (Disabled)
+# 1 - (Trace)
+# 2 - (Debug)
+# 3 - (Info)
+# 4 - (Warn)
+# 5 - (Error)
+# 6 - (Fatal)
+#
+# Flags:
+# 0 - None
+# 1 - Prefix Timestamp to the text
+# 2 - Prefix Log Level to the text
+# 4 - Prefix Log Filter type to the text
+# 8 - Append timestamp to the log file name. Format: YYYY-MM-DD_HH-MM-SS (Only used with Type = 2)
+# 16 - Make a backup of existing file before overwrite (Only used with Mode = w)
+#
+# Colors (read as optional1 if Type = Console)
+# Format: "fatal error warn info debug trace"
+# 0 - BLACK
+# 1 - RED
+# 2 - GREEN
+# 3 - BROWN
+# 4 - BLUE
+# 5 - MAGENTA
+# 6 - CYAN
+# 7 - GREY
+# 8 - YELLOW
+# 9 - LRED
+# 10 - LGREEN
+# 11 - LBLUE
+# 12 - LMAGENTA
+# 13 - LCYAN
+# 14 - WHITE
+# Example: "13 11 9 5 3 1"
+#
+# File: Name of the file (read as optional1 if Type = File)
+# Allows to use one "%s" to create dynamic files
+#
+# Mode: Mode to open the file (read as optional2 if Type = File)
+# a - (Append)
+# w - (Overwrite)
+#
+
+Appender.Console=1,3,0
+Appender.Server=2,2,0,Server.log,w
+Appender.GM=2,2,0,GM.log
+Appender.DBErrors=2,2,0,DBErrors.log
+Appender.Char=2,2,0,Char.log,w
+Appender.RA=2,2,0,RA.log
+Appender.Warden=2,4,0,Warden.log
+Appender.Chat=2,2,0,Chat.log
+Appender.CharDump=2,2,0,%s.log
+Appender.Arenas=2,2,0,Arena.log
+Appender.SQLDev=2,2,0,SQLDev.log
+Appender.SQLDriver=2,2,0,SQLDriver.log
+
# Appenders
# Description: List of Appenders to read from config
# (Using spaces as separator).
-# Default: "Console Server"
+# Default: "Console Server GM DBErrors Char RA Warden Chat"
+
+Appenders=Console Server GM DBErrors Char RA Warden Chat
+
+# Logger config values: Given a logger "name"
+# Logger.name
+# Description: Defines 'What to log'
+# Format: Type,LogLevel,AppenderList
+# Type
+# 0 - Default. Each type that has no config will
+# rely on this one. Core will create this logger
+# (disabled) if it's not configured
+# 1 - Units that doesn't fit in other categories
+# 2 - Pets
+# 3 - Vehicles
+# 4 - C++ AI, instance scripts, etc.
+# 5 - DB AI, such as SAI, EAI, CreatureAI
+# 6 - DB map scripts
+# 7 - Network input/output,
+# such as packet handlers and netcode logs
+# 8 - Spellsystem and aurasystem
+# 9 - Achievement system
+# 10 - Condition system
+# 11 - Pool system
+# 12 - Auction house
+# 13 - Arena's and battlegrounds
+# 14 - Outdoor PVP
+# 15 - Chat system
+# 16 - LFG system
+# 17 - Maps, instances (not scripts),
+# grids, cells, visibility, etc.
+# 18 - Player that doesn't fit in other categories.
+# 19 - Player loading from DB
+# (Player::_LoadXXX functions)
+# 20 - Items
+# 21 - Player skills (do not confuse with spells)
+# 22 - Player chat logs
+# 23 - loot
+# 24 - guilds
+# 25 - transports
+# 26 - SQL. DB errors
+# 27 - GM Commands
+# 28 - Remote Access Commands
+# 29 - Warden
+# 30 - Authserver
+# 31 - Worldserver
+# 32 - Game Events
+# 33 - Calendar
+# 34 - Character (Exclusive to log login, logout, create, rename)
+# 35 - Arenas
+# 36 - SQL Driver
+# 37 - SQL Dev
+# 38 - Player Dump
+# 39 - Battlefield
+# 40 - Server Loading
+# 41 - Opcodes (just id and name sent / received)
+# LogLevel
+# 0 - (Disabled)
+# 1 - (Trace)
+# 2 - (Debug)
+# 3 - (Info)
+# 4 - (Warn)
+# 5 - (Error)
+# 6 - (Fatal)
+#
+# AppenderList: List of appenders linked to logger
+# (Using spaces as separator).
+#
+
+Logger.Root=0,5,Console Server
+Logger.Chat=22,2,Chat
+Logger.DBErrors=26,5,Console Server DBErrors
+Logger.GM=27,3,Console Server GM
+Logger.RA=28,3,RA
+Logger.Warden=29,4,Warden
+Logger.WorldServer=31,3,Console Server
+Logger.Character=34,3,Char
+Logger.Arenas=35,3,Arenas
+Logger.SQLDriver=36,5,SQLDriver
+Logger.SQLDev=37,3,SQLDev
+Logger.CharDump=38,3,CharDump
+Logger.Load=40,3,Console Server
+Logger.Opcodes=41,6,Console Server
+
#
# Loggers
# Description: List of Loggers to read from config
# (Using spaces as separator).
-# Default: "root"
-
-Loggers=root GM SQL
-Appenders=Console Server GM SQL
+# Default: "Root Chat DBErrors GM RA Warden Character Load"
-Appender.Console.Type=1
-Appender.Console.Level=2
+Loggers=Root Chat DBErrors GM RA Warden Character Load WorldServer Opcodes
-Appender.Server.Type=2
-Appender.Server.Level=2
-Appender.Server.File=Server.log
-Appender.Server.Mode=w
-
-Appender.GM.Type=2
-Appender.GM.Level=2
-Appender.GM.File=gm_#%u.log
-
-Appender.SQL.Type=2
-Appender.SQL.Level=2
-Appender.SQL.File=SQL.log
-
-Logger.root.Type=0
-Logger.root.Level=3
-Logger.root.Appenders=Console Server
-
-Logger.SQL.Type=26
-Logger.SQL.Level=3
-Logger.SQL.Appenders=Console Server SQL
-
-Logger.GM.Type=27
-Logger.GM.Level=3
-Logger.GM.Appenders=Console Server GM
+#
+###################################################################################################
diff --git a/src/tools/map_extractor/CMakeLists.txt b/src/tools/map_extractor/CMakeLists.txt
index bde62c24c70..55a136f6329 100644
--- a/src/tools/map_extractor/CMakeLists.txt
+++ b/src/tools/map_extractor/CMakeLists.txt
@@ -43,5 +43,5 @@ add_dependencies(mapextractor mpq)
if( UNIX )
install(TARGETS mapextractor DESTINATION bin)
elseif( WIN32 )
- install(TARGETS mapextractor DESTINATION "${CMAKE_INSTALL_PREFIX}")
+ install(TARGETS mapextractor DESTINATION "${CMAKE_INSTALL_PREFIX}")
endif()
diff --git a/src/tools/map_extractor/System.cpp b/src/tools/map_extractor/System.cpp
index d64276c6363..d0342717324 100644
--- a/src/tools/map_extractor/System.cpp
+++ b/src/tools/map_extractor/System.cpp
@@ -9,6 +9,7 @@
#include "direct.h"
#else
#include <sys/stat.h>
+#include <unistd.h>
#endif
#include "dbcfile.h"
@@ -900,7 +901,7 @@ void ExtractMapsFromMpq(uint32 build)
printf("Convert map files\n");
for(uint32 z = 0; z < map_count; ++z)
{
- printf("Extract %s (%d/%d) \n", map_ids[z].name, z+1, map_count);
+ printf("Extract %s (%d/%u) \n", map_ids[z].name, z+1, map_count);
// Loadup map grid data
sprintf(mpq_map_name, "World\\Maps\\%s\\%s.wdt", map_ids[z].name, map_ids[z].name);
WDT_file wdt;
@@ -980,13 +981,13 @@ void ExtractDBCFiles(int locale, bool basicLocale)
}
// extract DBCs
- int count = 0;
+ uint32 count = 0;
for (set<string>::iterator iter = dbcfiles.begin(); iter != dbcfiles.end(); ++iter)
{
string filename = path;
filename += (iter->c_str() + strlen("DBFilesClient\\"));
- if(ExtractFile(iter->c_str(), filename))
+ if (ExtractFile(iter->c_str(), filename))
++count;
}
printf("Extracted %u DBC files\n\n", count);
diff --git a/src/tools/map_extractor/dbcfile.cpp b/src/tools/map_extractor/dbcfile.cpp
index 927d3d62b7f..c1cab7ddb2f 100644
--- a/src/tools/map_extractor/dbcfile.cpp
+++ b/src/tools/map_extractor/dbcfile.cpp
@@ -3,12 +3,12 @@
#include "dbcfile.h"
#include "mpq_libmpq04.h"
-DBCFile::DBCFile(const std::string &filename):
- filename(filename),
- data(0)
+DBCFile::DBCFile(const std::string& filename):
+ filename(filename), recordSize(0), recordCount(0), fieldCount(0), stringSize(0), data(NULL), stringTable(NULL)
{
}
+
bool DBCFile::open()
{
MPQFile f(filename.c_str());
diff --git a/src/tools/vmap4_extractor/adtfile.cpp b/src/tools/vmap4_extractor/adtfile.cpp
index a966172a3be..a605118eead 100644
--- a/src/tools/vmap4_extractor/adtfile.cpp
+++ b/src/tools/vmap4_extractor/adtfile.cpp
@@ -26,7 +26,7 @@
#define snprintf _snprintf
#endif
-const char * GetPlainName(const char * FileName)
+char const* GetPlainName(char const* FileName)
{
const char * szTemp;
@@ -35,7 +35,7 @@ const char * GetPlainName(const char * FileName)
return FileName;
}
-char * GetPlainName(char * FileName)
+char* GetPlainName(char* FileName)
{
char * szTemp;
@@ -44,24 +44,21 @@ char * GetPlainName(char * FileName)
return FileName;
}
-void fixnamen(char *name, size_t len)
+void fixnamen(char* name, size_t len)
{
- for (size_t i=0; i<len-3; i++)
+ for (size_t i = 0; i < len-3; i++)
{
- if (i>0 && name[i]>='A' && name[i]<='Z' && isalpha(name[i-1]))
- {
+ if (i > 0 && name[i] >= 'A' && name[i] <= 'Z' && isalpha(name[i-1]))
name[i] |= 0x20;
- } else if ((i==0 || !isalpha(name[i-1])) && name[i]>='a' && name[i]<='z')
- {
+ else if ((i == 0 || !isalpha(name[i-1])) && name[i]>='a' && name[i]<='z')
name[i] &= ~0x20;
- }
}
//extension in lowercase
- for(size_t i=len-3; i<len; i++)
+ for (size_t i = len - 3; i < len; i++)
name[i] |= 0x20;
}
-void fixname2(char *name, size_t len)
+void fixname2(char* name, size_t len)
{
for (size_t i=0; i<len-3; i++)
{
@@ -70,15 +67,15 @@ void fixname2(char *name, size_t len)
}
}
-char * GetExtension(char * FileName)
+char* GetExtension(char* FileName)
{
- char * szTemp;
- if((szTemp = strrchr(FileName, '.')) != NULL)
+ char* szTemp;
+ if (szTemp = strrchr(FileName, '.'))
return szTemp;
return NULL;
}
-ADTFile::ADTFile(char* filename): ADT(filename)
+ADTFile::ADTFile(char* filename): ADT(filename), nWMO(0), nMDX(0), WmoInstansName(NULL), ModelInstansName(NULL)
{
Adtfilename.append(filename);
}
@@ -99,7 +96,7 @@ bool ADTFile::init(uint32 map_num, uint32 tileX, uint32 tileY)
xMap = TempMapNumber.substr(TempMapNumber.find("_")+1,(TempMapNumber.find_last_of("_")-1) - (TempMapNumber.find("_")));
yMap = TempMapNumber.substr(TempMapNumber.find_last_of("_")+1,(TempMapNumber.length()) - (TempMapNumber.find_last_of("_")));
Adtfilename.erase((Adtfilename.length()-xMap.length()-yMap.length()-2), (xMap.length()+yMap.length()+2));
- string AdtMapNumber = xMap + ' ' + yMap + ' ' + GetPlainName((char*)Adtfilename.c_str());
+ //string AdtMapNumber = xMap + ' ' + yMap + ' ' + GetPlainName((char*)Adtfilename.c_str());
//printf("Processing map %s...\n", AdtMapNumber.c_str());
//printf("MapNumber = %s\n", TempMapNumber.c_str());
//printf("xMap = %s\n", xMap.c_str());
@@ -159,18 +156,17 @@ bool ADTFile::init(uint32 map_num, uint32 tileX, uint32 tileY)
{
if (size)
{
- char *buf = new char[size];
+ char* buf = new char[size];
ADT.read(buf, size);
- char *p=buf;
+ char* p=buf;
int q = 0;
WmoInstansName = new string[size];
while (p<buf+size)
{
- string path(p);
- char* s=GetPlainName(p);
- fixnamen(s,strlen(s));
- fixname2(s,strlen(s));
- p=p+strlen(p)+1;
+ char* s = GetPlainName(p);
+ fixnamen(s, strlen(s));
+ fixname2(s, strlen(s));
+ p += strlen(p) + 1;
WmoInstansName[q++] = s;
}
delete[] buf;
diff --git a/src/tools/vmap4_extractor/dbcfile.cpp b/src/tools/vmap4_extractor/dbcfile.cpp
index 2474cea5259..a651456d916 100644
--- a/src/tools/vmap4_extractor/dbcfile.cpp
+++ b/src/tools/vmap4_extractor/dbcfile.cpp
@@ -23,9 +23,10 @@
#include <cstdio>
-DBCFile::DBCFile(const std::string &filename) : filename(filename)
+DBCFile::DBCFile(const std::string& filename):
+ filename(filename), recordSize(0), recordCount(0), fieldCount(0), stringSize(0), data(NULL), stringTable(NULL)
{
- data = NULL;
+
}
bool DBCFile::open()
diff --git a/src/tools/vmap4_extractor/model.cpp b/src/tools/vmap4_extractor/model.cpp
index e81972f521f..57f9b421dbe 100644
--- a/src/tools/vmap4_extractor/model.cpp
+++ b/src/tools/vmap4_extractor/model.cpp
@@ -26,15 +26,14 @@
Model::Model(std::string &filename) : filename(filename), vertices(0), indices(0)
{
+ memset(&header, 0, sizeof(header));
}
bool Model::open()
{
MPQFile f(filename.c_str());
- ok = !f.isEof();
-
- if (!ok)
+ if (f.isEof())
{
f.close();
// Do not show this error on console to avoid confusion, the extractor can continue working even if some models fail to load
@@ -52,9 +51,7 @@ bool Model::open()
vertices = new Vec3D[header.nBoundingVertices];
f.read(vertices,header.nBoundingVertices*12);
for (uint32 i=0; i<header.nBoundingVertices; i++)
- {
vertices[i] = fixCoordSystem(vertices[i]);
- }
f.seek(0);
f.seekRelative(header.ofsBoundingTriangles);
indices = new uint16[header.nBoundingTriangles];
@@ -73,13 +70,13 @@ bool Model::open()
bool Model::ConvertToVMAPModel(const char * outfilename)
{
int N[12] = {0,0,0,0,0,0,0,0,0,0,0,0};
- FILE * output=fopen(outfilename,"wb");
- if(!output)
+ FILE* output=fopen(outfilename, "wb");
+ if (!output)
{
printf("Can't create the output file '%s'\n",outfilename);
return false;
}
- fwrite(szRawVMAPMagic,8,1,output);
+ fwrite(szRawVMAPMagic, 8, 1, output);
uint32 nVertices = 0;
nVertices = header.nBoundingVertices;
fwrite(&nVertices, sizeof(int), 1, output);
@@ -101,20 +98,18 @@ bool Model::ConvertToVMAPModel(const char * outfilename)
wsize = sizeof(uint32) + sizeof(unsigned short) * nIndexes;
fwrite(&wsize, sizeof(int), 1, output);
fwrite(&nIndexes, sizeof(uint32), 1, output);
- if(nIndexes >0)
- {
+ if (nIndexes >0)
fwrite(indices, sizeof(unsigned short), nIndexes, output);
- }
- fwrite("VERT",4, 1, output);
+
+ fwrite("VERT", 4, 1, output);
wsize = sizeof(int) + sizeof(float) * 3 * nVertices;
fwrite(&wsize, sizeof(int), 1, output);
fwrite(&nVertices, sizeof(int), 1, output);
- if(nVertices >0)
+ if (nVertices >0)
{
for(uint32 vpos=0; vpos <nVertices; ++vpos)
- {
std::swap(vertices[vpos].y, vertices[vpos].z);
- }
+
fwrite(vertices, sizeof(float)*3, nVertices, output);
}
@@ -134,24 +129,24 @@ Vec3D fixCoordSystem2(Vec3D v)
return Vec3D(v.x, v.z, v.y);
}
-ModelInstance::ModelInstance(MPQFile &f,const char* ModelInstName, uint32 mapID, uint32 tileX, uint32 tileY, FILE *pDirfile)
+ModelInstance::ModelInstance(MPQFile& f, char const* ModelInstName, uint32 mapID, uint32 tileX, uint32 tileY, FILE *pDirfile)
+ : model(NULL), d1(0), w(0.0f)
{
float ff[3];
f.read(&id, 4);
- f.read(ff,12);
- pos = fixCoords(Vec3D(ff[0],ff[1],ff[2]));
- f.read(ff,12);
- rot = Vec3D(ff[0],ff[1],ff[2]);
- f.read(&scale,4);
+ f.read(ff, 12);
+ pos = fixCoords(Vec3D(ff[0], ff[1], ff[2]));
+ f.read(ff, 12);
+ rot = Vec3D(ff[0], ff[1], ff[2]);
+ f.read(&scale, 4);
// scale factor - divide by 1024. blizzard devs must be on crack, why not just use a float?
sc = scale / 1024.0f;
char tempname[512];
sprintf(tempname, "%s/%s", szWorkDirWmo, ModelInstName);
- FILE *input;
- input = fopen(tempname, "r+b");
+ FILE* input = fopen(tempname, "r+b");
- if(!input)
+ if (!input)
{
//printf("ModelInstance::ModelInstance couldn't open %s\n", tempname);
return;
@@ -167,7 +162,9 @@ ModelInstance::ModelInstance(MPQFile &f,const char* ModelInstName, uint32 mapID,
uint16 adtId = 0;// not used for models
uint32 flags = MOD_M2;
- if(tileX == 65 && tileY == 65) flags |= MOD_WORLDSPAWN;
+ if (tileX == 65 && tileY == 65)
+ flags |= MOD_WORLDSPAWN;
+
//write mapID, tileX, tileY, Flags, ID, Pos, Rot, Scale, name
fwrite(&mapID, sizeof(uint32), 1, pDirfile);
fwrite(&tileX, sizeof(uint32), 1, pDirfile);
diff --git a/src/tools/vmap4_extractor/model.h b/src/tools/vmap4_extractor/model.h
index a6f4e27583c..7dd69212b54 100644
--- a/src/tools/vmap4_extractor/model.h
+++ b/src/tools/vmap4_extractor/model.h
@@ -21,12 +21,9 @@
#include "loadlib/loadlib.h"
#include "vec3d.h"
-//#include "mpq.h"
#include "modelheaders.h"
#include <vector>
-class Model;
-class WMOInstance;
class MPQFile;
Vec3D fixCoordSystem(Vec3D v);
@@ -35,18 +32,14 @@ class Model
{
public:
ModelHeader header;
- uint32 offsBB_vertices, offsBB_indices;
- Vec3D *BB_vertices, *vertices;
- uint16 *BB_indices, *indices;
- size_t nIndices;
+ Vec3D* vertices;
+ uint16* indices;
bool open();
- bool ConvertToVMAPModel(const char * outfilename);
+ bool ConvertToVMAPModel(char const* outfilename);
- bool ok;
-
- Model(std::string &filename);
- ~Model() {_unload();}
+ Model(std::string& filename);
+ ~Model() { _unload(); }
private:
void _unload()
@@ -56,22 +49,22 @@ private:
vertices = NULL;
indices = NULL;
}
+
std::string filename;
- char outfilename;
};
class ModelInstance
{
public:
- Model *model;
+ Model* model;
uint32 id;
Vec3D pos, rot;
unsigned int d1, scale;
- float w,sc;
+ float w, sc;
- ModelInstance() {}
- ModelInstance(MPQFile &f,const char* ModelInstName, uint32 mapID, uint32 tileX, uint32 tileY, FILE *pDirfile);
+ ModelInstance() : model(NULL), d1(0), scale(0), w(0.0f), sc(0.0f), id(0) {}
+ ModelInstance(MPQFile& f, char const* ModelInstName, uint32 mapID, uint32 tileX, uint32 tileY, FILE* pDirfile);
};
diff --git a/src/tools/vmap4_extractor/mpq_libmpq04.h b/src/tools/vmap4_extractor/mpq_libmpq04.h
index ed51022de78..89f715e9e87 100644
--- a/src/tools/vmap4_extractor/mpq_libmpq04.h
+++ b/src/tools/vmap4_extractor/mpq_libmpq04.h
@@ -24,7 +24,7 @@ public:
void close();
void GetFileListTo(vector<string>& filelist) {
- uint32 filenum;
+ uint32_t filenum;
if(libmpq__file_number(mpq_a, "(listfile)", &filenum)) return;
libmpq__off_t size, transferred;
libmpq__file_unpacked_size(mpq_a, filenum, &size);
@@ -60,8 +60,8 @@ class MPQFile
libmpq__off_t pointer,size;
// disable copying
- MPQFile(const MPQFile &f) {}
- void operator=(const MPQFile &f) {}
+ MPQFile(const MPQFile& /*f*/) {}
+ void operator=(const MPQFile& /*f*/) {}
public:
MPQFile(const char* filename); // filenames are not case sensitive
diff --git a/src/tools/vmap4_extractor/vmapexport.cpp b/src/tools/vmap4_extractor/vmapexport.cpp
index e60a773c6de..40a22a2a6e0 100644
--- a/src/tools/vmap4_extractor/vmapexport.cpp
+++ b/src/tools/vmap4_extractor/vmapexport.cpp
@@ -159,12 +159,12 @@ bool ExtractSingleWmo(std::string& fname)
int p = 0;
//Select root wmo files
- const char * rchr = strrchr(plain_name, '_');
+ char const* rchr = strrchr(plain_name, '_');
if(rchr != NULL)
{
char cpy[4];
- strncpy((char*)cpy,rchr,4);
- for (int i=0;i < 4; ++i)
+ strncpy((char*)cpy, rchr, 4);
+ for (int i = 0; i < 4; ++i)
{
int m = cpy[i];
if(isdigit(m))
@@ -200,7 +200,7 @@ bool ExtractSingleWmo(std::string& fname)
strcpy(temp, fname.c_str());
temp[fname.length()-4] = 0;
char groupFileName[1024];
- sprintf(groupFileName,"%s_%03d.wmo",temp, i);
+ sprintf(groupFileName, "%s_%03u.wmo", temp, i);
//printf("Trying to open groupfile %s\n",groupFileName);
string s = groupFileName;
@@ -382,9 +382,9 @@ bool processArgv(int argc, char ** argv, const char *versionString)
{
bool result = true;
hasInputPathParam = false;
- bool preciseVectorData = false;
+ preciseVectorData = false;
- for(int i=1; i< argc; ++i)
+ for(int i = 1; i < argc; ++i)
{
if(strcmp("-s",argv[i]) == 0)
{
@@ -447,7 +447,7 @@ int main(int argc, char ** argv)
const char *versionString = "V4.00 2012_02";
// Use command line arguments, when some
- if(!processArgv(argc, argv, versionString))
+ if (!processArgv(argc, argv, versionString))
return 1;
// some simple check if working dir is dirty
@@ -469,7 +469,7 @@ int main(int argc, char ** argv)
printf("Extract %s. Beginning work ....\n",versionString);
//xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
// Create the working directory
- if(mkdir(szWorkDirWmo
+ if (mkdir(szWorkDirWmo
#ifdef __linux__
, 0711
#endif
@@ -482,11 +482,11 @@ int main(int argc, char ** argv)
for (size_t i=0; i < archiveNames.size(); ++i)
{
MPQArchive *archive = new MPQArchive(archiveNames[i].c_str());
- if(!gOpenArchives.size() || gOpenArchives.front() != archive)
+ if (gOpenArchives.empty() || gOpenArchives.front() != archive)
delete archive;
}
- if(gOpenArchives.empty())
+ if (gOpenArchives.empty())
{
printf("FATAL ERROR: None MPQ archive found by path '%s'. Use -d option with proper path.\n",input_path);
return 1;
@@ -494,15 +494,15 @@ int main(int argc, char ** argv)
ReadLiquidTypeTableDBC();
// extract data
- if(success)
+ if (success)
success = ExtractWmo();
//xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
//map.dbc
- if(success)
+ if (success)
{
DBCFile * dbc = new DBCFile("DBFilesClient\\Map.dbc");
- if(!dbc->open())
+ if (!dbc->open())
{
delete dbc;
printf("FATAL ERROR: Map.dbc not found in data file.\n");
@@ -510,7 +510,7 @@ int main(int argc, char ** argv)
}
map_count=dbc->getRecordCount ();
map_ids=new map_id[map_count];
- for(unsigned int x=0;x<map_count;++x)
+ for (unsigned int x=0;x<map_count;++x)
{
map_ids[x].id=dbc->getRecord (x).getUInt(0);
strcpy(map_ids[x].name,dbc->getRecord(x).getString(1));
@@ -527,7 +527,7 @@ int main(int argc, char ** argv)
}
printf("\n");
- if(!success)
+ if (!success)
{
printf("ERROR: Extract %s. Work NOT complete.\n Precise vector data=%d.\nPress any key.\n",versionString, preciseVectorData);
getchar();
diff --git a/src/tools/vmap4_extractor/wdtfile.cpp b/src/tools/vmap4_extractor/wdtfile.cpp
index e3ee545db19..a799a928710 100644
--- a/src/tools/vmap4_extractor/wdtfile.cpp
+++ b/src/tools/vmap4_extractor/wdtfile.cpp
@@ -30,7 +30,7 @@ char * wdtGetPlainName(char * FileName)
return FileName;
}
-WDTFile::WDTFile(char* file_name, char* file_name1):WDT(file_name)
+WDTFile::WDTFile(char* file_name, char* file_name1) : WDT(file_name), gWmoInstansName(NULL), gnWMO(0)
{
filename.append(file_name1,strlen(file_name1));
}
@@ -78,9 +78,8 @@ bool WDTFile::init(char *map_id, unsigned int mapID)
char *p=buf;
int q = 0;
gWmoInstansName = new string[size];
- while (p<buf+size)
+ while (p < buf + size)
{
- string path(p);
char* s=wdtGetPlainName(p);
fixnamen(s,strlen(s));
p=p+strlen(p)+1;
@@ -89,23 +88,20 @@ bool WDTFile::init(char *map_id, unsigned int mapID)
delete[] buf;
}
}
- else if (!strcmp(fourcc,"MODF"))
+ else if (!strcmp(fourcc, "MODF"))
{
// global wmo instance data
if (size)
{
gnWMO = (int)size / 64;
- string gWMO_mapname;
- string fake_mapname;
- fake_mapname = "65 65 ";
- //gWMO_mapname = fake_mapname + filename;
- gWMO_mapname = fake_mapname + std::string(map_id);
- for (int i=0; i<gnWMO; ++i)
+
+ for (int i = 0; i < gnWMO; ++i)
{
int id;
WDT.read(&id, 4);
- WMOInstance inst(WDT,gWmoInstansName[id].c_str(),mapID, 65, 65, dirfile);
+ WMOInstance inst(WDT,gWmoInstansName[id].c_str(), mapID, 65, 65, dirfile);
}
+
delete[] gWmoInstansName;
}
}
diff --git a/src/tools/vmap4_extractor/wdtfile.h b/src/tools/vmap4_extractor/wdtfile.h
index f3d71c41791..2c66dbceb92 100644
--- a/src/tools/vmap4_extractor/wdtfile.h
+++ b/src/tools/vmap4_extractor/wdtfile.h
@@ -13,16 +13,15 @@ class WDTFile
public:
WDTFile(char* file_name, char* file_name1);
~WDTFile(void);
- bool init(char *map_id, unsigned int mapID);
+ bool init(char* map_id, unsigned int mapID);
string* gWmoInstansName;
- int gnWMO, nMaps;
+ int gnWMO;
ADTFile* GetMap(int x, int z);
private:
MPQFile WDT;
- bool maps[64][64];
string filename;
};
diff --git a/src/tools/vmap4_extractor/wmo.cpp b/src/tools/vmap4_extractor/wmo.cpp
index 6703872111b..0bc749b9bd5 100644
--- a/src/tools/vmap4_extractor/wmo.cpp
+++ b/src/tools/vmap4_extractor/wmo.cpp
@@ -31,8 +31,12 @@
using namespace std;
extern uint16 *LiqType;
-WMORoot::WMORoot(std::string &filename) : filename(filename)
+WMORoot::WMORoot(std::string &filename)
+ : filename(filename), col(0), nTextures(0), nGroups(0), nP(0), nLights(0),
+ nModels(0), nDoodads(0), nDoodadSets(0), RootWMOID(0), liquidType(0)
{
+ memset(bbcorn1, 0, sizeof(bbcorn1));
+ memset(bbcorn2, 0, sizeof(bbcorn2));
}
bool WMORoot::open()
@@ -57,7 +61,7 @@ bool WMORoot::open()
size_t nextpos = f.getPos() + size;
- if (!strcmp(fourcc,"MOHD"))//header
+ if (!strcmp(fourcc,"MOHD")) // header
{
f.read(&nTextures, 4);
f.read(&nGroups, 4);
@@ -68,8 +72,8 @@ bool WMORoot::open()
f.read(&nDoodadSets, 4);
f.read(&col, 4);
f.read(&RootWMOID, 4);
- f.read(bbcorn1,12);
- f.read(bbcorn2,12);
+ f.read(bbcorn1, 12);
+ f.read(bbcorn2, 12);
f.read(&liquidType, 4);
break;
}
@@ -120,15 +124,15 @@ bool WMORoot::open()
return true;
}
-bool WMORoot::ConvertToVMAPRootWmo(FILE *pOutfile)
+bool WMORoot::ConvertToVMAPRootWmo(FILE* pOutfile)
{
//printf("Convert RootWmo...\n");
- fwrite(szRawVMAPMagic,1,8,pOutfile);
+ fwrite(szRawVMAPMagic, 1, 8, pOutfile);
unsigned int nVectors = 0;
- fwrite(&nVectors,sizeof(nVectors),1,pOutfile); // will be filled later
- fwrite(&nGroups,4,1,pOutfile);
- fwrite(&RootWMOID,4,1,pOutfile);
+ fwrite(&nVectors,sizeof(nVectors), 1, pOutfile); // will be filled later
+ fwrite(&nGroups, 4, 1, pOutfile);
+ fwrite(&RootWMOID, 4, 1, pOutfile);
return true;
}
@@ -136,9 +140,13 @@ WMORoot::~WMORoot()
{
}
-WMOGroup::WMOGroup(std::string &filename) : filename(filename),
- MOPY(0), MOVI(0), MoviEx(0), MOVT(0), MOBA(0), MobaEx(0), hlq(0), LiquEx(0), LiquBytes(0)
+WMOGroup::WMOGroup(const std::string &filename) :
+ filename(filename), MOPY(0), MOVI(0), MoviEx(0), MOVT(0), MOBA(0), MobaEx(0),
+ hlq(0), LiquEx(0), LiquBytes(0), groupName(0), descGroupName(0), mogpFlags(0),
+ mopy_size(0), moba_size(0), LiquEx_size(0), nVertices(0), nTriangles(0)
{
+ memset(bbcorn1, 0, sizeof(bbcorn1));
+ memset(bbcorn2, 0, sizeof(bbcorn2));
}
bool WMOGroup::open()
@@ -237,7 +245,7 @@ bool WMOGroup::open()
return true;
}
-int WMOGroup::ConvertToVMAPGroupWmo(FILE *output, WMORoot *rootWMO, bool pPreciseVectorData)
+int WMOGroup::ConvertToVMAPGroupWmo(FILE *output, WMORoot *rootWMO, bool preciseVectorData)
{
fwrite(&mogpFlags,sizeof(uint32),1,output);
fwrite(&groupWMOID,sizeof(uint32),1,output);
@@ -246,7 +254,7 @@ int WMOGroup::ConvertToVMAPGroupWmo(FILE *output, WMORoot *rootWMO, bool pPrecis
fwrite(bbcorn2, sizeof(float), 3, output);
fwrite(&liquflags,sizeof(uint32),1,output);
int nColTriangles = 0;
- if(pPreciseVectorData)
+ if (preciseVectorData)
{
char GRP[] = "GRP ";
fwrite(GRP,1,4,output);
@@ -479,10 +487,9 @@ WMOGroup::~WMOGroup()
delete [] LiquBytes;
}
-WMOInstance::WMOInstance(MPQFile &f,const char* WmoInstName, uint32 mapID, uint32 tileX, uint32 tileY, FILE *pDirfile)
+WMOInstance::WMOInstance(MPQFile& f, char const* WmoInstName, uint32 mapID, uint32 tileX, uint32 tileY, FILE* pDirfile)
+ : currx(0), curry(0), wmo(NULL), doodadset(0), pos(), indx(0), d3(0)
{
- pos = Vec3D(0,0,0);
-
float ff[3];
f.read(&id, 4);
f.read(ff,12);
diff --git a/src/tools/vmap4_extractor/wmo.h b/src/tools/vmap4_extractor/wmo.h
index d1f7b82f0c6..74e666d3f82 100644
--- a/src/tools/vmap4_extractor/wmo.h
+++ b/src/tools/vmap4_extractor/wmo.h
@@ -50,14 +50,13 @@ public:
float bbcorn1[3];
float bbcorn2[3];
- WMORoot(std::string &filename);
+ WMORoot(std::string& filename);
~WMORoot();
bool open();
- bool ConvertToVMAPRootWmo(FILE *output);
+ bool ConvertToVMAPRootWmo(FILE* output);
private:
std::string filename;
- char outfilename;
};
struct WMOLiquidHeader
@@ -89,30 +88,29 @@ public:
uint16 nBatchB;
uint32 nBatchC, fogIdx, liquidType, groupWMOID;
- int mopy_size,moba_size;
+ int mopy_size, moba_size;
int LiquEx_size;
unsigned int nVertices; // number when loaded
int nTriangles; // number when loaded
- char *MOPY;
- uint16 *MOVI;
- uint16 *MoviEx;
- float *MOVT;
- uint16 *MOBA;
- int *MobaEx;
- WMOLiquidHeader *hlq;
- WMOLiquidVert *LiquEx;
- char *LiquBytes;
+ char* MOPY;
+ uint16* MOVI;
+ uint16* MoviEx;
+ float* MOVT;
+ uint16* MOBA;
+ int* MobaEx;
+ WMOLiquidHeader* hlq;
+ WMOLiquidVert* LiquEx;
+ char* LiquBytes;
uint32 liquflags;
- WMOGroup(std::string &filename);
+ WMOGroup(std::string const& filename);
~WMOGroup();
bool open();
- int ConvertToVMAPGroupWmo(FILE *output, WMORoot *rootWMO, bool pPreciseVectorData);
+ int ConvertToVMAPGroupWmo(FILE* output, WMORoot* rootWMO, bool preciseVectorData);
private:
std::string filename;
- char outfilename;
};
class WMOInstance
@@ -122,13 +120,13 @@ public:
std::string MapName;
int currx;
int curry;
- WMOGroup *wmo;
+ WMOGroup* wmo;
Vec3D pos;
Vec3D pos2, pos3, rot;
- uint32 indx,id, d2, d3;
+ uint32 indx, id, d2, d3;
int doodadset;
- WMOInstance(MPQFile &f,const char* WmoInstName, uint32 mapID, uint32 tileX, uint32 tileY, FILE *pDirfile);
+ WMOInstance(MPQFile&f , char const* WmoInstName, uint32 mapID, uint32 tileX, uint32 tileY, FILE* pDirfile);
static void reset();
};