示例#1
0
文件: Icon.cs 项目: Somnium13/SS13
        // Function from file: icons.dm
        public void ColorTone(string tone = null)
        {
            ByTable TONE  = null;
            double  gray  = 0;
            Icon    upper = null;

            this.GrayScale();
            TONE  = GlobalFuncs.ReadRGB(tone);
            gray  = Num13.Round(Convert.ToDouble(TONE[1] * 0.3 + TONE[2] * 0.81 + TONE[3] * 0.01), 1);
            upper = (255 - gray != 0 ? new Icon(this) : null);

            if (gray != 0)
            {
                this.MapColors(255 / gray, 0, 0, 0, 255 / gray, 0, 0, 0, 255 / gray, false, 0, 0);
                this.Blend(tone, 2);
            }
            else
            {
                this.SetIntensity(0);
            }

            if (255 - gray != 0)
            {
                upper.Blend(String13.ColorCode(((int)(gray)), ((int)(gray)), ((int)(gray))), 1);
                upper.MapColors((255 - Convert.ToDouble(TONE[1])) / (255 - gray), 0, 0, 0, 0, (255 - Convert.ToDouble(TONE[2])) / (255 - gray), 0, 0, 0, false, (255 - Convert.ToDouble(TONE[3])) / (255 - gray), 0, 0, 0, 0, 0, 0, 0, 0, 1);
                this.Blend(upper, 0);
            }
            return;
        }
