//============================= // Read Items public static NpcSpoilGroup ParseList(string data) { string inner_data = StringUtils.Trim(data, "{", "}"); NpcSpoilGroup items = new NpcSpoilGroup(); if (string.IsNullOrEmpty(inner_data)) { return(items); } // NpcDropItem item; int pos = 0; int len = inner_data.Length; while (pos < len && inner_data[pos] == '{') { item = read_item(inner_data, pos + 1, out pos); items.Items.Add(item); if (pos < len && inner_data[pos] == ';') { pos++; } } // return(items); }
public NpcSpoilGroup GetSpoilItems() { string data = GetValue(VAR_CORPSE_MAKE_LIST, null); if (data != null) { return(NpcSpoilGroup.ParseList(data)); } return(new NpcSpoilGroup()); }
//----------------------------- // Write Items public static string WriteList(NpcSpoilGroup items) { StringBuilder data = new StringBuilder(); // data.Append('{'); int gc = items.Items.Count; for (int i = 0; i < gc; i++) { if (i > 0) { data.Append(';'); } write_item(data, items.Items[i]); } data.Append('}'); // return(data.ToString()); }
public void SetSpoilItems(NpcSpoilGroup items) { string data = NpcSpoilGroup.WriteList(items); SetValue(VAR_CORPSE_MAKE_LIST, data); }