Forums WoW Modding Support Archives Azerothcore Discord Archives [DiscordArchive] You have two onLogin functions.

[DiscordArchive] You have two onLogin functions.

[DiscordArchive] You have two onLogin functions.

Pages (2): 1 2 Next
rektbyfaith
Administrator
0
09-09-2025, 02:17 PM
#1
Archived author: Aldori • Posted: 2025-09-09T14:17:58.573000+00:00
Original source

You have two onLogin functions.

You should also look into mapping those spell IDs to a table and then loop through that table for removing the racials. Something like RACIALS_TO_REMOVE. That way you don’t need to write out RemoveSpell a bunch of times. It’s a lot of duplicate code.

Also, are you wanting/meaning to delete & relearn the racial spells on each login?
rektbyfaith
09-09-2025, 02:17 PM #1

Archived author: Aldori • Posted: 2025-09-09T14:17:58.573000+00:00
Original source

You have two onLogin functions.

You should also look into mapping those spell IDs to a table and then loop through that table for removing the racials. Something like RACIALS_TO_REMOVE. That way you don’t need to write out RemoveSpell a bunch of times. It’s a lot of duplicate code.

Also, are you wanting/meaning to delete & relearn the racial spells on each login?

rektbyfaith
Administrator
0
09-09-2025, 02:25 PM
#2
Archived author: Band • Posted: 2025-09-09T14:25:41.205000+00:00
Original source

That is a great point... I should probably just create a table like the original mod does and do that. I could even store the variables in a table as well. I guess I was trying to do everything in the script since it was easier to manage at a glance.

The reason why is that currently there is an issue with the mod that causes racials to be reverted back to their defaults when the character logs back in. It is tied to this setting in the worldserver config. I was scared to turn that off because it could cause issues itself and I believe the Playerbots module uses spell validation a lot
[Image: image.png?ex=690c0725&is=690ab5a5&hm=08c...56ced8d02&]
rektbyfaith
09-09-2025, 02:25 PM #2

Archived author: Band • Posted: 2025-09-09T14:25:41.205000+00:00
Original source

That is a great point... I should probably just create a table like the original mod does and do that. I could even store the variables in a table as well. I guess I was trying to do everything in the script since it was easier to manage at a glance.

The reason why is that currently there is an issue with the mod that causes racials to be reverted back to their defaults when the character logs back in. It is tied to this setting in the worldserver config. I was scared to turn that off because it could cause issues itself and I believe the Playerbots module uses spell validation a lot
[Image: image.png?ex=690c0725&is=690ab5a5&hm=08c...56ced8d02&]

rektbyfaith
Administrator
0
09-09-2025, 02:35 PM
#3
Archived author: Aldori • Posted: 2025-09-09T14:35:21.334000+00:00
Original source

Also if I’m not mistaken, the RemoveSpell function should also remove the known spell from the character_spell table so you probably don’t need to call both dbCleanRacials and removeAllRacials functions.

Or a better approach would be to first add a check if the player knows said spell before attempting to remove it. You can just loop through the spell IDs if you map them to a table

if player:HasSpell() then player:RemoveSpell().
rektbyfaith
09-09-2025, 02:35 PM #3

Archived author: Aldori • Posted: 2025-09-09T14:35:21.334000+00:00
Original source

Also if I’m not mistaken, the RemoveSpell function should also remove the known spell from the character_spell table so you probably don’t need to call both dbCleanRacials and removeAllRacials functions.

Or a better approach would be to first add a check if the player knows said spell before attempting to remove it. You can just loop through the spell IDs if you map them to a table

if player:HasSpell() then player:RemoveSpell().

rektbyfaith
Administrator
0
09-09-2025, 02:39 PM
#4
Archived author: Band • Posted: 2025-09-09T14:39:08.604000+00:00
Original source

I originally attempted with just using the RemoveSpell function but ran into the SQL Insert issue from before, only after including the character_spell table deletes did it stop. It was weird and would revert my player back to its original state after logging out because the validation failed
rektbyfaith
09-09-2025, 02:39 PM #4