示例#2
0
        // Function from file: photocopier.dm
        public override dynamic Topic(string href = null, ByTable href_list = null, dynamic hsrc = null)
        {
            int?i = null;
            Obj_Item_Weapon_Paper c = null;
            dynamic copied          = null;
            int?    i2 = null;
            Obj_Item_Weapon_Photo p = null;
            Icon I                   = null;
            Icon img                 = null;
            int? i3                  = null;
            Icon temp_img            = null;
            Obj_Item_Weapon_Photo p2 = null;
            Icon    small_img        = null;
            Icon    ic               = null;
            ByTable nametemp         = null;
            dynamic find             = null;
            Picture selection        = null;
            Mob     tempAI           = null;
            Picture t                = null;
            Obj_Item_Weapon_Photo p3 = null;
            Picture q                = null;
            dynamic I2               = null;
            dynamic img2             = null;


            if (Lang13.Bool(base.Topic(href, href_list, (object)(hsrc))))
            {
                return(null);
            }

            if (Lang13.Bool(href_list["copy"]))
            {
                if (Lang13.Bool(this.copy))
                {
                    i = null;
                    i = 0;

                    while ((i ?? 0) < (this.copies ?? 0))
                    {
                        if (this.toner > 0 && !this.busy && Lang13.Bool(this.copy))
                        {
                            c = new Obj_Item_Weapon_Paper(this.loc);

                            if (Lang13.Length(this.copy.info) > 0)
                            {
                                if (this.toner > 10)
                                {
                                    c.info = "<font color = #101010>";
                                }
                                else
                                {
                                    c.info = "<font color = #808080>";
                                }
                                copied   = this.copy.info;
                                copied   = GlobalFuncs.replacetext(copied, "<font face=\"" + "Verdana" + "\" color=", "<font face=\"" + "Verdana" + "\" nocolor=");
                                copied   = GlobalFuncs.replacetext(copied, "<font face=\"" + "Comic Sans MS" + "\" color=", "<font face=\"" + "Comic Sans MS" + "\" nocolor=");
                                c.info  += copied;
                                c.info  += "</font>";
                                c.name   = this.copy.name;
                                c.fields = Lang13.DoubleNullable(this.copy.fields);
                                c.updateinfolinks();
                                this.toner--;
                            }
                            this.busy = true;
                            Task13.Sleep(15);
                            this.busy = false;
                        }
                        else
                        {
                            break;
                        }
                        i++;
                    }
                    this.updateUsrDialog();
                }
                else if (Lang13.Bool(this.photocopy))
                {
                    i2 = null;
                    i2 = 0;

                    while ((i2 ?? 0) < (this.copies ?? 0))
                    {
                        if (this.toner >= 5 && !this.busy && Lang13.Bool(this.photocopy))
                        {
                            p   = new Obj_Item_Weapon_Photo(this.loc);
                            I   = new Icon(this.photocopy.icon, this.photocopy.icon_state);
                            img = new Icon(this.photocopy.img);

                            if (this.greytoggle == "Greyscale")
                            {
                                if (this.toner > 10)
                                {
                                    I.MapColors("#4d4d4d", "#969696", "#1c1c1c", "#000000");
                                    img.MapColors("#4d4d4d", "#969696", "#1c1c1c", "#000000");
                                }
                                else
                                {
                                    I.MapColors("#4d4d4d", "#969696", "#1c1c1c", "#646464");
                                    img.MapColors("#4d4d4d", "#969696", "#1c1c1c", "#646464");
                                }
                                this.toner -= 5;
                            }
                            else if (this.greytoggle == "Color")
                            {
                                if (this.toner >= 10)
                                {
                                    this.toner -= 10;
                                }
                                else
                                {
                                    i2++;
                                    continue;
                                }
                            }
                            p.icon       = I;
                            p.img        = img;
                            p.name       = this.photocopy.name;
                            p.desc       = this.photocopy.desc;
                            p.scribble   = this.photocopy.scribble;
                            p.pixel_x    = Rand13.Int(-10, 10);
                            p.pixel_y    = Rand13.Int(-10, 10);
                            p.blueprints = Lang13.Bool(this.photocopy.blueprints);
                            this.busy    = true;
                            Task13.Sleep(15);
                            this.busy = false;
                        }
                        else
                        {
                            break;
                        }
                        i2++;
                    }
                }
                else if (this.ass != null)
                {
                    i3 = null;
                    i3 = 0;

                    while ((i3 ?? 0) < (this.copies ?? 0))
                    {
                        temp_img = null;

                        if (this.ass is Mob_Living_Carbon_Human && (Lang13.Bool(((Mob)this.ass).get_item_by_slot(14)) || Lang13.Bool(((Mob)this.ass).get_item_by_slot(13))))
                        {
                            Task13.User.WriteMsg("<span class='notice'>You feel kind of silly, copying " + (this.ass == Task13.User ? ((dynamic)("your")) : ((dynamic)(this.ass))) + (this.ass == Task13.User ? "" : "'s") + " ass with " + (this.ass == Task13.User ? "your" : "their") + " clothes on.</span>");
                            break;
                        }
                        else if (this.toner >= 5 && !this.busy && this.check_ass())
                        {
                            if (this.ass is Mob_Living_Carbon_Alien_Humanoid || this.ass is Mob_Living_SimpleAnimal_Hostile_Alien)
                            {
                                temp_img = new Icon("icons/ass/assalien.png");
                            }
                            else if (this.ass is Mob_Living_Carbon_Human)
                            {
                                if (this.ass.gender == GlobalVars.MALE)
                                {
                                    temp_img = new Icon("icons/ass/assmale.png");
                                }
                                else if (this.ass.gender == GlobalVars.FEMALE)
                                {
                                    temp_img = new Icon("icons/ass/assfemale.png");
                                }
                                else
                                {
                                    temp_img = new Icon("icons/ass/assmale.png");
                                }
                            }
                            else if (this.ass is Mob_Living_SimpleAnimal_Drone || this.ass is Mob_Living_SimpleAnimal_Drone)
                            {
                                temp_img = new Icon("icons/ass/assdrone.png");
                            }
                            else
                            {
                                break;
                            }
                            p2         = new Obj_Item_Weapon_Photo(this.loc);
                            p2.desc    = "You see " + this.ass + "'s ass on the photo.";
                            p2.pixel_x = Rand13.Int(-10, 10);
                            p2.pixel_y = Rand13.Int(-10, 10);
                            p2.img     = temp_img;
                            small_img  = new Icon(temp_img);
                            ic         = new Icon("icons/obj/items.dmi", "photo");
                            small_img.Scale(8, 8);
                            ic.Blend(small_img, 3, 10, 13);
                            p2.icon     = ic;
                            this.toner -= 5;
                            this.busy   = true;
                            Task13.Sleep(15);
                            this.busy = false;
                        }
                        else
                        {
                            break;
                        }
                        i3++;
                    }
                }
                this.updateUsrDialog();
            }
            else if (Lang13.Bool(href_list["remove"]))
            {
                if (Lang13.Bool(this.copy))
                {
                    if (!(Task13.User is Mob_Living_Silicon_Ai))
                    {
                        this.copy.loc = Task13.User.loc;
                        Task13.User.put_in_hands(this.copy);
                    }
                    else
                    {
                        this.copy.loc = this.loc;
                    }
                    Task13.User.WriteMsg("<span class='notice'>You take " + this.copy + " out of " + this + ".</span>");
                    this.copy = null;
                    this.updateUsrDialog();
                }
                else if (Lang13.Bool(this.photocopy))
                {
                    if (!(Task13.User is Mob_Living_Silicon_Ai))
                    {
                        this.photocopy.loc = Task13.User.loc;
                        Task13.User.put_in_hands(this.photocopy);
                    }
                    else
                    {
                        this.photocopy.loc = this.loc;
                    }
                    Task13.User.WriteMsg("<span class='notice'>You take " + this.photocopy + " out of " + this + ".</span>");
                    this.photocopy = null;
                    this.updateUsrDialog();
                }
                else if (this.check_ass())
                {
                    ((dynamic)this.ass).WriteMsg("<span class='notice'>You feel a slight pressure on your ass.</span>");
                }
            }
            else if (Lang13.Bool(href_list["min"]))
            {
                if ((this.copies ?? 0) > 1)
                {
                    this.copies--;
                    this.updateUsrDialog();
                }
            }
            else if (Lang13.Bool(href_list["add"]))
            {
                if ((this.copies ?? 0) < (this.maxcopies ?? 0))
                {
                    this.copies++;
                    this.updateUsrDialog();
                }
            }
            else if (Lang13.Bool(href_list["aipic"]))
            {
                if (!(Task13.User is Mob_Living_Silicon_Ai))
                {
                    return(null);
                }

                if (this.toner >= 5 && !this.busy)
                {
                    nametemp  = new ByTable();
                    find      = null;
                    selection = null;
                    tempAI    = Task13.User;

                    if (((dynamic)tempAI).aicamera.aipictures.len == 0)
                    {
                        Task13.User.WriteMsg("<span class='boldannounce'>No images saved</span>");
                        return(null);
                    }

                    foreach (dynamic _a in Lang13.Enumerate(((dynamic)tempAI).aicamera.aipictures, typeof(Picture)))
                    {
                        t = _a;

                        nametemp.Add(t.fields["name"]);
                    }
                    find = Interface13.Input("Select image (numbered in order taken)", null, null, null, nametemp, InputType.Any);
                    p3   = new Obj_Item_Weapon_Photo(this.loc);

                    foreach (dynamic _b in Lang13.Enumerate(((dynamic)tempAI).aicamera.aipictures, typeof(Picture)))
                    {
                        q = _b;


                        if (q.fields["name"] == find)
                        {
                            selection = q;
                            break;
                        }
                    }
                    I2            = selection.fields["icon"];
                    img2          = selection.fields["img"];
                    p3.icon       = I2;
                    p3.img        = img2;
                    p3.desc       = selection.fields["desc"];
                    p3.blueprints = Lang13.Bool(selection.fields["blueprints"]);
                    p3.pixel_x    = Rand13.Int(-10, 10);
                    p3.pixel_y    = Rand13.Int(-10, 10);
                    this.toner   -= 5;
                    this.busy     = true;
                    Task13.Sleep(15);
                    this.busy = false;
                }
                this.updateUsrDialog();
            }
            else if (Lang13.Bool(href_list["colortoggle"]))
            {
                if (this.greytoggle == "Greyscale")
                {
                    this.greytoggle = "Color";
                }
                else
                {
                    this.greytoggle = "Greyscale";
                }
                this.updateUsrDialog();
            }
            return(null);
        }