コード例 #1
0
        protected override void OnTick()
        {
            if (m_Addict == null || m_Addict.Deleted)
            {
                Stop();
                return;
            }

            if (!m_Addict.Alive)
                return;

            if (m_Addict.Map == Map.Internal)
                return;

            if (m_Addict is PlayerMobile && (m_Addict as PlayerMobile).Reforging)
                return;

            if (m_RecoveryCount >= HungerMax)
            {
                m_Addict.SendMessage(2006, "You have successfully recovered from your addiction to " + m_Crave.ToLower() + ".");

                XmlAddiction addAtt = XmlAttach.FindAttachment(m_Addict, typeof(XmlAddiction)) as XmlAddiction;
                if (addAtt != null)
                {
                    if (addAtt.Addictions.Contains(this))
                        addAtt.Addictions.Remove(this);
                }

                Stop();
                return;
            }

            if (Hunger < HungerMax / 2)
            {
                int statLoss = HungerMax - m_Addict.ManaMax - m_Addict.StamMax;
                if (statLoss < 5)
                    statLoss = 5;

                if (Hunger <= 0)
                {
                    XmlHits withdrawal1 = new XmlHits(0 - statLoss, HungerMax * 10); withdrawal1.Name = "Severe Withdrawal";
                    XmlAttach.AttachTo(m_Addict, withdrawal1);
                    XmlHue withdrawal2 = new XmlHue(2419, HungerMax * 10); withdrawal2.Name = "Severe Withdrawal";
                    XmlAttach.AttachTo(m_Addict, withdrawal2);

                    m_Addict.SendMessage(37, "You grow weak and pale with your desire for " + m_Crave.ToLower() + ".");
                    m_RecoveryCount++;
                }

                if (m_Crave == "Tobacco")
                {
                    XmlDex withdrawal = new XmlDex(0 - statLoss, HungerMax * 1); withdrawal.Name = "Tobacco Withdrawal";
                    XmlAttach.AttachTo(m_Addict, withdrawal);

                    m_Addict.SendMessage(37, "You've developed the shakes!");
                }
                else if (m_Crave == "Swampweed")
                {
                    XmlInt withdrawal = new XmlInt(0 - statLoss, HungerMax * 10); withdrawal.Name = "Swampweed Withdrawal";
                    XmlAttach.AttachTo(m_Addict, withdrawal);

                    m_Addict.SendMessage(37, "You have a splitting migraine!");
                }
                else if (m_Crave == "Qat")
                {
                    XmlStam withdrawal = new XmlStam(0 - statLoss, HungerMax * 10); withdrawal.Name = "Qat Withdrawal";
                    XmlAttach.AttachTo(m_Addict, withdrawal);

                    m_Addict.SendMessage(37, "You feel lethargic.");
                }
                else if (m_Crave == "Banestone")
                {
                    XmlMana withdrawal1 = new XmlMana(0 - statLoss, HungerMax * 10); withdrawal1.Name = "Banestone Withdrawal";
                    XmlAttach.AttachTo(m_Addict, withdrawal1);
                    XmlInt withdrawal2 = new XmlInt(0 - statLoss, HungerMax * 10); withdrawal2.Name = "Banestone Withdrawal";
                    XmlAttach.AttachTo(m_Addict, withdrawal2);

                    if (Utility.RandomBool())
                    {
                        new TripFoe.TripFoeTimer(m_Addict, 3);
                        m_Addict.Emote("*collapses, thrashing violently!*");
                    }
                    else
                    {
                        int damage = (HungerMax - Hunger);
                        if(damage < 1)
                            damage = 1;
                        if(m_Addict.HitsMax / 10 < 1)
                            damage = 1;
                        else
                            damage = damage / (m_Addict.HitsMax / 10);

                        m_Addict.PlaySound(0x133);
                        m_Addict.Damage(damage, m_Addict);
                        Blood blood = new Blood();
                        blood.ItemID = Utility.Random(0x122A, 5);
                        blood.MoveToWorld(m_Addict.Location, m_Addict.Map);
                        m_Addict.Emote("*blood flows from " + (m_Addict.Female ? "her" : "his") + " nose as " + (m_Addict.Female ? "her" : "his") +
                            " eyes roll to the back of " + (m_Addict.Female ? "her" : "his") + " head!*");
                    }

                    m_Addict.SendMessage(1609, "You are wracked with seizures!");
                }
                else if (m_Crave == "Opium")
                {
                    XmlDex withdrawal = new XmlDex(0 - statLoss, HungerMax * 10); withdrawal.Name = "Opium Withdrawal";
                    XmlAttach.AttachTo(m_Addict, withdrawal);
                    m_Addict.Hunger--;

                    m_Addict.SendMessage(37, "You feel a gnawing hunger.");
                }
            }

            Hunger--;
            if (Hunger < 0)
                Hunger = 0;

            base.OnTick();
        }
コード例 #2
0
			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;
			}
コード例 #3
0
        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;
        }