Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Commands] #npcspawn Changes #4311

Merged
merged 9 commits into from
May 16, 2024

Conversation

twincannon
Copy link
Contributor

Description

While populating zones with new NPCs I ran into a few issues, this PR aims to solve them and improve workflow using the #npcspawn and #npcedit commands.

This PR adds a new argument to the npcspawn command, "clone", which references an already existing but unused function that copies an NPC including spawngroup, only creating a spawn2 entry.

After making this command I found that #npcspawn remove was no longer functioning as intended, as it simply removed the first spawn2 entry it found - not necessarily the targeted NPC's entry. I fixed this and also made an optional parameter to remove spawngroups or not (as using the command on a bunch of cloned NPCs would remove all of them if it also kills the spawngroup).

I've also modified #npcspawn create to set all of the NPCs stats based on the target NPC. This allows you to for example #dbspawn an existing NPC you want to work off of as a base, use #npcspawn create on it, and then work from there.

Also included in this PR is a tweak to #npcedit set_grid - allowing setting a grid of 0 (clearing the grid) and adding a zone shortname check to the query to ensure only the currently selected npc in the current zone will be edited in the database.

Type of change

  • New feature (non-breaking change which adds functionality)
  • This change requires a documentation update

Testing

I've been using these changes to populate a zone with NPCs and have been crosschecking the database to ensure everything is being added/removed/updated as it should be. I have tested the following:

  • #npcspawn create copying stats properly to the new npc_types entry
  • #npcspawn create properly naming the spawngroup with appended timestamp to avoid duplicate spawngroup entries
  • Using the optional parameter to set respawn time with #npcspawn create/add/clone
  • #npcspawn clone properly creating a new spawn2 entry with the same spawngroup as the targeted NPC
  • #npcspawn help properly printing the help text and returning
  • #npcspawn remove optional param properly removing the spawngroup of the targeted NPC if set
  • #npcspawn create/add/clone all use the clients current position/heading instead of the targeted NPCs position for better ease of placing NPC spawns
  • #npcedit set_grid allowing values of 0 and properly applying it, and the query checking for which zone the NPC is in to avoid unintended row changes

Clients tested: RoF2

Checklist

  • I have tested my changes
  • I have performed a self-review of my code. Ensuring variables, functions and methods are named in a human-readable way, comments are added only where naming of variables, functions and methods can't give enough context.
  • I have made corresponding changes to the documentation (if applicable, if not delete this line)
  • I own the changes of my code and take responsibility for the potential issues that occur

zone/npc.cpp Outdated Show resolved Hide resolved
zone/npc.cpp Outdated Show resolved Hide resolved
zone/zonedb.h Outdated Show resolved Hide resolved
zone/npc.cpp Outdated Show resolved Hide resolved
zone/npc.cpp Outdated Show resolved Hide resolved
@Kinglykrab
Copy link
Contributor

Looks good, minor comments.

Appreciate your contribution and hope to see more from you!

@twincannon
Copy link
Contributor Author

Responded to the comments, thanks for reviewing!

@Kinglykrab Kinglykrab changed the title [Commands] npcspawn command changes [Commands] #npcspawn Changes May 16, 2024
@Kinglykrab Kinglykrab merged commit c87aadb into EQEmu:master May 16, 2024
1 check passed
@Akkadius Akkadius mentioned this pull request May 26, 2024
catapultam-habeo pushed a commit to The-Heroes-Journey-EQEMU/Server that referenced this pull request Jul 14, 2024
* Changes to npcspawn create command so it takes more stats from the target npc

* Add see invis stats to npccreate command

* WIP npcspawn command changes

* Add npcspawn clone and help args, fix some broken things with npcspawn

* Cleanup comments and add apostraphes to zone shortname query

* Make it so npcspawn remove only removes spawn2 row and optionally removes spawngroup and spawnentry, make create and add spawn the npc at client loc

* Make npcspawn create use the same syntax for spawngroup naming as npcspawn add

* Revert npcspawn create and add to use npc location rather than client, other misc tweaks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants