Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Wow-fake.com - functions for generation of achievement message
<?php
declare(strict_types=1);
/**
* @param int $achievementId
* @param string $achievementName
* @param DateTime $achievementDate
* @return string
*/
function generatePreviewMessage(int $achievementId, string $achievementName, DateTime $achievementDate): string
{
$day = $achievementDate->format('j');
$month = $achievementDate->format('n');
$year = $achievementDate->format('y');
$chatMessage = '/run DEFAULT_CHAT_FRAME:AddMessage("\124cffffff00\124Hachievement:' . $achievementId;
$chatMessage .= ':"..string.gsub(UnitGUID("player"), \'0x\', \'\')..":1:';
$chatMessage .= $month . ':' . $day . ':' . $year . ':4294967295:4294967295:4294967295:4294967295\124h[';
$chatMessage .= $achievementName . ']\124h\124r")';
return $chatMessage;
}
/**
* @param int $achievementId
* @param string $achievementName
* @param DateTime $achievementDate
* @return string
*/
function generateGuildMessage(int $achievementId, string $achievementName, DateTime $achievementDate): string
{
$day = $achievementDate->format('j');
$month = $achievementDate->format('n');
$year = $achievementDate->format('y');
$chatMessage = '/run SendChatMessage("has earned the achievement \124cffffff00\124Hachievement:' . $achievementId;
$chatMessage .= ':"..string.gsub(UnitGUID("player"), \'0x\', \'\')..":1:';
$chatMessage .= $month . ':' . $day . ':' . $year . ':4294967295:4294967295:4294967295:4294967295\124h[';
$chatMessage .= $achievementName . ']\124h\124r!","GUILD")';
return $chatMessage;
}
echo generatePreviewMessage(13727, 'Mythic: Radiance of Azshara', new DateTime());
echo PHP_EOL;
echo generateGuildMessage(13727, 'Mythic: Radiance of Azshara', new DateTime());
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.