summaryrefslogtreecommitdiff
path: root/src/map/npc.c
diff options
context:
space:
mode:
authorFlavioJS <FlavioJS@54d463be-8e91-2dee-dedb-b68131a5f0ec>2007-11-22 16:06:39 +0000
committerFlavioJS <FlavioJS@54d463be-8e91-2dee-dedb-b68131a5f0ec>2007-11-22 16:06:39 +0000
commite2ddbced3c35ca2d1c704c2b724234cc09a37418 (patch)
tree5c372ac886a2f4617939f36123e9a9f75176b5f7 /src/map/npc.c
parentbd953cebb864185e3f7f8ff5591ad02270bd19f0 (diff)
downloadhercules-e2ddbced3c35ca2d1c704c2b724234cc09a37418.tar.gz
hercules-e2ddbced3c35ca2d1c704c2b724234cc09a37418.tar.bz2
hercules-e2ddbced3c35ca2d1c704c2b724234cc09a37418.tar.xz
hercules-e2ddbced3c35ca2d1c704c2b724234cc09a37418.zip
* Renamed fakenpcname to setnpcdisplay, fixed and extended it.
- See doc/script_commands.txt for information on how to use it git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@11779 54d463be-8e91-2dee-dedb-b68131a5f0ec
Diffstat (limited to 'src/map/npc.c')
-rw-r--r--src/map/npc.c35
1 files changed, 26 insertions, 9 deletions
diff --git a/src/map/npc.c b/src/map/npc.c
index 14cf398c4..a65cf5e83 100644
--- a/src/map/npc.c
+++ b/src/map/npc.c
@@ -2042,16 +2042,33 @@ void npc_movenpc(struct npc_data* nd, int x, int y)
map_foreachinrange(clif_insight, &nd->bl, AREA_SIZE, BL_PC, &nd->bl);
}
-int npc_changename(const char* name, const char* newname, short look)
+/// Changes the display name of the npc.
+///
+/// @param nd Target npc
+/// @param newname New display name
+void npc_setdisplayname(struct npc_data* nd, const char* newname)
{
- struct npc_data* nd = (struct npc_data *) strdb_remove(npcname_db, name);
- if (nd == NULL)
- return 0;
- npc_enable(name, 0);
- strcpy(nd->name, newname);
- nd->class_ = look;
- npc_enable(newname, 1);
- return 0;
+ nullpo_retv(nd);
+
+ safestrncpy(nd->name, newname, sizeof(nd->name));
+ clif_charnameack(0, &nd->bl);
+}
+
+/// Changes the display class of the npc.
+///
+/// @param nd Target npc
+/// @param class_ New display class
+void npc_setclass(struct npc_data* nd, short class_)
+{
+ nullpo_retv(nd);
+
+ if( nd->class_ == class_ )
+ return;
+
+ clif_clearunit_area(&nd->bl, 0);// fade out
+ nd->class_ = class_;
+ status_set_viewdata(&nd->bl, class_);
+ clif_spawn(&nd->bl);// fade in
}
/// Parses a function.