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

Allow NPC view data modifications #4385

Merged
merged 25 commits into from Dec 22, 2019
Merged

Allow NPC view data modifications #4385

merged 25 commits into from Dec 22, 2019

Conversation

aleos89
Copy link
Contributor

@aleos89 aleos89 commented Oct 2, 2019

* Fixes #4289.
* Updated script commands setunitdata and getunitdata to support the modification of NPC view data.
* Converted mob_avail database to YAML.
Thanks to @4144, @exneval, and @Balferian!
@aleos89 aleos89 added the status:code-review Pull Request that requires reviewing from other developers before being pushed to master label Oct 2, 2019
@lgtm-com
Copy link

lgtm-com bot commented Oct 2, 2019

This pull request introduces 1 alert when merging 3980294 into df6385f - view on LGTM.com

new alerts:

  • 1 for Wrong type of arguments to formatting function

@Balferian
Copy link
Contributor

Balferian commented Oct 6, 2019

If npc have sprite = 0 without setunitdata UNPC_CLASS it looks like a novice.
Is this correct?
prontera,155,175,4 script NPCs 0,{ end; }
image

@aleos89
Copy link
Contributor Author

aleos89 commented Oct 6, 2019

Novice is ID 0, so that sounds right. UNPC_CLASS doesn't just mean job class, it refers to the general display of the NPC.

@attackjom
Copy link
Contributor

Try to walk around in thana_boss or juperos map

It will show a crash-popup.

@aleos89
Copy link
Contributor Author

aleos89 commented Oct 10, 2019

A client crash or map crash?

@Balferian
Copy link
Contributor

Balferian commented Oct 10, 2019

image
I think he say about novice sprite.
quests_juperos.txt
1681 | juperos_01,100,91,0 script jupe_goto#2 -1,2,2,{

@attackjom
Copy link
Contributor

for me these novice are headless and pop-up client crash

so , maybe it a client-side problem

@Balferian
Copy link
Contributor

Balferian commented Oct 10, 2019

Need to change function in map/npc.cpp:

struct npc_data *npc_create_npc(int m, int x, int y)
{
	struct npc_data *nd = NULL;

	CREATE(nd, struct npc_data, 1);
	nd->bl.id = npc_get_new_npc_id();
	nd->bl.prev = nd->bl.next = NULL;
	nd->bl.m = m;
	nd->bl.x = x;
	nd->bl.y = y;
	nd->area_size = AREA_SIZE + 1;
	nd->sc_display = NULL;
	nd->sc_display_count = 0;
	nd->progressbar.timeout = 0;
	nd->vd = npc_viewdb[0];

	return nd;
}

Now there is no novice sprite/client crash.

@Balferian
Copy link
Contributor

When use setunitdata getnpcid(0),UNPC_BODY2,1; map server crashed.

@aleos89
Copy link
Contributor Author

aleos89 commented Oct 17, 2019

Could you provide your crash dump? Thanks.

@Balferian
Copy link
Contributor

Sample script:
prontera,158,172,4 script NPCs 4_NFWISP,{
setunitdata getnpcid(0),UNPC_CLASS,4063;
setunitdata getnpcid(0),UNPC_HAIRSTYLE,1;
setunitdata getnpcid(0),UNPC_BODY2,1;
end;
}