Archived author: Band • Posted: 2025-09-09T14:39:08.604000+00:00
Original source

I originally attempted with just using the RemoveSpell function but ran into the SQL Insert issue from before, only after including the character_spell table deletes did it stop. It was weird and would revert my player back to its original state after logging out because the validation failed

rektbyfaith
Administrator
0
09-09-2025, 02:43 PM
#5
Archived author: Aldori • Posted: 2025-09-09T14:43:06.533000+00:00
Original source

Gotcha. Probably a weird scenario with that config setting then.

So what I would do then is just add the check for if the player knows the spell prior to calling RemoveSpell. Map all of those IDs to the table and through it.

Also don’t forget about the second onLogin function. You might get weird issues with that
rektbyfaith
09-09-2025, 02:43 PM #5

Archived author: Aldori • Posted: 2025-09-09T14:43:06.533000+00:00
Original source

Gotcha. Probably a weird scenario with that config setting then.

So what I would do then is just add the check for if the player knows the spell prior to calling RemoveSpell. Map all of those IDs to the table and through it.

Also don’t forget about the second onLogin function. You might get weird issues with that

rektbyfaith
Administrator
0
09-09-2025, 02:43 PM
#6
Archived author: Band • Posted: 2025-09-09T14:43:58.202000+00:00
Original source

Yea I removed that, it was an error of mine. Thanks for catching it

Do you foresee many database issues using this method? I am already working on creating the sql table to store the variables for the player and the racial spell IDs
rektbyfaith
09-09-2025, 02:43 PM #6

Archived author: Band • Posted: 2025-09-09T14:43:58.202000+00:00
Original source

Yea I removed that, it was an error of mine. Thanks for catching it

Do you foresee many database issues using this method? I am already working on creating the sql table to store the variables for the player and the racial spell IDs

rektbyfaith
Administrator
0
09-09-2025, 02:45 PM
#7
Archived author: Aldori • Posted: 2025-09-09T14:45:35.369000+00:00
Original source

Oh you don’t need to create a sql table. I meant a local table in the script. Otherwise you’ll be adding an extra DB call to get those
rektbyfaith
09-09-2025, 02:45 PM #7

Archived author: Aldori • Posted: 2025-09-09T14:45:35.369000+00:00
Original source

Oh you don’t need to create a sql table. I meant a local table in the script. Otherwise you’ll be adding an extra DB call to get those

rektbyfaith
Administrator
0
09-09-2025, 02:45 PM
#8
Archived author: Band • Posted: 2025-09-09T14:45:54.465000+00:00
Original source

Ohhhhhhhhhh... I have no idea how to do that
rektbyfaith
09-09-2025, 02:45 PM #8

Archived author: Band • Posted: 2025-09-09T14:45:54.465000+00:00
Original source

Ohhhhhhhhhh... I have no idea how to do that

rektbyfaith
Administrator
0
09-09-2025, 02:46 PM
#9
Archived author: Aldori • Posted: 2025-09-09T14:46:04.434000+00:00
Original source

You see “local NAME_TO_RACE = {“ near the top?

That’s a table.
rektbyfaith
09-09-2025, 02:46 PM #9

Archived author: Aldori • Posted: 2025-09-09T14:46:04.434000+00:00
Original source

You see “local NAME_TO_RACE = {“ near the top?

That’s a table.

rektbyfaith
Administrator
0
09-09-2025, 02:46 PM
#10
Archived author: Aldori • Posted: 2025-09-09T14:46:46.550000+00:00
Original source

So you’d make a SPELLS_TO_REMOVE = { x, y, z }
rektbyfaith
09-09-2025, 02:46 PM #10

Archived author: Aldori • Posted: 2025-09-09T14:46:46.550000+00:00
Original source

So you’d make a SPELLS_TO_REMOVE = { x, y, z }

Pages (2): 1 2 Next
Recently Browsing
 
Recently Browsing