From f3d0021ce882a5fb3977bef53f3659823ac6f083 Mon Sep 17 00:00:00 2001 From: megamage Date: Sat, 27 Dec 2008 15:28:30 -0600 Subject: *Fix the bug that spirit of redemption can be killed. --HG-- branch : trunk --- src/game/Spell.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'src/game') diff --git a/src/game/Spell.cpp b/src/game/Spell.cpp index 7aeb0159e9d..15259bf1af0 100644 --- a/src/game/Spell.cpp +++ b/src/game/Spell.cpp @@ -1111,6 +1111,14 @@ void Spell::DoSpellHitOnUnit(Unit *unit, const uint32 effectMask) if( m_caster != unit ) { + if (unit->GetCharmerOrOwnerGUID() != m_caster->GetGUID()) + { + if (unit->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE)) + { + m_caster->SendSpellMiss(unit, m_spellInfo->Id, SPELL_MISS_EVADE); + return; + } + } if( !m_caster->IsFriendlyTo(unit) ) { // for delayed spells ignore not visible explicit target -- cgit v1.2.3 From 231cb0f5a7707017cd37628c389c32e42f24f1fe Mon Sep 17 00:00:00 2001 From: QAston Date: Sat, 27 Dec 2008 22:24:29 +0100 Subject: *Remove aura slot from update fields at aura remove. --HG-- branch : trunk --- src/game/Pet.h | 1 + src/game/Player.h | 1 + src/game/SpellAuras.cpp | 4 ++-- src/game/Unit.cpp | 12 +++++++++--- src/game/Unit.h | 2 +- 5 files changed, 14 insertions(+), 6 deletions(-) (limited to 'src/game') diff --git a/src/game/Pet.h b/src/game/Pet.h index 1057abc0edf..9d187b24b45 100644 --- a/src/game/Pet.h +++ b/src/game/Pet.h @@ -235,6 +235,7 @@ class Pet : public Creature uint64 GetAuraUpdateMask() { return m_auraUpdateMask; } void SetAuraUpdateMask(uint8 slot) { m_auraUpdateMask |= (uint64(1) << slot); } + void UnsetAuraUpdateMask(uint8 slot) { m_auraUpdateMask &= ~(uint64(1) << slot); } void ResetAuraUpdateMask() { m_auraUpdateMask = 0; } DeclinedName const* GetDeclinedNames() const { return m_declinedname; } diff --git a/src/game/Player.h b/src/game/Player.h index 9187ca3968d..c97f771190e 100644 --- a/src/game/Player.h +++ b/src/game/Player.h @@ -2069,6 +2069,7 @@ class TRINITY_DLL_SPEC Player : public Unit void SetGroupUpdateFlag(uint32 flag) { m_groupUpdateMask |= flag; } uint64 GetAuraUpdateMask() { return m_auraUpdateMask; } void SetAuraUpdateMask(uint8 slot) { m_auraUpdateMask |= (uint64(1) << slot); } + void UnsetAuraUpdateMask(uint8 slot) { m_auraUpdateMask &= ~(uint64(1) << slot); } Player* GetNextRandomRaidMember(float radius); PartyResult CanUninviteFromGroup() const; diff --git a/src/game/SpellAuras.cpp b/src/game/SpellAuras.cpp index 36e62831f61..d22266f2e15 100644 --- a/src/game/SpellAuras.cpp +++ b/src/game/SpellAuras.cpp @@ -886,7 +886,7 @@ void Aura::_AddAura() UpdateAuraCharges(); // update for out of range group members - m_target->UpdateAuraForGroup(slot); + m_target->UpdateAuraForGroup(slot, true); } } else // use found slot @@ -973,7 +973,7 @@ void Aura::_RemoveAura() SetAuraApplication(slot, 0); // update for out of range group members - m_target->UpdateAuraForGroup(slot); + m_target->UpdateAuraForGroup(slot, false); if( IsSealSpell(GetSpellProto()) ) m_target->ModifyAuraState(AURA_STATE_JUDGEMENT,false); diff --git a/src/game/Unit.cpp b/src/game/Unit.cpp index 8e81c11582b..b726e78c69e 100644 --- a/src/game/Unit.cpp +++ b/src/game/Unit.cpp @@ -12286,7 +12286,7 @@ uint32 Unit::GetCastingTimeForBonus( SpellEntry const *spellProto, DamageEffectT return CastingTime; } -void Unit::UpdateAuraForGroup(uint8 slot) +void Unit::UpdateAuraForGroup(uint8 slot, bool apply) { if(GetTypeId() == TYPEID_PLAYER) { @@ -12294,7 +12294,10 @@ void Unit::UpdateAuraForGroup(uint8 slot) if(player->GetGroup()) { player->SetGroupUpdateFlag(GROUP_UPDATE_FLAG_AURAS); - player->SetAuraUpdateMask(slot); + if(apply) + player->SetAuraUpdateMask(slot); + else + player->UnsetAuraUpdateMask(slot); } } else if(GetTypeId() == TYPEID_UNIT && ((Creature*)this)->isPet()) @@ -12306,7 +12309,10 @@ void Unit::UpdateAuraForGroup(uint8 slot) if(owner && (owner->GetTypeId() == TYPEID_PLAYER) && ((Player*)owner)->GetGroup()) { ((Player*)owner)->SetGroupUpdateFlag(GROUP_UPDATE_FLAG_PET_AURAS); - pet->SetAuraUpdateMask(slot); + if(apply) + pet->SetAuraUpdateMask(slot); + else + pet->UnsetAuraUpdateMask(slot); } } } diff --git a/src/game/Unit.h b/src/game/Unit.h index c3f5be3adb1..2f1af0c32d8 100644 --- a/src/game/Unit.h +++ b/src/game/Unit.h @@ -1392,7 +1392,7 @@ class TRINITY_DLL_SPEC Unit : public WorldObject void UpdateReactives(uint32 p_time); // group updates - void UpdateAuraForGroup(uint8 slot); + void UpdateAuraForGroup(uint8 slot, bool apply); // pet auras typedef std::set PetAuraSet; -- cgit v1.2.3 From f286c83d1525ee70ea60e8cffb1c8e3433a8dca2 Mon Sep 17 00:00:00 2001 From: megamage Date: Sat, 27 Dec 2008 16:37:55 -0600 Subject: *Fix a bug that Prayer of Shadow Protection cannot be casted on other party. --HG-- branch : trunk --- src/game/Spell.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/game') diff --git a/src/game/Spell.cpp b/src/game/Spell.cpp index 15259bf1af0..52aa86bcf24 100644 --- a/src/game/Spell.cpp +++ b/src/game/Spell.cpp @@ -1518,10 +1518,10 @@ void Spell::SetTargetMap(uint32 i,uint32 cur,std::list &TagUnitMap) case TARGET_UNIT_TARGET_ANY: // SelectMagnetTarget()? case TARGET_UNIT_TARGET_PARTY: case TARGET_UNIT_SINGLE_UNKNOWN: - TagUnitMap.push_back(m_targets.getUnitTarget()); + TagUnitMap.push_back(target); break; case TARGET_UNIT_PARTY_TARGET: - m_caster->GetPartyMember(TagUnitMap, radius); + target->GetPartyMember(TagUnitMap, radius); break; case TARGET_UNIT_TARGET_ENEMY: if(Unit* pUnitTarget = SelectMagnetTarget()) -- cgit v1.2.3 From a486314d2827dff92bba51a1cc289a7d504ae9ff Mon Sep 17 00:00:00 2001 From: Blaymoira Date: Sun, 28 Dec 2008 00:11:03 +0100 Subject: *Lost razorfen_kraul.cpp --HG-- branch : trunk --- .../scripts/zone/razorfen_kraul/razorfen_kraul.cpp | 203 +++++++++++++++++++++ src/game/Level2.cpp | 128 ++++++------- 2 files changed, 263 insertions(+), 68 deletions(-) create mode 100644 src/bindings/scripts/scripts/zone/razorfen_kraul/razorfen_kraul.cpp (limited to 'src/game') diff --git a/src/bindings/scripts/scripts/zone/razorfen_kraul/razorfen_kraul.cpp b/src/bindings/scripts/scripts/zone/razorfen_kraul/razorfen_kraul.cpp new file mode 100644 index 00000000000..2d70b503a77 --- /dev/null +++ b/src/bindings/scripts/scripts/zone/razorfen_kraul/razorfen_kraul.cpp @@ -0,0 +1,203 @@ +/* Copyright (C) 2006 - 2008 ScriptDev2 + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +/* ScriptData +SDName: Razorfen Kraul +SD%Complete: 100 +SDComment: Quest support: 1144 +SDCategory: Razorfen Kraul +EndScriptData */ + +/* ContentData +npc_willix +EndContentData */ + +#include "precompiled.h" +#include "../../npc/npc_escortAI.h" + +#define SAY_READY -1047000 +#define SAY_POINT -10470001 +#define SAY_AGGRO1 -1047002 +#define SAY_BLUELEAF -1047003 +#define SAY_DANGER -1047004 +#define SAY_BAD -1047005 +#define SAY_THINK -1047006 +#define SAY_SOON -1047007 +#define SAY_FINALY -1047008 +#define SAY_WIN -1047009 +#define SAY_END -1047010 + +#define QUEST_WILLIX_THE_IMPORTER 1144 +#define ENTRY_BOAR 4514 + +struct TRINITY_DLL_DECL npc_willixAI : public npc_escortAI +{ +npc_willixAI(Creature *c) : npc_escortAI(c) {Reset();} + + void WaypointReached(uint32 i) + { + Unit* player = Unit::GetUnit((*m_creature), PlayerGUID); + + if (!player) + return; + + switch (i) + { + case 3: + m_creature->HandleEmoteCommand(EMOTE_STATE_POINT); + DoScriptText(SAY_POINT, m_creature, player); + break; + case 4: + m_creature->SummonCreature(ENTRY_BOAR, 2137.66, 1843.98, 48.08, 1.54, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 25000); + break; + case 8: + DoScriptText(SAY_BLUELEAF, m_creature, player); + break; + case 9: + DoScriptText(SAY_DANGER, m_creature, player); + break; + case 13: + DoScriptText(SAY_BAD, m_creature, player); + break; + case 14: + m_creature->SummonCreature(ENTRY_BOAR, 2078.91, 1704.54, 56.77, 1.54, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 25000); + break; + case 25: + DoScriptText(SAY_THINK, m_creature, player); + break; + case 31: + DoScriptText(SAY_SOON, m_creature, player); + break; + case 42: + DoScriptText(SAY_FINALY, m_creature, player); + break; + case 43: + m_creature->SummonCreature(ENTRY_BOAR, 1956.43, 1596.97, 81.75, 1.54,TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 25000); + break; + case 45: + DoScriptText(SAY_WIN, m_creature, player); + if (player && player->GetTypeId() == TYPEID_PLAYER) + ((Player*)player)->GroupEventHappens(QUEST_WILLIX_THE_IMPORTER,m_creature); + break; + case 46: + DoScriptText(SAY_END, m_creature, player); + break; + } + } + + void Reset() {} + + void Aggro(Unit* who) + { + DoScriptText(SAY_AGGRO1, m_creature, NULL); + } + + void JustSummoned(Creature* summoned) + { + summoned->AI()->AttackStart(m_creature); + } + + void JustDied(Unit* killer) + { + if (PlayerGUID) + { + if (Unit* player = Unit::GetUnit((*m_creature), PlayerGUID)) + ((Player*)player)->FailQuest(QUEST_WILLIX_THE_IMPORTER); + } + } + + void UpdateAI(const uint32 diff) + { + npc_escortAI::UpdateAI(diff); + } +}; + +bool QuestAccept_npc_willix(Player* player, Creature* creature, Quest const* quest) +{ + if (quest->GetQuestId() == QUEST_WILLIX_THE_IMPORTER) + { + ((npc_escortAI*)(creature->AI()))->Start(true, true, false, player->GetGUID()); + DoScriptText(SAY_READY, creature, player); + } + + return true; +} + +CreatureAI* GetAI_npc_willix(Creature *_Creature) +{ + npc_willixAI* thisAI = new npc_willixAI(_Creature); + + thisAI->AddWaypoint(0, 2194.38, 1791.65, 65.48, 5000); + thisAI->AddWaypoint(1, 2188.56, 1805.87, 64.45); + thisAI->AddWaypoint(2, 2187, 1843.49, 59.33); + thisAI->AddWaypoint(3, 2163.27, 1851.67, 56.73, 5000); + thisAI->AddWaypoint(4, 2137.66, 1843.98, 48.08, 5000); + thisAI->AddWaypoint(5, 2140.22, 1845.02, 48.32); + thisAI->AddWaypoint(6, 2131.5, 1804.29, 46.85); + thisAI->AddWaypoint(7, 2096.18, 1789.03, 51.13); + thisAI->AddWaypoint(8, 2074.46, 1780.09, 55.64, 3000); + thisAI->AddWaypoint(9, 2055.12, 1768.67, 58.46, 5000); + thisAI->AddWaypoint(10, 2037.83, 1748.62, 60.27); + thisAI->AddWaypoint(11, 2037.51, 1728.94, 60.85); + thisAI->AddWaypoint(12, 2044.7, 1711.71, 59.71); + thisAI->AddWaypoint(13, 2067.66, 1701.84, 57.77, 3000); + thisAI->AddWaypoint(14, 2078.91, 1704.54, 56.77, 3000); + thisAI->AddWaypoint(15, 2097.65, 1715.24, 54.74); + thisAI->AddWaypoint(16, 2106.44, 1720.98, 54.41); + thisAI->AddWaypoint(17, 2123.96, 1732.56, 52.27); + thisAI->AddWaypoint(18, 2153.82, 1728.73, 51.92); + thisAI->AddWaypoint(19, 2163.49, 1706.33, 54.42); + thisAI->AddWaypoint(20, 2158.75, 1695.98, 55.70); + thisAI->AddWaypoint(21, 2142.6, 1680.72, 58.24); + thisAI->AddWaypoint(22, 2118.31, 1671.54, 59.21); + thisAI->AddWaypoint(23, 2086.02, 1672.04, 61.24); + thisAI->AddWaypoint(24, 2068.81, 1658.93, 61.24); + thisAI->AddWaypoint(25, 2062.82, 1633.31, 64.35, 3000); + thisAI->AddWaypoint(26, 2063.05, 1589.16, 63.26); + thisAI->AddWaypoint(27, 2063.67, 1577.22, 65.89); + thisAI->AddWaypoint(28, 2057.94, 1560.68, 68.40); + thisAI->AddWaypoint(29, 2052.56, 1548.05, 73.35); + thisAI->AddWaypoint(30, 2045.22, 1543.4, 76.65); + thisAI->AddWaypoint(31, 2034.35, 1543.01, 79.70); + thisAI->AddWaypoint(32, 2029.95, 1542.94, 80.79); + thisAI->AddWaypoint(33, 2021.34, 1538.67, 80.8); + thisAI->AddWaypoint(34, 2012.45, 1549.48, 79.93); + thisAI->AddWaypoint(35, 2008.05, 1554.92, 80.44); + thisAI->AddWaypoint(36, 2006.54, 1562.72, 81.11); + thisAI->AddWaypoint(37, 2003.8, 1576.43, 81.57); + thisAI->AddWaypoint(38, 2000.57, 1590.06, 80.62); + thisAI->AddWaypoint(39, 1998.96, 1596.87, 80.22); + thisAI->AddWaypoint(40, 1991.19, 1600.82, 79.39); + thisAI->AddWaypoint(41, 1980.71, 1601.44, 79.77, 3000); + thisAI->AddWaypoint(42, 1967.22, 1600.18, 80.62, 3000); + thisAI->AddWaypoint(43, 1956.43, 1596.97, 81.75, 3000); + thisAI->AddWaypoint(44, 1954.87, 1592.02, 82.18); + thisAI->AddWaypoint(45, 1948.35, 1571.35, 80.96, 30000); + thisAI->AddWaypoint(46, 1947.02, 1566.42, 81.80, 30000); + + return (CreatureAI*)thisAI; +} + +void AddSC_razorfen_kraul() +{ + Script *newscript; + + newscript = new Script; + newscript->Name = "npc_willix"; + newscript->GetAI = &GetAI_npc_willix; + newscript->pQuestAccept = &QuestAccept_npc_willix; + newscript->RegisterSelf(); +} \ No newline at end of file diff --git a/src/game/Level2.cpp b/src/game/Level2.cpp index ac82b8177c6..821ea1696d9 100644 --- a/src/game/Level2.cpp +++ b/src/game/Level2.cpp @@ -1679,80 +1679,72 @@ bool ChatHandler::HandleNpcFactionIdCommand(const char* args) //kick player bool ChatHandler::HandleKickPlayerCommand(const char *args) { - char* kickName = strtok((char*)args, " "); - char* kickReason = strtok(NULL, "\n"); + if(!*args) + return false; + + const char* kickName = strtok((char*)args, " "); + if(!kickName) + { - if (!kickName) - { - Player* player = getSelectedPlayer(); + SendSysMessage(LANG_NO_CHAR_SELECTED); + SetSentErrorMessage(true); + return false; + } + + std::string name = kickName; - if(!player) - { - SendSysMessage(LANG_NO_CHAR_SELECTED); - SetSentErrorMessage(true); - return false; - } + if(!normalizePlayerName(name)) + { + SendSysMessage(LANG_PLAYER_NOT_FOUND); + SetSentErrorMessage(true); + return false; + } + + if(m_session && name==m_session->GetPlayer()->GetName()) + { + SendSysMessage(LANG_COMMAND_KICKSELF); + SetSentErrorMessage(true); + return false; + } - if(player==m_session->GetPlayer()) - { - SendSysMessage(LANG_COMMAND_KICKSELF); - SetSentErrorMessage(true); - return false; - } - - if(player->GetSession()->GetSecurity() > m_session->GetSecurity()) - { - SendSysMessage(LANG_YOURS_SECURITY_IS_LOW); //maybe replacement string for this later on - SetSentErrorMessage(true); - return false; - } + Player* player = objmgr.GetPlayer(kickName); + if(!player) + { + SendSysMessage(LANG_PLAYER_NOT_FOUND); + SetSentErrorMessage(true); + return false; + } + + if(player->GetSession()->GetSecurity() > m_session->GetSecurity()) + { + SendSysMessage(LANG_YOURS_SECURITY_IS_LOW); //maybe replacement string for this later on + SetSentErrorMessage(true); + return false; + } + + char* kickReason = strtok(NULL, "\n"); + std::string reason = "No Reason"; + if(kickReason) + {reason = kickReason;} - player->GetSession()->KickPlayer(); - } - else + if(sWorld.KickPlayer(name.c_str())) { - std::string name = kickName; - std::string reason = "No Reason"; - if(kickReason) - reason = kickReason; - - if(!normalizePlayerName(name)) - { - SendSysMessage(LANG_PLAYER_NOT_FOUND); - SetSentErrorMessage(true); - return false; - } - - if(m_session && name==m_session->GetPlayer()->GetName()) - { - SendSysMessage(LANG_COMMAND_KICKSELF); - SetSentErrorMessage(true); - return false; - } - - if(objmgr.GetPlayer(kickName)->GetSession()->GetSecurity() > m_session->GetSecurity()) - { - SendSysMessage(LANG_YOURS_SECURITY_IS_LOW); //maybe replacement string for this later on - SetSentErrorMessage(true); - return false; - } - - if(sWorld.KickPlayer(name)) - { - if(sWorld.getConfig(CONFIG_SHOW_KICK_IN_WORLD) == 1) - { - sWorld.SendWorldText(LANG_COMMAND_KICKMESSAGE, name.c_str(), m_session->GetPlayer()->GetName(), reason.c_str()); - } - else - { - PSendSysMessage(LANG_COMMAND_KICKMESSAGE, name.c_str(), m_session->GetPlayer()->GetName(), reason.c_str()); - } - } - else - PSendSysMessage(LANG_COMMAND_KICKNOTFOUNDPLAYER, name.c_str()); - } + if(sWorld.getConfig(CONFIG_SHOW_KICK_IN_WORLD) == 1) + { + sWorld.SendWorldText(LANG_COMMAND_KICKMESSAGE, name.c_str(), m_session->GetPlayer()->GetName(), reason.c_str()); + } + else + { + PSendSysMessage(LANG_COMMAND_KICKMESSAGE, name.c_str(), m_session->GetPlayer()->GetName(), reason.c_str()); + } + } + else + { + PSendSysMessage(LANG_COMMAND_KICKNOTFOUNDPLAYER, name.c_str()); + return false; + } - return true; + return true; } //show info of player -- cgit v1.2.3 From 8d293c276c5b91d9a2c22c28a38d2edce8e36501 Mon Sep 17 00:00:00 2001 From: Blaymoira Date: Sun, 28 Dec 2008 09:17:48 +0100 Subject: *Not send notification LANG_NO_CMD to SEC_PLAYER - by Machiavelli --HG-- branch : trunk --- src/game/Chat.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src/game') diff --git a/src/game/Chat.cpp b/src/game/Chat.cpp index 203f8f6c624..1beb78b9419 100644 --- a/src/game/Chat.cpp +++ b/src/game/Chat.cpp @@ -856,6 +856,8 @@ int ChatHandler::ParseCommands(const char* text) if(strlen(text) < 2) return 0; + std::string fullcmd = text; // original `text` can't be used. It content destroyed in command code processing. + /// ignore messages staring from many dots. if(text[0] == '.' && text[1] == '.' || text[0] == '!' && text[1] == '!') return 0; @@ -864,9 +866,7 @@ int ChatHandler::ParseCommands(const char* text) if(text[0] == '!' || text[0] == '.') ++text; - std::string fullcmd = text; // original `text` can't be used. It content destroyed in command code processing. - - if(!ExecuteCommandInTable(getCommandTable(), text, fullcmd)) + if(!ExecuteCommandInTable(getCommandTable(), text, fullcmd) && m_session->GetSecurity() > SEC_PLAYER) SendSysMessage(LANG_NO_CMD); return 1; -- cgit v1.2.3 From f20e4be2e9e5c055373a6d59081d99dba33a93bb Mon Sep 17 00:00:00 2001 From: Blaymoira Date: Sun, 28 Dec 2008 09:53:23 +0100 Subject: *Rewrited HandleAccountSetGmLevelCommand - by Machiavelli --HG-- branch : trunk --- src/game/Level3.cpp | 109 ++++++++++++++++++++++++++++------------------------ 1 file changed, 58 insertions(+), 51 deletions(-) (limited to 'src/game') diff --git a/src/game/Level3.cpp b/src/game/Level3.cpp index c507df4c858..123b1dceb09 100644 --- a/src/game/Level3.cpp +++ b/src/game/Level3.cpp @@ -722,43 +722,57 @@ bool ChatHandler::HandleLoadScriptsCommand(const char* args) bool ChatHandler::HandleAccountSetGmLevelCommand(const char* args) { - char* arg1 = strtok((char*)args, " "); - if( !arg1 ) + if(!*args) return false; - /// must be NULL if targeted syntax and must be not nULL if not targeted - char* arg2 = strtok(NULL, " "); - std::string targetAccountName; uint32 targetAccountId = 0; uint32 targetSecurity = 0; + uint32 gm = 0; + char* arg1 = strtok((char*)args, " "); + char* arg2 = strtok(NULL, " "); - /// only target player different from self allowed (if targetPlayer!=NULL then not console) - Player* targetPlayer = getSelectedPlayer(); - if(targetPlayer && m_session->GetPlayer()!=targetPlayer) + if(getSelectedPlayer() && arg1 && !arg2) { - /// wrong command syntax or unexpected targeting - if(arg2) - return false; + targetAccountId = getSelectedPlayer()->GetSession()->GetAccountId(); + accmgr.GetName(targetAccountId, targetAccountName); + Player* targetPlayer = getSelectedPlayer(); + gm = atoi(arg1); - /// security level expected in arg2 after this if. - arg2 = arg1; + // Check for invalid specified GM level. + if ( (gm < SEC_PLAYER || gm > SEC_ADMINISTRATOR) ) + { + SendSysMessage(LANG_BAD_VALUE); + SetSentErrorMessage(true); + return false; + } - targetAccountId = targetPlayer->GetSession()->GetAccountId(); + // Check if targets GM level and specified GM level is not higher than current gm level targetSecurity = targetPlayer->GetSession()->GetSecurity(); - if(!accmgr.GetName(targetAccountId,targetAccountName)) + if(targetSecurity >= m_session->GetSecurity() || gm >= m_session->GetSecurity() ) { - PSendSysMessage(LANG_ACCOUNT_NOT_EXIST,targetAccountName.c_str()); + SendSysMessage(LANG_YOURS_SECURITY_IS_LOW); SetSentErrorMessage(true); return false; } - } - else + + // Decide which string to show + if(m_session->GetPlayer()!=targetPlayer) + { + PSendSysMessage(LANG_YOU_CHANGE_SECURITY, targetAccountName.c_str(), gm); + }else{ + PSendSysMessage(LANG_YOURS_SECURITY_CHANGED, m_session->GetPlayer()->GetName(), gm); + } + + loginDatabase.PExecute("UPDATE account SET gmlevel = '%d' WHERE id = '%u'", gm, targetAccountId); + return true; + }else { - /// wrong command syntax (second arg expected) + // Check for second parameter if(!arg2) return false; - + + // Check for account targetAccountName = arg1; if(!AccountMgr::normilizeString(targetAccountName)) { @@ -766,41 +780,34 @@ bool ChatHandler::HandleAccountSetGmLevelCommand(const char* args) SetSentErrorMessage(true); return false; } + + // Check for invalid specified GM level. + gm = atoi(arg2); + if ( (gm < SEC_PLAYER || gm > SEC_ADMINISTRATOR) ) + { + SendSysMessage(LANG_BAD_VALUE); + SetSentErrorMessage(true); + return false; + } + + targetAccountId = accmgr.GetId(arg1); + /// m_session==NULL only for console + uint32 plSecurity = m_session ? m_session->GetSecurity() : SEC_CONSOLE; - targetAccountId = accmgr.GetId(targetAccountName); + /// can set security level only for target with less security and to less security that we have + /// This is also reject self apply in fact targetSecurity = accmgr.GetSecurity(targetAccountId); - } - - int32 gm = (int32)atoi(arg2); - if ( gm < SEC_PLAYER || gm > SEC_ADMINISTRATOR ) - { - SendSysMessage(LANG_BAD_VALUE); - SetSentErrorMessage(true); - return false; - } - - /// m_session==NULL only for console - uint32 plSecurity = m_session ? m_session->GetSecurity() : SEC_CONSOLE; - - /// can set security level only for target with less security and to less security that we have - /// This is also reject self apply in fact - if(targetSecurity >= plSecurity || uint32(gm) >= plSecurity ) - { - SendSysMessage(LANG_YOURS_SECURITY_IS_LOW); - SetSentErrorMessage(true); - return false; - } + if(targetSecurity >= plSecurity || gm >= plSecurity ) + { + SendSysMessage(LANG_YOURS_SECURITY_IS_LOW); + SetSentErrorMessage(true); + return false; + } - if(targetPlayer) - { - ChatHandler(targetPlayer).PSendSysMessage(LANG_YOURS_SECURITY_CHANGED,GetName(), gm); - targetPlayer->GetSession()->SetSecurity(gm); + PSendSysMessage(LANG_YOU_CHANGE_SECURITY, targetAccountName.c_str(), gm); + loginDatabase.PExecute("UPDATE account SET gmlevel = '%d' WHERE id = '%u'", gm, targetAccountId); + return true; } - - PSendSysMessage(LANG_YOU_CHANGE_SECURITY, targetAccountName.c_str(), gm); - loginDatabase.PExecute("UPDATE account SET gmlevel = '%i' WHERE id = '%u'", gm, targetAccountId); - - return true; } /// Set password for account -- cgit v1.2.3 From 1a53ea2c02ed0fd865798e2c3b97b2871944d971 Mon Sep 17 00:00:00 2001 From: megamage Date: Sun, 28 Dec 2008 09:25:29 -0600 Subject: *Remove auras by caster when interrupt channelled spells. --HG-- branch : trunk --- src/game/Spell.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/game') diff --git a/src/game/Spell.cpp b/src/game/Spell.cpp index 52aa86bcf24..c17e5632cb9 100644 --- a/src/game/Spell.cpp +++ b/src/game/Spell.cpp @@ -2130,11 +2130,11 @@ void Spell::cancel() { Unit* unit = m_caster->GetGUID()==(*ihit).targetGUID ? m_caster : ObjectAccessor::GetUnit(*m_caster, ihit->targetGUID); if( unit && unit->isAlive() ) - unit->RemoveAurasDueToSpell(m_spellInfo->Id); + unit->RemoveAurasDueToCasterSpell(m_spellInfo->Id, m_caster->GetGUID()); } } - m_caster->RemoveAurasDueToSpell(m_spellInfo->Id); + m_caster->RemoveAurasDueToCasterSpell(m_spellInfo->Id, m_caster->GetGUID()); SendChannelUpdate(0); SendInterrupted(0); SendCastResult(SPELL_FAILED_INTERRUPTED); -- cgit v1.2.3 From f650b55c2300870f0a7fa0d3d24a0c7d30aaaf31 Mon Sep 17 00:00:00 2001 From: megamage Date: Sun, 28 Dec 2008 10:00:27 -0600 Subject: *Fix the bug that ~Unit makes crash. --HG-- branch : trunk --- src/game/Unit.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/game') diff --git a/src/game/Unit.cpp b/src/game/Unit.cpp index b726e78c69e..1fed4717db6 100644 --- a/src/game/Unit.cpp +++ b/src/game/Unit.cpp @@ -11095,6 +11095,8 @@ void Unit::CleanupsBeforeDelete() { if(m_uint32Values) // only for fully created object { + UnpossessSelf(false); + RemoveAllFromVision(); InterruptNonMeleeSpells(true); m_Events.KillAllEvents(false); // non-delatable (currently casted spells) will not deleted now but it will deleted at call in Map::RemoveAllObjectsInRemoveList CombatStop(); @@ -11104,8 +11106,6 @@ void Unit::CleanupsBeforeDelete() RemoveAllAuras(); RemoveAllGameObjects(); RemoveAllDynObjects(); - UnpossessSelf(false); - RemoveAllFromVision(); GetMotionMaster()->Clear(false); // remove different non-standard movement generators. } RemoveFromWorld(); -- cgit v1.2.3 From e7c220d84378fdfc5b9e08d86a9b4f1d28b1571f Mon Sep 17 00:00:00 2001 From: megamage Date: Sun, 28 Dec 2008 10:01:05 -0600 Subject: *Reset currentNode in waypoint generator initialize. By trullyone. --HG-- branch : trunk --- src/game/WaypointMovementGenerator.cpp | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src/game') diff --git a/src/game/WaypointMovementGenerator.cpp b/src/game/WaypointMovementGenerator.cpp index 8786d25549e..f962c242bff 100644 --- a/src/game/WaypointMovementGenerator.cpp +++ b/src/game/WaypointMovementGenerator.cpp @@ -94,6 +94,8 @@ template<> void WaypointMovementGenerator::Initialize(Creature &u) { + i_currentNode = 0; + StopedByPlayer = false; u.StopMoving(); if(!path_id) path_id = u.GetWaypointPath(); -- cgit v1.2.3 From 9fa37dc69344a28a585bc2dee6713d7ebaa03d28 Mon Sep 17 00:00:00 2001 From: megamage Date: Sun, 28 Dec 2008 10:31:52 -0600 Subject: *Update waypoint Initialize(). --HG-- branch : trunk --- src/game/WaypointMovementGenerator.cpp | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) (limited to 'src/game') diff --git a/src/game/WaypointMovementGenerator.cpp b/src/game/WaypointMovementGenerator.cpp index f962c242bff..589afa088c3 100644 --- a/src/game/WaypointMovementGenerator.cpp +++ b/src/game/WaypointMovementGenerator.cpp @@ -94,12 +94,14 @@ template<> void WaypointMovementGenerator::Initialize(Creature &u) { - i_currentNode = 0; + u.StopMoving(); + i_currentNode = -1; // uint32, become 0 in the first update + i_nextMoveTime.Reset(0); StopedByPlayer = false; - u.StopMoving(); - if(!path_id) - path_id = u.GetWaypointPath(); - waypoints = WaypointMgr.GetPath(path_id); + if(!path_id) + path_id = u.GetWaypointPath(); + /*i_currentNode = 0; + waypoints = WaypointMgr.GetPath(path_id); if(waypoints && waypoints->size()) { Traveller traveller(u); @@ -107,7 +109,7 @@ WaypointMovementGenerator::Initialize(Creature &u) InitTraveller(u,node); i_destinationHolder.SetDestination(traveller, node.x, node.y, node.z); i_nextMoveTime.Reset(i_destinationHolder.GetTotalTravelTime()); - } + }*/ } template<> -- cgit v1.2.3