Skip to content

Commit

Permalink
Merge branch '3.3.5' into npcbots_3.3.5
Browse files Browse the repository at this point in the history
# Conflicts:
#	src/server/game/Entities/Creature/Creature.cpp
#	src/server/game/Entities/Unit/Unit.cpp
#	src/server/game/Entities/Vehicle/Vehicle.cpp
#	src/server/game/Spells/Spell.cpp
#	src/server/scripts/Spells/spell_druid.cpp
#	src/server/scripts/Spells/spell_generic.cpp
#	src/server/scripts/Spells/spell_paladin.cpp
#	src/server/scripts/Spells/spell_priest.cpp
#	src/server/scripts/Spells/spell_rogue.cpp
  • Loading branch information
trickerer committed Aug 31, 2024
2 parents f93a683 + fc735e3 commit 650389e
Show file tree
Hide file tree
Showing 389 changed files with 3,025 additions and 2,486 deletions.
6 changes: 5 additions & 1 deletion .github/workflows/codestyle.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,12 @@ jobs:
if: github.repository == 'azerothcore/azerothcore-wotlk'
steps:
- uses: actions/checkout@v4
- name: Setup python
uses: actions/setup-python@v4
with:
python-version: '3.10'
- name: AzerothCore codestyle
run: source ./apps/ci/ci-codestyle.sh
run: python ./apps/codestyle/codestyle.py
- name: C++ Advanced
run: |
sudo apt update -y
Expand Down
40 changes: 0 additions & 40 deletions apps/ci/ci-codestyle.sh

This file was deleted.

148 changes: 148 additions & 0 deletions apps/codestyle/codestyle.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,148 @@
import io
import os
import sys

# Get the src directory of the project
src_directory = os.path.join(os.getcwd(), 'src')

# Global variables
error_handler = False
results = {
"Multiple blank lines check": "Passed",
"Trailing whitespace check": "Passed",
"GetCounter() check": "Passed",
"GetTypeId() check": "Passed",
"NpcFlagHelpers check": "Passed"
}

# Main function to parse all the files of the project
def parsing_file(directory: str) -> None:
for root, _, files in os.walk(directory):
for file in files:
if not file.endswith('.ico'): # Skip .ico files that cannot be read
file_path = os.path.join(root, file)
file_name = file
try:
with open(file_path, 'r', encoding='utf-8') as file:
multiple_blank_lines_check(file, file_path)
trailing_whitespace_check(file, file_path)
get_counter_check(file, file_path)
if file_name != 'Object.h':
get_typeid_check(file, file_path)
if file_name != 'Unit.h':
npcflags_helpers_check(file, file_path)
except UnicodeDecodeError:
print(f"\nCould not decode file {file_path}")
sys.exit(1)
# Output the results
print("")
for check, result in results.items():
print(f"{check} : {result}")
if error_handler:
print("\nPlease fix the codestyle issues above.")
sys.exit(1)
else:
print(f"\nEverything looks good")

# Codestyle patterns checking for multiple blank lines
def multiple_blank_lines_check(file: io, file_path: str) -> None:
global error_handler, results
file.seek(0) # Reset file pointer to the beginning
check_failed = False
consecutive_blank_lines = 0
# Parse all the file
for line_number, line in enumerate(file, start = 1):
if line.strip() == '':
consecutive_blank_lines += 1
if consecutive_blank_lines > 1:
print(f"Multiple blank lines found in {file_path} at line {line_number - 1}")
check_failed = True
else:
consecutive_blank_lines = 0
# Additional check for the end of the file
if consecutive_blank_lines >= 1:
print(f"Multiple blank lines found at the end of: {file_path}")
check_failed = True
# Handle the script error and update the result output
if check_failed:
error_handler = True
results["Multiple blank lines check"] = "Failed"

