Page 1 of 1

Set Max HP

Posted: Tue May 07, 2019 9:33 am
by Gangrenous
Regarding this prior post

https://www.eq2emulator.net/phpBB3/view ... xhp#p33640

Could someone please make this change. If we send a character sheet change, it fixes it.
LuaFunctions.cpp around 1273

Code: Select all

int EQ2Emu_lua_SetMaxHP(lua_State* state){
	if(!lua_interface)
		return 0;
	Spawn* spawn = lua_interface->GetSpawn(state);
	sint32 value = lua_interface->GetSInt32Value(state, 2);
	lua_interface->ResetFunctionStack(state);
	if (spawn && spawn->IsEntity() && value > 0)
		((Entity*)spawn)->AddSpellBonus(0, ITEM_STAT_HEALTH, value - spawn->GetTotalHP());
	
	if (spawn->IsPlayer())
			((Player*)spawn)->SetCharSheetChanged(true);
		
	return 0;
}

Re: Set Max HP

Posted: Tue May 07, 2019 12:29 pm
by Jabantiz
Committed this change.

Re: Set Max HP

Posted: Tue May 07, 2019 2:34 pm
by Ememjr
any idea when the compile will be fixed, or is it

Re: Set Max HP

Posted: Tue May 07, 2019 3:59 pm
by Jabantiz
I just checked and my connection was refused so no clue when it will be back.

Re: Set Max HP

Posted: Tue May 07, 2019 5:21 pm
by Gangrenous
What is the issue anyway? I hear bits and pieces.

Re: Set Max HP

Posted: Tue May 07, 2019 6:09 pm
by Jabantiz
Currently ssh is refusing connections so we can't remote connect to the server at this time.

Re: Set Max HP

Posted: Wed May 08, 2019 4:08 am
by Ememjr
this same change should most likely be made to SetMaxPower as well in fact, any script that uses ((Entity*)spawn)->AddSpellBonus( should be following it with SetCharSheetChanged(true);

or better yet maybe the void Entity::AddSpellBonus() function should call SetCharSheetChanged(true); then none of the lua functions would have to call it any more, but i am sure there are many reasons it would not work

Re: Set Max HP

Posted: Wed May 08, 2019 4:20 pm
by Jabantiz
I would have thought that AddSpellBonus() would set the flag if it was a player and if the spell got applied but yea it would be better to put it in there then having it scattered across multiple lua function.

Re: Set Max HP

Posted: Wed May 08, 2019 4:51 pm
by Gangrenous
I concur