Beispiel #1
1
 public void AddBuf(Buf.BufType buf)
 {
     if (buf == Buf.BufType.Speed) {
         speedBufTimer = Time.time + 10;
     }
     if (buf == Buf.BufType.Rotate) {
         rotateBufTimer = Time.time + 10;
     }
     if (buf == Buf.BufType.Triple) {
         tripleshotTimer = Time.time + 10;
     }
     if (buf == Buf.BufType.Double) {
         doubleshotTimer = Time.time + 10;
     }
     if (buf == Buf.BufType.Health) {
         health = health + 20;
         if (health >= 100)
         {
             health = 100;
         }
     }
     if (buf == Buf.BufType.Energy) {
         energy = energy + 50;
         if (energy >= 100)
         {
             energy = 100;
         }
     }
     if (buf == Buf.BufType.QuadDamage) {
         quadDamageTimer = Time.time + 10;
     }
     if (buf == Buf.BufType.Bounce) {
         bounceTimer = Time.time + 10;
     }
 }
Beispiel #2
1
	public byte[] StringToByteData(string str)
	{
		int i, len;

		len = str.Length;
		Buf b = new Buf();

		for (i = 0; i < len; i++)
		{
			char c = str[i];
			if (c == '\\')
			{
				string tmp = "";

				//try
				{
					tmp = "" + str[i + 1] + str[i + 2];
				}
				/*catch (Exception ex)
				{
					tmp += "|err=" + ex.Message + ",len=" + len + ",i=" + i + "|src=" + str + "|";
					byte[] aa = Str.Utf8Encoding.GetBytes(tmp);
					b.Write(aa);
				}*/

				i += 2;

				//try
				{
					b.WriteByte(byte.Parse(tmp, System.Globalization.NumberStyles.HexNumber));
				}
				//catch
				{
				}
			}
			else
			{
				b.WriteByte((byte)c);
			}
		}

		return b.ByteData;
	}
Beispiel #3
0
 public override Long readBuf(Buf buf, long n)
 {
     int nval = (int)n;
       for (int i=0; i<nval; ++i)
       {
     int c = rChar();
     if (c < 0) return Long.valueOf(i);
     buf.m_out.w(c);
       }
       return Long.valueOf(n);
 }
 public void Advance(int count) => Buf.Advance(count);
Beispiel #5
0
        public override void Execute()
        {
            RetCode rc;

            var buf01 = new StringBuilder(Constants.BufSize);

            var recUids = new long[2];

            gOut.WriteLine();

            gEngine.PrintTitle(Title, true);

            var maxRecUid = RecordTable.GetRecordUid(false);

            gOut.Write("{0}{1}", Environment.NewLine, gEngine.BuildPrompt(43, '\0', 0, string.Format("Enter the starting {0} Uid", RecordTypeName), "1"));

            Buf.Clear();

            rc = Globals.In.ReadField(Buf, Constants.BufSize01, null, '_', '\0', true, "1", null, gEngine.IsCharDigit, null);

            Debug.Assert(gEngine.IsSuccess(rc));

            recUids[0] = Convert.ToInt64(Buf.Trim().ToString());

            gOut.Print("{0}", Globals.LineSep);

            gOut.Write("{0}{1}", Environment.NewLine, gEngine.BuildPrompt(43, '\0', 0, string.Format("Enter the ending {0} Uid", RecordTypeName), maxRecUid > 0 ? maxRecUid.ToString() : "1"));

            Buf.Clear();

            rc = Globals.In.ReadField(Buf, Constants.BufSize01, null, '_', '\0', true, maxRecUid > 0 ? maxRecUid.ToString() : "1", null, gEngine.IsCharDigit, null);

            Debug.Assert(gEngine.IsSuccess(rc));

            recUids[1] = Convert.ToInt64(Buf.Trim().ToString());

            var helper = Globals.CreateInstance <U>();

            var records = RecordTable.Records.Where(x => x.Uid >= recUids[0] && x.Uid <= recUids[1]);

            foreach (var record in records)
            {
                helper.Record = record;

                gOut.Print("{0}", Globals.LineSep);

                helper.ListRecord(true, Globals.Config.ShowDesc, Globals.Config.ResolveEffects, true, false, false);

                PrintPostListLineSep();

                gOut.Write("{0}Press any key to continue or X to exit: ", Environment.NewLine);

                Buf.Clear();

                rc = Globals.In.ReadField(Buf, Constants.BufSize02, null, ' ', '\0', true, null, gEngine.ModifyCharToNullOrX, null, gEngine.IsCharAny);

                Debug.Assert(gEngine.IsSuccess(rc));

                if (Buf.Length > 0 && Buf[0] == 'X')
                {
                    break;
                }
            }

            gOut.Print("{0}", Globals.LineSep);

            gOut.Print("Done listing {0} record details.", RecordTypeName);
        }
Beispiel #6
0
        public override void Execute()
        {
            IArtifact artifact;
            RetCode   rc;

            var artUids = new long[2];

            gOut.WriteLine();

            gEngine.PrintTitle("GENERATE DUMMY ARTIFACT RECORDS", true);

            gOut.Write("{0}{1}", Environment.NewLine, gEngine.BuildPrompt(43, '\0', 0, "Enter the number to generate", "0"));

            Buf.Clear();

            rc = Globals.In.ReadField(Buf, Constants.BufSize01, null, '_', '\0', true, "0", null, gEngine.IsCharDigit, null);

            Debug.Assert(gEngine.IsSuccess(rc));

            var j = Convert.ToInt64(Buf.Trim().ToString());

            for (var i = 0; i < j; i++)
            {
                artifact = Globals.CreateInstance <IArtifact>(x =>
                {
                    x.Uid      = Globals.Database.GetArtifactUid();
                    x.Name     = string.Format("artifact {0}", x.Uid);
                    x.Desc     = string.Format("You see artifact {0}.", x.Uid);
                    x.IsListed = true;
                    x.GetCategories(0).Type = ArtifactType.Treasure;
                    x.SetArtifactCategoryCount(1);
                });

                if (i == 0)
                {
                    artUids[0] = artifact.Uid;
                }

                if (i == j - 1)
                {
                    artUids[1] = artifact.Uid;
                }

                rc = Globals.Database.AddArtifact(artifact);

                Debug.Assert(gEngine.IsSuccess(rc));

                Globals.ArtifactsModified = true;

                if (Globals.Module != null)
                {
                    Globals.Module.NumArtifacts++;

                    Globals.ModulesModified = true;
                }
            }

            if (j > 0)
            {
                gOut.Print("{0}", Globals.LineSep);

                Buf.SetFormat(j > 1 ? "Generated dummy Artifacts with Uids between {0} and {1}, inclusive." : "Generated a dummy Artifact with Uid {0}.", artUids[0], artUids[1]);

                gOut.Print("{0}", Buf);
            }
        }
