这个是一个T端WOW3.3.5(Trinity-Core)系统的脚本。。主要是对竞技场系统做一个特色的NPC排名展示系统
我们来看看代码是怎么样的!支持3.3.5版本的T端哈!
/*
The Zxtreme - Dev Core
*/
#include "ScriptPCH.h"
#include
#include
#include "ObjectMgr.h"
#include "ScriptMgr.h"
#include "ArenaTeam.h"
#include "ArenaTeamMgr.h"
#include "World.h"
enum enus
{
ARENA_MAX_RESULTS = 10,
ARENA_2V2_LADDER = GOSSIP_ACTION_INFO_DEF + 1,
ARENA_3V3_LADDER = GOSSIP_ACTION_INFO_DEF + 2,
ARENA_5V5_LADDER = GOSSIP_ACTION_INFO_DEF + 3,
ARENA_GOODBYE = GOSSIP_ACTION_INFO_DEF + 4,
ARENA_START_TEAM_LOOKUP = GOSSIP_ACTION_INFO_DEF + 5,
ARENA_HELP = GOSSIP_ACTION_INFO_DEF + 9999,
};
class arena_top_teams : public CreatureScript
{
private:
uint32 optionToTeamType(uint32 option)
{
uint32 teamType;
switch(option)
{
case ARENA_2V2_LADDER:
teamType = 2;
break;
case ARENA_3V3_LADDER:
teamType = 3;
break;
case ARENA_5V5_LADDER:
teamType = 5;
break;
}
return teamType;
}
uint32 teamTypeToOption(uint32 teamType)
{
uint32 option;
switch(teamType)
{
case 2:
option = ARENA_2V2_LADDER;
break;
case 3:
option = ARENA_3V3_LADDER;
break;
case 5:
option = ARENA_5V5_LADDER;
break;
}
return option;
}
std::string raceToString(uint8 race)
{
std::string race_s = "Unknown";
switch (race)
{
case RACE_HUMAN:
race_s = "Human";
break;
case RACE_ORC:
race_s = "Orc";
break;
case RACE_DWARF:
race_s = "Dwarf";
break;
case RACE_NIGHTELF:
race_s = "Night Elf";
break;
case RACE_UNDEAD_PLAYER:
race_s = "Undead";
break;
case RACE_TAUREN:
race_s = "Tauren";
break;
case RACE_GNOME:
race_s = "Gnome";
break;
case RACE_TROLL:
race_s = "Troll";
break;
case RACE_BLOODELF:
race_s = "Blood Elf";
break;
case RACE_DRAENEI:
race_s = "Draenei";
break;
}
return race_s;
}
std::string classToString(uint8 Class)
{
std::string Class_s = "Unknown";
switch (Class)
{
case CLASS_WARRIOR:
Class_s = "Warrior";
break;
case CLASS_PALADIN:
Class_s = "Paladin";
break;
case CLASS_HUNTER:
Class_s = "Hunter";
break;
case CLASS_ROGUE:
Class_s = "Rogue";
break;
case CLASS_PRIEST:
Class_s = "Priest";
break;
case CLASS_DEATH_KNIGHT:
Class_s = "Death Knight";
break;
case CLASS_SHAMAN:
Class_s = "Shaman";
break;
case CLASS_MAGE:
Class_s = "Mage";
break;
case CLASS_WARLOCK:
Class_s = "Warlock";
break;
case CLASS_DRUID:
Class_s = "Druid";
break;
}
return Class_s;
}
std::string getPlayerStatus(uint32 guid)
{
Player *player = sObjectAccessor->FindPlayer(guid);
if(!player)
return "Offline";
if(player->isAFK())
return "Online, " + player->afkMsg;
if(player->isDND())
return "Online, " + player->dndMsg;
return "Online";
}
std::string getWinPercent(uint32 wins, uint32 losses)
{
uint32 totalGames = wins + losses;
if (totalGames == 0)
return "0%";
std::stringstream buf;
uint32 percentage = (wins * 100) / totalGames;
buf << percentage << "%";
return buf.str();
}
上面是部分代码。全部代码看下面的下载:
|