Esempio n. 1
0
        public void UpdatePassiveSkills(Toon toon)
        {
            Logger.Debug("Update passive to {0} {1} {2}", PassiveSkills[0], PassiveSkills[1], PassiveSkills[2]);
            var dbToon = DBSessions.AccountSession.Get <DBToon>(toon.PersistentID);

            dbToon.DBActiveSkills.Passive0 = PassiveSkills[0];
            dbToon.DBActiveSkills.Passive1 = PassiveSkills[1];
            dbToon.DBActiveSkills.Passive2 = PassiveSkills[2];

            DBSessions.AccountSession.SaveOrUpdate(dbToon.DBActiveSkills);
            DBSessions.AccountSession.Flush();
        }
Esempio n. 2
0
        private ByteString CreateHero(D3.OnlineService.HeroCreateParams createPrams)
        {
            int hashCode = ToonManager.GetUnusedHashCodeForToonName(createPrams.Name);
            var newToon  = new Toon(createPrams.Name, hashCode, createPrams.GbidClass, createPrams.IsFemale ? ToonFlags.Female : ToonFlags.Male, 1, Client.Account.CurrentGameAccount);

            if (ToonManager.SaveToon(newToon))
            {
                Logger.Trace("CreateHero() {0}", newToon);
                return(newToon.D3EntityID.ToByteString());
            }
            return(ByteString.Empty);
        }
Esempio n. 3
0
 public void SwitchUpdateSkills(int oldSNOSkill, int SNOSkill, int SNORune, Toon toon)
 {
     for (int i = 0; i < this.HotBarSkills.Length; i++)
     {
         if (this.HotBarSkills[i].SNOSkill == oldSNOSkill)
         {
             Logger.Debug("SkillSet: SwitchUpdateSkill Oldskill {0} Newskill {1}", oldSNOSkill, SNOSkill);
             this.HotBarSkills[i].SNOSkill = SNOSkill;
             this.UpdateSkills(i, SNOSkill, SNORune, toon);
             return;
         }
     }
 }
Esempio n. 4
0
        public override void CreateToon(Google.ProtocolBuffers.IRpcController controller, CreateToonRequest request, Action <CreateToonResponse> done)
        {
            Logger.Trace("CreateToon()");
            var heroCreateParams = D3.OnlineService.HeroCreateParams.ParseFrom(request.AttributeList[0].Value.MessageValue);
            var builder          = CreateToonResponse.CreateBuilder();

            var toon = new Toon(request.Name, heroCreateParams.GbidClass, heroCreateParams.IsFemale ? ToonFlags.Female : ToonFlags.Male, 1, Client.Account);

            if (ToonManager.SaveToon(toon))
            {
                builder.SetToon(toon.BnetEntityID);
            }
            done(builder.Build());
        }
Esempio n. 5
0
        public void UpdatePassiveSkills(Toon toon, Player player)
        {
            Logger.Debug("Update passive to {0} {1} {2}", PassiveSkills[0], PassiveSkills[1], PassiveSkills[2]);
            var dbToon = DBSessions.AccountSession.Get <DBToon>(toon.PersistentID);

            dbToon.DBActiveSkills.Passive0 = PassiveSkills[0];
            dbToon.DBActiveSkills.Passive1 = PassiveSkills[1];
            dbToon.DBActiveSkills.Passive2 = PassiveSkills[2];

            // PassiveSkillEffects when character Update the passives [Necrosummon]
            PassiveSkillsEffects(player);

            DBSessions.AccountSession.SaveOrUpdate(dbToon.DBActiveSkills);
            DBSessions.AccountSession.Flush();
        }