Beispiel #7
0
        /// <summary></summary>
        /// <param name="character"></param>
        public virtual void CreateCharacter(ICharacter character)
        {
            RetCode rc;

            Debug.Assert(character != null);

            gOut.Print("{0}", Globals.LineSep);

            gOut.Print("He hits his forehead and says, \"Ah, ye must be new here!  Well, wait just a minute and I'll bring someone out to take care of ye.\"");

            gOut.Print("The Irishman says, \"First I must know whether ye be male or female.  Which are ye?\"");

            gOut.Print("{0}", Globals.LineSep);

            gOut.Write("{0}You give him your gender ({1}=Male, {2}=Female): ",
                       Environment.NewLine,
                       (long)Gender.Male,
                       (long)Gender.Female);

            Buf.Clear();

            rc = Globals.In.ReadField(Buf, Constants.BufSize02, null, ' ', '\0', false, null, null, gEngine.IsChar0Or1, gEngine.IsChar0Or1);

            Debug.Assert(gEngine.IsSuccess(rc));

            character.Gender = (Gender)Convert.ToInt64(Buf.Trim().ToString());

            var helper = Globals.CreateInstance <ICharacterHelper>(x =>
            {
                x.Record = character;
            });

            Debug.Assert(helper.ValidateField("Gender"));

            Globals.Thread.Sleep(150);

            gOut.Print("{0}", Globals.LineSep);

            character.Uid = Globals.Database.GetCharacterUid();

            character.IsUidRecycled = true;

            character.Status = Status.Alive;

            var weaponValues = EnumUtil.GetValues <Weapon>();

            for (var i = 0; i < weaponValues.Count; i++)
            {
                var wv = weaponValues[i];

                var weapon = gEngine.GetWeapons(wv);

                Debug.Assert(weapon != null);

                character.SetWeaponAbilities(wv, Convert.ToInt64(weapon.EmptyVal));
            }

            character.HeldGold = 200;

            gOut.Write("{0}The Irishman walks away and in walks a tall man of possibly Elvish descent.{0}{0}He studies you for a moment and says, \"Here is a booklet of instructions for you to read, and your prime attributes are--{0}", Environment.NewLine);

            var statValues = EnumUtil.GetValues <Stat>();

            while (true)
            {
                for (var i = 0; i < statValues.Count; i++)
                {
                    var sv = statValues[i];

                    var stat = gEngine.GetStats(sv);

                    Debug.Assert(stat != null);

                    character.Stats[(long)sv] = gEngine.RollDice(3, 8, 0);

                    gOut.Write("{0}{1,27}{2}{3}",
                               Environment.NewLine,
                               string.Format("{0}: ", stat.Name),
                               character.GetStats(sv),
                               i == statValues.Count - 1 ? string.Format("\"{0}", Environment.NewLine) : "");
                }

                if (character.GetStats(Stat.Intellect) + character.GetStats(Stat.Hardiness) + character.GetStats(Stat.Agility) < 39 || character.Stats.Sum() < 52)
                {
                    gOut.Print("\"You are such a poor excuse for an adventurer that we will allow you to commit suicide.\"");

                    gOut.Print("{0}", Globals.LineSep);

                    gOut.Write("{0}Press Y to commit suicide or N to continue: ", Environment.NewLine);

                    Buf.Clear();

                    rc = Globals.In.ReadField(Buf, Constants.BufSize02, null, ' ', '\0', false, null, gEngine.ModifyCharToUpper, gEngine.IsCharYOrN, gEngine.IsCharYOrN);

                    Debug.Assert(gEngine.IsSuccess(rc));

                    Globals.Thread.Sleep(150);

                    if (Buf.Length > 0 && Buf[0] == 'Y')
                    {
                        gOut.Print("{0}", Globals.LineSep);

                        gOut.Print("\"We resurrect you again and your prime attributes are--");
                    }
                    else
                    {
                        break;
                    }
                }
                else
                {
                    break;
                }
            }

            rc = Globals.Database.AddCharacter(character);

            Debug.Assert(gEngine.IsSuccess(rc));

            Globals.CharactersModified = true;

            gOut.Print("{0}", Globals.LineSep);

            gOut.Write("{0}Press R to read instructions or T to give them back: ", Environment.NewLine);

            Buf.Clear();

            rc = Globals.In.ReadField(Buf, Constants.BufSize02, null, ' ', '\0', false, null, gEngine.ModifyCharToUpper, gEngine.IsCharROrT, gEngine.IsCharROrT);

            Debug.Assert(gEngine.IsSuccess(rc));

            Globals.Thread.Sleep(150);

            gOut.Print("{0}", Globals.LineSep);

            if (Buf.Length > 0 && Buf[0] == 'R')
            {
                gOut.WriteLine("{0}You read the instructions and they say--{0}", Environment.NewLine);

                gEngine.PrintTitle("INFORMATION ABOUT THE WORLD OF EAMON", false);

                gOut.Write("{0}You will have to buy a weapon.  Your chance to hit with it will be determined by the weapon complexity, your ability in that weapon class, how heavy your armor is, and the difference in agility between you and your enemy.{0}{0}The five classes of weapons (and your current abilities with each) are--{0}", Environment.NewLine);

                gOut.Write("{0}{1,28}", Environment.NewLine, "Club/Mace......20%");

                gOut.Write("{0}{1,28}", Environment.NewLine, "Spear..........10%");

                gOut.Write("{0}{1,28}", Environment.NewLine, "Axe.............5%");

                gOut.Write("{0}{1,28}", Environment.NewLine, "Sword...........0%");

                gOut.Print("{0,28}", "Bow...........-10%");

                gOut.Print("Every time you score a hit in battle, your ability in the weapon class may go up by 2%, if a random number from 1-100 is less than your chance to miss!");

                Globals.In.KeyPress(Buf);

                gOut.Print("{0}", Globals.LineSep);

                gOut.Print("There are four armor types and you may also carry a shield if you do not use a two-handed weapon.  These protections will absorb hits placed upon you (almost always!) but they lower your chance to hit.  The protections are--");

                gOut.Write("{0}{1,61}", Environment.NewLine, "Armor          Hits Absorbed        Odds Adjustment");

                gOut.Write("{0}{1,61}", Environment.NewLine, "---------------------------------------------------");

                gOut.Write("{0}{1,56}", Environment.NewLine, "None .................0 ....................0%");

                gOut.Write("{0}{1,56}", Environment.NewLine, "Leather ..............1 ..................-10%");

                gOut.Write("{0}{1,56}", Environment.NewLine, "Chain ................2 ..................-20%");

                gOut.Write("{0}{1,56}", Environment.NewLine, "Plate ................5 ..................-60%");

                gOut.Print("{0,56}", "Shield ...............1 ...................-5%");

                gOut.Print("You will develop an Armor Expertise, which will go up when you hit a blow wearing armor and your expertise is less than the armor you are wearing.  No matter how high your Armor Expertise is, however, the net effect of armor will never increase your chance to hit.");

                Globals.In.KeyPress(Buf);

                gOut.Print("{0}", Globals.LineSep);

                gOut.Write("{0}You can carry weight up to ten times your hardiness, or, {1} Gronds.  (A measure of weight, one Grond = 10 Dos.){0}{0}Additionally, your hardiness tells how many points of damage you can survive.  Therefore, you can be hit with {2} 1-point blows before you die.{0}{0}You will not be told how many blows you have taken.  You will be merely told such things as--{0}{0}   \"Wow!  That one hurt!\"{0}or \"You don't feel very well.\"{0}{0}Your charisma ({3}) affects how the citizens of Eamon react to you.  You affect a monster's friendliness rating by your charisma less ten, difference times two ({4}%).{0}{0}You start off with 200 gold pieces, which you will want to spend on supplies for your first adventure.  You will get a lower price for items if your charisma is high.{0}",
                           Environment.NewLine,
                           character.GetWeightCarryableGronds(),
                           character.GetStats(Stat.Hardiness),
                           character.GetStats(Stat.Charisma),
                           character.GetCharmMonsterPct());

                Globals.In.KeyPress(Buf);

                gOut.Print("{0}", Globals.LineSep);

                gOut.Write("{0}After you begin to accumulate wealth, you may want to put some of your money into the bank, where it cannot be stolen.  However it is a good idea to always carry some gold with you for use in bargaining and ransom situations.{0}{0}You should also hire a Wizard to teach you some magic spells.  Your intellect ({1}) affects your ability to learn both skills and spells.  There are four spells you can learn--{0}{0}Blast: Throw a magical blast at your enemies to inflict damage.{0}Heal : Remove damage from your body.{0}Speed: Double your agility for a short time.{0}Power: This unpredictable spell is different in each adventure.{0}{0}Other types of spells may be available in various adventures, and items may have special properties.  However, these will only work in the adventure where they were found.  Thus it is best (and you have no choice but to) sell all items found in adventures except for weapons and armor.{0}",
                           Environment.NewLine,
                           character.GetStats(Stat.Intellect));

                Globals.In.KeyPress(Buf);

                gOut.Print("{0}", Globals.LineSep);
            }

            gOut.Write("{0}The man behind the desk takes back the instructions and says, \"It is now time for you to start your life.\"  He makes an odd sign with his hand and says, \"Live long and prosper.\"{0}{0}You now wander into the Main Hall...{0}", Environment.NewLine);

            Globals.In.KeyPress(Buf);

            Globals.Character = character;
        }
Beispiel #8
0
        public virtual void Write(string format, params object[] arg)
        {
            Debug.Assert(format != null);

            Buf.SetFormat(format, arg);

            if (ResolveUidMacros && Globals?.Engine != null)
            {
                Buf01.Clear();

                var rc = Globals.Engine.ResolveUidMacros(Buf.ToString(), Buf01, true, true);

                Debug.Assert(Globals.Engine.IsSuccess(rc));

                Buf.SetFormat("{0}", Buf01);
            }

            if (PunctSpaceCode != PunctSpaceCode.None)
            {
                Buf.SetFormat("{0}", PunctSpaceCode == PunctSpaceCode.Single ? SingleSpaceRegex.Replace(Buf.ToString(), @"$1 $3") : DoubleSpaceRegex.Replace(Buf.ToString(), @"$1  $3"));
            }

            if (WordWrap && Globals?.Engine != null)
            {
                Globals.Engine.WordWrap(Buf.ToString(), Buf);
            }

            if (SuppressNewLines)
            {
                while (Buf.IndexOf(ThreeNewLines) >= 0)
                {
                    Buf.Replace(ThreeNewLines, TwoNewLines);
                }

                NumNewLines += (Buf.StartsWith(TwoNewLines) ? 2 : Buf.StartsWith(Environment.NewLine) ? 1 : 0);

                while (NumNewLines > 2 && Buf.StartsWith(Environment.NewLine))
                {
                    Buf.Remove(0, Environment.NewLine.Length);

                    NumNewLines--;
                }

                var s = Buf.ToString();

                if (Buf.Length > 0 && !s.Equals(Environment.NewLine) && !s.Equals(TwoNewLines))
                {
                    NumNewLines = Buf.EndsWith(TwoNewLines) ? 2 : Buf.EndsWith(Environment.NewLine) ? 1 : 0;
                }
            }

            if (EnableOutput)
            {
                try
                {
                    App.OutputBufMutex.WaitOne();

                    EnforceOutputBufMaxSize();

                    if (Stdout)
                    {
                        App.OutputBuf.Append(Buf);
                    }
                    else
                    {
                        App.OutputBuf.Append(Buf);
                    }

                    RefreshOutputText();
                }
                catch (Exception ex)
                {
                    // do something
                }
                finally
                {
                    App.OutputBufMutex.ReleaseMutex();
                }
            }
        }
