Forums WoW Modding Support Archives Azerothcore Discord Archives [DiscordArchive] I see file called core in the ac folder that the crash file?

[DiscordArchive] I see file called core in the ac folder that the crash file?

[DiscordArchive] I see file called core in the ac folder that the crash file?

rektbyfaith
Administrator
0
03-21-2025, 09:09 AM
#1
Archived author: Sanderis • Posted: 2025-03-21T09:09:30.306000+00:00
Original source

I see file called core in the ac folder that the crash file?
rektbyfaith
03-21-2025, 09:09 AM #1

Archived author: Sanderis • Posted: 2025-03-21T09:09:30.306000+00:00
Original source

I see file called core in the ac folder that the crash file?

rektbyfaith
Administrator
0
03-21-2025, 09:33 AM
#2
Archived author: Sanderis • Posted: 2025-03-21T09:33:43.686000+00:00
Original source

local VENDOR_ENTRY = 9000002
local COMMAND_NAME = "vendor"
local COOLDOWN_TIME = 300

local function Debug(message)
print("[VendorScript] " .. message)
end

local function HandleCooldown(player)
local currentTime = os.time()
local lastUse = player:GetData("VendorSummonLastUse")

if lastUse then
local timeLeft = COOLDOWN_TIME - (currentTime - lastUse)
if timeLeft > 0 then
local minutes = math.floor(timeLeft / 60)
local seconds = timeLeft % 60
player:SendBroadcastMessage(string.format("Vendor is on cooldown. Please wait %d minutes and %d seconds.", minutes, seconds))
return false
end
end

player:SetData("VendorSummonLastUse", currentTime)
return true
end

local function OnSpawn(event, creature)
if creature:GetEntry() == VENDOR_ENTRY then
Debug("Vendor NPC spawned")

creature:SetLevel(83)
creature:SetNPCFlags(4225)
end
end

local function RegisterVendorCommand(event, player, command)
if command == COMMAND_NAME then
Debug("Command executed by player: " .. player:GetName())

if not HandleCooldown(player) then
Debug("Player is on cooldown")
return false
end

if player:InBattleground() then
player:SendBroadcastMessage("You cannot summon a Vendor while in a battleground!")
Debug("Player is in battleground")
return false
end

local x = player:GetX()
local y = player:GetY()
local z = player:GetZ()
local o = player:GetO()

Debug("Player position: " .. x .. ", " .. y .. ", " .. z)

local vendor = PerformIngameSpawn(1, VENDOR_ENTRY, player:GetMapId(), player:GetInstanceId(), x, y, z+0.5, o, false, 180000)

if vendor then
Debug("NPC spawned successfully with ID: " .. vendor:GetEntry())

player:SetData("VendorSummonedGUID", vendor:GetGUID())

vendor:SendUnitSay("at your service! You can sell items and repair your gear.", 0)

player:SendBroadcastMessage("Vendor summoned! They will despawn in 3 minutes.")
else
Debug("Failed to spawn NPC")
player:SendBroadcastMessage("Failed to summon Vendor. Please try again or contact a GM.")
player:SetData("VendorSummonLastUse", nil)
end

return false
end
end

local function OnPlayerLogout(event, player)
local vendorGUID = player:GetData("VendorSummonedGUID")

if vendorGUID then
Debug("Player " .. player:GetName() .. " logged out, cleaning up summoned NPC")

local map = player:GetMap()
if map then
local npc = map:GetCreature(vendorGUID)
if npc then
Debug("Despawning NPC with GUID: " .. vendorGUID)
npcBig GrinespawnOrUnsummon(0)
end
end

player:SetData("VendorSummonedGUID", nil)
end
end

RegisterPlayerEvent(42, RegisterVendorCommand)
RegisterPlayerEvent(4, OnPlayerLogout)
RegisterCreatureEvent(VENDOR_ENTRY, 5, OnSpawn)
rektbyfaith
03-21-2025, 09:33 AM #2

Archived author: Sanderis • Posted: 2025-03-21T09:33:43.686000+00:00
Original source

local VENDOR_ENTRY = 9000002
local COMMAND_NAME = "vendor"
local COOLDOWN_TIME = 300

local function Debug(message)
print("[VendorScript] " .. message)
end

local function HandleCooldown(player)
local currentTime = os.time()
local lastUse = player:GetData("VendorSummonLastUse")

if lastUse then
local timeLeft = COOLDOWN_TIME - (currentTime - lastUse)
if timeLeft > 0 then
local minutes = math.floor(timeLeft / 60)
local seconds = timeLeft % 60
player:SendBroadcastMessage(string.format("Vendor is on cooldown. Please wait %d minutes and %d seconds.", minutes, seconds))
return false
end
end

player:SetData("VendorSummonLastUse", currentTime)
return true
end

local function OnSpawn(event, creature)
if creature:GetEntry() == VENDOR_ENTRY then
Debug("Vendor NPC spawned")

creature:SetLevel(83)
creature:SetNPCFlags(4225)
end
end

local function RegisterVendorCommand(event, player, command)
if command == COMMAND_NAME then
Debug("Command executed by player: " .. player:GetName())

if not HandleCooldown(player) then
Debug("Player is on cooldown")
return false
end

if player:InBattleground() then
player:SendBroadcastMessage("You cannot summon a Vendor while in a battleground!")
Debug("Player is in battleground")
return false
end

