Example #1
0
    public JSONObject jsonify()
    {
        JSONObject json = new JSONObject(JSONObject.Type.OBJECT);

        json.AddField("name", Name);
        json.AddField("basevalue", BaseValue);

        json.AddField("type", type.ToString());
        json.AddField("potency", potency);

        return(json);
    }
        public static string ToDescription(this ConsumableType type)
        {
            var    attributes  = (DescriptionAttribute[])type.GetType().GetField(type.ToString()).GetCustomAttributes(typeof(DescriptionAttribute), false);
            string description = attributes.Length > 0 ? attributes[0].Description : string.Empty;
            string result      = string.Empty;

            if (!string.IsNullOrEmpty(description))
            {
                result = typeof(LanguageData).GetProperty(description).GetValue(null, null) as string;
            }
            return(result);
        }
Example #3
0
        private void AddPicture(ConsumableType CType)
        {
            PictureBox pb = (PictureBox)PlacementCollection["consumable" + LastControl];

            pb.AccessibleName = CType.ToString();

            if (imageMap.ContainsKey(CType))
            {
                pb.Image = imageMap[CType];
            }
            else
            {
                pb.Image = null;
            }
            pb.Refresh();
            pb.Visible = true;
        }
Example #4
0
 public static void ShowKnownItems(Dict<ConsumableType,bool> IDed)
 {
     MouseUI.PushButtonMap();
     UI.draw_bottom_commands = false;
     UI.darken_status_bar = true;
     const int width = 25;
     List<ConsumableType> potion_order = new List<ConsumableType>{ConsumableType.STONEFORM,ConsumableType.CLOAKING,ConsumableType.VAMPIRISM,ConsumableType.HEALING,ConsumableType.MYSTIC_MIND,ConsumableType.SILENCE,ConsumableType.REGENERATION,ConsumableType.ROOTS,ConsumableType.BRUTISH_STRENGTH,ConsumableType.HASTE};
     List<ConsumableType> scroll_order = new List<ConsumableType>{ConsumableType.SUNLIGHT,ConsumableType.DARKNESS,ConsumableType.BLINKING,ConsumableType.RENEWAL,ConsumableType.FIRE_RING,ConsumableType.CALLING,ConsumableType.KNOWLEDGE,ConsumableType.PASSAGE,ConsumableType.THUNDERCLAP,ConsumableType.RAGE,ConsumableType.ENCHANTMENT,ConsumableType.TIME,ConsumableType.TRAP_CLEARING};
     List<ConsumableType> orb_order = new List<ConsumableType>{ConsumableType.BREACHING,ConsumableType.FREEZING,ConsumableType.SHIELDING,ConsumableType.BLADES,ConsumableType.CONFUSION,ConsumableType.FLAMES,ConsumableType.DETONATION,ConsumableType.PAIN,ConsumableType.TELEPORTAL,ConsumableType.FOG};
     List<ConsumableType> wand_order = new List<ConsumableType>{ConsumableType.DUST_STORM,ConsumableType.SLUMBER,ConsumableType.TELEKINESIS,ConsumableType.REACH,ConsumableType.INVISIBILITY,ConsumableType.WEBS,ConsumableType.FLESH_TO_FIRE};
     List<colorstring> potions = new List<colorstring>();
     List<colorstring> scrolls = new List<colorstring>();
     List<colorstring> orbs = new List<colorstring>();
     List<colorstring> wands = new List<colorstring>();
     List<List<colorstring>> string_lists = new List<List<colorstring>>{potions,scrolls,orbs,wands};
     int list_idx = 0;
     foreach(List<ConsumableType> item_list in new List<List<ConsumableType>>{potion_order,scroll_order,orb_order,wand_order}){
         int item_idx = 0;
         while(item_idx + 1 < item_list.Count){
             ConsumableType[] ct = new ConsumableType[2];
             string[] name = new string[2];
             Color[] ided_color = new Color[2];
             for(int i=0;i<2;++i){
                 ct[i] = item_list[item_idx + i];
                 name[i] = ct[i].ToString()[0] + ct[i].ToString().Substring(1).ToLower();
                 name[i] = name[i].Replace('_',' ');
                 if(IDed[ct[i]]){
                     ided_color[i] = Color.Cyan;
                 }
                 else{
                     ided_color[i] = Color.DarkGray;
                 }
             }
             int num_spaces = width - (name[0].Length + name[1].Length);
             string_lists[list_idx].Add(new colorstring(name[0],ided_color[0],"".PadRight(num_spaces),Color.Black,name[1],ided_color[1]));
             item_idx += 2;
         }
         if(item_list.Count % 2 == 1){
             ConsumableType ct = item_list.Last();
             string name = (ct.ToString()[0] + ct.ToString().Substring(1).ToLower()).Replace('_',' ');
             //name = name[i].Replace('_',' ');
             Color ided_color = Color.DarkGray;
             if(IDed[ct]){
                 ided_color = Color.Cyan;
             }
             int num_spaces = width - name.Length;
             string_lists[list_idx].Add(new colorstring(name,ided_color,"".PadRight(num_spaces),Color.Black));
         }
         ++list_idx;
     }
     Screen.WriteMapString(0,0,"".PadRight(COLS,'-'));
     for(int i=1;i<ROWS+2;++i){
         Screen.WriteMapString(i,0,"".PadToMapSize());
     }
     Screen.WriteMapString(ROWS+2,0,"".PadRight(COLS,'-'));
     const Color label_color = Color.Yellow;
     const int first_column_offset = 2;
     const int second_column_offset = first_column_offset + 35;
     const int first_item_row = 4;
     Screen.WriteMapString(first_item_row - 1,8 + first_column_offset,"- Potions -",label_color);
     Screen.WriteMapString(first_item_row - 1,7 + second_column_offset,"- Scrolls -",label_color);
     int line = first_item_row;
     foreach(colorstring s in potions){
         Screen.WriteMapString(line,first_column_offset,s);
         ++line;
     }
     line = first_item_row;
     foreach(colorstring s in scrolls){
         Screen.WriteMapString(line,second_column_offset,s);
         ++line;
     }
     const int second_item_row = first_item_row + 11;
     Screen.WriteMapString(second_item_row - 1,9 + first_column_offset,"- Orbs -",label_color);
     Screen.WriteMapString(second_item_row - 1,8 + second_column_offset,"- Wands -",label_color);
     line = second_item_row;
     foreach(colorstring s in orbs){
         Screen.WriteMapString(line,first_column_offset,s);
         ++line;
     }
     line = second_item_row;
     foreach(colorstring s in wands){
         Screen.WriteMapString(line,second_column_offset,s);
         ++line;
     }
     B.DisplayNow("Discovered item types: ");
     Screen.CursorVisible = true;
     Input.ReadKey();
     MouseUI.PopButtonMap();
     UI.draw_bottom_commands = true;
     UI.darken_status_bar = false;
 }
