public override void Execute(GameLiving living) { if (CheckPreconditions(living, DEAD | SITTING | MEZZED | STUNNED)) { return; } if (!(living is GamePlayer player)) { return; } if (player.ControlledBrain?.Body == null) { return; } player.ControlledBrain.Body.AddAbility(SkillBase.GetAbility(Abilities.CCImmunity)); new ResoluteMinionEffect().Start(player.ControlledBrain.Body); foreach (GamePlayer visPlayer in player.GetPlayersInRadius(WorldMgr.VISIBILITY_DISTANCE)) { visPlayer.Out.SendSpellEffectAnimation(player, player.ControlledBrain.Body, 7047, 0, false, 0x01); } DisableSkill(living); }
public override void OnEffectStart(GameSpellEffect effect) { gp = effect.Owner as GamePlayer; if (gp != null) { gp.AddAbility(SkillBase.GetAbility(Abilities.Climbing)); gp.Out.SendUpdatePlayerSkills(); } }
/// <summary> /// Fire bolt /// </summary> /// <param name="target"></param> public override void FinishSpellCast(GameLiving target) { m_caster.Mana -= PowerCost(target); // endurance m_caster.Endurance -= 5; // messages GamePlayer caster = (GamePlayer)m_caster; if (Spell.InstrumentRequirement == 0) { if (SecondarySpell == null && PrimarySpell == null) { MessageToCaster("No spells were loaded into " + m_spell.Name + ".", eChatType.CT_Spell); } else { MessageToCaster("Your " + m_spell.Name + " is ready for use.", eChatType.CT_Spell); //StartSpell(target); // and action GameSpellEffect neweffect = CreateSpellEffect(target, 1); neweffect.Start(m_caster); SendEffectAnimation(m_caster, 0, false, 1); ((GamePlayer)m_caster).Out.SendWarlockChamberEffect((GamePlayer)m_caster); } foreach (GamePlayer player in m_caster.GetPlayersInRadius(WorldMgr.INFO_DISTANCE)) { if (player != m_caster) { player.MessageFromArea(m_caster, m_caster.GetName(0, true) + " casts a spell!", eChatType.CT_Spell, eChatLoc.CL_SystemWindow); } } } //the quick cast is unallowed whenever you miss the spell //set the time when casting to can not quickcast during a minimum time if (m_caster is GamePlayer) { QuickCastEffect quickcast = m_caster.EffectList.GetOfType <QuickCastEffect>(); if (quickcast != null && Spell.CastTime > 0) { m_caster.TempProperties.setProperty(GamePlayer.QUICK_CAST_CHANGE_TICK, m_caster.CurrentRegion.Time); m_caster.DisableSkill(SkillBase.GetAbility(Abilities.Quickcast), QuickCastAbilityHandler.DISABLE_DURATION); quickcast.Cancel(false); } } }
/// <summary> /// Action /// </summary> /// <param name="living"></param> public override void Execute(GameLiving living) { if (CheckPreconditions(living, DEAD | SITTING | MEZZED | STUNNED)) { return; } SendCasterSpellEffectAndCastMessage(living, 7006, true); if (living is GamePlayer player) { player.RemoveDisabledSkill(SkillBase.GetAbility(Abilities.Quickcast)); } DisableSkill(living); }
/// <summary> /// Add all spell-lines and other things that are new when this skill is trained /// FIXME : this should be in database /// </summary> /// <param name="player"></param> /// <param name="skill"></param> public override void OnSkillTrained(GamePlayer player, Specialization skill) { base.OnSkillTrained(player, skill); switch (skill.KeyName) { case Specs.CompositeBow: if (ServerProperties.Properties.ALLOW_OLD_ARCHERY) { if (skill.Level < 3) { // do nothing } else if (skill.Level < 6) { player.AddAbility(SkillBase.GetAbility(Abilities.Critical_Shot, 1)); } else if (skill.Level < 9) { player.AddAbility(SkillBase.GetAbility(Abilities.Critical_Shot, 2)); } else if (skill.Level < 12) { player.AddAbility(SkillBase.GetAbility(Abilities.Critical_Shot, 3)); } else if (skill.Level < 15) { player.AddAbility(SkillBase.GetAbility(Abilities.Critical_Shot, 4)); } else if (skill.Level < 18) { player.AddAbility(SkillBase.GetAbility(Abilities.Critical_Shot, 5)); } else if (skill.Level < 21) { player.AddAbility(SkillBase.GetAbility(Abilities.Critical_Shot, 6)); } else if (skill.Level < 24) { player.AddAbility(SkillBase.GetAbility(Abilities.Critical_Shot, 7)); } else if (skill.Level < 27) { player.AddAbility(SkillBase.GetAbility(Abilities.Critical_Shot, 8)); } else if (skill.Level >= 27) { player.AddAbility(SkillBase.GetAbility(Abilities.Critical_Shot, 9)); } if (skill.Level >= 45) { player.AddAbility(SkillBase.GetAbility(Abilities.RapidFire, 2)); } else if (skill.Level >= 35) { player.AddAbility(SkillBase.GetAbility(Abilities.RapidFire, 1)); } if (skill.Level >= 45) { player.AddAbility(SkillBase.GetAbility(Abilities.SureShot)); } if (skill.Level >= 50) { player.AddAbility(SkillBase.GetAbility(Abilities.PenetratingArrow, 3)); } else if (skill.Level >= 40) { player.AddAbility(SkillBase.GetAbility(Abilities.PenetratingArrow, 2)); } else if (skill.Level >= 30) { player.AddAbility(SkillBase.GetAbility(Abilities.PenetratingArrow, 1)); } } break; } }
/// <summary> /// Constructs a new NpcTemplate /// </summary> /// <param name="data">The source npc template data</param> public NpcTemplate(DBNpcTemplate data) { if (data == null) { throw new ArgumentNullException("data"); } m_templateId = data.TemplateId; m_translationId = data.TranslationId; m_name = data.Name; m_suffix = data.Suffix; m_classType = data.ClassType; m_guildName = data.GuildName; m_examineArticle = data.ExamineArticle; m_messageArticle = data.MessageArticle; m_model = data.Model; m_gender = data.Gender; m_size = data.Size; if (m_size == null) { m_size = "50"; } m_level = data.Level; if (m_level == null) { m_level = "0"; } m_equipmentTemplateID = data.EquipmentTemplateID; m_itemsListTemplateID = data.ItemsListTemplateID; m_maxSpeed = data.MaxSpeed; m_parryChance = data.ParryChance; m_evadeChance = data.EvadeChance; m_blockChance = data.BlockChance; m_leftHandSwingChance = data.LeftHandSwingChance; m_strength = data.Strength; m_constitution = data.Constitution; m_dexterity = data.Dexterity; m_quickness = data.Quickness; m_intelligence = data.Intelligence; m_piety = data.Piety; m_charisma = data.Charisma; m_empathy = data.Empathy; // Time to add Spells/Styles and Abilties to the templates m_abilities = new ArrayList(); m_spelllines = new ArrayList(); m_spells = new ArrayList(); // Adding the spells to an Arraylist here if (data.Spells != null && data.Spells.Length > 0) { string[] spells = data.Spells.Split(';'); for (int k = 0; k < spells.Length; k++) { int id = int.Parse(spells[k]); Spell sp = SkillBase.GetSpellByID(id); if (sp != null) { m_spells.Add(sp); } else { log.Error("Tried to load a null spell into NPC template " + m_templateId + " spell ID: " + id); } } } // Adding Style list to Template NPC m_styles = new ArrayList(); if (data.Styles != null && data.Styles.Length > 0) { string[] styles = data.Styles.Split(';'); for (int i = 0; i < styles.Length; i++) { if (styles[i].Trim().Length == 0) { continue; } string[] styleAndClass = styles[i].Split('|'); if (styleAndClass.Length != 2) { continue; } string stylePart = styleAndClass[0].Trim(); string classPart = styleAndClass[1].Trim(); if (stylePart.Length == 0 || classPart.Length == 0) { continue; } int styleID = int.Parse(stylePart); int classID = int.Parse(classPart); Style style = SkillBase.GetStyleByID(styleID, classID); m_styles.Add(style); } } // Adding Abilities to Template NPC. // Certain Abilities have levels will need to fix that down the road. -Batlas if (data.Abilities != null && data.Abilities.Length > 0) { foreach (string splitab in data.Abilities.SplitCSV()) { string[] ab = splitab.Split('|'); if (splitab.Trim().Length == 0) { continue; } int id = 1; if (ab.Length > 1) { id = int.Parse(ab[1]); } Ability abil = SkillBase.GetAbility(ab[0], id); if (abil != null) { m_abilities.Add(abil); } } } m_flags = data.Flags; m_meleeDamageType = (eDamageType)data.MeleeDamageType; if (data.MeleeDamageType == 0) { m_meleeDamageType = eDamageType.Slash; } m_inventory = data.EquipmentTemplateID; m_aggroLevel = data.AggroLevel; m_aggroRange = data.AggroRange; m_race = (ushort)data.Race; m_bodyType = (ushort)data.BodyType; m_maxdistance = data.MaxDistance; m_tetherRange = data.TetherRange; m_visibleActiveWeaponSlot = data.VisibleWeaponSlots; m_replaceMobValues = data.ReplaceMobValues; }
public override bool ReceiveItem(GameLiving source, InventoryItem item) { if (source == null || item == null) { return(false); } if (source is GamePlayer) { GamePlayer player = (GamePlayer)source; string tmpStr = player.Client.Account.Characters[player.Client.ActiveCharIndex].SerializedSpecs.Replace(@";", ",").Replace(@"|", ","); string[] values = { }; foreach (string spec in tmpStr.SplitCSV()) { values = spec.Split(','); } int hasPlate = 0; int hasChain = 0; List <string> specList = new List <string>(); for (var i = 0; i < values.Length; i++) { if (i % 2 == 0 && values[i] == "Plate") { hasPlate = 6; specList.Add(values[i]); } else if (i % 2 == 0 && values[i] == "Chain") { hasChain = 4; specList.Add(values[i]); } else if (i % 2 == 0 && values[i] == "Studded / Reinforced") { hasChain = 4; specList.Add(values[i]); } else if (i % 2 == 0 && values[i] != "Chain" && values[i] != "Plate") { specList.Add(values[i]); } } if (values.Length < (20 - hasPlate - hasChain)) { if (values.Length < 15 && item.Item_Type == 444 && item.Name == "Plate") { player.AddAbility(SkillBase.GetAbility("AlbArmor", 5)); player.AddAbility(SkillBase.GetAbility("HibArmor", 4)); player.AddAbility(SkillBase.GetAbility("MidArmor", 4)); player.AddSpecialization(SkillBase.GetSpecialization(item.Name)); player.Out.SendUpdatePlayer(); player.Out.SendUpdatePoints(); player.Out.SendUpdatePlayerSkills(); player.SaveIntoDatabase(); player.UpdatePlayerStatus(); player.Inventory.RemoveCountFromStack(item, 1); } else if (values.Length > 14 && item.Item_Type == 444 && item.Name == "Plate") { SayTo(player, "Plate occupies 3 specs, remove some specs first!"); } else if (values.Length < 17 && item.Item_Type == 444 && item.Name == "Chain") { player.AddAbility(SkillBase.GetAbility("AlbArmor", 4)); player.AddAbility(SkillBase.GetAbility("HibArmor", 4)); player.AddAbility(SkillBase.GetAbility("MidArmor", 4)); player.AddSpecialization(SkillBase.GetSpecialization(item.Name)); player.Out.SendUpdatePlayer(); player.Out.SendUpdatePoints(); player.Out.SendUpdatePlayerSkills(); player.SaveIntoDatabase(); player.UpdatePlayerStatus(); player.Inventory.RemoveCountFromStack(item, 1); } else if (values.Length > 16 && item.Item_Type == 444 && item.Name == "Chain") { SayTo(player, "Chain and Studded occupy 2 specs, remove some specs first!"); } else if (values.Length < 17 && item.Item_Type == 444 && item.Name == "Studded / Reinforced") { player.AddAbility(SkillBase.GetAbility("AlbArmor", 3)); player.AddAbility(SkillBase.GetAbility("HibArmor", 3)); player.AddAbility(SkillBase.GetAbility("MidArmor", 3)); player.AddSpecialization(SkillBase.GetSpecialization(item.Name)); player.Out.SendUpdatePlayer(); player.Out.SendUpdatePoints(); player.Out.SendUpdatePlayerSkills(); player.SaveIntoDatabase(); player.UpdatePlayerStatus(); player.Inventory.RemoveCountFromStack(item, 1); } else if (values.Length > 16 && item.Item_Type == 444 && item.Name == "Studded / Reinforced") { SayTo(player, "Chain and Studded occupy 2 specs, remove some specs first!"); } else if (item.Item_Type == 444 && item.Name == "Leather") { player.AddAbility(SkillBase.GetAbility("AlbArmor", 2)); player.AddAbility(SkillBase.GetAbility("HibArmor", 2)); player.AddAbility(SkillBase.GetAbility("MidArmor", 2)); player.AddSpecialization(SkillBase.GetSpecialization(item.Name)); player.Out.SendUpdatePlayer(); player.Out.SendUpdatePoints(); player.Out.SendUpdatePlayerSkills(); player.SaveIntoDatabase(); player.UpdatePlayerStatus(); player.Inventory.RemoveCountFromStack(item, 1); } else if (item.Item_Type == 666 && isItemInMerchantList(item)) { player.AddAbility(SkillBase.GetAbility(item.Name)); player.AddSpecialization(SkillBase.GetSpecialization(item.Description)); player.Out.SendUpdatePlayer(); player.Out.SendUpdatePoints(); player.Out.SendUpdatePlayerSkills(); player.SaveIntoDatabase(); player.UpdatePlayerStatus(); player.Inventory.RemoveCountFromStack(item, 1); } else if (item.Item_Type == 888 && isItemInMerchantList(item)) { player.AddSpecialization(SkillBase.GetSpecialization(item.Name)); player.Out.SendUpdatePlayer(); player.Out.SendUpdatePoints(); player.Out.SendUpdatePlayerSkills(); player.SaveIntoDatabase(); player.UpdatePlayerStatus(); player.Inventory.RemoveCountFromStack(item, 1); } return(false); } else if (values.Length > (19 - hasPlate - hasChain)) { SayTo(player, "You can only have 10 specs in your specialization list! Go remove some to add this one. Choose wisely!"); } } return(false); }