浏览代码

Optimised PCLoginEvent activation a bit

git-svn-id: https://svn.code.sf.net/p/rathena/svn/branches/stable@912 54d463be-8e91-2dee-dedb-b68131a5f0ec
celest 20 年之前
父节点
当前提交
08755f2688
共有 2 个文件被更改,包括 9 次插入4 次删除
  1. 1 0
      Changelog.txt
  2. 8 4
      src/map/pc.c

+ 1 - 0
Changelog.txt

@@ -1,5 +1,6 @@
 Date	Added
 01/05
+        * Optimised PCLoginEvent activation a bit [celest]
         * Set 'droprate0item''s default to 'yes' so that items with 0 rate will never
           drop [celest]
         * Look at item type other than item ID as well to check whether it is a card

+ 8 - 4
src/map/pc.c

@@ -891,10 +891,14 @@ int pc_authok(int id, int login_id2, time_t connect_until_time, struct mmo_chars
 	else
 		sprintf(tmp_output,"Character '"CL_WHITE"%s"CL_RESET"' logged in. (Account ID: '"CL_WHITE"%d"CL_RESET"').\n", sd->status.name, sd->status.account_id);
 	ShowInfo(tmp_output);
-	//printf("pc: OnPCLogin event done. (%d events)\n", npc_event_doall("OnPCLogin") );
-	if (npc_name2id("PCLoginEvent")) {
-		run_script(npc_name2id("PCLoginEvent")->u.scr.script,0,sd->bl.id,npc_name2id("PCLoginEvent")->bl.id); // PCLoginNPC
-		ShowStatus("Event '"CL_WHITE"PCLoginEvent"CL_RESET"' executed.\n");
+
+	{
+		struct npc_data *npc;
+		//printf("pc: OnPCLogin event done. (%d events)\n", npc_event_doall("OnPCLogin") );
+		if ((npc = npc_name2id("PCLoginEvent"))) {
+			run_script(npc->u.scr.script,0,sd->bl.id,npc->bl.id); // PCLoginNPC
+			ShowStatus("Event '"CL_WHITE"PCLoginEvent"CL_RESET"' executed.\n");
+		}
 	}
 	// Send friends list
 	clif_friends_list_send(sd);