Beispiel #9
0
        /// <summary></summary>
        protected virtual void SelectAdvDbTextFiles()
        {
            RetCode rc;

            SelectedAdvDbTextFiles = new List <string>();

            var advDbTextFiles = new string[] { "ADVENTURES.XML", "FANTASY.XML", "SCIFI.XML", "CONTEMPORARY.XML", "TEST.XML", "WIP.XML" };

            if (SupportMenuType == SupportMenuType.AddAdventure)
            {
                var inputDefaultValue = "Y";

                foreach (var advDbTextFile in advDbTextFiles)
                {
                    gOut.Print("{0}", Globals.LineSep);

                    gOut.Write("{0}Add this game to adventure database \"{1}\" (Y/N) [{2}]: ", Environment.NewLine, advDbTextFile, inputDefaultValue);

                    Buf.Clear();

                    rc = Globals.In.ReadField(Buf, Constants.BufSize02, null, ' ', '\0', true, inputDefaultValue, gEngine.ModifyCharToUpper, gEngine.IsCharYOrN, null);

                    Debug.Assert(gEngine.IsSuccess(rc));

                    if (Buf.Length == 0 || Buf[0] != 'N')
                    {
                        SelectedAdvDbTextFiles.Add(advDbTextFile);

                        if (!string.Equals(advDbTextFile, "ADVENTURES.XML"))
                        {
                            inputDefaultValue = "N";
                        }
                    }
                }
            }
            else
            {
                SelectedAdvDbTextFiles.AddRange(advDbTextFiles);
            }

            var customAdvDbTextFile = string.Empty;

            while (true)
            {
                gOut.Print("{0}", Globals.LineSep);

                if (customAdvDbTextFile.Length == 0)
                {
                    gOut.Print("If you would like to {0} one or more custom adventure databases, enter those file names now (eg, HORROR.XML).  To skip this step, or if you are done, just press enter.", SupportMenuType == SupportMenuType.AddAdventure ? "add this adventure to" : "delete this adventure from");
                }

                gOut.Write("{0}Enter name of custom adventure database: ", Environment.NewLine);

                Buf.Clear();

                rc = Globals.In.ReadField(Buf, Constants.FsFileNameLen, null, '_', '\0', true, null, gEngine.ModifyCharToUpper, gEngine.IsCharAlnumPeriodUnderscore, null);

                Debug.Assert(gEngine.IsSuccess(rc));

                customAdvDbTextFile = Buf.Trim().ToString();

                if (customAdvDbTextFile.Length > 0)
                {
                    if (SelectedAdvDbTextFiles.FirstOrDefault(fn => string.Equals(fn, customAdvDbTextFile, StringComparison.OrdinalIgnoreCase)) == null)
                    {
                        SelectedAdvDbTextFiles.Add(customAdvDbTextFile);
                    }
                }
                else
                {
                    break;
                }
            }
        }
Beispiel #10
0
        /// <summary></summary>
        protected virtual void ListIntroStory()
        {
            if (FullDetail)
            {
                var listNum = NumberFields ? ListNum++ : 0;

                if (LookupMsg && Record.IntroStory > 0)
                {
                    Buf.Clear();

                    var effect = gEDB[Record.IntroStory];

                    if (effect != null)
                    {
                        Buf.Append(effect.Desc);

                        if (Buf.Length > 40)
                        {
                            Buf.Length = 40;
                        }

                        if (Buf.Length == 40)
                        {
                            Buf[39] = '.';

                            Buf[38] = '.';

                            Buf[37] = '.';
                        }
                    }

                    gOut.Write("{0}{1}{2}",
                               Environment.NewLine,
                               gEngine.BuildPrompt(27, '.', listNum, GetPrintedName("IntroStory"), null),
                               gEngine.BuildValue(51, ' ', 8, Record.IntroStory, null, effect != null ? Buf.ToString() : gEngine.UnknownName));
                }
                else
                {
                    gOut.Write("{0}{1}{2}", Environment.NewLine, gEngine.BuildPrompt(27, '.', listNum, GetPrintedName("IntroStory"), null), Record.IntroStory);
                }
            }
        }
 public virtual int ReadBytes(Span <byte> destination) => Buf.ReadBytes(destination);
 public virtual int GetBytes(int index, Memory <byte> destination) => Buf.GetBytes(index, destination);
 public virtual Span <byte> GetSpan(int index, int count) => Buf.GetSpan(index, count);
 public virtual Span <byte> GetSpan(int sizeHintt = 0) => Buf.GetSpan(sizeHintt);
 public virtual Memory <byte> GetMemory(int index, int count) => Buf.GetMemory(index, count);
 public virtual Memory <byte> GetMemory(int sizeHintt = 0) => Buf.GetMemory(sizeHintt);
