Procházet zdrojové kódy

- Fixed bugreport:6816, bugreport:6818, bugreport:6843, buying a Pet Egg is now working. Special thanks to Ind;
- Fixed a bug where pet egg was not deleted properly after clearing the floor.
- Adjusted comment from msg_athena.conf, these IDs are being used!

git-svn-id: https://svn.code.sf.net/p/rathena/svn/trunk@16897 54d463be-8e91-2dee-dedb-b68131a5f0ec

momacabu před 12 roky
rodič
revize
1450a8527d
3 změnil soubory, kde provedl 17 přidání a 12 odebrání
  1. 1 1
      conf/msg_athena.conf
  2. 7 7
      src/map/map.c
  3. 9 4
      src/map/npc.c

+ 1 - 1
conf/msg_athena.conf

@@ -418,7 +418,7 @@
 //chrif related
 408: Need disconnection to perform change-sex request...
 409: Your sex has been changed (need disconnection by the server)...
-//410-411 free
+//410-411 used by cash shop
 412: Your account has 'Unregistered'.
 413: Your account has an 'Incorrect Password'...
 414: Your account has expired.

+ 7 - 7
src/map/map.c

@@ -1301,23 +1301,23 @@ int map_get_new_object_id(void)
 int map_clearflooritem_timer(int tid, unsigned int tick, int id, intptr_t data)
 {
 	struct flooritem_data* fitem = (struct flooritem_data*)idb_get(id_db, id);
-	if( fitem==NULL || fitem->bl.type!=BL_ITEM || (!data && fitem->cleartimer != tid) )
+
+	if (fitem == NULL || fitem->bl.type != BL_ITEM || (!data && fitem->cleartimer != tid))
 	{
 		ShowError("map_clearflooritem_timer : error\n");
 		return 1;
 	}
 
-	if(data)
+	if (data)
 		delete_timer(fitem->cleartimer,map_clearflooritem_timer);
-	else
-	if(fitem->item_data.card[0] == CARD0_PET) // pet egg
-		intif_delete_petdata( MakeDWord(fitem->item_data.card[1],fitem->item_data.card[2]) );
 
-	clif_clearflooritem(fitem,0);
+	if (search_petDB_index(fitem->item_data.nameid, PET_EGG) >= 0)
+		intif_delete_petdata(MakeDWord(fitem->item_data.card[1], fitem->item_data.card[2]));
+
+	clif_clearflooritem(fitem, 0);
 	map_deliddb(&fitem->bl);
 	map_delblock(&fitem->bl);
 	map_freeblock(&fitem->bl);
-
 	return 0;
 }
 

+ 9 - 4
src/map/npc.c

@@ -1536,11 +1536,16 @@ int npc_buylist(struct map_session_data* sd, int n, unsigned short* item_list)
 		int amount = item_list[i*2+0];
 		struct item item_tmp;
 
-		memset(&item_tmp,0,sizeof(item_tmp));
-		item_tmp.nameid = nameid;
-		item_tmp.identify = 1;
+		if (itemdb_type(nameid) == IT_PETEGG)
+			pet_create_egg(sd, nameid);
+		else
+		{
+			memset(&item_tmp,0,sizeof(item_tmp));
+			item_tmp.nameid = nameid;
+			item_tmp.identify = 1;
 
-		pc_additem(sd,&item_tmp,amount,LOG_TYPE_NPC);
+			pc_additem(sd,&item_tmp,amount,LOG_TYPE_NPC);
+		}
 	}
 
 	// custom merchant shop exp bonus