`Program received signal SIGSEGV, Segmentation fault.
0x000000000046aa8f in clif_changelook (bl=0x7fffe2775a64, type=type@entry=13,
val=1) at clif.cpp:3704
warning: Source file is more recent than executable.
3704 if (val && sd->sc.option&OPTION_COSTUME)
Missing separate debuginfos, use: debuginfo-install glibc-2.17-260.el7_6.6.x86_64 libgcc-4.8.5-36.el7_6.2.x86_64 libstdc++-4.8.5-36.el7_6.2.x86_64 pcre-8.32-17.el7.x86_64 zlib-1.2.7-18.el7.x86_64
(gdb) bt full
#0 0x000000000046aa8f in clif_changelook (bl=0x7fffe2775a64,
type=type@entry=13, val=1) at clif.cpp:3704
sc = 0x7fffe2775f64
vd = 0x7fffe2775f44
sd = 0x0
target = AREA
val2 = 0
#1 0x0000000000588cb2 in buildin_setunitdata (st=0x7fffef816614)
at script.cpp:18308
hd = 0x7fffe08e52fc
ed = 0x194
nd = 0x7fffe2775a64
value =
FUNCTION = "buildin_setunitdata"

mc = 0x3
type = 43
mapname =
bl = 0x7fffe2775a64
md = 0x4bc0
pd = 0x562ea1 <pop_stack(script_state*, int, int)+529>
calc_status = false
#2 0x0000000000563b1d in run_func (st=st@entry=0x7fffef816614)
at script.cpp:4056
data =
i =
start_sp =
func = 404
end_sp =
#3 0x0000000000568b20 in run_script_main (st=0x7fffef816614)
at script.cpp:4331
c = C_FUNC
cmdcount = 655332
gotocount = 2048
sd =
stack = 0x7fffeb2eb44c
#4 0x00000000004eef03 in npc_click(map_session_data*, npc_data*) ()
No symbol table info available.
#5 0x000000000046724d in clif_parse (fd=16) at clif.cpp:21919
cmd =
packet_len = 7
sd = 0x63b6970
pnum = 0
#6 0x000000000062c6dd in do_sockets (next=) at socket.cpp:1398
rfd = {fds_bits = {65536, 0 <repeats 15 times>}}
timeout = {tv_sec = 0, tv_usec = 26304}
ret = 0
i = 16
#7 0x0000000000407bdd in main (argc=1, argv=0x7fffffffe5f8) at core.cpp:369
next = `

* LOOK_BODY2 and OPTION_COSTUME adjustment should only apply to players.
Thanks to @Balferian!
@ecdarreola
Copy link

In-conflict with #4448

aleos89 and others added 7 commits December 3, 2019 09:40
* Added header document.
* Added documentation for mob_avail database.
* Adjusted Options to a map instead of a sequence.
* Removed SEX_ prefix from Sex.
* Removed OPTION_ prefix from Options map.
* Cleaned up converter checks to properly discern mob, player, and NPC sprites.
* Cleaned up parser checks.
* Adjusted mob_avail_db class type.
* Updated header documentation.
Thanks to @Lemongrass3110!
@attackjom
Copy link
Contributor

I have found the problem when use mob_avail to change sprite to JOB

It show the headless sprite.

Is this a bug or clientside problem ?

@sinju92
Copy link

sinju92 commented Dec 17, 2019

I have found the problem when use mob_avail to change sprite to JOB

It show the headless sprite.

Is this a bug or clientside problem ?

i dont have that issue with client 20180621ragexe
but i have an issue with Sprite Upper/Middle/Lower didn't show poperly for sprite weapon work
Screenshot_1

* Corrected the headgear not being displayed.
Thanks to @cahya1992!
Copy link

@sinju92 sinju92 left a comment

Choose a reason for hiding this comment

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

Okay everything work poperly
Screenshot_5

* Cleaned up header documentation.
* Cleaned up warning messages.
* Added warning messages.
* Fixed mob_avail database getting loaded several times.
* Removed extern define.
@Lemongrass3110 Lemongrass3110 added this to the YAML Conversion milestone Dec 19, 2019
@lgtm-com
Copy link

lgtm-com bot commented Dec 20, 2019

This pull request introduces 9 alerts when merging 3623d9e into 77d86c6 - view on LGTM.com

new alerts:

  • 9 for Too few arguments to formatting function

src/map/mob.cpp Outdated Show resolved Hide resolved
aleos89 and others added 3 commits December 21, 2019 11:33
* Added some missing inverted checks.
* Cleaned up warning messages.
Thanks to @teededung!
Since this is a custom feature, the database will be loaded from import by default now.
@Lemongrass3110 Lemongrass3110 added component:database A fault that lies within the database of rAthena mode:prerenewal A fault that exists within the pre-renewal mode mode:renewal A fault that exists within the renewal mode type:enhancement Issue that is an enhancement to rAthena labels Dec 22, 2019
@aleos89 aleos89 merged commit b011963 into master Dec 22, 2019
@aleos89 aleos89 deleted the hotfix/issue4289 branch December 22, 2019 15:27
@aleos89 aleos89 removed the status:code-review Pull Request that requires reviewing from other developers before being pushed to master label Dec 22, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component:database A fault that lies within the database of rAthena mode:prerenewal A fault that exists within the pre-renewal mode mode:renewal A fault that exists within the renewal mode type:enhancement Issue that is an enhancement to rAthena
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

7 participants