Example #5
0
        public static void ShowKnownItems(Hash <ConsumableType> IDed)
        {
            MouseUI.PushButtonMap();
            UI.draw_bottom_commands = false;
            UI.darken_status_bar    = true;
            const int             width        = 25;
            List <ConsumableType> potion_order = new List <ConsumableType> {
                ConsumableType.STONEFORM, ConsumableType.CLOAKING, ConsumableType.VAMPIRISM, ConsumableType.HEALING, ConsumableType.MYSTIC_MIND, ConsumableType.SILENCE, ConsumableType.REGENERATION, ConsumableType.ROOTS, ConsumableType.BRUTISH_STRENGTH, ConsumableType.HASTE
            };
            List <ConsumableType> scroll_order = new List <ConsumableType> {
                ConsumableType.SUNLIGHT, ConsumableType.DARKNESS, ConsumableType.BLINKING, ConsumableType.RENEWAL, ConsumableType.FIRE_RING, ConsumableType.CALLING, ConsumableType.KNOWLEDGE, ConsumableType.PASSAGE, ConsumableType.THUNDERCLAP, ConsumableType.RAGE, ConsumableType.ENCHANTMENT, ConsumableType.TIME, ConsumableType.TRAP_CLEARING
            };
            List <ConsumableType> orb_order = new List <ConsumableType> {
                ConsumableType.BREACHING, ConsumableType.FREEZING, ConsumableType.SHIELDING, ConsumableType.BLADES, ConsumableType.CONFUSION, ConsumableType.FLAMES, ConsumableType.DETONATION, ConsumableType.PAIN, ConsumableType.TELEPORTAL, ConsumableType.FOG
            };
            List <ConsumableType> wand_order = new List <ConsumableType> {
                ConsumableType.DUST_STORM, ConsumableType.SLUMBER, ConsumableType.TELEKINESIS, ConsumableType.REACH, ConsumableType.INVISIBILITY, ConsumableType.WEBS, ConsumableType.FLESH_TO_FIRE
            };
            List <colorstring>         potions      = new List <colorstring>();
            List <colorstring>         scrolls      = new List <colorstring>();
            List <colorstring>         orbs         = new List <colorstring>();
            List <colorstring>         wands        = new List <colorstring>();
            List <List <colorstring> > string_lists = new List <List <colorstring> > {
                potions, scrolls, orbs, wands
            };
            int list_idx = 0;

            foreach (List <ConsumableType> item_list in new List <List <ConsumableType> > {
                potion_order, scroll_order, orb_order, wand_order
            })
            {
                int item_idx = 0;
                while (item_idx + 1 < item_list.Count)
                {
                    ConsumableType[] ct         = new ConsumableType[2];
                    string[]         names      = new string[2];
                    Color[]          ided_color = new Color[2];
                    for (int i = 0; i < 2; ++i)
                    {
                        ct[i]    = item_list[item_idx + i];
                        names[i] = ct[i].ToString()[0] + ct[i].ToString().Substring(1).ToLower();
                        names[i] = names[i].Replace('_', ' ');
                        if (IDed[ct[i]])
                        {
                            ided_color[i] = Color.Cyan;
                        }
                        else
                        {
                            ided_color[i] = Color.DarkGray;
                        }
                    }
                    int num_spaces = width - (names[0].Length + names[1].Length);
                    string_lists[list_idx].Add(new colorstring(names[0], ided_color[0], "".PadRight(num_spaces), Color.Black, names[1], ided_color[1]));
                    item_idx += 2;
                }
                if (item_list.Count % 2 == 1)
                {
                    ConsumableType ct = item_list.Last();
                    string         n  = (ct.ToString()[0] + ct.ToString().Substring(1).ToLower()).Replace('_', ' ');
                    //name = name[i].Replace('_',' ');
                    Color ided_color = Color.DarkGray;
                    if (IDed[ct])
                    {
                        ided_color = Color.Cyan;
                    }
                    int num_spaces = width - n.Length;
                    string_lists[list_idx].Add(new colorstring(n, ided_color, "".PadRight(num_spaces), Color.Black));
                }
                ++list_idx;
            }
            Screen.WriteMapString(0, 0, "".PadRight(COLS, '-'));
            for (int i = 1; i < ROWS + 2; ++i)
            {
                Screen.WriteMapString(i, 0, "".PadToMapSize());
            }
            Screen.WriteMapString(ROWS + 2, 0, "".PadRight(COLS, '-'));
            const Color label_color          = Color.Yellow;
            const int   first_column_offset  = 2;
            const int   second_column_offset = first_column_offset + 35;
            const int   first_item_row       = 4;

            Screen.WriteMapString(first_item_row - 1, 8 + first_column_offset, "- Potions -", label_color);
            Screen.WriteMapString(first_item_row - 1, 7 + second_column_offset, "- Scrolls -", label_color);
            int line = first_item_row;

            foreach (colorstring s in potions)
            {
                Screen.WriteMapString(line, first_column_offset, s);
                ++line;
            }
            line = first_item_row;
            foreach (colorstring s in scrolls)
            {
                Screen.WriteMapString(line, second_column_offset, s);
                ++line;
            }
            const int second_item_row = first_item_row + 11;

            Screen.WriteMapString(second_item_row - 1, 9 + first_column_offset, "- Orbs -", label_color);
            Screen.WriteMapString(second_item_row - 1, 8 + second_column_offset, "- Wands -", label_color);
            line = second_item_row;
            foreach (colorstring s in orbs)
            {
                Screen.WriteMapString(line, first_column_offset, s);
                ++line;
            }
            line = second_item_row;
            foreach (colorstring s in wands)
            {
                Screen.WriteMapString(line, second_column_offset, s);
                ++line;
            }
            UI.Display("Discovered item types: ");
            Input.ReadKey();
            MouseUI.PopButtonMap();
            UI.draw_bottom_commands = true;
            UI.darken_status_bar    = false;
        }