Hello,
I’m just start with Trinity. I just make a script for this Simple item:
class item_titanium_seal_of_dalaran : public ItemScript
{
public:
item_titanium_seal_of_dalaran() : ItemScript("item_titanium_seal_of_dalaran") { }
bool OnUse(Player* player, Item* /*item*/, SpellCastTargets const& /*targets*/)
{
uint32 cd_time = player->ToPlayer()->GetSpellCooldownDelay(60458);
if(cd_time <= 0)
{
player->ToPlayer()->AddSpellCooldown(60458,44430,time(NULL)+10);
player->CastSpell(player,60458,false);
if (urand(0, 99) < 50)
{
player->TextEmote(" casually flips his |cff0070dd|Hitem:44430:0:0:0:0:0:0:0:80|h[Titanium Seal of Dalaran]|h|r.");
player->TextEmote(" catches the coin heads up!");
return true;
}
else
{
player->TextEmote(" casually flips his |cff0070dd|Hitem:44430:0:0:0:0:0:0:0:80|h[Titanium Seal of Dalaran]|h|r.");
player->TextEmote(" catches the coin face down for tails!");
return true;
}
}
else
{
return false;
}
return true;
}
};
It’s working fine to me, but i have some problem with animation of item cooldown. I also think is possibility to write it only in sql using smartscripts.
I think i don’t do a stupid thing with this item ^^