# Codestyle patterns checking for whitespace at the end of the lines
def trailing_whitespace_check(file: io, file_path: str) -> None:
global error_handler, results
file.seek(0) # Reset file pointer to the beginning
# Parse all the file
for line_number, line in enumerate(file, start = 1):
if line.endswith(' \n'):
print(f"Trailing whitespace found: {file_path} at line {line_number}")
if not error_handler:
error_handler = True
results["Trailing whitespace check"] = "Failed"

# Codestyle patterns checking for ObjectGuid::GetCounter()
def get_counter_check(file: io, file_path: str) -> None:
global error_handler, results
file.seek(0) # Reset file pointer to the beginning
# Parse all the file
for line_number, line in enumerate(file, start = 1):
if 'ObjectGuid::GetCounter()' in line:
print(f"Please use ObjectGuid::ToString().c_str() instead ObjectGuid::GetCounter(): {file_path} at line {line_number}")
if not error_handler:
error_handler = True
results["GetCounter() check"] = "Failed"

# Codestyle patterns checking for GetTypeId()
def get_typeid_check(file: io, file_path: str) -> None:
global error_handler, results
file.seek(0) # Reset file pointer to the beginning
check_failed = False
# Parse all the file
for line_number, line in enumerate(file, start = 1):
if 'GetTypeId() == TYPEID_PLAYER' in line:
print(f"Please use IsPlayer() instead GetTypeId(): {file_path} at line {line_number}")
check_failed = True
if 'GetTypeId() == TYPEID_ITEM' in line:
print(f"Please use IsItem() instead GetTypeId(): {file_path} at line {line_number}")
check_failed = True
if 'GetTypeId() == TYPEID_DYNOBJECT' in line:
print(f"Please use IsDynamicObject() instead GetTypeId(): {file_path} at line {line_number}")
check_failed = True
# Handle the script error and update the result output
if check_failed:
error_handler = True
results["GetTypeId() check"] = "Failed"

# Codestyle patterns checking for NpcFlag helpers
def npcflags_helpers_check(file: io, file_path: str) -> None:
global error_handler, results
file.seek(0) # Reset file pointer to the beginning
check_failed = False
# Parse all the file
for line_number, line in enumerate(file, start = 1):
if 'GetUInt32Value(UNIT_NPC_FLAGS)' in line:
print(
f"Please use GetNpcFlags() instead GetUInt32Value(UNIT_NPC_FLAGS): {file_path} at line {line_number}")
check_failed = True
if 'HasFlag(UNIT_NPC_FLAGS,' in line:
print(
f"Please use HasNpcFlag() instead HasFlag(UNIT_NPC_FLAGS, ...): {file_path} at line {line_number}")
check_failed = True
if 'SetUInt32Value(UNIT_NPC_FLAGS,' in line:
print(
f"Please use ReplaceAllNpcFlags() instead SetUInt32Value(UNIT_NPC_FLAGS, ...): {file_path} at line {line_number}")
check_failed = True
if 'SetFlag(UNIT_NPC_FLAGS,' in line:
print(
f"Please use SetNpcFlag() instead SetFlag(UNIT_NPC_FLAGS, ...): {file_path} at line {line_number}")
check_failed = True
if 'RemoveFlag(UNIT_NPC_FLAGS,' in line:
print(
f"Please use RemoveNpcFlag() instead RemoveFlag(UNIT_NPC_FLAGS, ...): {file_path} at line {line_number}")
# Handle the script error and update the result output
if check_failed:
error_handler = True
results["NpcFlagHelpers check"] = "Failed"

# Main function
parsing_file(src_directory)
25 changes: 18 additions & 7 deletions apps/installer/includes/os_configs/debian.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,27 @@ if ! command -v lsb_release &>/dev/null ; then
fi

DEBIAN_VERSION=$(lsb_release -sr)
DEBIAN_VERSION_MIN="12"

if [[ $DEBIAN_VERSION -lt $DEBIAN_VERSION_MIN ]]; then
echo "########## ########## ##########"
echo ""
echo " using unsupported Debian version" $DEBIAN_VERSION
echo " please update to Debian" $DEBIAN_VERSION_MIN "or later"
echo ""
echo "########## ########## ##########"
fi

