Forums WoW Modding Support Archives Azerothcore Discord Archives [DiscordArchive] I have a question about the SendAddonMessage function: I see there are 2 player pointers, one called

[DiscordArchive] I have a question about the SendAddonMessage function: I see there are 2 player pointers, one called

[DiscordArchive] I have a question about the SendAddonMessage function: I see there are 2 player pointers, one called

Pages (2): Previous 1 2
rektbyfaith
Administrator
0
08-19-2025, 05:31 PM
#11
Archived author: Badgermilk • Posted: 2025-08-19T17:31:18.344000+00:00
Original source

I could use some guidance from more experienced programmers..
I have (with LLMs) created a script that checks account name prefixes and collects a party fee depending on some parameters.
It works, I have done quite a bit of tests with no crashing etc.

But could someone take a read and see if it looks "ok" considering I cannot gauge if it is written in a proper way?
https://pastebin.com/5C2cLC5k
rektbyfaith
08-19-2025, 05:31 PM #11

Archived author: Badgermilk • Posted: 2025-08-19T17:31:18.344000+00:00
Original source

I could use some guidance from more experienced programmers..
I have (with LLMs) created a script that checks account name prefixes and collects a party fee depending on some parameters.
It works, I have done quite a bit of tests with no crashing etc.

But could someone take a read and see if it looks "ok" considering I cannot gauge if it is written in a proper way?
https://pastebin.com/5C2cLC5k

rektbyfaith
Administrator
0
08-19-2025, 07:05 PM
#12
Archived author: Foe • Posted: 2025-08-19T19:05:51.731000+00:00
Original source

The GetAccName helper function is a little silly
rektbyfaith
08-19-2025, 07:05 PM #12

Archived author: Foe • Posted: 2025-08-19T19:05:51.731000+00:00
Original source

The GetAccName helper function is a little silly

rektbyfaith
Administrator
0
08-19-2025, 07:07 PM
#13
Archived author: Foe • Posted: 2025-08-19T19:07:01.948000+00:00
Original source

Your table structure can be changed to use just the min as the key, then do a reverse loop
rektbyfaith
08-19-2025, 07:07 PM #13

Archived author: Foe • Posted: 2025-08-19T19:07:01.948000+00:00
Original source

Your table structure can be changed to use just the min as the key, then do a reverse loop

rektbyfaith
Administrator
0
08-19-2025, 07:07 PM
#14
Archived author: Foe • Posted: 2025-08-19T19:07:08.549000+00:00
Original source

Much more efficient and less noise
rektbyfaith
08-19-2025, 07:07 PM #14

Archived author: Foe • Posted: 2025-08-19T19:07:08.549000+00:00
Original source

Much more efficient and less noise

rektbyfaith
Administrator
0
08-19-2025, 07:19 PM
#15
Archived author: Foe • Posted: 2025-08-19T19:19:08.361000+00:00
Original source

```Lua
local LEVEL_FEES = {
{level = 1, cost = 10}, -- 10 copper per hour
{level = 15, cost = 1250}, -- 50 silver per hour
{level = 20, cost = 2500}, -- 1 gold per hour
{level = 25, cost = 2500}, -- 1 gold per hour
{level = 30, cost = 3125}, -- 1.25 gold per hour
{level = 35, cost = 3125}, -- 1.25 gold per hour
{level = 40, cost = 3750}, -- 1.5 gold per hour
{level = 45, cost = 3750}, -- 1.5 gold per hour
{level = 51, cost = 4375}, -- 1.75 gold per hour
{level = 55, cost = 5000}, -- 2 gold per hour
{level = 60, cost = 6250}, -- 2.5 gold per hour
{level = 61, cost = 12500}, -- 5 gold per hour
{level = 64, cost = 12500}, -- 5 gold per hour
{level = 67, cost = 18750}, -- 7.5 gold per hour
{level = 70, cost = 25000}, -- 10 gold per hour
{level = 71, cost = 31250}, -- 12.5 gold per hour
{level = 74, cost = 31250}, -- 12.5 gold per hour
{level = 77, cost = 33750}, -- 13.5 gold per hour
{level = 80, cost = 37500}, -- 15 gold per hour
}

local function GetFeeForLevel(level)
for i = #LEVEL_FEES, 1, -1 do
local bracket = LEVEL_FEES[i]
if level >= bracket.level then
return bracket.cost
end
end
return 0
end```
rektbyfaith
08-19-2025, 07:19 PM #15

Archived author: Foe • Posted: 2025-08-19T19:19:08.361000+00:00
Original source

```Lua
local LEVEL_FEES = {
{level = 1, cost = 10}, -- 10 copper per hour
{level = 15, cost = 1250}, -- 50 silver per hour
{level = 20, cost = 2500}, -- 1 gold per hour
{level = 25, cost = 2500}, -- 1 gold per hour
{level = 30, cost = 3125}, -- 1.25 gold per hour
{level = 35, cost = 3125}, -- 1.25 gold per hour
{level = 40, cost = 3750}, -- 1.5 gold per hour
{level = 45, cost = 3750}, -- 1.5 gold per hour
{level = 51, cost = 4375}, -- 1.75 gold per hour
{level = 55, cost = 5000}, -- 2 gold per hour
{level = 60, cost = 6250}, -- 2.5 gold per hour
{level = 61, cost = 12500}, -- 5 gold per hour
{level = 64, cost = 12500}, -- 5 gold per hour
{level = 67, cost = 18750}, -- 7.5 gold per hour
{level = 70, cost = 25000}, -- 10 gold per hour
{level = 71, cost = 31250}, -- 12.5 gold per hour
{level = 74, cost = 31250}, -- 12.5 gold per hour
{level = 77, cost = 33750}, -- 13.5 gold per hour
{level = 80, cost = 37500}, -- 15 gold per hour
}

local function GetFeeForLevel(level)
for i = #LEVEL_FEES, 1, -1 do
local bracket = LEVEL_FEES[i]
if level >= bracket.level then
return bracket.cost
end
end
return 0
end```

rektbyfaith
Administrator
0
08-19-2025, 07:19 PM
#16
Archived author: Foe • Posted: 2025-08-19T19:19:14.885000+00:00
Original source

Something like that
rektbyfaith
08-19-2025, 07:19 PM #16

Archived author: Foe • Posted: 2025-08-19T19:19:14.885000+00:00
Original source

Something like that

rektbyfaith
Administrator
0
08-19-2025, 07:23 PM
#17
Archived author: Foe • Posted: 2025-08-19T19:23:47.050000+00:00
Original source

But ideally you should cache this to the player after looking it up once, so you don't have to check it constantly
rektbyfaith
08-19-2025, 07:23 PM #17

Archived author: Foe • Posted: 2025-08-19T19:23:47.050000+00:00
Original source

But ideally you should cache this to the player after looking it up once, so you don't have to check it constantly

rektbyfaith
Administrator
0
08-19-2025, 07:39 PM
#18
Archived author: Badgermilk • Posted: 2025-08-19T19:39:18.593000+00:00
Original source

Thank you, I will try to make some changes!
rektbyfaith
08-19-2025, 07:39 PM #18

Archived author: Badgermilk • Posted: 2025-08-19T19:39:18.593000+00:00
Original source

Thank you, I will try to make some changes!

Pages (2): Previous 1 2
Recently Browsing
 1 Guest(s)
Recently Browsing
 1 Guest(s)