diff options
Diffstat (limited to 'src')
-rwxr-xr-x | src/server/game/Entities/Unit/Unit.cpp | 2 | ||||
-rwxr-xr-x | src/server/game/Server/Protocol/Handlers/CharacterHandler.cpp | 4 | ||||
-rwxr-xr-x | src/server/game/Spells/SpellEffects.cpp | 10 | ||||
-rw-r--r-- | src/server/game/Tools/PlayerDump.cpp | 12 | ||||
-rwxr-xr-x | src/server/game/World/World.cpp | 14 | ||||
-rwxr-xr-x | src/server/game/World/World.h | 6 | ||||
-rw-r--r-- | src/server/scripts/Commands/cs_tele.cpp | 23 | ||||
-rw-r--r-- | src/server/scripts/Northrend/UtgardeKeep/UtgardeKeep/boss_ingvar_the_plunderer.cpp | 4 |
8 files changed, 60 insertions, 15 deletions
diff --git a/src/server/game/Entities/Unit/Unit.cpp b/src/server/game/Entities/Unit/Unit.cpp index c685417a835..dc1c4105fea 100755 --- a/src/server/game/Entities/Unit/Unit.cpp +++ b/src/server/game/Entities/Unit/Unit.cpp @@ -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; diff --git a/src/server/game/Server/Protocol/Handlers/CharacterHandler.cpp b/src/server/game/Server/Protocol/Handlers/CharacterHandler.cpp index c2b90041c4c..fc5cab7e8c0 100755 --- a/src/server/game/Server/Protocol/Handlers/CharacterHandler.cpp +++ b/src/server/game/Server/Protocol/Handlers/CharacterHandler.cpp @@ -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; diff --git a/src/server/game/Spells/SpellEffects.cpp b/src/server/game/Spells/SpellEffects.cpp index 3767b6ba560..db48f2b8693 100755 --- a/src/server/game/Spells/SpellEffects.cpp +++ b/src/server/game/Spells/SpellEffects.cpp @@ -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 diff --git a/src/server/game/Tools/PlayerDump.cpp b/src/server/game/Tools/PlayerDump.cpp index 92fa001fe46..bdb912aa8b0 100644 --- a/src/server/game/Tools/PlayerDump.cpp +++ b/src/server/game/Tools/PlayerDump.cpp @@ -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; } - diff --git a/src/server/game/World/World.cpp b/src/server/game/World/World.cpp index e15ef02058f..32b99b71abf 100755 --- a/src/server/game/World/World.cpp +++ b/src/server/game/World/World.cpp @@ -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()) diff --git a/src/server/game/World/World.h b/src/server/game/World/World.h index e08e78a50bd..553d4037430 100755 --- a/src/server/game/World/World.h +++ b/src/server/game/World/World.h @@ -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; } diff --git a/src/server/scripts/Commands/cs_tele.cpp b/src/server/scripts/Commands/cs_tele.cpp index 85e0ff2390b..8bfa010463a 100644 --- a/src/server/scripts/Commands/cs_tele.cpp +++ b/src/server/scripts/Commands/cs_tele.cpp @@ -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) diff --git a/src/server/scripts/Northrend/UtgardeKeep/UtgardeKeep/boss_ingvar_the_plunderer.cpp b/src/server/scripts/Northrend/UtgardeKeep/UtgardeKeep/boss_ingvar_the_plunderer.cpp index 55211f3f047..dc2d34326a7 100644 --- a/src/server/scripts/Northrend/UtgardeKeep/UtgardeKeep/boss_ingvar_the_plunderer.cpp +++ b/src/server/scripts/Northrend/UtgardeKeep/UtgardeKeep/boss_ingvar_the_plunderer.cpp @@ -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()); |