sudo apt-get update -y

sudo apt-get install -y gdbserver gdb unzip curl \
libncurses-dev libreadline-dev clang g++ \
gcc git cmake make ccache
gcc git cmake make ccache \
default-libmysqlclient-dev libssl-dev libbz2-dev \
libboost-all-dev gnupg wget

if [[ $DEBIAN_VERSION -eq "10" ]]; then
sudo apt-get install -y default-libmysqlclient-dev libssl-dev libreadline-dev libncurses-dev mariadb-server
libboost-system1.6*-dev libboost-filesystem1.6*-dev libboost-program-options1.6*-dev libboost-iostreams1.6*-dev \
else # Debian 8 and 9 should work using this
sudo apt-get install -y libmysqlclient-dev libssl1.0-dev mysql-server
fi
# run noninteractive install for MYSQL 8.4 LTS
wget https://dev.mysql.com/get/mysql-apt-config_0.8.32-1_all.deb
sudo DEBIAN_FRONTEND="noninteractive" dpkg -i ./mysql-apt-config_0.8.32-1_all.deb
sudo apt-get update
sudo DEBIAN_FRONTEND="noninteractive" apt-get install -y mysql-server
41 changes: 28 additions & 13 deletions apps/installer/includes/os_configs/ubuntu.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,26 +4,41 @@ fi

UBUNTU_VERSION=$(lsb_release -sr);

case $UBUNTU_VERSION in
"22.04")
;;
"24.04")
;;
*)
echo "########## ########## ##########"
echo ""
echo " using unsupported Ubuntu version " $UBUNTU_VERSION
echo " please update to Ubuntu 22.04 or later"
echo ""
echo "########## ########## ##########"
;;
esac

sudo apt update

# shared deps
sudo apt-get -y install ccache clang cmake curl google-perftools libmysqlclient-dev make unzip
sudo DEBIAN_FRONTEND="noninteractive" \
apt-get -y install ccache clang cmake curl google-perftools libmysqlclient-dev make unzip

if [[ $CONTINUOUS_INTEGRATION || $DOCKER ]]; then
# TODO: update CI / Docker section for Ubuntu 22.04+
sudo add-apt-repository -y ppa:mhier/libboost-latest && sudo apt update && sudo apt-get -y install build-essential cmake-data \
libboost1.74-dev libbz2-dev libncurses5-dev libmysql++-dev libgoogle-perftools-dev libreadline6-dev libssl-dev libtool \
openssl zlib1g-dev
else
case $UBUNTU_VERSION in
"20.04")
sudo apt-get install -y g++ gdb gdbserver gcc git \
libboost-all-dev libbz2-dev libncurses-dev libreadline-dev \
libssl-dev mysql-server
;;
*)
sudo add-apt-repository -y ppa:mhier/libboost-latest && sudo apt update && sudo apt-get install -y g++ gdb gdbserver gcc git \
libboost-all-dev libbz2-dev libncurses-dev libreadline-dev \
libssl-dev mysql-server
;;
esac
sudo DEBIAN_FRONTEND="noninteractive" \
apt-get install -y g++ gdb gdbserver gcc git \
libboost-all-dev libbz2-dev libncurses-dev libreadline-dev \
libssl-dev