Esempio n. 6
0
        public void UpdateAssignedSkill(int skillIndex, int SNOSkill, Toon toon)
        {
            //Fill DB with some entry if is the first time this toon try to put data on DB.
            switch (skillIndex)
            {
            case 0:
                Logger.Debug("UpdateAssignedSkill: index 0 {0}", SNOSkill);
                var query_0 = string.Format("UPDATE current_active_skills SET a_skill0={1} WHERE id_toon={0} ", toon.D3EntityID.IdLow, SNOSkill);
                var cmd_0   = new SQLiteCommand(query_0, DBManager.Connection);
                cmd_0.ExecuteReader();
                break;

            case 1:
                Logger.Debug("UpdateAssignedSkill: index 1 {0}", SNOSkill);
                var query_1 = string.Format("UPDATE current_active_skills SET a_skill1={1} WHERE id_toon={0} ", toon.D3EntityID.IdLow, SNOSkill);
                var cmd_1   = new SQLiteCommand(query_1, DBManager.Connection);
                cmd_1.ExecuteReader();
                break;

            case 2:
                Logger.Debug("UpdateAssignedSkill: index 2 {0}", SNOSkill);
                var query_2 = string.Format("UPDATE current_active_skills SET a_skill2={1} WHERE id_toon={0} ", toon.D3EntityID.IdLow, SNOSkill);
                var cmd_2   = new SQLiteCommand(query_2, DBManager.Connection);
                cmd_2.ExecuteReader();
                break;

            case 3:
                Logger.Debug("UpdateAssignedSkill: index 3 {0}", SNOSkill);
                var query_3 = string.Format("UPDATE current_active_skills SET a_skill3={1} WHERE id_toon={0} ", toon.D3EntityID.IdLow, SNOSkill);
                var cmd_3   = new SQLiteCommand(query_3, DBManager.Connection);
                cmd_3.ExecuteReader();
                break;

            case 4:
                Logger.Debug("UpdateAssignedSkill: index 4 {0}", SNOSkill);
                var query_4 = string.Format("UPDATE current_active_skills SET a_skill4={1} WHERE id_toon={0} ", toon.D3EntityID.IdLow, SNOSkill);
                var cmd_4   = new SQLiteCommand(query_4, DBManager.Connection);
                cmd_4.ExecuteReader();
                break;

            case 5:
                Logger.Debug("UpdateAssignedSkill: index 5 {0}", SNOSkill);
                var query_5 = string.Format("UPDATE current_active_skills SET a_skill5={1} WHERE id_toon={0} ", toon.D3EntityID.IdLow, SNOSkill);
                var cmd_5   = new SQLiteCommand(query_5, DBManager.Connection);
                cmd_5.ExecuteReader();
                break;
            }
        }
Esempio n. 7
0
            public string Save(string[] @params, LogNetClient invokerClient)
            {
                if (invokerClient == null)
                {
                    return("You can not invoke this command from console.");
                }

                if (invokerClient.InGameClient == null)
                {
                    return("You can only invoke this command while ingame.");
                }

                Toon toon   = invokerClient.Account.CurrentGameAccount.CurrentToon;
                var  dbToon = DBSessions.AccountSession.Get <DBToon>(toon.PersistentID);

                DBSessions.AccountSession.SaveOrUpdate(dbToon);
                DBSessions.AccountSession.Flush();

                return(string.Format("Player saved {0}", toon.Name));
            }
Esempio n. 8
0
        public void UpdateSkills(int hotBarIndex, int SNOSkill, int SNORune, Toon toon)
        {
            Logger.Debug("Update index {0} skill {1} rune {2}", hotBarIndex, SNOSkill, SNORune);
            var dbToon = DBSessions.AccountSession.Get <DBToon>(toon.PersistentID);

            switch (hotBarIndex)
            {
            case 0:
                dbToon.DBActiveSkills.Skill0 = SNOSkill;
                dbToon.DBActiveSkills.Rune0  = SNORune;
                break;

            case 1:
                dbToon.DBActiveSkills.Skill1 = SNOSkill;
                dbToon.DBActiveSkills.Rune1  = SNORune;
                break;

            case 2:
                dbToon.DBActiveSkills.Skill2 = SNOSkill;
                dbToon.DBActiveSkills.Rune2  = SNORune;
                break;

            case 3:
                dbToon.DBActiveSkills.Skill3 = SNOSkill;
                dbToon.DBActiveSkills.Rune3  = SNORune;
                break;

            case 4:
                dbToon.DBActiveSkills.Skill4 = SNOSkill;
                dbToon.DBActiveSkills.Rune4  = SNORune;
                break;

            case 5:
                dbToon.DBActiveSkills.Skill5 = SNOSkill;
                dbToon.DBActiveSkills.Rune5  = SNORune;
                break;
            }
            DBSessions.AccountSession.SaveOrUpdate(dbToon.DBActiveSkills);
            DBSessions.AccountSession.Flush();
        }
