latest github + bot fix
This commit is contained in:
@@ -14,11 +14,11 @@ class mxwow_bosskill : public PlayerScript
|
||||
|
||||
public:
|
||||
|
||||
mxwow_bosskill() : PlayerScript("mxwow_bosskill") { }
|
||||
mxwow_bosskill() : PlayerScript("mxwow_bosskill") {}
|
||||
|
||||
void OnPlayerLogin(Player* player) override
|
||||
{
|
||||
|
||||
|
||||
}
|
||||
|
||||
void OnPlayerCreatureKill(Player* player, Creature* boss) {
|
||||
@@ -39,37 +39,94 @@ public:
|
||||
float pLife;
|
||||
bool pGrouped;
|
||||
if (boss->isWorldBoss() || boss->IsDungeonBoss()) {
|
||||
if (boss->isWorldBoss()) { mType = "Raid"; } else { mType = "Donjon"; }
|
||||
if (boss->isWorldBoss()) { mType = "Raid"; }
|
||||
else { mType = "Donjon"; }
|
||||
uint32 contentDifId;
|
||||
bName = boss->GetName();
|
||||
map = player->GetMap();
|
||||
pName = player->GetName();
|
||||
piLevel = player->GetAverageItemLevelForDF();
|
||||
pMapName = map->GetMapName();
|
||||
pGrouped = player->GetGroup();
|
||||
pLife = player->GetHealthPct();
|
||||
int RandIndex = rand() % 8;
|
||||
int RandIndex = rand() % 8;
|
||||
if (player->GetMap()->IsHeroic()) {
|
||||
contentDifficulty = "|cffff0000";
|
||||
contentDifName = "|cffff0000Heroic";
|
||||
contentDifId = 1;
|
||||
}
|
||||
else {
|
||||
contentDifficulty = "|cff00ff00";
|
||||
contentDifName = "|cff00ff00Normal";
|
||||
contentDifId = 0;
|
||||
}
|
||||
|
||||
if (sConfigMgr->GetOption<bool>("MxWoW_BossKill.Enabled", true))
|
||||
{
|
||||
if (!pGrouped) {
|
||||
KillManager(player, boss, map);
|
||||
//ss << "|cffabeeff[MxW] [" << GetPlayerColor(player) << pName << "|cffabeeff][iL"<< piLevel <<"][" << pLife << "%] a tué [|cffff1100" << bName << "|cffabeeff][" << contentDifficulty << pMapName << "|cffabeeff]";
|
||||
/*pName = p->GetName();
|
||||
line00 << "|cffabeeff[MxW][" << mType << "]";
|
||||
line01 << "|cffabeeff[" << contentDifficulty << ""<< pMapName <<"|cffabeeff]["<< contentDifName <<"|cffabeeff]";
|
||||
line02 << "|cffabeeff["<< GetPlayerColor(player)<< pName <<"|cffabeeff][iL"<< piLevel <<"]["<< pLife <<"%]";
|
||||
line03 << "|cffabeeff[|cffff1100"<< bName <<"|cffabeeff] "<< GenKillMessage(RandIndex) <<".";
|
||||
line01 << "|cffabeeff[" << contentDifficulty << "" << pMapName << "|cffabeeff][" << contentDifName << "|cffabeeff]";
|
||||
line02 << "|cffabeeff[" << GetPlayerColor(player) << pName << "|cffabeeff][iL" << piLevel << "][" << pLife << "%]";
|
||||
line03 << "|cffabeeff[|cffff1100" << bName << "|cffabeeff] " << GenKillMessage(RandIndex) << ".";
|
||||
sWorldSessionMgr->SendServerMessage(SERVER_MSG_STRING, line00.str().c_str());
|
||||
sWorldSessionMgr->SendServerMessage(SERVER_MSG_STRING, line01.str().c_str());
|
||||
sWorldSessionMgr->SendServerMessage(SERVER_MSG_STRING, line02.str().c_str());
|
||||
sWorldSessionMgr->SendServerMessage(SERVER_MSG_STRING, line03.str().c_str());
|
||||
ChatHandler(p->GetSession()).PSendSysMessage(ss.str().c_str());*/
|
||||
}
|
||||
}
|
||||
else {
|
||||
Group* group = player->GetGroup();
|
||||
Group::MemberSlotList const& groupSlot = group->GetMemberSlots();
|
||||
for (Group::member_citerator itr = groupSlot.begin(); itr != groupSlot.end(); itr++)
|
||||
{
|
||||
Player* p = ObjectAccessor::FindPlayer(itr->guid);
|
||||
KillManager(p, boss, map);
|
||||
/*pName = p->GetName();
|
||||
line00 << "|cffabeeff[MxW][" << mType << "]";
|
||||
line01 << "|cffabeeff[" << contentDifficulty << "" << pMapName << "|cffabeeff][" << contentDifName << "|cffabeeff]";
|
||||
line02 << "|cffabeeff[" << GetPlayerColor(player) << pName << "|cffabeeff][iL" << piLevel << "][" << pLife << "%]";
|
||||
line03 << "|cffabeeff[|cffff1100" << bName << "|cffabeeff] " << GenKillMessage(RandIndex) << ".";
|
||||
sWorldSessionMgr->SendServerMessage(SERVER_MSG_STRING, line00.str().c_str());
|
||||
sWorldSessionMgr->SendServerMessage(SERVER_MSG_STRING, line01.str().c_str());
|
||||
sWorldSessionMgr->SendServerMessage(SERVER_MSG_STRING, line02.str().c_str());
|
||||
sWorldSessionMgr->SendServerMessage(SERVER_MSG_STRING, line03.str().c_str());
|
||||
ChatHandler(p->GetSession()).PSendSysMessage(ss.str().c_str());*/
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void KillManager(Player* player, Creature* boss, Map* map) {
|
||||
uint32 aId = player->GetSession()->GetAccountId();
|
||||
uint32 pId = player->GetGUID().GetRawValue();
|
||||
uint32 mapId = map->GetId();
|
||||
uint32 cId = boss->GetCreatureTemplate()->Entry;
|
||||
uint32 contentDifId;
|
||||
if (player->GetMap()->IsHeroic()) {
|
||||
contentDifId = 1;
|
||||
}
|
||||
else {
|
||||
contentDifId = 0;
|
||||
}
|
||||
QueryResult queryBossKill = LoginDatabase.Query("SELECT * FROM mxw_boss_kill WHERE accountid = {} AND charid = {} AND creatureid = {} AND instanceid = {} AND difficulty = {}", aId, pId, cId, mapId, contentDifId);
|
||||
if (queryBossKill) {
|
||||
uint32 killCount = (*queryBossKill)[5].Get<uint32>();
|
||||
killCount++;
|
||||
LoginDatabase.Execute("UPDATE mxw_boss_kill SET killcount = {} WHERE accountid = {} AND charid = {} AND creatureid = {} AND instanceid = {} AND difficulty = {}", killCount, aId, pId, cId, mapId, contentDifId);
|
||||
}
|
||||
else {
|
||||
LoginDatabase.Execute("INSERT INTO mxw_boss_kill (accountid,charid,creatureid,instanceid,difficulty,killcount) VALUES ({}, {}, {}, {}, {}, {})", aId, pId, cId, mapId, contentDifId, 1);
|
||||
}
|
||||
|
||||
QueryResult queryInstanceKill = LoginDatabase.Query("SELECT * FROM mxw_boss_instance WHERE instanceid = {} AND difficulty = {} AND bossid = {}", mapId, contentDifId, cId);
|
||||
if (queryInstanceKill) {
|
||||
uint32 killCount = (*queryInstanceKill)[3].Get<uint32>();
|
||||
killCount++;
|
||||
LoginDatabase.Execute("UPDATE mxw_boss_instance SET killcount = {} WHERE instanceid = {} AND difficulty = {} AND bossid = {} ", killCount, mapId, contentDifId, cId);
|
||||
}
|
||||
else {
|
||||
LoginDatabase.Execute("INSERT INTO mxw_boss_instance (instanceid,difficulty,bossid,killcount) VALUES ({}, {}, {}, {})", mapId, contentDifId, cId, 1);
|
||||
}
|
||||
}
|
||||
|
||||
std::string GenKillMessage(const int i)
|
||||
|
||||
Reference in New Issue
Block a user