# run noninteractive install for MYSQL 8.4 LTS
wget https://dev.mysql.com/get/mysql-apt-config_0.8.32-1_all.deb
sudo DEBIAN_FRONTEND="noninteractive" dpkg -i ./mysql-apt-config_0.8.32-1_all.deb
sudo apt-get update
sudo DEBIAN_FRONTEND="noninteractive" apt-get install -y mysql-server
fi
13 changes: 13 additions & 0 deletions data/sql/updates/db_world/2024_08_25_00.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
-- DB update 2024_08_22_01 -> 2024_08_25_00
UPDATE `creature_template` SET `AIName`='SmartAI' WHERE `entry`=23569;
DELETE FROM `smart_scripts` WHERE `entryorguid`=23569 AND `source_type`=0;
DELETE FROM `smart_scripts` WHERE `entryorguid`=2356900 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
(23569,0,0,1,62,0,100,0,8837,0,0,0,134,42670,0,0,0,0,0,7,0,0,0,0,0,0,0,'Renn McGill - On Gossip Option 0 Selected - Invoker Cast \'Replace Repaired Diving Gear\''),
(23569,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,'Renn McGill - On Gossip Option 0 Selected - Close Gossip'),
(23569,0,2,0,20,0,100,0,11140,0,0,0,80,2356900,0,0,0,0,0,1,0,0,0,0,0,0,0,'Renn McGill - On Quest \'Recover the Cargo!\' Finished - Run Script'),
(2356900,9,0,0,0,0,100,0,0,0,0,0,83,3,0,0,0,0,0,1,0,0,0,0,0,0,0,'Renn McGill - On Script - Remove Npc Flag Questgiver+Gossip'),
(2356900,9,1,0,0,0,100,0,1000,1000,0,0,1,0,0,0,0,0,0,1,0,0,0,0,0,0,0,'Renn McGill - On Script - Say Line 0'),
(2356900,9,2,0,0,0,100,0,4000,4000,0,0,1,1,0,0,0,0,0,1,0,0,0,0,0,0,0,'Renn McGill - On Script - Say Line 1'),
(2356900,9,3,0,0,0,100,0,5000,5000,0,0,1,2,0,0,0,0,0,1,0,0,0,0,0,0,0,'Renn McGill - On Script - Say Line 2'),
(2356900,9,4,0,0,0,100,0,6000,6000,0,0,82,3,0,0,0,0,0,1,0,0,0,0,0,0,0,'Renn McGill - On Script - Add Npc Flag Questgiver+Gossip');
9 changes: 9 additions & 0 deletions data/sql/updates/db_world/2024_08_26_00.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
-- DB update 2024_08_25_00 -> 2024_08_26_00
-- Fix the target_type for Chain lightning and Psychic Scream spells with Twilight Prophet
SET @ENTRY := 15308;
DELETE FROM `smart_scripts` WHERE (`source_type` = 0) AND (`entryorguid` = @ENTRY);
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`, `event_param5`, `event_param6`, `action_type`, `action_param1`, `action_param2`, `action_param3`, `action_param4`, `action_param5`, `action_param6`, `target_type`, `target_param1`, `target_param2`, `target_param3`, `target_param4`, `target_x`, `target_y`, `target_z`, `target_o`, `comment`) VALUES
(@ENTRY, 0, 0, 0, 0, 0, 100, 0, 4000, 4500, 12000, 15000, 0, 0, 11, 15305, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 'Twilight Prophet - In Combat - Cast Chain Lightning'),
(@ENTRY, 0, 1, 0, 0, 0, 100, 0, 8000, 9000, 25000, 28000, 0, 0, 11, 22884, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 'Twilight Prophet - In Combat - Cast Psychic Scream'),
(@ENTRY, 0, 2, 0, 106, 0, 100, 0, 16000, 19000, 16000, 19000, 0, 8, 11, 17366, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 'Twilight Prophet - Within 0-8 Range - Cast Fire Nova'),
(@ENTRY, 0, 3, 0, 106, 0, 100, 0, 16000, 19000, 16000, 19000, 0, 8, 11, 15531, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 'Twilight Prophet - Within 0-8 Range - Cast Frost Nova');
5 changes: 5 additions & 0 deletions data/sql/updates/db_world/2024_08_26_01.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
-- DB update 2024_08_26_00 -> 2024_08_26_01
--
DELETE FROM `spell_script_names` WHERE `spell_id` = 41360;
INSERT INTO `spell_script_names` (`spell_id`, `ScriptName`) VALUES
(41360, 'spell_black_temple_l5_arcane_charge');
Loading

0 comments on commit 650389e

Please sign in to comment.