Esempio n. 9
0
            public string ChangeName(string[] @params, LogNetClient invokerClient)
            {
                if (invokerClient == null)
                {
                    return("You can not invoke this command from console.");
                }

                if (invokerClient.InGameClient == null)
                {
                    return("You can only invoke this command while ingame.");
                }

                GameAccount account      = invokerClient.Account.CurrentGameAccount;
                Toon        toon         = invokerClient.Account.CurrentGameAccount.CurrentToon;
                var         dbToon       = DBSessions.AccountSession.Get <DBToon>(toon.PersistentID);
                string      PreviousName = toon.DBToon.Name; // Current character name before the name change. [Necrosummon]

                if (@params == null)
                {
                    return("Enter a name (only characters)");
                }

                // Check @params string if only contain letters, if not, name will not change. [Necrosummon]
                foreach (char ch in @params[0])
                {
                    if (!Char.IsLetter(ch) && ch != 32)
                    {
                        return("Only letters");
                    }
                }

                // New name = string
                toon.DBToon.Name = @params[0];

                // Update Database
                DBSessions.AccountSession.SaveOrUpdate(dbToon);
                DBSessions.AccountSession.Flush();

                return(string.Format("Player named {0} changed to {1}", PreviousName, toon.Name));
            }
Esempio n. 10
0
        private void Add_Click(object sender, RoutedEventArgs e)
        {
            if (ToonTitle.Text == "Enter title" || ToonUrl.Text == "Enter url")
            {
                Verbose.Text += "Please input a valid entry." + "\n";
                return;
            }

            if (ToonUrl.Text.Contains("https://www.webtoons.com"))
            {
                ToonUrl.Text = ToonUrl.Text.Replace("https://www.webtoons.com", "");
            }

            Toon tun = new Toon()
            {
                Title = ToonTitle.Text, Url = ToonUrl.Text
            };

            toons.Add(tun);
            QueueList.Items.Add(tun);

            if (!StartBtn.IsEnabled)
            {
                StartBtn.IsEnabled      = true;
                HtmlCheckbox.IsEnabled  = true;
                HtmlCheckbox.Foreground = new SolidColorBrush(Colors.White);
            }

            if (!ClearQueue.IsEnabled)
            {
                ClearQueue.IsEnabled = true;
            }

            ToonTitle.Text       = "Enter title";
            ToonUrl.Text         = "Enter url";
            ToonTitle.Foreground = new SolidColorBrush(Colors.DarkGray);
            ToonUrl.Foreground   = new SolidColorBrush(Colors.DarkGray);
        }
Esempio n. 11
0
        public override void CreateToon(Google.ProtocolBuffers.IRpcController controller, bnet.protocol.toon.external.CreateToonRequest request, Action <bnet.protocol.toon.external.CreateToonResponse> done)
        {
            var heroCreateParams = D3.OnlineService.HeroCreateParams.ParseFrom(request.AttributeList[0].Value.MessageValue);
            var builder          = bnet.protocol.toon.external.CreateToonResponse.CreateBuilder();

            int hashCode = ToonManager.GetUnusedHashCodeForToonName(request.Name);
            var toon     = new Toon(request.Name, hashCode, heroCreateParams.GbidClass, heroCreateParams.IsFemale ? ToonFlags.Female : ToonFlags.Male, 30, Client.Account);

            if (ToonManager.SaveToon(toon))
            {
                builder.SetToken((uint)toon.BnetEntityID.Low);
            }
            done(builder.Build());

            var notification = bnet.protocol.toon.external.ToonCreatedNotification.CreateBuilder()
                               .SetToon(toon.BnetEntityID)
                               .SetToken((uint)toon.BnetEntityID.Low)
                               .SetErrorCode(0).Build();

            this.Client.MakeRPC(() => bnet.protocol.toon.external.ToonNotifyExternal.CreateStub(this.Client).NotifyToonCreated(null, notification, callback => { }));

            Logger.Trace("CreateToon() {0}", toon);
        }
