/// <summary> /// 人物技能模板信息和魔法模板信息 /// </summary> private void LoadSkillTemplateAndSpellTemplate() { ////////////////////////////////////////////////////////////////////////// // 开始人物技能模板信息和魔法模板信息 for (uint iIndex = 0; iIndex < DBCInstances.SkillLineEntry.Count; ++iIndex) { SkillLineEntry skillLineEntry = DBCInstances.SkillLineEntry.LookupRowEntry(iIndex); if (skillLineEntry == null) { continue; } WowSkillTemplate wowSkillTemplate = new WowSkillTemplate(); wowSkillTemplate.Serial = skillLineEntry.ID; m_GlobalSkillTemplates.AddSkillTemplate(wowSkillTemplate.Serial, wowSkillTemplate); } for (uint iIndex = 0; iIndex < DBCInstances.SpellEntry.Count; ++iIndex) { SpellEntry spellEntry = DBCInstances.SpellEntry.LookupRowEntry(iIndex); if (spellEntry == null) { continue; } WowSpellTemplate wowSpellTemplate = new WowSpellTemplate(); wowSpellTemplate.Serial = spellEntry.ID; m_GlobalSpellTemplates.AddSpellTemplate(wowSpellTemplate.Serial, wowSpellTemplate); } LOGs.WriteLine(LogMessageType.MSG_INFO, "Wow世界:读取脚本内全部的 人物技能模板信息和魔法模板信息 完成"); }
public SpellScroll(SpellEntry spellEntry, int itemId, int amount) : base(itemId) { Stackable = true; Weight = 1.0; Amount = amount; SpellEntry = spellEntry; }
public SpellInfo(RichTextBox rtb, SpellEntry spell) { _rtb = rtb; _spell = spell; ProcInfo.SpellProc = spell; ViewSpellInfo(); }
public static SpellbookType GetTypeForSpell(SpellEntry spellId) { if ((int)spellId >= 0 && (int)spellId < 64) { return(SpellbookType.Regular); } return(SpellbookType.Invalid); }
public static Spell Create(SpellEntry entry, Mobile caster, Item scroll = null, bool spellStrike = false) { var spell = SpellRegistry.Create(entry, caster, scroll); spell.Caster = caster; spell.Scroll = scroll; spell.m_SpellStrike = spellStrike; return(spell); }
public SpellInfo(SpellEntry spellEntry) { SpellDescriptionVariablesEntry variables; Spell = spellEntry; if (DBC.DBC.SpellDescriptionVariables.TryGetValue(spellEntry.DescriptionVariablesID, out variables)) { DescriptionVariables = variables; } }
public Spell(SpellID spellID, SpellEntry spellEntry) { SpellID = spellID; //TODO Fix SpellEntry Name. Name = ""; Cooldown = spellEntry.RecoveryTime; CooldownCatagory = spellEntry.CategoryRecoveryTime; Catagory = spellEntry.Category; Range = spellEntry.rangeIndex > 0 ? spellEntry.rangeIndex : 30; IsPassive = spellEntry.Attributes.HasFlag(SpellAttributes.SPELL_ATTR_PASSIVE); }
private void OkClick(object sender, EventArgs e) { if (_lvSpellList.SelectedIndices.Count <= 0) { return; } Spell = _spellList[_lvSpellList.SelectedIndices[0]]; DialogResult = DialogResult.OK; Close(); }
private void _lvSpellList_SelectedIndexChanged(object sender, EventArgs e) { if (_lvSpellList.SelectedIndices.Count > 0) { SelectedSpell = _spellList[_lvSpellList.SelectedIndices[0]]; if (OnSpellChange != null) { OnSpellChange(this, new EventArgs()); } } }
private void SetProcAtribute(SpellEntry spell) { new SpellInfo(_rtbProcSpellInfo, spell); _cbProcSpellFamilyTree.SelectedValue = spell.SpellFamilyName; _clbProcFlags.SetCheckedItemFromFlag(spell.ProcFlags); _clbSchools.SetCheckedItemFromFlag(spell.SchoolMask); _cbProcFitstSpellFamily.SelectedValue = spell.SpellFamilyName; _tbPPM.Text = @"0"; // need correct value _tbChance.Text = spell.ProcChance.ToString(); _tbCooldown.Text = (spell.RecoveryTime / 1000f).ToString(); }
private void btnAdd_Click(object sender, EventArgs e) { if (String.IsNullOrEmpty(cbSpells.Text)) { return; } SpellEntry entry = new SpellEntry(); entry.Name = cbSpells.Text; lstSpells.Items.Add(entry.Name); _spellEffects.Add(entry); }
private void GetProcAttribute(SpellEntry spell) { var spellFamilyFlags = _tvFamilyTree.GetMask(); var statusproc = String.Format( "Spell ({0}) {1}. Proc Event ==> SchoolMask 0x{2:X2}, SpellFamily {3}, 0x{4:X8} {5:X8} {6:X8}, procFlag 0x{7:X8}, procEx 0x{8:X8}, PPMRate {9}", spell.ID, spell.SpellNameRank, _clbSchools.GetFlagsValue(), _cbProcFitstSpellFamily.ValueMember, spellFamilyFlags[0], spellFamilyFlags[1], spellFamilyFlags[2], _clbProcFlags.GetFlagsValue(), _clbProcFlagEx.GetFlagsValue(), _tbPPM.Text.ToFloat()); _gSpellProcEvent.Text = @"Spell Proc Event " + statusproc; }
public override void Deserialize(IGenericReader reader) { base.Deserialize(reader); var version = reader.ReadInt(); switch (version) { case 0: { SpellEntry = (SpellEntry)reader.ReadInt(); break; } } }
public static int DispatchSpellDcMod(this GameObject critter, SpellEntry spell) { var dispatcher = critter.GetDispatcher(); if (dispatcher == null) { return(0); } var dispIo = DispIoBonusAndSpellEntry.Default; dispIo.bonList = BonusList.Default; dispIo.spellEntry = spell; dispatcher.Process(DispatcherType.SpellDcMod, D20DispatcherKey.NONE, dispIo); return(dispIo.bonList.OverallBonus); }
readonly string[] _words = new[] { "=====" }; // todo: more wodrs /// <summary> /// Compares two spells /// </summary> /// <param name="rtb1">RichTextBox 1 in left</param> /// <param name="rtb2">RichTextBox 2 in right</param> /// <param name="spell1">Compare Spell 1</param> /// <param name="spell2">Compare Spell 2</param> public SpellCompare(RichTextBox rtb1, RichTextBox rtb2, SpellEntry spell1, SpellEntry spell2) { new SpellInfo(rtb1, spell1); new SpellInfo(rtb2, spell2); var strsl = rtb1.Text.Split('\n'); var strsr = rtb2.Text.Split('\n'); var pos = 0; foreach (var str in strsl) { pos += str.Length + 1; rtb1.Select(pos - str.Length - 1, pos - 1); if (rtb2.Find(str, RichTextBoxFinds.WholeWord) != -1) { rtb1.SelectionBackColor = str.ContainsText(_words) ? rtb1.BackColor : Color.Cyan; } else { rtb1.SelectionBackColor = Color.Salmon; } } pos = 0; foreach (var str in strsr) { pos += str.Length + 1; rtb2.Select(pos - str.Length - 1, pos - 1); if (rtb1.Find(str, RichTextBoxFinds.WholeWord) != -1) { rtb2.SelectionBackColor = str.ContainsText(_words) ? rtb2.BackColor : Color.Cyan; } else { rtb2.SelectionBackColor = Color.Salmon; } } }
private void OnCastSpell(WorldSession session, PCCastSpell packet) { IUnitEntity target = session.Player.Target ?? session.Player; target.SubscribedBy.ToList().ForEach(s => s.SendPacket(new PSSpellGo(session.Player, target, packet.spellID))); session.SendPacket(new PSSpellGo(session.Player, target, packet.spellID)); session.SendPacket(new PSCastFailed(packet.spellID)); SpellEntry spell = Core.DBC.GetDBC <SpellEntry>().SingleOrDefault(s => s.ID == packet.spellID); float spellSpeed = spell.Speed; /* * float distance = (float)Math.Sqrt((session.Entity.X - session.Entity.Target.X) * (session.Entity.X - session.Entity.Target.X) + * (session.Entity.Y - session.Entity.Target.Y) * (session.Entity.Y - session.Entity.Target.Y) + * (session.Entity.Z - session.Entity.Target.Z) * (session.Entity.Z - session.Entity.Target.Z)); * * if (distance < 5) distance = 5; * * float dx = session.Entity.X - target.X; * float dy = session.Entity.Y - target.Y; * float dz = session.Entity.Z - target.Target.Z; * float radius = 5; * float distance = (float)Math.Sqrt((dx * dx) + (dy * dy) + (dz * dz)) - radius; * * //if (distance < 5) distance = 5; * float timeToHit = (spellSpeed > 0) ? (float)Math.Floor(distance / spellSpeed * 1000f) : 0; * * session.sendMessage("Cast [" + spell.Name + "] Distance: " + distance + " Speed: " + spellSpeed + " Time: " + timeToHit); * float radians = (float)(Math.Atan2(session.Entity.Y - session.Entity.Target.Y, session.Entity.X - session.Entity.Target.X)); * * if(spellSpeed > 0) * { * DoTimer(timeToHit, (s, e) => * { * WorldServer.TransmitToAll(new PSMoveKnockBack(target, (float)Math.Cos(radians), (float)Math.Sin(radians), -10, -10)); * }); * } * * */ }
public static Spellbook Find(Mobile from, SpellEntry spellId, SpellbookType type) { if (from == null) { return(null); } if (from.Deleted) { Table.Remove(from); return(null); } List <Spellbook> list = null; Table.TryGetValue(from, out list); bool searchAgain = false; if (list == null) { Table[from] = list = FindAllSpellbooks(from); } else { searchAgain = true; } Spellbook book = FindSpellbookInList(list, from, spellId, type); if (book == null && searchAgain) { Table[from] = list = FindAllSpellbooks(from); book = FindSpellbookInList(list, from, spellId, type); } return(book); }
public SpellScroll(SpellEntry spellEntry, int itemId) : this(spellEntry, itemId, 1) { }
private void lvSpellList_SelectionChanged_1(object sender, SelectionChangedEventArgs e) { var listView = sender as ListView; if (listView != null && listView.SelectedValue is SpellEntry) this.SelectedSpell = listView.SelectedValue as SpellEntry; }
public CustomSpellScroll(SpellEntry spellEntry, int itemId, int amount, int hue) : base(spellEntry, itemId, amount) { Hue = hue; }
internal static SpellEntry Parse(int spellEnum, string path, TextReader reader) { var entry = new SpellEntry(); entry.spellEnum = spellEnum; string line; while ((line = reader.ReadLine()) != null) { if (line.Length == 0) { continue; } if (!ParseSpellLine(line, out var key, out var value)) { Logger.Warn("{0}: Couldn't parse line '{1}'", path, line); continue; } switch (key) { case SpellLineKey.School: if (ParseEnum(Schools, value, out var schoolOfMagic)) { entry.spellSchoolEnum = schoolOfMagic; } else { Logger.Warn("{0}: Unknown school of magic: '{1}'", path, line); } break; case SpellLineKey.Subschool: if (ParseEnum(SubSchools, value, out var subSchoolOfMagic)) { entry.spellSubSchoolEnum = subSchoolOfMagic; } else { Logger.Warn("{0}: Unknown sub-school of magic: '{1}'", path, line); } break; case SpellLineKey.Descriptor: if (ParseEnum(Descriptors, value, out var descriptor)) { entry.spellDescriptorBitmask |= descriptor; } else { Logger.Warn("{0}: Unknown spell descriptor: '{1}'", path, line); } break; case SpellLineKey.Level: if (ParseSpellListEntry(value, out var spellListEntry)) { entry.spellLvls.Add(spellListEntry); } else { Logger.Warn("{0}: Unparsable spell list entry: '{1}'", path, line); } break; case SpellLineKey.Component: if (ParseSpellComponent(value, out var spellComponent, out var argument)) { entry.spellComponentBitmask |= spellComponent; if (spellComponent == SpellComponent.Material) { entry.costGp = argument; } else if (spellComponent == SpellComponent.Experience) { entry.costXp = argument; } } else { Logger.Warn("{0}: Unparsable spell list entry: '{1}'", path, line); } break;
private Spell CreateSpell(int spellID) { SpellEntry spellEntry = Owner.Session.Core.DBC.GetDBC <SpellEntry>().SingleOrDefault(s => s.ID == spellID); return(new Spell((SpellID)spellID, spellEntry)); }
public static bool HasSpell(Mobile from, SpellEntry spellId) { Spellbook book = Spellbook.Find(from, spellId); return(book != null && book.HasSpell(spellId)); }
public SpellInfo(SpellEntry spellEntry, SpellEffectEntry[] effects) { Id = spellEntry.Id; SpellMisc misc = spellEntry.Misc; if (misc != null) { Attributes = (SpellAttr0)misc.Attributes; AttributesEx = (SpellAttr1)misc.AttributesEx; AttributesEx2 = (SpellAttr2)misc.AttributesEx2; AttributesEx3 = (SpellAttr3)misc.AttributesEx3; AttributesEx4 = (SpellAttr4)misc.AttributesEx4; AttributesEx5 = (SpellAttr5)misc.AttributesEx5; AttributesEx6 = (SpellAttr6)misc.AttributesEx6; AttributesEx7 = (SpellAttr7)misc.AttributesEx7; AttributesEx8 = (SpellAttr8)misc.AttributesEx8; AttributesEx9 = (SpellAttr9)misc.AttributesEx9; AttributesEx10 = (SpellAttr10)misc.AttributesEx10; Speed = spellEntry.Misc.Speed; for (var i = 0; i < 2; ++i) { SpellVisual[i] = misc.SpellVisual[i]; } CastTimeEntry = DBCStorage.SpellCastTimesStorage.LookupByKey(misc.CastingTimeIndex); DurationEntry = DBCStorage.SpellDurationStorage.LookupByKey(misc.DurationIndex); //PowerType = (Powers)misc.PowerType; RangeEntry = DBCStorage.SpellRangeStorage.LookupByKey(misc.RangeIndex); SpellIconID = misc.SpellIconID; ActiveIconID = misc.ActiveIconID; SchoolMask = misc.SchoolMask; } AttributesCu = 0; SpellName = spellEntry.Name; Rank = spellEntry.Rank; RuneCostID = spellEntry.RuneCostID; //SpellDifficultyId = spellEntry.SpellDifficultyId; SpellScalingId = spellEntry.SpellScalingId; SpellAuraOptionsId = spellEntry.SpellAuraOptionsId; SpellAuraRestrictionsId = spellEntry.SpellAuraRestrictionsId; SpellCastingRequirementsId = spellEntry.SpellCastingRequirementsId; SpellCategoriesId = spellEntry.SpellCategoriesId; SpellClassOptionsId = spellEntry.SpellClassOptionsId; SpellCooldownsId = spellEntry.SpellCooldownsId; SpellEquippedItemsId = spellEntry.SpellEquippedItemsId; SpellInterruptsId = spellEntry.SpellInterruptsId; SpellLevelsId = spellEntry.SpellLevelsId; SpellPowerId = spellEntry.SpellPowerId; SpellReagentsId = spellEntry.SpellReagentsId; SpellShapeshiftId = spellEntry.SpellShapeshiftId; SpellTargetRestrictionsId = spellEntry.SpellTargetRestrictionsId; SpellTotemsId = spellEntry.SpellTotemsId; // SpellDifficultyEntry if (effects != null) { for (uint i = 0; i < effects.Length; i++) { if (effects[i] == null) { continue; } Effects[i] = new SpellEffectInfo(this, i, effects[i]); } } // SpellScalingEntry SpellScalingEntry _scaling = DBCStorage.SpellScalingStorage.LookupByKey(SpellScalingId); if (_scaling != null) { CastTimeMin = _scaling.CastTimeMin; CastTimeMax = _scaling.CastTimeMax; CastTimeMaxLevel = _scaling.CastTimeMaxLevel; ScalingClass = _scaling.ScalingClass; //CoefBase = _scaling.CoefBase; //CoefLevelBase = _scaling.CoefLevelBase; } // SpellAuraOptionsEntry SpellAuraOptionsEntry _options = DBCStorage.SpellAuraOptionsStorage.LookupByKey(SpellAuraOptionsId); if (_options != null) { ProcFlags = _options.procFlags; ProcChance = _options.procChance; ProcCharges = _options.procCharges; StackAmount = _options.StackAmount; } // SpellAuraRestrictionsEntry SpellAuraRestrictionsEntry _aura = DBCStorage.SpellAuraRestrictionsStorage.LookupByKey(SpellAuraRestrictionsId); if (_aura != null) { CasterAuraState = _aura.CasterAuraState; TargetAuraState = _aura.TargetAuraState; CasterAuraStateNot = _aura.CasterAuraStateNot; TargetAuraStateNot = _aura.TargetAuraStateNot; CasterAuraSpell = _aura.casterAuraSpell; TargetAuraSpell = _aura.targetAuraSpell; ExcludeCasterAuraSpell = _aura.excludeCasterAuraSpell; ExcludeTargetAuraSpell = _aura.excludeTargetAuraSpell; } // SpellCastingRequirementsEntry SpellCastingRequirementsEntry _castreq = DBCStorage.SpellCastingRequirementsStorage.LookupByKey(SpellCastingRequirementsId); if (_castreq != null) { RequiresSpellFocus = _castreq.RequiresSpellFocus; FacingCasterFlags = _castreq.FacingCasterFlags; AreaGroupId = _castreq.AreaGroupId != 0 ? _castreq.AreaGroupId : -1; } // SpellCategoriesEntry SpellCategoriesEntry _categorie = DBCStorage.SpellCategoriesStorage.LookupByKey(SpellCategoriesId); if (_categorie != null) { Category = _categorie.Category; Dispel = _categorie.Dispel; Mechanic = _categorie.Mechanic; StartRecoveryCategory = _categorie.StartRecoveryCategory; DmgClass = (SpellDmgClass)_categorie.DmgClass; PreventionType = _categorie.PreventionType; } // SpellClassOptionsEntry SpellClassOptionsEntry _class = DBCStorage.SpellClassOptionsStorage.LookupByKey(SpellClassOptionsId); if (_class != null) { SpellFamilyName = _class.SpellFamilyName; SpellFamilyFlags = new flag96(_class.SpellFamilyFlags); } // SpellCooldownsEntry SpellCooldownsEntry _cooldowns = DBCStorage.SpellCooldownsStorage.LookupByKey(SpellCooldownsId); if (_cooldowns != null) { RecoveryTime = _cooldowns.RecoveryTime; CategoryRecoveryTime = _cooldowns.CategoryRecoveryTime; StartRecoveryTime = _cooldowns.StartRecoveryTime; } // SpellEquippedItemsEntry SpellEquippedItemsEntry _equipped = DBCStorage.SpellEquippedItemsStorage.LookupByKey(SpellEquippedItemsId); if (_equipped != null) { EquippedItemClass = _equipped.EquippedItemClass; EquippedItemSubClassMask = _equipped.EquippedItemSubClassMask; EquippedItemInventoryTypeMask = _equipped.EquippedItemInventoryTypeMask; } else { EquippedItemClass = -1; EquippedItemSubClassMask = -1; EquippedItemInventoryTypeMask = -1; } // SpellInterruptsEntry SpellInterruptsEntry _interrupt = DBCStorage.SpellInterruptsEntryStorage.LookupByKey(SpellInterruptsId); if (_interrupt != null) { InterruptFlags = _interrupt.InterruptFlags; AuraInterruptFlags = _interrupt.AuraInterruptFlags; ChannelInterruptFlags = _interrupt.ChannelInterruptFlags; } // SpellLevelsEntry SpellLevelsEntry _levels = DBCStorage.SpellLevelsStorage.LookupByKey(SpellLevelsId); if (_levels != null) { MaxLevel = _levels.maxLevel; BaseLevel = _levels.baseLevel; SpellLevel = _levels.spellLevel; } // SpellPowerEntry SpellPowerEntry _power = DBCStorage.SpellPowerStorage.LookupByKey(SpellPowerId); if (_power != null) { ManaCost = _power.manaCost; ManaCostPerlevel = _power.manaCostPerlevel; ManaCostPercentage = _power.ManaCostPercentage; ManaPerSecond = _power.manaPerSecond; } // SpellReagentsEntry SpellReagentsEntry _reagents = DBCStorage.SpellReagentsStorage.LookupByKey(SpellReagentsId); for (var i = 0; i < SharedConst.MaxSpellReagents; ++i) { Reagent[i] = _reagents != null ? _reagents.Reagent[i] : 0; ReagentCount[i] = _reagents != null ? _reagents.ReagentCount[i] : 0; } // SpellShapeshiftEntry SpellShapeshiftEntry _shapeshift = DBCStorage.SpellShapeshiftStorage.LookupByKey(SpellShapeshiftId); if (_shapeshift != null) { Stances = _shapeshift.Stances; StancesNot = _shapeshift.StancesNot; } // SpellTargetRestrictionsEntry SpellTargetRestrictionsEntry _target = DBCStorage.SpellTargetRestrictionsStorage.LookupByKey(SpellTargetRestrictionsId); if (_target != null) { Targets = _target.Targets; TargetCreatureType = _target.TargetCreatureType; MaxAffectedTargets = _target.MaxAffectedTargets; } // SpellTotemsEntry SpellTotemsEntry _totem = DBCStorage.SpellTotemsStorage.LookupByKey(SpellTotemsId); for (var i = 0; i < 2; ++i) { TotemCategory[i] = _totem != null ? _totem.TotemCategory[i] : 0; Totem[i] = _totem != null ? _totem.Totem[i] : 0; } //ExplicitTargetMask = _GetExplicitTargetMask(); ChainEntry = null; }
public SpellInfoHelper(SpellEntry dbcData) { ID = dbcData.Id; SpellName = dbcData.SpellName; Rank = dbcData.Rank; _Description = dbcData.Description; ToolTip = dbcData.ToolTip; RuneCostID = dbcData.RuneCostID; SpellMissileID = dbcData.SpellMissileID; SpellDescriptionVariableID = dbcData.SpellDescriptionVariableID; SpellDifficultyId = dbcData.SpellDifficultyId; // SpellMisc.dbc var misc = dbcData.Misc; if (misc != null) { Attributes = misc.Attributes; AttributesEx = misc.AttributesEx; AttributesEx2 = misc.AttributesEx2; AttributesEx3 = misc.AttributesEx3; AttributesEx4 = misc.AttributesEx4; AttributesEx5 = misc.AttributesEx5; AttributesEx6 = misc.AttributesEx6; AttributesEx7 = misc.AttributesEx7; AttributesEx8 = misc.AttributesEx8; AttributesEx9 = misc.AttributesEx9; AttributesEx10 = misc.AttributesEx10; AttributesEx11 = misc.AttributesEx11; AttributesEx12 = misc.AttributesEx12; AttributesEx13 = misc.AttributesEx13; CastingTimeIndex = misc.CastingTimeIndex; DurationIndex = misc.DurationIndex; //PowerType = misc.PowerType; RangeIndex = misc.RangeIndex; Speed = misc.Speed; SpellVisual = (uint[])misc.SpellVisual.Clone(); SpellIconID = misc.SpellIconID; ActiveIconID = misc.ActiveIconID; SchoolMask = misc.SchoolMask; } else { SpellVisual = new uint[2]; } // SpellCategories.dbc var cat = dbcData.Category; if (cat != null) { Category = cat.Category; Dispel = cat.Dispel; Mechanic = cat.Mechanic; StartRecoveryCategory = cat.StartRecoveryCategory; DmgClass = cat.DmgClass; PreventionType = cat.PreventionType; } // SpellShapeshift.dbc var shapeshift = dbcData.Shapeshift; if (shapeshift != null) { Stances = shapeshift.Stances; StancesNot = shapeshift.StancesNot; StanceBarOrder = shapeshift.StanceBarOrder; } // SpellTargetRestrictions.dbc var targetRestrictions = dbcData.TargetRestrictions; if (targetRestrictions != null) { Targets = targetRestrictions.Targets; TargetCreatureType = targetRestrictions.TargetCreatureType; MaxAffectedTargets = targetRestrictions.MaxAffectedTargets; MaxTargetLevel = targetRestrictions.MaxTargetLevel; } // SpellCastingRequirements.dbc var castingRequirements = dbcData.CastingRequirements; if (castingRequirements != null) { RequiresSpellFocus = castingRequirements.RequiresSpellFocus; FacingCasterFlags = castingRequirements.FacingCasterFlags; MinFactionId = castingRequirements.MinFactionId; MinReputation = castingRequirements.MinReputation; RequiredAuraVision = castingRequirements.RequiredAuraVision; AreaGroupId = castingRequirements.AreaGroupId; } // SpellAuraRestrictions.dbc var auraRestrictions = dbcData.AuraRestrictions; if (auraRestrictions != null) { CasterAuraState = auraRestrictions.CasterAuraState; TargetAuraState = auraRestrictions.TargetAuraState; CasterAuraStateNot = auraRestrictions.CasterAuraStateNot; TargetAuraStateNot = auraRestrictions.TargetAuraStateNot; CasterAuraSpell = auraRestrictions.CasterAuraSpell; TargetAuraSpell = auraRestrictions.TargetAuraSpell; ExcludeCasterAuraSpell = auraRestrictions.ExcludeCasterAuraSpell; ExcludeTargetAuraSpell = auraRestrictions.ExcludeTargetAuraSpell; } // SpellCooldowns.dbc var cooldowns = dbcData.Cooldowns; if (cooldowns != null) { RecoveryTime = cooldowns.RecoveryTime; CategoryRecoveryTime = cooldowns.CategoryRecoveryTime; StartRecoveryTime = cooldowns.StartRecoveryTime; } // SpellInterrupts.dbc var interrupts = dbcData.Interrupts; if (interrupts != null) { InterruptFlags = interrupts.InterruptFlags; AuraInterruptFlags = interrupts.AuraInterruptFlags; ChannelInterruptFlags = interrupts.ChannelInterruptFlags; } // SpellAuraOptions.dbc var options = dbcData.AuraOptions; if (options != null) { ProcFlags = options.ProcFlags; ProcChance = options.ProcChance; ProcCharges = options.ProcCharges; StackAmount = options.StackAmount; } // SpellLevels.dbc var levels = dbcData.Levels; if (levels != null) { MaxLevel = levels.MaxLevel; BaseLevel = levels.BaseLevel; SpellLevel = levels.SpellLevel; } // SpellPower.dbc var power = dbcData.Power; if (power != null) { ManaCost = power.ManaCost; ManaCostPerlevel = power.ManaCostPerlevel; ManaPerSecond = power.ManaPerSecond; ManaCostPercentage = (uint)power.ManaCostPercentage; PowerDisplayId = power.PowerDisplayId; PowerType = power.PowerType; } // SpellClassOptions.dbc var classOptions = dbcData.ClassOptions; if (classOptions != null) { ModalNextSpell = classOptions.ModalNextSpell; //_Description = String.IsNullOrEmpty(Description) ? classOptions.Description : _Description; SpellFamilyName = classOptions.SpellFamilyName; SpellFamilyFlags = (uint[])classOptions.SpellFamilyFlags.Clone(); } else { SpellFamilyFlags = new uint[4]; } // SpellTotems.dbc var totems = dbcData.Totems; if (totems != null) { Totem = (uint[])totems.Totem.Clone(); TotemCategory = (uint[])totems.TotemCategory.Clone(); } else { Totem = new uint[2]; TotemCategory = new uint[2]; } /* * // SpellReagents.dbc * var reagents = dbcData.Reagents; * if (reagents != null) * { * Reagent = (uint[])reagents.ItemId.Clone(); * ReagentCount = (uint[])reagents.Count.Clone(); * } * else*/ { Reagent = new uint[8]; ReagentCount = new uint[8]; } // SpellEquippedItems.dbc var equippedItems = dbcData.EquippedItems; if (equippedItems != null) { EquippedItemClass = equippedItems.EquippedItemClass; EquippedItemSubClassMask = equippedItems.EquippedItemSubClassMask; EquippedItemInventoryTypeMask = equippedItems.EquippedItemInventoryTypeMask; } Scaling = dbcData.Scaling; Effects = new SpellEffectEntry[DBC.DBC.MaxEffectIndex]; }
public static Spellbook Find(Mobile from, SpellEntry spellId) { return(Find(from, spellId, GetTypeForSpell(spellId))); }
/// <summary> /// Auto-generated serialization/write method. /// Partial method implemented from shared partial definition. /// </summary> /// <param name = "value">See external doc.</param> /// <param name = "buffer">See external doc.</param> /// <param name = "offset">See external doc.</param> public override void InternalWrite(SpellEntry <String> value, Span <byte> buffer, ref int offset) { //Type: SpellEntry Field: 1 Name: SpellId Type: Int32 ; GenericTypePrimitiveSerializerStrategy <Int32> .Instance.Write(value.SpellId, buffer, ref offset); //Type: SpellEntry Field: 2 Name: Category Type: UInt32 ; GenericTypePrimitiveSerializerStrategy <UInt32> .Instance.Write(value.Category, buffer, ref offset); //Type: SpellEntry Field: 3 Name: Dispel Type: UInt32 ; GenericTypePrimitiveSerializerStrategy <UInt32> .Instance.Write(value.Dispel, buffer, ref offset); //Type: SpellEntry Field: 4 Name: Mechanic Type: SpellMechanic ; GenericPrimitiveEnumTypeSerializerStrategy <SpellMechanic, Int32> .Instance.Write(value.Mechanic, buffer, ref offset); //Type: SpellEntry Field: 5 Name: Attributes Type: SpellAtribute ; GenericPrimitiveEnumTypeSerializerStrategy <SpellAtribute, UInt32> .Instance.Write(value.Attributes, buffer, ref offset); //Type: SpellEntry Field: 6 Name: AttributesEx Type: SpellAtributeEx ; GenericPrimitiveEnumTypeSerializerStrategy <SpellAtributeEx, UInt32> .Instance.Write(value.AttributesEx, buffer, ref offset); //Type: SpellEntry Field: 7 Name: AttributesEx2 Type: SpellAtributeEx2 ; GenericPrimitiveEnumTypeSerializerStrategy <SpellAtributeEx2, UInt32> .Instance.Write(value.AttributesEx2, buffer, ref offset); //Type: SpellEntry Field: 8 Name: AttributesEx3 Type: SpellAtributeEx3 ; GenericPrimitiveEnumTypeSerializerStrategy <SpellAtributeEx3, UInt32> .Instance.Write(value.AttributesEx3, buffer, ref offset); //Type: SpellEntry Field: 9 Name: AttributesEx4 Type: SpellAtributeEx4 ; GenericPrimitiveEnumTypeSerializerStrategy <SpellAtributeEx4, UInt32> .Instance.Write(value.AttributesEx4, buffer, ref offset); //Type: SpellEntry Field: 10 Name: AttributesEx5 Type: SpellAtributeEx5 ; GenericPrimitiveEnumTypeSerializerStrategy <SpellAtributeEx5, UInt32> .Instance.Write(value.AttributesEx5, buffer, ref offset); //Type: SpellEntry Field: 11 Name: AttributesEx6 Type: SpellAtributeEx6 ; GenericPrimitiveEnumTypeSerializerStrategy <SpellAtributeEx6, UInt32> .Instance.Write(value.AttributesEx6, buffer, ref offset); //Type: SpellEntry Field: 12 Name: AttributesEx7 Type: SpellAtributeEx7 ; GenericPrimitiveEnumTypeSerializerStrategy <SpellAtributeEx7, UInt32> .Instance.Write(value.AttributesEx7, buffer, ref offset); //Type: SpellEntry Field: 13 Name: Stances Type: UInt64 ; GenericTypePrimitiveSerializerStrategy <UInt64> .Instance.Write(value.Stances, buffer, ref offset); //Type: SpellEntry Field: 14 Name: StancesNot Type: UInt64 ; GenericTypePrimitiveSerializerStrategy <UInt64> .Instance.Write(value.StancesNot, buffer, ref offset); //Type: SpellEntry Field: 15 Name: Targets Type: UInt32 ; GenericTypePrimitiveSerializerStrategy <UInt32> .Instance.Write(value.Targets, buffer, ref offset); //Type: SpellEntry Field: 16 Name: TargetCreatureType Type: CreatureTypeMask ; GenericPrimitiveEnumTypeSerializerStrategy <CreatureTypeMask, Int32> .Instance.Write(value.TargetCreatureType, buffer, ref offset); //Type: SpellEntry Field: 17 Name: RequiresSpellFocus Type: UInt32 ; GenericTypePrimitiveSerializerStrategy <UInt32> .Instance.Write(value.RequiresSpellFocus, buffer, ref offset); //Type: SpellEntry Field: 18 Name: FacingCasterFlags Type: UInt32 ; GenericTypePrimitiveSerializerStrategy <UInt32> .Instance.Write(value.FacingCasterFlags, buffer, ref offset); //Type: SpellEntry Field: 19 Name: CasterAuraState Type: AuraState ; GenericPrimitiveEnumTypeSerializerStrategy <AuraState, Int32> .Instance.Write(value.CasterAuraState, buffer, ref offset); //Type: SpellEntry Field: 20 Name: TargetAuraState Type: AuraState ; GenericPrimitiveEnumTypeSerializerStrategy <AuraState, Int32> .Instance.Write(value.TargetAuraState, buffer, ref offset); //Type: SpellEntry Field: 21 Name: CasterAuraStateNot Type: AuraState ; GenericPrimitiveEnumTypeSerializerStrategy <AuraState, Int32> .Instance.Write(value.CasterAuraStateNot, buffer, ref offset); //Type: SpellEntry Field: 22 Name: TargetAuraStateNot Type: AuraState ; GenericPrimitiveEnumTypeSerializerStrategy <AuraState, Int32> .Instance.Write(value.TargetAuraStateNot, buffer, ref offset); //Type: SpellEntry Field: 23 Name: CasterAuraSpell Type: UInt32 ; GenericTypePrimitiveSerializerStrategy <UInt32> .Instance.Write(value.CasterAuraSpell, buffer, ref offset); //Type: SpellEntry Field: 24 Name: TargetAuraSpell Type: UInt32 ; GenericTypePrimitiveSerializerStrategy <UInt32> .Instance.Write(value.TargetAuraSpell, buffer, ref offset); //Type: SpellEntry Field: 25 Name: ExcludeCasterAuraSpell Type: UInt32 ; GenericTypePrimitiveSerializerStrategy <UInt32> .Instance.Write(value.ExcludeCasterAuraSpell, buffer, ref offset); //Type: SpellEntry Field: 26 Name: ExcludeTargetAuraSpell Type: UInt32 ; GenericTypePrimitiveSerializerStrategy <UInt32> .Instance.Write(value.ExcludeTargetAuraSpell, buffer, ref offset); //Type: SpellEntry Field: 27 Name: CastingTimeIndex Type: UInt32 ; GenericTypePrimitiveSerializerStrategy <UInt32> .Instance.Write(value.CastingTimeIndex, buffer, ref offset); //Type: SpellEntry Field: 28 Name: RecoveryTime Type: UInt32 ; GenericTypePrimitiveSerializerStrategy <UInt32> .Instance.Write(value.RecoveryTime, buffer, ref offset); //Type: SpellEntry Field: 29 Name: CategoryRecoveryTime Type: UInt32 ; GenericTypePrimitiveSerializerStrategy <UInt32> .Instance.Write(value.CategoryRecoveryTime, buffer, ref offset); //Type: SpellEntry Field: 30 Name: InterruptFlags Type: SpellInteruptFlags ; GenericPrimitiveEnumTypeSerializerStrategy <SpellInteruptFlags, UInt32> .Instance.Write(value.InterruptFlags, buffer, ref offset); //Type: SpellEntry Field: 31 Name: AuraInterruptFlags Type: SpellAuraInterruptFlags ; GenericPrimitiveEnumTypeSerializerStrategy <SpellAuraInterruptFlags, UInt32> .Instance.Write(value.AuraInterruptFlags, buffer, ref offset); //Type: SpellEntry Field: 32 Name: ChannelInterruptFlags Type: SpellChannelInterruptFlags ; GenericPrimitiveEnumTypeSerializerStrategy <SpellChannelInterruptFlags, UInt32> .Instance.Write(value.ChannelInterruptFlags, buffer, ref offset); //Type: SpellEntry Field: 33 Name: ProcFlags Type: ProcFlags ; GenericPrimitiveEnumTypeSerializerStrategy <ProcFlags, Int32> .Instance.Write(value.ProcFlags, buffer, ref offset); //Type: SpellEntry Field: 34 Name: ProcChance Type: UInt32 ; GenericTypePrimitiveSerializerStrategy <UInt32> .Instance.Write(value.ProcChance, buffer, ref offset); //Type: SpellEntry Field: 35 Name: ProcCharges Type: UInt32 ; GenericTypePrimitiveSerializerStrategy <UInt32> .Instance.Write(value.ProcCharges, buffer, ref offset); //Type: SpellEntry Field: 36 Name: MaxLevel Type: UInt32 ; GenericTypePrimitiveSerializerStrategy <UInt32> .Instance.Write(value.MaxLevel, buffer, ref offset); //Type: SpellEntry Field: 37 Name: BaseLevel Type: UInt32 ; GenericTypePrimitiveSerializerStrategy <UInt32> .Instance.Write(value.BaseLevel, buffer, ref offset); //Type: SpellEntry Field: 38 Name: SpellLevel Type: UInt32 ; GenericTypePrimitiveSerializerStrategy <UInt32> .Instance.Write(value.SpellLevel, buffer, ref offset); //Type: SpellEntry Field: 39 Name: DurationIndex Type: UInt32 ; GenericTypePrimitiveSerializerStrategy <UInt32> .Instance.Write(value.DurationIndex, buffer, ref offset); //Type: SpellEntry Field: 40 Name: PowerType Type: SpellCostPower ; GenericPrimitiveEnumTypeSerializerStrategy <SpellCostPower, UInt32> .Instance.Write(value.PowerType, buffer, ref offset); //Type: SpellEntry Field: 41 Name: ManaCost Type: UInt32 ; GenericTypePrimitiveSerializerStrategy <UInt32> .Instance.Write(value.ManaCost, buffer, ref offset); //Type: SpellEntry Field: 42 Name: ManaCostPerlevel Type: UInt32 ; GenericTypePrimitiveSerializerStrategy <UInt32> .Instance.Write(value.ManaCostPerlevel, buffer, ref offset); //Type: SpellEntry Field: 43 Name: ManaPerSecond Type: UInt32 ; GenericTypePrimitiveSerializerStrategy <UInt32> .Instance.Write(value.ManaPerSecond, buffer, ref offset); //Type: SpellEntry Field: 44 Name: ManaPerSecondPerLevel Type: UInt32 ; GenericTypePrimitiveSerializerStrategy <UInt32> .Instance.Write(value.ManaPerSecondPerLevel, buffer, ref offset); //Type: SpellEntry Field: 45 Name: RangeIndex Type: UInt32 ; GenericTypePrimitiveSerializerStrategy <UInt32> .Instance.Write(value.RangeIndex, buffer, ref offset); //Type: SpellEntry Field: 46 Name: Speed Type: Single ; GenericTypePrimitiveSerializerStrategy <Single> .Instance.Write(value.Speed, buffer, ref offset); //Type: SpellEntry Field: 47 Name: ModalNextSpell Type: UInt32 ; GenericTypePrimitiveSerializerStrategy <UInt32> .Instance.Write(value.ModalNextSpell, buffer, ref offset); //Type: SpellEntry Field: 48 Name: StackAmount Type: UInt32 ; GenericTypePrimitiveSerializerStrategy <UInt32> .Instance.Write(value.StackAmount, buffer, ref offset); //Type: SpellEntry Field: 49 Name: ReagentsRequired Type: RequiredReagentData ; RequiredReagentData_Serializer.Instance.Write(value.ReagentsRequired, buffer, ref offset); //Type: SpellEntry Field: 52 Name: EquippedItemClass Type: ItemClassType ; GenericPrimitiveEnumTypeSerializerStrategy <ItemClassType, Int32> .Instance.Write(value.EquippedItemClass, buffer, ref offset); //Type: SpellEntry Field: 53 Name: EquippedItemSubClassMask Type: Int32 ; GenericTypePrimitiveSerializerStrategy <Int32> .Instance.Write(value.EquippedItemSubClassMask, buffer, ref offset); //Type: SpellEntry Field: 54 Name: EquippedItemInventoryTypeMask Type: InventoryTypeMask ; GenericPrimitiveEnumTypeSerializerStrategy <InventoryTypeMask, Int32> .Instance.Write(value.EquippedItemInventoryTypeMask, buffer, ref offset); //Type: SpellEntry Field: 55 Name: SpellEffectInformation Type: SpellEffectData ; SpellEffectData_Serializer.Instance.Write(value.SpellEffectInformation, buffer, ref offset); //Type: SpellEntry Field: 75 Name: SpellVisual Type: SpellVisualData ; SpellVisualData_Serializer.Instance.Write(value.SpellVisual, buffer, ref offset); //Type: SpellEntry Field: 76 Name: SpellIconID Type: UInt32 ; GenericTypePrimitiveSerializerStrategy <UInt32> .Instance.Write(value.SpellIconID, buffer, ref offset); //Type: SpellEntry Field: 77 Name: ActiveIconID Type: UInt32 ; GenericTypePrimitiveSerializerStrategy <UInt32> .Instance.Write(value.ActiveIconID, buffer, ref offset); //Type: SpellEntry Field: 78 Name: SpellPriority Type: UInt32 ; GenericTypePrimitiveSerializerStrategy <UInt32> .Instance.Write(value.SpellPriority, buffer, ref offset); //Type: SpellEntry Field: 79 Name: SpellName Type: LocalizedStringDBC ; LocalizedStringDBC_String_Serializer.Instance.Write(value.SpellName, buffer, ref offset); //Type: SpellEntry Field: 81 Name: Rank Type: LocalizedStringDBC ; LocalizedStringDBC_String_Serializer.Instance.Write(value.Rank, buffer, ref offset); //Type: SpellEntry Field: 83 Name: Description Type: LocalizedStringDBC ; LocalizedStringDBC_String_Serializer.Instance.Write(value.Description, buffer, ref offset); //Type: SpellEntry Field: 85 Name: ToolTip Type: LocalizedStringDBC ; LocalizedStringDBC_String_Serializer.Instance.Write(value.ToolTip, buffer, ref offset); //Type: SpellEntry Field: 87 Name: ManaCostPercentage Type: UInt32 ; GenericTypePrimitiveSerializerStrategy <UInt32> .Instance.Write(value.ManaCostPercentage, buffer, ref offset); //Type: SpellEntry Field: 88 Name: StartRecoveryCategory Type: UInt32 ; GenericTypePrimitiveSerializerStrategy <UInt32> .Instance.Write(value.StartRecoveryCategory, buffer, ref offset); //Type: SpellEntry Field: 89 Name: StartRecoveryTime Type: UInt32 ; GenericTypePrimitiveSerializerStrategy <UInt32> .Instance.Write(value.StartRecoveryTime, buffer, ref offset); //Type: SpellEntry Field: 90 Name: MaxTargetLevel Type: UInt32 ; GenericTypePrimitiveSerializerStrategy <UInt32> .Instance.Write(value.MaxTargetLevel, buffer, ref offset); //Type: SpellEntry Field: 91 Name: SpellFamilyName Type: SpellFamilyName ; GenericPrimitiveEnumTypeSerializerStrategy <SpellFamilyName, Int32> .Instance.Write(value.SpellFamilyName, buffer, ref offset); //Type: SpellEntry Field: 92 Name: SpellFamilyFlags Type: Flags96 ; Flags96_UInt32_Serializer.Instance.Write(value.SpellFamilyFlags, buffer, ref offset); //Type: SpellEntry Field: 93 Name: MaxAffectedTargets Type: UInt32 ; GenericTypePrimitiveSerializerStrategy <UInt32> .Instance.Write(value.MaxAffectedTargets, buffer, ref offset); //Type: SpellEntry Field: 94 Name: DmgClass Type: SpellDamageClassType ; GenericPrimitiveEnumTypeSerializerStrategy <SpellDamageClassType, Int32> .Instance.Write(value.DmgClass, buffer, ref offset); //Type: SpellEntry Field: 95 Name: PreventionType Type: SpellPreventionType ; GenericPrimitiveEnumTypeSerializerStrategy <SpellPreventionType, Int32> .Instance.Write(value.PreventionType, buffer, ref offset); //Type: SpellEntry Field: 96 Name: StanceBarOrder Type: UInt32 ; GenericTypePrimitiveSerializerStrategy <UInt32> .Instance.Write(value.StanceBarOrder, buffer, ref offset); //Type: SpellEntry Field: 97 Name: DmgMultiplier Type: SpellEffectDataChunk ; SpellEffectDataChunk_Single_Serializer.Instance.Write(value.DmgMultiplier, buffer, ref offset); //Type: SpellEntry Field: 98 Name: MinFactionId Type: UInt32 ; GenericTypePrimitiveSerializerStrategy <UInt32> .Instance.Write(value.MinFactionId, buffer, ref offset); //Type: SpellEntry Field: 99 Name: MinReputation Type: UInt32 ; GenericTypePrimitiveSerializerStrategy <UInt32> .Instance.Write(value.MinReputation, buffer, ref offset); //Type: SpellEntry Field: 100 Name: RequiredAuraVision Type: UInt32 ; GenericTypePrimitiveSerializerStrategy <UInt32> .Instance.Write(value.RequiredAuraVision, buffer, ref offset); //Type: SpellEntry Field: 101 Name: TotemCategory Type: SpellTotemDataChunk ; SpellTotemDataChunk_UInt32_Serializer.Instance.Write(value.TotemCategory, buffer, ref offset); //Type: SpellEntry Field: 102 Name: AreaGroupId Type: Int32 ; GenericTypePrimitiveSerializerStrategy <Int32> .Instance.Write(value.AreaGroupId, buffer, ref offset); //Type: SpellEntry Field: 103 Name: SchoolMask Type: SpellSchoolMask ; GenericPrimitiveEnumTypeSerializerStrategy <SpellSchoolMask, Int32> .Instance.Write(value.SchoolMask, buffer, ref offset); //Type: SpellEntry Field: 104 Name: RuneCostID Type: UInt32 ; GenericTypePrimitiveSerializerStrategy <UInt32> .Instance.Write(value.RuneCostID, buffer, ref offset); //Type: SpellEntry Field: 105 Name: SpellMissileID Type: UInt32 ; GenericTypePrimitiveSerializerStrategy <UInt32> .Instance.Write(value.SpellMissileID, buffer, ref offset); //Type: SpellEntry Field: 106 Name: PowerDisplayId Type: UInt32 ; GenericTypePrimitiveSerializerStrategy <UInt32> .Instance.Write(value.PowerDisplayId, buffer, ref offset); //Type: SpellEntry Field: 107 Name: DamageCoeficient Type: SpellEffectDataChunk ; SpellEffectDataChunk_Single_Serializer.Instance.Write(value.DamageCoeficient, buffer, ref offset); //Type: SpellEntry Field: 108 Name: SpellDescriptionVariableID Type: UInt32 ; GenericTypePrimitiveSerializerStrategy <UInt32> .Instance.Write(value.SpellDescriptionVariableID, buffer, ref offset); //Type: SpellEntry Field: 109 Name: SpellDifficultyId Type: UInt32 ; GenericTypePrimitiveSerializerStrategy <UInt32> .Instance.Write(value.SpellDifficultyId, buffer, ref offset); }
public bool SpellSoundPlay(SpellPacketBody spellPkt, SpellEvent spellEvt) { if (spellEvt > SpellEvent.SpellStruck) { return(false); } int spellSoundType; switch (spellEvt) { case SpellEvent.BeginSpellCast: spellSoundType = 0; break; case SpellEvent.EndSpellCast: spellSoundType = 1; break; case SpellEvent.SpellEffect: spellSoundType = 2; break; case SpellEvent.BeginRound: spellSoundType = 3; break; case SpellEvent.BeginProjectile: spellSoundType = 4; break; case SpellEvent.EndProjectile: spellSoundType = 5; break; case SpellEvent.AreaOfEffectHit: spellSoundType = 7; break; case SpellEvent.SpellStruck: spellSoundType = 8; break; default: return(false); } var spellSoundId = spellSoundType + 20 * spellPkt.spellEnum + 6000; SpellEntry spellEntry = GameSystems.Spell.GetSpellEntry(spellPkt.spellEnum); var modeTarget = spellEntry.modeTargetSemiBitmask.GetBaseMode(); switch (spellEvt) { case SpellEvent.EndSpellCast: GameSystems.SoundGame.PositionalSound(spellSoundId, spellPkt.caster); return(true); case SpellEvent.SpellEffect: case SpellEvent.AreaOfEffectHit: case SpellEvent.SpellStruck: if (spellPkt.spellEnum == 133) { // Dispel Magic if (spellPkt.Targets.Length > 0) { GameSystems.SoundGame.PositionalSound(8660, spellPkt.Targets[0].Object); } else { GameSystems.SoundGame.PositionalSound(8660, spellPkt.aoeCenter.location); } return(true); } goto case SpellEvent.BeginRound; case SpellEvent.BeginRound: switch (modeTarget) { case UiPickerType.Single: if (spellPkt.Targets.Length > 0) { GameSystems.SoundGame.PositionalSound(spellSoundId, spellPkt.Targets[0].Object); return(true); } GameSystems.SoundGame.PositionalSound(spellSoundId, spellPkt.caster); break; case UiPickerType.Multi: case UiPickerType.Cone: if (spellPkt.Targets.Length == 0) { GameSystems.SoundGame.PositionalSound(spellSoundId, spellPkt.caster); return(true); } foreach (var target in spellPkt.Targets) { GameSystems.SoundGame.PositionalSound(spellSoundId, target.Object); } break; case UiPickerType.Area: if (spellPkt.Targets.Length == 0) { GameSystems.SoundGame.PositionalSound(spellSoundId, spellPkt.aoeCenter.location); return(true); } foreach (var target in spellPkt.Targets) { GameSystems.SoundGame.PositionalSound(spellSoundId, target.Object); } break; case UiPickerType.Wall: case UiPickerType.Location: GameSystems.SoundGame.PositionalSound(spellSoundId, spellPkt.aoeCenter.location); return(true); case UiPickerType.Personal: case UiPickerType.InventoryItem: case UiPickerType.Ray: GameSystems.SoundGame.PositionalSound(spellSoundId, spellPkt.caster); return(true); } return(true); case SpellEvent.BeginSpellCast: GameSystems.SoundGame.PositionalSound(spellSoundId, spellPkt.caster); return(true); case SpellEvent.BeginProjectile: case SpellEvent.EndProjectile: return(true); default: return(false); } }
public static Spellbook FindSpellbookInList(List <Spellbook> list, Mobile from, SpellEntry spellId, SpellbookType type) { Container pack = from.Backpack; for (int i = list.Count - 1; i >= 0; --i) { if (i >= list.Count) { continue; } Spellbook book = list[i]; if (!book.Deleted && (book.Parent == from || pack != null && book.Parent == pack) && ValidateSpellbook(book, spellId, type)) { return(book); } list.RemoveAt(i); } return(null); }
private void _lvSpellList_SelectedIndexChanged(object sender, EventArgs e) { if (_lvSpellList.SelectedIndices.Count > 0) { SelectedSpell=_spellList[_lvSpellList.SelectedIndices[0]]; if (OnSpellChange!=null) OnSpellChange(this, new EventArgs()); } }
internal static void sub_6A00F(Player player) // sub_6A00F { for (int i = 0; i < 5; i++) { player.spellCastCount[0, i] = 0; player.spellCastCount[1, i] = 0; player.spellCastCount[2, i] = 0; } for (SkillType skill = SkillType.Cleric; skill <= SkillType.Monk; skill++) { int skillLevel = player.SkillLevel(skill); if (skillLevel > 0) { switch (skill) { case SkillType.Cleric: player.spellCastCount[0, 0] += 1; for (int PlayerLvl = 0; PlayerLvl <= (skillLevel - 2); PlayerLvl++) { for (int sp_lvl = 0; sp_lvl < 5; sp_lvl++) { player.spellCastCount[0, sp_lvl] += ClericSpellLevels[PlayerLvl, sp_lvl]; } } calc_cleric_spells(false, player); foreach (Spells spell in System.Enum.GetValues(typeof(Spells))) { SpellEntry se = gbl.spellCastingTable[(int)spell]; int sp_class = (se.spellLevel - 1) / 5; int sp_lvl = (se.spellLevel - 1) % 5; if (se.spellClass == 0 && player.spellCastCount[sp_class, sp_lvl] > 0 && spell != Spells.animate_dead) { player.LearnSpell(spell); } } break; case SkillType.Paladin: if (skillLevel > 8) { for (int addLvl = 8; addLvl < skillLevel; addLvl++) { for (int spellLvl = 0; spellLvl < 5; spellLvl++) { player.spellCastCount[0, spellLvl] += PaladinSpellLevels[addLvl, spellLvl]; } } foreach (Spells spell in System.Enum.GetValues(typeof(Spells))) { SpellEntry se = gbl.spellCastingTable[(int)spell]; int sp_class = (se.spellLevel - 1) / 5; int sp_lvl = (se.spellLevel - 1) % 5; if (se.spellClass == 0 && player.spellCastCount[sp_class, sp_lvl] > 0) { player.LearnSpell(spell); } } } break; case SkillType.Ranger: if (skillLevel > 7) { for (int var_3 = 8; var_3 <= skillLevel; var_3++) { for (int sp_lvl = 0; sp_lvl < 3; sp_lvl++) { player.spellCastCount[1, sp_lvl] += unk_1A758[var_3, sp_lvl]; } for (int sp_lvl = 3; sp_lvl < 5; sp_lvl++) { player.spellCastCount[2, sp_lvl - 3] += unk_1A758[var_3, sp_lvl]; } } foreach (Spells spell in System.Enum.GetValues(typeof(Spells))) { if (gbl.spellCastingTable[(int)spell].spellClass == SpellClass.Druid) { player.LearnSpell(spell); } } } break; case SkillType.MagicUser: player.spellCastCount[2, 0] += 1; for (int lvl = 0; lvl <= (skillLevel - 2); lvl++) { /* unk_1A7C6 = seg600:44B6 */ player.spellCastCount[2, 0] += ovr020.MU_spell_lvl_learn[lvl, 0]; player.spellCastCount[2, 1] += ovr020.MU_spell_lvl_learn[lvl, 1]; player.spellCastCount[2, 2] += ovr020.MU_spell_lvl_learn[lvl, 2]; player.spellCastCount[2, 3] += ovr020.MU_spell_lvl_learn[lvl, 3]; player.spellCastCount[2, 4] += ovr020.MU_spell_lvl_learn[lvl, 4]; } break; } } } foreach (Item item in player.items) { if (item.affect_3 == Affects.protect_magic && item.readied) { for (int sp_lvl = 0; sp_lvl < 3; sp_lvl++) { player.spellCastCount[2, sp_lvl] *= 2; } } } }
public static bool ValidateSpellbook(Spellbook book, SpellEntry spellId, SpellbookType type) { return(book.SpellbookType == type && (spellId == SpellEntry.None || book.HasSpell(spellId))); }