Example #1
0
        public static string Construct(uint number, string args)
        {
            string value = LocalizedList.GetString(number);

            string[] split = null;

            if (args != null)
            {
                split = args.Split('\t');

                for (int i = 0; i < split.Length; i++)
                {
                    string s = split[i];

                    if (s.StartsWith("#"))
                    {
                        string sub = s.Substring(1, s.Length - 1);
                        uint   num;

                        if (UInt32.TryParse(sub, out num))
                        {
                            split[i] = LocalizedList.GetString(num);
                        }
                    }
                }
            }

            if (value != null)
            {
                int diff  = 0;
                int index = 0;
                int num;
                int start;
                int end;

                while (index < value.Length && (start = value.IndexOf('~', index)) >= 0)
                {
                    end  = value.IndexOf('~', start + 1) + 1;
                    num  = value[start + 1] - 49;
                    diff = value.Length;

                    if (split != null && num < split.Length)
                    {
                        value = value.Replace(value.Substring(start, end - start), split[num]);
                    }

                    diff -= value.Length;
                    index = end - diff;
                }
            }

            return(value.Trim());
        }
Example #2
0
        public LocalizedMessage(PacketReader reader, bool send) : base(reader, send)
        {
            int size = reader.ReadInt16();

            m_Serial    = reader.ReadUInt32();
            m_Body      = reader.ReadUInt16();
            m_Type      = (MessageType)reader.ReadByte();
            m_Hue       = reader.ReadUInt16();
            m_Font      = reader.ReadUInt16();
            m_Number    = reader.ReadUInt32();
            m_Name      = reader.ReadASCIIString(30);
            m_Arguments = Encoding.Unicode.GetString(reader.Data, reader.Index, reader.Data.Length - reader.Index - 2);
            m_Message   = LocalizedList.GetString(m_Number);
        }
Example #3
0
        public CommandCastSpell(PacketReader reader, bool send) : base(reader, send)
        {
            m_UseType = (SpellUseType)reader.ReadUInt16();

            if (m_UseType == SpellUseType.Spellbook)
            {
                m_Spellbook = reader.ReadUInt32();
            }

            m_Expansion = (SpellExpansionType)reader.ReadByte();
            m_SpellID   = reader.ReadByte();

            if (m_SpellID >= 0x1 && m_SpellID <= 0x40)
            {
                m_Type      = SpellType.Mage;
                m_SpellName = LocalizedList.GetString((uint)1044380 + m_SpellID);
            }
            else if (m_SpellID >= 0x59 && m_SpellID <= 0x68)
            {
                m_Type      = SpellType.Spellweaving;
                m_SpellName = LocalizedList.GetString((uint)1031601 + m_SpellID - 0x59);
            }
            else if (m_SpellID >= 0x65 && m_SpellID <= 0x75)
            {
                m_Type      = SpellType.Necromancer;
                m_SpellName = LocalizedList.GetString((uint)1060509 + m_SpellID - 0x65);
            }
            else if (m_SpellID >= 0xC9 && m_SpellID <= 0xD2)
            {
                m_Type      = SpellType.Paladin;
                m_SpellName = LocalizedList.GetString((uint)1060492 + m_SpellID - 0xC9);
            }
            else if (m_SpellID >= 0x91 && m_SpellID <= 0x96)
            {
                m_Type      = SpellType.Samurai;
                m_SpellName = LocalizedList.GetString((uint)1060595 + m_SpellID - 0x91);
            }
            else if (m_SpellID >= 0xF5 && m_SpellID <= 0xFC)
            {
                m_Type      = SpellType.Ninja;
                m_SpellName = LocalizedList.GetString((uint)1060610 + m_SpellID - 0xF5);
            }
            else
            {
                m_Type = SpellType.Unknown;
            }
        }
