EQMacEmu / Server

Other
28 stars 92 forks source link

Teach npcs to sacrifice #54

Closed fuzzlecutter closed 1 month ago

regneq commented 1 month ago

Could you give a description to what this suppose to do? I mean why would a npc sacrifice itself?

fuzzlecutter commented 1 month ago

This enables an npc to cast sacrifice on clients. The purpose is for a quest.

fuzzlecutter commented 1 month ago
            e.self:Emote("looks at you grinning. 'Very well. I will take your essence. You have served us well!', he says, chuckling to himself.");
            e.self:Cast(1768, e.other:GetID());
regneq commented 1 month ago

oh? what NPC is this that cast this? Quest name?

fuzzlecutter commented 1 month ago

Oh, that's not a live quest. Sorry for the confusion. It's a quest I'm adding, custom content. I figured this commit was generic enough that it could be used on takp or other takp forks.

regneq commented 1 month ago

Actually, this doesn't need to be hardcoded. You can just quest it to add item to the NPC loot.

fuzzlecutter commented 1 month ago

Hmm.. I suppose I could simulate the spell landing with timers, in a sense, via lua. Is the non-rezzable exp death doable via the lua api atm?

regneq commented 1 month ago

it can be made that way. not sure if we currently have lua api that does that. if not, can create one for it. Here's the list of lua corpse: https://github.com/EQMacEmu/Server/blob/main/zone/lua_corpse.cpp

fuzzlecutter commented 1 month ago

So to go this alternative route, I either would need to

  1. Generalize Client::Sacrifice to accept Mob (and thus Client or NPC) as a parameter, because, as is, it would seg fault / be undefined behavior to call with a nullptr or an NPC. Then expose that method in lua_client.
  2. Reimplement the Client::Sacrifice logic in lua.

Honestly would prefer the original approach as it is more generic (removed the hardcoded limitation preventing NPCs from casting sacrifice) and reuses the existing sacrifice, level limits, and exp loss logic.

fuzzlecutter commented 1 month ago

This was merged upstream in eqemu, https://github.com/EQEmu/Server/commit/cc0171dfe1d77393afd1b7b77029d9e5e8a48990

If you'd prefer, could merge in that commit, and close this PR.