Unofficial World of Warcraft Forums  
Please respect other members. Please do not post links or information about hacking/warez/cheats.
Read the rules of these forums as we rarely warn before banning. Lost or need RSS check the forum map.

Quick Site Nav
Navigation
Worldofwar.Net
WoW Forums
WoWDigger WoW Database
Articles
Community Blogs
WoW Info
Wrath of the Lich King Info
Primary Professions
Secondary Professions
Maps
Classes
PvP
A-Z Index
Guides
Submit Guides
List Guides
UI/Mods
Latest Mods
Submit Mod
List Macros
Submit Macro
Media Gallery
Gallery Home
Upload Pics
Community WoW Shots
Community BC Shots
Player Pics
Official WoW Shots
Official BC Shots


Donate and get extra forum perks
Support WoW:IncGamers

Go Back   Unofficial World of Warcraft Forums > WoW Community Forums > UI Customisation > UI/Mod Developer Forum

Reply
 
Thread Tools Display Modes
Old 30-06-2006, 02:41 AM   #1
JonRico
WorldofWar.Net Member
 
Join Date: Jul 2005
Posts: 3
When is an item added to the local cache?

I write a mod that adds item its sees in channels to its own database.

Annoyingly it also adds items it sees in languages that are not the clients current default language. So I thought it would be cool to filter those out.

To do this, when I see an item not in my database, I get its item id from the link in the text and then call GetItemInfo. I use the returned values to check that the name of the item i see in the text is the same as the name returned by GetItemInfo. If it is, I add it to my database. If its not, I assume its an item in another language and ignore it.

The problem is, it seems to add items randomly. Sometimes GetItemInfo returns null, sometimes it does not. I know its supposed to return null if the item is not in your local cache, but I assumed seeing it in a channel message would add it to the local cache.

If the item in question is whispered to me, it always seems to work. If the item is in another channel it normally seems to fail, but does work sometimes. :)

function TypeLinks_OnEvent()
if (event == "CHAT_MSG_CHANNEL") then
TypeLinks_ScanTextForLinks(arg1);
end
end

I simply call my scanner method on all channel messages. What I guess I want to know is when the item is added to the cache and if I can ensure its added to the cache before my method fires?

Can anyone help?
JonRico is offline   Reply With Quote
Old 19-07-2006, 02:44 AM   #2
JonRico
WorldofWar.Net Member
 
Join Date: Jul 2005
Posts: 3
Well here is what I had to do. :P

In order to test if a given item link in chat is in your local language, you need to get the item id in the link and then check the name given to you by GetItemInfo(item id) is the same as the name given in the link.

GetItemInfo returns null if the item given by its id is not in your local cache.

Since the item has been linked to you by another player, it is in the server cache. So you can safely force addition of it to your local cache. To do that, display its tooltip.

GameTooltip_SetDefaultAnchor(GameTooltip, someParent);
GameTooltip:SetHyperlink(hyperLinkToItem);
GameTooltip:Hide();

In practice though GetItemInfo sometimes still returns null. This is a timing issue (I think :P), so I need store the items that are returned null and then process them again on some later event (in my case when chat messages are displayed or when the player logs out). The items then are ALWAYS in the local cache and can be safely compared.

Just in case anyone wondered. ;)
JonRico is offline   Reply With Quote
Old 25-07-2006, 03:25 PM   #3
Wintrow
WorldofWar.Net Member
 
Wintrow's Avatar
 
Join Date: Aug 2005
Location: In ur account, sharding ur purplz
Posts: 4,304
nice :)8910
Wintrow is offline   Reply With Quote
Old 27-07-2006, 03:51 AM   #4
JonRico
WorldofWar.Net Member
 
Join Date: Jul 2005
Posts: 3
I have used this to write another little mod that automatically changes the language of item links in chats to the clients default.

So basically if a player using the (for example) german client links something to your english client, then you just see the normal english name.

Its pretty pointless since you can just click on the link and the tooltip is english and most of the time the translation is obvious anyway, but it works. :)
JonRico is offline   Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 11:13 AM.


Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
Advertisement System V2.5 By   Branden