diff options
author | Tartalo <none@none> | 2010-02-25 16:26:03 +0100 |
---|---|---|
committer | Tartalo <none@none> | 2010-02-25 16:26:03 +0100 |
commit | c76cb0ce7cae42970ac1b0792a9ee4ed33a23386 (patch) | |
tree | 5b8fa4196ec0451aa8ea6660faee7e3095bce352 | |
parent | 8c06fe676faa0e2a60f8848be0ae94d2cf0b2329 (diff) |
Add new flagged column to access_requirement to set instances opened/closed.
This way is possible to open a raid on 10man mode while the rest of modes are closed (for example).
Ingame commands to open/close instances coming soon ;)
--HG--
branch : trunk
-rw-r--r-- | sql/updates/7432_world_access_requirement.sql | 1 | ||||
-rw-r--r-- | sql/updates/7432_world_trinity_string.sql | 1 | ||||
-rw-r--r-- | sql/world.sql | 1 | ||||
-rw-r--r-- | src/game/Language.h | 2 | ||||
-rw-r--r-- | src/game/ObjectMgr.cpp | 5 | ||||
-rw-r--r-- | src/game/Player.cpp | 24 | ||||
-rw-r--r-- | src/game/Player.h | 12 |
7 files changed, 43 insertions, 3 deletions
diff --git a/sql/updates/7432_world_access_requirement.sql b/sql/updates/7432_world_access_requirement.sql new file mode 100644 index 00000000000..fcaabd1de2f --- /dev/null +++ b/sql/updates/7432_world_access_requirement.sql @@ -0,0 +1 @@ +ALTER TABLE `access_requirement` ADD COLUMN `status` TINYINT UNSIGNED DEFAULT 15 COMMENT 'instance status (open/close)'; diff --git a/sql/updates/7432_world_trinity_string.sql b/sql/updates/7432_world_trinity_string.sql new file mode 100644 index 00000000000..798cebb91be --- /dev/null +++ b/sql/updates/7432_world_trinity_string.sql @@ -0,0 +1 @@ +INSERT INTO `trinity_string` (`entry`,`content_default`) VALUES (5008,'This instance is closed.'); diff --git a/sql/world.sql b/sql/world.sql index de34753cf69..8d506e55f65 100644 --- a/sql/world.sql +++ b/sql/world.sql @@ -14775,6 +14775,7 @@ INSERT INTO `trinity_string` (`entry`,`content_default`,`content_loc1`,`content_ (5005, 'Following players are frozen on the server:', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), (5006, '- %s', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), (5007, 'You must be in a raid group to enter this instance.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(5008, 'This instance is closed.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), (5009, 'Sound %u Played to server', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), (5010, 'linkGUID: %u, Entry: %u (%s)', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), (5011, 'You can''t teleport self to self!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), diff --git a/src/game/Language.h b/src/game/Language.h index 3e954be14d1..f83ef222b6b 100644 --- a/src/game/Language.h +++ b/src/game/Language.h @@ -862,7 +862,7 @@ enum TrinityStrings LANG_COMMAND_LIST_FREEZE = 5005, LANG_COMMAND_FROZEN_PLAYERS = 5006, LANG_INSTANCE_RAID_GROUP_ONLY = 5007, - //LANG_INSTANCE_NOT_AS_GHOST = 5008, + LANG_INSTANCE_CLOSED = 5008, LANG_COMMAND_PLAYED_TO_ALL = 5009, LANG_NPCINFO_LINKGUID = 5010, LANG_TELEPORTED_TO_BY_CONSOLE = 5011, diff --git a/src/game/ObjectMgr.cpp b/src/game/ObjectMgr.cpp index cdc267ad1bd..895e651baef 100644 --- a/src/game/ObjectMgr.cpp +++ b/src/game/ObjectMgr.cpp @@ -5739,8 +5739,8 @@ void ObjectMgr::LoadAccessRequirements() uint32 count = 0; - // 0 1 2 3 4 5 6 7 8 9 10 11 - QueryResult_AutoPtr 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, heroic_level_min FROM access_requirement"); + // 0 1 2 3 4 5 6 7 8 9 10 11 12 + QueryResult_AutoPtr 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, heroic_level_min, status FROM access_requirement"); if( !result ) { @@ -5778,6 +5778,7 @@ void ObjectMgr::LoadAccessRequirements() ar.questFailedText = fields[8].GetCppString(); ar.heroicQuest = fields[9].GetUInt32(); ar.heroicQuestFailedText = fields[10].GetCppString(); + ar.status = fields[12].GetUInt8(); if(ar.item) { diff --git a/src/game/Player.cpp b/src/game/Player.cpp index 8379ec77d58..1a5e2720525 100644 --- a/src/game/Player.cpp +++ b/src/game/Player.cpp @@ -16980,6 +16980,30 @@ bool Player::Satisfy(AccessRequirement const *ar, uint32 target_map, bool report if(!mapEntry) return false; + bool closed = false; + + switch(mapEntry->IsRaid() ? GetRaidDifficulty() : GetDungeonDifficulty()) + { + case DUNGEON_DIFFICULTY_NORMAL: + closed = (ar->status & DUNGEON_STATUSFLAG_NORMAL) == 0; + break; + case DUNGEON_DIFFICULTY_HEROIC: + closed = (ar->status & DUNGEON_STATUSFLAG_HEROIC) == 0; + break; + case RAID_DIFFICULTY_10MAN_HEROIC: + closed = (ar->status & RAID_STATUSFLAG_10MAN_HEROIC) == 0; + break; + case RAID_DIFFICULTY_25MAN_HEROIC: + closed = (ar->status & RAID_STATUSFLAG_25MAN_HEROIC) == 0; + break; + } + + if (closed) + { + GetSession()->SendAreaTriggerMessage(GetSession()->GetTrinityString(LANG_INSTANCE_CLOSED)); + return false; + } + bool isNormalTargetMap = mapEntry->IsRaid() ? (GetRaidDifficulty() == RAID_DIFFICULTY_10MAN_NORMAL) : (GetDungeonDifficulty() == DUNGEON_DIFFICULTY_NORMAL); diff --git a/src/game/Player.h b/src/game/Player.h index f1ccfc60331..ae179894121 100644 --- a/src/game/Player.h +++ b/src/game/Player.h @@ -868,6 +868,17 @@ struct InstancePlayerBind InstancePlayerBind() : save(NULL), perm(false) {} }; +enum DungeonStatusFlag +{ + DUNGEON_STATUSFLAG_NORMAL = 0x01, + DUNGEON_STATUSFLAG_HEROIC = 0x02, + + RAID_STATUSFLAG_10MAN_NORMAL = 0x01, + RAID_STATUSFLAG_25MAN_NORMAL = 0x02, + RAID_STATUSFLAG_10MAN_HEROIC = 0x04, + RAID_STATUSFLAG_25MAN_HEROIC = 0x08 +}; + struct AccessRequirement { uint8 levelMin; @@ -881,6 +892,7 @@ struct AccessRequirement std::string questFailedText; uint32 heroicQuest; std::string heroicQuestFailedText; + uint8 status; }; class PlayerTaxi |