Esempio n. 12
0
        public SkillSet(ToonClass @class, Toon toon)
        {
            this.@Class = @class;
            var dbToon = DBSessions.AccountSession.Get <DBToon>(toon.PersistentID);

            if (dbToon.DBActiveSkills == null)
            {
                int[] ActiveSkillsList = Skills.GetAllActiveSkillsByClass(this.@Class).Take(1).ToArray();

                this.ActiveSkills = new ActiveSkillSavedData[6] {
                    new ActiveSkillSavedData {
                        snoSkill = ActiveSkillsList[0], snoRune = -1
                    },
                    new ActiveSkillSavedData {
                        snoSkill = Skills.None, snoRune = -1
                    },
                    new ActiveSkillSavedData {
                        snoSkill = Skills.None, snoRune = -1
                    },
                    new ActiveSkillSavedData {
                        snoSkill = Skills.None, snoRune = -1
                    },
                    new ActiveSkillSavedData {
                        snoSkill = Skills.None, snoRune = -1
                    },
                    new ActiveSkillSavedData {
                        snoSkill = Skills.None, snoRune = -1
                    }
                };

                this.PassiveSkills = new int[3] {
                    -1, -1, -1,
                };


                dbToon.DBActiveSkills = new DBActiveSkills
                {
                    Skill0   = ActiveSkillsList[0],
                    Skill1   = -1,
                    Skill2   = -1,
                    Skill3   = -1,
                    Skill4   = -1,
                    Skill5   = -1,
                    Rune0    = -1,
                    Rune1    = -1,
                    Rune2    = -1,
                    Rune3    = -1,
                    Rune4    = -1,
                    Rune5    = -1,
                    Passive0 = -1,
                    Passive1 = -1,
                    Passive2 = -1
                };
                DBSessions.AccountSession.SaveOrUpdate(dbToon.DBActiveSkills);
                DBSessions.AccountSession.Flush();
            }
            else
            {
                this.ActiveSkills = new ActiveSkillSavedData[6] {
                    new ActiveSkillSavedData {
                        snoSkill = dbToon.DBActiveSkills.Skill0,
                        snoRune  = dbToon.DBActiveSkills.Rune0
                    },
                    new ActiveSkillSavedData {
                        snoSkill = dbToon.DBActiveSkills.Skill1,
                        snoRune  = dbToon.DBActiveSkills.Rune1
                    },
                    new ActiveSkillSavedData {
                        snoSkill = dbToon.DBActiveSkills.Skill2,
                        snoRune  = dbToon.DBActiveSkills.Rune2
                    },
                    new ActiveSkillSavedData {
                        snoSkill = dbToon.DBActiveSkills.Skill3,
                        snoRune  = dbToon.DBActiveSkills.Rune3
                    },
                    new ActiveSkillSavedData {
                        snoSkill = dbToon.DBActiveSkills.Skill4,
                        snoRune  = dbToon.DBActiveSkills.Rune4
                    },
                    new ActiveSkillSavedData {
                        snoSkill = dbToon.DBActiveSkills.Skill5,
                        snoRune  = dbToon.DBActiveSkills.Rune5
                    },
                };
                this.PassiveSkills = new int[3] {
                    dbToon.DBActiveSkills.Passive0,
                    dbToon.DBActiveSkills.Passive1,
                    dbToon.DBActiveSkills.Passive2,
                };
            }

            this.HotBarSkills = new HotbarButtonData[6] {
                new HotbarButtonData {
                    SNOSkill = ActiveSkills[0].snoSkill, Field1 = -1, ItemGBId = -1
                },                                                                                        // left-click
                new HotbarButtonData {
                    SNOSkill = ActiveSkills[1].snoSkill, Field1 = -1, ItemGBId = -1
                },                                                                                        // right-click
                new HotbarButtonData {
                    SNOSkill = ActiveSkills[2].snoSkill, Field1 = -1, ItemGBId = -1
                },                                                                                        // bar-1
                new HotbarButtonData {
                    SNOSkill = ActiveSkills[3].snoSkill, Field1 = -1, ItemGBId = -1
                },                                                                                        // bar-2
                new HotbarButtonData {
                    SNOSkill = ActiveSkills[4].snoSkill, Field1 = -1, ItemGBId = -1
                },                                                                                        // bar-3
                new HotbarButtonData {
                    SNOSkill = ActiveSkills[5].snoSkill, Field1 = -1, ItemGBId = -1
                },                                                                                        // bar-4
            };
        }
