public static XmlAttachment NEWATTACHMENT(TriggerObject trigObj, string attachmenttype, string name) { attachmenttype = attachmenttype.ToLower().Trim(); XmlAttachment attachment = null; switch (attachmenttype) { case "xmlvalue": attachment = new XmlValue("", 0); break; case "xmllocalvariable": attachment = new XmlLocalVariable(""); break; case "xmlscript": attachment = new XmlScript(); break; case "xmlteam": attachment = new XmlTeam(); break; case "xmldouble": attachment = new XmlDouble("", 0.0); break; case "xmlgroup": attachment = new XmlGroup(); break; case "xmlslayer": attachment = new XmlSlayer("orcslaying", name); break; case "xmldate": attachment = new XmlDate(""); break; case "xmlcorpseaction": attachment = new XmlCorpseAction(); break; case "xmldeathaction": attachment = new XmlDeathAction(); break; case "xmluse": attachment = new XmlUse(); break; case "xmlonhit": attachment = new XmlOnHit(); break; case "xmladdfame": attachment = new XmlAddFame(0); break; case "xmladdkarma": attachment = new XmlAddKarma(0); break; case "xmldex": attachment = new XmlDex(); break; case "xmldialog": attachment = new XmlDialog(); break; case "xmlenemymastery": attachment = new XmlEnemyMastery(""); break; case "xmlfire": attachment = new XmlFire(1); break; case "xmlfreeze": attachment = new XmlFreeze(); break; case "xmlhue": attachment = new XmlHue(0); break; case "xmllifedrain": attachment = new XmlLifeDrain(1); break; case "xmllightning": attachment = new XmlLightning(1); break; case "xmlmagicword": attachment = new XmlMagicWord(); break; case "xmlmanadrain": attachment = new XmlManaDrain(1); break; case "xmlmessage": attachment = new XmlMessage(""); break; case "xmlsaveitem": attachment = new XmlSaveItem(); break; case "xmlskill": attachment = new XmlSkill("", "wrestling"); break; case "xmlsound": attachment = new XmlSound(); break; case "xmlstamdrain": attachment = new XmlStamDrain(1); break; case "xmlstr": attachment = new XmlStr(); break; case "xmlint": attachment = new XmlInt(); break; } if (attachment == null) { throw new UberScriptException("NEWATTACHMENT error: " + attachmenttype + " is not an available xmlattachment!"); } if (attachment.Name == "" && name == null) // those attachments that require a name { return attachment; } attachment.Name = name; return attachment; }
public bool DoDisease(Disease dis) { if (m_Player == null || m_Player.Deleted || !m_Player.Alive || (m_Player is PlayerMobile && (m_Player as PlayerMobile).RessSick)) return false; if (m_Player.Map == Map.Internal) return false; if (!HasDisease(dis)) return false; switch (dis) { case Disease.Influenza: { List<StatMod> removeMod = new List<StatMod>(); foreach (StatMod mod in m_Player.StatMods) { if (mod.Name.Contains("[Influenza]")) removeMod.Add(mod); } for (int i = 0; i < removeMod.Count; i++) if(m_Player.StatMods.Contains(removeMod[i])) m_Player.StatMods.Remove(removeMod[i]); int amount = (m_Player.StamMax / 2) * -1; m_Player.Emote("*sweats profusely*"); XmlStam influenza = new XmlStam(amount, 300); influenza.Name = " [Disease] [Influenza] "; XmlAttach.AttachTo(m_Player, influenza); DiseaseMessage(dis); return true; } case Disease.HundredDaysCough: { List<StatMod> removeMod = new List<StatMod>(); foreach (StatMod mod in m_Player.StatMods) { if (mod.Name.Contains("[HundredDaysCough]")) removeMod.Add(mod); } for (int i = 0; i < removeMod.Count; i++) if(m_Player.StatMods.Contains(removeMod[i])) m_Player.StatMods.Remove(removeMod[i]); m_Player.Emote("*cough cough cough!*"); if (m_Player.Female) { if (Utility.RandomBool()) m_Player.PlaySound(0x311); else m_Player.PlaySound(0x312); } else { if (Utility.RandomBool()) m_Player.PlaySound(0x420); else m_Player.PlaySound(0x421); } XmlStam cough = new XmlStam(-5, 60); XmlHits ache = new XmlHits(-5, 300); cough.Name = " [Disease] [HundredDaysCough] [1] "; ache.Name = " [Disease] [HundredDaysCough] [2] "; XmlAttach.AttachTo(m_Player, cough); XmlAttach.AttachTo(m_Player, ache); DiseaseMessage(dis); return true; } case Disease.Diptheria: { List<StatMod> removeMod = new List<StatMod>(); foreach (StatMod mod in m_Player.StatMods) { if (mod.Name.Contains("[Diptheria]")) removeMod.Add(mod); } for (int i = 0; i < removeMod.Count; i++) if(m_Player.StatMods.Contains(removeMod[i])) m_Player.StatMods.Remove(removeMod[i]); int amount = (m_Player.Dex / 3) * -1; m_Player.Emote("*drools over " + (m_Player.Female ? "her" : "his") + " swollen neck*"); XmlDex diptheria = new XmlDex(amount, 600); diptheria.Name = " [Disease] [Diptheria] "; XmlAttach.AttachTo(m_Player, diptheria); DiseaseMessage(dis); return true; } case Disease.Dysentery: { List<StatMod> removeMod = new List<StatMod>(); foreach (StatMod mod in m_Player.StatMods) { if (mod.Name.Contains("[Dysentery]")) removeMod.Add(mod); } for (int i = 0; i < removeMod.Count; i++) if(m_Player.StatMods.Contains(removeMod[i])) m_Player.StatMods.Remove(removeMod[i]); m_Player.Emote("*doubles over in pain!*"); m_Player.Hunger -= 10; if (m_Player.Hunger < 0) m_Player.Hunger = 0; m_Player.Thirst -= 10; if (m_Player.Thirst < 0) m_Player.Thirst = 0; XmlHits dysentery = new XmlHits(-10, 3600); dysentery.Name = " [Disease] [Dysentery] "; XmlAttach.AttachTo(m_Player, dysentery); DiseaseMessage(dis); return true; } case Disease.Consumption: { List<StatMod> removeMod = new List<StatMod>(); foreach (StatMod mod in m_Player.StatMods) { if (mod.Name.Contains("[Consumption]")) removeMod.Add(mod); } for (int i = 0; i < removeMod.Count; i++) if(m_Player.StatMods.Contains(removeMod[i])) m_Player.StatMods.Remove(removeMod[i]); m_Player.Emote("*cough cough cough!*"); if (m_Player.Female) { if(Utility.RandomBool()) m_Player.PlaySound(0x311); else m_Player.PlaySound(0x312); } else { if (Utility.RandomBool()) m_Player.PlaySound(0x420); else m_Player.PlaySound(0x421); } int hitsamount = (m_Player.HitsMax / 4) * -1; int stamamount = (m_Player.StamMax / 4) * -1; XmlHits consumption1 = new XmlHits(hitsamount, 1200); XmlStam consumption2 = new XmlStam(stamamount, 1200); consumption1.Name = " [Disease] [Consumption] [1] "; consumption2.Name = " [Disease] [Consumption] [2] "; XmlAttach.AttachTo(m_Player, consumption1); XmlAttach.AttachTo(m_Player, consumption2); if (!m_Player.Mounted) m_Player.Animate(32, 5, 1, true, false, 0); Point3D p = new Point3D(m_Player.Location); switch (m_Player.Direction) { case Direction.North: p.Y--; break; case Direction.South: p.Y++; break; case Direction.East: p.X++; break; case Direction.West: p.X--; break; case Direction.Right: p.X++; p.Y--; break; case Direction.Down: p.X++; p.Y++; break; case Direction.Left: p.X--; p.Y++; break; case Direction.Up: p.X--; p.Y--; break; default: break; } p.Z = m_Player.Map.GetAverageZ(p.X, p.Y); bool canFit = Server.Spells.SpellHelper.AdjustField(ref p, m_Player.Map, 12, false); if (canFit) { Puke puke = new Puke(); puke.Name = "blood"; puke.Hue = Utility.RandomList(1157, 1609, 2206, 2778, 2795); puke.Map = m_Player.Map; puke.Location = p; } DiseaseMessage(dis); return true; } case Disease.AzhuranFever: { List<StatMod> removeMod = new List<StatMod>(); foreach (StatMod mod in m_Player.StatMods) { if (mod.Name.Contains("[AzhuranFever]")) removeMod.Add(mod); } for (int i = 0; i < removeMod.Count; i++) if (m_Player.StatMods.Contains(removeMod[i])) m_Player.StatMods.Remove(removeMod[i]); m_Player.Emote("*sweats profusely!*"); if(m_Player is PlayerMobile) HallucinationEffect.BeginHallucinating(m_Player as PlayerMobile, 120); XmlHue yellowFever = new XmlHue(1052, 120); int stamamount =(m_Player.StamMax / 3) * -1; int stramount = (m_Player.Str / 4) * -1; XmlStam azhuranStam = new XmlStam(stamamount, 60); XmlStr azhuranStr = new XmlStr(stramount, 60); yellowFever.Name = " [Disease] [AzhuranFever] [1] "; azhuranStam.Name = " [Disease] [AzhuranFever] [2] "; azhuranStr.Name = " [Disease] [AzhuranFever] [3] "; XmlAttach.AttachTo(m_Player, yellowFever); XmlAttach.AttachTo(m_Player, azhuranStam); XmlAttach.AttachTo(m_Player, azhuranStr); DiseaseMessage(dis); return true; } case Disease.Bile: { List<StatMod> removeMod = new List<StatMod>(); foreach (StatMod mod in m_Player.StatMods) { if (mod.Name.Contains("[Bile]")) removeMod.Add(mod); } for (int i = 0; i < removeMod.Count; i++) if (m_Player.StatMods.Contains(removeMod[i])) m_Player.StatMods.Remove(removeMod[i]); m_Player.Emote("*doubles over in pain, losing control of " + (m_Player.Female ? "her" : "his") + " bodily functions*"); m_Player.Hunger -= 20; if (m_Player.Hunger < 0) m_Player.Hunger = 0; m_Player.Thirst -= 20; if (m_Player.Thirst < 0) m_Player.Thirst = 0; XmlHits dysentery = new XmlHits(-20, 3600); dysentery.Name = " [Disease] [Bile] "; XmlAttach.AttachTo(m_Player, dysentery); if (!m_Player.Mounted) m_Player.Animate(32, 5, 1, true, false, 0); Point3D p = new Point3D(m_Player.Location); switch (m_Player.Direction) { case Direction.North: p.Y--; break; case Direction.South: p.Y++; break; case Direction.East: p.X++; break; case Direction.West: p.X--; break; case Direction.Right: p.X++; p.Y--; break; case Direction.Down: p.X++; p.Y++; break; case Direction.Left: p.X--; p.Y++; break; case Direction.Up: p.X--; p.Y--; break; default: break; } p.Z = m_Player.Map.GetAverageZ(p.X, p.Y); bool canFit = Server.Spells.SpellHelper.AdjustField(ref p, m_Player.Map, 12, false); if (canFit) { Puke puke = new Puke(); puke.Name = "vomit"; puke.Hue = 2964; puke.Map = m_Player.Map; puke.Location = p; if (m_Player.Female) m_Player.PlaySound(0x32D); else m_Player.PlaySound(0x43F); } if (m_Player.Female) m_Player.PlaySound(0x318); else m_Player.PlaySound(0x428); DiseaseMessage(dis); return true; } case Disease.Leprosy: { XmlAosAttribute leprosy = new XmlAosAttribute(AosAttribute.RegenHits, -25, 15); leprosy.Name = " [Disease] [Leprosy] "; XmlAttach.AttachTo(m_Player, leprosy); Disfigurement++; DiseaseMessage(dis); return true; } case Disease.TyreanDisease: { List<StatMod> removeMod = new List<StatMod>(); foreach (StatMod mod in m_Player.StatMods) { if (mod.Name.Contains("[TyreanDisease]")) removeMod.Add(mod); } for (int i = 0; i < removeMod.Count; i++) if (m_Player.StatMods.Contains(removeMod[i])) m_Player.StatMods.Remove(removeMod[i]); XmlAosAttribute tyrean = new XmlAosAttribute(AosAttribute.RegenHits, -50, 15); tyrean.Name = " [Disease] [TyreanDisease] "; XmlAttach.AttachTo(m_Player, tyrean); int amount = (m_Player.Int / 2) * -1; XmlInt madness = new XmlInt(amount, 600); madness.Name = " [Disease] [TyreanDisease] "; XmlAttach.AttachTo(m_Player, madness); Disfigurement++; DiseaseMessage(dis); return true; } } return false; }