feat. Add option to Learn or cast spells (#30)

* feat. Add option to Learn or cast spells

* boolean learn attribute
This commit is contained in:
Walter Pagani 2023-09-05 05:17:05 -03:00 committed by GitHub
parent 8e4aef41dc
commit 494cde182c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 104 additions and 69 deletions

47
.github/README.md vendored
View file

@ -1,47 +0,0 @@
# ![logo](https://raw.githubusercontent.com/azerothcore/azerothcore.github.io/master/images/logo-github.png) AzerothCore
## mod-congrats-on-level
### This is a module for [AzerothCore](http://www.azerothcore.org)
- Latest build status with azerothcore:
[![Build Status](https://github.com/azerothcore/mod-congrats-on-level/workflows/core-build/badge.svg?branch=master&event=push)](https://github.com/azerothcore/mod-congrats-on-level)
#### Features:
This module rewards players when they reach specific levels. It has the option to reward gold, two items, and a buff or any combination. It also announces to the world when a player levels up. All rewards can be set in the config file for quick modifications.
### This module currently requires:
- AzerothCore v1.0.1+
### How to install
1. Simply place the module under the `modules` folder of your AzerothCore source folder.
2. Re-run cmake and launch a clean build of AzerothCore
3. Done :)
### Usage
- Type: Player/Server
- Script: CongratsOnLevel
- Config: Yes
- Enable Module
- Enable Module Announce
- Set Items/Gold/Buffs Given At Each Level
## Credits
- [SoulSeekkor](https://github.com/SoulSeekkor)
- [LordPsyan](https://bitbucket.org/lordpsyan/lordpsyan-patches)
- [Blizzard Entertainment](http://blizzard.com)
- [TrinityCore](https://github.com/TrinityCore/TrinityCore/blob/3.3.5/THANKS)
- [SunwellCore](http://www.azerothcore.org/pages/sunwell.pl/)
- [AzerothCore](https://github.com/AzerothCore/azerothcore-wotlk/graphs/contributors)
- [AzerothCore Discord](https://discord.gg/gkt4y2x)
- [EMUDevs](https://youtube.com/user/EmuDevs)
- [AC-Web](http://ac-web.org/)
- [ModCraft.io](http://modcraft.io/)
- [OwnedCore](http://ownedcore.com/)
- [OregonCore](https://wiki.oregon-core.net/)
- [Wowhead.com](http://wowhead.com)
- [AoWoW](https://wotlk.evowow.com/)
- [Stygianthebest]( http://stygianthebest.github.io)
AzerothCore: [repository](https://github.com/azerothcore) - [website](http://azerothcore.org/) - [discord chat community](https://discord.gg/PaqQRkd)

76
README.md Normal file
View file

@ -0,0 +1,76 @@
# ![logo](https://raw.githubusercontent.com/azerothcore/azerothcore.github.io/master/images/logo-github.png) AzerothCore
## mod-congrats-on-level
### This is a module for [AzerothCore](http://www.azerothcore.org)
- Latest build status with azerothcore:
[![Build Status](https://github.com/azerothcore/mod-congrats-on-level/workflows/core-build/badge.svg?branch=master&event=push)](https://github.com/azerothcore/mod-congrats-on-level)
### About the module
This module allows you to configure a series of prizes, by class, race and levels. To the extent that players reach these levels, they can obtain gold, spells, or items. If you don't want to deliver any of them, it's always possible to leave it at 0. All items were moved to the database. Inside the table, you could customize the prizes, however you want.
### Table structure
1. `level`: Level that the player must have to get the reward.
2. `money`: Amount of money to deliver, it can be 0.
3. `spell`: Id of the spell that you want to teach or cast, it can be 0.
4. `learn`: If it's 0, the spell is cast. If it is 1, it is learned.
5. `itemId1`: Id of the item that you want to deliver, it can be 0.
6. `itemId2`: Id of the item that you want to deliver, it can be 0.
7. `race`: 0 for all or specify race id.
8. `class`: 0 for all, or specify the class id.
| ID | className (enUS) |
|----|------------------|
| 1 | Warrior |
| 2 | Paladin |
| 3 | Hunter |
| 4 | Rogue |
| 5 | Priest |
| 6 | Death Knight |
| 7 | Shaman |
| 8 | Mage |
| 9 | Warlock |
| 11 | Druid |
| ID | Race .raceName (enUS) | Faction .name (enUS) |
|----|-----------------------|----------------------|
| 1 | Human | Alliance |
| 2 | Orc | Horde |
| 3 | Dwarf | Alliance |
| 4 | Night Elf | Alliance |
| 5 | Undead | Horde |
| 6 | Tauren | Horde |
| 7 | Gnome | Alliance |
| 8 | Troll | Horde |
| 10 | Blood Elf | Horde |
| 11 | Draenei | Alliance |
### How to install
1. Simply place the module under the `modules` folder of your AzerothCore source folder.
2. Re-run cmake and launch a clean build of AzerothCore
3. Done :)
## Credits
- [SoulSeekkor](https://github.com/SoulSeekkor)
- [LordPsyan](https://bitbucket.org/lordpsyan/lordpsyan-patches)
- [Blizzard Entertainment](http://blizzard.com)
- [TrinityCore](https://github.com/TrinityCore/TrinityCore/blob/3.3.5/THANKS)
- [SunwellCore](http://www.azerothcore.org/pages/sunwell.pl/)
- [AzerothCore](https://github.com/AzerothCore/azerothcore-wotlk/graphs/contributors)
- [AzerothCore Discord](https://discord.gg/gkt4y2x)
- [EMUDevs](https://youtube.com/user/EmuDevs)
- [AC-Web](http://ac-web.org/)
- [ModCraft.io](http://modcraft.io/)
- [OwnedCore](http://ownedcore.com/)
- [OregonCore](https://wiki.oregon-core.net/)
- [Wowhead.com](http://wowhead.com)
- [AoWoW](https://wotlk.evowow.com/)
- [Stygianthebest]( http://stygianthebest.github.io)
- AzerothCore: [repository](https://github.com/azerothcore)
- [website](http://azerothcore.org/)
- [discord chat community](https://discord.gg/PaqQRkd)

View file

@ -1,8 +1,8 @@
[worldserver]
###################################################################################################
#############################
# CONGRATS ON LEVEL-UP
###################################################################################################
#############################
# Enable the module? (1: true | 0: false)

View file

@ -1,20 +1,21 @@
CREATE TABLE IF NOT EXISTS `mod_congrats_on_level_items` (
`level` tinyint unsigned NOT NULL DEFAULT '0',
`money` int unsigned NOT NULL DEFAULT '0',
`spell` int unsigned NOT NULL DEFAULT '0',
`itemId1` int unsigned NOT NULL DEFAULT '0',
`itemId2` int unsigned NOT NULL DEFAULT '0',
`race` tinyint unsigned NOT NULL DEFAULT '0',
`class` tinyint unsigned NOT NULL DEFAULT '0'
`level` tinyint unsigned NOT NULL DEFAULT 0,
`money` int unsigned NOT NULL DEFAULT 0,
`spell` int unsigned NOT NULL DEFAULT 0,
`learn` boolean NOT NULL DEFAULT false,
`itemId1` int unsigned NOT NULL DEFAULT 0,
`itemId2` int unsigned NOT NULL DEFAULT 0,
`race` tinyint unsigned NOT NULL DEFAULT 0,
`class` tinyint unsigned NOT NULL DEFAULT 0
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
DELETE FROM `mod_congrats_on_level_items`;
INSERT INTO `mod_congrats_on_level_items` (`level`, `money`, `spell`, `itemId1`, `itemId2`, `race`, `class`) VALUES
(10, 1, 20217, 3419, 45063, 0, 0),
(20, 10, 48161, 5433, 38578, 0, 0),
(30, 15, 48469, 18231, 46780, 0, 0),
(40, 20, 20217, 31945, 49704, 0, 0),
(50, 25, 48161, 11382, 32542, 0, 0),
(60, 30, 48469, 37863, 33219, 0, 0),
(70, 35, 48161, 9360, 54212, 0, 0),
(80, 100, 20217, 9361, 40110, 0, 0);
INSERT INTO `mod_congrats_on_level_items` (`level`, `money`, `spell`, `learn`, `itemId1`, `itemId2`, `race`, `class`) VALUES
(10, 1, 20217, 0, 3419, 45063, 0, 0),
(20, 10, 48161, 0, 5433, 38578, 0, 0),
(30, 15, 48469, 0, 18231, 46780, 0, 0),
(40, 20, 20217, 0, 31945, 49704, 0, 0),
(50, 25, 48161, 0, 11382, 32542, 0, 0),
(60, 30, 48469, 0, 37863, 33219, 0, 0),
(70, 35, 48161, 0, 9360, 54212, 0, 0),
(80, 100, 20217, 0, 9361, 40110, 0, 0);

View file

@ -94,11 +94,16 @@ uint32 giveAward(Player* player)
money += fields[1].Get<uint32>() * GOLD;
}
if (fields[2].Get<uint32>() > 0)
{
if (fields[3].Get<uint32>() == 0)
player->CastSpell(player, fields[2].Get<uint32>());
if (fields[3].Get<uint32>() > 0)
player->AddItem(fields[3].Get<uint32>(), 1);
if (fields[4].Get<uint32>())
else
player->learnSpell(fields[2].Get<uint32>());
}
if (fields[4].Get<uint32>() > 0)
player->AddItem(fields[4].Get<uint32>(), 1);
if (fields[5].Get<uint32>())
player->AddItem(fields[5].Get<uint32>(), 1);
}
while (result->NextRow());