Thread Tools Display Modes
10-02-10, 10:16 PM   #1
Siku
A Fallenroot Satyr
 
Siku's Avatar
AddOn Author - Click to view addons
Join Date: Jun 2007
Posts: 29
QuestGiver API?

Alright, so i was thinking about a nice addon to develop for Cataclysm, but i got stuck on the drawing board by a crazy far-fetched idea. Which would pretty much be core to the addon.

Is there any Quest API to tell you who is the questgiver? Like the npc ID of the questgiver?
And is there any way to get said npc ID to show the NPC in a Model Widget?
In other words: I have to show the 3D model of a Questgiver.

If its not possible via API...Using a lua table that associate Quest ID = This NPC ID would work...wouldnt it? How would i get such a table, i have no idea yet, but it would be possible right?
  Reply With Quote
10-03-10, 02:04 AM   #2
Saiket
A Chromatic Dragonspawn
 
Saiket's Avatar
AddOn Author - Click to view addons
Join Date: Jul 2008
Posts: 154
Once you start interacting with an NPC, this will give you its Npc ID:
Code:
local QuestGiverID = tonumber( UnitGUID( "npc" ):sub( 8, 12 ), 16 );
You can then show it in a PlayerModel frame (not a plain Model) with this:
Code:
YourPlayerModel:SetCreature( QuestGiverID );
  Reply With Quote
10-03-10, 04:22 AM   #3
zork
A Pyroguard Emberseer
 
zork's Avatar
AddOn Author - Click to view addons
Join Date: Jul 2008
Posts: 1,740
Regarding quest unit models for Cataclysm. There are new API calls. Check FrameXML/questframe.lua. (See Cata forum)

Code snippets from questframe.lua
Code:
//quest turn in
local questPortrait, questPortraitText, questPortraitName = GetQuestPortraitTurnIn();
//quest giver
local questPortrait, questPortraitText, questPortraitName = GetQuestPortraitGiver();
//function call to change portrait
QuestFrame_ShowQuestPortrait(QuestFrame, questPortrait, questPortraitText, questPortraitName, -33, -62);


function QuestFrame_ShowQuestPortrait(parentFrame, portrait, text, name, x, y)
    
    -- ...
    
    if (portrait == -1) then
        QuestNPCModel:SetUnit("player");
    else
        QuestNPCModel:SetDisplayInfo(portrait);
    end
    
end
The new SetDisplayInfo is used and there are new API functions to retrieve the questgiver and the quest turn in person.
__________________
| Simple is beautiful.
| WoWI AddOns | GitHub | Zork (WoW)

"I wonder what the non-pathetic people are doing tonight?" - Rajesh Koothrappali (The Big Bang Theory)

Last edited by zork : 10-03-10 at 04:27 AM.
  Reply With Quote
10-03-10, 02:03 PM   #4
Siku
A Fallenroot Satyr
 
Siku's Avatar
AddOn Author - Click to view addons
Join Date: Jun 2007
Posts: 29
After seeing the new frame pop up inthe questlog on the beta, i guessed they added API for that unit. I'll have to study these new API while i work on it.
And the PlayerModel stuff is exactly what i wanted. It turns out it'll be more realizable than i thought. Awesome.
  Reply With Quote

WoWInterface » Developer Discussions » General Authoring Discussion » QuestGiver API?


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

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