public static List<FOCommon.Worldmap.EncounterGroup.EncounterGroup> LoadNew(List<string> lines)
        {
            List<FOCommon.Worldmap.EncounterGroup.EncounterGroup> Groups = new List<FOCommon.Worldmap.EncounterGroup.EncounterGroup>();

            int groupId = 0;
            EncounterGroup Group = null;
            foreach (string line in lines)
            {

                if (line.StartsWith("*")) // Npc data
                {
                    string[] parts = line.Split('|');
                    string[] param = parts[0].Split(',');

                    EncounterNpc NpcObj = new EncounterNpc(Int32.Parse(param[1]), Int32.Parse(param[2]), param[3], Int32.Parse(param[4]), param[5] == "1" ? true : false,
                        Int32.Parse(param[6]), Int32.Parse(param[7]), Int32.Parse(param[8]));

                    for (int i = 1; i < parts.Length; i++)
                    {
                        string[] npcData = parts[i].Split(',');
                        if (Int32.Parse(npcData[0]) == (int)GroupFormatData.Item)
                        {
                            EncounterItem item = new EncounterItem(Int32.Parse(npcData[1]), Int32.Parse(npcData[2]), Int32.Parse(npcData[3]), Int32.Parse(npcData[4]));
                            NpcObj.AddItem(item);
                        }
                        else if (Int32.Parse(npcData[0]) == (int)GroupFormatData.Perk)
                        {
                            EncounterPerk perk = new EncounterPerk(npcData[1], Int32.Parse(npcData[2]), Int32.Parse(npcData[3]), Int32.Parse(npcData[4]));
                            NpcObj.Perks.Add(perk);
                        }
                    }
                    Group.Npcs.Add(NpcObj);
                }
                else // Group data
                {
                    if (String.IsNullOrEmpty(line) || line.Length < 5)
                        continue;

                    string[] param = line.Split(',');

                    float quantityDay = (float)double.Parse(param[7], NumberStyles.Any, ci);
                    float quantityNight = (float)double.Parse(param[8], NumberStyles.Any, ci);

                    Group = new FOCommon.Worldmap.EncounterGroup.EncounterGroup(param[0], Int32.Parse(param[1]), Int32.Parse(param[2]),
                          Int32.Parse(param[3]), Int32.Parse(param[4]), Int32.Parse(param[5]), Int32.Parse(param[6]), quantityDay, quantityNight, Int32.Parse(param[9]), Int32.Parse(param[10]));

                    if (Group != null)
                    {
                        Group.Id = groupId++;
                        Groups.Add(Group);
                    }
                }
            }

            return Groups;
        }
        private void lstNpcItems_SelectionChanged(object sender, EventArgs e)
        {
            EncounterItem Item = (EncounterItem)lstNpcItems.SelectedObject;
            if (Item == null)
                return;

            if (CurrentItem == Item)
                return;

            if (CurrentItem != null)
                SaveCurrentItem();

            CurrentItem = Item;

            cmbItemPid.SelectedIndex = cmbItemPid.Items.IndexOf(Item.Item.Define);
            cmbSlot.SelectedIndex = (int)Item.Slot;
            numItemMin.Value = Item.Min;
            numItemMax.Value = Item.Max;
        }
        private void btnAddItem_Click(object sender, EventArgs e)
        {
            if (cmbItemPid.SelectedIndex==-1)
            {
                Message.Show("No item PID selected.", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }

            if (cmbSlot.SelectedIndex==-1)
            {
                Message.Show("No item slot selected.", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }

            EncounterItem Item = new EncounterItem(ItemPid.GetPid(cmbItemPid.SelectedItem.ToString()), Decimal.ToInt32(numItemMin.Value), Decimal.ToInt32(numItemMax.Value), cmbSlot.SelectedIndex);
            CurrentNpc.AddItem(Item);
            RefreshItems();
            RefreshNpcList();
        }
        public static List<FOCommon.Worldmap.EncounterGroup.EncounterGroup> LoadOld(List<string> lines)
        {
            List<FOCommon.Worldmap.EncounterGroup.EncounterGroup> Groups = new List<FOCommon.Worldmap.EncounterGroup.EncounterGroup>();
            int groupId = 0;

            foreach (string line in lines)
            {
                string[] partsdel = { "|||" };
                string[] npcsdel = { "||" };
                string[] parts = line.Split(partsdel, StringSplitOptions.RemoveEmptyEntries);

                string[] npcs;
                if (parts.Length == 2)
                    npcs = parts[1].Split(npcsdel, StringSplitOptions.RemoveEmptyEntries);
                else
                    npcs = new string[0];

                string[] param = parts[0].Split(',');

                float quantityDay = (float)double.Parse(param[7], NumberStyles.Any, ci);
                float quantityNight = (float)double.Parse(param[8], NumberStyles.Any, ci);

                FOCommon.Worldmap.EncounterGroup.EncounterGroup Group = new FOCommon.Worldmap.EncounterGroup.EncounterGroup(param[0], Int32.Parse(param[1]), Int32.Parse(param[2]),
                      Int32.Parse(param[3]), Int32.Parse(param[4]), Int32.Parse(param[5]), Int32.Parse(param[6]), quantityDay, quantityNight, Int32.Parse(param[9]), Int32.Parse(param[10]));

                Group.Id = groupId++;

                foreach (string npc in npcs)
                {
                    string[] npcparts = npc.Split('|');
                    string[] npcparams = npcparts[0].Split(',');

                    // Convert
                    EncounterNpc NpcObj = new EncounterNpc(Int32.Parse(npcparams[0]), Int32.Parse(npcparams[1]), npcparams[2], Int32.Parse(npcparams[3]),npcparams[4] == "1" ? true : false,
                        -1, -1, -1);

                    for (int i = 1; i < npcparts.Length; i++)
                    {
                        string[] itemparam = npcparts[i].Split(',');
                        EncounterItem item = new EncounterItem(Int32.Parse(itemparam[0]), Int32.Parse(itemparam[1]), Int32.Parse(itemparam[2]), Int32.Parse(itemparam[3]));
                        NpcObj.AddItem(item);
                    }

                    Group.Npcs.Add(NpcObj);
                }
                Groups.Add(Group);
            }
            return Groups;
        }
Exemple #5
0
 public void RemoveItem(EncounterItem item)
 {
     Items.Remove(item);
 }
Exemple #6
0
 public void AddItem(EncounterItem item)
 {
     Items.Add(item);
 }
Exemple #7
0
 public void RemoveItem(EncounterItem item)
 {
     Items.Remove(item);
 }
Exemple #8
0
 public void AddItem(EncounterItem item)
 {
     Items.Add(item);
 }