Beispiel #17
0
        /// <summary></summary>
        protected virtual void SelectClassFilesToAdd()
        {
            var invalidClassFileNames = new string[] { "Program.cs", "Engine.cs", "IPluginClassMappings.cs", "IPluginConstants.cs", "IPluginGlobals.cs", "PluginClassMappings.cs", "PluginConstants.cs", "PluginContext.cs", "PluginGlobals.cs" };

            SelectedClassFiles = new List <string>();

            IncludeInterfaces = new List <bool>();

            var classFileName = string.Empty;

            var includeInterface = false;

            while (true)
            {
                gOut.Print("{0}", Globals.LineSep);

                gOut.Write("{0}Enter file name of interface/class: ", Environment.NewLine);

                Buf.Clear();

                gOut.WordWrap = false;

                var rc = Globals.In.ReadField(Buf, 120, null, '_', '\0', true, null, null, null, null);

                Debug.Assert(gEngine.IsSuccess(rc));

                gOut.WordWrap = true;

                classFileName = Buf.Trim().ToString().Replace('/', '\\');

                if (classFileName.Length == 0)
                {
                    goto Cleanup;
                }

                includeInterface = false;

                if (!classFileName.StartsWith(@".\Eamon\") && !classFileName.StartsWith(@".\EamonDD\") && !classFileName.StartsWith(@".\EamonRT\"))
                {
                    classFileName = string.Empty;
                }
                else if (!classFileName.Contains(@"\Game\") && !classFileName.Contains(@"\Framework\"))
                {
                    classFileName = string.Empty;
                }
                else
                {
                    var destClassFileName = classFileName.Replace(classFileName.StartsWith(@".\Eamon\") ? @".\Eamon\" : classFileName.StartsWith(@".\EamonDD\") ? @".\EamonDD\" : @".\EamonRT\", Constants.AdventuresDir + @"\" + AdventureName + @"\").Replace(@"..\..\", @"..\");

                    if (!classFileName.EndsWith(".cs") || classFileName.Contains(@"\.") || invalidClassFileNames.FirstOrDefault(fn => string.Equals(fn, Globals.Path.GetFileName(classFileName), StringComparison.OrdinalIgnoreCase)) != null || SelectedClassFiles.FirstOrDefault(fn => string.Equals(fn, classFileName, StringComparison.OrdinalIgnoreCase)) != null || Globals.File.Exists(destClassFileName))
                    {
                        classFileName = string.Empty;
                    }

                    if (!Globals.File.Exists(classFileName))
                    {
                        if (classFileName.StartsWith(@".\EamonRT\Game\States\") || classFileName.StartsWith(@".\EamonRT\Game\Commands\") || classFileName.StartsWith(@".\EamonRT\Framework\States\") || classFileName.StartsWith(@".\EamonRT\Framework\Commands\"))
                        {
                            gOut.Print("{0}", Globals.LineSep);

                            gOut.Write("{0}Would you like to derive directly from {1} (Y/N) [N]: ", Environment.NewLine,
                                       classFileName.Contains(@"\Game\States\") ? "State" :
                                       classFileName.Contains(@"\Game\Commands\") ? "Command" :
                                       classFileName.Contains(@"\Framework\States\") ? "IState" :
                                       "ICommand");

                            Buf.Clear();

                            rc = Globals.In.ReadField(Buf, Constants.BufSize02, null, ' ', '\0', true, "N", gEngine.ModifyCharToUpper, gEngine.IsCharYOrN, null);

                            Debug.Assert(gEngine.IsSuccess(rc));

                            if (Buf.Length > 0 && Buf[0] == 'Y')
                            {
                                if (classFileName.Contains(@"\Game\"))
                                {
                                    includeInterface = true;
                                }
                            }
                            else
                            {
                                classFileName = string.Empty;
                            }
                        }
                        else
                        {
                            classFileName = string.Empty;
                        }
                    }
                }

                gOut.Print("{0}", Globals.LineSep);

                if (classFileName.Length > 0)
                {
                    SelectedClassFiles.Add(classFileName);

                    if (!includeInterface && classFileName.Contains(@"\Game\"))
                    {
                        gOut.Write("{0}Would you like to add a custom interface for this class (Y/N) [N]: ", Environment.NewLine);

                        Buf.Clear();

                        rc = Globals.In.ReadField(Buf, Constants.BufSize02, null, ' ', '\0', true, "N", gEngine.ModifyCharToUpper, gEngine.IsCharYOrN, null);

                        Debug.Assert(gEngine.IsSuccess(rc));

                        if (Buf.Length > 0 && Buf[0] == 'Y')
                        {
                            includeInterface = true;
                        }

                        gOut.Print("{0}", Globals.LineSep);
                    }

                    IncludeInterfaces.Add(includeInterface);

                    gOut.Print("The file name path was added to the selected class files list.");
                }
                else
                {
                    gOut.Print("The file name path was invalid or the source/destination file was not found, or already exists.");
                }
            }

Cleanup:

            if (SelectedClassFiles.Count == 0)
            {
                gOut.Print("{0}", Globals.LineSep);

                gOut.Print("The adventure was not processed.");

                GotoCleanup = true;
            }
        }
Beispiel #18
0
        /// <summary></summary>
        /// <returns></returns>
        public virtual bool ValidateInterdependenciesDirsElement()
        {
            var result = true;

            var i = Index;

            var dv = (Direction)i;

            if (gEngine.IsValidDirection(dv))
            {
                if (Record.IsDirectionRoom(dv))
                {
                    var roomUid = Record.GetDirs(i);

                    var room = gRDB[roomUid];

                    if (room == null)
                    {
                        result = false;

                        Buf.SetFormat(Constants.RecIdepErrorFmtStr, GetPrintedName("DirsElement"), "Room", roomUid, "which doesn't exist");

                        ErrorMessage = Buf.ToString();

                        RecordType = typeof(IRoom);

                        NewRecordUid = roomUid;

                        goto Cleanup;
                    }
                }
                else if (Record.IsDirectionDoor(dv))
                {
                    var artUid = Record.GetDirectionDoorUid(dv);

                    var artifact = gADB[artUid];

                    if (artifact == null)
                    {
                        result = false;

                        Buf.SetFormat(Constants.RecIdepErrorFmtStr, GetPrintedName("DirsElement"), "Artifact", artUid, "which doesn't exist");

                        ErrorMessage = Buf.ToString();

                        RecordType = typeof(IArtifact);

                        NewRecordUid = artUid;

                        goto Cleanup;
                    }
                    else if (artifact.DoorGate == null)
                    {
                        result = false;

                        Buf.SetFormat(Constants.RecIdepErrorFmtStr, GetPrintedName("DirsElement"), "Artifact", artUid, "which should be a door/gate, but isn't");

                        ErrorMessage = Buf.ToString();

                        RecordType = typeof(IArtifact);

                        EditRecord = artifact;

                        goto Cleanup;
                    }
                    else if (!artifact.IsInRoom(Record) && !artifact.IsEmbeddedInRoom(Record))
                    {
                        result = false;

                        Buf.SetFormat(Constants.RecIdepErrorFmtStr, GetPrintedName("DirsElement"), "Artifact", artUid, "which should be located in this Room, but isn't");

                        ErrorMessage = Buf.ToString();

                        RecordType = typeof(IArtifact);

                        EditRecord = artifact;

                        goto Cleanup;
                    }
                }
            }

Cleanup:

            return(result);
        }
 public virtual int ReadBytes(Memory <byte> destination) => Buf.ReadBytes(destination);
Beispiel #20
0
        /// <summary></summary>
        protected virtual void GetAdventureName()
        {
            var invalidAdventureNames = new string[] { "Adventures", "Catalog", "Characters", "Contemporary", "Fantasy", "SciFi", "Test", "Workbench", "WorkInProgress", "AdventureSupportMenu", "LoadAdventureSupportMenu", "YourAdventureName", "YourAuthorName", "YourAuthorInitials" };

            if (SupportMenuType == SupportMenuType.AddAdventure)
            {
                gOut.Print("You must enter a name for your new adventure (eg, The Beginner's Cave).  This should be the formal name of the adventure shown in the Main Hall's list of adventures; input should always be properly title-cased.");

                gOut.Print("Note:  the name will be used to produce a shortened form suitable for use as a folder name under the Adventures directory and also as a C# namespace (eg, TheBeginnersCave).");
            }
            else
            {
                if (SupportMenuType == SupportMenuType.AddClasses)
                {
                    gOut.Print(@"Note:  this menu option will allow you to enter the file paths for interfaces or classes you wish to add to the adventure; the actual addition will occur after you are given a final warning.  Your working directory is System and you should enter relative file paths (eg, .\Eamon\Game\Monster.cs or .\EamonRT\Game\Combat\CombatSystem.cs).  For any classes added, the corresponding .XML textfiles (if any) will be updated appropriately.");
                }
                else if (SupportMenuType == SupportMenuType.DeleteClasses)
                {
                    gOut.Print(@"Note:  this menu option will allow you to enter the file paths for interfaces or classes you wish to remove from the adventure; the actual deletion will occur after you are given a final warning.  Your working directory is the adventure folder for the game you've selected and you should enter relative file paths (eg, .\Game\Monster.cs).  For any classes deleted, the corresponding .XML textfiles (if any) will be updated appropriately.");
                }

                gOut.Print("You must enter the name of the adventure you wish to {0} (eg, The Beginner's Cave).  This should be the formal name of the adventure shown in the Main Hall's list of adventures; input should always be properly title-cased.", SupportMenuType == SupportMenuType.DeleteAdventure ? "delete" : "process");
            }

            AdventureName = string.Empty;

            while (AdventureName.Length == 0)
            {
                gOut.Write("{0}Enter the name of the {1}adventure: ", Environment.NewLine, SupportMenuType == SupportMenuType.AddAdventure ? "new " : "");

                Buf.Clear();

                var rc = Globals.In.ReadField(Buf, Constants.FsNameLen, null, '_', '\0', false, null, null, gEngine.IsCharAnyButBackForwardSlash, null);

                Debug.Assert(gEngine.IsSuccess(rc));

                Buf.SetFormat("{0}", Regex.Replace(Buf.ToString(), @"\s+", " ").Trim());

                AdventureName01 = Buf.ToString();

                var tempStr = Thread.CurrentThread.CurrentCulture.TextInfo.ToTitleCase(AdventureName01);

                AdventureName = new string((from char ch in tempStr where gEngine.IsCharAlnum(ch) select ch).ToArray());

                if (AdventureName.Length > 0 && (gEngine.IsCharDigit(AdventureName[0]) || invalidAdventureNames.FirstOrDefault(n => string.Equals(AdventureName, n, StringComparison.OrdinalIgnoreCase)) != null))
                {
                    AdventureName = string.Empty;
                }

                if (AdventureName.Length > Constants.FsFileNameLen - 4)
                {
                    AdventureName = AdventureName.Substring(0, Constants.FsFileNameLen - 4);
                }

                if (AdventureName.Length == 0)
                {
                    gOut.Print("{0}", Globals.LineSep);
                }
            }

            if (SupportMenuType == SupportMenuType.AddAdventure && Globals.Directory.Exists(Constants.AdventuresDir + @"\" + AdventureName))
            {
                gOut.Print("{0}", Globals.LineSep);

                gOut.Print("The adventure already exists.");

                GotoCleanup = true;
            }
            else if (SupportMenuType != SupportMenuType.AddAdventure && !Globals.Directory.Exists(Constants.AdventuresDir + @"\" + AdventureName))
            {
                gOut.Print("{0}", Globals.LineSep);

                gOut.Print("The adventure does not exist.");

                GotoCleanup = true;
            }
            else if (SupportMenuType == SupportMenuType.AddClasses || SupportMenuType == SupportMenuType.DeleteClasses)
            {
                if (!Globals.File.Exists(Constants.AdventuresDir + @"\" + AdventureName + @"\" + AdventureName + @".csproj"))
                {
                    gOut.Print("{0}", Globals.LineSep);

                    gOut.Print("That is not a custom adventure.");

                    GotoCleanup = true;
                }
                else if (!Globals.File.Exists(@".\" + AdventureName + ".dll"))
                {
                    gOut.Print("{0}", Globals.LineSep);

                    gOut.Print("The custom adventure library (.dll) does not exist.");

                    GotoCleanup = true;
                }
                else if (Globals.File.Exists(Constants.AdventuresDir + @"\" + AdventureName + @"\FRESHMEAT.XML"))
                {
                    gOut.Print("{0}", Globals.LineSep);

                    gOut.Print("The adventure is being played through.");

                    GotoCleanup = true;
                }
            }
        }
Beispiel #21
0
        public override void Execute()
        {
            RetCode rc;
            long    i;

            gOut.Print("{0}", Globals.LineSep);

            gOut.Write("{0}You have no trouble spotting Shylock McFenny, the local banker, due to his large belly.  You attract his attention, and he comes over to you.{0}{0}\"Well, {1} my dear {2} what a pleasure to see you!  Do you want to make a deposit or a withdrawal?\"{0}",
                       Environment.NewLine,
                       Globals.Character.Name,
                       Globals.Character.EvalGender("boy", "girl", "thing"));

            gOut.Print("You have {0} GP in hand, {1} GP in the bank.",
                       Globals.Character.HeldGold,
                       Globals.Character.BankGold);

            gOut.Print("{0}", Globals.LineSep);

            gOut.Write("{0}D=Deposit gold, W=Withdraw gold, X=Exit: ", Environment.NewLine);

            Buf.Clear();

            rc = Globals.In.ReadField(Buf, Constants.BufSize02, null, ' ', '\0', false, null, gEngine.ModifyCharToUpper, gEngine.IsCharDOrWOrX, gEngine.IsCharDOrWOrX);

            Debug.Assert(gEngine.IsSuccess(rc));

            Globals.Thread.Sleep(150);

            if (Buf.Length == 0 || Buf[0] == 'X')
            {
                goto Cleanup;
            }

            gOut.Print("{0}", Globals.LineSep);

            if (Buf[0] == 'D')
            {
                gOut.Print("Shylock gets a wide grin on his face and says, \"Good for you!  How much do you want to deposit?\"");

                gOut.Print("You have {0} GP in hand, {1} GP in the bank.",
                           Globals.Character.HeldGold,
                           Globals.Character.BankGold);

                gOut.Print("{0}", Globals.LineSep);

                gOut.Write("{0}Enter the amount to deposit: ", Environment.NewLine);

                Buf.Clear();

                rc = Globals.In.ReadField(Buf, Constants.BufSize01, null, ' ', '\0', false, null, null, gEngine.IsCharDigit, null);

                Debug.Assert(gEngine.IsSuccess(rc));

                Globals.Thread.Sleep(150);

                i = Convert.ToInt64(Buf.Trim().ToString());

                gOut.Print("{0}", Globals.LineSep);

                if (i > 0)
                {
                    if (i <= Globals.Character.HeldGold)
                    {
                        if (Globals.Character.BankGold + i > Constants.MaxGoldValue)
                        {
                            i = Constants.MaxGoldValue - Globals.Character.BankGold;
                        }

                        Globals.Character.HeldGold -= i;

                        Globals.Character.BankGold += i;

                        Globals.CharactersModified = true;

                        Buf.SetPrint("Shylock takes your money, puts it in his bag, listens to it jingle, then thanks you and walks away.");
                    }
                    else
                    {
                        Buf.SetPrint("Shylock was very pleased when you told him the sum, but when he discovered that you didn't have that much on you, he walked away shouting about fools who try to play tricks on a kindly banker.");
                    }
                }
                else
                {
                    Buf.SetPrint("The banker says, \"Well, if you change your mind and need my services, just let me know!\"");
                }

                gOut.Write("{0}", Buf);
            }
            else
            {
                Debug.Assert(Buf[0] == 'W');

                gOut.Print("Shylock says, \"Well, you have {0} gold piece{1} stored with me.  How many do you want to take back?\"",
                           Globals.Character.BankGold,
                           Globals.Character.BankGold != 1 ? "s" : "");

                gOut.Print("You have {0} GP in hand, {1} GP in the bank.",
                           Globals.Character.HeldGold,
                           Globals.Character.BankGold);

                gOut.Print("{0}", Globals.LineSep);

                gOut.Write("{0}Enter the amount to withdraw: ", Environment.NewLine);

                Buf.Clear();

                rc = Globals.In.ReadField(Buf, Constants.BufSize01, null, ' ', '\0', false, null, null, gEngine.IsCharDigit, null);

                Debug.Assert(gEngine.IsSuccess(rc));

                Globals.Thread.Sleep(150);

                i = Convert.ToInt64(Buf.Trim().ToString());

                gOut.Print("{0}", Globals.LineSep);

                if (i > 0)
                {
                    if (i <= Globals.Character.BankGold)
                    {
                        if (Globals.Character.HeldGold + i > Constants.MaxGoldValue)
                        {
                            i = Constants.MaxGoldValue - Globals.Character.HeldGold;
                        }

                        Globals.Character.BankGold -= i;

                        Globals.Character.HeldGold += i;

                        Globals.CharactersModified = true;

                        Buf.SetFormat("{0}The banker hands you your gold and says, \"That leaves you with {1} gold piece{2} in my care.\"{0}{0}He shakes your hand and walks away.{0}",
                                      Environment.NewLine,
                                      Globals.Character.BankGold,
                                      Globals.Character.BankGold != 1 ? "s" : "");
                    }
                    else
                    {
                        Buf.SetPrint("The banker throws you a terrible glance and says, \"That's more than you've got!  You know I don't make loans to your kind!\"  With that, he loses himself in the crowd.");
                    }
                }
                else
                {
                    Buf.SetPrint("The banker says, \"Well, if you change your mind and need my services, just let me know!\"");
                }

                gOut.Write("{0}", Buf);
            }

            Globals.In.KeyPress(Buf);

Cleanup:

            ;
        }
Beispiel #22
0
        /// <summary></summary>
        public virtual void PrintOutputBeginners()
        {
            RetCode rc;

            gOut.Print("{0}", Globals.LineSep);

            PrintOutputBeginnersPrelude();

            var i = 0L;                   // weird disambiguation hack

            if (!gCharacter.GetWeapons(i).IsActive())
            {
                PrintOutputBeginnersNoWeapons();

                Globals.MainLoop.ShouldExecute = false;

                Globals.ExitType = ExitType.GoToMainHall;
            }
            else if (gCharacter.ArmorExpertise != 0 || gCharacter.GetWeaponAbilities(Weapon.Axe) != 5 || gCharacter.GetWeaponAbilities(Weapon.Club) != 20 || gCharacter.GetWeaponAbilities(Weapon.Sword) != 0)
            {
                PrintOutputBeginnersNotABeginner();

                Globals.MainLoop.ShouldExecute = false;

                Globals.ExitType = ExitType.GoToMainHall;
            }
            else
            {
                if (gCharacter.GetWeapons(1).IsActive())
                {
                    PrintOutputBeginnersTooManyWeapons();

                    Buf.Clear();

                    gCharacter.ListWeapons(Buf);

                    gOut.WriteLine("{0}", Buf);

                    gOut.Print("{0}", Globals.LineSep);

                    gOut.Write("{0}Press the number of the weapon to select: ", Environment.NewLine);

                    Buf.Clear();

                    rc = Globals.In.ReadField(Buf, Constants.BufSize02, null, ' ', '\0', false, null, gEngine.ModifyCharToUpper, IsCharWpnNum, null);

                    Debug.Assert(gEngine.IsSuccess(rc));

                    Globals.Thread.Sleep(150);

                    gOut.Print("{0}", Globals.LineSep);

                    Debug.Assert(gGameState != null);

                    gGameState.UsedWpnIdx = Convert.ToInt64(Buf.Trim().ToString());

                    gGameState.UsedWpnIdx--;
                }

                PrintOutputBeginnersMayNowProceed();
            }
        }
Beispiel #23
0
        public void InitialReceiveHandler(ref SelectControl selectControl, Socket clientSocket, Buf safeBuffer)
        {
            int bytesReceived = clientSocket.Receive(safeBuffer.array);

            if (bytesReceived <= 0)
            {
                if (AppLayerProxy.Logger != null)
                {
                    AppLayerProxy.Logger.WriteLine("{0} Closed (no data received)", clientLogString);
                }
                selectControl.DisposeAndRemoveReceiveSocket(clientSocket);
                return;
            }

            if (!CheckForEndOfHeadersAndHandle(ref selectControl, clientSocket, safeBuffer.array, 0, (uint)bytesReceived))
            {
                if (AppLayerProxy.Logger != null)
                {
                    AppLayerProxy.Logger.WriteLine("{0} Initial socket receive did not contain all headers. Need to copy partial header to a new buffer.",
                                                   clientLogString);
                }

                clientBuffer = new ByteBuilder(InitialClientBufferLength +
                                               ((bytesReceived > InitialClientBufferLength) ? (uint)bytesReceived : 0));
                Array.Copy(safeBuffer.array, clientBuffer.bytes, bytesReceived);
                clientBuffer.contentLength = (uint)bytesReceived;

                selectControl.UpdateHandler(clientSocket, HeaderBuilderHandler);
            }
        }
Beispiel #24
0
        public override void Execute()
        {
            RetCode rc;

            var nlFlag = false;

            gOut.WriteLine();

            gEngine.PrintTitle("SHOW CHARACTER STATUS SUMMARY", true);

            var advCharList = new List <AdventuringCharacter>();

            var adventureDirs = Globals.Directory.GetDirectories(Constants.AdventuresDir);

            var j = (long)adventureDirs.Length;

            var i = 0;

            while (i < j)
            {
                var chrfn = Globals.Path.Combine(adventureDirs[i], "FRESHMEAT.DAT");

                if (Globals.File.Exists(chrfn))
                {
                    try
                    {
                        var fileName = Globals.Path.GetFullPath(@".\" + Globals.Path.GetFileNameWithoutExtension(adventureDirs[i]) + ".dll");

                        if (Globals.File.Exists(fileName))
                        {
                            Assembly.LoadFrom(fileName);
                        }
                    }
                    catch (Exception)
                    {
                        // do nothing
                    }

                    var modfn = Globals.Path.Combine(adventureDirs[i], "MODULE.DAT");

                    rc = Globals.PushDatabase();

                    Debug.Assert(gEngine.IsSuccess(rc));

                    rc = Globals.Database.LoadCharacters(chrfn, printOutput: false);

                    Debug.Assert(gEngine.IsSuccess(rc));

                    rc = Globals.Database.LoadModules(modfn, printOutput: false);

                    Debug.Assert(gEngine.IsSuccess(rc));

                    var character = Globals.Database.CharacterTable.Records.FirstOrDefault();

                    Debug.Assert(character != null);

                    var module = Globals.Database.ModuleTable.Records.FirstOrDefault();

                    Debug.Assert(module != null);

                    advCharList.Add(new AdventuringCharacter()
                    {
                        Character = Globals.CloneInstance(character),

                        Module = Globals.CloneInstance(module)
                    });

                    rc = Globals.PopDatabase();

                    Debug.Assert(gEngine.IsSuccess(rc));
                }

                i++;
            }

            var characterTable = Globals.Database.CharacterTable;

            j = characterTable.GetRecordsCount();

            i = 0;

            foreach (var character in characterTable.Records)
            {
                if (character.Status == Status.Adventuring)
                {
                    var advChar = advCharList.FirstOrDefault(ac => ac.Character.Uid == character.Uid);

                    Buf.SetFormat("{0,3}. {1}: {2} ({3})", character.Uid, gEngine.Capitalize(character.Name), character.Status, advChar != null ? gEngine.Capitalize(advChar.Module.Name) : "???");
                }
                else
                {
                    Buf.SetFormat("{0,3}. {1}: {2}", character.Uid, gEngine.Capitalize(character.Name), character.Status);
                }

                gOut.Write("{0}{1}", Environment.NewLine, Buf.ToString());

                nlFlag = true;

                if ((i != 0 && (i % (Constants.NumRows - 8)) == 0) || i == j - 1)
                {
                    nlFlag = false;

                    PrintPostShowLineSep();

                    gOut.Write("{0}Press any key to continue or X to exit: ", Environment.NewLine);

                    Buf.Clear();

                    rc = Globals.In.ReadField(Buf, Constants.BufSize02, null, ' ', '\0', true, null, gEngine.ModifyCharToNullOrX, null, gEngine.IsCharAny);

                    Debug.Assert(gEngine.IsSuccess(rc));

                    gOut.Print("{0}", Globals.LineSep);

                    if (Buf.Length > 0 && Buf[0] == 'X')
                    {
                        break;
                    }
                }

                i++;
            }

            if (nlFlag)
            {
                gOut.WriteLine();
            }

            gOut.Print("Done showing Character status summary.");
        }
Beispiel #25
0
        // Handler that receives data if all the headers were not in the initial receive
        void HeaderBuilderHandler(ref SelectControl selectControl, Socket clientSocket, Buf safeBuffer)
        {
            int bytesReceived = clientSocket.Receive(safeBuffer.array);

            if (bytesReceived <= 0)
            {
                if (AppLayerProxy.Logger != null)
                {
                    AppLayerProxy.Logger.WriteLine("{0} Closed ({1} bytes received but did not finish HTTP headers)", clientLogString, clientBuffer.contentLength);
                }
                selectControl.DisposeAndRemoveReceiveSocket(clientSocket);
                return;
            }

            clientBuffer.Append(safeBuffer.array, 0, (uint)bytesReceived);
            CheckForEndOfHeadersAndHandle(ref selectControl, clientSocket, clientBuffer.bytes, 0, clientBuffer.contentLength);
        }
Beispiel #26
0
        /// <summary></summary>
        public virtual void SelectCharacter()
        {
            RetCode rc;

            gOut.Print("{0}", Globals.LineSep);

            gOut.Print("You are greeted there by a burly Irishman who looks at you with a scowl and asks you, \"What's yer name?\"");

            var character = Globals.CreateInstance <ICharacter>();

            var menu = Globals.CreateInstance <IMainHallMenu>();

            var effect = null as IEffect;

            while (true)
            {
                Rtio = null;

                gOut.Print("{0}", Globals.LineSep);

                gOut.Write("{0}You give him your name (type it in now): ", Environment.NewLine);

                Buf.Clear();

                rc = Globals.In.ReadField(Buf, Constants.CharNameLen, null, ' ', '\0', false, null, null, gEngine.IsCharAnyButDquoteCommaColon, null);

                Debug.Assert(gEngine.IsSuccess(rc));

                Buf.SetFormat("{0}", Regex.Replace(Buf.ToString(), @"\s+", " ").Trim());

                character.Name = Buf.ToString();

                var helper = Globals.CreateInstance <ICharacterHelper>(x =>
                {
                    x.Record = character;
                });

                Globals.Thread.Sleep(150);

                if (helper.ValidateField("Name"))
                {
                    gOut.Print("{0}", Globals.LineSep);

                    if (effect == null)
                    {
                        var effectUid = gEngine.RollDice(1, Globals.Database.GetEffectsCount(), 0);

                        effect = gEDB[effectUid];
                    }

                    gOut.Print("He starts looking through his book, while muttering something about {0}", effect != null ? effect.Desc : "not having enough snappy comments.");

                    Globals.Character = Globals.Database.CharacterTable.Records.Where(c => c.Name.Equals(character.Name, StringComparison.OrdinalIgnoreCase)).FirstOrDefault();

                    if (Globals.Character == null)
                    {
                        gOut.Print("He eventually looks at you and says, \"Yer name's na in here.  Have ye given it to me aright?\"");

                        gOut.Print("{0}", Globals.LineSep);

                        gOut.Write("{0}Press Y for yes or N for no: ", Environment.NewLine);

                        Buf.Clear();

                        rc = Globals.In.ReadField(Buf, Constants.BufSize02, null, ' ', '\0', false, null, gEngine.ModifyCharToUpper, gEngine.IsCharYOrN, gEngine.IsCharYOrN);

                        Debug.Assert(gEngine.IsSuccess(rc));

                        Globals.Thread.Sleep(150);

                        if (Buf.Length > 0 && Buf[0] == 'Y')
                        {
                            character.Name = gEngine.Capitalize(character.Name);

                            Globals.CharacterName = character.Name;

                            CreateCharacter(character);

                            menu.Execute();

                            goto Cleanup;
                        }
                        else
                        {
                            BadCharacterName();
                        }
                    }
                    else
                    {
                        /*
                         *      Full Credit:  Derived wholly from Donald Brown's Classic Eamon
                         *
                         *      File: MAIN HALL
                         *      Line: 2020
                         */

                        if (Rtio == null)
                        {
                            var c2 = Globals.Character.GetMerchantAdjustedCharisma();

                            Rtio = gEngine.GetMerchantRtio(c2);
                        }

                        Globals.CharacterName = Globals.Character.Name;

                        if (Globals.Character.Status == Status.Alive)
                        {
                            gOut.Print("Finally he looks up and says, \"Ah, here ye be.  Well, go and have fun in the hall.\"");

                            Globals.In.KeyPress(Buf);

                            menu.Execute();

                            goto Cleanup;
                        }
                        else if (Globals.Character.Status == Status.Adventuring)
                        {
                            gOut.Write("{0}The burly Irishman stares at you intently and says, \"If ye really be {1}, it means ye've been recalled from yer adventure with the help of a local wizard, and fer a fee.  Is this true?\"{0}{0}(Warning:  Any saved games for that adventure will be deleted!){0}",
                                       Environment.NewLine,
                                       Globals.Character.Name);

                            gOut.Print("{0}", Globals.LineSep);

                            gOut.Write("{0}Press Y for yes or N for no: ", Environment.NewLine);

                            Buf.Clear();

                            rc = Globals.In.ReadField(Buf, Constants.BufSize02, null, ' ', '\0', false, null, gEngine.ModifyCharToUpper, gEngine.IsCharYOrN, gEngine.IsCharYOrN);

                            Debug.Assert(gEngine.IsSuccess(rc));

                            Globals.Thread.Sleep(150);

                            if (Buf.Length > 0 && Buf[0] == 'Y')
                            {
                                gOut.Print("{0}", Globals.LineSep);

                                AdventureName = "";

                                RecallCharacterFromAdventure();

                                if (Globals.Character.Status != Status.Adventuring)
                                {
                                    var ap = gEngine.GetMerchantAskPrice(Constants.RecallPrice, (double)Rtio);

                                    gOut.Print("Pointing to an entry in his registry, the Irishman exclaims, \"Says 'ere the wizard found ye in {0} and charged {1} gold coin{2} for his services{3}!\"",
                                               AdventureName.Length > 0 ? AdventureName : gEngine.UnknownName,
                                               ap,
                                               ap != 1 ? "s" : "",
                                               Globals.Character.HeldGold + Globals.Character.BankGold < ap ? ", but ye didn't have enough to pay the fee, even after he put a lien on yer bank account!  Uh-oh, he said he'd get even soon" :
                                               Globals.Character.HeldGold < ap ? "!  He even put a lien on yer bank account to ensure full payment" :
                                               "");

                                    Globals.Character.HeldGold -= ap;

                                    Globals.CharactersModified = true;

                                    gOut.Print("Finally he looks up and says, \"Welcome back from yer adventure.  Now go and have fun in the hall.\"");

                                    Globals.In.KeyPress(Buf);

                                    menu.Execute();

                                    goto Cleanup;
                                }
                                else
                                {
                                    gOut.Write("{0}Pointing to an entry in his registry, the Irishman exclaims, \"Says 'ere the wizard couldn't locate {1} in any known adventure!\"{0}{0}(You will have to manually change {2} status using EamonDD.){0}",
                                               Environment.NewLine,
                                               Globals.Character.Name,
                                               Globals.Character.EvalGender("his", "her", "its"));
                                }
                            }
                        }
                        else
                        {
                            Debug.Assert(Globals.Character.Status == Status.Dead || Globals.Character.Status == Status.Unknown);

                            gOut.Print("The burly Irishman gets a {0} look in his eyes and says, \"Ye can't be {1}, {2} be {3}.  Now who'r ye again?\"",
                                       Globals.Character.Status == Status.Dead ? "sad" : "puzzled",
                                       Globals.Character.Name,
                                       Globals.Character.EvalGender("he", "she", "it"),
                                       Globals.Character.Status == Status.Dead ? "dead" : "missing");
                        }
                    }
                }
                else
                {
                    BadCharacterName();
                }

                if (NumChances == 0)
                {
                    Globals.In.KeyPress(Buf);

                    goto Cleanup;
                }
            }

Cleanup:

            ;
        }
Beispiel #27
0
        void ServerSocketConnected(ref SelectControl selectControl, Socket serverSocket, Buf safeBuffer)
        {
            try
            {
                if (!clientSocket.Connected)
                {
                    clientSocket.Close(); // Should already removed from selectControl
                    if (!selectControl.ConnectionError && serverSocket.Connected)
                    {
                        if (AppLayerProxy.Logger != null)
                        {
                            AppLayerProxy.Logger.WriteLine("{0} > {1} Server Connected but Client Disconnected...Closing Server", clientLogString, serverLogString);
                        }
                        try { serverSocket.Shutdown(SocketShutdown.Both); }
                        catch (Exception) { }
                    }
                    else
                    {
                        if (AppLayerProxy.Logger != null)
                        {
                            AppLayerProxy.Logger.WriteLine("{0} > {1} Client disconnected before server could connect", clientLogString, serverLogString);
                        }
                    }
                    selectControl.DisposeAndRemoveConnectSocket(serverSocket);
                }
                else if (selectControl.ConnectionError)
                {
                    if (AppLayerProxy.Logger != null)
                    {
                        if (AppLayerProxy.ForwardProxy == null)
                        {
                            AppLayerProxy.Logger.WriteLine("{0} > {1} Failed to connect to server..Closing Client", clientLogString, serverLogString);
                        }
                        else
                        {
                            AppLayerProxy.Logger.WriteLine("{0} > {1} Failed to connect to proxy server '{2}'..Closing Client",
                                                           clientLogString, serverLogString, AppLayerProxy.ForwardProxy.host.CreateTargetString());
                        }
                    }
                    clientSocket.ShutdownAndDispose(); // Should already removed from selectControl
                    selectControl.DisposeAndRemoveConnectSocket(serverSocket);
                }
                else if (!serverSocket.Connected)
                {
                    // Ignore.  Only do something if we are connected or get a ConnectionError
                }
                else
                {
                    if (AppLayerProxy.Logger != null)
                    {
                        AppLayerProxy.Logger.WriteLine("{0} > {1} Connected to Server", clientLogString, serverLogString);
                    }

                    if (isConnect)
                    {
                        if (clientBuffer == null)
                        {
                            FinishConnection(null, 0, 0);
                        }
                        else
                        {
                            uint extraChars = clientBuffer.contentLength - headersLength;
                            FinishConnection(clientBuffer.bytes, headersLength, extraChars);
                        }
                    }
                    else
                    {
                        // A NonConnect will always have buffered data to send
                        FinishConnection(clientBuffer.bytes, 0, clientBuffer.contentLength);
                    }

                    TcpBridge bridge = new TcpBridge(clientLogString, clientSocket, serverLogString, serverSocket);
                    selectControl.AddReceiveSocket(clientSocket, bridge.ReceiveHandler);
                    selectControl.UpdateConnectorToReceiver(serverSocket, bridge.ReceiveHandler);
                }
            }
            catch (Exception e)
            {
                if (AppLayerProxy.ErrorLogger != null)
                {
                    AppLayerProxy.ErrorLogger.WriteLine("{0} > {1} Failed to finish connection: {2}", clientLogString, serverLogString, e.Message);
                }
                selectControl.ShutdownIfConnectedDisposeAndRemoveReceiveSocket(clientSocket);
                selectControl.ShutdownIfConnectedDisposeAndRemoveReceiveSocket(serverSocket);
                selectControl.DisposeAndRemoveConnectSocket(serverSocket);
            }
        }
Beispiel #28
0
        public override void Execute()
        {
            IWeapon weapon;
            RetCode rc;
            long    ap = 0;
            long    i;

            gOut.Print("{0}", Globals.LineSep);

            /*
             *      Full Credit:  Derived wholly from Donald Brown's Classic Eamon
             *
             *      File: MAIN HALL
             *      Line: 3010
             */

            if (Rtio == null)
            {
                var c2 = Globals.Character.GetMerchantAdjustedCharisma();

                Rtio = gEngine.GetMerchantRtio(c2);
            }

            gOut.Print("The man behind the counter says, \"I'm Don Leif Thor Robin Hercules Diego, at your service!  I teach weapons.  Select your weapon of interest.\"");

            gOut.Print("{0}", Globals.LineSep);

            Buf.Clear();

            var weaponValues = EnumUtil.GetValues <Weapon>();

            for (i = 0; i < weaponValues.Count; i++)
            {
                weapon = gEngine.GetWeapons(weaponValues[(int)i]);

                Debug.Assert(weapon != null);

                Buf.AppendFormat("{0}{1}{2}={3}{4}",
                                 i == 0 ? Environment.NewLine : "",
                                 i != 0 ? ", " : "",
                                 (long)weaponValues[(int)i],
                                 weapon.MarcosName ?? weapon.Name,
                                 i == weaponValues.Count - 1 ? ": " : "");
            }

            gOut.Write("{0}", Buf);

            Buf.Clear();

            rc = Globals.In.ReadField(Buf, Constants.BufSize02, null, ' ', '\0', false, null, null, gEngine.IsCharWpnType, gEngine.IsCharWpnType);

            Debug.Assert(gEngine.IsSuccess(rc));

            Globals.Thread.Sleep(150);

            gOut.Print("{0}", Globals.LineSep);

            Debug.Assert(Buf.Length > 0);

            i = Convert.ToInt64(Buf.Trim().ToString());

            weapon = gEngine.GetWeapons((Weapon)i);

            Debug.Assert(weapon != null);

            ap = gEngine.GetMerchantAskPrice(Constants.WeaponTrainingPrice, (double)Rtio);

            gOut.Print("\"My fee is {0} gold piece{1} per try.  Your current ability is {2}%.\"", ap, ap != 1 ? "s" : "", Globals.Character.GetWeaponAbilities(i));

            gOut.Print("Don asks you to enter his shop.  \"{0}, see that {1} over there?  It's all in the wrist...  ATTACK!\"", Globals.Character.Name, i == (long)Weapon.Bow || i == (long)Weapon.Spear ? "target" : "dummy");

            while (true)
            {
                Globals.In.KeyPress(Buf);

                gOut.Print("{0}", Globals.LineSep);

                gOut.Print("Ability: {0}        Gold: {1}", Globals.Character.GetWeaponAbilities(i), Globals.Character.HeldGold);

                if (Globals.Character.HeldGold >= ap)
                {
                    gOut.Write("{0}1=Attack, 2=Rest, X=Exit: ", Environment.NewLine);

                    Buf.Clear();

                    rc = Globals.In.ReadField(Buf, Constants.BufSize02, null, ' ', '\0', false, null, gEngine.ModifyCharToUpper, gEngine.IsChar1Or2OrX, gEngine.IsChar1Or2OrX);

                    Debug.Assert(gEngine.IsSuccess(rc));

                    Globals.Thread.Sleep(150);

                    gOut.Print("{0}", Globals.LineSep);

                    if (Buf.Length == 0 || Buf[0] == 'X')
                    {
                        break;
                    }
                    else if (Buf[0] == '1')
                    {
                        var rl = gEngine.RollDice(1, 100, 0);

                        if (rl > 90)
                        {
                            gOut.Print("\"A critical hit!  Very good!  Now, continue.\"");

                            Globals.Character.ModWeaponAbilities(i, 2);
                        }
                        else if (rl > 50)
                        {
                            gOut.Print("\"A hit!  Good!  Now, continue.\"");

                            Globals.Character.ModWeaponAbilities(i, 1);
                        }
                        else
                        {
                            gOut.Print("\"A miss!  Try harder!  Now, continue.\"");
                        }

                        if (Globals.Character.GetWeaponAbilities(i) > weapon.MaxValue)
                        {
                            Globals.Character.SetWeaponAbilities(i, weapon.MaxValue);
                        }

                        Globals.Character.HeldGold -= ap;

                        Globals.CharactersModified = true;
                    }
                    else
                    {
                        gOut.Print("PUFF  PUFF  PUFF.  \"Stamina is important!\"");
                    }
                }
                else
                {
                    gOut.Print("\"Sorry, but you have too little gold!\"");

                    break;
                }
            }

            gOut.Print("\"Goodbye and good luck!\"");

            Globals.In.KeyPress(Buf);
        }
 public virtual ReadOnlySpan <byte> GetReadableSpan(int index, int count) => Buf.GetReadableSpan(index, count);
Beispiel #30
0
        public override void Execute()
        {
            RetCode rc;

            if (EditRecord != null || Globals.Module != null)
            {
                gOut.WriteLine();

                gEngine.PrintTitle("EDIT MODULE RECORD FIELD", true);

                if (EditRecord == null)
                {
                    EditRecord = Globals.Module;
                }

                var editModule01 = Globals.CloneInstance(EditRecord);

                Debug.Assert(editModule01 != null);

                var helper = Globals.CreateInstance <IModuleHelper>(x =>
                {
                    x.Record = editModule01;
                });

                string editFieldName01 = null;

                if (string.IsNullOrWhiteSpace(EditFieldName))
                {
                    helper.ListRecord(true, true, false, true, true, true);

                    gOut.WriteLine();

                    gOut.Print("{0}", Globals.LineSep);

                    gOut.Write("{0}{1}", Environment.NewLine, gEngine.BuildPrompt(47, '\0', 0, "Enter the number of the field to edit", "0"));

                    Buf.Clear();

                    rc = Globals.In.ReadField(Buf, Constants.BufSize01, null, '_', '\0', true, "0", null, gEngine.IsCharDigit, null);

                    Debug.Assert(gEngine.IsSuccess(rc));

                    var fieldNum = Convert.ToInt64(Buf.Trim().ToString());

                    editFieldName01 = helper.GetFieldName(fieldNum);

                    if (string.IsNullOrWhiteSpace(editFieldName01))
                    {
                        goto Cleanup;
                    }

                    gOut.Print("{0}", Globals.LineSep);
                }
                else
                {
                    editFieldName01 = EditFieldName;
                }

                helper.EditRec   = true;
                helper.EditField = true;
                helper.FieldDesc = Globals.Config.FieldDesc;

                helper.InputField(editFieldName01);

                CompareAndSave(editModule01);
            }

Cleanup:

            EditRecord = null;

            EditFieldName = null;
        }
 public virtual ReadOnlySequence <byte> GetSequence(int index, int count) => Buf.GetSequence(index, count);
Beispiel #32
0
        public override void Execute()
        {
            RetCode rc;
            bool    imw = false;
            long    ap  = 0;
            long    ap0;
            long    ap1;
            long    i;

            gOut.Print("{0}", Globals.LineSep);

            /*
             *      Full Credit:  Derived wholly from Donald Brown's Classic Eamon
             *
             *      File: MAIN HALL
             *      Line: 3010
             */

            if (Rtio == null)
            {
                var c2 = Globals.Character.GetMerchantAdjustedCharisma();

                Rtio = gEngine.GetMerchantRtio(c2);
            }

            i = gEngine.FindIndex(Globals.Character.Weapons, w => !w.IsActive());

            if (i < 0)
            {
                gOut.Print("Grendel says, \"I'm sorry, but you're going to have to try and sell one of your weapons at the store to the north.  You know the law:  No more than four weapons per person!  Come back when you've sold a weapon.\"");

                goto Cleanup;
            }

            gOut.Print("Grendel says, \"Would you care to look at my stock of used weapons?  You can also order a custom weapon if you'd prefer.\"");

            gOut.Print("{0}", Globals.LineSep);

            gOut.Write("{0}U=Used weapon, C=Custom weapon, X=Exit: ", Environment.NewLine);

            Buf.Clear();

            rc = Globals.In.ReadField(Buf, Constants.BufSize02, null, ' ', '\0', false, null, gEngine.ModifyCharToUpper, gEngine.IsCharUOrCOrX, gEngine.IsCharUOrCOrX);

            Debug.Assert(gEngine.IsSuccess(rc));

            Globals.Thread.Sleep(150);

            gOut.Print("{0}", Globals.LineSep);

            if (Buf.Length == 0 || Buf[0] == 'X')
            {
                goto Cleanup;
            }

            if (Buf[0] == 'U')
            {
                var weaponList = new List <string[]>()
                {
                    null,
                    new string[] { "Slaymor", "Elfkill" },
                    new string[] { "Stinger", "Scrunch" },
                    new string[] { "Centuri", "Falcoor" },
                    new string[] { "Widower", "Flasher" },
                    new string[] { "Slasher", "Freedom" }
                };

                gOut.Print("\"What type of weapon do you wish?\"");

                gOut.Print("{0}", Globals.LineSep);

                var j = (int)GetWeaponType();

                var weaponPrice = gEngine.GetWeaponPriceOrValue(weaponList[j][0], 12, (Weapon)j, 2, 8, j == (long)Weapon.Bow ? 2 : 1, true, ref imw);

                ap0 = gEngine.GetMerchantAskPrice(weaponPrice, (double)Rtio);

                weaponPrice = gEngine.GetWeaponPriceOrValue(weaponList[j][1], 24, (Weapon)j, 2, 16, j == (long)Weapon.Bow ? 2 : 1, true, ref imw);

                ap1 = gEngine.GetMerchantAskPrice(weaponPrice, (double)Rtio);

                gOut.Write("{0}\"I happen to have two in stock right now.\"{0}{0}1. {1} (2D8  / 12%) ...... {2} GP{0}2. {3} (2D16 / 24%) ..... {4} GP{0}", Environment.NewLine, weaponList[j][0], ap0, weaponList[j][1], ap1);

                gOut.Print("{0}", Globals.LineSep);

                gOut.Write("{0}Press the number of the weapon to buy or X to exit: ", Environment.NewLine);

                Buf.Clear();

                rc = Globals.In.ReadField(Buf, Constants.BufSize02, null, ' ', '\0', false, null, gEngine.ModifyCharToUpper, gEngine.IsChar1Or2OrX, gEngine.IsChar1Or2OrX);

                Debug.Assert(gEngine.IsSuccess(rc));

                Globals.Thread.Sleep(150);

                gOut.Print("{0}", Globals.LineSep);

                if (Buf.Length == 0 || Buf[0] == 'X')
                {
                    goto Cleanup;
                }

                var k = (int)Convert.ToInt64(Buf.Trim().ToString());

                ap = k == 1 ? ap0 : ap1;

                if (Globals.Character.HeldGold >= ap)
                {
                    gOut.Print("\"Good choice!  A great bargain!\"");

                    UpdateCharacterWeapon(i, ap, Globals.CloneInstance(weaponList[j][k - 1]), j, 12 * k, 2, 8 * k, j == (long)Weapon.Bow ? 2 : 1);

                    goto Cleanup;
                }
                else
                {
                    PrintNotEnoughGold();

                    goto Cleanup;
                }
            }
            else
            {
                gOut.Print("\"What do you want me to make?\"");

                gOut.Print("{0}", Globals.LineSep);

                var j = (int)GetWeaponType();

                var weapon = gEngine.GetWeapons((Weapon)j);

                Debug.Assert(weapon != null);

                var wpnName = (weapon.MarcosName ?? weapon.Name).ToLower();

                gOut.Print("\"What name should I inscribe on it?\"");

                gOut.Print("Note: this should be a capitalized singular proper name (eg, Trollsfire)");

                gOut.Print("{0}", Globals.LineSep);

                gOut.Write("{0}Enter weapon name: ", Environment.NewLine);

                Buf.Clear();

                rc = Globals.In.ReadField(Buf, Constants.CharArtNameLen, null, ' ', '\0', false, null, null, null, null);

                Debug.Assert(gEngine.IsSuccess(rc));

                Buf.SetFormat("{0}", Regex.Replace(Buf.ToString(), @"\s+", " ").Trim());

                var wpnName01 = Buf.ToString();

                Globals.Thread.Sleep(150);

                if (wpnName01 == "" || string.Equals(wpnName01, "NONE", StringComparison.OrdinalIgnoreCase))
                {
                    wpnName01 = string.Format("Grendel{0}", wpnName);
                }

                wpnName01 = gEngine.Capitalize(wpnName01.ToLower());

                gOut.Print("{0}", Globals.LineSep);

                gOut.Write("{0}\"I do have limits of craftsmanship.\"{0}{0}    Complexity    Dice   Sides{0}      1%-50%       1-3    1-12{0}", Environment.NewLine);

                gOut.Print("{0}", Globals.LineSep);

                gOut.Write("{0}Enter complexity: ", Environment.NewLine);

                Buf.Clear();

                rc = Globals.In.ReadField(Buf, Constants.BufSize01, null, ' ', '\0', false, null, null, gEngine.IsCharDigit, null);

                Debug.Assert(gEngine.IsSuccess(rc));

                var wpnComplexity = Convert.ToInt64(Buf.Trim().ToString());

                if (wpnComplexity < 1)
                {
                    wpnComplexity = 1;
                }
                else if (wpnComplexity > 50)
                {
                    wpnComplexity = 50;
                }

                gOut.Print("{0}", Globals.LineSep);

                gOut.Write("{0}Enter number of dice: ", Environment.NewLine);

                Buf.Clear();

                rc = Globals.In.ReadField(Buf, Constants.BufSize01, null, ' ', '\0', false, null, null, gEngine.IsCharDigit, null);

                Debug.Assert(gEngine.IsSuccess(rc));

                var wpnDice = Convert.ToInt64(Buf.Trim().ToString());

                if (wpnDice < 1)
                {
                    wpnDice = 1;
                }
                else if (wpnDice > 3)
                {
                    wpnDice = 3;
                }

                gOut.Print("{0}", Globals.LineSep);

                gOut.Write("{0}Enter number of dice sides: ", Environment.NewLine);

                Buf.Clear();

                rc = Globals.In.ReadField(Buf, Constants.BufSize01, null, ' ', '\0', false, null, null, gEngine.IsCharDigit, null);

                Debug.Assert(gEngine.IsSuccess(rc));

                var wpnSides = Convert.ToInt64(Buf.Trim().ToString());

                if (wpnSides < 1)
                {
                    wpnSides = 1;
                }
                else if (wpnSides > 12)
                {
                    wpnSides = 12;
                }

                var weaponPrice = gEngine.GetWeaponPriceOrValue(wpnName01, wpnComplexity, (Weapon)j, wpnDice, wpnSides, j == (long)Weapon.Bow ? 2 : 1, true, ref imw);

                ap = gEngine.GetMerchantAskPrice(weaponPrice, (double)Rtio);

                gOut.Print("{0}", Globals.LineSep);

                gOut.Print("\"I can make you a {0}H {1}D{2} {3} with complexity of {4}% called {5} for {6} gold piece{7}.  Should I proceed?\"", j == (long)Weapon.Bow ? 2 : 1, wpnDice, wpnSides, wpnName, wpnComplexity, wpnName01, ap, ap != 1 ? "s" : "");

                gOut.Print("{0}", Globals.LineSep);

                gOut.Write("{0}Press Y for yes or N for no: ", Environment.NewLine);

                Buf.Clear();

                rc = Globals.In.ReadField(Buf, Constants.BufSize02, null, ' ', '\0', false, null, gEngine.ModifyCharToUpper, gEngine.IsCharYOrN, gEngine.IsCharYOrN);

                Debug.Assert(gEngine.IsSuccess(rc));

                Globals.Thread.Sleep(150);

                gOut.Print("{0}", Globals.LineSep);

                if (Buf.Length == 0 || Buf[0] == 'N')
                {
                    goto Cleanup;
                }

                if (Globals.Character.HeldGold >= ap)
                {
                    gOut.Print("Grendel works on your weapon, often calling in wizards and weapon experts.  Finally he finishes.  \"I think you will be satisfied with this.\" he says modestly.");

                    UpdateCharacterWeapon(i, ap, wpnName01, j, wpnComplexity, wpnDice, wpnSides, j == (long)Weapon.Bow ? 2 : 1);

                    goto Cleanup;
                }
                else
                {
                    PrintNotEnoughGold();

                    goto Cleanup;
                }
            }

Cleanup:

            gOut.Print("\"Goodbye, {0}!  Come again.\"", Globals.Character.Name);

            Globals.In.KeyPress(Buf);
        }
 public virtual ReadOnlyMemory <byte> GetReadableMemory(int index, int count) => Buf.GetReadableMemory(index, count);