Example #4
0
        public void WriteSphereGump(StreamWriter writer)
        {
            writer.WriteLine("[DIALOG d_SpyUO]");
            writer.WriteLine("SetLocation={0},{1}", m_X, m_Y);
            foreach (GumpEntry entry in m_Layout)
            {
                if (entry is GumpPage)
                {
                    writer.WriteLine();
                }

                int i = 0;
                while (true)
                {
                    writer.Write(entry.Commands[i]);
                    if (++i < entry.Commands.Length)
                    {
                        writer.Write(" ");
                    }
                    else
                    {
                        break;
                    }
                }

                if (entry is GumpHtmlLocalized)
                {
                    writer.WriteLine(" // " + LocalizedList.GetString(((GumpHtmlLocalized)entry).Number) as string);
                }
                else if (entry is GumpHtmlLocalizedColor)
                {
                    writer.WriteLine(" // " + LocalizedList.GetString(((GumpHtmlLocalizedColor)entry).Number) as string);
                }
                else if (entry is GumpHtmlLocalizedArgs)
                {
                    writer.WriteLine(" // " + LocalizedList.GetString(((GumpHtmlLocalizedArgs)entry).Number) as string);
                }
                else
                {
                    writer.WriteLine();
                }
            }
            writer.WriteLine();

            writer.WriteLine("[DIALOG d_SpyUO TEXT]");
            foreach (string txt in Text)
            {
                writer.WriteLine(txt);
            }
            writer.WriteLine();

            writer.WriteLine("[DIALOG d_SpyUO BUTTON]");
            ArrayList list = new ArrayList();

            list.Add(0);
            foreach (GumpEntry entry in m_Layout)
            {
                GumpButton button = entry as GumpButton;
                if (button != null && button.Type != 0 && !list.Contains(button.ButtonId))
                {
                    list.Add(button.ButtonId);
                }
            }
            list.Sort();
            foreach (int b in list)
            {
                writer.WriteLine("ON={0}", b);
            }

            writer.WriteLine();
            writer.Write("[EOF]");
        }
Example #5
0
        public void WriteRunUOClass(StreamWriter writer)
        {
            writer.WriteLine("using System;");
            writer.WriteLine("using Server;");
            writer.WriteLine("using Server.Gumps;");
            writer.WriteLine("using Server.Network;");

            writer.WriteLine();

            writer.WriteLine("namespace Server.SpyUO");
            writer.WriteLine("{");

            writer.WriteLine("\tpublic class SpyUOGump : Gump");
            writer.WriteLine("\t{");

            writer.WriteLine("\t\tpublic SpyUOGump() : base( {0}, {1} )", m_X, m_Y);
            writer.WriteLine("\t\t{");
            for (int i = 0; i < m_Layout.Length; i++)
            {
                GumpEntry entry = m_Layout[i];
                bool      space = entry is GumpPage;
                if (space && i != 0)
                {
                    writer.WriteLine();
                }

                writer.Write("\t\t\t{0}", entry.GetRunUOLine());

                if (entry is GumpHtmlLocalized)
                {
                    writer.WriteLine(" // " + LocalizedList.GetString(((GumpHtmlLocalized)entry).Number) as string);
                }
                else if (entry is GumpHtmlLocalizedColor)
                {
                    writer.WriteLine(" // " + LocalizedList.GetString(((GumpHtmlLocalizedColor)entry).Number) as string);
                }
                else if (entry is GumpHtmlLocalizedArgs)
                {
                    writer.WriteLine(" // " + LocalizedList.GetString(((GumpHtmlLocalizedArgs)entry).Number) as string);
                }
                else
                {
                    writer.WriteLine();
                }

                if (space && i < m_Layout.Length)
                {
                    writer.WriteLine();
                }
            }
            writer.WriteLine("\t\t}");

            writer.WriteLine();

            writer.WriteLine("\t\tpublic override void OnResponse( NetState sender, RelayInfo info )");
            writer.WriteLine("\t\t{");
            writer.WriteLine("\t\t}");

            writer.WriteLine("\t}");

            writer.Write("}");
        }
Example #6
0
 public override string ToString()
 {
     return(string.Format("Number: \"{0}\", NumberText: \"{1}\"{2}",
                          Number, LocalizedList.GetString(Number), Arguments.Length != 0 ? ", Arguments: \"" + Arguments + "\"" : ""));
 }