LoadItemCommonData(id)

EQ2Emulator Development forum.

Moderator: Team Members

Post Reply
User avatar
John Adams
Retired
Posts: 9684
Joined: Thu Jul 26, 2007 6:27 am
EQ2Emu Server: EQ2Emulator Test Center
Characters: John
Location: Arizona
Contact:

LoadItemCommonData(id)

Post by John Adams » Thu Oct 15, 2009 4:20 pm

LE, can you tell me what's going on in this function? Looking at it, and running the query myself, I think I am going to faint at how much data we're pulling in each item (something tells me I've asked this before)

Code: Select all

Item* WorldDatabase::LoadItemCommonData(int32 id){
	Item* item = 0;
	if(tmp_item_list.empty()){
		Query query;
		MYSQL_ROW row;
		MYSQL_RES* result = query.RunQuery2(Q_SELECT, "SELECT id, name, icon, count, tier, weight, description, show_name, attuneable, artifact, lore, temporary, notrade, novalue, nozone, nodestroy, crafted, good_only, evil_only, skill_id_req, skill_id_req2, skill_min, skill_max, slots, sell_price, stack_count, collectable, offers_quest_id, part_of_quest_id, recommended_level, adventure_default_level, max_charges, tradeskill_default_level, adventure_classes, tradeskill_classes, lua_script, usable FROM items");
		while(result && (row = mysql_fetch_row(result))){
			item = new Item();
			LoadDataFromRow(row, item);
			master_item_list.AddItem(item);
			tmp_item_list[atoul(row[0])] = item;
		}
		LoadItemStats();
		LoadItemLevelOverride();
		LoadItemEffects();
		LoadItemAppearances();
	}
	item = tmp_item_list[id];
	tmp_item_list.erase(id);
	return item;
}
Shouldn't the query end in "WHERE id = %lu" so we're not reading 110,000 records each time we load 1 item to find it's details? Or is that not what this function is actually doing... I do see a little map thingy there, so maybe you're working some voodoo.

LethalEncounter
Team: Zombie
Posts: 2717
Joined: Wed Jul 25, 2007 10:10 pm

Re: LoadItemCommonData(id)

Post by LethalEncounter » Fri Oct 16, 2009 1:40 pm

lol yah you asked it before:

http://www.eq2emulator.net/phpBB3/viewt ... ata#p14481

:P Basically it loads all the information once and then uses it to assign the details to more specific item types.

User avatar
John Adams
Retired
Posts: 9684
Joined: Thu Jul 26, 2007 6:27 am
EQ2Emu Server: EQ2Emulator Test Center
Characters: John
Location: Arizona
Contact:

Re: LoadItemCommonData(id)

Post by John Adams » Fri Oct 16, 2009 2:21 pm

I knew it sounded familiar :)

Post Reply

Who is online

Users browsing this forum: No registered users and 0 guests