Re: Implementing: Rules System
Posted: Thu Jul 07, 2011 4:56 pm
Scatto, I know you said you are out the next few days. Is the Rules code in a state where I can start adding rule defs yet, or you want me to wait?
http://oldforums.eq2classic.com/
Code: Select all
enum RuleCategory {
CHARACTER,
GLOBAL,
ZONE
};
enum RuleType {
MAX_LEVEL,
SERVER_GUILD_AUTOJOIN,
SERVER_GUILD_ID,
XP_MULTIPLIER,
XP_TRADESKILL_MULTIPLIER
};Code: Select all
ruleset_id, name
1, default_setCode: Select all
ruleset_id, rule_name, rule_value
1, AA:ExpPerPoint, 23976503
1, Aggro:CriticallyWoundedAggroMod, 100
1, Aggro:CurrentTargetAggroMod, 0
1, Aggro:IncapacitateAggroMod, 500
1, Aggro:MeleeRangeAggroMod, 10
1, Aggro:MovementImpairAggroMod, 175
1, Aggro:PetSpellAggroMod, 10
1, Aggro:SittingAggroMod, 35
1, Aggro:SlowAggroMod, 450
1, Aggro:SmartAggroList, true
1, Aggro:SongAggroMod, 33
1, Aggro:SpellAggroMod, 100
1, Aggro:StunAggroMod, 750
1, Bazaar:AuditTrail, false
1, Bazaar:EnableWarpToTrader, true
1, Bazaar:MaxBarterSearchResults, 200
1, Bazaar:MaxSearchResults, 50
1, Channels:DeleteTimer, 1440
1, Channels:RequiredStatusAdmin, 251
1, Channels:RequiredStatusListAll, 251
1, Character:AAExpMultiplier, 0.5
1, Character:AutosaveIntervalS, 300
1, Character:BindAnywhere, false
1, Character:ConsumptionMultiplier, 100
1, Character:CorpseDecayTimeMS, 10800000
1, Character:CorpseResTimeMS, 10800000
1, Character:DeathExpLossLevel, 10
1, Character:DeathExpLossMaxLevel, 255
1, Character:DeathExpLossMultiplier, 3
1, Character:DeathItemLossLevel, 10
1, Character:DragCorpseDistance, 400.000000
1, Character:EnduranceRegenMultiplier, 100
1, Character:ExpMultiplier, 0.5
1, Character:FeignKillsPet, false
1, Character:GroupExpMultiplier, 0.5
1, Character:HasteCap, 100
1, Character:HealOnLevel, false
1, Character:HPRegenMultiplier, 100
1, Character:ItemAccuracyCap, 150
1, Character:ItemAvoidanceCap, 100
1, Character:ItemCastsUseFocus, false
1, Character:ItemClairvoyanceCap, 250
1, Character:ItemCombatEffectsCap, 100
1, Character:ItemDamageShieldCap, 30
1, Character:ItemDoTShieldingCap, 35
1, Character:ItemDSMitigationCap, 50
1, Character:ItemEnduranceRegenCap, 15
1, Character:ItemHealAmtCap, 250
1, Character:ItemHealthRegenCap, 35
1, Character:ItemManaRegenCap, 15
1, Character:ItemShieldingCap, 35
1, Character:ItemSpellDmgCap, 250
1, Character:ItemSpellShieldingCap, 35
1, Character:ItemStrikethroughCap, 35
1, Character:ItemStunResistCap, 35
1, Character:KillsPerGroupLeadershipAA, 50
1, Character:KillsPerRaidLeadershipAA, 50
1, Character:LeaveCorpses, false
1, Character:LeaveNakedCorpses, false
1, Character:ManaRegenMultiplier, 100
1, Character:MaxDraggedCorpses, 2
1, Character:MaxExpLevel, 0
1, Character:MaxLevel, 80
1, Character:MinStatusForNoDropExemptions, 80
1, Character:RaidExpMultiplier, 0.2
1, Character:RespawnFromHover, true
1, Character:RespawnFromHoverTimer, 300
1, Character:RestRegenEndurance, false
1, Character:RestRegenPercent, 0
1, Character:RestRegenTimeToActivate, 30
1, Character:SharedBankPlat, false
1, Character:SkillCapMaxLevel, -1
1, Character:SkillUpModifier, 100
1, Character:SoDClientUseSoDHPManaEnd, false
1, Character:StatCap, 0
1, Character:UseDeathExpLossMult, true
1, Character:UseNewStatsWindow, true
1, Character:UseRaceClassExpBonuses, true
1, Chat:EnableMailKeyIPVerification, false
1, Chat:EnableVoiceMacros, false
1, Chat:ServerWideAuction, true
1, Chat:ServerWideOOC, true
1, Combat:AdjustProcPerMinute, true
1, Combat:AgiHitFactor, 0.01
1, Combat:ArcheryBaseDamageBonus, 1
1, Combat:ArcheryHitPenalty, 0.25
1, Combat:ArcheryNPCMultiplier, 1.0
1, Combat:ArcheryStationaryPenalty, 1.0
1, Combat:AssistNoTargetSelf, true
1, Combat:AvgProcsPerMinute, 18.0
1, Combat:BaseHitChance, 69
1, Combat:BaseProcChance, 0.035
1, Combat:BerserkBaseCritChance, 6
1, Combat:CasterHitChanceMod, 0.7
1, Combat:ClientBaseCritChance, 0
1, Combat:EnableFearPathing, true
1, Combat:FleeHPRatio, 25
1, Combat:FleeIfNotAlone, false
1, Combat:HeavyAvoidChanceMod, 1.0
1, Combat:HitBonusPerLevel, 0.4
1, Combat:HitFalloffMajor, 50.0
1, Combat:HitFalloffMinor, 5.0
1, Combat:HitFalloffModerate, 7.0
1, Combat:HitPerLevelDiff, 145
1, Combat:LightAvoidChanceMod, 0.91
1, Combat:MeleeBaseCritChance, 0
1, Combat:MeleeHitChanceMod, 1.0
1, Combat:MinRangedAttackDist, 25
1, Combat:ModerateAvoidChanceMod, 0.96
1, Combat:NPCBashKickLevel, 6
1, Combat:NPCBashKickStunChance, 15
1, Combat:PetAttackMagicLevel, 30
1, Combat:PriestHitChanceMod, 0.85
1, Combat:ProcDexDivideBy, 11000
1, Combat:ProcPerMinDexContrib, 0.075
1, Combat:UnarmoredAvoidChanceMod, 0.86
1, Combat:UseIntervalAC, true
1, Combat:WarBerBaseCritChance, 3
1, Combat:WeaponSkillFalloff, 0.33
1, EventLog:RecordBuyFromMerchant, false
1, EventLog:RecordSellToMerchant, false
1, GM:MinStatusToZoneAnywhere, 250
1, Guild:MaxMembers, 2048
1, Mail:EnableMailSystem, true
1, Mail:ExpireRead, 31536000
1, Mail:ExpireTrash, 0
1, Mail:ExpireUnread, 31536000
1, Map:FindBestZHeightAdjust, 1
1, Map:FixPathingZAtWaypoints, false
1, Map:FixPathingZMaxDeltaLoading, 45.0000000
1, Map:FixPathingZMaxDeltaMoving, 20.0000000
1, Map:FixPathingZMaxDeltaSendTo, 20.0000000
1, Map:FixPathingZMaxDeltaWaypoint, 20.0000000
1, Map:FixPathingZOnSendTo, false
1, Map:FixPathingZWhenLoading, true
1, Map:FixPathingZWhenMoving, false
1, Map:UseClosestZ, false
1, Merchant:BuyCostMod, 0.95
1, Merchant:ChaBonusMod, 3.45
1, Merchant:ChaPenaltyMod, 1.52
1, Merchant:PriceBonusPct, 4
1, Merchant:PricePenaltyPct, 4
1, Merchant:SellCostMod, 1.05
1, Merchant:UsePriceMod, true
1, NPC:BuffFriends, false
1, NPC:CorpseUnlockTimer, 150000
1, NPC:EmptyNPCCorpseDecayTimeMS, 0
1, NPC:EnableNPCQuestJournal, false
1, NPC:LastFightingDelayMovingMax, 20000
1, NPC:LastFightingDelayMovingMin, 10000
1, NPC:MajorNPCCorpseDecayTimeMS, 1500000
1, NPC:MinorNPCCorpseDecayTimeMS, 450000
1, NPC:OOCRegen, 0
1, NPC:ReturnNonQuestNoDropItems, false
1, NPC:SayPauseTimeInSec, 5
1, NPC:SmartLastFightingDelayMoving, true
1, NPC:UseItemBonusesForNonPets, true
1, Pathing:Aggro, true
1, Pathing:AggroReturnToGrid, true
1, Pathing:CandidateNodeRangeXY, 400.000000
1, Pathing:CandidateNodeRangeZ, 10.0000000
1, Pathing:CullNodesFromEnd, 1
1, Pathing:CullNodesFromStart, 1
1, Pathing:Fear, true
1, Pathing:Find, true
1, Pathing:Guard, true
1, Pathing:LOSCheckFrequency, 1000
1, Pathing:MaxNodesLeftForLOSCheck, 4
1, Pathing:MinDistanceForLOSCheckLong, 1000000.00
1, Pathing:MinDistanceForLOSCheckShort, 40000.0000
1, Pathing:MinNodesTraversedForLOSCheck, 3
1, Pathing:RouteUpdateFrequencyLong, 5000
1, Pathing:RouteUpdateFrequencyNodeCount, 5
1, Pathing:RouteUpdateFrequencyShort, 1000
1, Pathing:ZDiffThreshold, 10.0000000
1, Pets:AttackCommandRange, 150.000000
1, Skills:MaxTradeskillSearchSkillDiff, 50
1, Skills:MaxTrainTradeskills, 21
1, Skills:UseLimitTradeskillSearchSkillDiff, true
1, Spells:AutoResistDiff, 15
1, Spells:BaseCritChance, 0
1, Spells:BaseCritRatio, 100
1, Spells:EnableBlockedBuffs, true
1, Spells:EnableSpellGlobals, false
1, Spells:PartialHitChance, 0.69999998
1, Spells:PartialHitChanceFear, 0.25000000
1, Spells:ReflectType, 1
1, Spells:ResistChance, 2.00000000
1, Spells:ResistMod, 0.40000000
1, Spells:ResistPerLevelDiff, 85
1, Spells:SacrificeItemID, 9963
1, Spells:SacrificeMaxLevel, 69
1, Spells:SacrificeMinLevel, 46
1, Spells:TranslocateTimeLimit, 0
1, Spells:VirusSpreadDistance, 30
1, Spells:WizCritChance, 7
1, Spells:WizCritLevel, 12
1, Spells:WizCritRatio, 0
1, TaskSystem:EnableTaskProximity, true
1, TaskSystem:EnableTaskSystem, true
1, TaskSystem:KeepOneRecordPerCompletedTask, true
1, TaskSystem:PeriodicCheckTimer, 5
1, TaskSystem:RecordCompletedOptionalActivities, false
1, TaskSystem:RecordCompletedTasks, true
1, Watermap:CheckForWaterAtWaypoints, false
1, Watermap:CheckForWaterOnSendTo, false
1, Watermap:CheckForWaterWhenFishing, false
1, Watermap:CheckForWaterWhenMoving, false
1, Watermap:CheckWaypointsInWaterWhenLoading, false
1, Watermap:FishingLineLength, 40.0000000
1, Watermap:FishingRodLength, 30.0000000
1, World:AccountSessionLimit, -1
1, World:AddMaxClientsPerIP, -1
1, World:AddMaxClientsStatus, -1
1, World:ClearTempMerchantlist, true
1, World:ClientKeepaliveTimeoutMS, 65000
1, World:EnableReturnHomeButton, true
1, World:EnableTutorialButton, true
1, World:ExemptAccountLimitStatus, -1
1, World:ExemptMaxClientsStatus, -1
1, World:ExpansionSettings, 16383
1, World:FVNoDropFlag, 0
1, World:GMAccountIPList, false
1, World:GuildBankZoneID, 345
1, World:IsGMPetitionWindowEnabled, false
1, World:MaxClientsPerIP, -1
1, World:MaxClientsSetByStatus, false
1, World:MaxLevelForTutorial, 10
1, World:MinOfflineTimeToReturnHome, 21600
1, World:PVPSettings, 0
1, World:SoFStartZoneID, -1
1, World:TutorialZoneID, 189
1, World:UseBannedIPsTable, true
1, World:ZoneAutobootTimeoutMS, 60000
1, Zone:AutoShutdownDelay, 5000
1, Zone:ClientLinkdeadMS, 180000
1, Zone:EnableMQGateDetector, true
1, Zone:EnableMQGhostDetector, true
1, Zone:EnableMQWarpDetector, true
1, Zone:EnableMQZoneDetector, true
1, Zone:EnableShadowrest, false
1, Zone:GraveyardTimeMS, 1200000
1, Zone:MQGateExemptStatus, -1
1, Zone:MQGhostExemptStatus, -1
1, Zone:MQWarpDetectorDistance, 4900.00000
1, Zone:MQWarpExemptStatus, -1
1, Zone:MQWarpLagThreshold, 140.000000
1, Zone:MQWarpThresholdTimer, 90000.0000
1, Zone:MQZoneExemptStatus, -1
1, Zone:NPCGlobalPositionUpdateInterval, 60000
1, Zone:PEQZoneDebuff1, 4454
1, Zone:PEQZoneDebuff2, 2209
1, Zone:PEQZoneReuseTime, 900
1, Zone:UsePEQZoneDebuffs, trueDid that answer *this* question? Or TMI, as usual from me? teeScatman wrote:So where exactly are the global variables being set in the db again?
That's all I needed to know!John Adams wrote:The World knows what it's BASE, Global ruleset_id is because it is set in the `variables` table (default_ruleset_id = 1).
Probably from the pre-processor definition WORLD (LOGIN, etc).John Adams wrote:Does this make more sense, why I wanted to start with World (global) first? Btw, I cannot create a category called "WORLD" because it must already be defined somewhere else, because it errors when I try making it an ENUM.
Yep, that's exactly how the rules are implemented. Give me CHARACTER and MAX_LEVEL for zone id 253. If that rule isn't found in the rule set for zone 253, give me the default rule.John Adams wrote:Btw, while I like the ENUM concept, I am worried that you are thinking the Category ZONE *must* be a zone-rule only, and it is not. It is a World-wide rule for all zones. The only time a rule becomes specific to a zone is if the entire ruleset is bound to a zone via `zones`.`ruleset_id`.
Code: Select all
enum RuleType {
/* UI */
MAX_WHO_RESULTS,
MAX_WHO_OVERRIDE_STATUS,Code: Select all
enum RuleType {
/* UI */
MaxWhoResults,
MaxWhoOverrideStatus,Code: Select all
minLockedStatus = rule_manager.GetGlobalRule(R_World, ServerLockedOverrideStatus)->GetSInt16();
maxPlayers = rule_manager.GetGlobalRule(R_World, MaxPlayers)->GetSInt16();
minGameFullStatus = rule_manager.GetGlobalRule(R_World, MaxPlayersOverrideStatus)->GetSInt16();
Code: Select all
RULE_INIT(R_Player, MaxPlayers, "-1");
RULE_INIT(R_Player, MaxPlayersOverrideStatus, "100");Ok, good catch. Don't add anymore Rule getting into world yet. I'm going to change how you access a rule. Instead of rule_manager.GetZoneRule(cat,type)->GetInt16(), it'll be...rule_manager->GoneRuleInt16(cat, type). This way I can return a default type instead of returning NULL for the rule and crashing world. So integers will return 0, strings will return "", etc. Sound good?John Adams wrote:Bug 1: We need to handle this scenario we talked about... where some dumbass (me) calls to an invalid Category, Type combo.