Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using DOL.GS.PacketHandler;
- using DOL.GS.RealmAbilities;
- namespace DOL.GS.Commands
- {
- [CmdAttribute(
- "&gamenpc",
- ePrivLevel.GM,
- "/Gamenpc <spell> <target|targetName|targetGuild> <spellID> <self|enemy|npcguild|npcname>",
- "/Gamenpc <add|remove> <ability|base|spec|debuff> <property> <value> <radius>")]
- public class GameNPCCommandHandler : AbstractCommandHandler, ICommandHandler
- {
- public void OnCommand(GameClient client, string[] args)
- {
- GameNPC npc = (GameNPC)client.Player.TargetObject;
- if (args.Length < 2)
- {
- DisplaySyntax(client);
- return;
- }
- switch (args[1].ToLower())
- {
- case "add":
- {
- switch (args[2].ToLower())
- {
- case "ability":
- {
- if (args.Length < 6)
- {
- DisplaySyntax(client, args[1]);
- return;
- }
- int property = Convert.ToInt16(args[3]);
- if (Convert.ToInt32(args[5]) > 0)
- {
- foreach (GameNPC npcs in npc.GetNPCsInRadius((ushort)Convert.ToInt32(args[5])))
- {
- npcs.AbilityBonus[property] += Convert.ToInt16(args[4]);
- }
- }
- else
- npc.AbilityBonus[property] += Convert.ToInt16(args[4]);
- }
- break;
- case "base":
- {
- if (args.Length < 6)
- {
- DisplaySyntax(client, args[1]);
- return;
- }
- int property = Convert.ToInt16(args[3]);
- if (Convert.ToInt32(args[5]) > 0)
- {
- foreach (GameNPC npcs in npc.GetNPCsInRadius((ushort)Convert.ToInt32(args[5])))
- {
- npcs.BaseBuffBonusCategory[property] += Convert.ToInt16(args[4]);
- }
- }
- else
- npc.BaseBuffBonusCategory[property] += Convert.ToInt16(args[4]);
- }
- break;
- case "spec":
- {
- if (args.Length < 6)
- {
- DisplaySyntax(client, args[1]);
- return;
- }
- int property = Convert.ToInt16(args[3]);
- if (Convert.ToInt32(args[5]) > 0)
- {
- foreach (GameNPC npcs in npc.GetNPCsInRadius((ushort)Convert.ToInt32(args[5])))
- {
- npcs.BuffBonusCategory4[property] += Convert.ToInt16(args[4]);
- }
- }
- else
- npc.BuffBonusCategory4[property] += Convert.ToInt16(args[4]);
- }
- break;
- }
- break;
- }
- case "remove":
- {
- switch (args[2].ToLower())
- {
- case "ability":
- {
- if (args.Length < 6)
- {
- DisplaySyntax(client, args[1]);
- return;
- }
- int property = Convert.ToInt16(args[3]);
- if (Convert.ToInt32(args[5]) > 0)
- {
- foreach (GameNPC npcs in npc.GetNPCsInRadius((ushort)Convert.ToInt32(args[5])))
- {
- npcs.AbilityBonus[property] -= Convert.ToInt16(args[4]);
- }
- }
- else
- npc.AbilityBonus[property] -= Convert.ToInt16(args[4]);
- }
- break;
- case "base":
- {
- if (args.Length < 5)
- {
- DisplaySyntax(client, args[1]);
- return;
- }
- int property = Convert.ToInt16(args[3]);
- if (Convert.ToInt32(args[2]) > 0)
- {
- foreach (GameNPC npcs in npc.GetNPCsInRadius((ushort)Convert.ToInt32(args[4])))
- {
- npcs.BaseBuffBonusCategory[property] -= Convert.ToInt16(args[3]);
- }
- }
- else
- npc.BaseBuffBonusCategory[property] -= Convert.ToInt16(args[3]);
- }
- break;
- case "spec":
- {
- if (args.Length < 5)
- {
- DisplaySyntax(client, args[1]);
- return;
- }
- int property = Convert.ToInt16(args[2]);
- if (Convert.ToInt32(args[4]) > 0)
- {
- foreach (GameNPC npcs in npc.GetNPCsInRadius((ushort)Convert.ToInt32(args[4])))
- {
- npcs.BuffBonusCategory4[property] -= Convert.ToInt16(args[3]);
- }
- }
- else
- npc.BuffBonusCategory4[property] -= Convert.ToInt16(args[3]);
- }
- break;
- }
- break;
- }
- case "cast":
- {
- if (args.Length != 5)
- {
- DisplaySyntax(client, args[1]);
- return;
- }
- if (npc == null || client.Player.TargetObject == null) return;
- SpellLine line = SkillBase.GetSpellLine("Mob Spells");
- Spell spell = SkillBase.GetSpellByID(Convert.ToInt32(args[3]));
- DOL.Database.DBSpell dbs = null;
- Spell cloneSpell = null;
- dbs.Description = spell.Description;
- dbs.Target = args[2];
- dbs.Type = spell.SpellType;
- dbs.Range = spell.Range;
- dbs.Radius = spell.Radius;
- dbs.Value = spell.Value;
- dbs.Damage = spell.Damage;
- dbs.DamageType = (int)spell.DamageType;
- dbs.Concentration = spell.Concentration;
- dbs.Duration = spell.Duration;
- dbs.Frequency = spell.Frequency;
- dbs.Pulse = spell.Pulse;
- dbs.PulsePower = spell.PulsePower;
- dbs.Power = spell.Power;
- dbs.CastTime = spell.CastTime;
- dbs.RecastDelay = spell.RecastDelay;
- dbs.ResurrectHealth = spell.ResurrectHealth;
- dbs.ResurrectMana = spell.ResurrectMana;
- dbs.LifeDrainReturn = spell.LifeDrainReturn;
- dbs.AmnesiaChance = spell.AmnesiaChance;
- dbs.Message1 = spell.Message1;
- dbs.Message2 = spell.Message2;
- dbs.Message3 = spell.Message3;
- dbs.Message4 = spell.Message4;
- dbs.ClientEffect = spell.ClientEffect;
- dbs.Icon = spell.Icon;
- dbs.InstrumentRequirement = spell.InstrumentRequirement;
- dbs.EffectGroup = spell.EffectGroup;
- dbs.SubSpellID = spell.SubSpellID;
- dbs.MoveCast = spell.MoveCast;
- dbs.Uninterruptible = spell.Uninterruptible;
- dbs.IsFocus = spell.IsFocus;
- dbs.IsPrimary = spell.IsPrimary;
- dbs.IsSecondary = spell.IsSecondary;
- dbs.AllowBolt = spell.AllowBolt;
- dbs.SharedTimerGroup = spell.SharedTimerGroup;
- cloneSpell = new Spell(dbs, 1);
- if (spell != null && cloneSpell != null)
- {
- npc.CastSpell(cloneSpell, line);
- return;
- }
- client.Out.SendMessage("Spell with id " + Convert.ToInt16(args[3]) + " not found in db!", eChatType.CT_System, eChatLoc.CL_SystemWindow);
- break;
- }
- default:
- {
- client.Out.SendMessage("'" + args[1] + "' is not a valid arguement.", eChatType.CT_Important, eChatLoc.CL_SystemWindow);
- }
- break;
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement