Exemple #1
0
        public static void DrinkBottle(Bottle bottle, Character ch)
        {
            if (bottle.m_open)
            {
                if (!bottle.special.Contains("empty "))
                {
                    if (bottle.itemID == Item.ID_BALM && ch.Land.LandID == GameWorld.Land.ID_ADVANCEDGAME)
                    {
                        Bottle.ConvertBalmToAGBalm(bottle);
                    }

                    string[] effectList   = bottle.effectType.Split(" ".ToCharArray());
                    string[] amountList   = bottle.effectAmount.Split(" ".ToCharArray());
                    string[] durationList = bottle.effectDuration.Split(" ".ToCharArray());

                    for (int a = 0; a < effectList.Length; a++)
                    {
                        Effect.CreateCharacterEffect((Effect.EffectTypes)Convert.ToInt32(effectList[a]), Convert.ToInt32(amountList[a]),
                                                     ch, Convert.ToInt32(durationList[a]), ch);
                    }

                    if (bottle.drinkDesc != "")
                    {
                        ch.WriteToDisplay(bottle.drinkDesc);
                    }

                    bottle.special   = "empty " + bottle.special;
                    bottle.coinValue = 0;
                    ch.EmitSound(Sound.GetCommonSound(Sound.CommonSound.DrinkBottle));

                    //TODO: make this spam optional
                    ch.SendToAllInSight(ch.GetNameForActionResult() + " drinks from " + bottle.longDesc + ".");
                }
                else
                {
                    ch.WriteToDisplay("The bottle is empty.");
                }
            }
            else
            {
                ch.WriteToDisplay("You must first open the bottle.");
            }
        }
Exemple #2
0
        public static string GetFluidDesc(Bottle bottle)
        {
            if (bottle.special.Contains("empty "))
            {
                return(" The " + bottle.name + " is empty.");
            }

            if (bottle.fluidDesc != "")
            {
                if (!Bottle.HasCork(bottle))
                {
                    return(" Inside the " + bottle.name + " is " + bottle.fluidDesc);
                }
                else if (bottle.m_open)
                {
                    return(" Inside the " + bottle.name + " is " + bottle.fluidDesc + " The " + bottle.name + " is open.");
                }
                else
                {
                    return(" The " + bottle.name + " is closed.");
                }
            }
            return("");
        }
Exemple #3
0
        public string GetLookDescription(Character looker)
        {
            if (itemType == Globals.eItemType.Coin)
            {
                return("" + (int)coinValue + " coins.");
            }

            string description = longDesc + ".";

            if (baseType == Globals.eItemBaseType.Bottle)
            {
                description += Bottle.GetFluidDesc((Bottle)this);
            }

            if (blueglow)
            {
                description += " " + (wearLocation == Globals.eWearLocation.Feet || wearLocation == Globals.eWearLocation.Hands ? "They are" : "It is") + " emitting a faint blue glow.";
            }

            if (looker.BaseProfession == Character.ClassType.Thief) // add thief appraisal to description
            {
                #region thief gem and jewelry appraising
                switch (baseType)
                {
                case Globals.eItemBaseType.Amulet:
                case Globals.eItemBaseType.Ring:
                case Globals.eItemBaseType.Gem:
                case Globals.eItemBaseType.Bracelet:
                    //case BaseType.Figurine:
                    if (coinValue == 0)
                    {
                        description += " The " + name + " has no monetary value.";
                    }
                    else if (coinValue == 1)
                    {
                        description += " The " + name + " is worth " + coinValue + " coin.";
                    }
                    else
                    {
                        description += " The " + name + " is worth about " + Math.Round(coinValue, coinValue.ToString().Length - 1, MidpointRounding.AwayFromZero) + " coins.";
                    }
                    break;

                default:
                    break;
                }
                #endregion
            }
            else if (looker.BaseProfession == Character.ClassType.Fighter) // add fighter appraisal to description
            {
                #region fighter armor and weapon appraising
                int actualLevel = Rules.GetExpLevel(looker.Experience);

                switch (baseType)
                {
                case Globals.eItemBaseType.Armor:
                case Globals.eItemBaseType.Helm:
                case Globals.eItemBaseType.Boots:
                    if (actualLevel >= 10)
                    {
                        if (this.coinValue == 0)
                        {
                            description += " The " + name + " has no monetary value.";
                        }
                        else if (this.coinValue == 1)
                        {
                            description += " The " + name + " is worth " + coinValue + " coin.";
                        }
                        else
                        {
                            description += " The " + name + " is worth about " + Math.Round(coinValue, coinValue.ToString().Length - 1, MidpointRounding.AwayFromZero) + " coins.";
                        }
                    }
                    break;

                case Globals.eItemBaseType.Bow:
                case Globals.eItemBaseType.Shield:
                case Globals.eItemBaseType.Mace:
                    if (actualLevel >= 11)
                    {
                        if (coinValue == 0)
                        {
                            description += " The " + name + " has no monetary value.";
                        }
                        else if (coinValue == 1)
                        {
                            description += " The " + name + " is worth " + coinValue + " coin.";
                        }
                        else
                        {
                            description += " The " + name + " is worth about " + Math.Round(coinValue, coinValue.ToString().Length - 1, MidpointRounding.AwayFromZero) + " coins.";
                        }
                    }
                    break;

                case Globals.eItemBaseType.Dagger:
                case Globals.eItemBaseType.Flail:
                case Globals.eItemBaseType.Sword:
                    if (actualLevel >= 12)
                    {
                        if (coinValue == 0)
                        {
                            description += " The " + name + " has no monetary value.";
                        }
                        else if (this.coinValue == 1)
                        {
                            description += " The " + name + " is worth " + coinValue + " coin.";
                        }
                        else
                        {
                            description += " The " + name + " is worth about " + Math.Round(coinValue, coinValue.ToString().Length - 1, MidpointRounding.AwayFromZero) + " coins.";
                        }
                    }
                    break;

                case Globals.eItemBaseType.Halberd:
                case Globals.eItemBaseType.Rapier:
                    if (actualLevel >= 13)
                    {
                        if (coinValue == 0)
                        {
                            description += " The " + name + " has no monetary value.";
                        }
                        else if (this.coinValue == 1)
                        {
                            description += " The " + name + " is worth " + coinValue + " coin.";
                        }
                        else
                        {
                            description += " The " + name + " is worth about " + Math.Round(coinValue, coinValue.ToString().Length - 1, MidpointRounding.AwayFromZero) + " coins.";
                        }
                    }
                    break;

                default:
                    break;
                }
                #endregion
            }
            else if (looker.BaseProfession == Character.ClassType.Sorcerer)
            {
                // sorcerers can tell if a corpse looks fresh (will be a zombie vice skeleton if Animate Dead is cast)
                if (itemType == Globals.eItemType.Corpse && World.NPCCorpseDecayTimer - (DragonsSpineMain.GameRound - dropRound) >= (World.NPCCorpseDecayTimer / 2))
                {
                    description += " The " + name + " looks fresh.";
                }
            }
            // add skill level if held weapon
            if ((this == looker.RightHand || this == looker.LeftHand) && itemType == Globals.eItemType.Weapon)
            {
                description += " You are " + Skills.GetSkillTitle(skillType, looker.BaseProfession, looker.GetSkillExperience(skillType), looker.gender) + " with this weapon.";
            }

            if (attunedID == looker.UniqueID)
            {
                description += " You are soulbound to this item.";
            }

            if (this is SoulGem && (looker.BaseProfession == Character.ClassType.Sorcerer || looker.IsImmortal))
            {
                description += " The " + name + " contains the soul of " + (this as SoulGem).Soul.Name + ".";
            }

            if (looker.fighterSpecialization == skillType && skillType != Globals.eSkillType.None)
            {
                description += " You are specialized in the use of this weapon.";
            }

            //if (looker.RightHand == this || looker.LeftHand == this)
            //{
            //    double perceivedWeight = this.weight;

            //    if (!Rules.CheckPerception(looker))
            //        perceivedWeight = Math.Round(perceivedWeight + Rules.Dice.NextDouble());

            //    if (looker.BaseProfession == Character.ClassType.Thief)
            //    {
            //        description += " The " + this.name + " feels like it weighs " + perceivedWeight + " m'na.";
            //    }
            //    else if(perceivedWeight <= 0)
            //    {
            //        description += " The " + this.name + " feels like it weighs less than 1 m'na.";
            //    }
            //    else  description += " The " + this.name + " feels like it weighs about " + perceivedWeight + " m'na.";
            //}

            if (IsNocked)
            {
                description += " The " + name + " is nocked.";
            }

            if (venom > 0)
            {
                description += " The " + name + " drips with a caustic venom.";
            }

            return(description);
        }