Skip to content

Add /killbless, /killpotion and /noflask commands - #15

Open
Valadez601 wants to merge 4 commits into
AstoniaCommunity:mainfrom
Valadez601:Potion-and-bless-commands
Open

Add /killbless, /killpotion and /noflask commands#15
Valadez601 wants to merge 4 commits into
AstoniaCommunity:mainfrom
Valadez601:Potion-and-bless-commands

Conversation

@Valadez601

Copy link
Copy Markdown
Contributor

/killbless (/killb) removes any Bless spells on the pc /killpotion (/killp) removes any stat potion spells from the pc /noflask prevents the creation of empty flasks when using health/mana/combo or stat potions.

Added CF_TUTOR to CF_Tab in create.c for parity with server.h

/killbless (/killb) removes any Bless spells on the pc
/killpotion (/killp) removes any stat potion spells from the pc
/noflask prevents the creation of empty flasks when using health/mana/combo or stat potions.

Added CF_TUTOR to CF_Tab in create.c for parity with server.h
/killpotion now correctly states that a potion wasn't not found if one isn't active rather than saying that Bless isn't found.
Changed "Another potion is still active." to mention that /killpotion can be used.

@DanielBrockhaus DanielBrockhaus left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

24.01.26 19:09:11 [003-01]: item Empty Potion (19465): not linked. fixing.
24.01.26 19:09:11 [003-01]: ITEM: name=Empty Potion, description=A small flask made of glass.
24.01.26 19:09:11 [003-01]: ITEM: value=25, ID=0, driver=32
24.01.26 19:09:11 [003-01]: ITEM: mod 0: index=0, value=0
24.01.26 19:09:11 [003-01]: ITEM: mod 1: index=0, value=0
24.01.26 19:09:11 [003-01]: ITEM: mod 2: index=0, value=0
24.01.26 19:09:11 [003-01]: ITEM: mod 3: index=0, value=0
24.01.26 19:09:11 [003-01]: ITEM: mod 4: index=0, value=0

You need to also free the items you remove from characters:

remove_item_char(in);
free_item(in);

Please always test your code, and check the .elog.

@eddoww

eddoww commented Jan 26, 2026

Copy link
Copy Markdown
Member
24.01.26 19:09:11 [003-01]: item Empty Potion (19465): not linked. fixing.
24.01.26 19:09:11 [003-01]: ITEM: name=Empty Potion, description=A small flask made of glass.
24.01.26 19:09:11 [003-01]: ITEM: value=25, ID=0, driver=32
24.01.26 19:09:11 [003-01]: ITEM: mod 0: index=0, value=0
24.01.26 19:09:11 [003-01]: ITEM: mod 1: index=0, value=0
24.01.26 19:09:11 [003-01]: ITEM: mod 2: index=0, value=0
24.01.26 19:09:11 [003-01]: ITEM: mod 3: index=0, value=0
24.01.26 19:09:11 [003-01]: ITEM: mod 4: index=0, value=0

You need to also free the items you remove from characters:

remove_item_char(in);
free_item(in);

Please always test your code, and check the .elog.

Perfect oppertunity for using a util function, something like :
remove_item() in drvlib.c (I moved this away from drvlib.c and into tool.c, probably a good idea). Or introduce a similar function that does all the things required for removing items, instead of writing duplicate code lines all over.

edit: I shouldn't reply before reading properly, you suggested pretty much exactly that :D

@DanielBrockhaus DanielBrockhaus left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Still getting errors when using healing potions:

Image

@Valadez601

Copy link
Copy Markdown
Contributor Author

That's odd. I didn't get any further errors despite testing it over several days and using potions while testing a quest.

I'll test further.

@Valadez601

Copy link
Copy Markdown
Contributor Author

Could it have been a leftover unfreed item from prior?

@DanielBrockhaus

DanielBrockhaus commented Jan 29, 2026

Copy link
Copy Markdown
Collaborator

It happens right away:

image image image

Comment thread src/base.c
it[in].drdata[2] * POWERSCALE);

if (empty) replace_item_char(in, in2);
if (empty && (!(ch[cn].flags & CF_NOFLASK))) replace_item_char(in, in2);

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

in2 gets lost here.

A much cleaner way would be to not create the empty bottle in the first place.

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.

3 participants