Esempio n. 13
0
        public Hero(GameClient client, Universe universe, Toon toon)
        {
            RevealedWorlds = new List <World>();
            RevealedScenes = new List <Scene>();
            RevealedActors = new List <Actor>();

            this.InGameClient    = client;
            this.Universe        = universe;
            this.Properties      = toon;
            this.CurrentWorldSNO = 0x115EE;

            // actor values
            this.Id             = 0x789E00E2;
            this.SnoId          = this.ClassSNO;
            this.Field2         = 0x00000009;
            this.Field3         = 0x00000000;
            this.Scale          = ModelScale;
            this.RotationAmount = 0.05940768f;
            this.RotationAxis   = new Vector3D(0f, 0f, 0.9982339f);

            //initial world and position
            this.WorldId = 0x772E0000;
            //new char starter pos:
            this.Position.X = 3143.75f;
            this.Position.Y = 2828.75f;
            this.Position.Z = 59.075588f;

            //den of evil:
            //this.Position.X = 2526.250000f;
            //this.Position.Y = 2098.750000f;
            //this.Position.Z = -5.381495f;

            //inn:
            //this.Position.X = 2996.250000f;
            //this.Position.Y = 2793.750000f;
            //this.Position.Z = 24.045330f;

            //this.Position.X = 1768.750000f;
            //this.Position.Y = 2921.250000f;
            //this.Position.Z = 20.333143f;

            //this.Position.X = 2041.250000f;
            //this.Position.Y = 1778.750000f;
            //this.Position.Z = 0.426203f;

            //defiled crypt level 2
            //this.WorldId = 2000289804;
            //this.Position.X = 158.750000f;
            //this.Position.Y = 76.250000f;
            //this.Position.Z = 0.100000f;

            this.GBHandle = new GBHandle()
            {
                Field0 = 0x00000007,
                Field1 = this.Properties.ClassID,
            };

            this.Field7  = -1;
            this.Field8  = -1;
            this.Field9  = 0x00000000;
            this.Field10 = 0x0;
        }
