Core/Scripts: Tidy up commandscripts to adhere to scripting-standards and fix some minor typos (fix by Paradox)
Closes issue #4859. --HG-- branch : trunk
This commit is contained in:
1 parent
0fb06f63e5
commit
3e27be7501
16 files changed
+9505
-9534
No files matched your search
@@ -27,51 +27,51 @@ EndScriptData */
|
||||
|
||||
class achievement_commandscript : public CommandScript
|
||||
{
|
||||
public:
|
||||
achievement_commandscript() : CommandScript("achievement_commandscript") { }
|
||||
public:
|
||||
achievement_commandscript() : CommandScript("achievement_commandscript") { }
|
||||
|
||||
ChatCommand* GetCommands() const
|
||||
ChatCommand* GetCommands() const
|
||||
{
|
||||
static ChatCommand achievementCommandTable[] =
|
||||
{
|
||||
static ChatCommand achievementCommandTable[] =
|
||||
{
|
||||
{ "add", SEC_ADMINISTRATOR, false, &HandleAchievementAddCommand, "", NULL },
|
||||
{ NULL, 0, false, NULL, "", NULL }
|
||||
};
|
||||
static ChatCommand commandTable[] =
|
||||
{
|
||||
{ "achievement", SEC_ADMINISTRATOR, false, NULL, "", achievementCommandTable },
|
||||
{ NULL, 0, false, NULL, "", NULL }
|
||||
};
|
||||
return commandTable;
|
||||
}
|
||||
|
||||
static bool HandleAchievementAddCommand(ChatHandler* handler, const char *args)
|
||||
{ "add", SEC_ADMINISTRATOR, false, &HandleAchievementAddCommand, "", NULL },
|
||||
{ NULL, 0, false, NULL, "", NULL }
|
||||
};
|
||||
static ChatCommand commandTable[] =
|
||||
{
|
||||
if (!*args)
|
||||
return false;
|
||||
{ "achievement", SEC_ADMINISTRATOR, false, NULL, "", achievementCommandTable },
|
||||
{ NULL, 0, false, NULL, "", NULL }
|
||||
};
|
||||
return commandTable;
|
||||
}
|
||||
|
||||
uint32 achievementId = atoi((char*)args);
|
||||
static bool HandleAchievementAddCommand(ChatHandler* handler, const char *args)
|
||||
{
|
||||
if (!*args)
|
||||
return false;
|
||||
|
||||
uint32 achievementId = atoi((char*)args);
|
||||
if (!achievementId)
|
||||
{
|
||||
if (char* cId = handler->extractKeyFromLink((char*)args, "Hachievement"))
|
||||
achievementId = atoi(cId);
|
||||
if (!achievementId)
|
||||
{
|
||||
if (char* cId = handler->extractKeyFromLink((char*)args, "Hachievement"))
|
||||
achievementId = atoi(cId);
|
||||
if (!achievementId)
|
||||
return false;
|
||||
}
|
||||
|
||||
Player* target = handler->getSelectedPlayer();
|
||||
if (!target)
|
||||
{
|
||||
handler->SendSysMessage(LANG_NO_CHAR_SELECTED);
|
||||
handler->SetSentErrorMessage(true);
|
||||
return false;
|
||||
}
|
||||
|
||||
if (AchievementEntry const* pAE = GetAchievementStore()->LookupEntry(achievementId))
|
||||
target->CompletedAchievement(pAE, true);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
Player* target = handler->getSelectedPlayer();
|
||||
if (!target)
|
||||
{
|
||||
handler->SendSysMessage(LANG_NO_CHAR_SELECTED);
|
||||
handler->SetSentErrorMessage(true);
|
||||
return false;
|
||||
}
|
||||
|
||||
if (AchievementEntry const* pAE = GetAchievementStore()->LookupEntry(achievementId))
|
||||
target->CompletedAchievement(pAE, true);
|
||||
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
void AddSC_achievement_commandscript()
|
||||
|
||||
Reference in new issue
Block a user