From fe48f18f716478598024219f8d07ea035efb5824 Mon Sep 17 00:00:00 2001 From: Uleat Date: Tue, 1 Dec 2015 20:30:43 -0500 Subject: [PATCH] Added rule-based check for race/class restriction of spell scribing --- common/ruletypes.h | 1 + common/version.h | 2 +- utils/sql/db_update_manifest.txt | 1 + .../required/2015_12_01_spell_scribe_restriction_rule.sql | 7 +++++++ zone/client_process.cpp | 5 +++++ 5 files changed, 15 insertions(+), 1 deletion(-) create mode 100644 utils/sql/git/required/2015_12_01_spell_scribe_restriction_rule.sql diff --git a/common/ruletypes.h b/common/ruletypes.h index 06b908e76..91d3479be 100644 --- a/common/ruletypes.h +++ b/common/ruletypes.h @@ -125,6 +125,7 @@ RULE_BOOL(Character, ActiveInvSnapshots, false) // Takes a periodic snapshot of RULE_INT(Character, InvSnapshotMinIntervalM, 180) // Minimum time (in minutes) between inventory snapshots RULE_INT(Character, InvSnapshotMinRetryM, 30) // Time (in minutes) to re-attempt an inventory snapshot after a failure RULE_INT(Character, InvSnapshotHistoryD, 30) // Time (in days) to keep snapshot entries +RULE_BOOL(Character, RestrictSpellScribing, false) // Restricts spell scribing to allowable races/classes of spell scroll, if true RULE_CATEGORY_END() RULE_CATEGORY(Mercs) diff --git a/common/version.h b/common/version.h index 4f39b595c..1e1a9dc35 100644 --- a/common/version.h +++ b/common/version.h @@ -30,7 +30,7 @@ Manifest: https://github.com/EQEmu/Server/blob/master/utils/sql/db_update_manifest.txt */ -#define CURRENT_BINARY_DATABASE_VERSION 9089 +#define CURRENT_BINARY_DATABASE_VERSION 9090 #ifdef BOTS #define CURRENT_BINARY_BOTS_DATABASE_VERSION 9000 #else diff --git a/utils/sql/db_update_manifest.txt b/utils/sql/db_update_manifest.txt index aa1e46be9..3a34e4b09 100644 --- a/utils/sql/db_update_manifest.txt +++ b/utils/sql/db_update_manifest.txt @@ -343,6 +343,7 @@ 9087|2015_09_25_inventory_snapshots.sql|SHOW TABLES LIKE 'inventory_snapshots'|empty| 9088|2015_11_01_perl_event_export_settings.sql|SHOW TABLES LIKE 'perl_event_export_settings'|empty| 9089|2015_11_02_ai_idle_no_spell_recast_default_changes.sql|SELECT * FROM `rule_values` WHERE `rule_name` LIKE '%Spells:AI_IdleNoSpellMinRecast%' AND `rule_value` = '500'|not_empty| +9090|2015_12_01_spell_scribe_restriction_rule.sql|SELECT `rule_name` FROM `rule_values` WHERE `rule_name` LIKE 'Character:RestrictSpellScribing'|empty| # Upgrade conditions: # This won't be needed after this system is implemented, but it is used database that are not diff --git a/utils/sql/git/required/2015_12_01_spell_scribe_restriction_rule.sql b/utils/sql/git/required/2015_12_01_spell_scribe_restriction_rule.sql new file mode 100644 index 000000000..277e66882 --- /dev/null +++ b/utils/sql/git/required/2015_12_01_spell_scribe_restriction_rule.sql @@ -0,0 +1,7 @@ +INSERT INTO `rule_values` VALUES ('0', 'Character:RestrictSpellScribing', 'false', 'Restricts spell scribing to allowable races/classes of spell scroll, if true'); +INSERT INTO `rule_values` VALUES ('1', 'Character:RestrictSpellScribing', 'false', 'Restricts spell scribing to allowable races/classes of spell scroll, if true'); +INSERT INTO `rule_values` VALUES ('2', 'Character:RestrictSpellScribing', 'false', 'Restricts spell scribing to allowable races/classes of spell scroll, if true'); +INSERT INTO `rule_values` VALUES ('3', 'Character:RestrictSpellScribing', 'false', 'Restricts spell scribing to allowable races/classes of spell scroll, if true'); +INSERT INTO `rule_values` VALUES ('4', 'Character:RestrictSpellScribing', 'false', 'Restricts spell scribing to allowable races/classes of spell scroll, if true'); +INSERT INTO `rule_values` VALUES ('5', 'Character:RestrictSpellScribing', 'false', 'Restricts spell scribing to allowable races/classes of spell scroll, if true'); +INSERT INTO `rule_values` VALUES ('10', 'Character:RestrictSpellScribing', 'false', 'Restricts spell scribing to allowable races/classes of spell scroll, if true'); diff --git a/zone/client_process.cpp b/zone/client_process.cpp index a0be235a7..3b973e7b7 100644 --- a/zone/client_process.cpp +++ b/zone/client_process.cpp @@ -1153,6 +1153,11 @@ void Client::OPMemorizeSpell(const EQApplicationPacket* app) { const Item_Struct* item = inst->GetItem(); + if (RuleB(Character, RestrictSpellScribing) && !item->IsEquipable(GetRace(), GetClass())) { + Message_StringID(13, CANNOT_USE_ITEM); + break; + } + if(item && item->Scroll.Effect == (int32)(memspell->spell_id)) { ScribeSpell(memspell->spell_id, memspell->slot);