Esempio n. 14
0
        public SkillSet(ToonClass @class, Toon toon)
        {
            this.@Class = @class;


            this.CurrentActiveSkills = Skills.GetAllActiveSkillsByClass(this.@Class).Take(6).ToArray();

            var query  = string.Format("SELECT * from active_skills WHERE id_toon={0}", toon.D3EntityID.IdLow);
            var cmd    = new SQLiteCommand(query, DBManager.Connection);
            var reader = cmd.ExecuteReader();

            //30592 base attack

            if (!reader.HasRows)  //this is just in case something goes wrong on  public void SaveToDB() -> we need to change this name ...
            {
                var query_first_insert = string.Format("INSERT INTO  active_skills (id_toon,skill_0,skill_1,skill_2,skill_3,skill_4,skill_5) VALUES ({0},{1},{2},{3},{4},{5},{6} )", toon.D3EntityID.IdLow, this.CurrentActiveSkills[0], 30592, Skills.None, Skills.None, Skills.None, Skills.None, Skills.None);
                var cmd_first_insert   = new SQLiteCommand(query_first_insert, DBManager.Connection);
                cmd_first_insert.ExecuteReader();
                Logger.Debug("SkillSet: No Entry for {0}", toon.D3EntityID.IdLow);
                this.HotBarSkills = new HotbarButtonData[9] {
                    new HotbarButtonData {
                        SNOSkill = this.CurrentActiveSkills[0], ItemGBId = -1
                    },                                                                          // left-click
                    new HotbarButtonData {
                        SNOSkill = 30592, ItemGBId = -1
                    },                                                    // right-click
                    new HotbarButtonData {
                        SNOSkill = Skills.None, ItemGBId = -1
                    },                                                          // hidden-bar - left-click switch - which key??
                    new HotbarButtonData {
                        SNOSkill = Skills.None, ItemGBId = -1
                    },                                                          // hidden-bar - right-click switch (press x ingame)
                    new HotbarButtonData {
                        SNOSkill = Skills.None, ItemGBId = -1
                    },                                                          // bar-1
                    new HotbarButtonData {
                        SNOSkill = Skills.None, ItemGBId = -1
                    },                                                          // bar-2
                    new HotbarButtonData {
                        SNOSkill = Skills.None, ItemGBId = -1
                    },                                                          // bar-3
                    new HotbarButtonData {
                        SNOSkill = Skills.None, ItemGBId = -1
                    },                                                          // bar-4
                    new HotbarButtonData {
                        SNOSkill = Skills.None, ItemGBId = 0x622256D4
                    }                                                                  // bar-5 - potion
                };
            }
            else
            {
                this.HotBarSkills = new HotbarButtonData[9] {
                    new HotbarButtonData {
                        SNOSkill = (int)reader["skill_0"], ItemGBId = -1
                    },                                                                     // left-click
                    new HotbarButtonData {
                        SNOSkill = (int)reader["skill_1"], ItemGBId = -1
                    },                                                                     // right-click
                    new HotbarButtonData {
                        SNOSkill = Skills.None, ItemGBId = -1
                    },                                                          // hidden-bar - left-click switch - which key??
                    new HotbarButtonData {
                        SNOSkill = Skills.None, ItemGBId = -1
                    },                                                          // hidden-bar - right-click switch (press x ingame)
                    new HotbarButtonData {
                        SNOSkill = (int)reader["skill_5"], ItemGBId = -1
                    },                                                                     // bar-1
                    new HotbarButtonData {
                        SNOSkill = (int)reader["skill_4"], ItemGBId = -1
                    },                                                                     // bar-2
                    new HotbarButtonData {
                        SNOSkill = (int)reader["skill_3"], ItemGBId = -1
                    },                                                                     // bar-3
                    new HotbarButtonData {
                        SNOSkill = (int)reader["skill_2"], ItemGBId = -1
                    },                                                                     // bar-4
                    new HotbarButtonData {
                        SNOSkill = Skills.None, ItemGBId = 0x622256D4
                    }                                                                  // bar-5 - potion
                };
            }


            //Current Active Skills part

            var query_as  = string.Format("SELECT * from current_active_skills WHERE id_toon={0}", toon.D3EntityID.IdLow);
            var cmd_as    = new SQLiteCommand(query_as, DBManager.Connection);
            var reader_as = cmd_as.ExecuteReader();

            if (!reader_as.HasRows)
            {
                var query_first_insert = string.Format("INSERT INTO  current_active_skills (id_toon,a_skill0,a_skill1,a_skill2,a_skill3,a_skill4,a_skill5) VALUES ({0},{1},{2},{3},{4},{5},{6} )", toon.D3EntityID.IdLow, this.CurrentActiveSkills[0], Skills.None, Skills.None, Skills.None, Skills.None, Skills.None, Skills.None);
                var cmd_first_insert   = new SQLiteCommand(query_first_insert, DBManager.Connection);
                cmd_first_insert.ExecuteReader();
                Logger.Debug("SkillSet: Current Active Skill Seen for the First Time  Entry for {0}", toon.D3EntityID.IdLow);
                //Logger.Debug("CurrentActiveSkill {0}",reader_as["id_toon"]);
                this.ActiveSkills = new int[6] {
                    this.CurrentActiveSkills[0], Skills.None, Skills.None, Skills.None, Skills.None, Skills.None
                };
            }
            else
            {
                this.ActiveSkills = new int[6] {
                    (int)reader_as["a_skill0"], (int)reader_as["a_skill1"], (int)reader_as["a_skill2"], (int)reader_as["a_skill3"], (int)reader_as["a_skill4"], (int)reader_as["a_skill5"]
                };
                Logger.Debug("ActiveSkill {0}", reader_as["a_skill0"]);
            }


            this.PassiveSkills = new int[3] {
                -1, -1, -1
            };                                              // setting passive skills here crashes the client, need to figure out the reason. /raist
        }
