*Implement access_requirement table - by Iskander
- now check the requirements on teleport not only on areatrigger use - moved some columns from instance_template and areatrigger_teleport to access_requirement table --HG-- branch : trunk
This commit is contained in:
@@ -0,0 +1,141 @@
|
||||
DROP TABLE IF EXISTS `access_requirement`;
|
||||
CREATE TABLE `access_requirement` (
|
||||
`id` bigint(20) unsigned NOT NULL COMMENT 'Identifier',
|
||||
`level_min` tinyint(3) unsigned NOT NULL default '0',
|
||||
`level_max` tinyint(3) unsigned NOT NULL default '0',
|
||||
`item` MEDIUMINT(8) UNSIGNED NOT NULL DEFAULT '0',
|
||||
`item2` MEDIUMINT(8) UNSIGNED NOT NULL DEFAULT '0',
|
||||
`heroic_key` MEDIUMINT(8) UNSIGNED NOT NULL DEFAULT '0',
|
||||
`heroic_key2` MEDIUMINT(8) UNSIGNED NOT NULL DEFAULT '0',
|
||||
`quest_done` MEDIUMINT(8) UNSIGNED NOT NULL DEFAULT '0',
|
||||
`quest_failed_text` TEXT NULL DEFAULT NULL,
|
||||
`heroic_quest_done` MEDIUMINT(8) UNSIGNED NOT NULL DEFAULT '0',
|
||||
`heroic_quest_failed_text` TEXT NULL DEFAULT NULL,
|
||||
`comment` TEXT NULL DEFAULT NULL,
|
||||
PRIMARY KEY (`id`)
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC COMMENT='Access Requirements';
|
||||
|
||||
|
||||
ALTER TABLE `instance_template`
|
||||
DROP COLUMN `levelMin`,
|
||||
DROP COLUMN `levelMax`,
|
||||
ADD COLUMN `access_id` bigint(20) unsigned NOT NULL DEFAULT '0' AFTER `reset_delay`;
|
||||
|
||||
ALTER TABLE `areatrigger_teleport`
|
||||
DROP COLUMN `required_level`,
|
||||
DROP COLUMN `required_item`,
|
||||
DROP COLUMN `required_item2`,
|
||||
DROP COLUMN `heroic_key`,
|
||||
DROP COLUMN `heroic_key2`,
|
||||
DROP COLUMN `heroic_required_quest_done`,
|
||||
DROP COLUMN `heroic_required_failed_quest_text`,
|
||||
DROP COLUMN `required_quest_done`,
|
||||
DROP COLUMN `required_failed_text`,
|
||||
ADD COLUMN `access_id` bigint(20) unsigned NOT NULL DEFAULT '0' AFTER `name`;
|
||||
|
||||
INSERT INTO `access_requirement` VALUES
|
||||
('1','10','0','0','0','0','0','0',NULL,'0',NULL,'instance Shadowfang Keep (33)'),
|
||||
('2','15','0','0','0','0','0','0',NULL,'0',NULL,'instance The Stockade (34)'),
|
||||
('3','10','0','0','0','0','0','0',NULL,'0',NULL,'instance The Deadmines (36)'),
|
||||
('4','10','0','0','0','0','0','0',NULL,'0',NULL,'instance Wailing Caverns (43)'),
|
||||
('5','15','0','0','0','0','0','0',NULL,'0',NULL,'instance Razorfen Kraul (47)'),
|
||||
('6','10','0','0','0','0','0','0',NULL,'0',NULL,'instance Blackfathom Deeps (48)'),
|
||||
('7','30','0','0','0','0','0','0',NULL,'0',NULL,'instance Uldaman (70)'),
|
||||
('8','15','0','0','0','0','0','0',NULL,'0',NULL,'instance Gnomeregan (90)'),
|
||||
('9','35','0','0','0','0','0','0',NULL,'0',NULL,'instance Sunken Temple (109)'),
|
||||
('10','25','0','0','0','0','0','0',NULL,'0',NULL,'instance Razorfen Downs (129)'),
|
||||
('11','20','0','0','0','0','0','0',NULL,'0',NULL,'instance Scarlet Monastery (189)'),
|
||||
('12','35','0','0','0','0','0','0',NULL,'0',NULL,'instance Zul\'Farrak (209)'),
|
||||
('13','45','0','0','0','0','0','0',NULL,'0',NULL,'instance Blackrock Spire (229)'),
|
||||
('14','40','0','0','0','0','0','0',NULL,'0',NULL,'instance Blackrock Depths (230)'),
|
||||
('15','55','0','16309','0','0','0','0',NULL,'0',NULL,'instance Onyxia\'s Lair (249)'),
|
||||
('16','66','0','0','0','30635','0','10285','You can\'t enter Black Morass until you rescue Thrall from Durnholde Keep.','0',NULL,'instance The Black Morass (269)'),
|
||||
('17','45','0','13704','0','0','0','0',NULL,'0',NULL,'instance Scholomance (289)'),
|
||||
('18','50','0','0','0','0','0','0',NULL,'0',NULL,'instance Zul\'Gurub (309)'),
|
||||
('19','45','0','0','0','0','0','0',NULL,'0',NULL,'instance Stratholme (329)'),
|
||||
('20','30','0','0','0','0','0','0',NULL,'0',NULL,'instance Maraudon (349)'),
|
||||
('21','8','0','0','0','0','0','0',NULL,'0',NULL,'instance Ragefire Chasm (389)'),
|
||||
('22','50','0','0','0','0','0','7487',NULL,'0',NULL,'instance Molten Core (409)'),
|
||||
('23','45','0','0','0','0','0','0',NULL,'0',NULL,'instance Dire Maul (429)'),
|
||||
('24','60','0','0','0','0','0','7761',NULL,'0',NULL,'instance Blackwing Lair (469)'),
|
||||
('25','60','0','0','0','0','0','0',NULL,'0',NULL,'instance Ruins of Ahn\'Qiraj (509)'),
|
||||
('26','60','0','0','0','0','0','0',NULL,'0',NULL,'instance Temple of Ahn\'Qiraj (531)'),
|
||||
('27','68','0','0'/*'24490'*/,'0','0','0','0',NULL,'0',NULL,'instance Karazhan (532)'),
|
||||
('28','60','0','0','0','0','0','0',NULL,'0',NULL,'instance Naxxramas (533)'),
|
||||
('29','70','0','0','0','0','0','10445',NULL,'0',NULL,'instance Hyjal Summit (534)'),
|
||||
('30','55','0','0'/*'28395'*/,'0','30637','30622','0',NULL,'0',NULL,'instance The Shattered Halls (540)'),
|
||||
('31','55','0','0','0','30637','30622','0',NULL,'0',NULL,'instance The Blood Furnace (542)'),
|
||||
('32','55','0','0','0','30637','30622','0',NULL,'0',NULL,'instance Hellfire Ramparts (543)'),
|
||||
('33','65','0','0','0','0','0','0',NULL,'0',NULL,'instance Magtheridon\'s Lair (544)'),
|
||||
('34','55','0','0','0','30623','0','0',NULL,'0',NULL,'instance The Steamvault (545)'),
|
||||
('35','55','0','0','0','30623','0','0',NULL,'0',NULL,'instance The Underbog (546)'),
|
||||
('36','55','0','0','0','30623','0','0',NULL,'0',NULL,'instance The Slave Pens (547)'),
|
||||
('37','70','0','0','0','0','0','0'/*'10901'*/,NULL,'0',NULL,'instance Serpentshrine Cavern (548)'),
|
||||
('38','70','0','0'/*'31704'*/,'0','0','0','0',NULL,'0',NULL,'instance The Eye (550)'),
|
||||
('39','68','0','0'/*'31084'*/,'0','30634','0','0',NULL,'0',NULL,'instance The Arcatraz (552)'),
|
||||
('40','68','0','0','0','30634','0','0',NULL,'0',NULL,'instance The Botanica (553)'),
|
||||
('41','68','0','0','0','30634','0','0',NULL,'0',NULL,'instance The Mechanar (554)'),
|
||||
('42','65','0','27991','0','30633','0','0',NULL,'0',NULL,'instance Shadow Labyrinth (555)'),
|
||||
('43','55','0','0','0','30633','0','0',NULL,'0',NULL,'instance Sethekk Halls (556)'),
|
||||
('44','55','0','0','0','30633','0','0',NULL,'0',NULL,'instance Mana-Tombs (557)'),
|
||||
('45','55','0','0','0','30633','0','0',NULL,'0',NULL,'instance Auchenai Crypts (558)'),
|
||||
('46','66','0','0','0','30635','0','0',NULL,'0',NULL,'instance Old Hillsbrad Foothills (560)'),
|
||||
('47','70','0','32649','0','0','0','0',NULL,'0',NULL,'instance Black Temple (564)'),
|
||||
('48','65','0','0','0','0','0','0',NULL,'0',NULL,'instance Gruul\'s Lair (565)'),
|
||||
('49','70','0','0','0','0','0','0',NULL,'0',NULL,'instance Zul\'Aman (568)'),
|
||||
('50','70','0','0','0','0','0','0',NULL,'0',NULL,'instance Sunwell Plateau (580)'),
|
||||
('51','70','0','0','0','0','0','0',NULL,'11492','Heroic Difficulty requires completion of the "Hard to Kill" quest.','instance Magisters\' Terrace (585)'),
|
||||
('52','58','0','0','0','0','0','0',NULL,'0',NULL,'Dark Portal');
|
||||
|
||||
UPDATE `instance_template` SET `access_id` = '1' WHERE `map` = '33';
|
||||
UPDATE `instance_template` SET `access_id` = '2' WHERE `map` = '34';
|
||||
UPDATE `instance_template` SET `access_id` = '3' WHERE `map` = '36';
|
||||
UPDATE `instance_template` SET `access_id` = '4' WHERE `map` = '43';
|
||||
UPDATE `instance_template` SET `access_id` = '5' WHERE `map` = '47';
|
||||
UPDATE `instance_template` SET `access_id` = '6' WHERE `map` = '48';
|
||||
UPDATE `instance_template` SET `access_id` = '7' WHERE `map` = '70';
|
||||
UPDATE `instance_template` SET `access_id` = '8' WHERE `map` = '90';
|
||||
UPDATE `instance_template` SET `access_id` = '9' WHERE `map` = '109';
|
||||
UPDATE `instance_template` SET `access_id` = '10' WHERE `map` = '129';
|
||||
UPDATE `instance_template` SET `access_id` = '11' WHERE `map` = '189';
|
||||
UPDATE `instance_template` SET `access_id` = '12' WHERE `map` = '209';
|
||||
UPDATE `instance_template` SET `access_id` = '13' WHERE `map` = '229';
|
||||
UPDATE `instance_template` SET `access_id` = '14' WHERE `map` = '230';
|
||||
UPDATE `instance_template` SET `access_id` = '15' WHERE `map` = '249';
|
||||
UPDATE `instance_template` SET `access_id` = '16' WHERE `map` = '269';
|
||||
UPDATE `instance_template` SET `access_id` = '17' WHERE `map` = '289';
|
||||
UPDATE `instance_template` SET `access_id` = '18' WHERE `map` = '309';
|
||||
UPDATE `instance_template` SET `access_id` = '19' WHERE `map` = '329';
|
||||
UPDATE `instance_template` SET `access_id` = '20' WHERE `map` = '349';
|
||||
UPDATE `instance_template` SET `access_id` = '21' WHERE `map` = '389';
|
||||
UPDATE `instance_template` SET `access_id` = '22' WHERE `map` = '409';
|
||||
UPDATE `instance_template` SET `access_id` = '23' WHERE `map` = '429';
|
||||
UPDATE `instance_template` SET `access_id` = '24' WHERE `map` = '469';
|
||||
UPDATE `instance_template` SET `access_id` = '25' WHERE `map` = '509';
|
||||
UPDATE `instance_template` SET `access_id` = '26' WHERE `map` = '531';
|
||||
UPDATE `instance_template` SET `access_id` = '27' WHERE `map` = '532';
|
||||
UPDATE `instance_template` SET `access_id` = '28' WHERE `map` = '533';
|
||||
UPDATE `instance_template` SET `access_id` = '29' WHERE `map` = '534';
|
||||
UPDATE `instance_template` SET `access_id` = '30' WHERE `map` = '540';
|
||||
UPDATE `instance_template` SET `access_id` = '31' WHERE `map` = '542';
|
||||
UPDATE `instance_template` SET `access_id` = '32' WHERE `map` = '543';
|
||||
UPDATE `instance_template` SET `access_id` = '33' WHERE `map` = '544';
|
||||
UPDATE `instance_template` SET `access_id` = '34' WHERE `map` = '545';
|
||||
UPDATE `instance_template` SET `access_id` = '35' WHERE `map` = '546';
|
||||
UPDATE `instance_template` SET `access_id` = '36' WHERE `map` = '547';
|
||||
UPDATE `instance_template` SET `access_id` = '37' WHERE `map` = '548';
|
||||
UPDATE `instance_template` SET `access_id` = '38' WHERE `map` = '550';
|
||||
UPDATE `instance_template` SET `access_id` = '39' WHERE `map` = '552';
|
||||
UPDATE `instance_template` SET `access_id` = '40' WHERE `map` = '553';
|
||||
UPDATE `instance_template` SET `access_id` = '41' WHERE `map` = '554';
|
||||
UPDATE `instance_template` SET `access_id` = '42' WHERE `map` = '555';
|
||||
UPDATE `instance_template` SET `access_id` = '43' WHERE `map` = '556';
|
||||
UPDATE `instance_template` SET `access_id` = '44' WHERE `map` = '557';
|
||||
UPDATE `instance_template` SET `access_id` = '45' WHERE `map` = '558';
|
||||
UPDATE `instance_template` SET `access_id` = '46' WHERE `map` = '560';
|
||||
UPDATE `instance_template` SET `access_id` = '47' WHERE `map` = '564';
|
||||
UPDATE `instance_template` SET `access_id` = '48' WHERE `map` = '565';
|
||||
UPDATE `instance_template` SET `access_id` = '49' WHERE `map` = '568';
|
||||
UPDATE `instance_template` SET `access_id` = '50' WHERE `map` = '580';
|
||||
UPDATE `instance_template` SET `access_id` = '51' WHERE `map` = '585';
|
||||
UPDATE `areatrigger_teleport` SET `access_id` = '52' WHERE `id` IN ('4352','4354');
|
||||
@@ -168,4 +168,7 @@ INSTALL(FILES
|
||||
1069_world_scripts.sql
|
||||
1073_world_scripts.sql
|
||||
1074_world_scripts.sql
|
||||
1138_world.sql
|
||||
1142_world.sql
|
||||
1156_world.sql
|
||||
DESTINATION share/trinity/sql/updates)
|
||||
|
||||
+33
-10
@@ -82,14 +82,8 @@ UNLOCK TABLES;
|
||||
DROP TABLE IF EXISTS `areatrigger_teleport`;
|
||||
CREATE TABLE `areatrigger_teleport` (
|
||||
`id` mediumint(8) unsigned NOT NULL default '0' COMMENT 'Identifier',
|
||||
`name` text,
|
||||
`required_level` tinyint(3) unsigned NOT NULL default '0',
|
||||
`required_item` mediumint(8) unsigned NOT NULL default '0',
|
||||
`required_item2` mediumint(8) unsigned NOT NULL default '0',
|
||||
`heroic_key` mediumint(8) unsigned NOT NULL default '0',
|
||||
`heroic_key2` mediumint(8) unsigned NOT NULL default '0',
|
||||
`required_quest_done` int(11) unsigned NOT NULL default '0',
|
||||
`required_failed_text` text,
|
||||
`name` text,
|
||||
`access_id` bigint(20) unsigned NOT NULL DEFAULT '0',
|
||||
`target_map` smallint(5) unsigned NOT NULL default '0',
|
||||
`target_position_x` float NOT NULL default '0',
|
||||
`target_position_y` float NOT NULL default '0',
|
||||
@@ -108,6 +102,36 @@ LOCK TABLES `areatrigger_teleport` WRITE;
|
||||
/*!40000 ALTER TABLE `areatrigger_teleport` ENABLE KEYS */;
|
||||
UNLOCK TABLES;
|
||||
|
||||
--
|
||||
-- Table structure for table `access_requirement`
|
||||
--
|
||||
|
||||
DROP TABLE IF EXISTS `access_requirement`;
|
||||
CREATE TABLE `access_requirement` (
|
||||
`id` bigint(20) unsigned NOT NULL COMMENT 'Identifier',
|
||||
`level_min` tinyint(3) unsigned NOT NULL default '0',
|
||||
`level_max` tinyint(3) unsigned NOT NULL default '0',
|
||||
`item` MEDIUMINT(8) UNSIGNED NOT NULL DEFAULT '0',
|
||||
`item2` MEDIUMINT(8) UNSIGNED NOT NULL DEFAULT '0',
|
||||
`heroic_key` MEDIUMINT(8) UNSIGNED NOT NULL DEFAULT '0',
|
||||
`heroic_key2` MEDIUMINT(8) UNSIGNED NOT NULL DEFAULT '0',
|
||||
`quest_done` MEDIUMINT(8) UNSIGNED NOT NULL DEFAULT '0',
|
||||
`quest_failed_text` TEXT NULL DEFAULT NULL,
|
||||
`heroic_quest_done` MEDIUMINT(8) UNSIGNED NOT NULL DEFAULT '0',
|
||||
`heroic_quest_failed_text` TEXT NULL DEFAULT NULL,
|
||||
`comment` TEXT NULL DEFAULT NULL,
|
||||
PRIMARY KEY (`id`)
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC COMMENT='Access Requirements';
|
||||
|
||||
--
|
||||
-- Dumping data for table `access_requirement`
|
||||
--
|
||||
|
||||
LOCK TABLES `access_requirement` WRITE;
|
||||
/*!40000 ALTER TABLE `access_requirement` DISABLE KEYS */;
|
||||
/*!40000 ALTER TABLE `access_requirement` ENABLE KEYS */;
|
||||
UNLOCK TABLES;
|
||||
|
||||
--
|
||||
-- Table structure for table `battleground_template`
|
||||
--
|
||||
@@ -1369,10 +1393,9 @@ DROP TABLE IF EXISTS `instance_template`;
|
||||
CREATE TABLE `instance_template` (
|
||||
`map` smallint(5) unsigned NOT NULL,
|
||||
`parent` int(10) unsigned NOT NULL,
|
||||
`levelMin` tinyint(3) unsigned NOT NULL default '0',
|
||||
`levelMax` tinyint(3) unsigned NOT NULL default '0',
|
||||
`maxPlayers` tinyint(3) unsigned NOT NULL default '0',
|
||||
`reset_delay` int(10) unsigned NOT NULL default '0',
|
||||
`access_id` bigint(20) unsigned NOT NULL DEFAULT '0',
|
||||
`startLocX` float default NULL,
|
||||
`startLocY` float default NULL,
|
||||
`startLocZ` float default NULL,
|
||||
|
||||
@@ -247,6 +247,7 @@ ChatCommand * ChatHandler::getCommandTable()
|
||||
|
||||
{ "areatrigger_tavern", SEC_ADMINISTRATOR, true, &ChatHandler::HandleReloadAreaTriggerTavernCommand, "", NULL },
|
||||
{ "areatrigger_teleport", SEC_ADMINISTRATOR, true, &ChatHandler::HandleReloadAreaTriggerTeleportCommand, "", NULL },
|
||||
{ "access_requirement", SEC_ADMINISTRATOR, true, &ChatHandler::HandleReloadAccessRequirementCommand, "", NULL },
|
||||
{ "areatrigger_involvedrelation",SEC_ADMINISTRATOR, true, &ChatHandler::HandleReloadQuestAreaTriggersCommand, "", NULL },
|
||||
{ "event_scripts", SEC_ADMINISTRATOR, true, &ChatHandler::HandleReloadEventScriptsCommand, "", NULL },
|
||||
{ "command", SEC_ADMINISTRATOR, true, &ChatHandler::HandleReloadCommandCommand, "", NULL },
|
||||
|
||||
@@ -222,6 +222,7 @@ class ChatHandler
|
||||
bool HandleReloadWpScriptsCommand(const char* args);
|
||||
bool HandleReloadAreaTriggerTavernCommand(const char* args);
|
||||
bool HandleReloadAreaTriggerTeleportCommand(const char* args);
|
||||
bool HandleReloadAccessRequirementCommand(const char* args);
|
||||
bool HandleReloadEventScriptsCommand(const char* args);
|
||||
bool HandleReloadCommandCommand(const char* args);
|
||||
bool HandleReloadCreatureQuestRelationsCommand(const char* args);
|
||||
|
||||
@@ -572,6 +572,14 @@ bool ChatHandler::HandleReloadAreaTriggerTeleportCommand(const char*)
|
||||
return true;
|
||||
}
|
||||
|
||||
bool ChatHandler::HandleReloadAccessRequirementCommand(const char*)
|
||||
{
|
||||
sLog.outString( "Re-Loading Access Requirement definitions..." );
|
||||
objmgr.LoadAccessRequirements();
|
||||
SendGlobalGMSysMessage("DB table `access_requirement` reloaded.");
|
||||
return true;
|
||||
}
|
||||
|
||||
bool ChatHandler::HandleReloadCommandCommand(const char*)
|
||||
{
|
||||
load_command_table = true;
|
||||
|
||||
+2
-3
@@ -98,11 +98,10 @@ struct CreatureMover
|
||||
struct InstanceTemplate
|
||||
{
|
||||
uint32 map;
|
||||
uint32 parent;
|
||||
uint32 levelMin;
|
||||
uint32 levelMax;
|
||||
uint32 parent;
|
||||
uint32 maxPlayers;
|
||||
uint32 reset_delay;
|
||||
uint32 access_id;
|
||||
float startLocX;
|
||||
float startLocY;
|
||||
float startLocZ;
|
||||
|
||||
@@ -209,14 +209,12 @@ bool MapManager::CanPlayerEnter(uint32 mapid, Player* player)
|
||||
}
|
||||
}
|
||||
|
||||
// TODO: move this to a map dependent location
|
||||
/*if(i_data && i_data->IsEncounterInProgress())
|
||||
{
|
||||
sLog.outDebug("MAP: Player '%s' can't enter instance '%s' while an encounter is in progress.", player->GetName(), GetMapName());
|
||||
player->SendTransferAborted(GetId(), TRANSFER_ABORT_ZONE_IN_COMBAT);
|
||||
return(false);
|
||||
}*/
|
||||
return true;
|
||||
// Requirements
|
||||
InstanceTemplate const* instance = objmgr.GetInstanceTemplate(mapid);
|
||||
if(!instance)
|
||||
return false;
|
||||
|
||||
return player->Satisfy(objmgr.GetAccessRequirement(instance->access_id), mapid, true);
|
||||
}
|
||||
else
|
||||
return true;
|
||||
|
||||
@@ -854,60 +854,8 @@ void WorldSession::HandleAreaTriggerOpcode(WorldPacket & recv_data)
|
||||
if(!at)
|
||||
return;
|
||||
|
||||
if(!GetPlayer()->isGameMaster())
|
||||
{
|
||||
uint32 missingLevel = 0;
|
||||
if(GetPlayer()->getLevel() < at->requiredLevel && !sWorld.getConfig(CONFIG_INSTANCE_IGNORE_LEVEL))
|
||||
missingLevel = at->requiredLevel;
|
||||
|
||||
// must have one or the other, report the first one that's missing
|
||||
uint32 missingItem = 0;
|
||||
if(at->requiredItem)
|
||||
{
|
||||
if(!GetPlayer()->HasItemCount(at->requiredItem, 1) &&
|
||||
(!at->requiredItem2 || !GetPlayer()->HasItemCount(at->requiredItem2, 1)))
|
||||
missingItem = at->requiredItem;
|
||||
}
|
||||
else if(at->requiredItem2 && !GetPlayer()->HasItemCount(at->requiredItem2, 1))
|
||||
missingItem = at->requiredItem2;
|
||||
|
||||
uint32 missingKey = 0;
|
||||
uint32 missingHeroicQuest = 0;
|
||||
if(GetPlayer()->GetDifficulty() == DIFFICULTY_HEROIC)
|
||||
{
|
||||
if(at->heroicKey)
|
||||
{
|
||||
if(!GetPlayer()->HasItemCount(at->heroicKey, 1) &&
|
||||
(!at->heroicKey2 || !GetPlayer()->HasItemCount(at->heroicKey2, 1)))
|
||||
missingKey = at->heroicKey;
|
||||
}
|
||||
else if(at->heroicKey2 && !GetPlayer()->HasItemCount(at->heroicKey2, 1))
|
||||
missingKey = at->heroicKey2;
|
||||
|
||||
if(at->heroicQuest && !GetPlayer()->GetQuestRewardStatus(at->heroicQuest))
|
||||
missingHeroicQuest = at->heroicQuest;
|
||||
}
|
||||
|
||||
uint32 missingQuest = 0;
|
||||
if(at->requiredQuest && !GetPlayer()->GetQuestRewardStatus(at->requiredQuest))
|
||||
missingQuest = at->requiredQuest;
|
||||
|
||||
if(missingLevel || missingItem || missingKey || missingQuest || missingHeroicQuest)
|
||||
{
|
||||
// TODO: all this is probably wrong
|
||||
if(missingItem)
|
||||
SendAreaTriggerMessage(GetTrinityString(LANG_LEVEL_MINREQUIRED_AND_ITEM), at->requiredLevel, objmgr.GetItemPrototype(missingItem)->Name1);
|
||||
else if(missingKey)
|
||||
GetPlayer()->SendTransferAborted(at->target_mapId, TRANSFER_ABORT_DIFFICULTY2);
|
||||
else if(missingHeroicQuest)
|
||||
SendAreaTriggerMessage(at->heroicQuestFailedText.c_str());
|
||||
else if(missingQuest)
|
||||
SendAreaTriggerMessage(at->requiredFailedText.c_str());
|
||||
else if(missingLevel)
|
||||
SendAreaTriggerMessage(GetTrinityString(LANG_LEVEL_MINREQUIRED), missingLevel);
|
||||
return;
|
||||
}
|
||||
}
|
||||
if(!GetPlayer()->Satisfy(objmgr.GetAccessRequirement(at->access_id), at->target_mapId, true))
|
||||
return;
|
||||
|
||||
GetPlayer()->TeleportTo(at->target_mapId,at->target_X,at->target_Y,at->target_Z,at->target_Orientation,TELE_TO_NOT_LEAVE_TRANSPORT);
|
||||
}
|
||||
|
||||
+122
-74
@@ -5112,8 +5112,8 @@ void ObjectMgr::LoadAreaTriggerTeleports()
|
||||
|
||||
uint32 count = 0;
|
||||
|
||||
// 0 1 2 3 4 5 6 7 8 9 10 11 12 13
|
||||
QueryResult *result = WorldDatabase.Query("SELECT id, required_level, required_item, required_item2, heroic_key, heroic_key2, heroic_required_quest_done, heroic_required_failed_quest_text, required_quest_done, required_failed_text, target_map, target_position_x, target_position_y, target_position_z, target_orientation FROM areatrigger_teleport");
|
||||
// 0 1 2 3 4 5 6
|
||||
QueryResult *result = WorldDatabase.Query("SELECT id, access_id, target_map, target_position_x, target_position_y, target_position_z, target_orientation FROM areatrigger_teleport");
|
||||
if( !result )
|
||||
{
|
||||
|
||||
@@ -5140,20 +5140,12 @@ void ObjectMgr::LoadAreaTriggerTeleports()
|
||||
|
||||
AreaTrigger at;
|
||||
|
||||
at.requiredLevel = fields[1].GetUInt8();
|
||||
at.requiredItem = fields[2].GetUInt32();
|
||||
at.requiredItem2 = fields[3].GetUInt32();
|
||||
at.heroicKey = fields[4].GetUInt32();
|
||||
at.heroicKey2 = fields[5].GetUInt32();
|
||||
at.heroicQuest = fields[6].GetUInt32();
|
||||
at.heroicQuestFailedText = fields[7].GetCppString();
|
||||
at.requiredQuest = fields[8].GetUInt32();
|
||||
at.requiredFailedText = fields[9].GetCppString();
|
||||
at.target_mapId = fields[10].GetUInt32();
|
||||
at.target_X = fields[11].GetFloat();
|
||||
at.target_Y = fields[12].GetFloat();
|
||||
at.target_Z = fields[13].GetFloat();
|
||||
at.target_Orientation = fields[14].GetFloat();
|
||||
at.access_id = fields[1].GetUInt32();
|
||||
at.target_mapId = fields[2].GetUInt32();
|
||||
at.target_X = fields[3].GetFloat();
|
||||
at.target_Y = fields[4].GetFloat();
|
||||
at.target_Z = fields[5].GetFloat();
|
||||
at.target_Orientation = fields[6].GetFloat();
|
||||
|
||||
AreaTriggerEntry const* atEntry = sAreaTriggerStore.LookupEntry(Trigger_ID);
|
||||
if(!atEntry)
|
||||
@@ -5161,64 +5153,7 @@ void ObjectMgr::LoadAreaTriggerTeleports()
|
||||
sLog.outErrorDb("Area trigger (ID:%u) does not exist in `AreaTrigger.dbc`.",Trigger_ID);
|
||||
continue;
|
||||
}
|
||||
|
||||
if(at.requiredItem)
|
||||
{
|
||||
ItemPrototype const *pProto = GetItemPrototype(at.requiredItem);
|
||||
if(!pProto)
|
||||
{
|
||||
sLog.outError("Key item %u does not exist for trigger %u, removing key requirement.", at.requiredItem, Trigger_ID);
|
||||
at.requiredItem = 0;
|
||||
}
|
||||
}
|
||||
if(at.requiredItem2)
|
||||
{
|
||||
ItemPrototype const *pProto = GetItemPrototype(at.requiredItem2);
|
||||
if(!pProto)
|
||||
{
|
||||
sLog.outError("Second item %u not exist for trigger %u, remove key requirement.", at.requiredItem2, Trigger_ID);
|
||||
at.requiredItem2 = 0;
|
||||
}
|
||||
}
|
||||
|
||||
if(at.heroicKey)
|
||||
{
|
||||
ItemPrototype const *pProto = GetItemPrototype(at.heroicKey);
|
||||
if(!pProto)
|
||||
{
|
||||
sLog.outError("Heroic key item %u not exist for trigger %u, remove key requirement.", at.heroicKey, Trigger_ID);
|
||||
at.heroicKey = 0;
|
||||
}
|
||||
}
|
||||
|
||||
if(at.heroicKey2)
|
||||
{
|
||||
ItemPrototype const *pProto = GetItemPrototype(at.heroicKey2);
|
||||
if(!pProto)
|
||||
{
|
||||
sLog.outError("Heroic second key item %u not exist for trigger %u, remove key requirement.", at.heroicKey2, Trigger_ID);
|
||||
at.heroicKey2 = 0;
|
||||
}
|
||||
}
|
||||
|
||||
if(at.heroicQuest)
|
||||
{
|
||||
if(!mQuestTemplates[at.heroicQuest])
|
||||
{
|
||||
sLog.outErrorDb("Required Heroic Quest %u not exist for trigger %u, remove heroic quest done requirement.",at.heroicQuest,Trigger_ID);
|
||||
at.heroicQuest = 0;
|
||||
}
|
||||
}
|
||||
|
||||
if(at.requiredQuest)
|
||||
{
|
||||
if(!mQuestTemplates[at.requiredQuest])
|
||||
{
|
||||
sLog.outErrorDb("Required Quest %u not exist for trigger %u, remove quest done requirement.",at.requiredQuest,Trigger_ID);
|
||||
at.requiredQuest = 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
MapEntry const* mapEntry = sMapStore.LookupEntry(at.target_mapId);
|
||||
if(!mapEntry)
|
||||
{
|
||||
@@ -5242,6 +5177,119 @@ void ObjectMgr::LoadAreaTriggerTeleports()
|
||||
sLog.outString( ">> Loaded %u area trigger teleport definitions", count );
|
||||
}
|
||||
|
||||
void ObjectMgr::LoadAccessRequirements()
|
||||
{
|
||||
mAccessRequirements.clear(); // need for reload case
|
||||
|
||||
uint32 count = 0;
|
||||
|
||||
// 0 1 2 3 4 5 6 7 8 9 10
|
||||
QueryResult *result = WorldDatabase.Query("SELECT id, level_min, level_max, item, item2, heroic_key, heroic_key2, quest_done, quest_failed_text, heroic_quest_done, heroic_quest_failed_text FROM access_requirement");
|
||||
if( !result )
|
||||
{
|
||||
|
||||
barGoLink bar( 1 );
|
||||
|
||||
bar.step();
|
||||
|
||||
sLog.outString();
|
||||
sLog.outString( ">> Loaded %u access requirement definitions", count );
|
||||
return;
|
||||
}
|
||||
|
||||
barGoLink bar( result->GetRowCount() );
|
||||
|
||||
do
|
||||
{
|
||||
Field *fields = result->Fetch();
|
||||
|
||||
bar.step();
|
||||
|
||||
++count;
|
||||
|
||||
uint32 requiremt_ID = fields[0].GetUInt32();
|
||||
|
||||
AccessRequirement ar;
|
||||
|
||||
ar.levelMin = fields[1].GetUInt8();
|
||||
ar.levelMax = fields[2].GetUInt32();
|
||||
ar.item = fields[3].GetUInt32();
|
||||
ar.item2 = fields[4].GetUInt32();
|
||||
ar.heroicKey = fields[5].GetUInt32();
|
||||
ar.heroicKey2 = fields[6].GetUInt32();
|
||||
ar.quest = fields[7].GetUInt32();
|
||||
ar.questFailedText = fields[8].GetCppString();
|
||||
ar.heroicQuest = fields[9].GetUInt32();
|
||||
ar.heroicQuestFailedText = fields[10].GetCppString();
|
||||
|
||||
if(ar.item)
|
||||
{
|
||||
ItemPrototype const *pProto = GetItemPrototype(ar.item);
|
||||
if(!pProto)
|
||||
{
|
||||
sLog.outError("Key item %u does not exist for requirement %u, removing key requirement.", ar.item, requiremt_ID);
|
||||
ar.item = 0;
|
||||
}
|
||||
}
|
||||
|
||||
if(ar.item2)
|
||||
{
|
||||
ItemPrototype const *pProto = GetItemPrototype(ar.item2);
|
||||
if(!pProto)
|
||||
{
|
||||
sLog.outError("Second item %u does not exist for requirement %u, removing key requirement.", ar.item2, requiremt_ID);
|
||||
ar.item2 = 0;
|
||||
}
|
||||
}
|
||||
|
||||
if(ar.heroicKey)
|
||||
{
|
||||
ItemPrototype const *pProto = GetItemPrototype(ar.heroicKey);
|
||||
if(!pProto)
|
||||
{
|
||||
sLog.outError("Heroic key %u not exist for trigger %u, remove key requirement.", ar.heroicKey, requiremt_ID);
|
||||
ar.heroicKey = 0;
|
||||
}
|
||||
}
|
||||
|
||||
if(ar.heroicKey2)
|
||||
{
|
||||
ItemPrototype const *pProto = GetItemPrototype(ar.heroicKey2);
|
||||
if(!pProto)
|
||||
{
|
||||
sLog.outError("Second heroic key %u not exist for trigger %u, remove key requirement.", ar.heroicKey2, requiremt_ID);
|
||||
ar.heroicKey2 = 0;
|
||||
}
|
||||
}
|
||||
|
||||
if(ar.heroicQuest)
|
||||
{
|
||||
if(!mQuestTemplates[ar.heroicQuest])
|
||||
{
|
||||
sLog.outErrorDb("Required Heroic Quest %u not exist for trigger %u, remove heroic quest done requirement.",ar.heroicQuest,requiremt_ID);
|
||||
ar.heroicQuest = 0;
|
||||
}
|
||||
}
|
||||
|
||||
if(ar.quest)
|
||||
{
|
||||
if(!mQuestTemplates[ar.quest])
|
||||
{
|
||||
sLog.outErrorDb("Required Quest %u not exist for trigger %u, remove quest done requirement.",ar.quest,requiremt_ID);
|
||||
ar.quest = 0;
|
||||
}
|
||||
}
|
||||
|
||||
mAccessRequirements[requiremt_ID] = ar;
|
||||
|
||||
} while( result->NextRow() );
|
||||
|
||||
delete result;
|
||||
|
||||
sLog.outString();
|
||||
sLog.outString( ">> Loaded %u access requirement definitions", count );
|
||||
}
|
||||
|
||||
AreaTrigger const* ObjectMgr::GetGoBackTrigger(uint32 Map) const
|
||||
{
|
||||
const MapEntry *mapEntry = sMapStore.LookupEntry(Map);
|
||||
|
||||
+13
-9
@@ -102,15 +102,7 @@ extern ScriptMapMap sWaypointScripts;
|
||||
|
||||
struct AreaTrigger
|
||||
{
|
||||
uint8 requiredLevel;
|
||||
uint32 requiredItem;
|
||||
uint32 requiredItem2;
|
||||
uint32 heroicKey;
|
||||
uint32 heroicKey2;
|
||||
uint32 heroicQuest;
|
||||
std::string heroicQuestFailedText;
|
||||
uint32 requiredQuest;
|
||||
std::string requiredFailedText;
|
||||
uint32 access_id;
|
||||
uint32 target_mapId;
|
||||
float target_X;
|
||||
float target_Y;
|
||||
@@ -315,6 +307,8 @@ class ObjectMgr
|
||||
|
||||
typedef UNORDERED_MAP<uint32, uint32> AreaTriggerScriptMap;
|
||||
|
||||
typedef UNORDERED_MAP<uint32, AccessRequirement> AccessRequirementMap;
|
||||
|
||||
typedef UNORDERED_MAP<uint32, ReputationOnKillEntry> RepOnKillMap;
|
||||
|
||||
typedef UNORDERED_MAP<uint32, WeatherZoneChances> WeatherZoneMap;
|
||||
@@ -490,6 +484,14 @@ class ObjectMgr
|
||||
return NULL;
|
||||
}
|
||||
|
||||
AccessRequirement const* GetAccessRequirement(uint32 requirement) const
|
||||
{
|
||||
AccessRequirementMap::const_iterator itr = mAccessRequirements.find( requirement );
|
||||
if( itr != mAccessRequirements.end( ) )
|
||||
return &itr->second;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
AreaTrigger const* GetGoBackTrigger(uint32 Map) const;
|
||||
|
||||
uint32 GetAreaTriggerScriptId(uint32 trigger_id);
|
||||
@@ -565,6 +567,7 @@ class ObjectMgr
|
||||
void LoadGossipText();
|
||||
|
||||
void LoadAreaTriggerTeleports();
|
||||
void LoadAccessRequirements();
|
||||
void LoadQuestAreaTriggers();
|
||||
void LoadAreaTriggerScripts();
|
||||
void LoadTavernAreaTriggers();
|
||||
@@ -859,6 +862,7 @@ class ObjectMgr
|
||||
GossipTextMap mGossipText;
|
||||
AreaTriggerMap mAreaTriggers;
|
||||
AreaTriggerScriptMap mAreaTriggerScripts;
|
||||
AccessRequirementMap mAccessRequirements;
|
||||
|
||||
RepOnKillMap mRepOnKill;
|
||||
|
||||
|
||||
@@ -15227,6 +15227,70 @@ void Player::ConvertInstancesToGroup(Player *player, Group *group, uint64 player
|
||||
if(!player || has_solo) CharacterDatabase.PExecute("DELETE FROM character_instance WHERE guid = '%d' AND permanent = 0", GUID_LOPART(player_guid));
|
||||
}
|
||||
|
||||
bool Player::Satisfy(AccessRequirement const *ar, uint32 target_map, bool report)
|
||||
{
|
||||
if(!isGameMaster() && ar)
|
||||
{
|
||||
uint32 LevelMin = 0;
|
||||
if(getLevel() < ar->levelMin && !sWorld.getConfig(CONFIG_INSTANCE_IGNORE_LEVEL))
|
||||
LevelMin = ar->levelMin;
|
||||
|
||||
uint32 LevelMax = 0;
|
||||
if(ar->levelMax >= ar->levelMin && getLevel() > ar->levelMax && !sWorld.getConfig(CONFIG_INSTANCE_IGNORE_LEVEL))
|
||||
LevelMax = ar->levelMax;
|
||||
|
||||
uint32 missingItem = 0;
|
||||
if(ar->item)
|
||||
{
|
||||
if(!HasItemCount(ar->item, 1) &&
|
||||
(!ar->item2 || !HasItemCount(ar->item2, 1)))
|
||||
missingItem = ar->item;
|
||||
}
|
||||
else if(ar->item2 && !HasItemCount(ar->item2, 1))
|
||||
missingItem = ar->item2;
|
||||
|
||||
uint32 missingKey = 0;
|
||||
uint32 missingHeroicQuest = 0;
|
||||
if(GetDifficulty() == DIFFICULTY_HEROIC)
|
||||
{
|
||||
if(ar->heroicKey)
|
||||
{
|
||||
if(!HasItemCount(ar->heroicKey, 1) &&
|
||||
(!ar->heroicKey2 || !HasItemCount(ar->heroicKey2, 1)))
|
||||
missingKey = ar->heroicKey;
|
||||
}
|
||||
else if(ar->heroicKey2 && !HasItemCount(ar->heroicKey2, 1))
|
||||
missingKey = ar->heroicKey2;
|
||||
|
||||
if(ar->heroicQuest && !GetQuestRewardStatus(ar->heroicQuest))
|
||||
missingHeroicQuest = ar->heroicQuest;
|
||||
}
|
||||
|
||||
uint32 missingQuest = 0;
|
||||
if(ar->quest && !GetQuestRewardStatus(ar->quest))
|
||||
missingQuest = ar->quest;
|
||||
|
||||
if(LevelMin || LevelMax || missingItem || missingKey || missingQuest || missingHeroicQuest)
|
||||
{
|
||||
if(report)
|
||||
{
|
||||
if(missingItem)
|
||||
GetSession()->SendAreaTriggerMessage(GetSession()->GetTrinityString(LANG_LEVEL_MINREQUIRED_AND_ITEM), ar->levelMin, objmgr.GetItemPrototype(missingItem)->Name1);
|
||||
else if(missingKey)
|
||||
SendTransferAborted(target_map, TRANSFER_ABORT_DIFFICULTY2);
|
||||
else if(missingHeroicQuest)
|
||||
GetSession()->SendAreaTriggerMessage(ar->heroicQuestFailedText.c_str());
|
||||
else if(missingQuest)
|
||||
GetSession()->SendAreaTriggerMessage(ar->questFailedText.c_str());
|
||||
else if(LevelMin)
|
||||
GetSession()->SendAreaTriggerMessage(GetSession()->GetTrinityString(LANG_LEVEL_MINREQUIRED), LevelMin);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
bool Player::_LoadHomeBind(QueryResult *result)
|
||||
{
|
||||
bool ok = false;
|
||||
|
||||
@@ -830,6 +830,20 @@ struct InstancePlayerBind
|
||||
InstancePlayerBind() : save(NULL), perm(false) {}
|
||||
};
|
||||
|
||||
struct AccessRequirement
|
||||
{
|
||||
uint8 levelMin;
|
||||
uint8 levelMax;
|
||||
uint32 item;
|
||||
uint32 item2;
|
||||
uint32 heroicKey;
|
||||
uint32 heroicKey2;
|
||||
uint32 quest;
|
||||
std::string questFailedText;
|
||||
uint32 heroicQuest;
|
||||
std::string heroicQuestFailedText;
|
||||
};
|
||||
|
||||
class TRINITY_DLL_SPEC PlayerTaxi
|
||||
{
|
||||
public:
|
||||
@@ -2052,6 +2066,7 @@ class TRINITY_DLL_SPEC Player : public Unit
|
||||
void SendRaidInfo();
|
||||
void SendSavedInstances();
|
||||
static void ConvertInstancesToGroup(Player *player, Group *group = NULL, uint64 player_guid = 0);
|
||||
bool Satisfy(AccessRequirement const*, uint32 target_map, bool report = false);
|
||||
|
||||
/*********************************************************/
|
||||
/*** GROUP SYSTEM ***/
|
||||
|
||||
+2
-4
@@ -4027,10 +4027,8 @@ uint8 Spell::CanCast(bool strict)
|
||||
InstanceTemplate const* instance = ObjectMgr::GetInstanceTemplate(m_caster->GetMapId());
|
||||
if(!instance)
|
||||
return SPELL_FAILED_TARGET_NOT_IN_INSTANCE;
|
||||
if ( instance->levelMin > target->getLevel() )
|
||||
return SPELL_FAILED_LOWLEVEL;
|
||||
if ( instance->levelMax && instance->levelMax < target->getLevel() )
|
||||
return SPELL_FAILED_HIGHLEVEL;
|
||||
if(!target->Satisfy(objmgr.GetAccessRequirement(instance->access_id), m_caster->GetMapId()))
|
||||
return SPELL_FAILED_BAD_TARGETS;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
+4
-1
@@ -1201,7 +1201,10 @@ void World::SetInitialWorldSettings()
|
||||
objmgr.LoadQuestRelations(); // must be after quest load
|
||||
|
||||
sLog.outString( "Loading AreaTrigger definitions..." );
|
||||
objmgr.LoadAreaTriggerTeleports(); // must be after item template load
|
||||
objmgr.LoadAreaTriggerTeleports();
|
||||
|
||||
sLog.outString( "Loading Access Requirements..." );
|
||||
objmgr.LoadAccessRequirements(); // must be after item template load
|
||||
|
||||
sLog.outString( "Loading Quest Area Triggers..." );
|
||||
objmgr.LoadQuestAreaTriggers(); // must be after LoadQuests
|
||||
|
||||
@@ -39,8 +39,8 @@ const char ItemPrototypesrcfmt[]="iiiisiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii
|
||||
const char ItemPrototypedstfmt[]="iiiisiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiffiffiffiffiffiiiiiiiiiifiiifiiiiiifiiiiiifiiiiiifiiiiiifiiiisiiiiiiiiiiiiiiiiiiiiiiiiifiiiiii";
|
||||
const char PageTextfmt[]="isi";
|
||||
const char SpellThreatfmt[]="ii";
|
||||
const char InstanceTemplatesrcfmt[]="iiiiiiffffs";
|
||||
const char InstanceTemplatedstfmt[]="iiiiiiffffi";
|
||||
const char InstanceTemplatesrcfmt[]="iiiiiffffs";
|
||||
const char InstanceTemplatedstfmt[]="iiiiiffffi";
|
||||
|
||||
SQLStorage sCreatureStorage(CreatureInfosrcfmt, CreatureInfodstfmt, "entry","creature_template");
|
||||
SQLStorage sCreatureDataAddonStorage(CreatureDataAddonInfofmt,"guid","creature_addon");
|
||||
|
||||
Reference in New Issue
Block a user