Jump to content

masteredu

Members
  • Posts

    4
  • Joined

  • Last visited

    Never
  • Donations

    0.00 GBP 

Posts posted by masteredu

  1. edit: here is the patch

    diff --git a/sql/mangos_spell_disabled.sql b/sql/mangos_spell_disabled.sql
    new file mode 100644
    index 0000000..d4fc43c
    --- /dev/null
    +++ b/sql/mangos_spell_disabled.sql    
    @@ -0,0 +1,6 @@
    +CREATE TABLE spell_disabled (
    +  entry int(11) unsigned NOT NULL default '0' COMMENT 'spell entry',
    +  ischeat_spell tinyint(3) unsigned NOT NULL default '0' COMMENT 'mark spell as cheat',
    +  active tinyint(3) unsigned NOT NULL default '1' COMMENT 'enable check of this spell',
    +  PRIMARY KEY  (entry)
    +) ENGINE=MyISAM DEFAULT CHARSET=utf8 ROW_FORMAT=FIXED COMMENT='Disabled Spell System';
    \\ No newline at end of file
    diff --git a/src/game/Chat.cpp b/src/game/Chat.cpp
    index c024989..891d96b 100644
    --- a/src/game/Chat.cpp
    +++ b/src/game/Chat.cpp
    @@ -465,6 +465,7 @@ ChatCommand * ChatHandler::getCommandTable()
            { "spell_scripts",               SEC_ADMINISTRATOR, true,  &ChatHandler::HandleReloadSpellScriptsCommand,            "", NULL },
            { "spell_target_position",       SEC_ADMINISTRATOR, true,  &ChatHandler::HandleReloadSpellTargetPositionCommand,     "", NULL },
            { "spell_threats",               SEC_ADMINISTRATOR, true,  &ChatHandler::HandleReloadSpellThreatsCommand,            "", NULL },
    +        { "spell_disabled",              SEC_ADMINISTRATOR, true,  &ChatHandler::HandleReloadSpellDisabledCommand,           "", NULL },
    
            { NULL,                          0,                 false, NULL,                                                     "", NULL }
        };
    diff --git a/src/game/Chat.h b/src/game/Chat.h
    index 45a0293..9c3ff0a 100644
    --- a/src/game/Chat.h
    +++ b/src/game/Chat.h
    @@ -386,6 +386,7 @@ class ChatHandler
            bool HandleReloadSpellTargetPositionCommand(const char* args);
            bool HandleReloadSpellThreatsCommand(const char* args);
            bool HandleReloadSpellPetAurasCommand(const char* args);
    +        bool HandleReloadSpellDisabledCommand(const char* args);
    
            bool HandleResetAchievementsCommand(const char * args);
            bool HandleResetAllCommand(const char * args);
    diff --git a/src/game/Level3.cpp b/src/game/Level3.cpp
    index 3e3e650..af40fc2 100644
    --- a/src/game/Level3.cpp
    +++ b/src/game/Level3.cpp
    @@ -163,6 +163,7 @@ bool ChatHandler::HandleReloadAllSpellCommand(const char*)
        HandleReloadSpellTargetPositionCommand("a");
        HandleReloadSpellThreatsCommand("a");
        HandleReloadSpellPetAurasCommand("a");
    +    HandleReloadSpellDisabledCommand("a");
        return true;
    }
    
    @@ -822,6 +823,17 @@ bool ChatHandler::HandleReloadLocalesQuestCommand(const char* /*arg*/)
        return true;
    }
    
    +bool ChatHandler::HandleReloadSpellDisabledCommand(const char* /*arg*/)
    +{
    +    sLog.outString( "Re-Loading spell disabled table...");
    +
    +    objmgr.LoadSpellDisabledEntrys();
    +
    +    SendGlobalSysMessage("DB table `spell_disabled` reloaded.");
    +
    +    return true;
    +}
    +
    bool ChatHandler::HandleLoadScriptsCommand(const char* args)
    {
        if(!LoadScriptingModule(args)) return true;
    diff --git a/src/game/ObjectMgr.cpp b/src/game/ObjectMgr.cpp
    index 6791db9..8b137f0 100644
    --- a/src/game/ObjectMgr.cpp
    +++ b/src/game/ObjectMgr.cpp
    @@ -7040,6 +7040,46 @@ const char *ObjectMgr::GetMangosString(int32 entry, int locale_idx) const
        return "<error>";
    }
    
    +void ObjectMgr::LoadSpellDisabledEntrys()
    +{
    +    m_spell_disabled.clear();                                // need for reload case
    +    QueryResult *result = WorldDatabase.Query("SELECT entry, ischeat_spell FROM spell_disabled where active=1");
    +
    +    uint32 total_count = 0;
    +    uint32 cheat_spell_count=0;
    +
    +    if( !result )
    +    {
    +        barGoLink bar( 1 );
    +        bar.step();
    +
    +        sLog.outString();
    +        sLog.outString( ">> Loaded %u disabled spells", total_count );
    +        return;
    +    }
    +
    +    barGoLink bar( result->GetRowCount() );
    +
    +    Field* fields;
    +    do
    +    {
    +        bar.step();
    +        fields = result->Fetch();
    +        uint32 spellid = fields[0].GetUInt32();
    +        bool ischeater = fields[1].GetBool();
    +        m_spell_disabled[spellid] = ischeater;
    +        ++total_count;
    +        if(ischeater)
    +        ++cheat_spell_count;
    +
    +    } while ( result->NextRow() );
    +
    +    delete result;
    +
    +    sLog.outString();
    +    sLog.outString( ">> Loaded %u disabled spells ( %u - is cheaters spells)", total_count, cheat_spell_count);
    +}
    +
    void ObjectMgr::LoadFishingBaseSkillLevel()
    {
        mFishingBaseForArea.clear();                            // for reload case
    diff --git a/src/game/ObjectMgr.h b/src/game/ObjectMgr.h
    index b36394c..6091439 100644
    --- a/src/game/ObjectMgr.h
    +++ b/src/game/ObjectMgr.h
    @@ -702,6 +702,20 @@ class ObjectMgr
    
            static bool CheckDeclinedNames(std::wstring mainpart, DeclinedName const& names);
    
    +        void LoadSpellDisabledEntrys();
    +        uint8 IsSpellDisabled(uint32 spellid)
    +        {
    +            uint8 result=0;
    +            SpellDisabledMap::const_iterator itr = m_spell_disabled.find(spellid);
    +            if(itr != m_spell_disabled.end())
    +            {
    +                result=1;
    +                if(itr->second != 0)
    +                    result=2;
    +            }
    +            return result;
    +        }
    +
            int GetIndexForLocale(LocaleConstant loc);
            LocaleConstant GetLocaleForIndex(int i);
    
    @@ -826,6 +840,9 @@ class ObjectMgr
            typedef std::set<std::wstring> ReservedNamesMap;
            ReservedNamesMap    m_ReservedNames;
    
    +        typedef UNORDERED_MAP<uint32, uint32> SpellDisabledMap;
    +        SpellDisabledMap  m_spell_disabled;
    +
            GraveYardMap        mGraveYardMap;
    
            GameTeleMap         m_GameTeleMap;
    diff --git a/src/game/Spell.cpp b/src/game/Spell.cpp
    index 8a68ea7..3b39f19 100644
    --- a/src/game/Spell.cpp
    +++ b/src/game/Spell.cpp
    @@ -2382,6 +2382,19 @@ void Spell::Prepare(SpellCastTargets const* targets, Aura* triggeredByAura)
            return;
        }
    
    +    if(uint8 result = objmgr.IsSpellDisabled(m_spellInfo->Id))
    +    {
    +        if(m_caster->GetTypeId() == TYPEID_PLAYER)
    +        {
    +            sLog.outDebug("Player %s cast a spell %u which was disabled by server administrator",   m_caster->GetName(), m_spellInfo->Id);
    +            if(result == 2)
    +            sLog.outChar("Player %s cast a spell %u which was disabled by server administrator and marked as CheatSpell",   m_caster->GetName(), m_spellInfo->Id);
    +        }
    +        SendCastResult(SPELL_FAILED_SPELL_UNAVAILABLE);
    +        finish(false);
    +        return;
    +    }
    +
        // Fill cost data
        m_powerCost = CalculatePowerCost();
    
    diff --git a/src/game/World.cpp b/src/game/World.cpp
    index c418d72..450de87 100644
    --- a/src/game/World.cpp
    +++ b/src/game/World.cpp
    @@ -1331,6 +1331,9 @@ void World::SetInitialWorldSettings()
        sLog.outString( "Loading Player Corpses..." );
        objmgr.LoadCorpses();
    
    +    sLog.outString( "Loading Spell disabled..." );
    +    objmgr.LoadSpellDisabledEntrys();
    +
        sLog.outString( "Loading Loot Tables..." );
        sLog.outString();
        LoadLootTables();
    

  2. Revision: * * 8220 *
    Date 24:7:2009. Time 11:23 
    //=====================================================
    *** Hardware ***
    Processor: Intel(R) Core(TM)2 Quad CPU    Q6600  @ 2.40GHz
    Number Of Processors: 4
    Physical Memory: 1572864 KB (Available: 706916 KB)
    Commit Charge Limit: 1572864 KB
    
    *** Operation System ***
    Microsoft Windows Server 2003 Standard Edition Service Pack 2 (Version 5.2, Build 3790)
    
    //=====================================================
    Exception code: C00000FD STACK_OVERFLOW
    Fault address:  0042F907 01:0002E907 C:\\server\\mangosd.exe
    
    Registers:
    EAX:0F372000
    EBX:136FC0E8
    ECX:0F372250
    EDX:00000003
    ESI:0000057D
    EDI:0089D060
    CS:EIP:0023:0042F907
    SS:ESP:002B:0F37D314  EBP:0F37D31C
    DS:002B  ES:002B  FS:0053  GS:002B
    Flags:00010206
    
    Call stack:
    Address   Frame     Function      SourceFile
    0042F907  00000000  _chkstk+27
    006B1C41  00000000  Spell::CheckItems+111
    006AD372  00000000  Spell::CheckCast+1012
    006A6C40  00000000  Spell::Prepare+290
    004568D5  00000000  Unit::CastSpell+1B5
    00456718  00000000  Unit::CastSpell+118
    0046A1F3  00000000  Unit::HandleProcTriggerSpell+1EA3
    004793E6  00000000  Unit::ProcDamageAndSpellFor+706
    004624FF  00000000  Unit::ProcDamageAndSpell+2F
    006A1B07  00000000  Spell::DoAllEffectOnTarget+2D7
    006A7A76  00000000  Spell::handle_immediate+E6
    006A78AD  00000000  Spell::cast+7AD
    006A6D44  00000000  Spell::Prepare+394
    00456B0D  00000000  Unit::CastCustomSpell+16D
    00456992  00000000  Unit::CastCustomSpell+82
    00465DDF  00000000  Unit::HandleDummyAuraProc+2EEF
    004795A9  00000000  Unit::ProcDamageAndSpellFor+8C9
    00462543  00000000  Unit::ProcDamageAndSpell+73
    006A1E37  00000000  Spell::DoAllEffectOnTarget+607
    006A7A76  00000000  Spell::handle_immediate+E6
    006A78AD  00000000  Spell::cast+7AD
    006A6D44  00000000  Spell::Prepare+394
    004568D5  00000000  Unit::CastSpell+1B5
    0082B85F  00000000  Spell::EffectDummy+46FF
    006AC063  00000000  Spell::HandleEffects+C3
    006A28D4  00000000  Spell::DoSpellHitOnUnit+5E4
    006A1A04  00000000  Spell::DoAllEffectOnTarget+1D4
    006A7A76  00000000  Spell::handle_immediate+E6
    006A78AD  00000000  Spell::cast+7AD
    006A6D44  00000000  Spell::Prepare+394
    004568D5  00000000  Unit::CastSpell+1B5
    00456718  00000000  Unit::CastSpell+118
    0083A0BC  00000000  Spell::EffectScriptEffect+1DAC
    006AC063  00000000  Spell::HandleEffects+C3
    006A28D4  00000000  Spell::DoSpellHitOnUnit+5E4
    006A1A04  00000000  Spell::DoAllEffectOnTarget+1D4
    006A7A76  00000000  Spell::handle_immediate+E6
    006A78AD  00000000  Spell::cast+7AD
    006A8390  00000000  Spell::update+290
    006B424D  00000000  SpellEvent::Execute+2D
    008D4D7C  00000000  EventProcessor::Update+EC
    0045382B  00000000  Unit::Update+3B
    004C0067  00000000  Player::Update+117
    0049A539  00000000  Map::Update+D9
    0080BB9E  00000000  MapInstanced::Update+DE
    0060CB58  00000000  MapManager::Update+128
    005ED8E0  00000000  World::Update+780
    0042F75E  00000000  WorldRunnable::run+8E
    0089D077  00000000  ACE_Based::Thread::ThreadTask+17
    00B714D4  00000000  __WSAFDIsSet+FFFFFFFFFFFCC45C
    78543433  00000000  _endthreadex+44
    785434C7  00000000  _endthreadex+D8
    7D4DFE21  00000000  FlsSetValue+136
    
    Call stack:
    Address   Frame     Function      SourceFile
    7D61C828  00000000  ZwWaitForSingleObject+15
    7D4D8BF1  00000000  WaitForSingleObject+12
    00B29C64  00000000  __WSAFDIsSet+FFFFFFFFFFF84BEC
    00B964DA  00000000  __WSAFDIsSet+FFFFFFFFFFFF1462
    00B9269F  00000000  __WSAFDIsSet+FFFFFFFFFFFED627
    0060988A  00000000  WorldSocketMgr::Wait+4A
    1BD771F4  00000000  0000:00000000 
    1BD771F4  00000000  0000:00000000 
    6C696146  00000000  

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue. Privacy Policy Terms of Use