Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- * Created by SharpDevelop.
- * User: Administrator
- * Date: 7/14/2011
- * Time: 11:23 PM
- *
- * To change this template use Tools | Options | Coding | Edit Standard Headers.
- */
- using System;
- using System.Collections;
- using System.Collections.Generic;
- using Delta9;
- using pwnagebot.LotroInterface;
- namespace SiegeOfGondomon
- {
- /// <summary>
- /// Description of MyClass.
- /// </summary>
- public class SiegeOfGondamon : Delta9Methods, Delta9Method
- { ArrayList loadedSkills;
- ArrayList loadedNpcs;
- SkillContainer summonSoldier;
- bool findNewTarget = false;
- int maxRange = 35;
- int maxMathiDist = 20;
- public SiegeOfGondamon(Delta9Instance i,string args) : base(i,args) {
- scriptName = "Siege of Gondomon";
- }
- public override void Run() {
- Initialize();
- while (KeepGoing()) {
- if (KeepGoing()) WalkToMathi();
- if (KeepGoing()) KillNearestNpc();
- if (KeepGoing()) SummonSoldier();
- }
- Debug("Stopped script!");
- }
- void WalkToMathi() {
- LotroEntity e = GetEntityByName("Mathi",100);
- if (e != null) {
- if (e.DistanceTo(GetMe()) > maxMathiDist) {
- Debug("Walking to Mathi");
- WalkToWait(e,5);
- }
- }
- }
- void KillNearestNpc() {
- LotroEntity e = GetEntityByName(loadedNpcs,maxRange);
- if (e != null) {
- Debug("Killing Nearest NPC: "+e.Name);
- while (e.Dead != true && !findNewTarget) {
- foreach (SkillContainer f in loadedSkills) {
- f.Cast(e);
- }
- }
- if (findNewTarget) {
- findNewTarget = false;
- }
- else if (e.Lootable) {
- Debug("Looting coorpse");
- WalkToWait(e,2);
- SelectTarget(e);
- Face(e);
- Wait(200);
- Loot(e);
- WalkToMathi();
- Wait(1000);
- }
- }
- }
- void SummonSoldier() {
- LotroEntity e = GetEntityByName("Warrior",50);
- if (e == null && GetMe().CombatActive == false) {
- Wait(1000);
- summonSoldier.Cast();
- }
- }
- private void Initialize() {
- Debug("Loaded script...");
- LoadConfig();
- Interface.OnLineOfSight += new EventHandler<EventArgs>(NewTarget);
- Interface.OnInvalidTarget += new EventHandler<EventArgs>(NewTarget);
- }
- private void LoadConfig() {
- // Create a dictionary of Section elements called
- // configSections
- loadedSkills = new ArrayList();
- loadedNpcs = new ArrayList();
- Dictionary<string, Dictionary<string,string>>
- configSections =
- ParseConfig("scripts/SiegeOfGondamon.ini");
- if (configSections.ContainsKey("Skills")) {
- Dictionary<string, string> skillSection = null;
- configSections.TryGetValue("Skills",out skillSection);
- if (skillSection != null) {
- string val = "";
- for (int i = 1; i < 10; ++i) {
- bool result = skillSection.TryGetValue("Skill" + i, out val);
- if (result) {
- string name = val;
- skillSection.TryGetValue("Skill"+i+"Focus",out val);
- int focus = int.Parse(val);
- skillSection.TryGetValue("Skill"+i+"Delay",out val);
- int delay = int.Parse(val);
- skillSection.TryGetValue("Skill"+i+"Hotkey",out val);
- int hotkey = int.Parse(val);
- skillSection.TryGetValue("Skill"+i+"Range",out val);
- int range = int.Parse(val);
- skillSection.TryGetValue("Skill"+i+"Induction",out val);
- int induction = int.Parse(val);
- loadedSkills.Add(
- new SkillContainer(
- this,name,hotkey,delay,focus,range,induction
- )
- );
- Debug("Skill loaded: Name="+name+", Hotkey="+hotkey+", Delay="+delay+", Range="+range);
- }
- }
- if (skillSection.TryGetValue("SkillSoldier",out val)) {
- string name = val;
- skillSection.TryGetValue("SkillSoldierFocus",out val);
- int focus = int.Parse(val);
- skillSection.TryGetValue("SkillSoldierDelay",out val);
- int delay = int.Parse(val);
- skillSection.TryGetValue("SkillSoldierHotkey",out val);
- int hotkey = int.Parse(val);
- skillSection.TryGetValue("SkillSoldierRange",out val);
- int range = int.Parse(val);
- skillSection.TryGetValue("SkillSoldierInduction",out val);
- int induction = int.Parse(val);
- summonSoldier = new SkillContainer(
- this,name,hotkey,delay,focus,range,induction
- );
- Debug("Summon Soldier Loaded: Name="+name+", Hotkey="+hotkey+", Delay="+delay+", Range="+range);
- }
- }
- Dictionary<string, string> configSection = null;
- configSections.TryGetValue("Config",out configSection);
- if (configSection != null) {
- string val = "false";
- configSection.TryGetValue("Melee",out val);
- if (bool.Parse(val)) {
- maxRange = 4;
- }
- else {
- maxRange = 35;
- }
- val = "20";
- configSection.TryGetValue("MaxMathiDist",out val);
- maxMathiDist = int.Parse(val);
- }
- Dictionary<string, string> npcSection = null;
- configSections.TryGetValue("Npcs",out npcSection);
- if (npcSection != null) {
- foreach (string s in npcSection.Values) {
- if (s != null) {
- loadedNpcs.Add(s);
- Debug("Loaded NPC: "+s);
- }
- }
- }
- }
- else {
- Debug("Error loading config.. Termininating script..");
- Stop();
- }
- }
- private bool KeepGoing() {
- if (Running) {
- Wait(1000);
- return true;
- }
- return false;
- }
- #region Event Handlers
- public override void OnDeath(object o, EventArgs e) {
- }
- public void NewTarget(object o, EventArgs e) {
- findNewTarget = true;
- }
- #endregion
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement