Merge branch 'master' of github.com:TrinityCore/TrinityCore into 4.3.4

Conflicts:
	src/server/shared/Database/Implementation/CharacterDatabase.cpp
This commit is contained in:
Vincent-Michael committed 2013-06-03 18:19:18 +02:00
commit efb4fb4959
22 files changed
+827 -64

No files matched your search

+66 -44
View File
@@ -1586,7 +1586,12 @@ public:
std::string areaName = "<unknown>";
std::string zoneName = "<unknown>";
// Guild data print is only defined if part of Guild
// Guild data print variables defined so that they exist, but are not necessarily used
uint32 guildId = 0;
std::string guildName;
std::string guildRank;
std::string note;
std::string officeNote;
// Mail data print is only defined if you have a mail
@@ -1625,18 +1630,19 @@ public:
if (!result)
return false;
Field* fields = result->Fetch();
totalPlayerTime = fields[0].GetUInt32();
level = fields[1].GetUInt8();
money = fields[2].GetUInt32();
accId = fields[3].GetUInt32();
raceid = fields[4].GetUInt8();
classid = fields[5].GetUInt8();
mapId = fields[6].GetUInt16();
areaId = fields[7].GetUInt16();
gender = fields[8].GetUInt8();
uint32 health = fields[9].GetUInt32();
Field* fields = result->Fetch();
totalPlayerTime = fields[0].GetUInt32();
level = fields[1].GetUInt8();
money = fields[2].GetUInt32();
accId = fields[3].GetUInt32();
raceid = fields[4].GetUInt8();
classid = fields[5].GetUInt8();
mapId = fields[6].GetUInt16();
areaId = fields[7].GetUInt16();
gender = fields[8].GetUInt8();
uint32 health = fields[9].GetUInt32();
uint32 playerFlags = fields[10].GetUInt32();
if (!health || playerFlags & PLAYER_FLAGS_GHOST)
alive = "No";
else
@@ -1654,13 +1660,13 @@ public:
Field* fields = result->Fetch();
userName = fields[0].GetString();
security = fields[1].GetUInt8();
eMail = fields[2].GetString();
// Only fetch these fields if commander has sufficient rights AND is online (prevent cheating)
/// @TODO: Add RBAC for "Can query ip and login data"
if (!handler->GetSession() || handler->GetSession()->GetSecurity() >= AccountTypes(security))
// Only fetch these fields if commander has sufficient rights)
if (handler->HasPermission(RBAC_PERM_COMMANDS_PINFO_CHECK_PERSONAL_DATA) && // RBAC Perm. 48, Role 39
(!handler->GetSession() || handler->GetSession()->GetSecurity() >= AccountTypes(security)))
{
lastIp = fields[3].GetString();
eMail = fields[2].GetString();
lastIp = fields[3].GetString();
lastLogin = fields[4].GetString();
uint32 ip = inet_addr(lastIp.c_str());
@@ -1677,6 +1683,12 @@ public:
lastIp.append(")");
}
}
else
{
eMail = "Unauthorized";
lastIp = "Unauthorized";
lastLogin = "Unauthorized";
}
muteTime = fields[5].GetUInt64();
muteReason = fields[6].GetString();
muteBy = fields[7].GetString();
@@ -1727,7 +1739,25 @@ public:
if (result4)
{
Field* fields = result4->Fetch();
xp = fields[0].GetUInt32();
xp = fields[0].GetUInt32(); // Used for "current xp" output and "%u XP Left" calculation
uint32 gguid = fields[1].GetUInt32(); // We check if have a guild for the person, so we might not require to query it at all
if (gguid != 0)
{
// Guild Data - an own query, because it may not happen.
PreparedStatement* stmt3 = CharacterDatabase.GetPreparedStatement(CHAR_SEL_GUILD_MEMBER_EXTENDED);
stmt3->setUInt32(0, lowguid);
PreparedQueryResult result5 = CharacterDatabase.Query(stmt3);
if (result5)
{
Field* fields = result5->Fetch();
guildId = fields[0].GetUInt32();
guildName = fields[1].GetString();
guildRank = fields[2].GetString();
note = fields[3].GetString();
officeNote = fields[4].GetString();
}
}
}
// Initiate output
@@ -1759,7 +1789,10 @@ public:
handler->PSendSysMessage(LANG_PINFO_ACC_IP, lastIp.c_str(), locked ? "Yes" : "No");
// Output X. LANG_PINFO_CHR_LEVEL
handler->PSendSysMessage(LANG_PINFO_CHR_LEVEL, level, xp, xptotal, (xptotal - xp));
if (level != sWorld->getIntConfig(CONFIG_MAX_PLAYER_LEVEL))
handler->PSendSysMessage(LANG_PINFO_CHR_LEVEL_LOW, level, xp, xptotal, (xptotal - xp));
else
handler->PSendSysMessage(LANG_PINFO_CHR_LEVEL_HIGH, level);
// Output XI. LANG_PINFO_CHR_RACE
raceStr = GetRaceName(raceid, locale);
@@ -1794,27 +1827,15 @@ public:
if (target)
handler->PSendSysMessage(LANG_PINFO_CHR_MAP, map->name[locale], (!zoneName.empty() ? zoneName.c_str() : "<Unknown>"), (!areaName.empty() ? areaName.c_str() : "<Unknown>"));
// Guild Data - an own query, because it may not happen.
PreparedStatement* stmt3 = CharacterDatabase.GetPreparedStatement(CHAR_SEL_GUILD_MEMBER_EXTENDED);
stmt3->setUInt32(0, lowguid);
PreparedQueryResult result5 = CharacterDatabase.Query(stmt3);
if (result5)
// Output XVII. - XX. if they are not empty
if (!guildName.empty())
{
Field* fields = result5->Fetch();
uint32 guildId = fields[0].GetUInt32();
std::string guildName = fields[1].GetString();
std::string guildRank = fields[2].GetString();
std::string note = fields[3].GetString();
std::string officeNote = fields[4].GetString();
// Output XVII. - XX.
handler->PSendSysMessage(LANG_PINFO_CHR_GUILD, guildName.c_str(), guildId);
handler->PSendSysMessage(LANG_PINFO_CHR_GUILD_RANK, guildRank.c_str());
// Only output XIX and XX if they are not empty
if (!note.empty())
handler->PSendSysMessage(LANG_PINFO_CHR_GUILD_NOTE, note.c_str());
if (!officeNote.empty())
handler->PSendSysMessage(LANG_PINFO_CHR_GUILD_ONOTE, officeNote.c_str());
handler->PSendSysMessage(LANG_PINFO_CHR_GUILD, guildName.c_str(), guildId);
handler->PSendSysMessage(LANG_PINFO_CHR_GUILD_RANK, guildRank.c_str());
if (!note.empty())
handler->PSendSysMessage(LANG_PINFO_CHR_GUILD_NOTE, note.c_str());
if (!officeNote.empty())
handler->PSendSysMessage(LANG_PINFO_CHR_GUILD_ONOTE, officeNote.c_str());
}
// Output XXI. LANG_PINFO_CHR_PLAYEDTIME
@@ -1822,23 +1843,24 @@ public:
// Mail Data - an own query, because it may or may not be useful.
// SQL: "SELECT SUM(CASE WHEN (checked & 1) THEN 1 ELSE 0 END) AS 'readmail', COUNT(*) AS 'totalmail' FROM mail WHERE `receiver` = ?"
stmt3 = CharacterDatabase.GetPreparedStatement(CHAR_SEL_PINFO_MAILS);
stmt3->setUInt32(0, lowguid);
PreparedQueryResult result6 = CharacterDatabase.Query(stmt3);
PreparedStatement* stmt4 = CharacterDatabase.GetPreparedStatement(CHAR_SEL_PINFO_MAILS);
stmt4->setUInt32(0, lowguid);
PreparedQueryResult result6 = CharacterDatabase.Query(stmt4);
if (result6)
{
// Define the variables, so the compiler knows they exist
uint32 rmailint = 0;
// Fetch the fields - readmail is a SUM(x) and given out as char! Thus...
// ... while totalmail is a COUNT(x), which is given out as INt64, which we just convert on fetch...
Field* fields = result6->Fetch();
std::string readmail = fields[0].GetString();
uint64 totalmail = fields[1].GetUInt64();
uint32 totalmail = uint32(fields[1].GetUInt64());
// ... we have to convert it from Char to int. We can use totalmail as it is
rmailint = atol(readmail.c_str());
// Output XXII. LANG_INFO_CHR_MAILS if at least one mails is given
// Output XXII. LANG_INFO_CHR_MAILS if at least one mail is given
if (totalmail >= 1)
handler->PSendSysMessage(LANG_PINFO_CHR_MAILS, rmailint, totalmail);
}
@@ -122,9 +122,11 @@ enum AssemblyYells
EMOTE_BRUNDIR_OVERLOAD = 7
};
enum AssemblyNPCs
enum Misc
{
NPC_WORLD_TRIGGER = 22515
NPC_WORLD_TRIGGER = 22515,
DATA_PHASE_3 = 1
};
#define FLOOR_Z 427.28f
@@ -158,6 +160,14 @@ class boss_steelbreaker : public CreatureScript
events.ScheduleEvent(EVENT_FUSION_PUNCH, 15000);
}
uint32 GetData(uint32 type) const
{
if (type == DATA_PHASE_3)
return (phase >= 3) ? 1 : 0;
return 0;
}
void DoAction(int32 action)
{
switch (action)
@@ -184,7 +194,7 @@ class boss_steelbreaker : public CreatureScript
if (instance->GetBossState(BOSS_ASSEMBLY_OF_IRON) == DONE)
{
DoCastAOE(SPELL_KILL_CREDIT);
DoCastAOE(SPELL_KILL_CREDIT, true);
Talk(SAY_STEELBREAKER_ENCOUNTER_DEFEATED);
}
else
@@ -287,6 +297,14 @@ class boss_runemaster_molgeim : public CreatureScript
events.ScheduleEvent(EVENT_RUNE_OF_POWER, 20000);
}
uint32 GetData(uint32 type) const
{
if (type == DATA_PHASE_3)
return (phase >= 3) ? 1 : 0;
return 0;
}
void DoAction(int32 action)
{
switch (action)
@@ -313,7 +331,7 @@ class boss_runemaster_molgeim : public CreatureScript
if (instance->GetBossState(BOSS_ASSEMBLY_OF_IRON) == DONE)
{
DoCastAOE(SPELL_KILL_CREDIT);
DoCastAOE(SPELL_KILL_CREDIT, true);
Talk(SAY_MOLGEIM_ENCOUNTER_DEFEATED);
}
else
@@ -429,6 +447,14 @@ class boss_stormcaller_brundir : public CreatureScript
me->ApplySpellImmune(0, IMMUNITY_MECHANIC, MECHANIC_STUN, false); // Reset immumity, Brundir should be stunnable by default
}
uint32 GetData(uint32 type) const
{
if (type == DATA_PHASE_3)
return (phase >= 3) ? 1 : 0;
return 0;
}
void EnterCombat(Unit* /*who*/)
{
_EnterCombat();
@@ -470,7 +496,7 @@ class boss_stormcaller_brundir : public CreatureScript
if (instance->GetBossState(BOSS_ASSEMBLY_OF_IRON) == DONE)
{
DoCastAOE(SPELL_KILL_CREDIT);
DoCastAOE(SPELL_KILL_CREDIT, true);
Talk(SAY_BRUNDIR_ENCOUNTER_DEFEATED);
}
else
@@ -697,6 +723,17 @@ class spell_assembly_rune_of_summoning : public SpellScriptLoader
}
};
class achievement_assembly_i_choose_you : public AchievementCriteriaScript
{
public:
achievement_assembly_i_choose_you() : AchievementCriteriaScript("achievement_assembly_i_choose_you") { }
bool OnCheck(Player* /*player*/, Unit* target)
{
return target && target->GetAI()->GetData(DATA_PHASE_3);
}
};
void AddSC_boss_assembly_of_iron()
{
new boss_steelbreaker();
@@ -705,4 +742,5 @@ void AddSC_boss_assembly_of_iron()
new spell_shield_of_runes();
new spell_assembly_meltdown();
new spell_assembly_rune_of_summoning();
new achievement_assembly_i_choose_you();
}