1、这个是根据会员等级的不同,来实现不同的聊天说话的信息显示方式的代码
2、这个可以根据阵营的不同,显示不同的聊天显示的前缀
3、支持Trinity端的3.3.5怀旧魔兽世界私服的版本
4、命令使用方式分别为:5、下面是完整的T端的脚本代码。请自己加到你的T端内核代码中去
6、OK,go 去试试!
#include "ScriptPCH.h"#include "Chat.h"
class AleraChat : public CommandScript
{
public:
AleraChat() : CommandScript("AleraChat") {}
ChatCommand * GetCommands() const
{
static ChatCommand AleraChatCommandTable[] =
{
{"chat", SEC_PLAYER, true, &HandleAleraChatCommand, "",
{NULL, 0, false, NULL, "", NULL}
};
return AleraChatCommandTable;
}
static bool HandleAleraChatCommand(ChatHandler * handler, const char * args)
{
if (!args)
return false;
std::string msg = "";
Player * player = handler->GetSession()->GetPlayer();
switch(player->GetSession()->GetSecurity())
{
// Player
case SEC_PLAYER:
-- GM level 0
if (player->GetTeam() == ALLIANCE)
{
msg += "|cff00FFFB[Alera Twink]|cff0000EE[Alliance]|cff00CD00[";
msg += player->GetName();
msg += "]:|cffffffff ";
}
if (player->GetTeam() == HORDE)
{
msg += "|cff00FFFB[Alera Twink]|cffCC1100[Horde]|cff00CD00[";
msg += player->GetName();
msg += "]:|cffffffff ";
}
break;
// VIP -- GM level 1
case SEC_VIP:
if (player->GetTeam() == ALLIANCE)
{
msg += "|cff00FFFB[Alera Twink]|cff0000EE[Alliance]|cff800080[VIP]|cff00CD00[";
msg += player->GetName();
msg += "]:|cffffffff ";
}
if (player->GetTeam() == HORDE)
{
msg += "|cff00FFFB[Alera Twink]|cffCC1100[Horde]|cff800080[VIP]|cff00CD00[";
msg += player->GetName();
msg += "]:|cffffffff ";
}
break;
// Moderator -- GM level 2
case SEC_MODERATOR:
msg += "|cff00FFFB[Alera Twink]|cffEEB422[Moderator]|cff00CD00[";
msg += player->GetName();
msg += "]:|cffffffff ";
break;
// Gamemaster -- GM level 3
case SEC_GAMEMASTER:
msg += "|cff00FFFB[Alera Twink]|cffF0A804[Gamemaster]|cff00CD00[";
msg += player->GetName();
msg += "]:|cffffffff ";
break;
// Head GM -- GM level 4
case SEC_ADMINISTRATOR:
msg += "|cff00FFFB[Alera Twink]|cffFF0000[Administrator]|cff00CD00[";
msg += player->GetName();
msg += "]:|cffffffff ";
break;
}
msg += args;
sWorld->SendServerMessage(SERVER_MSG_STRING, msg.c_str(), 0);
return true;
}
}
};
void AddSC_AleraChat()
{
new AleraChat();
}
下面是完整的代码下载地址
|