Changeset 85
- Timestamp:
- 11/19/08 13:32:53 (17 years ago)
- Location:
- trunk
- Files:
-
- 1 added
- 9 modified
Legend:
- Unmodified
- Added
- Removed
-
trunk/sql/world.sql
r45 r85 2948 2948 2949 2949 -- 2950 -- Table structure for table `spell_disabled` 2951 -- 2952 2953 DROP TABLE IF EXISTS `spell_disabled`; 2954 CREATE TABLE `spell_disabled` ( 2955 `entry` int(11) unsigned NOT NULL default '0' COMMENT 'Spell entry', 2956 `disable_mask` int(8) unsigned NOT NULL default '0', 2957 `comment` varchar(64) NOT NULL default '', 2958 PRIMARY KEY (`entry`) 2959 ) ENGINE=MyISAM DEFAULT CHARSET=utf8 ROW_FORMAT=FIXED COMMENT='Disabled Spell System'; 2960 2961 -- 2962 -- Dumping data for table `spell_disabled` 2963 -- 2964 2965 LOCK TABLES `spell_disabled` WRITE; 2966 /*!40000 ALTER TABLE `spell_disabled` DISABLE KEYS */; 2967 /*!40000 ALTER TABLE `spell_disabled` ENABLE KEYS */; 2968 UNLOCK TABLES; 2969 2970 -- 2950 2971 -- Table structure for table `spell_elixir` 2951 2972 -- -
trunk/src/game/Chat.cpp
r83 r85 198 198 { "spell_target_position", SEC_ADMINISTRATOR, &ChatHandler::HandleReloadSpellTargetPositionCommand, "", NULL }, 199 199 { "spell_threats", SEC_ADMINISTRATOR, &ChatHandler::HandleReloadSpellThreatsCommand, "", NULL }, 200 { "spell_disabled", SEC_ADMINISTRATOR, &ChatHandler::HandleReloadSpellDisabledCommand, "", NULL }, 200 201 { "locales_creature", SEC_ADMINISTRATOR, &ChatHandler::HandleReloadLocalesCreatureCommand, "", NULL }, 201 202 { "locales_gameobject", SEC_ADMINISTRATOR, &ChatHandler::HandleReloadLocalesGameobjectCommand, "", NULL }, -
trunk/src/game/Chat.h
r79 r85 194 194 bool HandleReloadSpellThreatsCommand(const char* args); 195 195 bool HandleReloadSpellPetAurasCommand(const char* args); 196 bool HandleReloadSpellDisabledCommand(const char* args); 196 197 bool HandleReloadPageTextsCommand(const char* args); 197 198 bool HandleReloadItemEnchantementsCommand(const char* args); -
trunk/src/game/Level3.cpp
r79 r85 151 151 HandleReloadSpellThreatsCommand("a"); 152 152 HandleReloadSpellPetAurasCommand("a"); 153 HandleReloadSpellDisabledCommand("a"); 153 154 return true; 154 155 } … … 610 611 611 612 SendGlobalSysMessage("DB table `game_tele` reloaded."); 613 614 return true; 615 } 616 617 bool ChatHandler::HandleReloadSpellDisabledCommand(const char* /*arg*/) 618 { 619 sLog.outString( "Re-Loading spell disabled table..."); 620 621 objmgr.LoadSpellDisabledEntrys(); 622 623 SendGlobalSysMessage("DB table `spell_disabled` reloaded."); 612 624 613 625 return true; … … 5577 5589 { 5578 5590 player = getSelectedPlayer(); 5579 5591 if (player) //prevent crash with creature as target 5580 5592 { 5581 5593 name = player->GetName(); … … 5610 5622 player->setFaction(35); 5611 5623 player->CombatStop(); 5612 5624 if(player->IsNonMeleeSpellCasted(true)) 5613 5625 player->InterruptNonMeleeSpells(true); 5614 5626 player->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); 5615 5627 player->SetUInt32Value(PLAYER_DUEL_TEAM, 1); 5616 5628 5617 5629 //if player class = hunter || warlock remove pet if alive 5618 5630 if((player->getClass() == CLASS_HUNTER) || (player->getClass() == CLASS_WARLOCK)) 5619 5631 { … … 5662 5674 { 5663 5675 player = getSelectedPlayer(); 5664 5676 if (player) //prevent crash with creature as target 5665 5677 { 5666 5678 name = player->GetName(); … … 5697 5709 { 5698 5710 //check for offline players 5699 5711 QueryResult *result = CharacterDatabase.PQuery("SELECT characters.guid FROM `characters` WHERE characters.name = '%s'",name.c_str()); 5700 5712 if(!result) 5701 5702 5713 { 5714 SendSysMessage(LANG_COMMAND_FREEZE_WRONG); 5703 5715 return true; 5704 5705 5706 5716 } 5717 //if player found: delete his freeze aura 5718 Field *fields=result->Fetch(); 5707 5719 uint64 pguid = fields[0].GetUInt64(); 5708 5720 delete result; 5709 5721 CharacterDatabase.PQuery("DELETE FROM `character_aura` WHERE character_aura.spell = 9454 AND character_aura.guid = '%u'",pguid); 5710 5722 PSendSysMessage(LANG_COMMAND_UNFREEZE,name.c_str()); 5711 5723 return true; 5712 5713 5714 { 5715 5724 } 5725 else 5726 { 5727 SendSysMessage(LANG_COMMAND_FREEZE_WRONG); 5716 5728 return true; 5717 5729 } 5718 5730 } 5719 5731 -
trunk/src/game/ObjectMgr.cpp
r83 r85 6292 6292 } 6293 6293 6294 void ObjectMgr::LoadSpellDisabledEntrys() 6295 { 6296 m_DisabledPlayerSpells.clear(); // need for reload case 6297 m_DisabledCreatureSpells.clear(); 6298 QueryResult *result = WorldDatabase.Query("SELECT entry, disable_mask FROM spell_disabled"); 6299 6300 uint32 total_count = 0; 6301 6302 if( !result ) 6303 { 6304 barGoLink bar( 1 ); 6305 bar.step(); 6306 6307 sLog.outString(); 6308 sLog.outString( ">> Loaded %u disabled spells", total_count ); 6309 return; 6310 } 6311 6312 barGoLink bar( result->GetRowCount() ); 6313 6314 Field* fields; 6315 do 6316 { 6317 bar.step(); 6318 fields = result->Fetch(); 6319 uint32 spellid = fields[0].GetUInt32(); 6320 if(!sSpellStore.LookupEntry(spellid)) 6321 { 6322 sLog.outErrorDb("Spell entry %u from `spell_disabled` doesn't exist in dbc, ignoring.",spellid); 6323 continue; 6324 } 6325 uint32 disable_mask = fields[1].GetUInt32(); 6326 if(disable_mask & SPELL_DISABLE_PLAYER) 6327 m_DisabledPlayerSpells.insert(spellid); 6328 if(disable_mask & SPELL_DISABLE_CREATURE) 6329 m_DisabledCreatureSpells.insert(spellid); 6330 ++total_count; 6331 } while ( result->NextRow() ); 6332 6333 delete result; 6334 6335 sLog.outString(); 6336 sLog.outString( ">> Loaded %u disabled spells from `spell_disabled`", total_count); 6337 } 6338 6294 6339 void ObjectMgr::LoadFishingBaseSkillLevel() 6295 6340 { -
trunk/src/game/ObjectMgr.h
r79 r85 690 690 static bool CheckDeclinedNames(std::wstring mainpart, DeclinedName const& names); 691 691 692 void LoadSpellDisabledEntrys(); 693 bool IsPlayerSpellDisabled(uint32 spellid) { return (m_DisabledPlayerSpells.count(spellid) != 0); } 694 bool IsCreatureSpellDisabled(uint32 spellid) { return (m_DisabledCreatureSpells.count(spellid) != 0); } 695 692 696 int GetIndexForLocale(LocaleConstant loc); 693 697 LocaleConstant GetLocaleForIndex(int i); … … 798 802 typedef std::set<std::string> ReservedNamesMap; 799 803 ReservedNamesMap m_ReservedNames; 804 805 std::set<uint32> m_DisabledPlayerSpells; 806 std::set<uint32> m_DisabledCreatureSpells; 800 807 801 808 GraveYardMap mGraveYardMap; -
trunk/src/game/Spell.cpp
r69 r85 2033 2033 } 2034 2034 2035 if(m_caster->GetTypeId() == TYPEID_PLAYER || (m_caster->GetTypeId() == TYPEID_UNIT && ((Creature*)m_caster)->isPet())) 2036 { 2037 if(objmgr.IsPlayerSpellDisabled(m_spellInfo->Id)) 2038 { 2039 SendCastResult(SPELL_FAILED_SPELL_UNAVAILABLE); 2040 finish(false); 2041 return; 2042 } 2043 } 2044 else 2045 { 2046 if(objmgr.IsCreatureSpellDisabled(m_spellInfo->Id)) 2047 { 2048 finish(false); 2049 return; 2050 } 2051 } 2052 2035 2053 // Fill cost data 2036 2054 m_powerCost = CalculatePowerCost(); -
trunk/src/game/SpellMgr.h
r44 r85 228 228 }; 229 229 230 enum SpellDisableTypes 231 { 232 SPELL_DISABLE_PLAYER = 1, 233 SPELL_DISABLE_CREATURE = 2 234 }; 235 230 236 //Some SpellFamilyFlags 231 237 #define SPELLFAMILYFLAG_ROGUE_VANISH 0x000000800LL -
trunk/src/game/World.cpp
r83 r85 1110 1110 objmgr.LoadCorpses(); 1111 1111 1112 sLog.outString( "Loading Disabled Spells..." ); 1113 objmgr.LoadSpellDisabledEntrys(); 1114 1112 1115 sLog.outString( "Loading Loot Tables..." ); 1113 1116 LoadLootTables();