Running TC 3.3.5, latest rev.
I'm trying to make a CreatureScript that will show in a gossip menu item, the remaining respawn time of a world boss.
I have so far..
I like colors... so.
I'm trying to make a CreatureScript that will show in a gossip menu item, the remaining respawn time of a world boss.
I have so far..
Code:
[COLOR=#0066cc]class [/COLOR][COLOR=#add8e6]boss_timer[/COLOR] : [COLOR=#0066cc]public [/COLOR][COLOR=#add8e6]CreatureScript[/COLOR]
{
[COLOR=#0066cc]public[/COLOR]:
boss_timer() : [COLOR=#add8e6]CreatureScript[/COLOR]([COLOR=#cc6633]"boss_timer"[/COLOR]) { }
[COLOR=#0066cc]bool [/COLOR]OnGossipHello([COLOR=#add8e6]Player[/COLOR]* [COLOR=#a9a9a9]player[/COLOR], Creature* [COLOR=#a9a9a9]creature[/COLOR])
{
[COLOR=#add8e6]Creature[/COLOR]* target = ObjectAccessor::GetCreature(*[COLOR=#a9a9a9]player[/COLOR], [COLOR=#a9a9a9]creature[/COLOR]->GetGUID()); [COLOR=#00ff00]// Find Entry by GUID ??? How?[/COLOR]
[COLOR=#add8e6]uint32 [/COLOR]timer = [COLOR=#add8e6]uint32[/COLOR]([COLOR=#a9a9a9]target[/COLOR]->GetRespawnTime() / 1000); [COLOR=#00ff00]// Get remaining timer for respawn of that GUID.[/COLOR]
[COLOR=#a9a9a9]player[/COLOR]->SendUpdateWorldState(0, time([COLOR=#ee82ee]NULL[/COLOR]) + timer); [COLOR=#00ff00]// update timers ???[/COLOR]
std::[COLOR=#add8e6]ostringstream [/COLOR]ss;
ss << [COLOR=#cc6633]"World Boss will respawn in "[/COLOR] << timer; [COLOR=#00ff00]// add in gossip menu item[/COLOR]
[COLOR=#a9a9a9]player[/COLOR]->[COLOR=#ee82ee]ADD_GOSSIP_ITEM[/COLOR]([COLOR=#99ccff]GOSSIP_ICON_CHAT[/COLOR], ss.str().c_str(), [COLOR=#99ccff]GOSSIP_SENDER_MAIN[/COLOR], [COLOR=#99ccff]GOSSIP_ACTION_INFO_DEF + 1[/COLOR]);
return true;
}
[COLOR=#0066cc]bool [/COLOR]OnGossipSelect([COLOR=#add8e6]Player[/COLOR]* [COLOR=#a9a9a9]player[/COLOR], [COLOR=#add8e6]Creature[/COLOR]* [COLOR=#00ff00]/*creature*/[/COLOR], [COLOR=#add8e6]uint32 [/COLOR][COLOR=#00ff00]/*sender*/[/COLOR], [COLOR=#add8e6]uint32 [/COLOR][COLOR=#00ff00]/*action*/[/COLOR])
{
[COLOR=#a9a9a9]player[/COLOR]->[COLOR=#ee82ee]CLOSE_GOSSIP_MENU[/COLOR]();
[COLOR=#0066cc]return true[/COLOR];
}
};
[COLOR=#0066cc]void [/COLOR][COLOR=#add8e6]AddSC_boss_timer[/COLOR]()
{
[COLOR=#0066cc]new [/COLOR][COLOR=#add8e6]boss_timer[/COLOR]();
}
I like colors... so.