local x = player:GetX()
local y = player:GetY()
local z = player:GetZ()
local o = player:GetO()

Debug("Player position: " .. x .. ", " .. y .. ", " .. z)

local vendor = PerformIngameSpawn(1, VENDOR_ENTRY, player:GetMapId(), player:GetInstanceId(), x, y, z+0.5, o, false, 180000)

if vendor then
Debug("NPC spawned successfully with ID: " .. vendor:GetEntry())

player:SetData("VendorSummonedGUID", vendor:GetGUID())

vendor:SendUnitSay("at your service! You can sell items and repair your gear.", 0)

player:SendBroadcastMessage("Vendor summoned! They will despawn in 3 minutes.")
else
Debug("Failed to spawn NPC")
player:SendBroadcastMessage("Failed to summon Vendor. Please try again or contact a GM.")
player:SetData("VendorSummonLastUse", nil)
end

return false
end
end

local function OnPlayerLogout(event, player)
local vendorGUID = player:GetData("VendorSummonedGUID")

if vendorGUID then
Debug("Player " .. player:GetName() .. " logged out, cleaning up summoned NPC")

local map = player:GetMap()
if map then
local npc = map:GetCreature(vendorGUID)
if npc then
Debug("Despawning NPC with GUID: " .. vendorGUID)
npcBig GrinespawnOrUnsummon(0)
end
end

player:SetData("VendorSummonedGUID", nil)
end
end

RegisterPlayerEvent(42, RegisterVendorCommand)
RegisterPlayerEvent(4, OnPlayerLogout)
RegisterCreatureEvent(VENDOR_ENTRY, 5, OnSpawn)

rektbyfaith
Administrator
0
03-21-2025, 09:33 AM
#3
Archived author: Sanderis • Posted: 2025-03-21T09:33:53.744000+00:00
Original source

**How does this look?**
rektbyfaith
03-21-2025, 09:33 AM #3

Archived author: Sanderis • Posted: 2025-03-21T09:33:53.744000+00:00
Original source

**How does this look?**

rektbyfaith
Administrator
0
03-21-2025, 03:29 PM
#4
Archived author: metallinos • Posted: 2025-03-21T15:29:44.067000+00:00
Original source

There's some chatGPT-like code and hallucinations in here, you should try to verify the functions against the API on https://www.azerothcore.org/eluna/index.html
[Embed: Eluna API]
API documentation for the Eluna engine.
https://www.azerothcore.org/eluna/index.html
rektbyfaith
03-21-2025, 03:29 PM #4

Archived author: metallinos • Posted: 2025-03-21T15:29:44.067000+00:00
Original source

There's some chatGPT-like code and hallucinations in here, you should try to verify the functions against the API on https://www.azerothcore.org/eluna/index.html
[Embed: Eluna API]
API documentation for the Eluna engine.
https://www.azerothcore.org/eluna/index.html

rektbyfaith
Administrator
0
03-21-2025, 03:31 PM
#5
Archived author: Sanderis • Posted: 2025-03-21T15:31:23.192000+00:00
Original source

Only used it to guide me since I'm new lol
rektbyfaith
03-21-2025, 03:31 PM #5

Archived author: Sanderis • Posted: 2025-03-21T15:31:23.192000+00:00
Original source

Only used it to guide me since I'm new lol

rektbyfaith
Administrator
0
03-21-2025, 03:31 PM
#6
Archived author: metallinos • Posted: 2025-03-21T15:31:30.935000+00:00
Original source

It looks a lot better than before though, much leaner and nice use of setdata. You don't have to set the data to nil on logout as it's destructed on logout anyway
rektbyfaith
03-21-2025, 03:31 PM #6

Archived author: metallinos • Posted: 2025-03-21T15:31:30.935000+00:00
Original source

It looks a lot better than before though, much leaner and nice use of setdata. You don't have to set the data to nil on logout as it's destructed on logout anyway

rektbyfaith
Administrator
0
03-21-2025, 03:31 PM
#7
Archived author: Sanderis • Posted: 2025-03-21T15:31:54.001000+00:00
Original source

Thank you
rektbyfaith
03-21-2025, 03:31 PM #7

Archived author: Sanderis • Posted: 2025-03-21T15:31:54.001000+00:00
Original source

Thank you

rektbyfaith
Administrator
0
03-21-2025, 03:32 PM
#8
Archived author: metallinos • Posted: 2025-03-21T15:32:01.115000+00:00
Original source

Let me give it a quick spin to see if it's possible to store GUIDs in setdata. Pretty sure it's fine. Just gotta swap out GetCreature with GetWorldObject
rektbyfaith
03-21-2025, 03:32 PM #8

Archived author: metallinos • Posted: 2025-03-21T15:32:01.115000+00:00
Original source

Let me give it a quick spin to see if it's possible to store GUIDs in setdata. Pretty sure it's fine. Just gotta swap out GetCreature with GetWorldObject

rektbyfaith
Administrator
0
03-21-2025, 03:33 PM
#9
Archived author: Sanderis • Posted: 2025-03-21T15:33:19.155000+00:00
Original source

It's currently working for me at the moment.
rektbyfaith
03-21-2025, 03:33 PM #9

Archived author: Sanderis • Posted: 2025-03-21T15:33:19.155000+00:00
Original source

It's currently working for me at the moment.

Recently Browsing
 
Recently Browsing