private static void write_group(StringBuilder data, NpcDropGroup group)
        {
            data.Append('{');
            data.Append('{');
            //
            int c = group.Items.Count;

            if (c > 0)
            {
                NpcDropItem item;
                for (int i = 0; i < c; i++)
                {
                    item = group.Items[i];
                    if (i > 0)
                    {
                        data.Append(';');
                    }
                    write_item(data, item);
                }
            }
            //
            data.Append('}');
            data.Append(';');
            data.Append(group.Chance);
            data.Append('}');
        }
Beispiel #2
0
        //=============================

        public List <NpcDropGroup> GetDropGroups()
        {
            string data = GetValue(VAR_ADDITIONAL_MAKE_MULTI_LIST, null);

            if (data != null)
            {
                return(NpcDropGroup.ParseList(data));
            }
            return(null);
        }
        public NpcDropGroup Clone()
        {
            NpcDropGroup item = new NpcDropGroup();

            item.Chance = this.Chance;
            //
            int c = this.Items.Count;

            for (int i = 0; i < c; i++)
            {
                item.Items.Add(this.Items[i].Clone());
            }
            //
            return(item);
        }
        private static NpcDropGroup read_group(string data, int p_start, out int p_end)
        {
            int          pos = p_start + 1;
            NpcDropItem  item;
            NpcDropGroup group = new NpcDropGroup();
            int          len   = data.Length;

            while (pos < len && data[pos] == '{')
            {
                item = read_item(data, pos + 1, out pos);
                group.Items.Add(item);
                if (pos < len && data[pos] == ';')
                {
                    pos++;
                }
            }
            //
            if (pos < len && data[pos] == '}')
            {
                pos++;
            }
            if (pos < len && data[pos] == ';')
            {
                pos++;
            }
            //
            int x = data.IndexOf('}', pos);

            if (x < 0)
            {
                throw new Exception("!");
            }
            group.Chance = data.Substring(pos, x - pos);
            p_end        = x + 2;
            //
            return(group);
        }
Beispiel #5
0
        public void SetDropGroups(List <NpcDropGroup> items)
        {
            string data = NpcDropGroup.WriteList(items);

            SetValue(VAR_ADDITIONAL_MAKE_MULTI_LIST, data);
        }