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

This commit is contained in:
Rat
2011-11-20 18:39:20 +01:00
24 changed files with 765 additions and 15 deletions
+1 -1
View File
@@ -6290,7 +6290,7 @@ bool Unit::HandleDummyAuraProc(Unit* victim, uint32 damage, AuraEffect* triggere
{
if (procSpell->SpellVisual[0] == 750 && procSpell->Effects[1].ApplyAuraName == 3)
{
if (target->GetTypeId() == TYPEID_UNIT)
if (target && target->GetTypeId() == TYPEID_UNIT)
{
triggered_spell_id = 54820;
break;
@@ -1241,6 +1241,8 @@ void WorldSession::HandleChangePlayerNameOpcodeCallBack(QueryResult result, std:
data << uint64(guid);
data << newname;
SendPacket(&data);
sWorld->UpdateCharacterNameData(guidLow, newname);
}
void WorldSession::HandleSetPlayerDeclinedNames(WorldPacket& recv_data)
@@ -1705,7 +1707,7 @@ void WorldSession::HandleCharFactionOrRaceChange(WorldPacket& recv_data)
SQLTransaction trans = CharacterDatabase.BeginTransaction();
trans->PAppend("UPDATE `characters` SET name='%s', race='%u', at_login=at_login & ~ %u WHERE guid='%u'", newname.c_str(), race, used_loginFlag, lowGuid);
trans->PAppend("DELETE FROM character_declinedname WHERE guid ='%u'", lowGuid);
sWorld->UpdateCharacterNameData(GUID_LOPART(guid), newname, gender, race);
sWorld->UpdateCharacterNameData(GUID_LOPART(guid), newname, gender, race);
BattlegroundTeamId team = BG_TEAM_ALLIANCE;
+10
View File
@@ -2141,6 +2141,16 @@ void Spell::EffectSendEvent(SpellEffIndex effIndex)
&& effectHandleMode != SPELL_EFFECT_HANDLE_HIT)
return;
//! it's possible for spells with this spell effect to either have a target or no target
//! in case of a target, we will execute this handler on SPELL_EFFECT_HANDLE_HIT_TARGET
//! with all relevant variables, and we will skip SPELL_EFFECT_HANDLE_HIT
if (effectHandleMode == SPELL_EFFECT_HANDLE_HIT)
{
if (GetSpellInfo()->Effects[effIndex].TargetA.GetTarget() != 0 ||
GetSpellInfo()->Effects[effIndex].TargetB.GetTarget() != 0)
return;
}
WorldObject* target = NULL;
// call events for target if present
+9 -3
View File
@@ -443,6 +443,9 @@ DumpReturn PlayerDumpReader::LoadDump(const std::string& file, uint32 account, s
typedef PetIds::value_type PetIdsPair;
PetIds petids;
uint8 gender;
uint8 race;
uint8 playerClass;
SQLTransaction trans = CharacterDatabase.BeginTransaction();
while (!feof(fin))
{
@@ -512,6 +515,9 @@ DumpReturn PlayerDumpReader::LoadDump(const std::string& file, uint32 account, s
if (!changenth(line, 2, chraccount)) // characters.account update
ROLLBACK(DUMP_FILE_BROKEN);
race = uint8(atol(getnth(line, 4).c_str()));
playerClass = uint8(atol(getnth(line, 5).c_str()));
gender = uint8(atol(getnth(line, 6).c_str()));
if (name == "")
{
// check if the original name already exists
@@ -520,10 +526,8 @@ DumpReturn PlayerDumpReader::LoadDump(const std::string& file, uint32 account, s
result = CharacterDatabase.PQuery("SELECT 1 FROM characters WHERE name = '%s'", name.c_str());
if (result)
{
if (!changenth(line, 37, "1")) // characters.at_login set to "rename on login"
ROLLBACK(DUMP_FILE_BROKEN);
}
}
else if (!changenth(line, 3, name.c_str())) // characters.name
ROLLBACK(DUMP_FILE_BROKEN);
@@ -654,6 +658,9 @@ DumpReturn PlayerDumpReader::LoadDump(const std::string& file, uint32 account, s
CharacterDatabase.CommitTransaction(trans);
// in case of name conflict player has to rename at login anyway
sWorld->AddCharacterNameData(guid, name, gender, race, playerClass);
sObjectMgr->m_hiItemGuid += items.size();
sObjectMgr->m_mailid += mails.size();
@@ -664,4 +671,3 @@ DumpReturn PlayerDumpReader::LoadDump(const std::string& file, uint32 account, s
return DUMP_SUCCESS;
}
+9 -5
View File
@@ -2874,7 +2874,7 @@ void World::LoadCharacterNameData()
sLog->outString("Loaded name data for %u characters", count);
}
void World::AddCharacterNameData(uint32 guid, const std::string& name, uint8 gender, uint8 race, uint8 playerClass)
void World::AddCharacterNameData(uint32 guid, std::string const& name, uint8 gender, uint8 race, uint8 playerClass)
{
CharacterNameData& data = _characterNameDataMap[guid];
data.m_name = name;
@@ -2883,18 +2883,22 @@ void World::AddCharacterNameData(uint32 guid, const std::string& name, uint8 gen
data.m_class = playerClass;
}
void World::UpdateCharacterNameData(uint32 guid, const std::string& name, uint8 gender, uint8 race)
void World::UpdateCharacterNameData(uint32 guid, std::string const& name, uint8 gender /*= GENDER_NONE*/, uint8 race /*= RACE_NONE*/)
{
std::map<uint32, CharacterNameData>::iterator itr = _characterNameDataMap.find(guid);
if (itr == _characterNameDataMap.end())
return;
itr->second.m_name = name;
itr->second.m_gender = gender;
if(race != RACE_NONE)
if (gender != GENDER_NONE)
itr->second.m_gender = gender;
if (race != RACE_NONE)
itr->second.m_race = race;
}
const CharacterNameData* World::GetCharacterNameData(uint32 guid) const
CharacterNameData const* World::GetCharacterNameData(uint32 guid) const
{
std::map<uint32, CharacterNameData>::const_iterator itr = _characterNameDataMap.find(guid);
if (itr != _characterNameDataMap.end())
+3 -3
View File
@@ -740,9 +740,9 @@ class World
bool isEventKillStart;
const CharacterNameData* GetCharacterNameData(uint32 guid) const;
void AddCharacterNameData(uint32 guid, const std::string& name, uint8 gender, uint8 race, uint8 playerClass);
void UpdateCharacterNameData(uint32 guid, const std::string& name, uint8 gender, uint8 race = RACE_NONE);
CharacterNameData const* GetCharacterNameData(uint32 guid) const;
void AddCharacterNameData(uint32 guid, std::string const& name, uint8 gender, uint8 race, uint8 playerClass);
void UpdateCharacterNameData(uint32 guid, std::string const& name, uint8 gender = GENDER_NONE, uint8 race = RACE_NONE);
void DeleteCharaceterNameData(uint32 guid) { _characterNameDataMap.erase(guid); }
uint32 GetCleaningFlags() const { return m_CleaningFlags; }
+23
View File
@@ -125,6 +125,29 @@ public:
if (!handler->extractPlayerTarget(nameStr, &target, &target_guid, &target_name))
return false;
if (strcmp(teleStr, "$home") == 0) // References target's homebind
{
if (target)
target->TeleportTo(target->m_homebindMapId, target->m_homebindX, target->m_homebindY, target->m_homebindZ, target->GetOrientation());
else
{
QueryResult resultDB = CharacterDatabase.PQuery("SELECT mapId, zoneId, posX, posY, posZ FROM character_homebind WHERE guid = %u", target_guid);
if (resultDB)
{
Field* fieldsDB = resultDB->Fetch();
uint32 mapId = fieldsDB[0].GetUInt32();
uint32 zoneId = fieldsDB[1].GetUInt32();
float posX = fieldsDB[2].GetFloat();
float posY = fieldsDB[3].GetFloat();
float posZ = fieldsDB[4].GetFloat();
Player::SavePositionInDB(mapId, posX, posY, posZ, 0, zoneId, target_guid);
}
}
return true;
}
// id, or string, or [name] Shift-click form |color|Htele:id|h[name]|h|r
GameTele const* tele = handler->extractGameTeleFromLink(teleStr);
if (!tele)
@@ -130,7 +130,7 @@ public:
me->SetHealth(0);
me->InterruptNonMeleeSpells(true);
me->RemoveAllAuras();
me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_OOC_NOT_ATTACKABLE);
me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE);
me->GetMotionMaster()->MovementExpired(false);
me->GetMotionMaster()->MoveIdle();
me->SetStandState(UNIT_STAND_STATE_DEAD);
@@ -152,7 +152,7 @@ public:
{
bIsUndead = true;
bEventInProgress = false;
me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_OOC_NOT_ATTACKABLE);
me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE);
me->UpdateEntry(MOB_INGVAR_UNDEAD);
me->SetInCombatWith(me->getVictim());
me->GetMotionMaster()->MoveChase(me->getVictim());