Esempio n. 15
0
        public void InitSceneLight()
        {
            World world = new World();

            Shader black     = new Phong(new Vector4(0, 0, 0));
            Shader white     = new Phong(new Vector4(1, 1, 1));
            Shader red       = new Phong(new Vector4(1, 0, 0));
            Shader green     = new Phong(new Vector4(0, 1, 0));
            Shader blue      = new Phong(new Vector4(0, 0, 1));
            Shader yellow    = new Phong(new Vector4(1, 1, 0));
            Shader pink      = new Phong(new Vector4(1, 0, 1));
            Shader cyan      = new Phong(new Vector4(0, 1, 1));
            Shader bluePhong = new Phong(new Vector4(0, 0, 1));
            //ToDo: change carPhong color to match your sample from ExLab
            Shader carPhong         = new Phong(new Vector4(0.18, 0.39, 0.56));
            Shader gray             = new Phong(new Vector4(0.5, 0.5, 0.5));
            Shader lightBlue        = new Phong(new Vector4(91 / 255.0, 142 / 255.0, 210 / 255.0));
            Shader unsaturatedGreen = new Phong(new Vector4(86 / 255.0, 116 / 255.0, 86 / 255.0));
            Shader brown            = new Phong(new Vector4(80 / 255.0, 48 / 255.0, 34 / 255.0));
            Shader lightBrown       = new Phong(new Vector4(195 / 255.0, 152 / 255.0, 101 / 255.0));

            Shader checker = new Checker()
            {
                Shader0  = unsaturatedGreen,
                Shader1  = white,
                CubeSize = 3
            };

            Shader toon = new Toon(pink as Phong)
            {
                SpecularColor = new Vector4(1, 1, 1)
            };

            Shader cook = new CookTorrance(carPhong as Phong)
            {
                SpecularColor = new Vector4(1, 1, 1)
            };

            Shader oren = new OrenNayar(yellow as Phong)
            {
                SpecularColor = new Vector4(1, 1, 1)
            };

            Shader gradient = new GradientShader()
            {
                Shader0 = brown,
                Shader1 = lightBrown,
                Q       = new Vector4(0, 0, 0),
                v       = new Vector4(0, 1, 0)
            };

            world.Models.Add(new Plane(checker, new Vector4(0, 0, 0), new Vector4(0, 0, 1)));
            world.Models.Add(new Sphere(toon, new Vector4(0, -14, 4), 4));
            world.Models.Add(new Sphere(cook, new Vector4(0, -6, 4), 4));
            world.Models.Add(new Sphere(cyan, new Vector4(0, 2, 4), 4));
            world.Models.Add(new Sphere(oren, new Vector4(0, 10, 4), 4));
            world.Models.Add(new Sphere(gradient, new Vector4(0, 18, 4), 4));

            switch (LightType)
            {
            case "SunLight": world.Lights.Add(sun); break;

            case "PointLight": world.Lights.Add(point); break;

            case "SpotLight": world.Lights.Add(spot); break;

            case "AreaLight": area.Set(); world.Lights.Add(area); break;
            }

            camera.World = world;
        }
Esempio n. 16
0
 public bool HasToon(Toon toon) // checks if given toon is already channels member
 {
     return(this.Members.Any(pair => pair.Value.Identity.ToonId.Low == toon.BnetEntityID.Low));
 }