From e0601735424f712d685330b421898db16a366b17 Mon Sep 17 00:00:00 2001 From: Schmoozerd Date: Tue, 4 Oct 2011 01:14:46 +0200 Subject: [PATCH 01/40] Initial Commit for the ICC Learning project --- icc_project/README | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 icc_project/README diff --git a/icc_project/README b/icc_project/README new file mode 100644 index 000000000..507f3d1ce --- /dev/null +++ b/icc_project/README @@ -0,0 +1,25 @@ +== ScriptDev2 README == + + Copyright (C) 2006 - 2011 ScriptDev2 + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +== ICC Learning Project == + +This project has as goals: +* Learning how to use Git to work in a distibuted workflow +* Learning the base system of ScriptedAI (Base-class for SD2 Creature scripts) +* Learning the base system of how SD2 handles instance scripts +* Learning how to structure research about bosses, to get solid scripts for them +* Learning how to interact with the MaNGOS project and database projects to do things _right_ From 1cebd00445e7bd92927f305e40225de1049d450c Mon Sep 17 00:00:00 2001 From: Schmoozerd Date: Tue, 4 Oct 2011 02:02:44 +0200 Subject: [PATCH 02/40] Add some files and documentation for the first part --- icc_project/documentation/day_1.txt | 115 ++++++++++++++++++ .../research_blood_prince_council.txt | 0 .../research_boss_blood_queen_lanathel.txt | 0 .../research_boss_deathbringer_saurfang.txt | 0 .../research/research_boss_festergut.txt | 0 .../research_boss_lady_deathwhisper.txt | 0 .../research/research_boss_lord_marrowgar.txt | 0 .../research_boss_professor_putricide.txt | 0 .../research/research_boss_rotface.txt | 0 .../research/research_boss_sindragosa.txt | 0 .../research/research_boss_the_lich_king.txt | 0 .../research_boss_valithria_dreamwalker.txt | 0 .../research/research_gunship_battle.txt | 0 .../research_instance_icecrown_citadel.txt | 0 14 files changed, 115 insertions(+) create mode 100644 icc_project/documentation/day_1.txt create mode 100644 icc_project/research/research_blood_prince_council.txt create mode 100644 icc_project/research/research_boss_blood_queen_lanathel.txt create mode 100644 icc_project/research/research_boss_deathbringer_saurfang.txt create mode 100644 icc_project/research/research_boss_festergut.txt create mode 100644 icc_project/research/research_boss_lady_deathwhisper.txt create mode 100644 icc_project/research/research_boss_lord_marrowgar.txt create mode 100644 icc_project/research/research_boss_professor_putricide.txt create mode 100644 icc_project/research/research_boss_rotface.txt create mode 100644 icc_project/research/research_boss_sindragosa.txt create mode 100644 icc_project/research/research_boss_the_lich_king.txt create mode 100644 icc_project/research/research_boss_valithria_dreamwalker.txt create mode 100644 icc_project/research/research_gunship_battle.txt create mode 100644 icc_project/research/research_instance_icecrown_citadel.txt diff --git a/icc_project/documentation/day_1.txt b/icc_project/documentation/day_1.txt new file mode 100644 index 000000000..ec627ab9d --- /dev/null +++ b/icc_project/documentation/day_1.txt @@ -0,0 +1,115 @@ +-- First Part: + +This part should introduce you to adding a new branch with Git, switching between the branches, and how to do the most basic work with Git. + + +The changes for the ICC learning project are currently located at SD2 repository, within the branch "icc_project" + +This part assumes: +- You have already cloned SD2, if not look into http://www.scriptdev2.com/showthread.php?t=4 +- You are on a clean branch, and have not yet used the name "icc_project" for a branch on your system. See (1) how to check, and restore a clean environment + +I will always use the Git bash to work with Git. +Hence I strongly suggest for you to use it as well. +But nearly all stuff must work with GUI tools somehow +(Note for *nix User: "Open 'Git bash here'" can be translated to open a bash in the directory) + +So, to do anything with Git, we will open a Git bash in the ScriptDev2 directory in your MaNGOS source folder - in src\bindings\. + +To do so, open your explorer, right click the "ScriptDev2" directory and select "Git bash here" from the context menu. + +This will open a nice black and white window, where you can type commands in a very old fasioned way :) + + +- (1) Checkinig your status + +The first and most important command is +> git status +This will show the current state of your work tree related to the index. + +What does this mean: +When you look at your ScriptDev2 directory, there are two things you must keep in mind: +* The directory contains files - these files are refered to as the work tree, and are just normal files. +* Git has an internal represantation of the history related to your project, this history is stored in the index. + +So +> git status +now shows you in which state every file in your work tree is in relation to what state the file should be compared to your current history index + +The default output should be: +> # On branch master +> nothing to commit (working directory clean) + +This shows you that you are on your "master" branch (this is default), and that you have no change related to your history (working directory clean) + +Exercise 1: Add or change a file, and compare the output of > git status + +If you have a not clean working tree, you must clean it. + +Do so (WARNING: This will delte all changes now) with + +- (2) Resetting your working tree to the index +> git reset --hard + +Remark: This will only give you what I expect, if you didn't too many experiments yourself. + +- (3) Updateing your remote information for the SD2 repo. + +The SD2 repo (assumeing it was cloned from initially) should be named "origin" +If you have done nothing special, it will be and you don't have to worry. + +To update the information for the remote origin repository, simply do: +> git fetch + + +- (4) Cloning the remote branch containing the icc learning project. + +Git is really great when it comes to branching. +This means, it is easy to have different branches of history-indexes and to switch the working-tree files between them. + +The reason why branches are so cool is, that one branch does not change the history of another branch. +So it is very easy to have different things to work on. + + +The process to switch the working tree from one history branch to another is called "checkout", and hence the command that is to be used is +> git checkout , where is the name of the branch to which you will switch your working tree + +However, before you are able to checkout to a branch, you must create it. + +To make this easier, there is the "-b" option for the checkout command: + +All in all you should type: +> git checkout -b icc_project -t remotes/origin/icc_project + +This will do the following: +-b => create a new branch named "icc_project" +-t => use the next specifier as "tracking" branch +remotes/origin/icc_project is the branch icc_project in the repository origin which is a remote repository + + +- (5) Switching between branches: +As already mentioned, you can easily switch between branches with +> git checkout + +Exersice 2: +Test switching with +> git checkout master +> git checkout icc_project +And observe changes of files in the directory (especially the sub directory icc_project) + +== End of First Part + +What this part was about: +* Checking tge status of working tree, command > git status +* Checking out a remote branch into a local branch +* Switching branches, command > git checkout +Most important concepts: +* index and working tree (What were they?) +* branches in Git (What are they used for?) + +Additional resources: +http://www.youtube.com/watch?v=4XpnKHJAok8 This is a nice vid, it should clearify why we use git, and explain some more concepts of Git :) + +What comes next: +- How to do local commits +- How to read history diff --git a/icc_project/research/research_blood_prince_council.txt b/icc_project/research/research_blood_prince_council.txt new file mode 100644 index 000000000..e69de29bb diff --git a/icc_project/research/research_boss_blood_queen_lanathel.txt b/icc_project/research/research_boss_blood_queen_lanathel.txt new file mode 100644 index 000000000..e69de29bb diff --git a/icc_project/research/research_boss_deathbringer_saurfang.txt b/icc_project/research/research_boss_deathbringer_saurfang.txt new file mode 100644 index 000000000..e69de29bb diff --git a/icc_project/research/research_boss_festergut.txt b/icc_project/research/research_boss_festergut.txt new file mode 100644 index 000000000..e69de29bb diff --git a/icc_project/research/research_boss_lady_deathwhisper.txt b/icc_project/research/research_boss_lady_deathwhisper.txt new file mode 100644 index 000000000..e69de29bb diff --git a/icc_project/research/research_boss_lord_marrowgar.txt b/icc_project/research/research_boss_lord_marrowgar.txt new file mode 100644 index 000000000..e69de29bb diff --git a/icc_project/research/research_boss_professor_putricide.txt b/icc_project/research/research_boss_professor_putricide.txt new file mode 100644 index 000000000..e69de29bb diff --git a/icc_project/research/research_boss_rotface.txt b/icc_project/research/research_boss_rotface.txt new file mode 100644 index 000000000..e69de29bb diff --git a/icc_project/research/research_boss_sindragosa.txt b/icc_project/research/research_boss_sindragosa.txt new file mode 100644 index 000000000..e69de29bb diff --git a/icc_project/research/research_boss_the_lich_king.txt b/icc_project/research/research_boss_the_lich_king.txt new file mode 100644 index 000000000..e69de29bb diff --git a/icc_project/research/research_boss_valithria_dreamwalker.txt b/icc_project/research/research_boss_valithria_dreamwalker.txt new file mode 100644 index 000000000..e69de29bb diff --git a/icc_project/research/research_gunship_battle.txt b/icc_project/research/research_gunship_battle.txt new file mode 100644 index 000000000..e69de29bb diff --git a/icc_project/research/research_instance_icecrown_citadel.txt b/icc_project/research/research_instance_icecrown_citadel.txt new file mode 100644 index 000000000..e69de29bb From 226e68c63c38b3e8eb101dd4d8c32ce397f25f16 Mon Sep 17 00:00:00 2001 From: Schmoozerd Date: Tue, 4 Oct 2011 15:41:40 +0200 Subject: [PATCH 03/40] Fix Typos in day 1 --- icc_project/documentation/day_1.txt | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/icc_project/documentation/day_1.txt b/icc_project/documentation/day_1.txt index ec627ab9d..f581510c4 100644 --- a/icc_project/documentation/day_1.txt +++ b/icc_project/documentation/day_1.txt @@ -51,6 +51,8 @@ Do so (WARNING: This will delte all changes now) with - (2) Resetting your working tree to the index > git reset --hard +Note: This will only affect files which are known to the index, so a new created file won't get deleted. + Remark: This will only give you what I expect, if you didn't too many experiments yourself. - (3) Updateing your remote information for the SD2 repo. @@ -83,7 +85,7 @@ All in all you should type: This will do the following: -b => create a new branch named "icc_project" --t => use the next specifier as "tracking" branch +-t => use the point from which you branch as "tracking" branch remotes/origin/icc_project is the branch icc_project in the repository origin which is a remote repository @@ -91,7 +93,7 @@ remotes/origin/icc_project is the branch icc_project in the repository origin wh As already mentioned, you can easily switch between branches with > git checkout -Exersice 2: +Exercise 2: Test switching with > git checkout master > git checkout icc_project From 995d09d276094f274e0e8e177466c6c73b56abd3 Mon Sep 17 00:00:00 2001 From: Schmoozerd Date: Tue, 4 Oct 2011 15:43:17 +0200 Subject: [PATCH 04/40] Start Day 2. First part contains information about git log, git show --- icc_project/documentation/day_2.txt | 127 ++++++++++++++++++++++++++++ 1 file changed, 127 insertions(+) create mode 100644 icc_project/documentation/day_2.txt diff --git a/icc_project/documentation/day_2.txt b/icc_project/documentation/day_2.txt new file mode 100644 index 000000000..106aaef1a --- /dev/null +++ b/icc_project/documentation/day_2.txt @@ -0,0 +1,127 @@ +-- First Part: + +From day_1 you should have learned these things: +* Meaning of working tree and index: The working tree are the actual files on your file system, the index is the history information +* The concept of branches: A branch is a branch of the history index + +Also you should be able to switch between branches with > git checkout and to check the state of your working tree related to the index with > git status + +This part now should introduce you to know how to actual see the history. + +- (0) excursion: The pager 'less' +This is especially important for Windows user! + +When using Git via Git bash, the default toolset is the archaic toolset every *nix fan will have learned by heart, but they can be extremely weird from Windows view. + +In old times, when there was nothing except console and there were no possibilities to scroll in the text, console environments had the so called pager programs, which were used to be able to scroll in output. + +Assume you would have an enourmous amount of text, so if you would push it directly onto the console, you would not be able to read anything, because it would be way too fast. + +So, the idea is to give the output to a program -- the pager -- which allows you to scroll up and down in the output. + +Default pager on *nix is 'less' - which Git bash uses by default to show the history (or many other things). +You can scroll in there with the arrow keys or a whole page by the space bar. +And most important: You quit less by pressing "q" + +The manpage for less can be found here: http://unixhelp.ed.ac.uk/CGI/man-cgi?less +(Disclaimer: I don't take responsibilty for brain damage caused by any provided link here!) +Anyhow: A better "guide" for less to link would be appreciated, but trying to search for "howto less" kind of doesn't work. + +Exercise 1: Try to find a better less howto and take a look +Hint: add "unix" to your search attempt :) + + +- (1) Viewing the history of a branch in Git + +Ok, now we can look into the history of the current branch, this is done simply by +> git log +Just do so now :) + +Remember: To close the output, type "q" + +The most recent commits (see 3) might look like this: +< commit 1cebd00445e7bd92927f305e40225de1049d450c +< Author: Schmoozerd +< Date: Tue Oct 4 02:02:44 2011 +0200 +< +< Add some files and documentation for the first part +< +< commit e0601735424f712d685330b421898db16a366b17 +< Author: Schmoozerd +< Date: Tue Oct 4 01:14:46 2011 +0200 +< +< Initial Commit for the ICC Learning project + +What does this show: +1) commit <-- this is the hash of the commit, which should globally uniquely identify any commit. +Usally it is enough to only take the first ~6 digits. +This is more or less the "name" of the commit +2) Author: <-- yes, this is the author of the commit +3) Date: <-- when the commit was authored + +4) Then comes the commit message, this is the message the author thought might be helpfull to describe the commit + + +So - what is git log suefull for? +With git log you are able to see the history, who did which changes, and in which order. +Also git log has a big amount of options, which help you to actually search for a specific commit (ie by author) + +Exercise 2: If you have already submitted a patch to SD2, that got accepted it is likely that you are "author" of a commit. +Check with +> git log --author="yourNickName" +If you are not, pick anyone whom you think has contributed and look what git log --author tells you ;) + +- (2) The structure of objects in the git history index + +When you do a change, and make this change known to the history, then you have a "commit" + +Any commit has: +* An author +* A commit hash (the strange numbers already seen in git log) +* The set of changes it describes (if you didn't change anything, there is no commit!) + +* One previous commit on which the commit is done. + +As of the last statement, you have a chain of commits. And this is your history! + + +- (3) View a commit +you can view a commit with +> git show + +Exercise 3: Look into the commit 111cea5073191b, type +> git show 111cea5073191b +What commit does this refer to: What is the commit message? Who is the author? When was it commited? + + +- (4) How to access commits +Things are only usefull if you can work with them, and to do so you need powerfull ways to access them. +Git provides reasonable ways to "get to" a specific commit. + +You have already seen the commit hash, this identifies a commit and hence is a great accessor (except that no one can remember endless amounts of hash-ids) + +When you are on a local branch, "HEAD" always points to the top-most commit of your local branch. + +A branchname always points to the HEAD commit of the branch with the branchname + +"~N" referes to "N commits before the commit + +Exercise 4: Look into a few commits, examples are: +> git show HEAD~1 +> git show master +> git show master~304 + +Remember: To close the pager, type "q" + +- (5) Advanced looking into the history: +Now that you know how commits are accessed, you are able to invoke more features from git log. +However I don't think that this is needed for our purposes just now, so if you are interested, +see http://book.git-scm.com/3_reviewing_history_-_git_log.html + + +== End of First Part + +What this part was about: +* Knowing what a 'commit' means. +* Showing a commit ( git show ) +* Knowing how to access various commits From a19923a5ac9b324311f44478ae772b2f94028d0c Mon Sep 17 00:00:00 2001 From: Schmoozerd Date: Tue, 4 Oct 2011 16:49:19 +0200 Subject: [PATCH 05/40] Some spelling fixes, at least the spellchecker told me so :) --- icc_project/documentation/day_1.txt | 18 +++++++++--------- icc_project/documentation/day_2.txt | 28 ++++++++++++++-------------- 2 files changed, 23 insertions(+), 23 deletions(-) diff --git a/icc_project/documentation/day_1.txt b/icc_project/documentation/day_1.txt index f581510c4..e35d44dbf 100644 --- a/icc_project/documentation/day_1.txt +++ b/icc_project/documentation/day_1.txt @@ -18,10 +18,10 @@ So, to do anything with Git, we will open a Git bash in the ScriptDev2 directory To do so, open your explorer, right click the "ScriptDev2" directory and select "Git bash here" from the context menu. -This will open a nice black and white window, where you can type commands in a very old fasioned way :) +This will open a nice black and white window, where you can type commands in a very old fashioned way :) -- (1) Checkinig your status +- (1) Checking your status The first and most important command is > git status @@ -29,8 +29,8 @@ This will show the current state of your work tree related to the index. What does this mean: When you look at your ScriptDev2 directory, there are two things you must keep in mind: -* The directory contains files - these files are refered to as the work tree, and are just normal files. -* Git has an internal represantation of the history related to your project, this history is stored in the index. +* The directory contains files - these files are referred to as the work tree, and are just normal files. +* Git has an internal representation of the history related to your project, this history is stored in the index. So > git status @@ -46,7 +46,7 @@ Exercise 1: Add or change a file, and compare the output of > git status If you have a not clean working tree, you must clean it. -Do so (WARNING: This will delte all changes now) with +Do so (WARNING: This will delete all changes now) with - (2) Resetting your working tree to the index > git reset --hard @@ -55,9 +55,9 @@ Note: This will only affect files which are known to the index, so a new created Remark: This will only give you what I expect, if you didn't too many experiments yourself. -- (3) Updateing your remote information for the SD2 repo. +- (3) Updating your remote information for the SD2 repo. -The SD2 repo (assumeing it was cloned from initially) should be named "origin" +The SD2 repo (assuming it was cloned from initially) should be named "origin" If you have done nothing special, it will be and you don't have to worry. To update the information for the remote origin repository, simply do: @@ -102,7 +102,7 @@ And observe changes of files in the directory (especially the sub directory icc_ == End of First Part What this part was about: -* Checking tge status of working tree, command > git status +* Checking the status of working tree, command > git status * Checking out a remote branch into a local branch * Switching branches, command > git checkout Most important concepts: @@ -110,7 +110,7 @@ Most important concepts: * branches in Git (What are they used for?) Additional resources: -http://www.youtube.com/watch?v=4XpnKHJAok8 This is a nice vid, it should clearify why we use git, and explain some more concepts of Git :) +http://www.youtube.com/watch?v=4XpnKHJAok8 This is a nice vid, it should clarify why we use git, and explain some more concepts of Git :) What comes next: - How to do local commits diff --git a/icc_project/documentation/day_2.txt b/icc_project/documentation/day_2.txt index 106aaef1a..d0c674ecf 100644 --- a/icc_project/documentation/day_2.txt +++ b/icc_project/documentation/day_2.txt @@ -1,6 +1,6 @@ -- First Part: -From day_1 you should have learned these things: +From day_1 you should have learnt these things: * Meaning of working tree and index: The working tree are the actual files on your file system, the index is the history information * The concept of branches: A branch is a branch of the history index @@ -11,11 +11,11 @@ This part now should introduce you to know how to actual see the history. - (0) excursion: The pager 'less' This is especially important for Windows user! -When using Git via Git bash, the default toolset is the archaic toolset every *nix fan will have learned by heart, but they can be extremely weird from Windows view. +When using Git via Git bash, the default tool set is the archaic tool set every *nix fan will have learned by heart, but they can be extremely weird from Windows view. In old times, when there was nothing except console and there were no possibilities to scroll in the text, console environments had the so called pager programs, which were used to be able to scroll in output. -Assume you would have an enourmous amount of text, so if you would push it directly onto the console, you would not be able to read anything, because it would be way too fast. +Assume you would have an enormous amount of text, so if you would push it directly onto the console, you would not be able to read anything, because it would be way too fast. So, the idea is to give the output to a program -- the pager -- which allows you to scroll up and down in the output. @@ -23,17 +23,17 @@ Default pager on *nix is 'less' - which Git bash uses by default to show the his You can scroll in there with the arrow keys or a whole page by the space bar. And most important: You quit less by pressing "q" -The manpage for less can be found here: http://unixhelp.ed.ac.uk/CGI/man-cgi?less -(Disclaimer: I don't take responsibilty for brain damage caused by any provided link here!) -Anyhow: A better "guide" for less to link would be appreciated, but trying to search for "howto less" kind of doesn't work. +The man page for less can be found here: http://unixhelp.ed.ac.uk/CGI/man-cgi?less +(Disclaimer: I don't take responsibility for brain damage caused by any provided link here!) +Anyhow: A better "guide" for less to link would be appreciated, but trying to search for "how to less" kind of doesn't work. -Exercise 1: Try to find a better less howto and take a look +Exercise 1: Try to find a better less how-to and take a look Hint: add "unix" to your search attempt :) - (1) Viewing the history of a branch in Git -Ok, now we can look into the history of the current branch, this is done simply by +OK, now we can look into the history of the current branch, this is done simply by > git log Just do so now :) @@ -54,15 +54,15 @@ The most recent commits (see 3) might look like this: What does this show: 1) commit <-- this is the hash of the commit, which should globally uniquely identify any commit. -Usally it is enough to only take the first ~6 digits. +Usually it is enough to only take the first ~6 digits. This is more or less the "name" of the commit 2) Author: <-- yes, this is the author of the commit 3) Date: <-- when the commit was authored -4) Then comes the commit message, this is the message the author thought might be helpfull to describe the commit +4) Then comes the commit message, this is the message the author thought might be helpful to describe the commit -So - what is git log suefull for? +So - what is git log useful for? With git log you are able to see the history, who did which changes, and in which order. Also git log has a big amount of options, which help you to actually search for a specific commit (ie by author) @@ -91,11 +91,11 @@ you can view a commit with Exercise 3: Look into the commit 111cea5073191b, type > git show 111cea5073191b -What commit does this refer to: What is the commit message? Who is the author? When was it commited? +What commit does this refer to: What is the commit message? Who is the author? When was it committed? - (4) How to access commits -Things are only usefull if you can work with them, and to do so you need powerfull ways to access them. +Things are only useful if you can work with them, and to do so you need powerful ways to access them. Git provides reasonable ways to "get to" a specific commit. You have already seen the commit hash, this identifies a commit and hence is a great accessor (except that no one can remember endless amounts of hash-ids) @@ -104,7 +104,7 @@ When you are on a local branch, "HEAD" always points to the top-most commit of y A branchname always points to the HEAD commit of the branch with the branchname -"~N" referes to "N commits before the commit +"~N" refers to "N commits before the commit Exercise 4: Look into a few commits, examples are: > git show HEAD~1 From 7e53699b973c40f4cf3b3d42682b755479a365f1 Mon Sep 17 00:00:00 2001 From: Schmoozerd Date: Tue, 4 Oct 2011 20:11:02 +0200 Subject: [PATCH 06/40] Day 2, Part 2 Howto git commit --- icc_project/documentation/day_2.txt | 141 +++++++++++++++++++++++++++- 1 file changed, 139 insertions(+), 2 deletions(-) diff --git a/icc_project/documentation/day_2.txt b/icc_project/documentation/day_2.txt index d0c674ecf..913ee2ad4 100644 --- a/icc_project/documentation/day_2.txt +++ b/icc_project/documentation/day_2.txt @@ -8,10 +8,10 @@ Also you should be able to switch between branches with > git checkout and to ch This part now should introduce you to know how to actual see the history. -- (0) excursion: The pager 'less' +- (0) Excursion: The pager 'less' This is especially important for Windows user! -When using Git via Git bash, the default tool set is the archaic tool set every *nix fan will have learned by heart, but they can be extremely weird from Windows view. +When using Git via Git bash, the default tool set is the archaic tool set every *nix fan will have learnt by heart, but they can be extremely weird from Windows view. In old times, when there was nothing except console and there were no possibilities to scroll in the text, console environments had the so called pager programs, which were used to be able to scroll in output. @@ -125,3 +125,140 @@ What this part was about: * Knowing what a 'commit' means. * Showing a commit ( git show ) * Knowing how to access various commits + + +-- Second Part + +From the first part of today you should know what commits are, and how to find them. +Also you should feel safe about concepts as branches, working tree and index + +Now it is time to start doing some own commits! + + +- (6) Why commit? + +When you commit, you get the full power of Git to track your history. +Also commits are easier to merge and handle than changes that are just there. +Also with committing, you are able to provide extra information in the commit message to tell "what you have done why". + +So, the golden rule of thumb is: + Commit often, commit early! +And of course: Publish your commits! (More about this likely tomorrow) + +- (7) How to commit: + +The base command to commit changes is +> git commit +however this command alone won't make you very happy. + +You must tell Git which changes you want to commit. +A very reasonable way is often, to commit all changes, like with +> git commit -a -m"My first commit" +Where +-a <= commit _all_ changes in all tracked files +-m <= take as commit message, note that I used ".." to mark the whole text as message + +Example: +This commit was added with +> git commit -a -m"Day 2, Part 2 Howto git commit" + + +As this would only commit changes in already tracked files, you might wonder how to commit (changes to) new files. +You can add a new file with +> git add path/to/fileName +Then the file named fileName located in path/to/ will be committed with your next > git commit -a command + +Remark for later: If you plan a couple of commits, it might be a good idea to fork a new branch and commit them there + +By using these commands, the usual work flow in Git represents itself like this: + +You edit a few files +> git commit -a -m "Some cool edits" +You edit more +> git commit -a -m"More cool edits" +You edit even more +> git commit -a -m"The coolest edits ever" + +Then you check your work with +> git log +The topmost three commits should then be + The coolest edits ever + More cool edits + Some cool edits + +Exercise 5: Do some test commits +Suggested files to change might be found in icc_project\research + +Exercise 6: Look at your work with git log + +Special Exercises are not important to do right now, but if you feel confident or want to test some things feel free to explore a bit +Special Exercise 7: Add a new file to git and commit it +Special Exercise 8: Do the same in a branch, to start invoke > git checkout -b testing +(Remember: the -b will create a new branch, and git checkout switches to a branch) + +Possible additional sources related to this topic: +http://book.git-scm.com/3_normal_workflow.html (unfortunately it seems the flash vids showing this are gone) +http://www.youtube.com/watch?v=8dhZ9BXQgc4 must also show this stuff, but I think I don't like the style of the speaker too much - but if you have time ;) + +- (8) Undo Changes + +This section will show up every now and then, because there are different ways to undo things, depending on what and how you want to undo. + +It is not necessary, but I suggest to remove the testing changes from Ex. 5-7 from your icc_project branch. +Do so by switching into this branch with +> git checkout icc_project +and reset to origin state with +> git reset --hard origin/icc_project + +- (9) Excursion: The editor 'vi' + +You remember that Git uses by default the archaic pager 'less' in some cases? +They are even more hostile, because in some cases by default (when there is need to edit something) Git will start the well loved 'vi' editor. + +The good news: +You can change the default editor to some editor that at least is usable for people who didn't suffer years of brain damage caused by vi and think this is a good editor :) +To change the default editor, look at this line carefully: +> git config --global core.editor "'C:/Program Files/Notepad++/notepad++.exe' -multiInst -notabbar -nosession -noPlugin" +This is however only an example how it worked on my system. + +However there are a few reasons why 'vi' is still worth knowing about: +* Every *nix system has vi, and it works nicely over ssh -- so it might be required some day to know at least the very basics +* Actually vi performs quite nicely related to big files +* Well, vi is very powerful + +Besides I like it, refer to brain damage to understand why ;) + +As vi originates in the golden ages when mice where only found under the desk of full-time hackers, +and not on the desk related to GUI editors, there was the very pressing question how to know if you want to invoke a command (ie "save" ) or when to write a word (ie "save" ). +Many editors solved this by using CTRL and similar for command mode, and normal typing else wise. +However vi went another way (because of more powerful features and because ctrl and similar caused trouble on telnet sessions). + +So, what does vi: +vi has a few different modes, which can be switched and entered with a few buttons: +* The INSERT mode: When this mode is active, there is a "-- INSERT --" marked on the bottom of your console, and in this mode vi behaves like normal editors. +If you type things, they will show on the screen - so you will do what you expect from an editor: you will edit a file +* The command mode: In this mode, pressing keys are considered as commands, and do confusing things! + +How to switch between the modes: +When you start vi you are in the command mode. Press "i" to start the insert mode. +When you are in the INSERT mode, press "Esc" to leave the INSERT mode and return to command mode. + +Actually most people green to vi wonder about one thing most: + How to close the damn program? +The answer is relatively easy: +You must be in the command mode, and then press ":". This will activate a special mode (for interested: ex-mode) in which you can type in commands. +the most useful commands are: (you don't need to press the ":" again) +:wq <= Write and Quit, which it does, and you will have manged to quit vi ;) +:q <= Only quit, to do so there must be no change +:q! <= Quit and discard changes you made + +There are tons of docs for vi out there, maybe http://www.gentoo.org/doc/en/vi-guide.xml is a good one. + +Special Exercise 9: Do a few changes and use > git commit -a and experiment :) + + +== End of Second Part + +What this part was about: +* Doing own commits with git commit +* Really encouraging to do own simple tests now! From a793bd9e677852065223a82a17d7076bdff3f8f0 Mon Sep 17 00:00:00 2001 From: Schmoozerd Date: Wed, 5 Oct 2011 23:40:17 +0200 Subject: [PATCH 07/40] Add Day_3, viewing unified diffs with git diff and format-patch --- icc_project/documentation/day_3.txt | 128 ++++++++++++++++++++++++++++ 1 file changed, 128 insertions(+) create mode 100644 icc_project/documentation/day_3.txt diff --git a/icc_project/documentation/day_3.txt b/icc_project/documentation/day_3.txt new file mode 100644 index 000000000..3da2d1c90 --- /dev/null +++ b/icc_project/documentation/day_3.txt @@ -0,0 +1,128 @@ +First Part: +----------- + +In Day 2 we showed what commits are, how to navigate in them, and how to create them. + +This part is now about the content of a commit. +Remember the (meta) structure of a commit: +* Commit hash +* Commit date +* Author information +* Commit message +* Content changes + +Today we will talk about the Content changes in each commit. + +(1) The diff format +~~~~~~~~~~~~~~~~~~~ + +One of the natural ways in programming to display changes between two files (or two states), is a so called "diff". + +Usually this might look like this: (pointless example to emphasise how to read it) +-------------------------- +diff --git a/README b/README +index bba7c29..79dc7e6 100644 +--- a/README ++++ b/README +@@ -22,7 +23,7 @@ that comes with MaNGOS ( http://www.getmangos.com ), written in C++ and is + compatible with Windows and Linux. SQL needed for database support both + MySQL and PostgreSQL. + +-This script library provides unique scripts for NPCs, gameobjects, events ++This script library provides unique and great scripts for NPCs, gameobjects, events + and other that need unique implementation. + + Once ScriptDev2 is compiled it is automatically run by MaNGOS on server + +-------------------------- + +You can read such a (unified) patch format like this: +* diff --git a/path/to/file b/path/to/file + This line tells you that you have a diff created with git, and it has the changes in path/to/file (two versions, a and b) +* @@ -A,B +C,D + This line tells you where the hunk you have changes with is located, and how big it is. + - A is the line where the content did begin in the first version + - B is the length of the hunk before the change in the first version + - C is the line where the content begins in the second version + - D is the length of the hunk in the second version +* A content (unchanged) line always starts with a blanc +* A line starting with a minus sign indicates that this line is removed +* A line starting with a plus sign indicates that this line is added + +So, now to our example diff: +the first line tells us, that we look at a change for the file README (located in main ScriptDev2 directory) +Open it and look into line 22 (A). +line 22 currently is "compatible with Windows and Linux. SQL needed for database support both" +so we know that we are in the right place to apply our changes +A few lines later, we see the line "This script library provides unique scripts for NPCs, gameobjects, events" +which out diff replaces with the line "This script library provides unique and great scripts for NPCs, gameobjects, events". +(Clearly: if you delete a line, and insert at the same place another line, you actually do replace this line) + +Note that a diff can consist of changes for multiple files, and each file changes can consist of multiple hunks + +Further documentation: http://en.wikipedia.org/wiki/Diff (various similar diff formats are also mentioned there, perhaps just look into it when reading the second time) + +(2) Creating a diff with Git +~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +> git diff + +This is one of the most important commands in Git. +With git diff you see the change set as unified diff between the current working tree and the HEAD +For memory: HEAD is the topmost commit in the current branch + +Exercise 1: Edit a few things and invoke > git diff to see the change set +Exercise 2: Edit the README in a way to get the same unified diff I posted above - did I cheat? + +Further documentation: Attention, this will show additional more advanced uses of git diff, but you should be able to understand them! +http://book.git-scm.com/3_comparing_commits_-_git_diff.html + +(3) Other important commands to see diffs +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +You already should know > git show - this commands also shows the changes of the specified commit as unified diff (after some meta information of the commit) +However with this command, you can only see the changes of a commit, not between current working tree and index + +Another tool I like very very much to see diffs of multiple commits is +> git format-patch +However this tool creates by default a bunch of diff-files, to prevent this you can use the --stdout option. +Also you should specify from which point on you want to see the commits. +Also you can specify to which point you want to see the commits. + +I usually use it this way: +> git format-patch [..] --stdout +With the meaning: +* <= commit, from which the changes will be shown (see day2 how a commit can be referenced) +* .. <= Option: commit, to which the changes will be shown +* --stdout <= print the output to the console instead of creating files for each commit + +Exercise 3: Use format-patch to see the changes between master and icc_project +Try > git format-patch master --stdout +Exercise 4: Do Day 2 - Special Exercise 8 if you have not already done, and look at the format-patch output between the created testing branch and the icc_project branch + +(4) Cleanup what happened today +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +Assuming you are on the icc_project branch, and you have no "valuable" custom changes on there, use +> git reset --hard origin/icc_project +to reset all changes of tracked files from your index and working tree. + +Check if everything is nice with > git status ;) + + +== End of First Part + +This Part should have shown how to use the commands +> git diff +> git show +> git format-patch +to look into changes of commits, or between commits and the working-tree + +Basic concepts: +You should have a rough feeling of how to "read" unified patches. + +What comes next: +~~~~~~~~~~~~~~~~ + +* A small Excursion into Bash redirection and pipes, look into http://tldp.org/HOWTO/Bash-Prog-Intro-HOWTO.html if curious +* How to apply unified patches with git apply and git am From c13eed5073ee3fae48235a04f5a22b19f518acd1 Mon Sep 17 00:00:00 2001 From: Schmoozerd Date: Thu, 6 Oct 2011 18:59:49 +0200 Subject: [PATCH 08/40] Update text style for asciidoc, also add an autogenerated html page for testing --- icc_project/documentation/day_1.html | 995 +++++++++++++++++++++++++++ icc_project/documentation/day_1.txt | 110 +-- 2 files changed, 1065 insertions(+), 40 deletions(-) create mode 100644 icc_project/documentation/day_1.html diff --git a/icc_project/documentation/day_1.html b/icc_project/documentation/day_1.html new file mode 100644 index 000000000..db1676a21 --- /dev/null +++ b/icc_project/documentation/day_1.html @@ -0,0 +1,995 @@ + + + + + + + + + + + +
+
+

1. First Part

+
+

This part should introduce you to adding a new branch with Git, switching between the branches, and how to do the most basic work with Git.

+

The changes for the ICC learning project are currently located at SD2 repository, within the branch "icc_project"

+

This part assumes:

+
    +
  • +

    +You have already cloned SD2, if not look into http://www.scriptdev2.com/showthread.php?t=4 +

    +
  • +
  • +

    +You are on a clean branch, and have not yet used the name "icc_project" for a branch on your system. + See the next section how to check, and restore a clean environment +

    +
  • +
+

I will always use the Git bash to work with Git. +Hence I strongly suggest for you to use it as well. +But nearly all stuff must work with GUI tools somehow +(Note for *nix User: "Open Git bash here" can be translated to open a bash in the directory)

+

So, to do anything with Git, we will open a Git bash in the ScriptDev2 directory in your MaNGOS source folder - in src\bindings\.

+

To do so, open your explorer, right click the "ScriptDev2" directory and select "Git bash here" from the context menu.

+

This will open a nice black and white window, where you can type commands in a very old fashioned way :)

+
+

1.1. Checking your status

+

The first and most important command is

+
+
+
git status
+
+

This will show the current state of your work tree related to the index.

+

What does this mean: +When you look at your ScriptDev2 directory, there are two things you must keep in mind:

+
    +
  • +

    +The directory contains files - these files are referred to as the work tree, and are just normal files. +

    +
  • +
  • +

    +Git has an internal representation of the history related to your project, this history is stored in the index. +

    +
  • +
+

So git status now shows you in which state every file in your work tree is in relation to what state the file should be compared to your current history index

+

The default output should be:

+
+
+
# On branch master
+nothing to commit (working directory clean)
+
+

This shows you that you are on your "master" branch (this is default), and that you have no change related to your history (working directory clean)

+
+ + + +
+
Note
+
+
Example 1: Check the status
+

Add or change a file, and compare the output of git status

+
+
+

If you have a not clean working tree, you must clean it.

+
+ + + +
+
Warning
+
+

This will delete all changes!

+
+
+

Do so with

+
+
+

1.2. Resetting your working tree to the index

+
+
+
git reset --hard
+
+

Note: This will only affect files which are known to the index, so a new created file won’t get deleted.

+

Remark: This will only give you what I expect, if you didn’t too many experiments yourself.

+
+
+

1.3. Updating your remote information for the SD2 repo.

+

The SD2 repo (assuming it was cloned from initially) should be named "origin" +If you have done nothing special, it will be and you don’t have to worry.

+

To update the information for the remote origin repository, simply do:

+
+
+
git fetch
+
+
+
+

1.4. Cloning the remote branch containing the icc learning project.

+

Git is really great when it comes to branching. +This means, it is easy to have different branches of history-indexes and to switch the working-tree files between them.

+

The reason why branches are so cool is, that one branch does not change the history of another branch. +So it is very easy to have different things to work on.

+

The process to switch the working tree from one history branch to another is called "checkout", and hence the command that is to be used is

+
+
+
git checkout <newBranch>
+
+

where <newBranch> is the name of the branch to which you will switch your working tree

+

However, before you are able to checkout to a branch, you must create it.

+

To make this easier, there is the "-b" option for the checkout command:

+

All in all you should type:

+
+
+
git checkout -b icc_project -t remotes/origin/icc_project
+
+

This will do the following:

+
+ + + + + + + + + + + + +
+-b +
+
+

+create a new branch named "icc_project" +

+
+-t +
+
+

+use the point from which you branch as "tracking" branch +

+
+remotes/origin/icc_project +
+
+

+is the branch icc_project in the repository origin which is a remote repository +

+
+
+
+

1.5. Switching between branches:

+

As already mentioned, you can easily switch between branches with

+
+
+
git checkout <branchName>
+
+
+ + + +
+
Note
+
+
Example 2: Test switching with
+
+
+
git checkout master
+git checkout icc_project
+
+

And observe changes of files in the directory (especially the sub directory icc_project)

+
+
+
+
+
+
+

2. End of First Part

+
+
+

2.1. What this part was about:

+
    +
  • +

    +Checking the status of working tree, command > git status +

    +
  • +
  • +

    +Checking out a remote branch into a local branch +

    +
  • +
  • +

    +Switching branches, command > git checkout +

    +
  • +
+
+
+

2.2. Most important concepts:

+
    +
  • +

    +index and working tree (What were they?) +

    +
  • +
  • +

    +branches in Git (What are they used for?) +

    +
  • +
+
+
+

2.3. Additional resources:

+
+ + + +
+
Tip
+
Tech talk about what Git is not This is a nice vid, it should clarify why we use git, and explain some more concepts of Git :)
+
+
+
+

2.4. What comes next:

+
    +
  • +

    +How to do local commits +

    +
  • +
  • +

    +How to read history +

    +
  • +
+
+
+
+
+

+ + + diff --git a/icc_project/documentation/day_1.txt b/icc_project/documentation/day_1.txt index e35d44dbf..b7deb9c00 100644 --- a/icc_project/documentation/day_1.txt +++ b/icc_project/documentation/day_1.txt @@ -1,13 +1,14 @@ --- First Part: +== First Part This part should introduce you to adding a new branch with Git, switching between the branches, and how to do the most basic work with Git. - The changes for the ICC learning project are currently located at SD2 repository, within the branch "icc_project" This part assumes: -- You have already cloned SD2, if not look into http://www.scriptdev2.com/showthread.php?t=4 -- You are on a clean branch, and have not yet used the name "icc_project" for a branch on your system. See (1) how to check, and restore a clean environment + +* You have already cloned SD2, if not look into http://www.scriptdev2.com/showthread.php?t=4 +* You are on a clean branch, and have not yet used the name "icc_project" for a branch on your system. + See the next section how to check, and restore a clean environment I will always use the Git bash to work with Git. Hence I strongly suggest for you to use it as well. @@ -20,51 +21,64 @@ To do so, open your explorer, right click the "ScriptDev2" directory and select This will open a nice black and white window, where you can type commands in a very old fashioned way :) - -- (1) Checking your status +=== Checking your status The first and most important command is -> git status +-------------------------------- +git status +-------------------------------- This will show the current state of your work tree related to the index. What does this mean: When you look at your ScriptDev2 directory, there are two things you must keep in mind: + * The directory contains files - these files are referred to as the work tree, and are just normal files. * Git has an internal representation of the history related to your project, this history is stored in the index. -So -> git status -now shows you in which state every file in your work tree is in relation to what state the file should be compared to your current history index +So +git status+ now shows you in which state every file in your work tree is in relation to what state the file should be compared to your current history index The default output should be: -> # On branch master -> nothing to commit (working directory clean) +-------------------------------- +# On branch master +nothing to commit (working directory clean) +-------------------------------- This shows you that you are on your "master" branch (this is default), and that you have no change related to your history (working directory clean) -Exercise 1: Add or change a file, and compare the output of > git status +[NOTE] +.*Example 1:* Check the status +================================================================== +Add or change a file, and compare the output of +git status+ +================================================================== If you have a not clean working tree, you must clean it. -Do so (WARNING: This will delete all changes now) with +[WARNING] +================================================================== +This will delete all changes! +================================================================== +Do so with -- (2) Resetting your working tree to the index -> git reset --hard +=== Resetting your working tree to the index +-------------------------------- +git reset --hard +-------------------------------- Note: This will only affect files which are known to the index, so a new created file won't get deleted. Remark: This will only give you what I expect, if you didn't too many experiments yourself. -- (3) Updating your remote information for the SD2 repo. +=== Updating your remote information for the SD2 repo. The SD2 repo (assuming it was cloned from initially) should be named "origin" If you have done nothing special, it will be and you don't have to worry. To update the information for the remote origin repository, simply do: -> git fetch - +-------------------------------- +git fetch +-------------------------------- -- (4) Cloning the remote branch containing the icc learning project. +=== Cloning the remote branch containing the icc learning project. Git is really great when it comes to branching. This means, it is easy to have different branches of history-indexes and to switch the working-tree files between them. @@ -72,46 +86,62 @@ This means, it is easy to have different branches of history-indexes and to swit The reason why branches are so cool is, that one branch does not change the history of another branch. So it is very easy to have different things to work on. - The process to switch the working tree from one history branch to another is called "checkout", and hence the command that is to be used is -> git checkout , where is the name of the branch to which you will switch your working tree +-------------------------------- +git checkout +-------------------------------- +where is the name of the branch to which you will switch your working tree However, before you are able to checkout to a branch, you must create it. To make this easier, there is the "-b" option for the checkout command: All in all you should type: -> git checkout -b icc_project -t remotes/origin/icc_project +-------------------------------- +git checkout -b icc_project -t remotes/origin/icc_project +-------------------------------- This will do the following: --b => create a new branch named "icc_project" --t => use the point from which you branch as "tracking" branch -remotes/origin/icc_project is the branch icc_project in the repository origin which is a remote repository +[horizontal] +*-b*:: create a new branch named "icc_project" +*-t*:: use the point from which you branch as "tracking" branch +*remotes/origin/icc_project*:: is the branch icc_project in the repository origin which is a remote repository +=== Switching between branches: -- (5) Switching between branches: As already mentioned, you can easily switch between branches with -> git checkout - -Exercise 2: -Test switching with -> git checkout master -> git checkout icc_project +-------------------------------- +git checkout +-------------------------------- + +[NOTE] +.*Example 2:* Test switching with +================================================================== +-------------------------------- +git checkout master +git checkout icc_project +-------------------------------- And observe changes of files in the directory (especially the sub directory icc_project) +================================================================== == End of First Part -What this part was about: +=== What this part was about: + * Checking the status of working tree, command > git status * Checking out a remote branch into a local branch * Switching branches, command > git checkout -Most important concepts: + +=== Most important concepts: + * index and working tree (What were they?) * branches in Git (What are they used for?) -Additional resources: -http://www.youtube.com/watch?v=4XpnKHJAok8 This is a nice vid, it should clarify why we use git, and explain some more concepts of Git :) +=== Additional resources: + +TIP: http://www.youtube.com/watch?v=4XpnKHJAok8[Tech talk about what Git is not] This is a nice vid, it should clarify why we use git, and explain some more concepts of Git :) + +=== What comes next: -What comes next: -- How to do local commits -- How to read history +* How to do local commits +* How to read history From 01cc761f25d7210a43f2afbfe10f1f5534536f20 Mon Sep 17 00:00:00 2001 From: Schmoozerd Date: Thu, 6 Oct 2011 20:12:48 +0200 Subject: [PATCH 09/40] Add icons and move html output to sub-directory --- icc_project/documentation/day_1.txt | 14 ++++----- .../documentation/{ => html}/day_1.html | 29 +++++++++--------- .../documentation/html/images/icons/README | 5 +++ .../html/images/icons/callouts/1.png | Bin 0 -> 329 bytes .../html/images/icons/callouts/10.png | Bin 0 -> 361 bytes .../html/images/icons/callouts/11.png | Bin 0 -> 565 bytes .../html/images/icons/callouts/12.png | Bin 0 -> 617 bytes .../html/images/icons/callouts/13.png | Bin 0 -> 623 bytes .../html/images/icons/callouts/14.png | Bin 0 -> 411 bytes .../html/images/icons/callouts/15.png | Bin 0 -> 640 bytes .../html/images/icons/callouts/2.png | Bin 0 -> 353 bytes .../html/images/icons/callouts/3.png | Bin 0 -> 350 bytes .../html/images/icons/callouts/4.png | Bin 0 -> 345 bytes .../html/images/icons/callouts/5.png | Bin 0 -> 348 bytes .../html/images/icons/callouts/6.png | Bin 0 -> 355 bytes .../html/images/icons/callouts/7.png | Bin 0 -> 344 bytes .../html/images/icons/callouts/8.png | Bin 0 -> 357 bytes .../html/images/icons/callouts/9.png | Bin 0 -> 357 bytes .../html/images/icons/caution.png | Bin 0 -> 2734 bytes .../html/images/icons/example.png | Bin 0 -> 2599 bytes .../documentation/html/images/icons/home.png | Bin 0 -> 1340 bytes .../html/images/icons/important.png | Bin 0 -> 2980 bytes .../documentation/html/images/icons/next.png | Bin 0 -> 1302 bytes .../documentation/html/images/icons/note.png | Bin 0 -> 2494 bytes .../documentation/html/images/icons/prev.png | Bin 0 -> 1348 bytes .../documentation/html/images/icons/tip.png | Bin 0 -> 2718 bytes .../documentation/html/images/icons/up.png | Bin 0 -> 1320 bytes .../html/images/icons/warning.png | Bin 0 -> 3214 bytes 28 files changed, 26 insertions(+), 22 deletions(-) rename icc_project/documentation/{ => html}/day_1.html (97%) create mode 100644 icc_project/documentation/html/images/icons/README create mode 100644 icc_project/documentation/html/images/icons/callouts/1.png create mode 100644 icc_project/documentation/html/images/icons/callouts/10.png create mode 100644 icc_project/documentation/html/images/icons/callouts/11.png create mode 100644 icc_project/documentation/html/images/icons/callouts/12.png create mode 100644 icc_project/documentation/html/images/icons/callouts/13.png create mode 100644 icc_project/documentation/html/images/icons/callouts/14.png create mode 100644 icc_project/documentation/html/images/icons/callouts/15.png create mode 100644 icc_project/documentation/html/images/icons/callouts/2.png create mode 100644 icc_project/documentation/html/images/icons/callouts/3.png create mode 100644 icc_project/documentation/html/images/icons/callouts/4.png create mode 100644 icc_project/documentation/html/images/icons/callouts/5.png create mode 100644 icc_project/documentation/html/images/icons/callouts/6.png create mode 100644 icc_project/documentation/html/images/icons/callouts/7.png create mode 100644 icc_project/documentation/html/images/icons/callouts/8.png create mode 100644 icc_project/documentation/html/images/icons/callouts/9.png create mode 100644 icc_project/documentation/html/images/icons/caution.png create mode 100644 icc_project/documentation/html/images/icons/example.png create mode 100644 icc_project/documentation/html/images/icons/home.png create mode 100644 icc_project/documentation/html/images/icons/important.png create mode 100644 icc_project/documentation/html/images/icons/next.png create mode 100644 icc_project/documentation/html/images/icons/note.png create mode 100644 icc_project/documentation/html/images/icons/prev.png create mode 100644 icc_project/documentation/html/images/icons/tip.png create mode 100644 icc_project/documentation/html/images/icons/up.png create mode 100644 icc_project/documentation/html/images/icons/warning.png diff --git a/icc_project/documentation/day_1.txt b/icc_project/documentation/day_1.txt index b7deb9c00..8d5ffa1b0 100644 --- a/icc_project/documentation/day_1.txt +++ b/icc_project/documentation/day_1.txt @@ -46,23 +46,22 @@ nothing to commit (working directory clean) This shows you that you are on your "master" branch (this is default), and that you have no change related to your history (working directory clean) [NOTE] -.*Example 1:* Check the status +[icon="./images/icons/example.png", caption="Exercise"] +.*Exercise 1* - Check the status ================================================================== Add or change a file, and compare the output of +git status+ ================================================================== If you have a not clean working tree, you must clean it. +=== Resetting your working tree to the index [WARNING] ================================================================== This will delete all changes! -================================================================== -Do so with - -=== Resetting your working tree to the index -------------------------------- git reset --hard -------------------------------- +================================================================== Note: This will only affect files which are known to the index, so a new created file won't get deleted. @@ -115,13 +114,14 @@ git checkout -------------------------------- [NOTE] -.*Example 2:* Test switching with +[icon="./images/icons/example.png", caption="Exercise"] +.*Exercise 2* - Test switching ================================================================== +Observe changes of files in the directory (especially the sub directory icc_project) while switching with -------------------------------- git checkout master git checkout icc_project -------------------------------- -And observe changes of files in the directory (especially the sub directory icc_project) ================================================================== == End of First Part diff --git a/icc_project/documentation/day_1.html b/icc_project/documentation/html/day_1.html similarity index 97% rename from icc_project/documentation/day_1.html rename to icc_project/documentation/html/day_1.html index db1676a21..95b9ac3b8 100644 --- a/icc_project/documentation/day_1.html +++ b/icc_project/documentation/html/day_1.html @@ -796,33 +796,32 @@

1.1. Checking your status

-
Note
+Exercise
-
Example 1: Check the status
+
Exercise 1 - Check the status

Add or change a file, and compare the output of git status

If you have a not clean working tree, you must clean it.

+ +
+

1.2. Resetting your working tree to the index

-
-
Warning
+Warning

This will delete all changes!

-
-
-

Do so with

-
-
-

1.2. Resetting your working tree to the index

git reset --hard
+ + +

Note: This will only affect files which are known to the index, so a new created file won’t get deleted.

Remark: This will only give you what I expect, if you didn’t too many experiments yourself.

@@ -902,16 +901,16 @@

1.5. Switching between branches:

-
Note
+Exercise
-
Example 2: Test switching with
+
Exercise 2 - Test switching
+

Observe changes of files in the directory (especially the sub directory icc_project) while switching with

git checkout master
 git checkout icc_project
-

And observe changes of files in the directory (especially the sub directory icc_project)

@@ -961,7 +960,7 @@

2.3. Additional resources:

-
Tip
+Tip
Tech talk about what Git is not This is a nice vid, it should clarify why we use git, and explain some more concepts of Git :)
@@ -988,7 +987,7 @@

2.4. What comes next:


diff --git a/icc_project/documentation/html/images/icons/README b/icc_project/documentation/html/images/icons/README new file mode 100644 index 000000000..f12b2a730 --- /dev/null +++ b/icc_project/documentation/html/images/icons/README @@ -0,0 +1,5 @@ +Replaced the plain DocBook XSL admonition icons with Jimmac's DocBook +icons (http://jimmac.musichall.cz/ikony.php3). I dropped transparency +from the Jimmac icons to get round MS IE and FOP PNG incompatibilies. + +Stuart Rackham diff --git a/icc_project/documentation/html/images/icons/callouts/1.png b/icc_project/documentation/html/images/icons/callouts/1.png new file mode 100644 index 0000000000000000000000000000000000000000..7d473430b7bec514f7de12f5769fe7c5859e8c5d GIT binary patch literal 329 zcmeAS@N?(olHy`uVBq!ia0vp^JRr;gBp8b2n5}^nQC}X^4DKU-G|w_t}fLBA)Suv#nrW z!^h2QnY_`l!BOq-UXEX{m2up>JTQkX)2m zTvF+fTUlI^nXH#utd~++ke^qgmzgTe~DWM4ffP81J literal 0 HcmV?d00001 diff --git a/icc_project/documentation/html/images/icons/callouts/10.png b/icc_project/documentation/html/images/icons/callouts/10.png new file mode 100644 index 0000000000000000000000000000000000000000..997bbc8246a316e040e0804174ba260e219d7d33 GIT binary patch literal 361 zcmeAS@N?(olHy`uVBq!ia0vp^JRr;gBp8b2n5}^nQWtZ~+OvdJMW|Y+^UT?O-M{rKJsmzxdayJ{ zDCQA!%%@7Jj$q%-wf8e0_jRx8Dqi$}^?K=?6FriQFLv>>oc^CE+aVHhW3=nZ+fQ4!M=ZC7H>3sl|FJr3LwU zC3?yExf6FO?f@F61vV}-Juk7O6lk8Yg;}bFaZ-|HQc7Azopr01?u8M*si- literal 0 HcmV?d00001 diff --git a/icc_project/documentation/html/images/icons/callouts/11.png b/icc_project/documentation/html/images/icons/callouts/11.png new file mode 100644 index 0000000000000000000000000000000000000000..ce47dac3f52ac49017749a3fea53db57d006993c GIT binary patch literal 565 zcmeAS@N?(olHy`uVBq!ia0vp^JRr=$1SD^YpWXnZI14-?iy0V%N{XE z)7O>#600DeuDZ?5tOl@ql94%{~0TwC?8m~C^ZqJRG}m@H-L1 z5L@scq?{XUcxG{OP9jig5ySQaTl#^*93bKF#G<^+ymW>G($Cs~V(bw8rA5i93}62@ zzlJGu&d<$F%`0K}c4pdspcorSSx9C{PAbEScbC)|7#JBmT^vIy=9KoYUDZ+`aP)jU z&ny=ErrK^#Gw!AcR}pdfMERuV^@&0$@(#^6b8c@rn^6RWX3pUb z4*6@PZ+H0#u=rjsXzS?6n6*sBGbHqGTU%mCsH?n#%j;eD^2}qe=iX*J@VQ3BRpz+u z{PX#N(^9X${`$90+;!pWs>o@z_n8G)7Uo7PJz`jrS+)QE@=PWHmc~UIw=WmUe73o7 z>^bR(M752aYoNg~ozu7U7&{(U>{s!;bn#f?ItjL^o`e{*EOQHqO;ccnz9hLK5@2cAyw@AaPFL~Cp#02|E|4xeQteNtB7waMs QVCXP-y85}Sb4q9e0GRUFb^rhX literal 0 HcmV?d00001 diff --git a/icc_project/documentation/html/images/icons/callouts/12.png b/icc_project/documentation/html/images/icons/callouts/12.png new file mode 100644 index 0000000000000000000000000000000000000000..31daf4e2f25b6712499ee32de9c2e3b050b691ca GIT binary patch literal 617 zcmeAS@N?(olHy`uVBq!ia0vp^JRr=$1SD^YpWXnZI14-?iy0V%N{XE z)7O>#600De9$%>2LVd81Yeb1-X-P(Y5yQ%LXFPyHJS9LOm(=3qqRfJl%=|nCVNOM5 zpg0#u+&RCXvM4h>ql94%{~0TwC?8m~C^ZqJRG}m@H-L1 z5L@scq?{XUcxG{OP9jig5ySQaTl#^*93bKF#G<^+ymW>G($Cs~V(bw8rA5i93}62@ zzlJGu&d<$F%`0K}c4pdspcorSSx9C{PAbEScbC)|7#JBmT^vIy=Cn>wTzx1(qV@bS z0hYvspf(--lM>otrqbK$7p{3DzJ|+KN8%5ows)AI?zWk_n>jwEHXrTJecpEW_0xL= z?}N`*R`T~d2{AN${y8T#GEn4hUb&52^}Op@TW4{oc)A6)%$5=G}h# z?O{QLj@aRcAIf&y&OiUN=H2gq=_}V|pWfuReDV|{jwXw~>#w)I|9${XE z)7O>#600Dep5bGK9wD%hYeb1-X-P(Y5yQ%LXFPyHJS9LOm(=3qqRfJl%=|nCVNOM5 zpg0#u+&RCXvM4h>ql94%{~0TwC?8m~C^ZqJRG}m@H-L1 z5L@scq?{XUcxG{OP9jig5ySQaTl#^*93bKF#G<^+ymW>G($Cs~V(bw8rA5i93}62@ zzlJGu&d<$F%`0K}c4pdspcorSSx9C{PAbEScbC)|7#JBmT^vIy=Cn>w>~AWNX^a2R zbkveVY|45D7UnZ&JtjPwvdCCscZp0EA*0()#GOw)UH4-^&)y^E*4%UC)*|J}q_Ss;tN`nd8$>x9$_Xb^O2EpX&@C ZI46EzbLxq-voTO7gQu&X%Q~loCIF_C`w;*D literal 0 HcmV?d00001 diff --git a/icc_project/documentation/html/images/icons/callouts/14.png b/icc_project/documentation/html/images/icons/callouts/14.png new file mode 100644 index 0000000000000000000000000000000000000000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!;Y+ zJAlS%fsM;d&r2*R1)67JkeZlkYGj#gX_9E3W@4U_nw*@Ln38B@k(iuhnUeN2eF0kK0(Y1u|9Rc(19XFPiEBhjaDG}zd16s2gM)^$re|(qda7?? zdS-IAf{C7yo`r&?rM`iMzJZ}aa#3b+Nu@(>WpPPnvR-PjUP@^}eqM=Qa(?c_U5Yz^ z#%Y0#%S_KpEGY$=XJL?(l#*ybuErX#^g`ttQfwn3r>K)tuC)r#2`iJ>Prt42#Ndx#Uc~1)>aw z3jE@Q4|!9Z%lVv}- zc=48cF7H)t`(Ck`^+mtha~Np7bBSw2NpOBzNqJ&XDuaWDvZiNlVtT4?VtQtBwt|VC zk)DNurKP@sg}#BILUK`NaY>~^Ze?*vX0l#tv0h4PL4IC|UUGi!#9fLzfW~Qojmu2W zODrh`nrE42VU(7fm~5G9U~HM3l#*m_WNcxOXkuzEX4g z+-vfUhb0A>b04=Im{6XiQd1v%r%>h0$G8U7E1If8OQ!N~xOYY5h0NDT$p9(iZ?Q&e z18-(+l~J8O`)kc}e&uL$eW&>P-#`~Qm$*ih1m~xflqVLYGB{``YkKA;rl!p+yCFkc(+@-h!Xq*<< zxXkpt#FA2=d1VEBsYynrsitN|Y01eJ$;p;U#>wWX2KP5v&I9V=1L+C? fTFYQ)RAFeOZJ=$?lDoSWD8u0C>gTe~DWM4f^}upZ literal 0 HcmV?d00001 diff --git a/icc_project/documentation/html/images/icons/callouts/6.png b/icc_project/documentation/html/images/icons/callouts/6.png new file mode 100644 index 0000000000000000000000000000000000000000..0ba694af6c07d947d219b45a629bd32c60a0f5fe GIT binary patch literal 355 zcmeAS@N?(olHy`uVBq!ia0vp^JRr;gBp8b2n5}^nQ*)Bra@SU# zmiz#bR~{$s2si{S(aY|Z}Vd7tb ouUmn-_&~Y>fYve?8dVq?X&Y!8wB+ut1u%w%U~xZhnMEEs6JbBSw2NpOBzNqJ&XDuaWDvZiNlVtT4?VtQtBwt|VC zk)DNurKP@sg}#BILUK`NaY>~^Ze?*vX0l#tv0h4PL4IC|UUGi!#9fLzfW~Qojmu2W zODrh`nrCEbVQgk$XkwI@Y+{_8nv`N>YGIaQkz#0QY@Te9lBQ<)awbq0A4pdK&{_sV bqY6VKZ3AtCmfYR7Kp6&4S3j3^P6u&S`V$cAh@R~F=4@V4jxkzlaQrcFYWK{)(`o5XZnut z=nE4SU2g1ZW%;@@I$>_e3F8a=8WK~|CVXt1DqisQxtIX|`YW_n&?Nh#1gQ}d)$LrYTw(_{nVG)tp2V+#}WG*e^KRLdkoLz7g? qn(IA84Qgo42`r6v<+Hvch>@C7(8A5T-G@yGywn*$#_oy literal 0 HcmV?d00001 diff --git a/icc_project/documentation/html/images/icons/callouts/9.png b/icc_project/documentation/html/images/icons/callouts/9.png new file mode 100644 index 0000000000000000000000000000000000000000..a0676d26cc2ff1de12c4ecdeefb44a0d71bc6bde GIT binary patch literal 357 zcmeAS@N?(olHy`uVBq!ia0vp^JRr;gBp8b2n5}^nQNRqa;^5&H%t0&v*|C|wdb9$wI zR@+N9#RIowg@Uqn&z-__Tzhhz!sG|vTxA7?=O|Y?u(d4T{!RM9c7chr6d%1?R=i16 z?@Ic{f32YJFJnVhX)qGzOMplv!L->5yAlT#}irms+fsQd*FoSE84k zpF44v;trs3T43Wc)AJHbN`dAXo0u6Hr<$gkq?lM38ycjV7+5A5Sr{ayr5c%-n;95g pF*H#D>f!_G3IJNmU}#ifXryhRZP1dtyA~+J;OXk;vd$@?2>@J{cB%jX literal 0 HcmV?d00001 diff --git a/icc_project/documentation/html/images/icons/caution.png b/icc_project/documentation/html/images/icons/caution.png new file mode 100644 index 0000000000000000000000000000000000000000..9a8c515a109faf9159777ac9e6861c2b8e7df383 GIT binary patch literal 2734 zcmV;f3Q_fmP)qRJ4X9M6U>%D6f0(?w()&*gbo9@8u#OnM`JS zW_EV>-1GRp-+RwxM1*g0b9~(Z?zH`%z}MZr@dTV-#iD+{pITd6&G*#QRQP;8_EqdP z|Z zr_*TzIR6(J)bsgKQa{~CYTLW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?pFVAlbIA_8QaA(4X5D8=QYyeXh*X?9cO7Rg-N4+R+>Mmsk`Xrb%irFOiUXfx zYu#mYJ;oR|Z{CchOP9j!cEjm(!s&EEk|aoy)Vn5bM?kRGG!56UUq@C}7C!jk1B=8M zwy*gS=1&_5Uy9rC3l8E&&LD1v%`o^L{N}Ry&ET+ZsEyo|AnH4r8s%=WUN@R0z_m24hDlz6a}iPn&8F$k*!~~kTrLRXGxM! zR8)io3l`YMK3&;}mtMbwD{Y;6%|t4$ws+%VOE;EpXhL@&Ec)@|$0H{v2b!jtk`~}Y zp-`0BSVE}z9Ca$e7-QCC;cz%0Ns=jf&bb*CBuPSHVIjO;FY4;*%r#2(eT>fT5T0Is zFWSHC!R599R&Kv!1D~Frj@;Z_$g+%x+~R zNK_yE9PfSf1*VQ4j{W~^$F(oQ6{gSU!ov#pLWK3D0Y*f`7_&(~Qk~**I2_2%&PIHEJc^5pZ6|l4B_<|f z?b@{%HENUz&g=EUdp1gX0|3)>gu_{#Efflw z8ai|44BmR{Ewr?>nA%HAOT&yAGmw&!0=L_ZxVShoVF~aeSxJ&)W?@0XO2Ar?_WN*G z5D_Fqh*MS7OgJL>sH%#~moGz66lj_TRaKFktbZn2ZQbQ^*#L^W(7NyeYxa#Srw4R8 z9a&-s0wPmdi3u%OGYx)=OR!{=8aL8Ut zWub-J9`p{1K*W2m*_ttC0vG*e@^Ly%kfL8aTZtIYeUcc|9~`m1Pa_kM1w^mUF+ufb okQh4{0;0ttGLSY9u)Vea0c2b7c|xT9mjD0&07*qoM6N<$f;>?xtpET3 literal 0 HcmV?d00001 diff --git a/icc_project/documentation/html/images/icons/example.png b/icc_project/documentation/html/images/icons/example.png new file mode 100644 index 0000000000000000000000000000000000000000..1199e864f8502a57c3b8def7c2e1d90c5f760a73 GIT binary patch literal 2599 zcmV+?3fT3DP)!p-mb;RMJu+ROx1c5(5$li%g&}q%h1d>z%pFnYriP{BV|;p>t;=6`S-)-nl2| zyytoU|7Urh=RIQ?WB4eG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R>rzD{Ont<9bH z+-$C2IL{n7aKLnQbePW0PSe-dXUgTW85$ZgQc9z>HdE27lrnGZ`G>jlo}0}L3+I~t z{(ch#!K8FexQ$*w)@ZHc@AxwDQ0ko#uAVq<#?YG_Uz1%g4#9DCO^LwB#gg}u*qjdV zvGgVq8)HI!QznosHcH7w0I#KYvO1?l;QvWJ^8Y9Pn82l${{opPvZfw590vdZ002ov JPDHLkV1oa#`7Hnd literal 0 HcmV?d00001 diff --git a/icc_project/documentation/html/images/icons/home.png b/icc_project/documentation/html/images/icons/home.png new file mode 100644 index 0000000000000000000000000000000000000000..37a5231bacc905886c9351a291e0d5eed68dd60e GIT binary patch literal 1340 zcmV-C1;hG@P)3OI*>m>ZTpH8MCNbI~p>5o#SPG&Qk<#jef)uMh2myWbj}ZD7 zh{6HICtr#Pz6cdXyitu?V_PlNrfJekvdJcU$;sK>bIyzp+pD(v!N&~4H^1*P^UVnU zL&|T@DlmhfhcPA%1~4H;FDc!up7NjT-fyq?59og26)=+sN(hw!KzBAV$s#Z-bbO+0 zKK$PI{p5ea<+o?YLA-;dUd?9G#RmrRa;V>B_dp9zC0ty~GGEoKuB_;_Mi}Zi{9c)j zclVl4e)N4mzR9uv0UZJH9!~z)E?&yw^=Gmi*d>@4@kA_K z=jyr{j}o3-V{HCV*_*3WD*7()jY!|i=JU_LxW6FYc-rIPVT+Wq`0iYbXD16hw9Vto z(+x^nT?XiE9#ynCpukP^C)W^Sp?W4p2p6cm;e2qAE6!C*mA`D+8m?m6$vN`kJB?lLlz!jk{Kkx~e@^*cN|p5gPK8q6#f zXohK8WTmD)(G;bU1cni^G>{X7UClGM$&hse?PILVE-@f3Z$XCB@aCNmqRz+l; zi23CXm5XhfK?l!@u|>q<^%|XE{fj-~vyXwQ1yHF}%#QN0xlY6*S|=mh`z_%)09MHP;2puk~TFsPZ8lgSW+>A$aX+>Yo z#!(W-7XMOZ!D=Jo%v^(|mFCP~eEN7vR(=Lnecw-Rfh(1YIW(1CtC`W$jnG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XspAW?4=y}K$=D-3Cq2~!5)J(J*2d)>YYGo**?EM3NI;)rb@k&FW;GL&o z>od2YhlgP2k8|gigtA)$9pJ`&1Xp2(-d8J?y;rNlNS_U z{2XG6kcb&#n<1h;rA)k$Mt$w3+0EX1R=u|`tQEFeVYI2qv6oCHrJ;AV&4({V7N4EE zP-pkA9w`e_*24U#qr90)G|U}J8I#jSHk)NjM&1~sd!^7pZ@SGS*$@!71L9Ud!VXx| zAs3zU_o&BrM+=z3Uwp?DKG$zfQLD@x>=Hlh2J#CQ2n|*Jyi^j8TpQ#0?o|nCTesYC zW5Q*4)CSUPde zPwCFH1=om86#ULoHLxRQAmULIQ%a-&twW|}Dhyq%s&k{I^6YH!U`zPdm-Em(;P?0U z-@QS$ZQCY+_#kg=2xQ`Qg|$vf(cwgmC_u>#Jr%0Fi8m4nbBET-!^eRfF#DeyWWfkP zxr_Y=^M2>aqDZGP?6fH32$XEpK~1X4c%!~{Gi6Lp10}!()a`rkUpdA_c;_CU5&!@I M07*qoM6N<$g4<+Y4gdfE literal 0 HcmV?d00001 diff --git a/icc_project/documentation/html/images/icons/note.png b/icc_project/documentation/html/images/icons/note.png new file mode 100644 index 0000000000000000000000000000000000000000..7c1f3e2fa7ef8897bb55ee0e0dda088dc49d6408 GIT binary patch literal 2494 zcmV;v2|@OWP)Dn;hlg!sWaK|u z738H>q0O5&+vt7wuzAz%lqL_6pE$;`=_$TGUSZXTKE{?UTV#Q4eNlNy5f~X6vC;eP zVar?IL^}QqvwNN<9++V9)D&M@mNI(ZJ=}l){r{0jyrc*W4-ebj%iAbbjxqbUooH}4 zuZUNi7mlaxe8H{Yp@$wSHWB%^MdKw!V8@OfbY&U!zwaWH1ECZMSs=**Axr2VTE>nY zJBTp?U=3MN%Nye7^JNh+5usEnkslf-lmqG&b&3m$`XUlKILOS*6L|lEeL0JH(vmpIP@3Z^}f3}I(e8SSttw+1qk&H*S&}e3GMAA ze*25>uxL>y9qlEuEJammu}RJZ5CH{IL<&-v!Lq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W@h)^doN%7{9V+h zk6;!#cyN-uUgNL3_Aq(mIDg$ehQ&xndmCL{ZLD10&oygSAp(N~y+srn0E~zbkyt-# zpQs+SIn0db4jg3nt}!Z=%7OqWPF0rk)D zr>8l2s>1lB@$ff)#?*sGJVnVz0zW@d(3twxNo#p`CGHJ_WD_uk{2YrQse z#LSqPnK|p?*UYHb>#ak)bB-iQNRot7sf73b^6y4fwdLW$YlU&m+vcV=Lw@G-xp$l1 z`?IJaBE%S5qeD}ZB)L2a{V&M>_pg-y4e|OV literal 0 HcmV?d00001 diff --git a/icc_project/documentation/html/images/icons/prev.png b/icc_project/documentation/html/images/icons/prev.png new file mode 100644 index 0000000000000000000000000000000000000000..3e8f12fe24c6e042bc7ef4badb15449f71529ace GIT binary patch literal 1348 zcmV-K1-tr*P)4zN}O#(F4Jyqw_mKoxsZ-I`F8^(@$jCw?lX&Z*cU6RDktP#MR}H zlhq+#oL?sxw7*T*#_N0K!;^R6&X1hFlgZ`&eE8s)di4)Ja|MTlarpRjgN5sT7OwZ1 znM&el#YE0!-%i8S7Q?lgOtgpU@w&`b50(9;YPBkx;KCEH9mmVQ^vrMb>bbJPGnyb0 zKC3o)?sr@H{r)lLrjvYhs?N48hEXJl2-8~)*_2Tim*VkZAZD6#pO(wz(AjW%_MmbS z#~<63OCBm2w1yzGeEq);PnGi&#yzxBBs@(N3!_j7Ld!4|f=Jk!(ewhB#no_THQq5l z#kbeo(raf7A}?mr$y{ldM{F&vo^WGj$dh|>%uFRWXHaW~w0idifY=JV3o-w_lE^md zndfWa%vUZj2^`4f#&kXz(e7!Q-H6g$hPmzj#=u0lRS!6Oxl0hq|ADcv)QCC1oToiV z(IKNP%{^^ZEV@7erHd0;#UQW@0?Xdn6y>?hJ&xey*Xs|=`={X zDt>8Yl8T*^pwyj^0}87($N)R)uk?JbwQ~IH8;5pZeld8Z1z%j+04oII;ZR95auK@> z+-&vjY^;3FF2djcA-wqlY|C#r9|UmheOO$(9~=vWF&GWq!3ZR-Y1>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2001 From: Schmoozerd Date: Thu, 6 Oct 2011 22:18:36 +0200 Subject: [PATCH 10/40] Change style in day_2.txt to fit asciidoc --- icc_project/documentation/day_2.txt | 320 +++++++++++++++++++--------- 1 file changed, 217 insertions(+), 103 deletions(-) diff --git a/icc_project/documentation/day_2.txt b/icc_project/documentation/day_2.txt index 913ee2ad4..775a32c87 100644 --- a/icc_project/documentation/day_2.txt +++ b/icc_project/documentation/day_2.txt @@ -1,14 +1,17 @@ --- First Part: -From day_1 you should have learnt these things: +From Day 1 you should have learnt these things: + * Meaning of working tree and index: The working tree are the actual files on your file system, the index is the history information * The concept of branches: A branch is a branch of the history index -Also you should be able to switch between branches with > git checkout and to check the state of your working tree related to the index with > git status +Also you should be able to switch between branches with +git checkout+ and to check the state of your working tree related to the index with +git status+ + +== First Part: This part now should introduce you to know how to actual see the history. -- (0) Excursion: The pager 'less' +=== Excursion: The pager 'less' + This is especially important for Windows user! When using Git via Git bash, the default tool set is the archaic tool set every *nix fan will have learnt by heart, but they can be extremely weird from Windows view. @@ -23,59 +26,78 @@ Default pager on *nix is 'less' - which Git bash uses by default to show the his You can scroll in there with the arrow keys or a whole page by the space bar. And most important: You quit less by pressing "q" -The man page for less can be found here: http://unixhelp.ed.ac.uk/CGI/man-cgi?less +[TIP] +================================================================== +http://unixhelp.ed.ac.uk/CGI/man-cgi?less[The man page for less can be found here] + (Disclaimer: I don't take responsibility for brain damage caused by any provided link here!) + Anyhow: A better "guide" for less to link would be appreciated, but trying to search for "how to less" kind of doesn't work. +================================================================== -Exercise 1: Try to find a better less how-to and take a look +[NOTE] +[icon="./images/icons/example.png", caption="Exercise"] +.*Exercise 1* - Try to find a better less how-to and take a look +==================================================================================================================================== Hint: add "unix" to your search attempt :) +==================================================================================================================================== - -- (1) Viewing the history of a branch in Git +=== Viewing the history of a branch in Git OK, now we can look into the history of the current branch, this is done simply by -> git log +-------------------------------- +git log +-------------------------------- Just do so now :) Remember: To close the output, type "q" The most recent commits (see 3) might look like this: -< commit 1cebd00445e7bd92927f305e40225de1049d450c -< Author: Schmoozerd -< Date: Tue Oct 4 02:02:44 2011 +0200 -< -< Add some files and documentation for the first part -< -< commit e0601735424f712d685330b421898db16a366b17 -< Author: Schmoozerd -< Date: Tue Oct 4 01:14:46 2011 +0200 -< -< Initial Commit for the ICC Learning project - -What does this show: -1) commit <-- this is the hash of the commit, which should globally uniquely identify any commit. -Usually it is enough to only take the first ~6 digits. -This is more or less the "name" of the commit -2) Author: <-- yes, this is the author of the commit -3) Date: <-- when the commit was authored - -4) Then comes the commit message, this is the message the author thought might be helpful to describe the commit - - -So - what is git log useful for? +-------------------------------- +commit 1cebd00445e7bd92927f305e40225de1049d450c <1> +Author: Schmoozerd <2> +Date: Tue Oct 4 02:02:44 2011 +0200 <3> + + Add some files and documentation for the first part <4> + +commit e0601735424f712d685330b421898db16a366b17 <1> +Author: Schmoozerd <2> +Date: Tue Oct 4 01:14:46 2011 +0200 <3> + + Initial Commit for the ICC Learning project <4> +-------------------------------- + +*What does this show:* + +<1> This is the hash of the commit, which should globally uniquely identify any commit. + Usually it is enough to only take the first ~6 digits. + This is more or less the "name" of the commit +<2> Yes you guessed rightly, this is the author of the commit +<3> When the commit was authored +<4> This is the message the author thought might be helpful to describe the commit + +*So - what is git log useful for?* + With git log you are able to see the history, who did which changes, and in which order. Also git log has a big amount of options, which help you to actually search for a specific commit (ie by author) -Exercise 2: If you have already submitted a patch to SD2, that got accepted it is likely that you are "author" of a commit. -Check with -> git log --author="yourNickName" -If you are not, pick anyone whom you think has contributed and look what git log --author tells you ;) +[NOTE] +[icon="./images/icons/example.png", caption="Exercise"] +.*Exercise 2* - Search the history by author +================================================================== +If you have already submitted a patch to SD2, that got accepted it is likely that you are "author" of a commit. Check with +-------------------------------- +git log --author="yourNickName" +-------------------------------- +If you are not, pick anyone whom you think has contributed and look what +git log --author+ tells you ;) +================================================================== -- (2) The structure of objects in the git history index +=== The structure of objects in the git history index When you do a change, and make this change known to the history, then you have a "commit" Any commit has: + * An author * A commit hash (the strange numbers already seen in git log) * The set of changes it describes (if you didn't change anything, there is no commit!) @@ -85,16 +107,25 @@ Any commit has: As of the last statement, you have a chain of commits. And this is your history! -- (3) View a commit -you can view a commit with -> git show +=== View a commit + +You can view a commit with +-------------------------------- +git show +-------------------------------- -Exercise 3: Look into the commit 111cea5073191b, type -> git show 111cea5073191b +[NOTE] +[icon="./images/icons/example.png", caption="Exercise"] +.*Exercise 3* - View a commit by hash +================================================================== +-------------------------------- +git show 111cea5073191b +-------------------------------- What commit does this refer to: What is the commit message? Who is the author? When was it committed? +================================================================== +=== How to access commits -- (4) How to access commits Things are only useful if you can work with them, and to do so you need powerful ways to access them. Git provides reasonable ways to "get to" a specific commit. @@ -106,122 +137,190 @@ A branchname always points to the HEAD commit of the branch with the branchname "~N" refers to "N commits before the commit -Exercise 4: Look into a few commits, examples are: -> git show HEAD~1 -> git show master -> git show master~304 - +[NOTE] +[icon="./images/icons/example.png", caption="Exercise"] +.*Exercise 4* - Look into a few commits +================================================================== +Try these examples, maybe a few more. +-------------------------------- +git show HEAD~1 +git show master +git show master~304 +-------------------------------- Remember: To close the pager, type "q" +================================================================== + +=== Advanced looking into the history: -- (5) Advanced looking into the history: Now that you know how commits are accessed, you are able to invoke more features from git log. -However I don't think that this is needed for our purposes just now, so if you are interested, -see http://book.git-scm.com/3_reviewing_history_-_git_log.html +TIP: http://book.git-scm.com/3_reviewing_history_-_git_log.html[For interested Readers - this goes quite ahead for now] == End of First Part -What this part was about: +=== What this part was about: + * Knowing what a 'commit' means. -* Showing a commit ( git show ) +* Showing a commit ( +git show+ ) * Knowing how to access various commits - --- Second Part +== Second Part From the first part of today you should know what commits are, and how to find them. Also you should feel safe about concepts as branches, working tree and index Now it is time to start doing some own commits! +=== Why commit? -- (6) Why commit? - -When you commit, you get the full power of Git to track your history. -Also commits are easier to merge and handle than changes that are just there. -Also with committing, you are able to provide extra information in the commit message to tell "what you have done why". +* When you commit, you get the full power of Git to track your history. +* Also commits are easier to merge and handle than changes that are just there. +* Also with committing, you are able to provide extra information in the commit message to tell "what you have done why". So, the golden rule of thumb is: - Commit often, commit early! + +[IMPORTANT] +================================================================== +*Commit often, commit early!* + And of course: Publish your commits! (More about this likely tomorrow) +================================================================== -- (7) How to commit: +=== How to commit: The base command to commit changes is -> git commit +-------------------------------- +git commit +-------------------------------- however this command alone won't make you very happy. You must tell Git which changes you want to commit. A very reasonable way is often, to commit all changes, like with -> git commit -a -m"My first commit" +-------------------------------- +git commit -a -m"My first commit" +-------------------------------- Where --a <= commit _all_ changes in all tracked files --m <= take as commit message, note that I used ".." to mark the whole text as message +[horizontal] +*-a*:: commit _all_ changes in all tracked files +*-m *:: take as commit message, note that I used ".." to mark the whole text as message -Example: -This commit was added with +*Example:* This commit was added with +-------------------------------- > git commit -a -m"Day 2, Part 2 Howto git commit" +-------------------------------- +==== Track new files As this would only commit changes in already tracked files, you might wonder how to commit (changes to) new files. + You can add a new file with -> git add path/to/fileName -Then the file named fileName located in path/to/ will be committed with your next > git commit -a command +-------------------------------- +git add path/to/fileName +-------------------------------- +Then the file named fileName located in path/to/ will be committed with your next +git commit -a+ command Remark for later: If you plan a couple of commits, it might be a good idea to fork a new branch and commit them there +==== Workflow in Git + By using these commands, the usual work flow in Git represents itself like this: You edit a few files -> git commit -a -m "Some cool edits" +-------------------------------- +git commit -a -m "Some cool edits" +-------------------------------- You edit more -> git commit -a -m"More cool edits" +-------------------------------- +git commit -a -m"More cool edits" +-------------------------------- You edit even more -> git commit -a -m"The coolest edits ever" - +-------------------------------- +git commit -a -m"The coolest edits ever" +-------------------------------- Then you check your work with -> git log +-------------------------------- +git log +-------------------------------- + The topmost three commits should then be - The coolest edits ever - More cool edits - Some cool edits -Exercise 5: Do some test commits +. The coolest edits ever +. More cool edits +. Some cool edits + +[NOTE] +[icon="./images/icons/example.png", caption="Exercise"] +.*Exercise 5* - Do some test commits +==================================================================================================================================== Suggested files to change might be found in icc_project\research +==================================================================================================================================== + +[NOTE] +[icon="./images/icons/example.png", caption="Exercise"] +.*Exercise 6* +================================================================== +Look at your work with +git log+ +================================================================== + +WARNING: Special Exercises are not important to do right now, but if you feel confident or want to test some things feel free to explore a bit + +[NOTE] +[icon="./images/icons/example.png", caption="Exercise"] +.*Special Exercise 7* - Commit changes with a new file +================================================================== +Add a new file to git and commit it (lookup +git add+) +================================================================== -Exercise 6: Look at your work with git log +[NOTE] +[icon="./images/icons/example.png", caption="Exercise"] +.*Special Exercise 8* - Commit in a branch +================================================================== +To start invoke +git checkout -b testing+ +Remember: the -b will create a new branch, and git checkout switches to a branch +================================================================== -Special Exercises are not important to do right now, but if you feel confident or want to test some things feel free to explore a bit -Special Exercise 7: Add a new file to git and commit it -Special Exercise 8: Do the same in a branch, to start invoke > git checkout -b testing -(Remember: the -b will create a new branch, and git checkout switches to a branch) +==== Possible additional sources related to this topic: -Possible additional sources related to this topic: -http://book.git-scm.com/3_normal_workflow.html (unfortunately it seems the flash vids showing this are gone) -http://www.youtube.com/watch?v=8dhZ9BXQgc4 must also show this stuff, but I think I don't like the style of the speaker too much - but if you have time ;) +TIP: http://book.git-scm.com/3_normal_workflow.html (unfortunately it seems the flash vids showing this are gone) -- (8) Undo Changes +TIP: http://www.youtube.com/watch?v=8dhZ9BXQgc4[Tech Talk of what Git is about] I think I don't like the style of the speaker too much - but maybe you do :) + +=== Undo Changes This section will show up every now and then, because there are different ways to undo things, depending on what and how you want to undo. It is not necessary, but I suggest to remove the testing changes from Ex. 5-7 from your icc_project branch. + Do so by switching into this branch with -> git checkout icc_project + +-------------------------------- +git checkout icc_project +-------------------------------- + and reset to origin state with -> git reset --hard origin/icc_project -- (9) Excursion: The editor 'vi' +-------------------------------- +git reset --hard origin/icc_project +-------------------------------- + +=== Excursion: The editor 'vi' You remember that Git uses by default the archaic pager 'less' in some cases? + They are even more hostile, because in some cases by default (when there is need to edit something) Git will start the well loved 'vi' editor. -The good news: +==== Change default editor in Git, aka 'The good news' + You can change the default editor to some editor that at least is usable for people who didn't suffer years of brain damage caused by vi and think this is a good editor :) + To change the default editor, look at this line carefully: -> git config --global core.editor "'C:/Program Files/Notepad++/notepad++.exe' -multiInst -notabbar -nosession -noPlugin" +-------------------------------- +git config --global core.editor "'C:/Program Files/Notepad++/notepad++.exe' -multiInst -notabbar -nosession -noPlugin" +-------------------------------- This is however only an example how it worked on my system. -However there are a few reasons why 'vi' is still worth knowing about: +==== Reasons why 'vi' is still worth knowing about: + * Every *nix system has vi, and it works nicely over ssh -- so it might be required some day to know at least the very basics * Actually vi performs quite nicely related to big files * Well, vi is very powerful @@ -231,34 +330,49 @@ Besides I like it, refer to brain damage to understand why ;) As vi originates in the golden ages when mice where only found under the desk of full-time hackers, and not on the desk related to GUI editors, there was the very pressing question how to know if you want to invoke a command (ie "save" ) or when to write a word (ie "save" ). Many editors solved this by using CTRL and similar for command mode, and normal typing else wise. + However vi went another way (because of more powerful features and because ctrl and similar caused trouble on telnet sessions). -So, what does vi: +==== How 'vi' works vi has a few different modes, which can be switched and entered with a few buttons: + * The INSERT mode: When this mode is active, there is a "-- INSERT --" marked on the bottom of your console, and in this mode vi behaves like normal editors. If you type things, they will show on the screen - so you will do what you expect from an editor: you will edit a file + * The command mode: In this mode, pressing keys are considered as commands, and do confusing things! -How to switch between the modes: +===== How to switch between the modes: When you start vi you are in the command mode. Press "i" to start the insert mode. When you are in the INSERT mode, press "Esc" to leave the INSERT mode and return to command mode. +===== Closing 'vi' + Actually most people green to vi wonder about one thing most: - How to close the damn program? + +*How to close the damn program?* + The answer is relatively easy: + You must be in the command mode, and then press ":". This will activate a special mode (for interested: ex-mode) in which you can type in commands. the most useful commands are: (you don't need to press the ":" again) -:wq <= Write and Quit, which it does, and you will have manged to quit vi ;) -:q <= Only quit, to do so there must be no change -:q! <= Quit and discard changes you made -There are tons of docs for vi out there, maybe http://www.gentoo.org/doc/en/vi-guide.xml is a good one. +[horizontal] ++:wq+:: Write and Quit, which it does, and you will have manged to quit vi ;) ++:q+:: Only quit, to do so there must be no change ++:q!+:: Quit and discard changes you made -Special Exercise 9: Do a few changes and use > git commit -a and experiment :) +TIP: There are tons of docs for vi out there, maybe http://www.gentoo.org/doc/en/vi-guide.xml is a good one. +[NOTE] +[icon="./images/icons/example.png", caption="Exercise"] +.*Special Exercise 9* +================================================================== +Do a few changes and use > git commit -a and experiment :) +================================================================== == End of Second Part -What this part was about: +=== What this part was about: + * Doing own commits with git commit * Really encouraging to do own simple tests now! From 383d37b73e4283adab66e9b669743a2327cb9c27 Mon Sep 17 00:00:00 2001 From: Schmoozerd Date: Thu, 6 Oct 2011 22:53:16 +0200 Subject: [PATCH 11/40] Change style in day_2.txt to fit asciidoc --- icc_project/documentation/day_3.txt | 182 +++++++++++++++++----------- 1 file changed, 112 insertions(+), 70 deletions(-) diff --git a/icc_project/documentation/day_3.txt b/icc_project/documentation/day_3.txt index 3da2d1c90..33ee726f7 100644 --- a/icc_project/documentation/day_3.txt +++ b/icc_project/documentation/day_3.txt @@ -1,10 +1,8 @@ -First Part: ------------ - In Day 2 we showed what commits are, how to navigate in them, and how to create them. This part is now about the content of a commit. Remember the (meta) structure of a commit: + * Commit hash * Commit date * Author information @@ -13,116 +11,160 @@ Remember the (meta) structure of a commit: Today we will talk about the Content changes in each commit. -(1) The diff format -~~~~~~~~~~~~~~~~~~~ +== First Part: + +=== The diff format One of the natural ways in programming to display changes between two files (or two states), is a so called "diff". Usually this might look like this: (pointless example to emphasise how to read it) --------------------------- -diff --git a/README b/README +-------------------------------- +diff --git a/README b/README <1> index bba7c29..79dc7e6 100644 --- a/README +++ b/README -@@ -22,7 +23,7 @@ that comes with MaNGOS ( http://www.getmangos.com ), written in C++ and is - compatible with Windows and Linux. SQL needed for database support both - MySQL and PostgreSQL. - --This script library provides unique scripts for NPCs, gameobjects, events -+This script library provides unique and great scripts for NPCs, gameobjects, events - and other that need unique implementation. - - Once ScriptDev2 is compiled it is automatically run by MaNGOS on server - --------------------------- - -You can read such a (unified) patch format like this: -* diff --git a/path/to/file b/path/to/file - This line tells you that you have a diff created with git, and it has the changes in path/to/file (two versions, a and b) -* @@ -A,B +C,D - This line tells you where the hunk you have changes with is located, and how big it is. - - A is the line where the content did begin in the first version - - B is the length of the hunk before the change in the first version - - C is the line where the content begins in the second version - - D is the length of the hunk in the second version -* A content (unchanged) line always starts with a blanc -* A line starting with a minus sign indicates that this line is removed -* A line starting with a plus sign indicates that this line is added - -So, now to our example diff: +@@ -22,7 +23,7 @@ that comes with MaNGOS ( http://www.getmangos.com ), written in C++ and is <2> + compatible with Windows and Linux. SQL needed for database support both <3> + MySQL and PostgreSQL. <3> + +-This script library provides unique scripts for NPCs, gameobjects, events <4> ++This script library provides unique and great scripts for NPCs, gameobjects, events <5> + and other that need unique implementation. <3> + + Once ScriptDev2 is compiled it is automatically run by MaNGOS on server <3> + +-------------------------------- + +*You can read such a (unified) patch format like this:* + +<1> diff --git a/path/to/file b/path/to/file + This line tells you that you have a diff created with git, and it has the changes in path/to/file (two versions, a and b) +<2> @@ -A,B +C,D + This line tells you where the hunk you have changes with is located, and how big it is. + - A is the line where the content did begin in the first version + - B is the length of the hunk before the change in the first version + - C is the line where the content begins in the second version + - D is the length of the hunk in the second version +<3> A content (unchanged) line always starts with a blanc +<4> A line starting with a minus sign indicates that this line is removed +<5> A line starting with a plus sign indicates that this line is added + +*So, now to our example diff:* + the first line tells us, that we look at a change for the file README (located in main ScriptDev2 directory) + Open it and look into line 22 (A). -line 22 currently is "compatible with Windows and Linux. SQL needed for database support both" -so we know that we are in the right place to apply our changes -A few lines later, we see the line "This script library provides unique scripts for NPCs, gameobjects, events" -which out diff replaces with the line "This script library provides unique and great scripts for NPCs, gameobjects, events". + +line 22 currently is +compatible with Windows and Linux. SQL needed for database support both+ + +so we know that we are in the right place to apply our changes. + +A few lines later, we see the line +This script library provides unique scripts for NPCs, gameobjects, events+ +which out diff replaces with the line +This script library provides unique and great scripts for NPCs, gameobjects, events+. + (Clearly: if you delete a line, and insert at the same place another line, you actually do replace this line) Note that a diff can consist of changes for multiple files, and each file changes can consist of multiple hunks -Further documentation: http://en.wikipedia.org/wiki/Diff (various similar diff formats are also mentioned there, perhaps just look into it when reading the second time) +TIP: http://en.wikipedia.org/wiki/Diff[Further documentation] including various similar diff formats are also mentioned there, perhaps just look into it when reading the second time -(2) Creating a diff with Git -~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +=== Creating a diff with Git -> git diff +-------------------------------- +git diff +-------------------------------- This is one of the most important commands in Git. + With git diff you see the change set as unified diff between the current working tree and the HEAD + For memory: HEAD is the topmost commit in the current branch -Exercise 1: Edit a few things and invoke > git diff to see the change set -Exercise 2: Edit the README in a way to get the same unified diff I posted above - did I cheat? +[NOTE] +[icon="./images/icons/example.png", caption="Exercise"] +.*Exercise 1* - Use git diff +================================================================== +Edit a few files and see what happens with +git diff+ +================================================================== + +[NOTE] +[icon="./images/icons/example.png", caption="Exercise"] +.*Exercise 2* - Compare to diff above +================================================================== +Edit the README in a way to get the same unified diff I posted above - did I cheat? +================================================================== + +TIP: http://book.git-scm.com/3_comparing_commits_-_git_diff.html[Further documentation] his will show additional more advanced uses of git diff, but you should be able to understand them! -Further documentation: Attention, this will show additional more advanced uses of git diff, but you should be able to understand them! -http://book.git-scm.com/3_comparing_commits_-_git_diff.html +=== Other important commands to see diffs -(3) Other important commands to see diffs -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +You already should know +git show+ - this commands also shows the changes of the specified commit as unified diff (after some meta information of the commit) -You already should know > git show - this commands also shows the changes of the specified commit as unified diff (after some meta information of the commit) However with this command, you can only see the changes of a commit, not between current working tree and index Another tool I like very very much to see diffs of multiple commits is -> git format-patch -However this tool creates by default a bunch of diff-files, to prevent this you can use the --stdout option. -Also you should specify from which point on you want to see the commits. -Also you can specify to which point you want to see the commits. +-------------------------------- +git format-patch +-------------------------------- + +* However this tool creates by default a bunch of diff-files, to prevent this you can use the +--stdout+ option. +* Also you should specify from which point on you want to see the commits. +* Also you can specify to which point you want to see the commits. I usually use it this way: +-------------------------------- > git format-patch [..] --stdout +-------------------------------- With the meaning: -* <= commit, from which the changes will be shown (see day2 how a commit can be referenced) -* .. <= Option: commit, to which the changes will be shown -* --stdout <= print the output to the console instead of creating files for each commit -Exercise 3: Use format-patch to see the changes between master and icc_project -Try > git format-patch master --stdout -Exercise 4: Do Day 2 - Special Exercise 8 if you have not already done, and look at the format-patch output between the created testing branch and the icc_project branch +[horizontal] +:: Commit, from which the changes will be shown (see day2 how a commit can be referenced) + ..:: Optional commit, to which the changes will be shown ++--stdout+:: print the output to the console instead of creating files for each commit + + +[NOTE] +[icon="./images/icons/example.png", caption="Exercise"] +.*Exercise 3* - Basic example for git format-patch +================================================================== +Use format-patch to see the changes between master and icc_project, try +-------------------------------- +git format-patch master --stdout +-------------------------------- +================================================================== -(4) Cleanup what happened today -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +[NOTE] +[icon="./images/icons/example.png", caption="Exercise"] +.*Exercise 4* - git format-patch for different branches +================================================================== +Do Day 2 - Special Exercise 8 if you have not already done, and look at the format-patch output between the created testing branch and the icc_project branch +================================================================== + +=== Cleanup what happened today Assuming you are on the icc_project branch, and you have no "valuable" custom changes on there, use -> git reset --hard origin/icc_project +-------------------------------- +git reset --hard origin/icc_project +-------------------------------- to reset all changes of tracked files from your index and working tree. -Check if everything is nice with > git status ;) - +Check if everything is nice with +git status+ ;) == End of First Part This Part should have shown how to use the commands -> git diff -> git show -> git format-patch +-------------------------------- +git diff +git show +git format-patch +-------------------------------- to look into changes of commits, or between commits and the working-tree -Basic concepts: -You should have a rough feeling of how to "read" unified patches. +*Basic concepts:* + +* You should have a rough feeling of how to "read" unified patches. -What comes next: -~~~~~~~~~~~~~~~~ +*What comes next:* * A small Excursion into Bash redirection and pipes, look into http://tldp.org/HOWTO/Bash-Prog-Intro-HOWTO.html if curious * How to apply unified patches with git apply and git am From a141cf3bfda2be7398d87e1945c26ad8bb47c175 Mon Sep 17 00:00:00 2001 From: Schmoozerd Date: Thu, 6 Oct 2011 22:56:00 +0200 Subject: [PATCH 12/40] Add autogenerated files for Days 2, 3 --- icc_project/documentation/html/day_2.html | 1347 +++++++++++++++++++++ icc_project/documentation/html/day_3.html | 1042 ++++++++++++++++ 2 files changed, 2389 insertions(+) create mode 100644 icc_project/documentation/html/day_2.html create mode 100644 icc_project/documentation/html/day_3.html diff --git a/icc_project/documentation/html/day_2.html b/icc_project/documentation/html/day_2.html new file mode 100644 index 000000000..5d59fad6c --- /dev/null +++ b/icc_project/documentation/html/day_2.html @@ -0,0 +1,1347 @@ + + + + + + + + + + + +
+

From Day 1 you should have learnt these things:

+
    +
  • +

    +Meaning of working tree and index: The working tree are the actual files on your file system, the index is the history information +

    +
  • +
  • +

    +The concept of branches: A branch is a branch of the history index +

    +
  • +
+

Also you should be able to switch between branches with git checkout and to check the state of your working tree related to the index with git status

+
+

1. First Part:

+
+

This part now should introduce you to know how to actual see the history.

+
+

1.1. Excursion: The pager less

+

This is especially important for Windows user!

+

When using Git via Git bash, the default tool set is the archaic tool set every *nix fan will have learnt by heart, but they can be extremely weird from Windows view.

+

In old times, when there was nothing except console and there were no possibilities to scroll in the text, console environments had the so called pager programs, which were used to be able to scroll in output.

+

Assume you would have an enormous amount of text, so if you would push it directly onto the console, you would not be able to read anything, because it would be way too fast.

+

So, the idea is to give the output to a program — the pager — which allows you to scroll up and down in the output.

+

Default pager on *nix is less - which Git bash uses by default to show the history (or many other things). +You can scroll in there with the arrow keys or a whole page by the space bar. +And most important: You quit less by pressing "q"

+
+ + + +
+Tip + + +

(Disclaimer: I don’t take responsibility for brain damage caused by any provided link here!)

+

Anyhow: A better "guide" for less to link would be appreciated, but trying to search for "how to less" kind of doesn’t work.

+
+
+
+ + + +
+Exercise + +
Exercise 1 - Try to find a better less how-to and take a look
+

Hint: add "unix" to your search attempt :)

+
+
+
+
+

1.2. Viewing the history of a branch in Git

+

OK, now we can look into the history of the current branch, this is done simply by

+
+
+
git log
+
+

Just do so now :)

+

Remember: To close the output, type "q"

+

The most recent commits (see 3) might look like this:

+
+
+
commit 1cebd00445e7bd92927f305e40225de1049d450c          1
+Author: Schmoozerd <schmoozerd@scriptdev2.com>           2
+Date:   Tue Oct 4 02:02:44 2011 +0200                    3
+
+    Add some files and documentation for the first part  4
+
+commit e0601735424f712d685330b421898db16a366b17          1
+Author: Schmoozerd <schmoozerd@scriptdev2.com>           2
+Date:   Tue Oct 4 01:14:46 2011 +0200                    3
+
+    Initial Commit for the ICC Learning project          4
+
+

What does this show:

+
+ + + + +
1 +This is the hash of the commit, which should globally uniquely identify any commit. + Usually it is enough to only take the first ~6 digits. + This is more or less the "name" of the commit +
2 +Yes you guessed rightly, this is the author of the commit +
3 +When the commit was authored +
4 +This is the message the author thought might be helpful to describe the commit +
+

So - what is git log useful for?

+

With git log you are able to see the history, who did which changes, and in which order. +Also git log has a big amount of options, which help you to actually search for a specific commit (ie by author)

+
+ + + +
+Exercise + +
Exercise 2 - Search the history by author
+

If you have already submitted a patch to SD2, that got accepted it is likely that you are "author" of a commit. Check with

+
+
+
git log --author="yourNickName"
+
+

If you are not, pick anyone whom you think has contributed and look what git log --author tells you ;)

+
+
+
+
+

1.3. The structure of objects in the git history index

+

When you do a change, and make this change known to the history, then you have a "commit"

+

Any commit has:

+
    +
  • +

    +An author +

    +
  • +
  • +

    +A commit hash (the strange numbers already seen in git log) +

    +
  • +
  • +

    +The set of changes it describes (if you didn’t change anything, there is no commit!) +

    +
  • +
  • +

    +One previous commit on which the commit is done. +

    +
  • +
+

As of the last statement, you have a chain of commits. And this is your history!

+
+
+

1.4. View a commit

+

You can view a commit with

+
+
+
git show <someIdentifier>
+
+
+ + + +
+Exercise + +
Exercise 3 - View a commit by hash
+
+
+
git show 111cea5073191b
+
+

What commit does this refer to: What is the commit message? Who is the author? When was it committed?

+
+
+
+
+

1.5. How to access commits

+

Things are only useful if you can work with them, and to do so you need powerful ways to access them. +Git provides reasonable ways to "get to" a specific commit.

+

You have already seen the commit hash, this identifies a commit and hence is a great accessor (except that no one can remember endless amounts of hash-ids)

+

When you are on a local branch, "HEAD" always points to the top-most commit of your local branch.

+

A branchname always points to the HEAD commit of the branch with the branchname

+

"<Commit>~N" refers to "N commits before the commit <Commit>

+
+ + + +
+Exercise + +
Exercise 4 - Look into a few commits
+

Try these examples, maybe a few more.

+
+
+
git show HEAD~1
+git show master
+git show master~304
+
+

Remember: To close the pager, type "q"

+
+
+
+
+

1.6. Advanced looking into the history:

+

Now that you know how commits are accessed, you are able to invoke more features from git log.

+ +
+
+
+
+

2. End of First Part

+
+
+

2.1. What this part was about:

+
    +
  • +

    +Knowing what a commit means. +

    +
  • +
  • +

    +Showing a commit ( git show ) +

    +
  • +
  • +

    +Knowing how to access various commits +

    +
  • +
+
+
+
+
+

3. Second Part

+
+

From the first part of today you should know what commits are, and how to find them. +Also you should feel safe about concepts as branches, working tree and index

+

Now it is time to start doing some own commits!

+
+

3.1. Why commit?

+
    +
  • +

    +When you commit, you get the full power of Git to track your history. +

    +
  • +
  • +

    +Also commits are easier to merge and handle than changes that are just there. +

    +
  • +
  • +

    +Also with committing, you are able to provide extra information in the commit message to tell "what you have done why". +

    +
  • +
+

So, the golden rule of thumb is:

+
+ + + +
+Important + +

Commit often, commit early!

+

And of course: Publish your commits! (More about this likely tomorrow)

+
+
+
+
+

3.2. How to commit:

+

The base command to commit changes is

+
+
+
git commit
+
+

however this command alone won’t make you very happy.

+

You must tell Git which changes you want to commit. +A very reasonable way is often, to commit all changes, like with

+
+
+
git commit -a -m"My first commit"
+
+

Where

+
+ + + + + + + + +
+-a +
+
+

+commit all changes in all tracked files +

+
+-m <String> +
+
+

+take <String> as commit message, note that I used ".." to mark the whole text as message +

+
+

Example: This commit was added with

+
+
+
> git commit -a -m"Day 2, Part 2 Howto git commit"
+
+
+

3.2.1. Track new files

+

As this would only commit changes in already tracked files, you might wonder how to commit (changes to) new files.

+

You can add a new file with

+
+
+
git add path/to/fileName
+
+

Then the file named fileName located in path/to/ will be committed with your next git commit -a command

+

Remark for later: If you plan a couple of commits, it might be a good idea to fork a new branch and commit them there

+
+
+

3.2.2. Workflow in Git

+

By using these commands, the usual work flow in Git represents itself like this:

+

You edit a few files

+
+
+
git commit -a -m "Some cool edits"
+
+

You edit more

+
+
+
git commit -a -m"More cool edits"
+
+

You edit even more

+
+
+
git commit -a -m"The coolest edits ever"
+
+

Then you check your work with

+
+
+
git log
+
+

The topmost three commits should then be

+
    +
  1. +

    +The coolest edits ever +

    +
  2. +
  3. +

    +More cool edits +

    +
  4. +
  5. +

    +Some cool edits +

    +
  6. +
+
+ + + +
+Exercise + +
Exercise 5 - Do some test commits
+

Suggested files to change might be found in icc_project\research

+
+
+
+ + + +
+Exercise + +
Exercise 6
+

Look at your work with git log

+
+
+
+ + + +
+Warning +Special Exercises are not important to do right now, but if you feel confident or want to test some things feel free to explore a bit
+
+
+ + + +
+Exercise + +
Special Exercise 7 - Commit changes with a new file
+

Add a new file to git and commit it (lookup git add)

+
+
+
+ + + +
+Exercise + +
Special Exercise 8 - Commit in a branch
+

To start invoke git checkout -b testing +Remember: the -b will create a new branch, and git checkout switches to a branch

+
+
+
+
+ +
+ + + +
+Tip +http://book.git-scm.com/3_normal_workflow.html (unfortunately it seems the flash vids showing this are gone)
+
+
+ + + +
+Tip +Tech Talk of what Git is about I think I don’t like the style of the speaker too much - but maybe you do :)
+
+
+
+
+

3.3. Undo Changes

+

This section will show up every now and then, because there are different ways to undo things, depending on what and how you want to undo.

+

It is not necessary, but I suggest to remove the testing changes from Ex. 5-7 from your icc_project branch.

+

Do so by switching into this branch with

+
+
+
git checkout icc_project
+
+

and reset to origin state with

+
+
+
git reset --hard origin/icc_project
+
+
+
+

3.4. Excursion: The editor vi

+

You remember that Git uses by default the archaic pager less in some cases?

+

They are even more hostile, because in some cases by default (when there is need to edit something) Git will start the well loved vi editor.

+
+

3.4.1. Change default editor in Git, aka The good news

+

You can change the default editor to some editor that at least is usable for people who didn’t suffer years of brain damage caused by vi and think this is a good editor :)

+

To change the default editor, look at this line carefully:

+
+
+
git config --global core.editor "'C:/Program Files/Notepad++/notepad++.exe' -multiInst -notabbar -nosession -noPlugin"
+
+

This is however only an example how it worked on my system.

+
+
+

3.4.2. Reasons why vi is still worth knowing about:

+
    +
  • +

    +Every *nix system has vi, and it works nicely over ssh — so it might be required some day to know at least the very basics +

    +
  • +
  • +

    +Actually vi performs quite nicely related to big files +

    +
  • +
  • +

    +Well, vi is very powerful +

    +
  • +
+

Besides I like it, refer to brain damage to understand why ;)

+

As vi originates in the golden ages when mice where only found under the desk of full-time hackers, +and not on the desk related to GUI editors, there was the very pressing question how to know if you want to invoke a command (ie "save" ) or when to write a word (ie "save" ). +Many editors solved this by using CTRL and similar for command mode, and normal typing else wise.

+

However vi went another way (because of more powerful features and because ctrl and similar caused trouble on telnet sessions).

+
+
+

3.4.3. How vi works

+

vi has a few different modes, which can be switched and entered with a few buttons:

+
    +
  • +

    +The INSERT mode: When this mode is active, there is a "-- INSERT --" marked on the bottom of your console, and in this mode vi behaves like normal editors. +If you type things, they will show on the screen - so you will do what you expect from an editor: you will edit a file +

    +
  • +
  • +

    +The command mode: In this mode, pressing keys are considered as commands, and do confusing things! +

    +
  • +
+
+
How to switch between the modes:
+

When you start vi you are in the command mode. Press "i" to start the insert mode. +When you are in the INSERT mode, press "Esc" to leave the INSERT mode and return to command mode.

+
+
+
Closing vi
+

Actually most people green to vi wonder about one thing most:

+

How to close the damn program?

+

The answer is relatively easy:

+

You must be in the command mode, and then press ":". This will activate a special mode (for interested: ex-mode) in which you can type in commands. +the most useful commands are: (you don’t need to press the ":" again)

+
+ + + + + + + + + + + + +
+:wq +
+
+

+Write and Quit, which it does, and you will have manged to quit vi ;) +

+
+:q +
+
+

+Only quit, to do so there must be no change +

+
+:q! +
+
+

+Quit and discard changes you made +

+
+
+ + + +
+Tip +There are tons of docs for vi out there, maybe http://www.gentoo.org/doc/en/vi-guide.xml is a good one.
+
+
+ + + +
+Exercise + +
Special Exercise 9
+

Do a few changes and use > git commit -a and experiment :)

+
+
+
+
+
+
+
+
+

4. End of Second Part

+
+
+

4.1. What this part was about:

+
    +
  • +

    +Doing own commits with git commit +

    +
  • +
  • +

    +Really encouraging to do own simple tests now! +

    +
  • +
+
+
+
+
+

+ + + diff --git a/icc_project/documentation/html/day_3.html b/icc_project/documentation/html/day_3.html new file mode 100644 index 000000000..b4f2b3b3b --- /dev/null +++ b/icc_project/documentation/html/day_3.html @@ -0,0 +1,1042 @@ + + + + + + + + + + + +
+

In Day 2 we showed what commits are, how to navigate in them, and how to create them.

+

This part is now about the content of a commit. +Remember the (meta) structure of a commit:

+
    +
  • +

    +Commit hash +

    +
  • +
  • +

    +Commit date +

    +
  • +
  • +

    +Author information +

    +
  • +
  • +

    +Commit message +

    +
  • +
  • +

    +Content changes +

    +
  • +
+

Today we will talk about the Content changes in each commit.

+
+

1. First Part:

+
+
+

1.1. The diff format

+

One of the natural ways in programming to display changes between two files (or two states), is a so called "diff".

+

Usually this might look like this: (pointless example to emphasise how to read it)

+
+
+
diff --git a/README b/README        1
+index bba7c29..79dc7e6 100644
+--- a/README
++++ b/README
+@@ -22,7 +23,7 @@ that comes with MaNGOS ( http://www.getmangos.com ), written in C++ and is        2
+ compatible with Windows and Linux. SQL needed for database support both                            3
+ MySQL and PostgreSQL.                                                                              3
+
+-This script library provides unique scripts for NPCs, gameobjects, events              4
++This script library provides unique and great scripts for NPCs, gameobjects, events    5
+ and other that need unique implementation.                                                         3
+
+ Once ScriptDev2 is compiled it is automatically run by MaNGOS on server                            3
+
+

You can read such a (unified) patch format like this:

+
+ + + + + +
1 +diff --git a/path/to/file b/path/to/file + This line tells you that you have a diff created with git, and it has the changes in path/to/file (two versions, a and b) +
2 +@@ -A,B +C,D <someString> + This line tells you where the hunk you have changes with is located, and how big it is. +
    +
  • +

    +A is the line where the content did begin in the first version +

    +
  • +
  • +

    +B is the length of the hunk before the change in the first version +

    +
  • +
  • +

    +C is the line where the content begins in the second version +

    +
  • +
  • +

    +D is the length of the hunk in the second version +

    +
  • +
+
3 +A content (unchanged) line always starts with a blanc +
4 +A line starting with a minus sign indicates that this line is removed +
5 +A line starting with a plus sign indicates that this line is added +
+

So, now to our example diff:

+

the first line tells us, that we look at a change for the file README (located in main ScriptDev2 directory)

+

Open it and look into line 22 (A).

+

line 22 currently is compatible with Windows and Linux. SQL needed for database support both

+

so we know that we are in the right place to apply our changes.

+

A few lines later, we see the line This script library provides unique scripts for NPCs, gameobjects, events +which out diff replaces with the line This script library provides unique and great scripts for NPCs, gameobjects, events.

+

(Clearly: if you delete a line, and insert at the same place another line, you actually do replace this line)

+

Note that a diff can consist of changes for multiple files, and each file changes can consist of multiple hunks

+
+ + + +
+Tip +Further documentation including various similar diff formats are also mentioned there, perhaps just look into it when reading the second time
+
+
+
+

1.2. Creating a diff with Git

+
+
+
git diff
+
+

This is one of the most important commands in Git.

+

With git diff you see the change set as unified diff between the current working tree and the HEAD

+

For memory: HEAD is the topmost commit in the current branch

+
+ + + +
+Exercise + +
Exercise 1 - Use git diff
+

Edit a few files and see what happens with git diff

+
+
+
+ + + +
+Exercise + +
Exercise 2 - Compare to diff above
+

Edit the README in a way to get the same unified diff I posted above - did I cheat?

+
+
+
+ + + +
+Tip +Further documentation his will show additional more advanced uses of git diff, but you should be able to understand them!
+
+
+
+

1.3. Other important commands to see diffs

+

You already should know git show - this commands also shows the changes of the specified commit as unified diff (after some meta information of the commit)

+

However with this command, you can only see the changes of a commit, not between current working tree and index

+

Another tool I like very very much to see diffs of multiple commits is

+
+
+
git format-patch
+
+
    +
  • +

    +However this tool creates by default a bunch of diff-files, to prevent this you can use the --stdout option. +

    +
  • +
  • +

    +Also you should specify from which point on you want to see the commits. +

    +
  • +
  • +

    +Also you can specify to which point you want to see the commits. +

    +
  • +
+

I usually use it this way:

+
+
+
> git format-patch <startCommit>[..<endCommit>] --stdout
+
+

With the meaning:

+
+ + + + + + + + + + + + +
+<startCommit> +
+
+

+Commit, from which the changes will be shown (see day2 how a commit can be referenced) +

+
+..<endCommit> +
+
+

+Optional commit, to which the changes will be shown +

+
+--stdout +
+
+

+print the output to the console instead of creating files for each commit +

+
+
+ + + +
+Exercise + +
Exercise 3 - Basic example for git format-patch
+

Use format-patch to see the changes between master and icc_project, try

+
+
+
git format-patch master --stdout
+
+
+
+
+ + + +
+Exercise + +
Exercise 4 - git format-patch for different branches
+

Do Day 2 - Special Exercise 8 if you have not already done, and look at the format-patch output between the created testing branch and the icc_project branch

+
+
+
+
+

1.4. Cleanup what happened today

+

Assuming you are on the icc_project branch, and you have no "valuable" custom changes on there, use

+
+
+
git reset --hard origin/icc_project
+
+

to reset all changes of tracked files from your index and working tree.

+

Check if everything is nice with git status ;)

+
+
+
+
+

2. End of First Part

+
+

This Part should have shown how to use the commands

+
+
+
git diff
+git show
+git format-patch
+
+

to look into changes of commits, or between commits and the working-tree

+

Basic concepts:

+
    +
  • +

    +You should have a rough feeling of how to "read" unified patches. +

    +
  • +
+

What comes next:

+
+
+
+
+

+ + + From 866f90ba189f5d7c82809cf448967603043b47f2 Mon Sep 17 00:00:00 2001 From: Schmoozerd Date: Fri, 7 Oct 2011 00:47:58 +0200 Subject: [PATCH 13/40] Start Day 4 - Tales about bash, redirection to Create Patch files --- icc_project/documentation/day-4.txt | 102 ++++++++++++++++++++++++++++ 1 file changed, 102 insertions(+) create mode 100644 icc_project/documentation/day-4.txt diff --git a/icc_project/documentation/day-4.txt b/icc_project/documentation/day-4.txt new file mode 100644 index 000000000..e0d070637 --- /dev/null +++ b/icc_project/documentation/day-4.txt @@ -0,0 +1,102 @@ + +From Day 3 you should have learnt these things: + +* How to read unified diffs +* How to use +git diff+, +git show+ and +git format-patch+ to create diff between different commits or the working tree + +Today now is about how to + +* Create patch files, that is files which contain the output from the above commands +* How to apply them + +== First Part: + +A very neat way to create the patch files within a bash (ie Git bash) is to use the output redirection + +=== Excursion: Some notes about working with a console + +*Reasons to still use a console environment for some things* + +* You definitively will feel like a geek!\r\n + (Do we actually need more reasons?) +* Using a console is for some things very fast (and very slow for others) +* Reasonable to learn, as *nix systems won't proper work without (Windows systems won't work proper without using +cmd+ now and then, only that the cmd sucks) + +*Most useful commands in a bash console* + +Ok, to clearify: When you type commands into a console, there is actually a program that interprets these commands. Some examples are the cmd (from (win)do(w)s), or bash which got popular on linux + +[horizontal] +*ls*:: List the content of the current directory (on Windows this was called +dir+) +*cd*:: Change your directory. If you invoke +cd ..+ then you will change into the parent directory +*cat*:: Can be used to get text from a file onto the console +*cp* A B:: Copy a file from A to B +*mv* A B:: Move a file from A to B (if A and B are in the same directory, than this renames) +*rm* A:: Remove (this means delete) file A +*mkdir*:: Create a directory +*rmdir*:: Remove a directory + +*Very usefull things:* + +Autocompletion (Bash can do this):: +If you want to type something, and press the +tab+ key, the bash will try to autocomplete a word for you. ++ +Example: Type (in the ScriptDev2-directory) into the bash: +ls to+ and then press the +tab+ key. + +Copy and Paste in the bash (For Windows users):: +If you klick on the top-left corner of your console window, you can select "Edit" and there "Mark" and "Paste". ++ +(Marking is finished with +enter+, the marked text will then be in your clipboard) + +Using previously typed commands:: +With the arrow keys (up, down) you can reuse previous commands easily. + +=== Excursion: Bash output/ input redirection + +For most console based systems it is possible to use these types of output redirection + +[horizontal] +*>*:: Forward the output into a file, the file will be created if it does not exist, and truncated before refilled if it exists +*>>*:: Forward the output into a file, but append if the file already exists +*|*:: (Called pipe) Forward the output from the program as input to the next program +:: A few more exists which I won't cover! + +Remember the nice tools like +git diff+ or +git format-patch --stdout+ from Day 3? + +They were working nice, but only displayed there stuff in the console. + +The trick to get their output into files is to use output redirection. + +[NOTE] +[icon="./images/icons/example.png", caption="Exercise"] +.*Exercise 1* - Use output redirection to create patch files +================================================================== +* Do Exercise 1 from Day3, but redirect the output of +git diff+ with +git diff > temp_diff.patch+ +* Do Exercise 3 from Day3, but redirect the output of +git diff+ with +git diff > temp_format.patch+ + +And look at these created files with a patch tool (if you have one installed), an editor and +cat+. + +To use cat do: +cat temp_diff.patch+ and +cat temp_format.patch+ + +Gratulation, you have created your first patch files! +================================================================== + +[NOTE] +[icon="./images/icons/example.png", caption="Exercise"] +.*Exercise 2* - Use output redirection to create patch files +================================================================== +Do some more edits and test bash autocompletion with +git diff > te+ +d+ +================================================================== + +Sometimes you might not want to get all changes directly into a file, but would like to view the output of ie +git format-patch --stdout+ slowly. + +Remeber the pager 'less' from Day 2? + +[NOTE] +[icon="./images/icons/example.png", caption="Exercise"] +.*Exercise 3* - Fais la pipe (My french is bad, maybe it was Utilize) +================================================================== +Use +git format-patch master --stdout | less+ +================================================================== + +== End of First Part From 2b8b2d19001b6ef48c93045d1c39b69e80e4501f Mon Sep 17 00:00:00 2001 From: Schmoozerd Date: Fri, 7 Oct 2011 01:27:59 +0200 Subject: [PATCH 14/40] Day 4 - Add documentation of how to apply patch files --- icc_project/documentation/day-4.txt | 162 ++++++++++++++++++++++++++-- 1 file changed, 151 insertions(+), 11 deletions(-) diff --git a/icc_project/documentation/day-4.txt b/icc_project/documentation/day-4.txt index e0d070637..8c0ca0745 100644 --- a/icc_project/documentation/day-4.txt +++ b/icc_project/documentation/day-4.txt @@ -24,7 +24,7 @@ A very neat way to create the patch files within a bash (ie Git bash) is to use *Most useful commands in a bash console* -Ok, to clearify: When you type commands into a console, there is actually a program that interprets these commands. Some examples are the cmd (from (win)do(w)s), or bash which got popular on linux +OK, to clarify: When you type commands into a console, there is actually a program that interprets these commands. Some examples are the cmd (from (win)do(w)s), or bash which got popular on Linux [horizontal] *ls*:: List the content of the current directory (on Windows this was called +dir+) @@ -36,15 +36,15 @@ Ok, to clearify: When you type commands into a console, there is actually a prog *mkdir*:: Create a directory *rmdir*:: Remove a directory -*Very usefull things:* +*Very useful things:* -Autocompletion (Bash can do this):: -If you want to type something, and press the +tab+ key, the bash will try to autocomplete a word for you. +Auto completion (Bash can do this):: +If you want to type something, and press the +tab+ key, the bash will try to auto complete a word for you. + Example: Type (in the ScriptDev2-directory) into the bash: +ls to+ and then press the +tab+ key. Copy and Paste in the bash (For Windows users):: -If you klick on the top-left corner of your console window, you can select "Edit" and there "Mark" and "Paste". +If you click on the top-left corner of your console window, you can select "Edit" and there "Mark" and "Paste". + (Marking is finished with +enter+, the marked text will then be in your clipboard) @@ -75,28 +75,168 @@ The trick to get their output into files is to use output redirection. * Do Exercise 3 from Day3, but redirect the output of +git diff+ with +git diff > temp_format.patch+ And look at these created files with a patch tool (if you have one installed), an editor and +cat+. +(To use cat do: +cat temp_diff.patch+ and +cat temp_format.patch+) -To use cat do: +cat temp_diff.patch+ and +cat temp_format.patch+ - -Gratulation, you have created your first patch files! +Congratulation, you have created your first patch files! ================================================================== [NOTE] [icon="./images/icons/example.png", caption="Exercise"] .*Exercise 2* - Use output redirection to create patch files ================================================================== -Do some more edits and test bash autocompletion with +git diff > te+ +d+ +Do some more edits and test bash auto completion with +git diff > te+ +d+ ================================================================== Sometimes you might not want to get all changes directly into a file, but would like to view the output of ie +git format-patch --stdout+ slowly. -Remeber the pager 'less' from Day 2? +Remember the pager 'less' from Day 2? [NOTE] [icon="./images/icons/example.png", caption="Exercise"] -.*Exercise 3* - Fais la pipe (My french is bad, maybe it was Utilize) +.*Exercise 3* - Fais la pipe (My French is bad, maybe it was Utilize) ================================================================== Use +git format-patch master --stdout | less+ ================================================================== == End of First Part + +[TIP] +================================================================== +If you still cannot get enough about using bash, look http://linux.org.mt/article/terminal[here] + +For more bash programming purposes look http://tldp.org/LDP/Bash-Beginners-Guide/html/[here] + +If anybody finds a neat beginners guide suitable for this topic, please inform! +================================================================== + +== Second Part: + +Now we want to apply a few patch files. + +You will need the patch files you created in Part 1 - Exercise 1! + +Also you should copy the content of https://github.com/scriptdev2/scriptdev2/commit/9438d49b62f81d543489b87e8c8e60d94afb1fcd.patch[SD2-Commit 2302] +into a file in your ScriptDev2 directory, expected name +sd2_2302.patch+ + +=== Applying patches with git apply and git am + +Both commands apply a patch from a filename with appropriate format if possible. + +git am:: +Git am applies a patch created with +format-patch+ to the 'index' ++ +As a formatted patch contains some meta information of the commit(s) from which it was created, it will directly commit the change sets from the commits, and thereby using the provided meta information in the patch file. ++ +Hence a patch file for git am must contain this information in a defined way. + +git apply:: +Git apply applies a patch created with git show or git diff to the 'working tree' ++ +These patches contain no additional meta information, and hence won't be committed automatically. + +To apply the following examples, be sure to be on clear icc_project, to do so use +-------------------------------- +git reset --hard origin/icc_project +-------------------------------- + +[NOTE] +[icon="./images/icons/example.png", caption="Exercise"] +.*Exercise 4* - Apply a patch with git apply +================================================================== +Apply the patch created in Exercise 1 into file +temp_diff.patch+ +-------------------------------- +git apply temp_diff.patch +-------------------------------- +Check what this did! Use git status, git diff and git log to see what this did! + +Reset your changes with +git reset --hard+ +================================================================== + +[NOTE] +[icon="./images/icons/example.png", caption="Exercise"] +.*Exercise 5* - Apply a patch with git am +================================================================== +Apply the patch created in Exercise 1 into file +temp_diff.patch+ +-------------------------------- +git am sd2_2302.patch +-------------------------------- +Check what this did! + +Reset your changes with +git reset --hard origin/icc_project+ +================================================================== + +[NOTE] +[icon="./images/icons/example.png", caption="Exercise"] +.*Exercise 6* - Why why why? +================================================================== +Why did I suggest to use different ways to git reset --hard in exercises 4 and 5? +================================================================== + +[NOTE] +[icon="./images/icons/example.png", caption="Exercise"] +.*Special Exercise 7* - Some first conflicts +================================================================== +Try to apply the changes in +temp_format.patch+ with +git am+ + +This gives errors - Why? + +To abort the attempt to apply this with git am, use +-------------------------------- +git am --abort +-------------------------------- +================================================================== + +[NOTE] +[icon="./images/icons/example.png", caption="Exercise"] +.*Special Exercise 8* - Apply to a conflict free point +================================================================== +Find a point in the history where the changes from +temp_format.patch+ could be applied! + +Checkout to this point, and apply there +-------------------------------- +git checkout -b apply-safe +git am temp_format.patch +-------------------------------- +Now you have applied the patch file. Check what happened with the usual suspects :) +================================================================== + +[NOTE] +[icon="./images/icons/example.png", caption="Exercise"] +.*Special Exercise 9* - Merging conflicts +================================================================== +Checkout to your icc_project branch + +Try to merge the apply-safe branch into your current branch, try +git merge apply-safe+ + +This will give the same conflicts as you had in Exercise 7, but now you have the possibility to use the powerful tools of git to merge. Actually for me merge went without problems! + +However if you still get conflicts, abort the merge with git reset --hard +================================================================== + +Now, there might have been many changes, and it is time to cleanup: + +-------------------------------- +git checkout icc_project +git reset --hard origin/icc_project <2> +git branch -D apply-safe <1> +rm sd2_2302.patch <3> +rm temp_format.patch +rm temp_diff.patch +-------------------------------- + +<1> git branch -D will delete a branch +<2> Do you already know why this time the reset --hard version with origin/icc_project was used? +<3> Remove a few untracked files - check for more with +git status+ + +== End of Second Part + +Today we have seen + +* how to use a console environment +* how to use dark console powers to create patch files +* how to apply patch files +* how using Git the right way conflict solving can become very easy! (Special exercises) + +So, now we have the tools in place to actually start working on ICC code. + +Expect the first steps toward a C++ script in the next days! From d527347e632a3add2a033cb0d8598c92fda91ac3 Mon Sep 17 00:00:00 2001 From: Schmoozerd Date: Fri, 7 Oct 2011 01:58:27 +0200 Subject: [PATCH 15/40] Add html page for Day 4 --- icc_project/documentation/html/day-4.html | 1216 +++++++++++++++++++++ 1 file changed, 1216 insertions(+) create mode 100644 icc_project/documentation/html/day-4.html diff --git a/icc_project/documentation/html/day-4.html b/icc_project/documentation/html/day-4.html new file mode 100644 index 000000000..f506801cc --- /dev/null +++ b/icc_project/documentation/html/day-4.html @@ -0,0 +1,1216 @@ + + + + + + + + + + + +
+

From Day 3 you should have learnt these things:

+
    +
  • +

    +How to read unified diffs +

    +
  • +
  • +

    +How to use git diff, git show and git format-patch to create diff between different commits or the working tree +

    +
  • +
+

Today now is about how to

+
    +
  • +

    +Create patch files, that is files which contain the output from the above commands +

    +
  • +
  • +

    +How to apply them +

    +
  • +
+
+

1. First Part:

+
+

A very neat way to create the patch files within a bash (ie Git bash) is to use the output redirection

+
+

1.1. Excursion: Some notes about working with a console

+

Reasons to still use a console environment for some things

+
    +
  • +

    +You definitively will feel like a geek!\r\n + (Do we actually need more reasons?) +

    +
  • +
  • +

    +Using a console is for some things very fast (and very slow for others) +

    +
  • +
  • +

    +Reasonable to learn, as *nix systems won’t proper work without (Windows systems won’t work proper without using cmd now and then, only that the cmd sucks) +

    +
  • +
+

Most useful commands in a bash console

+

OK, to clarify: When you type commands into a console, there is actually a program that interprets these commands. Some examples are the cmd (from (win)do(w)s), or bash which got popular on Linux

+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ls +
+
+

+List the content of the current directory (on Windows this was called dir) +

+
+cd +
+
+

+Change your directory. If you invoke cd .. then you will change into the parent directory +

+
+cat +
+
+

+Can be used to get text from a file onto the console +

+
+cp A B +
+
+

+Copy a file from A to B +

+
+mv A B +
+
+

+Move a file from A to B (if A and B are in the same directory, than this renames) +

+
+rm A +
+
+

+Remove (this means delete) file A +

+
+mkdir +
+
+

+Create a directory +

+
+rmdir +
+
+

+Remove a directory +

+
+

Very useful things:

+
+
+Auto completion (Bash can do this) +
+
+

+If you want to type something, and press the tab key, the bash will try to auto complete a word for you. +

+

Example: Type (in the ScriptDev2-directory) into the bash: ls to and then press the tab key.

+
+
+Copy and Paste in the bash (For Windows users) +
+
+

+If you click on the top-left corner of your console window, you can select "Edit" and there "Mark" and "Paste". +

+

(Marking is finished with enter, the marked text will then be in your clipboard)

+
+
+Using previously typed commands +
+
+

+With the arrow keys (up, down) you can reuse previous commands easily. +

+
+
+
+
+

1.2. Excursion: Bash output/ input redirection

+

For most console based systems it is possible to use these types of output redirection

+
+ + + + + + + + + + + + +
+> +
+
+

+Forward the output into a file, the file will be created if it does not exist, and truncated before refilled if it exists +

+
+>> +
+
+

+Forward the output into a file, but append if the file already exists +

+
+| +
+
+

+(Called pipe) Forward the output from the program as input to the next program +:: A few more exists which I won’t cover! +

+
+

Remember the nice tools like git diff or git format-patch --stdout from Day 3?

+

They were working nice, but only displayed there stuff in the console.

+

The trick to get their output into files is to use output redirection.

+
+ + + +
+Exercise + +
Exercise 1 - Use output redirection to create patch files
+
    +
  • +

    +Do Exercise 1 from Day3, but redirect the output of git diff with git diff > temp_diff.patch +

    +
  • +
  • +

    +Do Exercise 3 from Day3, but redirect the output of git diff with git diff > temp_format.patch +

    +
  • +
+

And look at these created files with a patch tool (if you have one installed), an editor and cat. +(To use cat do: cat temp_diff.patch and cat temp_format.patch)

+

Congratulation, you have created your first patch files!

+
+
+
+ + + +
+Exercise + +
Exercise 2 - Use output redirection to create patch files
+

Do some more edits and test bash auto completion with git diff > te <press tab key> d <press tab key>

+
+
+

Sometimes you might not want to get all changes directly into a file, but would like to view the output of ie git format-patch --stdout slowly.

+

Remember the pager less from Day 2?

+
+ + + +
+Exercise + +
Exercise 3 - Fais la pipe (My French is bad, maybe it was Utilize)
+

Use git format-patch master --stdout | less

+
+
+
+
+
+
+

2. End of First Part

+
+
+ + + +
+Tip + +

If you still cannot get enough about using bash, look here

+

For more bash programming purposes look here

+

If anybody finds a neat beginners guide suitable for this topic, please inform!

+
+
+
+
+
+

3. Second Part:

+
+

Now we want to apply a few patch files.

+

You will need the patch files you created in Part 1 - Exercise 1!

+

Also you should copy the content of SD2-Commit 2302 +into a file in your ScriptDev2 directory, expected name sd2_2302.patch

+
+

3.1. Applying patches with git apply and git am

+

Both commands apply a patch from a filename with appropriate format if possible.

+
+
+git am +
+
+

+Git am applies a patch created with format-patch to the index +

+

As a formatted patch contains some meta information of the commit(s) from which it was created, it will directly commit the change sets from the commits, and thereby using the provided meta information in the patch file.

+

Hence a patch file for git am must contain this information in a defined way.

+
+
+git apply +
+
+

+Git apply applies a patch created with git show or git diff to the working tree +

+

These patches contain no additional meta information, and hence won’t be committed automatically.

+
+
+

To apply the following examples, be sure to be on clear icc_project, to do so use

+
+
+
git reset --hard origin/icc_project
+
+
+ + + +
+Exercise + +
Exercise 4 - Apply a patch with git apply
+

Apply the patch created in Exercise 1 into file temp_diff.patch

+
+
+
git apply temp_diff.patch
+
+

Check what this did! Use git status, git diff and git log to see what this did!

+

Reset your changes with git reset --hard

+
+
+
+ + + +
+Exercise + +
Exercise 5 - Apply a patch with git am
+

Apply the patch created in Exercise 1 into file temp_diff.patch

+
+
+
git am sd2_2302.patch
+
+

Check what this did!

+

Reset your changes with git reset --hard origin/icc_project

+
+
+
+ + + +
+Exercise + +
Exercise 6 - Why why why?
+

Why did I suggest to use different ways to git reset --hard in exercises 4 and 5?

+
+
+
+ + + +
+Exercise + +
Special Exercise 7 - Some first conflicts
+

Try to apply the changes in temp_format.patch with git am

+

This gives errors - Why?

+

To abort the attempt to apply this with git am, use

+
+
+
git am --abort
+
+
+
+
+ + + +
+Exercise + +
Special Exercise 8 - Apply to a conflict free point
+

Find a point in the history where the changes from temp_format.patch could be applied!

+

Checkout to this point, and apply there

+
+
+
git checkout -b apply-safe <ThisPoint>
+git am temp_format.patch
+
+

Now you have applied the patch file. Check what happened with the usual suspects :)

+
+
+
+ + + +
+Exercise + +
Special Exercise 9 - Merging conflicts
+

Checkout to your icc_project branch

+

Try to merge the apply-safe branch into your current branch, try git merge apply-safe

+

This will give the same conflicts as you had in Exercise 7, but now you have the possibility to use the powerful tools of git to merge. Actually for me merge went without problems!

+

However if you still get conflicts, abort the merge with git reset --hard

+
+
+

Now, there might have been many changes, and it is time to cleanup:

+
+
+
git checkout icc_project
+git reset --hard origin/icc_project 2
+git branch -D apply-safe    1
+rm sd2_2302.patch    3
+rm temp_format.patch
+rm temp_diff.patch
+
+
+ + + +
1 +git branch -D will delete a branch +
2 +Do you already know why this time the reset --hard version with origin/icc_project was used? +
3 +Remove a few untracked files - check for more with git status +
+
+
+
+
+

4. End of Second Part

+
+

Today we have seen

+
    +
  • +

    +how to use a console environment +

    +
  • +
  • +

    +how to use dark console powers to create patch files +

    +
  • +
  • +

    +how to apply patch files +

    +
  • +
  • +

    +how using Git the right way conflict solving can become very easy! (Special exercises) +

    +
  • +
+

So, now we have the tools in place to actually start working on ICC code.

+

Expect the first steps toward a C++ script in the next days!

+
+
+
+

+ + + From c42a0b736bb512129c995670afde271fd5d4e038 Mon Sep 17 00:00:00 2001 From: Schmoozerd Date: Fri, 7 Oct 2011 23:31:35 +0200 Subject: [PATCH 16/40] A few improvements to Day 4, thanks to Krofna --- icc_project/documentation/day-4.txt | 26 +++++++++++++---------- icc_project/documentation/html/day-4.html | 25 +++++++++++----------- 2 files changed, 28 insertions(+), 23 deletions(-) diff --git a/icc_project/documentation/day-4.txt b/icc_project/documentation/day-4.txt index 8c0ca0745..507183b9d 100644 --- a/icc_project/documentation/day-4.txt +++ b/icc_project/documentation/day-4.txt @@ -17,14 +17,18 @@ A very neat way to create the patch files within a bash (ie Git bash) is to use *Reasons to still use a console environment for some things* -* You definitively will feel like a geek!\r\n - (Do we actually need more reasons?) +* You definitively will feel like a geek! ++ +(Do we actually need more reasons?) + * Using a console is for some things very fast (and very slow for others) * Reasonable to learn, as *nix systems won't proper work without (Windows systems won't work proper without using +cmd+ now and then, only that the cmd sucks) *Most useful commands in a bash console* -OK, to clarify: When you type commands into a console, there is actually a program that interprets these commands. Some examples are the cmd (from (win)do(w)s), or bash which got popular on Linux +OK, to clarify: When you type commands into a console, there is actually a program that interprets these commands. + +Some examples are the cmd (from (win)do(w)s), or bash which got popular on Linux [horizontal] *ls*:: List the content of the current directory (on Windows this was called +dir+) @@ -44,7 +48,7 @@ If you want to type something, and press the +tab+ key, the bash will try to aut Example: Type (in the ScriptDev2-directory) into the bash: +ls to+ and then press the +tab+ key. Copy and Paste in the bash (For Windows users):: -If you click on the top-left corner of your console window, you can select "Edit" and there "Mark" and "Paste". +If you click on the top-left corner of your console window, you can select "Edit" and there "Mark" and "Paste". Also you can use the INSERT key to paste the content of your clipboard + (Marking is finished with +enter+, the marked text will then be in your clipboard) @@ -63,7 +67,7 @@ For most console based systems it is possible to use these types of output redir Remember the nice tools like +git diff+ or +git format-patch --stdout+ from Day 3? -They were working nice, but only displayed there stuff in the console. +They were working nice, but only displayed their stuff in the console. The trick to get their output into files is to use output redirection. @@ -143,7 +147,7 @@ git reset --hard origin/icc_project [icon="./images/icons/example.png", caption="Exercise"] .*Exercise 4* - Apply a patch with git apply ================================================================== -Apply the patch created in Exercise 1 into file +temp_diff.patch+ +Apply the patch created in Exercise 1 from file +temp_diff.patch+ -------------------------------- git apply temp_diff.patch -------------------------------- @@ -156,7 +160,7 @@ Reset your changes with +git reset --hard+ [icon="./images/icons/example.png", caption="Exercise"] .*Exercise 5* - Apply a patch with git am ================================================================== -Apply the patch created in Exercise 1 into file +temp_diff.patch+ +Apply the patch from file +sd2_2302.patch+ -------------------------------- git am sd2_2302.patch -------------------------------- @@ -217,15 +221,15 @@ Now, there might have been many changes, and it is time to cleanup: -------------------------------- git checkout icc_project -git reset --hard origin/icc_project <2> -git branch -D apply-safe <1> +git reset --hard origin/icc_project <1> +git branch -D apply-safe <2> rm sd2_2302.patch <3> rm temp_format.patch rm temp_diff.patch -------------------------------- -<1> git branch -D will delete a branch -<2> Do you already know why this time the reset --hard version with origin/icc_project was used? +<1> Do you already know why this time the reset --hard version with origin/icc_project was used? +<2> git branch -D will delete a branch <3> Remove a few untracked files - check for more with +git status+ == End of Second Part diff --git a/icc_project/documentation/html/day-4.html b/icc_project/documentation/html/day-4.html index f506801cc..2000e674f 100644 --- a/icc_project/documentation/html/day-4.html +++ b/icc_project/documentation/html/day-4.html @@ -773,9 +773,9 @@

1.1. Excursion: Some
  • -You definitively will feel like a geek!\r\n - (Do we actually need more reasons?) +You definitively will feel like a geek!

    +

    (Do we actually need more reasons?)

  • @@ -789,7 +789,8 @@

    1.1. Excursion: Some

Most useful commands in a bash console

-

OK, to clarify: When you type commands into a console, there is actually a program that interprets these commands. Some examples are the cmd (from (win)do(w)s), or bash which got popular on Linux

+

OK, to clarify: When you type commands into a console, there is actually a program that interprets these commands.

+

Some examples are the cmd (from (win)do(w)s), or bash which got popular on Linux

@@ -896,7 +897,7 @@

1.1. Excursion: Some

-If you click on the top-left corner of your console window, you can select "Edit" and there "Mark" and "Paste". +If you click on the top-left corner of your console window, you can select "Edit" and there "Mark" and "Paste". Also you can use the INSERT key to paste the content of your clipboard

(Marking is finished with enter, the marked text will then be in your clipboard)

@@ -950,7 +951,7 @@

1.2. Excursion: Bash output/ i

Remember the nice tools like git diff or git format-patch --stdout from Day 3?

-

They were working nice, but only displayed there stuff in the console.

+

They were working nice, but only displayed their stuff in the console.

The trick to get their output into files is to use output redirection.

@@ -1064,7 +1065,7 @@

3.1. Applying patches with

Exercise 4 - Apply a patch with git apply
-

Apply the patch created in Exercise 1 into file temp_diff.patch

+

Apply the patch created in Exercise 1 from file temp_diff.patch

git apply temp_diff.patch
@@ -1081,7 +1082,7 @@

3.1. Applying patches with

Exercise 5 - Apply a patch with git am
-

Apply the patch created in Exercise 1 into file temp_diff.patch

+

Apply the patch from file sd2_2302.patch

git am sd2_2302.patch
@@ -1155,18 +1156,18 @@

3.1. Applying patches with
git checkout icc_project
-git reset --hard origin/icc_project 2
-git branch -D apply-safe    1
+git reset --hard origin/icc_project 1
+git branch -D apply-safe    2
 rm sd2_2302.patch    3
 rm temp_format.patch
 rm temp_diff.patch
1 -git branch -D will delete a branch +Do you already know why this time the reset --hard version with origin/icc_project was used?
2 -Do you already know why this time the reset --hard version with origin/icc_project was used? +git branch -D will delete a branch
3 Remove a few untracked files - check for more with git status @@ -1209,7 +1210,7 @@

4. End of Second Part


From 55481e026600049a66277ee4e71110b1ba797418 Mon Sep 17 00:00:00 2001 From: Schmoozerd Date: Tue, 11 Oct 2011 18:51:53 +0200 Subject: [PATCH 17/40] ICC, Festergut - Implement first script --- .../icecrown_citadel/boss_festergut.cpp | 23 +++++++++++++++++++ sql/mangos_scriptname_full.sql | 3 +++ sql/updates/r8800_mangos.sql | 1 + 3 files changed, 27 insertions(+) create mode 100644 sql/updates/r8800_mangos.sql diff --git a/scripts/northrend/icecrown_citadel/icecrown_citadel/boss_festergut.cpp b/scripts/northrend/icecrown_citadel/icecrown_citadel/boss_festergut.cpp index d0ce13034..acd358d58 100644 --- a/scripts/northrend/icecrown_citadel/icecrown_citadel/boss_festergut.cpp +++ b/scripts/northrend/icecrown_citadel/icecrown_citadel/boss_festergut.cpp @@ -38,6 +38,29 @@ enum SAY_FESTERGUT_DEATH = -1631091, }; +struct MANGOS_DLL_DECL boss_festergutAI : public ScriptedAI +{ + boss_festergutAI(Creature* pCreature) : ScriptedAI(pCreature) + { + Reset(); + } + + void Reset() + { + } +}; + +CreatureAI* GetAI_boss_festergut(Creature* pCreature) +{ + return new boss_festergutAI(pCreature); +} + void AddSC_boss_festergut() { + Script* pNewScript; + + pNewScript = new Script; + pNewScript->Name = "boss_festergut"; + pNewScript->GetAI = &GetAI_boss_festergut; + pNewScript->RegisterSelf(); } diff --git a/sql/mangos_scriptname_full.sql b/sql/mangos_scriptname_full.sql index 8d95c69f5..de37e427d 100644 --- a/sql/mangos_scriptname_full.sql +++ b/sql/mangos_scriptname_full.sql @@ -707,6 +707,9 @@ UPDATE creature_template SET ScriptName='npc_silvermoon_harry' WHERE entry=24539 /* ICECROWN CITADEL */ /* */ +/* ICECROWN CITADEL */ +UPDATE creature_template SET ScriptName='boss_festergut' WHERE entry=36626; + /* FORGE OF SOULS */ UPDATE creature_template SET ScriptName='boss_bronjahm' WHERE entry=36497; UPDATE creature_template SET ScriptName='npc_corrupted_soul_fragment' WHERE entry=36535; diff --git a/sql/updates/r8800_mangos.sql b/sql/updates/r8800_mangos.sql new file mode 100644 index 000000000..262da6df8 --- /dev/null +++ b/sql/updates/r8800_mangos.sql @@ -0,0 +1 @@ +UPDATE creature_template SET ScriptName='boss_festergut' WHERE entry=36626; From 844c6b3e2d57935cce2b48abde472352cad30c0d Mon Sep 17 00:00:00 2001 From: Schmoozerd Date: Tue, 11 Oct 2011 21:21:56 +0200 Subject: [PATCH 18/40] Day 7 - First script and basic OOP introduction --- icc_project/documentation/day-7.txt | 300 ++++++++++++++++++++++++++++ 1 file changed, 300 insertions(+) create mode 100644 icc_project/documentation/day-7.txt diff --git a/icc_project/documentation/day-7.txt b/icc_project/documentation/day-7.txt new file mode 100644 index 000000000..7d2fa0896 --- /dev/null +++ b/icc_project/documentation/day-7.txt @@ -0,0 +1,300 @@ + +From the first week you should have learnt how to use Git to manage your source code + +In this week we will start to look at the basic parts of actual boss scripting. + +Today now is about how to + +* What the first script looks like +* A few elemental things about object oriented programming (OOP) + +== First Part: + +=== The very first script + +In commit 55481e02, see https://github.com/scriptdev2/scriptdev2/commit/55481e026600049a66277ee4e71110b1ba797418[Commit on Github] I added the following patch to the icc_branch: + +-------------------------------- +From 55481e026600049a66277ee4e71110b1ba797418 Mon Sep 17 00:00:00 2001 +From: Schmoozerd +Date: Tue, 11 Oct 2011 18:51:53 +0200 +Subject: [PATCH] ICC, Festergut - Implement first script + +--- + .../icecrown_citadel/boss_festergut.cpp | 23 ++++++++++++++++++++ + sql/mangos_scriptname_full.sql | 3 ++ + sql/updates/r8800_mangos.sql | 1 + + 3 files changed, 27 insertions(+), 0 deletions(-) + create mode 100644 sql/updates/r8800_mangos.sql + +diff --git a/scripts/northrend/icecrown_citadel/icecrown_citadel/boss_festergut.cpp b/scripts/northrend/icecrown_citadel/icecrown_citadel/boss_festergut.cpp +index d0ce130..acd358d 100644 +--- a/scripts/northrend/icecrown_citadel/icecrown_citadel/boss_festergut.cpp ++++ b/scripts/northrend/icecrown_citadel/icecrown_citadel/boss_festergut.cpp +@@ -38,6 +38,29 @@ enum + SAY_FESTERGUT_DEATH = -1631091, + }; + ++struct MANGOS_DLL_DECL boss_festergutAI : public ScriptedAI <1> ++{ ++ boss_festergutAI(Creature* pCreature) : ScriptedAI(pCreature) ++ { ++ Reset(); ++ } ++ ++ void Reset() <2> ++ { ++ } ++}; ++ ++CreatureAI* GetAI_boss_festergut(Creature* pCreature) <3> ++{ ++ return new boss_festergutAI(pCreature); ++} ++ + void AddSC_boss_festergut() + { ++ Script* pNewScript; <4> ++ ++ pNewScript = new Script; ++ pNewScript->Name = "boss_festergut"; ++ pNewScript->GetAI = &GetAI_boss_festergut; ++ pNewScript->RegisterSelf(); + } +diff --git a/sql/mangos_scriptname_full.sql b/sql/mangos_scriptname_full.sql +index 8d95c69..de37e42 100644 +--- a/sql/mangos_scriptname_full.sql ++++ b/sql/mangos_scriptname_full.sql +@@ -707,6 +707,9 @@ UPDATE creature_template SET ScriptName='npc_silvermoon_harry' WHERE entry=24539 + /* ICECROWN CITADEL */ + /* */ + <5> ++/* ICECROWN CITADEL */ ++UPDATE creature_template SET ScriptName='boss_festergut' WHERE entry=36626; ++ + /* FORGE OF SOULS */ + UPDATE creature_template SET ScriptName='boss_bronjahm' WHERE entry=36497; + UPDATE creature_template SET ScriptName='npc_corrupted_soul_fragment' WHERE entry=36535; +diff --git a/sql/updates/r8800_mangos.sql b/sql/updates/r8800_mangos.sql +new file mode 100644 +index 0000000..262da6d +--- /dev/null ++++ b/sql/updates/r8800_mangos.sql +@@ -0,0 +1 @@ <6> ++UPDATE creature_template SET ScriptName='boss_festergut' WHERE entry=36626; +-- +1.7.6.msysgit.0 + +-------------------------------- + +==== How this commit and patch here were created: + +-------------------------------- + +git add sql/updates/r8800_mangos.sql ## To track this new file +git commit -a -m "ICC, Festergut - Implement first script" ## Commit all changes and name commit msg +git log ## To get the hash-id +git format-patch HEAD^..HEAD --stdout > temp.patch ## Get the patch (and pasted here) +-------------------------------- + +==== What can be seen here + +Actually there are 6 main steps that I did - Don't worry, they should be clear by the end of the day: + +<1> The actual class for the bossAI (AI = Artificial Intelligence) to be scripted +<2> Any SD2 Boss script must implement the Reset function +<3> The wrapper to actually create an instance of the implemented class +<4> Some internal magic to help registering a script to SD2 side such that it can be used after assigned to the database. ++ +Remark especially that the to be used ScriptName is assigned here, too + +<5> The required SQL-changes for +mangos_scriptname_full.sql+ +<6> The required SQL-changes for the sql update file + +=== Object oriented programming + +This is now about the most fundamental aspect -- *objects* and *classes* + +==== What is a class? What is an object? + +A class is the 'shape' or an 'idea' of *things* that we have in our mind. + +I will stay with the name 'idea' for now, because I think to distinct between classes and objects, it is (for now) easier to use the words "thing" and "idea". + +When you go outside, then you might see an actual tree that grows high up into the air. This tree is an actual 'thing', that you can see, feel, smell and so on, it is part of the reality. +Nearby, there might be another tree, which would be another 'thing', but also an tree. +As a matter of fact, to read this sentence you must have an 'idea' of trees in your mind (connected to the word tree), which helps you to recognise a tree when you see one. + +So, in your mind there lives the 'idea' of tree, and in reality you can see 'things' that fit into the category tree - which is the 'idea' tree you have. + +If you want to know if a 'thing' is a tree, you might compare the properties of the thing you see to the 'idea' of tree you have in your mind. In your example (tree) reasonable properties would be: +A tree has roots, a stem, branches, and in summer the branches have leaves or needles. Also you might expect that the stem is quite tall, the roots are mostly in the earth, and so on.. + +Important of the concept of ideas is that you can differ: +No real 'thing' is exactly like the 'idea' of it, and no 'idea' is exactly like any real thing. They both live in different planes. + +About functionality: +* An idea can have attributes, expected behaviour (drop leaves in winter), and ways to modify it (nick an apple) +* The things realises - which means fill the values and behaviour - of these functionalities + +In OOP (Object Oriented Programming) this concept is used in this way: +* An 'idea' is represented by a *class*, +* A 'thing' is represented by an *object* (or often called *instance* (of the class) ) + +Note: I feel this is not well written, any improvements are very welcome + +==== A class hierarchy + +As noted above the concepts of classes and objects is very natural to the way we think, and there is one other big part that is important: *Inheritance* +Classes can be subclasses of other classes, or parent classes of other classes. + +This means, a class "A" which is a subclass of class "B" inherits all stuff from class B, but might overwrite a few things, or extend functionality. + +If you now have many classes, which have sub and super classes, you have a hierarchy. + +As this is also a very fundamental concept, I will give a very simple example: + +*Possible class hierarchy of two dimensional elemental geometric shapes* + +image:images/geo_shapes.png[Image: Class hierarchy for geometric shapes] + +See also http://666kb.com/i/bxpk46qvs7hzcu7am.gif[In case the image does not directly work] + +There you can see (in some UML notation) the setup: + +* A super class which is rather abstract, named GeometricalShape ++ +This class has the attribute of the +LeftBottomCorner+ (of type Point ), a +Color+ attribute and a function to get the area +GetArea+ + +* A "Circle" is a geometric shape, hence it is realised as a subclass. ++ +Note that the attributes Color and LeftBottomCorner are inherited from GeometricShape. ++ +The function +GetArea+ needs to be overwritten to reproduce the expected result + +* A "Rectangular" is also a geometric shape, however there we need an additional point (Could have also used height and width). +* A "Square" is a specialisation of a rectangular, hence realised as subclass + +NOTE: These are only classes, no objects yet! + +===== C++ implementation of this hierarchy + +This is a sketch of normal C++ implementation + +-------------------------------- +class GeometricShape <1> +{ + GeometricShape(Point leftBottomCorner, int color) <2> + { + m_pLeftBottomCorner.x = leftBottomCorner.x; <3> + m_pLeftBottomCorner.y = leftBottomCorner.y; + m_iColor = color; + } + + virtual float GetArea() { return 0.0f; } <4> + + Point m_pLeftBottomCorner; <5> + int m_iColor; +}; + +class Circle : public GeometricShape <6> +{ + Circle(Point leftBottomCorner, int color, float radius) : GeometricShape(leftBottomCorner, color) <7> + { + m_fRadius = radius; + } + + float GetArea() <8> + { + return radius*radius*(float)PI; + } + + float m_fRadius; <9> +}; +... +-------------------------------- + +What do the different lines mean: + +<1> This tells C++ that a new class starts which is named +GeometricShape+ +<2> This is the constructor of the class (when an object of a class is instantiated, the constructor is the first thing that is called) ++ +Here we tell the constructor to require two parameters, one of type Point, and one of type int + +<3> Here we set the internal values of the class to the parameters given in the constructor +<4> This is the default function to return the area of the geometric shape ++ +The visual keyword is there, to mark this function to be overwritten by subclasses + +<5> These are two member variables for the class. ++ +This is in Hungarian Notation which we use in ScriptDev2. For more information see http://www.scriptdev2.com/showthread.php?t=4098[SD2 Coding Standards] + +<6> This defines Circle as subclass of GeometricShape (by the :) +<7> Constructor for Circle, we call the constructor of GeometricShape, and also set the new member variable +<8> Overwrite the GetArea function to return the expected value for a circle. +<9> A member variable of Circle + +[TIP] +================================================================== +Some overview for OOP: http://en.wikipedia.org/wiki/Object-oriented_programming[wikipedia OOP overview] - This covers mostly concepts + +A fair warning about the example I chosed here: http://en.wikipedia.org/wiki/Circle-ellipse_problem[Why it works in this simple way, but may fail in other cases] + +Some C++ specific tutorial, which goes far further than such a small guide like this would ever do: http://www.desy.de/gna/html/cc/Tutorial/tutorial.html +================================================================== + +== Back to the class hierarchy for boss scripts in ScriptDev2 + +-------------------------------- +struct MANGOS_DLL_DECL boss_festergutAI : public ScriptedAI <1> +{ + boss_festergutAI(Creature* pCreature) : ScriptedAI(pCreature) <2> + { + Reset(); + } + + void Reset() <3> + { + } +}; + +CreatureAI* GetAI_boss_festergut(Creature* pCreature) <4> +{ + return new boss_festergutAI(pCreature); <5> +} +-------------------------------- + +<1> In this line we define the class +boss_festergutAI+ as a subclass of +ScriptedAI+ ++ +* struct and class mean for us for now the same +* the +MANGOS_DLL_DECL+ can be considered as magic, that is required because we implement a class for a DLL to be used by another project + +<2> The constructor for our class: We inherit stuff from ScriptedAI, and call its constructor first, then we do some own code +<3> Reset is a so called "pure virtual function" which means a subclass must implement it, else wise it won't compile +<4> This is now something new. If you have read the stuff above carefully you would have noted that we have yet only implemented classes, but never objects. ++ +But of course we want to handle objects, each boss should have a specific object/ instance of the AI loaded. This is done with the +new+ keyword. + +<5> This line creates a new object of the class +boss_festergutAI+ and handles this newly created class back to some other places (actually to mangos) where it is assigned to the real boss. + +== End of first part + +[NOTE] +[icon="./images/icons/example.png", caption="Exercise"] +.*Exercise 1* - Test the first script! +================================================================== +Compile SD2 with these changes, and then test the script on boss festergut. + +As the script does not do very much, use the +.npc aiinfo+ command, to see if it is actually loaded +================================================================== + +What you should have seen today: + +* Basic things of OOP: Classes and Objects +* Inheritance as fundamental concept to make the programmers' life easier + +What comes next: + +* A few notes to class hierarchy used in ScriptDev2 (CreatureAI <- ScriptedAI <- boss_*AI) +* How to bring life to the first script. From d9c88f81c53ef92ef06f9f875a40d77d4a3909a8 Mon Sep 17 00:00:00 2001 From: Schmoozerd Date: Tue, 11 Oct 2011 21:27:25 +0200 Subject: [PATCH 19/40] Add html for Day 7 --- icc_project/documentation/html/day-7.html | 1130 +++++++++++++++++ .../documentation/html/images/geo_shapes.png | Bin 0 -> 6328 bytes 2 files changed, 1130 insertions(+) create mode 100644 icc_project/documentation/html/day-7.html create mode 100644 icc_project/documentation/html/images/geo_shapes.png diff --git a/icc_project/documentation/html/day-7.html b/icc_project/documentation/html/day-7.html new file mode 100644 index 000000000..87995686c --- /dev/null +++ b/icc_project/documentation/html/day-7.html @@ -0,0 +1,1130 @@ + + + + + + + + + + + +
+

From the first week you should have learnt how to use Git to manage your source code

+

In this week we will start to look at the basic parts of actual boss scripting.

+

Today now is about how to

+
    +
  • +

    +What the first script looks like +

    +
  • +
  • +

    +A few elemental things about object oriented programming (OOP) +

    +
  • +
+
+

1. First Part:

+
+
+

1.1. The very first script

+

In commit 55481e02, see Commit on Github I added the following patch to the icc_branch:

+
+
+
From 55481e026600049a66277ee4e71110b1ba797418 Mon Sep 17 00:00:00 2001
+From: Schmoozerd <schmoozerd@scriptdev2.com>
+Date: Tue, 11 Oct 2011 18:51:53 +0200
+Subject: [PATCH] ICC, Festergut - Implement first script
+
+---
+ .../icecrown_citadel/boss_festergut.cpp            |   23 ++++++++++++++++++++
+ sql/mangos_scriptname_full.sql                     |    3 ++
+ sql/updates/r8800_mangos.sql                       |    1 +
+ 3 files changed, 27 insertions(+), 0 deletions(-)
+ create mode 100644 sql/updates/r8800_mangos.sql
+
+diff --git a/scripts/northrend/icecrown_citadel/icecrown_citadel/boss_festergut.cpp b/scripts/northrend/icecrown_citadel/icecrown_citadel/boss_festergut.cpp
+index d0ce130..acd358d 100644
+--- a/scripts/northrend/icecrown_citadel/icecrown_citadel/boss_festergut.cpp
++++ b/scripts/northrend/icecrown_citadel/icecrown_citadel/boss_festergut.cpp
+@@ -38,6 +38,29 @@ enum
+     SAY_FESTERGUT_DEATH         = -1631091,
+ };
+
++struct MANGOS_DLL_DECL boss_festergutAI : public ScriptedAI        1
++{
++    boss_festergutAI(Creature* pCreature) : ScriptedAI(pCreature)
++    {
++        Reset();
++    }
++
++    void Reset()                                                   2
++    {
++    }
++};
++
++CreatureAI* GetAI_boss_festergut(Creature* pCreature)              3
++{
++    return new boss_festergutAI(pCreature);
++}
++
+ void AddSC_boss_festergut()
+ {
++    Script* pNewScript;                                            4
++
++    pNewScript = new Script;
++    pNewScript->Name = "boss_festergut";
++    pNewScript->GetAI = &GetAI_boss_festergut;
++    pNewScript->RegisterSelf();
+ }
+diff --git a/sql/mangos_scriptname_full.sql b/sql/mangos_scriptname_full.sql
+index 8d95c69..de37e42 100644
+--- a/sql/mangos_scriptname_full.sql
++++ b/sql/mangos_scriptname_full.sql
+@@ -707,6 +707,9 @@ UPDATE creature_template SET ScriptName='npc_silvermoon_harry' WHERE entry=24539
+ /* ICECROWN CITADEL */
+ /*  */
+                                                                    5
++/* ICECROWN CITADEL */
++UPDATE creature_template SET ScriptName='boss_festergut' WHERE entry=36626;
++
+ /* FORGE OF SOULS */
+ UPDATE creature_template SET ScriptName='boss_bronjahm' WHERE entry=36497;
+ UPDATE creature_template SET ScriptName='npc_corrupted_soul_fragment' WHERE entry=36535;
+diff --git a/sql/updates/r8800_mangos.sql b/sql/updates/r8800_mangos.sql
+new file mode 100644
+index 0000000..262da6d
+--- /dev/null
++++ b/sql/updates/r8800_mangos.sql
+@@ -0,0 +1 @@                                                       6
++UPDATE creature_template SET ScriptName='boss_festergut' WHERE entry=36626;
+--
+1.7.6.msysgit.0
+
+
+

1.1.1. How this commit and patch here were created:

+
+
+
<Edit the required stuff>
+git add sql/updates/r8800_mangos.sql                                    ## To track this new file
+git commit -a -m "ICC, Festergut - Implement first script"              ## Commit all changes and name commit msg
+git log                                                                 ## To get the hash-id
+git format-patch HEAD^..HEAD --stdout > temp.patch                      ## Get the patch (and pasted here)
+
+
+
+

1.1.2. What can be seen here

+

Actually there are 6 main steps that I did - Don’t worry, they should be clear by the end of the day:

+
+ + + + + + +
1 +The actual class for the bossAI (AI = Artificial Intelligence) to be scripted +
2 +Any SD2 Boss script must implement the Reset function +
3 +The wrapper to actually create an instance of the implemented class +
4 +Some internal magic to help registering a script to SD2 side such that it can be used after assigned to the database. +

Remark especially that the to be used ScriptName is assigned here, too

+
5 +The required SQL-changes for mangos_scriptname_full.sql +
6 +The required SQL-changes for the sql update file +
+
+
+
+

1.2. Object oriented programming

+

This is now about the most fundamental aspect — objects and classes

+
+

1.2.1. What is a class? What is an object?

+

A class is the shape or an idea of things that we have in our mind.

+

I will stay with the name idea for now, because I think to distinct between classes and objects, it is (for now) easier to use the words "thing" and "idea".

+

When you go outside, then you might see an actual tree that grows high up into the air. This tree is an actual thing, that you can see, feel, smell and so on, it is part of the reality. +Nearby, there might be another tree, which would be another thing, but also an tree. +As a matter of fact, to read this sentence you must have an idea of trees in your mind (connected to the word tree), which helps you to recognise a tree when you see one.

+

So, in your mind there lives the idea of tree, and in reality you can see things that fit into the category tree - which is the idea tree you have.

+

If you want to know if a thing is a tree, you might compare the properties of the thing you see to the idea of tree you have in your mind. In your example (tree) reasonable properties would be: +A tree has roots, a stem, branches, and in summer the branches have leaves or needles. Also you might expect that the stem is quite tall, the roots are mostly in the earth, and so on..

+

Important of the concept of ideas is that you can differ: +No real thing is exactly like the idea of it, and no idea is exactly like any real thing. They both live in different planes.

+

About functionality: +* An idea can have attributes, expected behaviour (drop leaves in winter), and ways to modify it (nick an apple) +* The things realises - which means fill the values and behaviour - of these functionalities

+

In OOP (Object Oriented Programming) this concept is used in this way: +* An idea is represented by a class, +* A thing is represented by an object (or often called instance (of the class) )

+

Note: I feel this is not well written, any improvements are very welcome

+
+
+

1.2.2. A class hierarchy

+

As noted above the concepts of classes and objects is very natural to the way we think, and there is one other big part that is important: Inheritance +Classes can be subclasses of other classes, or parent classes of other classes.

+

This means, a class "A" which is a subclass of class "B" inherits all stuff from class B, but might overwrite a few things, or extend functionality.

+

If you now have many classes, which have sub and super classes, you have a hierarchy.

+

As this is also a very fundamental concept, I will give a very simple example:

+

Possible class hierarchy of two dimensional elemental geometric shapes

+

+Image: Class hierarchy for geometric shapes +

+ +

There you can see (in some UML notation) the setup:

+
    +
  • +

    +A super class which is rather abstract, named GeometricalShape +

    +

    This class has the attribute of the LeftBottomCorner (of type Point ), a Color attribute and a function to get the area GetArea

    +
  • +
  • +

    +A "Circle" is a geometric shape, hence it is realised as a subclass. +

    +

    Note that the attributes Color and LeftBottomCorner are inherited from GeometricShape.

    +

    The function GetArea needs to be overwritten to reproduce the expected result

    +
  • +
  • +

    +A "Rectangular" is also a geometric shape, however there we need an additional point (Could have also used height and width). +

    +
  • +
  • +

    +A "Square" is a specialisation of a rectangular, hence realised as subclass +

    +
  • +
+
+ + + +
+Note +These are only classes, no objects yet!
+
+
+
C++ implementation of this hierarchy
+

This is a sketch of normal C++ implementation

+
+
+
class GeometricShape                                    1
+{
+    GeometricShape(Point leftBottomCorner, int color)   2
+    {
+        m_pLeftBottomCorner.x = leftBottomCorner.x;     3
+        m_pLeftBottomCorner.y = leftBottomCorner.y;
+        m_iColor = color;
+    }
+
+    virtual float GetArea() { return 0.0f; }            4
+
+    Point m_pLeftBottomCorner;                          5
+    int m_iColor;
+};
+
+class Circle : public GeometricShape                    6
+{
+    Circle(Point leftBottomCorner, int color, float radius) : GeometricShape(leftBottomCorner, color)   7
+    {
+        m_fRadius = radius;
+    }
+
+    float GetArea()                                     8
+    {
+        return radius*radius*(float)PI;
+    }
+
+    float m_fRadius;                                    9
+};
+...
+
+

What do the different lines mean:

+
+ + + + + + + + + +
1 +This tells C++ that a new class starts which is named GeometricShape +
2 +This is the constructor of the class (when an object of a class is instantiated, the constructor is the first thing that is called) +

Here we tell the constructor to require two parameters, one of type Point, and one of type int

+
3 +Here we set the internal values of the class to the parameters given in the constructor +
4 +This is the default function to return the area of the geometric shape +

The visual keyword is there, to mark this function to be overwritten by subclasses

+
5 +These are two member variables for the class. +

This is in Hungarian Notation which we use in ScriptDev2. For more information see SD2 Coding Standards

+
6 +This defines Circle as subclass of GeometricShape (by the :) +
7 +Constructor for Circle, we call the constructor of GeometricShape, and also set the new member variable +
8 +Overwrite the GetArea function to return the expected value for a circle. +
9 +A member variable of Circle +
+
+ + + +
+Tip + +

Some overview for OOP: wikipedia OOP overview - This covers mostly concepts

+

A fair warning about the example I chosed here: Why it works in this simple way, but may fail in other cases

+

Some C++ specific tutorial, which goes far further than such a small guide like this would ever do: http://www.desy.de/gna/html/cc/Tutorial/tutorial.html

+
+
+
+
+
+
+
+
+

2. Back to the class hierarchy for boss scripts in ScriptDev2

+
+
+
+
struct MANGOS_DLL_DECL boss_festergutAI : public ScriptedAI        1
+{
+    boss_festergutAI(Creature* pCreature) : ScriptedAI(pCreature)  2
+    {
+        Reset();
+    }
+
+    void Reset()                                                   3
+    {
+    }
+};
+
+CreatureAI* GetAI_boss_festergut(Creature* pCreature)              4
+{
+    return new boss_festergutAI(pCreature);                        5
+}
+
+
+ + + + + +
1 +In this line we define the class boss_festergutAI as a subclass of ScriptedAI +
    +
  • +

    +struct and class mean for us for now the same +

    +
  • +
  • +

    +the MANGOS_DLL_DECL can be considered as magic, that is required because we implement a class for a DLL to be used by another project +

    +
  • +
+
2 +The constructor for our class: We inherit stuff from ScriptedAI, and call its constructor first, then we do some own code +
3 +Reset is a so called "pure virtual function" which means a subclass must implement it, else wise it won’t compile +
4 +This is now something new. If you have read the stuff above carefully you would have noted that we have yet only implemented classes, but never objects. +

But of course we want to handle objects, each boss should have a specific object/ instance of the AI loaded. This is done with the new keyword.

+
5 +This line creates a new object of the class boss_festergutAI and handles this newly created class back to some other places (actually to mangos) where it is assigned to the real boss. +
+
+
+
+

3. End of first part

+
+
+ + + +
+Exercise + +
Exercise 1 - Test the first script!
+

Compile SD2 with these changes, and then test the script on boss festergut.

+

As the script does not do very much, use the .npc aiinfo command, to see if it is actually loaded

+
+
+

What you should have seen today:

+
    +
  • +

    +Basic things of OOP: Classes and Objects +

    +
  • +
  • +

    +Inheritance as fundamental concept to make the programmers' live easier +

    +
  • +
+

What comes next:

+
    +
  • +

    +A few notes to class hierarchy used in ScriptDev2 (CreatureAI ← ScriptedAI ← boss_*AI) +

    +
  • +
  • +

    +How to bring live to the first script. +

    +
  • +
+
+
+
+

+ + + diff --git a/icc_project/documentation/html/images/geo_shapes.png b/icc_project/documentation/html/images/geo_shapes.png new file mode 100644 index 0000000000000000000000000000000000000000..f024c4a7730586074cd4c270539ad04ce55273b9 GIT binary patch literal 6328 zcmbt(c{o&m`#(|<*$de+_FeXDg^?j6Ym%ixG&JLrov}og5n^l^I}M^xmIgyo_O+}r zma?y7C&rlX>FM)4*Yo^-*YA5>&-MFbuIp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%y@O(6Kl1Rl$exf}ojf zBY@9bnmCJ!f)vJ}Ae9q<-i-sO5%e#?k$;VAVx-CO`aP|CG8fjPR*yov45312Xh6C! zPe0a{!@-NJtWJBu4eU~T$%9kb1Zx}!XAP&^ByH0X)&(H__U;YFyQpWkyK>Vl{L%o}ldZ;@s* Date: Fri, 14 Oct 2011 23:33:07 +0200 Subject: [PATCH 20/40] Fix typo in Day 7, thanks to krofna --- icc_project/documentation/day-7.txt | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/icc_project/documentation/day-7.txt b/icc_project/documentation/day-7.txt index 7d2fa0896..360f525f2 100644 --- a/icc_project/documentation/day-7.txt +++ b/icc_project/documentation/day-7.txt @@ -1,4 +1,3 @@ - From the first week you should have learnt how to use Git to manage your source code In this week we will start to look at the basic parts of actual boss scripting. @@ -224,7 +223,7 @@ Here we tell the constructor to require two parameters, one of type Point, and o <3> Here we set the internal values of the class to the parameters given in the constructor <4> This is the default function to return the area of the geometric shape + -The visual keyword is there, to mark this function to be overwritten by subclasses +The virtual keyword is there, to mark this function to be overwritten by subclasses <5> These are two member variables for the class. + From 7190ec4655946b4497fd24a68d98125a2c093efe Mon Sep 17 00:00:00 2001 From: Schmoozerd Date: Fri, 14 Oct 2011 23:35:10 +0200 Subject: [PATCH 21/40] Rename files to fit wiki filenames --- icc_project/documentation/{day_1.txt => day-1.txt} | 0 icc_project/documentation/{day_2.txt => day-2.txt} | 0 icc_project/documentation/{day_3.txt => day-3.txt} | 0 icc_project/documentation/html/{day_1.html => day-1.html} | 0 icc_project/documentation/html/{day_2.html => day-2.html} | 0 icc_project/documentation/html/{day_3.html => day-3.html} | 0 6 files changed, 0 insertions(+), 0 deletions(-) rename icc_project/documentation/{day_1.txt => day-1.txt} (100%) rename icc_project/documentation/{day_2.txt => day-2.txt} (100%) rename icc_project/documentation/{day_3.txt => day-3.txt} (100%) rename icc_project/documentation/html/{day_1.html => day-1.html} (100%) rename icc_project/documentation/html/{day_2.html => day-2.html} (100%) rename icc_project/documentation/html/{day_3.html => day-3.html} (100%) diff --git a/icc_project/documentation/day_1.txt b/icc_project/documentation/day-1.txt similarity index 100% rename from icc_project/documentation/day_1.txt rename to icc_project/documentation/day-1.txt diff --git a/icc_project/documentation/day_2.txt b/icc_project/documentation/day-2.txt similarity index 100% rename from icc_project/documentation/day_2.txt rename to icc_project/documentation/day-2.txt diff --git a/icc_project/documentation/day_3.txt b/icc_project/documentation/day-3.txt similarity index 100% rename from icc_project/documentation/day_3.txt rename to icc_project/documentation/day-3.txt diff --git a/icc_project/documentation/html/day_1.html b/icc_project/documentation/html/day-1.html similarity index 100% rename from icc_project/documentation/html/day_1.html rename to icc_project/documentation/html/day-1.html diff --git a/icc_project/documentation/html/day_2.html b/icc_project/documentation/html/day-2.html similarity index 100% rename from icc_project/documentation/html/day_2.html rename to icc_project/documentation/html/day-2.html diff --git a/icc_project/documentation/html/day_3.html b/icc_project/documentation/html/day-3.html similarity index 100% rename from icc_project/documentation/html/day_3.html rename to icc_project/documentation/html/day-3.html From eefcbddba601b3a7d209181103ed833070ce86fc Mon Sep 17 00:00:00 2001 From: Schmoozerd Date: Fri, 14 Oct 2011 23:37:29 +0200 Subject: [PATCH 22/40] Recent html changes to day7 --- icc_project/documentation/html/day-7.html | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/icc_project/documentation/html/day-7.html b/icc_project/documentation/html/day-7.html index 87995686c..121a6e5d0 100644 --- a/icc_project/documentation/html/day-7.html +++ b/icc_project/documentation/html/day-7.html @@ -986,7 +986,7 @@
C++ implementation of this hierarch
4 This is the default function to return the area of the geometric shape -

The visual keyword is there, to mark this function to be overwritten by subclasses

+

The virtual keyword is there, to mark this function to be overwritten by subclasses

5 These are two member variables for the class. @@ -1100,7 +1100,7 @@

3. End of first part

  • -Inheritance as fundamental concept to make the programmers' live easier +Inheritance as fundamental concept to make the programmers' life easier

  • @@ -1113,7 +1113,7 @@

    3. End of first part

  • -How to bring live to the first script. +How to bring life to the first script.

  • @@ -1123,7 +1123,7 @@

    3. End of first part


    From 26dae0d5883f45c40c5504df5018c550e43fb20a Mon Sep 17 00:00:00 2001 From: Schmoozerd Date: Fri, 14 Oct 2011 23:53:22 +0200 Subject: [PATCH 23/40] Add structograms for festergut, thanks to gzor --- .../research/research_boss_festergut.txt | 23 +++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/icc_project/research/research_boss_festergut.txt b/icc_project/research/research_boss_festergut.txt index e69de29bb..f139357a0 100644 --- a/icc_project/research/research_boss_festergut.txt +++ b/icc_project/research/research_boss_festergut.txt @@ -0,0 +1,23 @@ +Hi, + +I made 2 structograms about the UpdateAI of the boss festergut. +I hope it will give you on a simple way a overview about what the boss do. + +### UpdateAI + +Basic structogram about the UpdateAI from festergut: +http://filebeam.com/989245ce17458b524896e4baf40f2a29.jpg) + +After you see this, you may want to see more detail. +To satisfy this, you can look at the second structogram: + +More detailed structogram about the UpdateAI of Festergut: +http://filebeam.com/148c8edc1dd7da75c5287128ae19b57d.jpg + + +### ScriptedAI + +After you know how the UpdateAI should look, you have to integrate it in the ScriptedAI. + +The structure of the ScriptedAI is shown in the following structogram: +http://filebeam.com/d249e442935fb2c53a5e0c624af4eb92.jpg From f5f3a22fec940bdf0b4a20fc6f8c09859af97609 Mon Sep 17 00:00:00 2001 From: Schmoozerd Date: Sat, 15 Oct 2011 01:31:06 +0200 Subject: [PATCH 24/40] ICC, Festergut - Add Aggro text --- .../icecrown_citadel/icecrown_citadel/boss_festergut.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/scripts/northrend/icecrown_citadel/icecrown_citadel/boss_festergut.cpp b/scripts/northrend/icecrown_citadel/icecrown_citadel/boss_festergut.cpp index acd358d58..940b7f766 100644 --- a/scripts/northrend/icecrown_citadel/icecrown_citadel/boss_festergut.cpp +++ b/scripts/northrend/icecrown_citadel/icecrown_citadel/boss_festergut.cpp @@ -48,6 +48,11 @@ struct MANGOS_DLL_DECL boss_festergutAI : public ScriptedAI void Reset() { } + + void Aggro(Unit* pWho) + { + DoScriptText(SAY_AGGRO, m_creature); + } }; CreatureAI* GetAI_boss_festergut(Creature* pCreature) From 7a35df04b072ebbeb038235e0b6d6b68a91ab81b Mon Sep 17 00:00:00 2001 From: Schmoozerd Date: Sat, 15 Oct 2011 01:41:41 +0200 Subject: [PATCH 25/40] ICC, Festergut - Add text when festergut killed an enemy --- .../icecrown_citadel/icecrown_citadel/boss_festergut.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/scripts/northrend/icecrown_citadel/icecrown_citadel/boss_festergut.cpp b/scripts/northrend/icecrown_citadel/icecrown_citadel/boss_festergut.cpp index 940b7f766..b059c1fab 100644 --- a/scripts/northrend/icecrown_citadel/icecrown_citadel/boss_festergut.cpp +++ b/scripts/northrend/icecrown_citadel/icecrown_citadel/boss_festergut.cpp @@ -53,6 +53,11 @@ struct MANGOS_DLL_DECL boss_festergutAI : public ScriptedAI { DoScriptText(SAY_AGGRO, m_creature); } + + void KilledUnit(Unit* pVictim) + { + DoScriptText(urand(0, 1) ? SAY_SLAY_1 : SAY_SLAY_2, m_creature); + } }; CreatureAI* GetAI_boss_festergut(Creature* pCreature) From 050fa507647b65693c3665e2ceccc2523647f4c6 Mon Sep 17 00:00:00 2001 From: Schmoozerd Date: Sat, 15 Oct 2011 02:03:53 +0200 Subject: [PATCH 26/40] Add Day 8 documentation --- icc_project/documentation/day-8.txt | 232 ++++++++++++++++++++++++++++ 1 file changed, 232 insertions(+) create mode 100644 icc_project/documentation/day-8.txt diff --git a/icc_project/documentation/day-8.txt b/icc_project/documentation/day-8.txt new file mode 100644 index 000000000..6a054efde --- /dev/null +++ b/icc_project/documentation/day-8.txt @@ -0,0 +1,232 @@ +In Day 7 you should have seen: + +* A few basic ideas of OOP +* What a minimal ScriptDev2 script looks like, and how it is added to the system + +This day is now about + +* A description about the main classes used for boss scripts in ScriptDev2 +* A few things you can do with the provided powers + +== First Part + +Interaction between MaNGOS and ScriptDev2 for Creature AIs + +=== The CreatureAI class + +The class 'CreatureAI' defined in MaNGOS, especially in +src/game/CreatureAI.h+ is the topmost class for any AI a creature uses. +Any npc in the world has one AI, and this AI is a subclass of CreatureAI. + +The AI of any Creature can be accessed by the member function of the Creature class named +AI()+. + +TIP: https://github.com/mangos/mangos/blob/master/src/game/CreatureAI.h[The MaNGOS CreatureAI header] + +TIP: TODO Link here to auto-generated documentation + +When you look into the source, you will notice that nearly all of the functions are marked 'virtual' +This means, that when anywhere in the core one of these functions is called the implementation of this function in the actual class realising the AI will be called. + +This is the way how the script is "informed" about events that it might want to react to. + +When the core will call these functions is documented there. + +=== The ScriptedAI class + +The class 'ScriptedAI' is the base class in ScriptDev2 to be used to implement scripts. +It implements a few of the functions of CreatureAI with default behaviour you might expect from a creature. + +What are the actual default implementations of ScriptedAI can be seen in +include/sc_creature.cpp+: + +TIP: https://github.com/scriptdev2/scriptdev2/blob/master/include/sc_creature.cpp[Basic ScriptDev2 class for creature scripts] + +When we implement a boss script, we usally overwrite a few functions of ScriptedAI (and hence overwrite the functions of CreatureAI). + +=== Our example class 'boss_festergutAI' + +As you should remember from Day 7 that 'boss_festergutAI' is a subclass of 'ScriptedAI', which is a subclass of 'CreatureAI'. + +Currently, this class does not do very much, and hence also the instances of the class assigned to a spawned creature is also rather boring. + +== End of first part + +This already brings us to the end of the small introduction of the CreatureAI functions. +This got way shorter than intended, and must be improved. + +The main problem here is how to bring a relatively big class with a fair amount of documentation into a usable format for this guide. + +[NOTE] +[icon="./images/icons/example.png", caption="Exercise"] +.*Exercise 1* - Do my job :) +================================================================== +Do look into the CreatureAI class, and think if there might be ways to present it in a guide environment! +================================================================== + +== Second Part: + +As just noted, the script we added to boss Festergut with the class 'boss_festergutAI' is really really boring, so now we start to change it! + +In this part we will cover a few of the virtual functions we have available through 'CreatureAI' to do some text output. + +=== Text Output in ScriptDev2 + +Luckily most of the texts in ICC are already prepared for ScriptDev2, so we can use them very easy. +They might not be all correct, and it will become required to change some of them to make them better. +Currently they are taken from http://www.wowwiki.com[wowwiki], which is a good source but not always perfect. + + +==== The signature of a function + +Any function defined in C++ has a so called signature. +This is the combination of: + +return-type:: The type of the values returned by the function +function-name:: The name of the function (in case of C++ case sensetive) +paramter-list:: The parameter types the function takes + +=== DoScriptText + +Our main method to output text is +DoScriptText+ which is defined in +ScriptMgr.cpp+, its signature looks like this: + +-------------------------------- +void DoScriptText(int32 iTextEntry, WorldObject* pSource, Unit* pTarget /*=NULL*/) +-------------------------------- + +Where the parameters have this meaning: + +*iTextEntry*(an int32 number):: Entry of the text, stored in SD2-database +*pSource*(a WorldObject, often a Creature):: Who displays the text +*pTarget*(a Unit, that is player or creature):: To whom the text will be directed, 'not' required + +TIP: A detailed description of how SD2 stores the texts in the database can be found in http://www.scriptdev2.com/showthread.php?t=5536[Guide for SD2-SQL] + +=== Doing Text on Aggro + +Most bosses have a text when they start attacking, this we call 'Aggro' for which a function in ScriptedAI is defined, with the signature + +-------------------------------- +void Aggro(Unit* pWho) +-------------------------------- +pWho:: is the Unit (Player or Creature) whom we aggro. + +This we will now overwrite, to display the text "Fun time!" by Festergut when Festergut aggroes. + +This text is already in the SD2 database, and the number is assigned the constant +SAY_AGGRO+. + +The required change looks like this: + +-------------------------------- +From f5f3a22fec940bdf0b4a20fc6f8c09859af97609 Mon Sep 17 00:00:00 2001 +From: Schmoozerd +Date: Sat, 15 Oct 2011 01:31:06 +0200 +Subject: [PATCH] ICC, Festergut - Add Aggro text + +--- + .../icecrown_citadel/boss_festergut.cpp | 5 +++++ + 1 files changed, 5 insertions(+), 0 deletions(-) + +diff --git a/scripts/northrend/icecrown_citadel/icecrown_citadel/boss_festergut.cpp b/scripts/northrend/icecrown_citadel/icecrown_citadel/boss_festergut.cpp +index acd358d..940b7f7 100644 +--- a/scripts/northrend/icecrown_citadel/icecrown_citadel/boss_festergut.cpp ++++ b/scripts/northrend/icecrown_citadel/icecrown_citadel/boss_festergut.cpp +@@ -48,6 +48,11 @@ struct MANGOS_DLL_DECL boss_festergutAI : public ScriptedAI + void Reset() + { + } ++ ++ void Aggro(Unit* pWho) <1> ++ { ++ DoScriptText(SAY_AGGRO, m_creature); ++ } + }; + + CreatureAI* GetAI_boss_festergut(Creature* pCreature) +-- +1.7.6.msysgit.0 +-------------------------------- +Where + +<1> The actual changes to the code + +Remark that the variable +m_creature+ links to Festergut. + +[NOTE] +[icon="./images/icons/example.png", caption="Exercise"] +.*Exercise 2* - Where is it from +================================================================== +Where is the variable m_creature defined? +================================================================== + +=== Doing Text when killing a player + +This is very important text, because a both where this doesn't happen should not be called boss :) +Only killed players are good players! + +Looking again into CreatureAI you can find: + +-------------------------------- + /** + * Called when the creature kills a unit + * @param pVictim Victim that got killed + */ + virtual void KilledUnit(Unit* pVictim) {} +-------------------------------- + +As Player is a subclass of Unit, a player is also a unit, so this function can be expected to be called when the creature kills a player. +This is infact true, so we will use this function to display the text we want to display when killing enemies. + +From http://www.wowwiki.com/Festergut[wowwiki] we take the texts "Daddy, I did it!" and "Dead, dead, dead!" which should be displayed when killing. +There are already two constants assinged: +SAY_SLAY_1+ and +SAY_SLAY_2+. + +The required code to overwrite the function "void KilledUnit(Unit* pVictim)" is: + +-------------------------------- + void KilledUnit(Unit* pVictim) + { + DoScriptText(urand(0, 1) ? SAY_SLAY_1 : SAY_SLAY_2, m_creature); + } +-------------------------------- + +The full changeset can be seen on https://github.com/scriptdev2/scriptdev2/commit/7a35df04b072ebbeb038235e0b6d6b68a91ab81b[Github] or on https://github.com/scriptdev2/scriptdev2/commit/7a35df04b072ebbeb038235e0b6d6b68a91ab81b.patch[Github as format-patch] + +In case you have never seen this construction before: + +With +expression ? A : B+ you tell the code to set at this place IF expression is true THEN A ELSE B, which is handy to write compact code. + +[NOTE] +[icon="./images/icons/example.png", caption="Exercise"] +.*Exercise 3* - More texts +================================================================== +Find a function that could be used when a creature just died, and use it to display the text of constant +SAY_DEATH+ +================================================================== + +== End of second part + +What you should have seen today: + +* Where the functions you can use in ScriptDev2 boss scripts come from +* How to use them to display some texts + +What comes next: + +* The UpdateAI function, and timers +* Some more constructs to make a boss deadly + +[NOTE] +[icon="./images/icons/example.png", caption="Exercise"] +.*Exercise 4* - Prepare yourself +================================================================== +Figure out how UpdateAI is called, and think about how this could be used. +================================================================== + +NOTE: This is no special exercise, because I really want to encourage you guys to take matters into your own hand, and do some own stuff! + +[NOTE] +[icon="./images/icons/example.png", caption="Exercise"] +.*Exercise 5* - Do some own stuff +================================================================== +* Pick another boss, create a basic script (look into Day 7) +* Let this other boss display some basic texts like done today +* Share the code you did with us all! ++ +Best use format-patch styled output on http://paste2.org/new-paste and post your scripts in the forum. Take a look into the first week if you feel unsecure with creating patches and commits! +================================================================== From 138ffbd80d78df4459062324d98575eb8f3d2674 Mon Sep 17 00:00:00 2001 From: Schmoozerd Date: Sat, 15 Oct 2011 02:04:24 +0200 Subject: [PATCH 27/40] And Day 8 html documentation --- icc_project/documentation/html/day-8.html | 1119 +++++++++++++++++++++ 1 file changed, 1119 insertions(+) create mode 100644 icc_project/documentation/html/day-8.html diff --git a/icc_project/documentation/html/day-8.html b/icc_project/documentation/html/day-8.html new file mode 100644 index 000000000..2266e803d --- /dev/null +++ b/icc_project/documentation/html/day-8.html @@ -0,0 +1,1119 @@ + + + + + + + + + + + +
    +

    In Day 7 you should have seen:

    +
      +
    • +

      +A few basic ideas of OOP +

      +
    • +
    • +

      +What a minimal ScriptDev2 script looks like, and how it is added to the system +

      +
    • +
    +

    This day is now about

    +
      +
    • +

      +A description about the main classes used for boss scripts in ScriptDev2 +

      +
    • +
    • +

      +A few things you can do with the provided powers +

      +
    • +
    +
    +

    1. First Part

    +
    +

    Interaction between MaNGOS and ScriptDev2 for Creature AIs

    +
    +

    1.1. The CreatureAI class

    +

    The class CreatureAI defined in MaNGOS, especially in src/game/CreatureAI.h is the topmost class for any AI a creature uses. +Any npc in the world has one AI, and this AI is a subclass of CreatureAI.

    +

    The AI of any Creature can be accessed by the member function of the Creature class named AI().

    + +
    + + + +
    +Tip +TODO Link here to auto-generated documentation
    +
    +

    When you look into the source, you will notice that nearly all of the functions are marked virtual +This means, that when anywhere in the core one of these functions is called the implementation of this function in the actual class realising the AI will be called.

    +

    This is the way how the script is "informed" about events that it might want to react to.

    +

    When the core will call these functions is documented there.

    +
    +
    +

    1.2. The ScriptedAI class

    +

    The class ScriptedAI is the base class in ScriptDev2 to be used to implement scripts. +It implements a few of the functions of CreatureAI with default behaviour you might expect from a creature.

    +

    What are the actual default implementations of ScriptedAI can be seen in include/sc_creature.cpp:

    + +

    When we implement a boss script, we usally overwrite a few functions of ScriptedAI (and hence overwrite the functions of CreatureAI).

    +
    +
    +

    1.3. Our example class boss_festergutAI

    +

    As you should remember from Day 7 that boss_festergutAI is a subclass of ScriptedAI, which is a subclass of CreatureAI.

    +

    Currently, this class does not do very much, and hence also the instances of the class assigned to a spawned creature is also rather boring.

    +
    +
    +
    +
    +

    2. End of first part

    +
    +

    This already brings us to the end of the small introduction of the CreatureAI functions. +This got way shorter than intended, and must be improved.

    +

    The main problem here is how to bring a relatively big class with a fair amount of documentation into a usable format for this guide.

    +
    + + + +
    +Exercise + +
    Exercise 1 - Do my job :)
    +

    Do look into the CreatureAI class, and think if there might be ways to present it in a guide environment!

    +
    +
    +
    +
    +
    +

    3. Second Part:

    +
    +

    As just noted, the script we added to boss Festergut with the class boss_festergutAI is really really boring, so now we start to change it!

    +

    In this part we will cover a few of the virtual functions we have available through CreatureAI to do some text output.

    +
    +

    3.1. Text Output in ScriptDev2

    +

    Luckily most of the texts in ICC are already prepared for ScriptDev2, so we can use them very easy. +They might not be all correct, and it will become required to change some of them to make them better. +Currently they are taken from wowwiki, which is a good source but not always perfect.

    +
    +

    3.1.1. The signature of a function

    +

    Any function defined in C++ has a so called signature. +This is the combination of:

    +
    +
    +return-type +
    +
    +

    +The type of the values returned by the function +

    +
    +
    +function-name +
    +
    +

    +The name of the function (in case of C++ case sensetive) +

    +
    +
    +paramter-list +
    +
    +

    +The parameter types the function takes +

    +
    +
    +
    +
    +
    +

    3.2. DoScriptText

    +

    Our main method to output text is DoScriptText which is defined in ScriptMgr.cpp, its signature looks like this:

    +
    +
    +
    void DoScriptText(int32 iTextEntry, WorldObject* pSource, Unit* pTarget /*=NULL*/)
    +
    +

    Where the parameters have this meaning:

    +
    +
    +iTextEntry(an int32 number) +
    +
    +

    +Entry of the text, stored in SD2-database +

    +
    +
    +pSource(a WorldObject, often a Creature) +
    +
    +

    +Who displays the text +

    +
    +
    +pTarget(a Unit, that is player or creature) +
    +
    +

    +To whom the text will be directed, not required +

    +
    +
    +
    + + + +
    +Tip +A detailed description of how SD2 stores the texts in the database can be found in Guide for SD2-SQL
    +
    +
    +
    +

    3.3. Doing Text on Aggro

    +

    Most bosses have a text when they start attacking, this we call Aggro for which a function in ScriptedAI is defined, with the signature

    +
    +
    +
    void Aggro(Unit* pWho)
    +
    +
    +
    +pWho +
    +
    +

    +is the Unit (Player or Creature) whom we aggro. +

    +
    +
    +

    This we will now overwrite, to display the text "Fun time!" by Festergut when Festergut aggroes.

    +

    This text is already in the SD2 database, and the number is assigned the constant SAY_AGGRO.

    +

    The required change looks like this:

    +
    +
    +
    From f5f3a22fec940bdf0b4a20fc6f8c09859af97609 Mon Sep 17 00:00:00 2001
    +From: Schmoozerd <schmoozerd@scriptdev2.com>
    +Date: Sat, 15 Oct 2011 01:31:06 +0200
    +Subject: [PATCH] ICC, Festergut - Add Aggro text
    +
    +---
    + .../icecrown_citadel/boss_festergut.cpp            |    5 +++++
    + 1 files changed, 5 insertions(+), 0 deletions(-)
    +
    +diff --git a/scripts/northrend/icecrown_citadel/icecrown_citadel/boss_festergut.cpp b/scripts/northrend/icecrown_citadel/icecrown_citadel/boss_festergut.cpp
    +index acd358d..940b7f7 100644
    +--- a/scripts/northrend/icecrown_citadel/icecrown_citadel/boss_festergut.cpp
    ++++ b/scripts/northrend/icecrown_citadel/icecrown_citadel/boss_festergut.cpp
    +@@ -48,6 +48,11 @@ struct MANGOS_DLL_DECL boss_festergutAI : public ScriptedAI
    +     void Reset()
    +     {
    +     }
    ++
    ++    void Aggro(Unit* pWho)                         1
    ++    {
    ++        DoScriptText(SAY_AGGRO, m_creature);
    ++    }
    + };
    +
    + CreatureAI* GetAI_boss_festergut(Creature* pCreature)
    +--
    +1.7.6.msysgit.0
    +
    +

    Where

    +
    + +
    1 +The actual changes to the code +
    +

    Remark that the variable m_creature links to Festergut.

    +
    + + + +
    +Exercise + +
    Exercise 2 - Where is it from
    +

    Where is the variable m_creature defined?

    +
    +
    +
    +
    +

    3.4. Doing Text when killing a player

    +

    This is very important text, because a both where this doesn’t happen should not be called boss :) +Only killed players are good players!

    +

    Looking again into CreatureAI you can find:

    +
    +
    +
            /**
    +         * Called when the creature kills a unit
    +         * @param pVictim Victim that got killed
    +         */
    +        virtual void KilledUnit(Unit* pVictim) {}
    +
    +

    As Player is a subclass of Unit, a player is also a unit, so this function can be expected to be called when the creature kills a player. +This is infact true, so we will use this function to display the text we want to display when killing enemies.

    +

    From wowwiki we take the texts "Daddy, I did it!" and "Dead, dead, dead!" which should be displayed when killing. +There are already two constants assinged: SAY_SLAY_1 and SAY_SLAY_2.

    +

    The required code to overwrite the function "void KilledUnit(Unit* pVictim)" is:

    +
    +
    +
        void KilledUnit(Unit* pVictim)
    +    {
    +        DoScriptText(urand(0, 1) ? SAY_SLAY_1 : SAY_SLAY_2, m_creature);
    +    }
    +
    +

    The full changeset can be seen on Github or on Github as format-patch

    +

    In case you have never seen this construction before:

    +

    With expression ? A : B you tell the code to set at this place IF expression is true THEN A ELSE B, which is handy to write compact code.

    +
    + + + +
    +Exercise + +
    Exercise 3 - More texts
    +

    Find a function that could be used when a creature just died, and use it to display the text of constant SAY_DEATH

    +
    +
    +
    +
    +
    +
    +

    4. End of second part

    +
    +

    What you should have seen today:

    +
      +
    • +

      +Where the functions you can use in ScriptDev2 boss scripts come from +

      +
    • +
    • +

      +How to use them to display some texts +

      +
    • +
    +

    What comes next:

    +
      +
    • +

      +The UpdateAI function, and timers +

      +
    • +
    • +

      +Some more constructs to make a boss deadly +

      +
    • +
    +
    + + + +
    +Exercise + +
    Exercise 4 - Prepare yourself
    +

    Figure out how UpdateAI is called, and think about how this could be used.

    +
    +
    +
    + + + +
    +Note +This is no special exercise, because I really want to encourage you guys to take matters into your own hand, and do some own stuff!
    +
    +
    + + + +
    +Exercise + +
    Exercise 5 - Do some own stuff
    +
      +
    • +

      +Pick another boss, create a basic script (look into Day 7) +

      +
    • +
    • +

      +Let this other boss display some basic texts like done today +

      +
    • +
    • +

      +Share the code you did with us all! +

      +

      Best use format-patch styled output on http://paste2.org/new-paste and post your scripts in the forum. Take a look into the first week if you feel unsecure with creating patches and commits!

      +
    • +
    +
    +
    +
    +
    +
    +

    + + + From bd821056ec9f44e453b077d3e1304f24d7043a68 Mon Sep 17 00:00:00 2001 From: Schmoozerd Date: Fri, 28 Oct 2011 14:59:15 +0200 Subject: [PATCH 28/40] ICC, Festergut - Add Berserk timer Notes: * Recasting of the BerserkTimer after 5 minutes is kind of unproper, but usally used way with if (m_uiBerserkTimer) if (.. <= uiDiff) would be against the current lession(day 9) * Not using if (DoCastSpellIfCan(..) == CAST_OK) is also inproper, but same reason. --- .../icecrown_citadel/boss_festergut.cpp | 20 +++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/scripts/northrend/icecrown_citadel/icecrown_citadel/boss_festergut.cpp b/scripts/northrend/icecrown_citadel/icecrown_citadel/boss_festergut.cpp index b059c1fab..30ec25ed7 100644 --- a/scripts/northrend/icecrown_citadel/icecrown_citadel/boss_festergut.cpp +++ b/scripts/northrend/icecrown_citadel/icecrown_citadel/boss_festergut.cpp @@ -36,6 +36,8 @@ enum SAY_BERSERK = -1631089, SAY_DEATH = -1631090, SAY_FESTERGUT_DEATH = -1631091, + + SPELL_BERSERK = 47008, }; struct MANGOS_DLL_DECL boss_festergutAI : public ScriptedAI @@ -45,8 +47,11 @@ struct MANGOS_DLL_DECL boss_festergutAI : public ScriptedAI Reset(); } + uint32 m_uiBerserkTimer; + void Reset() { + m_uiBerserkTimer = 5*MINUTE*IN_MILLISECONDS; } void Aggro(Unit* pWho) @@ -58,6 +63,21 @@ struct MANGOS_DLL_DECL boss_festergutAI : public ScriptedAI { DoScriptText(urand(0, 1) ? SAY_SLAY_1 : SAY_SLAY_2, m_creature); } + + void UpdateAI(const uint32 uiDiff) + { + if (!m_creature->SelectHostileTarget() || !m_creature->getVictim()) + return; + + if (m_uiBerserkTimer < uiDiff) + { + DoCastSpellIfCan(m_creature, SPELL_BERSERK); + DoScriptText(SAY_BERSERK, m_creature); + m_uiBerserkTimer = 5*MINUTE*IN_MILLISECONDS; + } + else + m_uiBerserkTimer -= uiDiff; + } }; CreatureAI* GetAI_boss_festergut(Creature* pCreature) From e172316007b544e06309a1a227fce40ed919f370 Mon Sep 17 00:00:00 2001 From: Schmoozerd Date: Fri, 28 Oct 2011 15:12:21 +0200 Subject: [PATCH 29/40] Add Day 9 - Spells and Timers --- icc_project/documentation/day-9.txt | 332 ++++++++++++++++++++++++++++ 1 file changed, 332 insertions(+) create mode 100644 icc_project/documentation/day-9.txt diff --git a/icc_project/documentation/day-9.txt b/icc_project/documentation/day-9.txt new file mode 100644 index 000000000..abde4fce1 --- /dev/null +++ b/icc_project/documentation/day-9.txt @@ -0,0 +1,332 @@ +In Day 8 you should have seen: + +* Which classes you need to specialise in order to create boss scripts +* A bunch of functions that are useful for this + +This day is now about + +* Some thoughts about spells (as this is the thing most bosses do: Cast spells) +* Implementing casting spells + +== First Part + +For a clean scripting attempt it is expected to handle nearly everything with spells. So this part is now about the spell system. + +Any spell is cast by some caster onto some victim. And a spell will hit some targets. + +For some direct spells like ie Fireball the target will be the victim, but ie for AoE spells like ArcaneExplosion the victim will be the caster (self-cast spell), and the targets will be enemies around. + +=== The spell system + +Spells are provided in dbc form which can be extracted from the wow-client. Actually if you installed a local test server already, you will have extracted these dbc files. + +The structure (as far as known) for the spell.dbc can be seen in MaNGOS::DBCStructure.h - +struct SpellEntry+. However this is rather unpleasant to read and hence I 'strongly' suggest to use a tool to help understanding these entries. + +TIP: https://github.com/LordJZ/spellwork_cs[SpellWork] This is a nice tool to view the spell dbc, binary files can be downloaded from the SpellWork/bin/Release directory over github + +Basic structure of a spell: + +* Id and name - this identifies a spell +* Some internal information +* Spell Range +* Difficulty information (if exists) - If a spell has difficulty information, you only need to cast the base spell, the proper one for current difficulty will be selected by MaNGOS +* Information about Cast-Time, Duration of auras and similar + +* Information what the spell actually does: ++ +A spell has up to three effects (like summon or dealing damage). ++ +Each effect consists of: ++ + - The effect type (what the effect will do) + - The target types (how the targeting of the spell will work - AoE, Self, enemy) + - Some additional information about this effect (like how many damage, what npc will be summoned and so on) + +=== The spell system in MaNGOS + +Some parts of how spells should be handled are unknown, which means we can only interpret the values from spell.dbc by what should happen (and this usually is how the handling is implemented within MaNGOS) + +It is not in the scope of this guide to give some detailed explanation of everything about how spells are handled. For this you must seriously study the MaNGOS code. + +TIP: TODO Link here to the wiki page that should exist about mangos spell system. + +Effects and their implementation can be seen in MaNGOS:SpellEffects.cpp. Often the name of the effect gives some good clue what they will do + +Targeting can be seen in MaNGOS::Spell.cpp. Most important targets are: + +* TARGET_SELF - the effect will target the caster +* TARGET_*AREA* - the effect will work as AoE spell, in case of SpellRange == 0, the spell must be self cast +* TARGET_CHAIN_DAMAGE - the effect will target the victim +* TARGET_SCRIPT* - the target is fixed by the table `spell_script_target` + +[NOTE] +[icon="./images/icons/example.png", caption="Exercise"] +.*Exercise 1* - Check a few spells +==================================================================================================================================== +Download SpellWork and check a few spells: Maybe IDs 9488 or 59245. +==================================================================================================================================== + +=== Which spells should a boss cast? + +Well, by now you should have seen a few spells and be able to have a rough idea what they are doing. But of course the most important question still is: What spells should a boss use? (And when) + +To get information what spells a boss should use, you can check: + +* Database sites (like wowhead) - NPCs usually have there a list of abilities, however this can be incomplete or even wrong +* Transcriptor/ Combat logs (there are sites where such are available) +* The DBM Addon +* Watching videos +* Wowwiki and similar sites + +There are usually two answers of *when* a spell is cast: + +. On a timer: This means, some time after engaging combat, and then repeating after some time. +. On some event: Like 50% health, or when an add dies + +To figure this you must use resources like videos, experience or a bunch of logs (and of course good guessing also helps) + +== End of first part + +In this part you should have seen how a spell looks like, and how to obtain information about its use. + +== Second Part: + +This part now will look about how spell casting is to be implemented in MaNGOS. + +The main function that will be used for spell casting is: +-------------------------------- +DoCastSpellIfCan(Unit* pVictim, uint32 uiSpellId); which returns a value of type CastResult +-------------------------------- + +=== The virtual function UpdateAI(const uint32 uiDiff) + +MaNGOS calls for every AI the function +UpdateAI(const uint32 uiDiff)+ about every 100ms. The actual time since last call is stored in uiDiff. + +This gives two possibilites: + +* Handle things that should be handled always +* Countdown a timer + +==== How does a timer work, if we know the time-diff since we last called a function? + +A timer is a variable of type uin32 (unsingned integer), which stores the time until the timer should expire next (in millieseconds) + +So, a minimal timer script would look like: +-------------------------------- +struct MANGOS_DLL_DECL boss_dummyAI : public ScriptedAI +{ + boss_dummyAI(Creature* pCreature) : ScriptedAI(pCreature) + { + Reset(); + } + + uint32 m_uiTimer; <1> + + void Reset() <2> + { + m_uiTimer = 17000; <3> + } + + void UpdateAI(const uint32 uiDiff) <4> + { + if (m_uiTimer < uiDiff) <6> + { + DoScriptText(-1000001, m_creature); <7> + m_uiTimer = 30000; <8> + } + else + m_uiTimer -= uiDiff; <5> + } +}; +-------------------------------- + +Note that this misses all stuff like registering the script, but you should be able to test it, if you move the content to some other empty script (maybe festergut) + +The meaning of the new lines: + +<1> In this line the member variable +m_uiTimer+ of the struct boss_dummyAI is defined. +<2> This is the virtual Reset function that every script implements. +<3> And we reset here the timer to the initially value. +<4> Here we overwrite the UpdateAI function, that will be called every +uiDiff+ millieseconds. +<5> If the timer is not expired ("else") we decrement it. +<6> We check if the timer is expired (which means it is time to do something for which we need the timer) +<7> Some Text will be displayed +<8> The timer will be set to a new value + +Currently this function only contains the timer handling. + +===== How exactly does a timer work + +It is probably a good idea to clarify this with pen and paper: Think what will happen in the code (assume the UpdateAI is called every 100ms) + +When the script is initialized the timer will be 17000. On first 'tick' of UpdateAI evaluating the code looks like: +---------------------------------------------------------------- + void UpdateAI(const uint32 uiDiff==100) + { + if (m_uiTimer==17000 < 100) // evaluates to false + { + DoScriptText(-1000001, m_creature); + m_uiTimer = 30000; + } + else + m_uiTimer==17000 -= 100; + } +---------------------------------------------------------------- +When this code is finished, m_uiTimer will be decremented by 100, and has then the value of 16900. + +The next tick would look like: +---------------------------------------------------------------- + void UpdateAI(const uint32 uiDiff==100) + { + if (m_uiTimer==16900 < 100) // evaluates to false + { + DoScriptText(-1000001, m_creature); + m_uiTimer = 30000; + } + else + m_uiTimer==16900 -= 100; + } +---------------------------------------------------------------- +When this code is finished, m_uiTimer will be decremented by 100, and has then the value of 16800. + +After a bunch of more 'ticks' the code will evaluate to (Exercise: How many ticks? - How long does it take?) +---------------------------------------------------------------- + void UpdateAI(const uint32 uiDiff==100) + { + if (m_uiTimer==0 < 100) // evaluates to true + { + DoScriptText(-1000001, m_creature); + m_uiTimer = 30000; + } + else + m_uiTimer==0 -= 100; + } +---------------------------------------------------------------- +And the timer will be expired, and the actions that should happen when the timer is expired will be triggered. + +[NOTE] +[icon="./images/icons/example.png", caption="Exercise"] +.*Exercise 2* - Understand the timer +================================================================== +When will the timer first expire? + +When will the timer the second time expire? +================================================================== +[NOTE] +[icon="./images/icons/example.png", caption="Exercise"] +.*Exercise 3* - Understand the timer(2) +================================================================== +Change the code so that the timer will initially expire after 10seconds, and from then expire every 30-40 seconds. (Hint: +urand(A, B)+ gives a random number between A and B) +================================================================== + +==== What other stuff fits well into the UpdateAI function? + +In normal cases we want to script combat behaviour. And most important for combating is of course threat management (whom the boss should attack). + +This is handled by MaNGOS with the function +SelectHostileTarget+. + +Also we normally want a boss to do melee attack. + +This is handled by MaNGOS with the function +DoMeleeAttackIfReady+. + +So the structure for a normal +UpdateAI+ should look like this (changes might be reasonable, but only very rarely) +---------------------------------------------------------------- + void UpdateAI(const uint32 uiDiff) + { + if (!m_creature->SelectHostileTarget() || !m_creature->getVictim()) + return; <1> + + // Some combat Timers + + DoMeleeAttackIfReady(); + } +---------------------------------------------------------------- +<1> As of this return anything after will only be executed when we are in proper combat. + +=== Real example: Let Festergut cast something + +On http://old.wowhead.com/npc=36626#abilities[wowhead-Festergut] I found a spell ID for the Berserk spell as well as the information that the berserk should happen after 5 minutes (initially) + +---------------------------------------------------------------- +diff --git a/scripts/northrend/icecrown_citadel/icecrown_citadel/boss_festergut.cpp b/scripts/northrend/icecrown_citadel/icecrown_citadel/boss_festergut.cpp +index b059c1f..30ec25e 100644 +--- a/scripts/northrend/icecrown_citadel/icecrown_citadel/boss_festergut.cpp ++++ b/scripts/northrend/icecrown_citadel/icecrown_citadel/boss_festergut.cpp +@@ -36,6 +36,8 @@ enum + SAY_BERSERK = -1631089, + SAY_DEATH = -1631090, + SAY_FESTERGUT_DEATH = -1631091, ++ ++ SPELL_BERSERK = 47008, <1> + }; + + struct MANGOS_DLL_DECL boss_festergutAI : public ScriptedAI +@@ -45,8 +47,11 @@ struct MANGOS_DLL_DECL boss_festergutAI : public ScriptedAI + Reset(); + } + ++ uint32 m_uiBerserkTimer; <2> ++ + void Reset() + { ++ m_uiBerserkTimer = 5*MINUTE*IN_MILLISECONDS; + } + + void Aggro(Unit* pWho) +@@ -58,6 +63,21 @@ struct MANGOS_DLL_DECL boss_festergutAI : public ScriptedAI + { + DoScriptText(urand(0, 1) ? SAY_SLAY_1 : SAY_SLAY_2, m_creature); + } ++ ++ void UpdateAI(const uint32 uiDiff) ++ { ++ if (!m_creature->SelectHostileTarget() || !m_creature->getVictim()) ++ return; ++ ++ if (m_uiBerserkTimer < uiDiff) <3> ++ { ++ DoCastSpellIfCan(m_creature, SPELL_BERSERK); ++ DoScriptText(SAY_BERSERK, m_creature); ++ m_uiBerserkTimer = 5*MINUTE*IN_MILLISECONDS; ++ } ++ else ++ m_uiBerserkTimer -= uiDiff; ++ } + }; + + CreatureAI* GetAI_boss_festergut(Creature* pCreature) +---------------------------------------------------------------- + +What is done here: + +<1> The Berserk spell ID is assigned to an enum (to prevent so called magic numbers) +<2> As we can expect that there will be additional timers for this boss, we must find unique names for every timer, usually this works well with the spellname. ++ +Also note the http://www.scriptdev2.com/showthread.php?t=4098[ScriptDev2 Coding Standards] + +<3> The actual implementation of the timer. From the infos there should be besides the casting of the berserk spell also a text displayed that Festergut enrages. + +This patch was commited with bd821056ec9f + +[NOTE] +[icon="./images/icons/example.png", caption="Exercise"] +.*Exercise 4* - Add some abilities to your own script +================================================================== +Write a script for an own boss and add some abilites, or add some abilites to Festergut here. + +Provide patches to the forum thread! + +Also note from which sources you got which info - good place for this would be the commit message +================================================================== + +== End of second part + +What you should have seen today: + +* How spells work +* How to cast spells on a timer + +What comes next: + +* Using events to trigger some stuff +* Using phases From 0e7332b561c33dae82331ebadb34673e14dd99c3 Mon Sep 17 00:00:00 2001 From: Schmoozerd Date: Fri, 28 Oct 2011 15:12:38 +0200 Subject: [PATCH 30/40] Add Day 9 HTML doc --- icc_project/documentation/html/day-9.html | 1246 +++++++++++++++++++++ 1 file changed, 1246 insertions(+) create mode 100644 icc_project/documentation/html/day-9.html diff --git a/icc_project/documentation/html/day-9.html b/icc_project/documentation/html/day-9.html new file mode 100644 index 000000000..18fa77549 --- /dev/null +++ b/icc_project/documentation/html/day-9.html @@ -0,0 +1,1246 @@ + + + + + + + + + + + +
    +

    In Day 8 you should have seen:

    +
      +
    • +

      +Which classes you need to specialise in order to create boss scripts +

      +
    • +
    • +

      +A bunch of functions that are useful for this +

      +
    • +
    +

    This day is now about

    +
      +
    • +

      +Some thoughts about spells (as this is the thing most bosses do: Cast spells) +

      +
    • +
    • +

      +Implementing casting spells +

      +
    • +
    +
    +

    1. First Part

    +
    +

    For a clean scripting attempt it is expected to handle nearly everything with spells. So this part is now about the spell system.

    +

    Any spell is cast by some caster onto some victim. And a spell will hit some targets.

    +

    For some direct spells like ie Fireball the target will be the victim, but ie for AoE spells like ArcaneExplosion the victim will be the caster (self-cast spell), and the targets will be enemies around.

    +
    +

    1.1. The spell system

    +

    Spells are provided in dbc form which can be extracted from the wow-client. Actually if you installed a local test server already, you will have extracted these dbc files.

    +

    The structure (as far as known) for the spell.dbc can be seen in MaNGOS::DBCStructure.h - struct SpellEntry. However this is rather unpleasant to read and hence I strongly suggest to use a tool to help understanding these entries.

    +
    + + + +
    +Tip +SpellWork This is a nice tool to view the spell dbc, binary files can be downloaded from the SpellWork/bin/Release directory over github
    +
    +

    Basic structure of a spell:

    +
      +
    • +

      +Id and name - this identifies a spell +

      +
    • +
    • +

      +Some internal information +

      +
    • +
    • +

      +Spell Range +

      +
    • +
    • +

      +Difficulty information (if exists) - If a spell has difficulty information, you only need to cast the base spell, the proper one for current difficulty will be selected by MaNGOS +

      +
    • +
    • +

      +Information about Cast-Time, Duration of auras and similar +

      +
    • +
    • +

      +Information what the spell actually does: +

      +

      A spell has up to three effects (like summon or dealing damage).

      +

      Each effect consists of:

      +
        +
      • +

        +The effect type (what the effect will do) +

        +
      • +
      • +

        +The target types (how the targeting of the spell will work - AoE, Self, enemy) +

        +
      • +
      • +

        +Some additional information about this effect (like how many damage, what npc will be summoned and so on) +

        +
      • +
      +
    • +
    +
    +
    +

    1.2. The spell system in MaNGOS

    +

    Some parts of how spells should be handled are unknown, which means we can only interpret the values from spell.dbc by what should happen (and this usually is how the handling is implemented within MaNGOS)

    +

    It is not in the scope of this guide to give some detailed explanation of everything about how spells are handled. For this you must seriously study the MaNGOS code.

    +
    + + + +
    +Tip +TODO Link here to the wiki page that should exist about mangos spell system.
    +
    +

    Effects and their implementation can be seen in MaNGOS:SpellEffects.cpp. Often the name of the effect gives some good clue what they will do

    +

    Targeting can be seen in MaNGOS::Spell.cpp. Most important targets are:

    +
      +
    • +

      +TARGET_SELF - the effect will target the caster +

      +
    • +
    • +

      +TARGET_*AREA* - the effect will work as AoE spell, in case of SpellRange == 0, the spell must be self cast +

      +
    • +
    • +

      +TARGET_CHAIN_DAMAGE - the effect will target the victim +

      +
    • +
    • +

      +TARGET_SCRIPT* - the target is fixed by the table spell_script_target +

      +
    • +
    +
    + + + +
    +Exercise + +
    Exercise 1 - Check a few spells
    +

    Download SpellWork and check a few spells: Maybe IDs 9488 or 59245.

    +
    +
    +
    +
    +

    1.3. Which spells should a boss cast?

    +

    Well, by now you should have seen a few spells and be able to have a rough idea what they are doing. But of course the most important question still is: What spells should a boss use? (And when)

    +

    To get information what spells a boss should use, you can check:

    +
      +
    • +

      +Database sites (like wowhead) - NPCs usually have there a list of abilities, however this can be incomplete or even wrong +

      +
    • +
    • +

      +Transcriptor/ Combat logs (there are sites where such are available) +

      +
    • +
    • +

      +The DBM Addon +

      +
    • +
    • +

      +Watching videos +

      +
    • +
    • +

      +Wowwiki and similar sites +

      +
    • +
    +

    There are usually two answers of when a spell is cast:

    +
      +
    1. +

      +On a timer: This means, some time after engaging combat, and then repeating after some time. +

      +
    2. +
    3. +

      +On some event: Like 50% health, or when an add dies +

      +
    4. +
    +

    To figure this you must use resources like videos, experience or a bunch of logs (and of course good guessing also helps)

    +
    +
    +
    +
    +

    2. End of first part

    +
    +

    In this part you should have seen how a spell looks like, and how to obtain information about its use.

    +
    +
    +
    +

    3. Second Part:

    +
    +

    This part now will look about how spell casting is to be implemented in MaNGOS.

    +

    The main function that will be used for spell casting is:

    +
    +
    +
    DoCastSpellIfCan(Unit* pVictim, uint32 uiSpellId); which returns a value of type CastResult
    +
    +
    +

    3.1. The virtual function UpdateAI(const uint32 uiDiff)

    +

    MaNGOS calls for every AI the function UpdateAI(const uint32 uiDiff) about every 100ms. The actual time since last call is stored in uiDiff.

    +

    This gives two possibilites:

    +
      +
    • +

      +Handle things that should be handled always +

      +
    • +
    • +

      +Countdown a timer +

      +
    • +
    +
    +

    3.1.1. How does a timer work, if we know the time-diff since we last called a function?

    +

    A timer is a variable of type uin32 (unsingned integer), which stores the time until the timer should expire next (in millieseconds)

    +

    So, a minimal timer script would look like:

    +
    +
    +
    struct MANGOS_DLL_DECL boss_dummyAI : public ScriptedAI
    +{
    +    boss_dummyAI(Creature* pCreature) : ScriptedAI(pCreature)
    +    {
    +        Reset();
    +    }
    +
    +    uint32 m_uiTimer;                                              1
    +
    +    void Reset()                                                   2
    +    {
    +        m_uiTimer = 17000;                                         3
    +    }
    +
    +    void UpdateAI(const uint32 uiDiff)                             4
    +    {
    +        if (m_uiTimer < uiDiff)                                    6
    +        {
    +            DoScriptText(-1000001, m_creature);                    7
    +            m_uiTimer = 30000;                                     8
    +        }
    +        else
    +            m_uiTimer -= uiDiff;                                   5
    +    }
    +};
    +
    +

    Note that this misses all stuff like registering the script, but you should be able to test it, if you move the content to some other empty script (maybe festergut)

    +

    The meaning of the new lines:

    +
    + + + + + + + + +
    1 +In this line the member variable m_uiTimer of the struct boss_dummyAI is defined. +
    2 +This is the virtual Reset function that every script implements. +
    3 +And we reset here the timer to the initially value. +
    4 +Here we overwrite the UpdateAI function, that will be called every uiDiff millieseconds. +
    5 +If the timer is not expired ("else") we decrement it. +
    6 +We check if the timer is expired (which means it is time to do something for which we need the timer) +
    7 +Some Text will be displayed +
    8 +The timer will be set to a new value +
    +

    Currently this function only contains the timer handling.

    +
    +
    How exactly does a timer work
    +

    It is probably a good idea to clarify this with pen and paper: Think what will happen in the code (assume the UpdateAI is called every 100ms)

    +

    When the script is initialized the timer will be 17000. On first tick of UpdateAI evaluating the code looks like:

    +
    +
    +
        void UpdateAI(const uint32 uiDiff==100)
    +    {
    +        if (m_uiTimer==17000 < 100)    // evaluates to false
    +        {
    +            DoScriptText(-1000001, m_creature);
    +            m_uiTimer = 30000;
    +        }
    +        else
    +            m_uiTimer==17000 -= 100;
    +    }
    +
    +

    When this code is finished, m_uiTimer will be decremented by 100, and has then the value of 16900.

    +

    The next tick would look like:

    +
    +
    +
        void UpdateAI(const uint32 uiDiff==100)
    +    {
    +        if (m_uiTimer==16900 < 100)    // evaluates to false
    +        {
    +            DoScriptText(-1000001, m_creature);
    +            m_uiTimer = 30000;
    +        }
    +        else
    +            m_uiTimer==16900 -= 100;
    +    }
    +
    +

    When this code is finished, m_uiTimer will be decremented by 100, and has then the value of 16800.

    +

    After a bunch of more ticks the code will evaluate to (Exercise: How many ticks? - How long does it take?)

    +
    +
    +
        void UpdateAI(const uint32 uiDiff==100)
    +    {
    +        if (m_uiTimer==0 < 100)    // evaluates to true
    +        {
    +            DoScriptText(-1000001, m_creature);
    +            m_uiTimer = 30000;
    +        }
    +        else
    +            m_uiTimer==0 -= 100;
    +    }
    +
    +

    And the timer will be expired, and the actions that should happen when the timer is expired will be triggered.

    +
    + + + +
    +Exercise + +
    Exercise 2 - Understand the timer
    +

    When will the timer first expire?

    +

    When will the timer the second time expire?

    +
    +
    +
    + + + +
    +Exercise + +
    Exercise 3 - Understand the timer(2)
    +

    Change the code so that the timer will initially expire after 10seconds, and from then expire every 30-40 seconds. (Hint: urand(A, B) gives a random number between A and B)

    +
    +
    +
    +
    +
    +

    3.1.2. What other stuff fits well into the UpdateAI function?

    +

    In normal cases we want to script combat behaviour. And most important for combating is of course threat management (whom the boss should attack).

    +

    This is handled by MaNGOS with the function SelectHostileTarget.

    +

    Also we normally want a boss to do melee attack.

    +

    This is handled by MaNGOS with the function DoMeleeAttackIfReady.

    +

    So the structure for a normal UpdateAI should look like this (changes might be reasonable, but only very rarely)

    +
    +
    +
        void UpdateAI(const uint32 uiDiff)
    +    {
    +        if (!m_creature->SelectHostileTarget() || !m_creature->getVictim())
    +           return;              1
    +
    +        // Some combat Timers
    +
    +        DoMeleeAttackIfReady();
    +    }
    +
    +
    + +
    1 +As of this return anything after will only be executed when we are in proper combat. +
    +
    +
    +
    +

    3.2. Real example: Let Festergut cast something

    +

    On wowhead-Festergut I found a spell ID for the Berserk spell as well as the information that the berserk should happen after 5 minutes (initially)

    +
    +
    +
    diff --git a/scripts/northrend/icecrown_citadel/icecrown_citadel/boss_festergut.cpp b/scripts/northrend/icecrown_citadel/icecrown_citadel/boss_festergut.cpp
    +index b059c1f..30ec25e 100644
    +--- a/scripts/northrend/icecrown_citadel/icecrown_citadel/boss_festergut.cpp
    ++++ b/scripts/northrend/icecrown_citadel/icecrown_citadel/boss_festergut.cpp
    +@@ -36,6 +36,8 @@ enum
    +     SAY_BERSERK                 = -1631089,
    +     SAY_DEATH                   = -1631090,
    +     SAY_FESTERGUT_DEATH         = -1631091,
    ++
    ++    SPELL_BERSERK               = 47008,                          1
    + };
    +
    + struct MANGOS_DLL_DECL boss_festergutAI : public ScriptedAI
    +@@ -45,8 +47,11 @@ struct MANGOS_DLL_DECL boss_festergutAI : public ScriptedAI
    +         Reset();
    +     }
    +
    ++    uint32 m_uiBerserkTimer;                                      2
    ++
    +     void Reset()
    +     {
    ++        m_uiBerserkTimer = 5*MINUTE*IN_MILLISECONDS;
    +     }
    +
    +     void Aggro(Unit* pWho)
    +@@ -58,6 +63,21 @@ struct MANGOS_DLL_DECL boss_festergutAI : public ScriptedAI
    +     {
    +         DoScriptText(urand(0, 1) ? SAY_SLAY_1 : SAY_SLAY_2, m_creature);
    +     }
    ++
    ++    void UpdateAI(const uint32 uiDiff)
    ++    {
    ++        if (!m_creature->SelectHostileTarget() || !m_creature->getVictim())
    ++            return;
    ++
    ++        if (m_uiBerserkTimer < uiDiff)                            3
    ++        {
    ++            DoCastSpellIfCan(m_creature, SPELL_BERSERK);
    ++            DoScriptText(SAY_BERSERK, m_creature);
    ++            m_uiBerserkTimer = 5*MINUTE*IN_MILLISECONDS;
    ++        }
    ++        else
    ++            m_uiBerserkTimer -= uiDiff;
    ++    }
    + };
    +
    + CreatureAI* GetAI_boss_festergut(Creature* pCreature)
    +
    +

    What is done here:

    +
    + + + +
    1 +The Berserk spell ID is assigned to an enum (to prevent so called magic numbers) +
    2 +As we can expect that there will be additional timers for this boss, we must find unique names for every timer, usually this works well with the spellname. + +
    3 +The actual implementation of the timer. From the infos there should be besides the casting of the berserk spell also a text displayed that Festergut enrages. +
    +

    This patch was commited with bd821056ec9f

    +
    + + + +
    +Exercise + +
    Exercise 4 - Add some abilities to your own script
    +

    Write a script for an own boss and add some abilites, or add some abilites to Festergut here.

    +

    Provide patches to the forum thread!

    +

    Also note from which sources you got which info - good place for this would be the commit message

    +
    +
    +
    +
    +
    +
    +

    4. End of second part

    +
    +

    What you should have seen today:

    +
      +
    • +

      +How spells work +

      +
    • +
    • +

      +How to cast spells on a timer +

      +
    • +
    +

    What comes next:

    +
      +
    • +

      +Using events to trigger some stuff +

      +
    • +
    • +

      +Using phases +

      +
    • +
    +
    +
    +
    +

    + + + From ab79f7f68153adea0c25cbbb6775c6a8ceb5df4f Mon Sep 17 00:00:00 2001 From: stfx Date: Fri, 4 Nov 2011 17:50:52 +0100 Subject: [PATCH 31/40] Backport [2321] to keep MakeFiles in sync Improve Mr Smite in Deadmines * Remove unneeded evade check in PhaseEquipProcess * Fix Texts --- VC100/100ScriptDev2.vcxproj | 1 + VC80/80ScriptDev2.vcproj | 4 + VC90/90ScriptDev2.vcproj | 4 + .../deadmines/boss_mr_smite.cpp | 278 ++++++++++++++++++ .../eastern_kingdoms/deadmines/deadmines.cpp | 271 +---------------- sql/scriptdev2_script_full.sql | 4 +- sql/updates/r2321_scriptdev2.sql | 2 + system/ScriptLoader.cpp | 3 +- 8 files changed, 300 insertions(+), 267 deletions(-) create mode 100644 scripts/eastern_kingdoms/deadmines/boss_mr_smite.cpp create mode 100644 sql/updates/r2321_scriptdev2.sql diff --git a/VC100/100ScriptDev2.vcxproj b/VC100/100ScriptDev2.vcxproj index cf314563c..003dee807 100644 --- a/VC100/100ScriptDev2.vcxproj +++ b/VC100/100ScriptDev2.vcxproj @@ -276,6 +276,7 @@ + diff --git a/VC80/80ScriptDev2.vcproj b/VC80/80ScriptDev2.vcproj index 63ee6ed44..11cffa20f 100644 --- a/VC80/80ScriptDev2.vcproj +++ b/VC80/80ScriptDev2.vcproj @@ -679,6 +679,10 @@ + + diff --git a/VC90/90ScriptDev2.vcproj b/VC90/90ScriptDev2.vcproj index 1284716d7..c30b3c062 100644 --- a/VC90/90ScriptDev2.vcproj +++ b/VC90/90ScriptDev2.vcproj @@ -678,6 +678,10 @@ + + diff --git a/scripts/eastern_kingdoms/deadmines/boss_mr_smite.cpp b/scripts/eastern_kingdoms/deadmines/boss_mr_smite.cpp new file mode 100644 index 000000000..2b1aa23d9 --- /dev/null +++ b/scripts/eastern_kingdoms/deadmines/boss_mr_smite.cpp @@ -0,0 +1,278 @@ +/* Copyright (C) 2006 - 2011 ScriptDev2 + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +/* ScriptData +SDName: Boss_Mr_Smite +SD%Complete: 100 +SDComment: +SDCategory: Deadmines +EndScriptData */ + +#include "precompiled.h" +#include "deadmines.h" + +enum +{ + SAY_PHASE_2 = -1036002, + SAY_PHASE_3 = -1036003, + + // EQUIP_ID_SWORD = 2179, // default equipment, not used in code + EQUIP_ID_AXE = 2183, + EQUIP_ID_HAMMER = 10756, + + SPELL_NIBLE_REFLEXES = 6433, // removed after phase 1 + SPELL_SMITE_SLAM = 6435, + SPELL_SMITE_STOMP = 6432, + SPELL_SMITE_HAMMER = 6436, + SPELL_THRASH = 12787, // unclear, possible 3417 (only 10% proc chance) + + PHASE_1 = 1, + PHASE_2 = 2, + PHASE_3 = 3, + PHASE_EQUIP_NULL = 4, + PHASE_EQUIP_START = 5, + PHASE_EQUIP_PROCESS = 6, + PHASE_EQUIP_END = 7, +}; + +struct MANGOS_DLL_DECL boss_mr_smiteAI : public ScriptedAI +{ + boss_mr_smiteAI(Creature* pCreature) : ScriptedAI(pCreature) { Reset(); } + + uint32 m_uiPhase; + uint32 m_uiEquipTimer; + uint32 m_uiSlamTimer; + + void Reset() + { + m_uiPhase = PHASE_1; + m_uiEquipTimer = 0; + m_uiSlamTimer = 9000; + + DoCastSpellIfCan(m_creature, SPELL_NIBLE_REFLEXES, CAST_TRIGGERED); + + // must assume database has the default equipment set + SetEquipmentSlots(true); + } + + void AttackedBy(Unit* pAttacker) + { + if (m_creature->getVictim()) + return; + + if (m_uiPhase > PHASE_3) + return; + + AttackStart(pAttacker); + } + + void AttackStart(Unit* pWho) + { + if (m_uiPhase > PHASE_3) + return; + + if (m_creature->Attack(pWho, true)) + { + m_creature->AddThreat(pWho); + m_creature->SetInCombatWith(pWho); + pWho->SetInCombatWith(m_creature); + + m_creature->GetMotionMaster()->MoveChase(pWho); + } + } + + void MovementInform(uint32 uiMotionType, uint32 uiPointId) + { + if (uiMotionType != POINT_MOTION_TYPE) + return; + + m_creature->SetSheath(SHEATH_STATE_UNARMED); + m_creature->SetStandState(UNIT_STAND_STATE_KNEEL); + + m_uiEquipTimer = 3000; + m_uiPhase = PHASE_EQUIP_PROCESS; + } + + void PhaseEquipStart() + { + ScriptedInstance* pInstance = (ScriptedInstance*)m_creature->GetInstanceData(); + + if (!pInstance) + return; + + GameObject* pChest = pInstance->GetSingleGameObjectFromStorage(GO_SMITE_CHEST); + + if (!pChest) + return; + + m_uiPhase = PHASE_EQUIP_NULL; + + float fX, fY, fZ; + pChest->GetContactPoint(m_creature, fX, fY, fZ, CONTACT_DISTANCE); + + m_creature->GetMotionMaster()->Clear(); + m_creature->SetFacingToObject(pChest); + m_creature->GetMotionMaster()->MovePoint(0, fX, fY, fZ); + } + + void PhaseEquipProcess() + { + if (m_creature->GetHealthPercent() < 33.0f) + { + // It's Hammer, go Hammer! + SetEquipmentSlots(false, EQUIP_ID_HAMMER, EQUIP_UNEQUIP); + DoCastSpellIfCan(m_creature, SPELL_SMITE_HAMMER); + } + else + SetEquipmentSlots(false, EQUIP_ID_AXE, EQUIP_ID_AXE); + + m_creature->SetStandState(UNIT_STAND_STATE_STAND); + m_uiPhase = PHASE_EQUIP_END; + m_uiEquipTimer = 1000; + + Unit* pVictim = m_creature->SelectAttackingTarget(ATTACKING_TARGET_TOPAGGRO, 0); + + if (!pVictim) + { + EnterEvadeMode(); + return; + } + } + + void PhaseEquipEnd() + { + // We don't have getVictim, so select from threat list + Unit* pVictim = m_creature->SelectAttackingTarget(ATTACKING_TARGET_TOPAGGRO, 0); + + if (!pVictim) + { + EnterEvadeMode(); + return; + } + + m_creature->SetSheath(SHEATH_STATE_MELEE); + + m_uiPhase = m_creature->GetHealthPercent() < 33.0f ? PHASE_3 : PHASE_2; + + if (m_uiPhase == PHASE_2) + DoCastSpellIfCan(m_creature, SPELL_THRASH, CAST_TRIGGERED); + + AttackStart(pVictim); + } + + void UpdateAI(const uint32 uiDiff) + { + if (!m_creature->SelectHostileTarget() || !m_creature->getVictim()) + { + if (m_uiEquipTimer) + { + // decrease the cooldown in between equipment change phases + if (m_uiEquipTimer > uiDiff) + { + m_uiEquipTimer -= uiDiff; + return; + } + else + m_uiEquipTimer = 0; + } + + switch(m_uiPhase) + { + case PHASE_EQUIP_START: + PhaseEquipStart(); + break; + case PHASE_EQUIP_PROCESS: + PhaseEquipProcess(); + break; + case PHASE_EQUIP_END: + PhaseEquipEnd(); + break; + } + + return; + } + + // the normal combat phases + switch(m_uiPhase) + { + case PHASE_1: + { + if (m_creature->GetHealthPercent() < 66.0f) + { + if (DoCastSpellIfCan(m_creature, SPELL_SMITE_STOMP) == CAST_OK) + { + DoScriptText(SAY_PHASE_2, m_creature); + m_uiPhase = PHASE_EQUIP_START; + m_uiEquipTimer = 2500; + + // will clear getVictim (m_attacking) + m_creature->AttackStop(true); + m_creature->RemoveAurasDueToSpell(SPELL_NIBLE_REFLEXES); + } + return; + } + break; + } + case PHASE_2: + { + if (m_creature->GetHealthPercent() < 33.0f) + { + if (DoCastSpellIfCan(m_creature, SPELL_SMITE_STOMP) == CAST_OK) + { + DoScriptText(SAY_PHASE_3, m_creature); + m_uiPhase = PHASE_EQUIP_START; + m_uiEquipTimer = 2500; + + // will clear getVictim (m_attacking) + m_creature->AttackStop(true); + m_creature->RemoveAurasDueToSpell(SPELL_THRASH); + } + return; + } + break; + } + case PHASE_3: + { + if (m_uiSlamTimer < uiDiff) + { + if (DoCastSpellIfCan(m_creature->getVictim(), SPELL_SMITE_SLAM) == CAST_OK) + m_uiSlamTimer = 11000; + } + else + m_uiSlamTimer -= uiDiff; + + break; + } + } + + DoMeleeAttackIfReady(); + } +}; + +CreatureAI* GetAI_boss_mr_smite(Creature* pCreature) +{ + return new boss_mr_smiteAI(pCreature); +} + +void AddSC_boss_mr_smite() +{ + Script* pNewScript; + + pNewScript = new Script; + pNewScript->Name = "boss_mr_smite"; + pNewScript->GetAI = &GetAI_boss_mr_smite; + pNewScript->RegisterSelf(); +} diff --git a/scripts/eastern_kingdoms/deadmines/deadmines.cpp b/scripts/eastern_kingdoms/deadmines/deadmines.cpp index f863d9936..4e6907a8a 100644 --- a/scripts/eastern_kingdoms/deadmines/deadmines.cpp +++ b/scripts/eastern_kingdoms/deadmines/deadmines.cpp @@ -16,261 +16,14 @@ /* ScriptData SDName: Deadmines -SD%Complete: 75 -SDComment: Contains boss_mr_smite and GO for event at end door +SD%Complete: 100 +SDComment: Contains GO for Iron Clad door event SDCategory: Deadmines EndScriptData */ #include "precompiled.h" #include "deadmines.h" -/*###### -## boss_mr_smite -######*/ - -enum -{ - SAY_PHASE_2 = -1036002, - SAY_PHASE_3 = -1036003, - - // EQUIP_ID_SWORD = 2179, // default equipment, not used in code - EQUIP_ID_AXE = 2183, - EQUIP_ID_HAMMER = 10756, - - SPELL_NIBLE_REFLEXES = 6433, // removed after phase 1 - SPELL_SMITE_SLAM = 6435, - SPELL_SMITE_STOMP = 6432, - SPELL_SMITE_HAMMER = 6436, - SPELL_THRASH = 12787, // unclear, possible 3417 (only 10% proc chance) - - PHASE_1 = 1, - PHASE_2 = 2, - PHASE_3 = 3, - PHASE_EQUIP_NULL = 4, - PHASE_EQUIP_START = 5, - PHASE_EQUIP_PROCESS = 6, - PHASE_EQUIP_END = 7, -}; - -struct MANGOS_DLL_DECL boss_mr_smiteAI : public ScriptedAI -{ - boss_mr_smiteAI(Creature* pCreature) : ScriptedAI(pCreature) { Reset(); } - - uint32 m_uiPhase; - uint32 m_uiEquipTimer; - uint32 m_uiSlamTimer; - - void Reset() - { - m_uiPhase = PHASE_1; - m_uiEquipTimer = 0; - m_uiSlamTimer = 9000; - - DoCastSpellIfCan(m_creature, SPELL_NIBLE_REFLEXES, CAST_TRIGGERED); - - // must assume database has the default equipment set - SetEquipmentSlots(true); - } - - void AttackedBy(Unit* pAttacker) - { - if (m_creature->getVictim()) - return; - - if (m_uiPhase > PHASE_3) - return; - - AttackStart(pAttacker); - } - - void AttackStart(Unit* pWho) - { - if (m_uiPhase > PHASE_3) - return; - - if (m_creature->Attack(pWho, true)) - { - m_creature->AddThreat(pWho); - m_creature->SetInCombatWith(pWho); - pWho->SetInCombatWith(m_creature); - - m_creature->GetMotionMaster()->MoveChase(pWho); - } - } - - void MovementInform(uint32 uiMotionType, uint32 uiPointId) - { - if (uiMotionType != POINT_MOTION_TYPE) - return; - - m_creature->SetSheath(SHEATH_STATE_UNARMED); - m_creature->SetStandState(UNIT_STAND_STATE_KNEEL); - - m_uiEquipTimer = 3000; - m_uiPhase = PHASE_EQUIP_PROCESS; - } - - void PhaseEquipStart() - { - ScriptedInstance* pInstance = (ScriptedInstance*)m_creature->GetInstanceData(); - - if (!pInstance) - return; - - GameObject* pChest = pInstance->GetSingleGameObjectFromStorage(GO_SMITE_CHEST); - - if (!pChest) - return; - - m_uiPhase = PHASE_EQUIP_NULL; - - float fX, fY, fZ; - pChest->GetContactPoint(m_creature, fX, fY, fZ, CONTACT_DISTANCE); - - m_creature->GetMotionMaster()->Clear(); - m_creature->SetFacingToObject(pChest); - m_creature->GetMotionMaster()->MovePoint(0, fX, fY, fZ); - } - - void PhaseEquipProcess() - { - if (m_creature->GetHealthPercent() < 33.0f) - { - // It's Hammer, go Hammer! - SetEquipmentSlots(false, EQUIP_ID_HAMMER, EQUIP_UNEQUIP); - DoCastSpellIfCan(m_creature, SPELL_SMITE_HAMMER); - } - else - SetEquipmentSlots(false, EQUIP_ID_AXE, EQUIP_ID_AXE); - - m_creature->SetStandState(UNIT_STAND_STATE_STAND); - m_uiPhase = PHASE_EQUIP_END; - m_uiEquipTimer = 1000; - - Unit* pVictim = m_creature->SelectAttackingTarget(ATTACKING_TARGET_TOPAGGRO, 0); - - if (!pVictim) - { - EnterEvadeMode(); - return; - } - } - - void PhaseEquipEnd() - { - // We don't have getVictim, so select from threat list - Unit* pVictim = m_creature->SelectAttackingTarget(ATTACKING_TARGET_TOPAGGRO, 0); - - if (!pVictim) - { - EnterEvadeMode(); - return; - } - - m_creature->SetSheath(SHEATH_STATE_MELEE); - - m_uiPhase = m_creature->GetHealthPercent() < 33.0f ? PHASE_3 : PHASE_2; - - if (m_uiPhase == PHASE_2) - DoCastSpellIfCan(m_creature, SPELL_THRASH, CAST_TRIGGERED); - - AttackStart(pVictim); - } - - void UpdateAI(const uint32 uiDiff) - { - if (!m_creature->SelectHostileTarget() || !m_creature->getVictim()) - { - if (m_uiEquipTimer) - { - // decrease the cooldown in between equipment change phases - if (m_uiEquipTimer > uiDiff) - { - m_uiEquipTimer -= uiDiff; - return; - } - else - m_uiEquipTimer = 0; - } - - switch(m_uiPhase) - { - case PHASE_EQUIP_START: - PhaseEquipStart(); - break; - case PHASE_EQUIP_PROCESS: - PhaseEquipProcess(); - break; - case PHASE_EQUIP_END: - PhaseEquipEnd(); - break; - } - - return; - } - - // the normal combat phases - switch(m_uiPhase) - { - case PHASE_1: - { - if (m_creature->GetHealthPercent() < 66.0f) - { - if (DoCastSpellIfCan(m_creature, SPELL_SMITE_STOMP) == CAST_OK) - { - DoScriptText(SAY_PHASE_2, m_creature); - m_uiPhase = PHASE_EQUIP_START; - m_uiEquipTimer = 2500; - - // will clear getVictim (m_attacking) - m_creature->AttackStop(true); - m_creature->RemoveAurasDueToSpell(SPELL_NIBLE_REFLEXES); - } - return; - } - break; - } - case PHASE_2: - { - if (m_creature->GetHealthPercent() < 33.0f) - { - if (DoCastSpellIfCan(m_creature, SPELL_SMITE_STOMP) == CAST_OK) - { - DoScriptText(SAY_PHASE_3, m_creature); - m_uiPhase = PHASE_EQUIP_START; - m_uiEquipTimer = 2500; - - // will clear getVictim (m_attacking) - m_creature->AttackStop(true); - m_creature->RemoveAurasDueToSpell(SPELL_THRASH); - } - return; - } - break; - } - case PHASE_3: - { - if (m_uiSlamTimer < uiDiff) - { - if (DoCastSpellIfCan(m_creature->getVictim(), SPELL_SMITE_SLAM) == CAST_OK) - m_uiSlamTimer = 11000; - } - else - m_uiSlamTimer -= uiDiff; - - break; - } - } - - DoMeleeAttackIfReady(); - } -}; - -CreatureAI* GetAI_boss_mr_smite(Creature* pCreature) -{ - return new boss_mr_smiteAI(pCreature); -} - bool GOUse_go_door_lever_dm(Player* pPlayer, GameObject* pGo) { ScriptedInstance* pInstance = (ScriptedInstance*)pGo->GetInstanceData(); @@ -302,20 +55,10 @@ bool GOUse_go_defias_cannon(Player* pPlayer, GameObject* pGo) void AddSC_deadmines() { - Script *newscript; - - newscript = new Script; - newscript->Name = "boss_mr_smite"; - newscript->GetAI = &GetAI_boss_mr_smite; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "go_door_lever_dm"; - newscript->pGOUse = &GOUse_go_door_lever_dm; - newscript->RegisterSelf(); + Script* pNewScript; - newscript = new Script; - newscript->Name = "go_defias_cannon"; - newscript->pGOUse = &GOUse_go_defias_cannon; - newscript->RegisterSelf(); + pNewScript = new Script; + pNewScript->Name = "go_defias_cannon"; + pNewScript->pGOUse = &GOUse_go_defias_cannon; + pNewScript->RegisterSelf(); } diff --git a/sql/scriptdev2_script_full.sql b/sql/scriptdev2_script_full.sql index afa7819ec..0f5823352 100644 --- a/sql/scriptdev2_script_full.sql +++ b/sql/scriptdev2_script_full.sql @@ -791,8 +791,8 @@ INSERT INTO script_texts (entry,content_default,sound,type,language,emote,commen -- -1 036 000 DEADMINES INSERT INTO script_texts (entry,content_default,sound,type,language,emote,comment) VALUES -(-1036000,'You there, check out that noise.',5775,6,7,0,'smite INST_SAY_ALARM1'), -(-1036001,'We\'re under attack! A vast, ye swabs! Repel the invaders!',5777,6,7,0,'smite INST_SAY_ALARM2'), +(-1036000,'You there! Check out that noise.',5775,6,7,0,'smite INST_SAY_ALARM1'), +(-1036001,'We\'re under attack! A vast, ye swabs! Repel the invaders!',5777,6,7,0,'smite INST_SAY_ALARM2'), (-1036002,'You land lubbers are tougher than I thought! I\'ll have to improvise!',5778,0,0,21,'smite SAY_PHASE_2'), (-1036003,'D\'ah! Now you\'re making me angry!',5779,0,0,15,'smite SAY_PHASE_3'); diff --git a/sql/updates/r2321_scriptdev2.sql b/sql/updates/r2321_scriptdev2.sql new file mode 100644 index 000000000..884319617 --- /dev/null +++ b/sql/updates/r2321_scriptdev2.sql @@ -0,0 +1,2 @@ +UPDATE script_texts SET content_default='You there! Check out that noise.' WHERE entry=-1036000; +UPDATE script_texts SET content_default='We\'re under attack! A vast, ye swabs! Repel the invaders!' WHERE entry=-1036001; diff --git a/system/ScriptLoader.cpp b/system/ScriptLoader.cpp index eb2ca2537..3d01a903a 100644 --- a/system/ScriptLoader.cpp +++ b/system/ScriptLoader.cpp @@ -63,7 +63,8 @@ extern void AddSC_boss_chromaggus(); extern void AddSC_boss_nefarian(); extern void AddSC_boss_victor_nefarius(); extern void AddSC_instance_blackwing_lair(); -extern void AddSC_deadmines(); // deadmines +extern void AddSC_boss_mr_smite(); // deadmines +extern void AddSC_deadmines(); extern void AddSC_instance_deadmines(); extern void AddSC_gnomeregan(); // gnomeregan extern void AddSC_boss_thermaplugg(); From 458442c50b360e9cde322dc0fefc17f1d3d12eea Mon Sep 17 00:00:00 2001 From: Schmoozerd Date: Tue, 8 Nov 2011 00:25:59 +0100 Subject: [PATCH 32/40] Backport [2327] to fix compile Some improvements related to LoadCreatureAddon --- include/sc_creature.cpp | 1 - .../molten_core/boss_majordomo_executus.cpp | 1 - .../shadowfang_keep/shadowfang_keep.cpp | 4 ++-- .../caverns_of_time/hyjal/hyjalAI.cpp | 1 - scripts/kalimdor/moonglade.cpp | 2 +- scripts/northrend/naxxramas/boss_thaddius.cpp | 21 +++---------------- .../blood_furnace/boss_broggok.cpp | 2 +- 7 files changed, 7 insertions(+), 25 deletions(-) diff --git a/include/sc_creature.cpp b/include/sc_creature.cpp index c625da773..cecf63f41 100644 --- a/include/sc_creature.cpp +++ b/include/sc_creature.cpp @@ -124,7 +124,6 @@ void ScriptedAI::EnterEvadeMode() m_creature->RemoveAllAuras(); m_creature->DeleteThreatList(); m_creature->CombatStop(true); - m_creature->LoadCreatureAddon(); if (m_creature->isAlive()) m_creature->GetMotionMaster()->MoveTargetedHome(); diff --git a/scripts/eastern_kingdoms/molten_core/boss_majordomo_executus.cpp b/scripts/eastern_kingdoms/molten_core/boss_majordomo_executus.cpp index 56aa05f73..2e4ce2838 100644 --- a/scripts/eastern_kingdoms/molten_core/boss_majordomo_executus.cpp +++ b/scripts/eastern_kingdoms/molten_core/boss_majordomo_executus.cpp @@ -135,7 +135,6 @@ struct MANGOS_DLL_DECL boss_majordomoAI : public ScriptedAI m_creature->RemoveAllAuras(); m_creature->DeleteThreatList(); m_creature->CombatStop(true); - m_creature->LoadCreatureAddon(); m_creature->SetLootRecipient(NULL); // Set friendly diff --git a/scripts/eastern_kingdoms/shadowfang_keep/shadowfang_keep.cpp b/scripts/eastern_kingdoms/shadowfang_keep/shadowfang_keep.cpp index e39c6901d..09b2e3482 100644 --- a/scripts/eastern_kingdoms/shadowfang_keep/shadowfang_keep.cpp +++ b/scripts/eastern_kingdoms/shadowfang_keep/shadowfang_keep.cpp @@ -374,7 +374,7 @@ struct MANGOS_DLL_DECL mob_arugal_voidwalkerAI : public ScriptedAI m_creature->RemoveAllAuras(); m_creature->DeleteThreatList(); m_creature->CombatStop(true); - m_creature->LoadCreatureAddon(); + m_creature->LoadCreatureAddon(true); m_creature->SetLootRecipient(NULL); @@ -888,7 +888,7 @@ struct MANGOS_DLL_DECL npc_deathstalker_vincentAI : public ScriptedAI m_creature->RemoveAllAuras(); m_creature->DeleteThreatList(); m_creature->CombatStop(true); - m_creature->LoadCreatureAddon(); + m_creature->LoadCreatureAddon(true); m_creature->SetLootRecipient(NULL); Reset(); } diff --git a/scripts/kalimdor/caverns_of_time/hyjal/hyjalAI.cpp b/scripts/kalimdor/caverns_of_time/hyjal/hyjalAI.cpp index 302d924da..e75aaf065 100644 --- a/scripts/kalimdor/caverns_of_time/hyjal/hyjalAI.cpp +++ b/scripts/kalimdor/caverns_of_time/hyjal/hyjalAI.cpp @@ -138,7 +138,6 @@ void hyjalAI::EnterEvadeMode() m_creature->RemoveAllAuras(); m_creature->DeleteThreatList(); m_creature->CombatStop(true); - m_creature->LoadCreatureAddon(); if (m_creature->isAlive()) m_creature->GetMotionMaster()->MoveTargetedHome(); diff --git a/scripts/kalimdor/moonglade.cpp b/scripts/kalimdor/moonglade.cpp index 7f982e884..a28893d32 100644 --- a/scripts/kalimdor/moonglade.cpp +++ b/scripts/kalimdor/moonglade.cpp @@ -825,7 +825,7 @@ struct MANGOS_DLL_DECL boss_eranikusAI : public ScriptedAI m_creature->RemoveAllAuras(); m_creature->DeleteThreatList(); m_creature->CombatStop(true); - m_creature->LoadCreatureAddon(); + m_creature->LoadCreatureAddon(true); m_creature->SetLootRecipient(NULL); diff --git a/scripts/northrend/naxxramas/boss_thaddius.cpp b/scripts/northrend/naxxramas/boss_thaddius.cpp index 2ec1a316c..4f08913e9 100644 --- a/scripts/northrend/naxxramas/boss_thaddius.cpp +++ b/scripts/northrend/naxxramas/boss_thaddius.cpp @@ -118,6 +118,8 @@ struct MANGOS_DLL_DECL boss_thaddiusAI : public Scripted_NoMovementAI m_uiChainLightningTimer = 8*IN_MILLISECONDS; m_uiBallLightningTimer = 1*IN_MILLISECONDS; m_uiBerserkTimer = 6*MINUTE*IN_MILLISECONDS; + + m_creature->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); } void Aggro(Unit* pWho) @@ -133,7 +135,7 @@ struct MANGOS_DLL_DECL boss_thaddiusAI : public Scripted_NoMovementAI m_creature->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); } - void EnterEvadeMode() + void JustReachedHome() { if (m_pInstance) { @@ -153,23 +155,6 @@ struct MANGOS_DLL_DECL boss_thaddiusAI : public Scripted_NoMovementAI pStalagg->Respawn(); } } - - // Reset - m_creature->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); - - // Delay reloading of CreatureAddon until Reached home for proper handling - // Also note that m_creature->LoadCreatureAddon(); must _not_ be called before m_creature->GetMotionMaster()->MoveTargetedHome(); - // Done this way, because MoveTargetHome ensures proper positioning (orientation) - m_creature->RemoveAllAuras(); - m_creature->DeleteThreatList(); - m_creature->CombatStop(true); - - if (m_creature->isAlive()) - m_creature->GetMotionMaster()->MoveTargetedHome(); - - m_creature->SetLootRecipient(NULL); - - Reset(); } void KilledUnit(Unit* pVictim) diff --git a/scripts/outland/hellfire_citadel/blood_furnace/boss_broggok.cpp b/scripts/outland/hellfire_citadel/blood_furnace/boss_broggok.cpp index 096de3448..ddbdb8a0b 100644 --- a/scripts/outland/hellfire_citadel/blood_furnace/boss_broggok.cpp +++ b/scripts/outland/hellfire_citadel/blood_furnace/boss_broggok.cpp @@ -90,7 +90,7 @@ struct MANGOS_DLL_DECL boss_broggokAI : public ScriptedAI m_creature->RemoveAllAuras(); m_creature->DeleteThreatList(); m_creature->CombatStop(true); - m_creature->LoadCreatureAddon(); + m_creature->LoadCreatureAddon(true); m_creature->SetLootRecipient(NULL); From f6d755b704736482d0aac7b5c3dda7a5398b447b Mon Sep 17 00:00:00 2001 From: Schmoozerd Date: Wed, 30 Nov 2011 14:11:53 +0100 Subject: [PATCH 33/40] Backport [2352] as ICC related Fix Typo for ICC texts - thanks to Blumster for pointing --- .../icecrown_citadel/icecrown_citadel/blood_prince_council.cpp | 2 +- sql/scriptdev2_script_full.sql | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/northrend/icecrown_citadel/icecrown_citadel/blood_prince_council.cpp b/scripts/northrend/icecrown_citadel/icecrown_citadel/blood_prince_council.cpp index 57838d23c..d50f3eb04 100644 --- a/scripts/northrend/icecrown_citadel/icecrown_citadel/blood_prince_council.cpp +++ b/scripts/northrend/icecrown_citadel/icecrown_citadel/blood_prince_council.cpp @@ -30,7 +30,7 @@ enum SAY_KELESETH_INVOCATION = -1631103, SAY_KELESETH_SPECIAL = -1631104, SAY_KELESETH_SLAY_1 = -1631105, - SAY_SKELESETH_SLAY_2 = -1631106, + SAY_KELESETH_SLAY_2 = -1631106, SAY_KELESETH_BERSERK = -1631107, SAY_KELESETH_DEATH = -1631108, SAY_TALDARAM_INVOCATION = -1631109, diff --git a/sql/scriptdev2_script_full.sql b/sql/scriptdev2_script_full.sql index 0f5823352..9cfc8f625 100644 --- a/sql/scriptdev2_script_full.sql +++ b/sql/scriptdev2_script_full.sql @@ -3534,7 +3534,7 @@ INSERT INTO script_texts (entry,content_default,sound,type,language,emote,commen (-1631103,'Such wondrous power! The Darkfallen Orb has made me INVINCIBLE!',16727,1,0,0,'keleseth SAY_KELESETH_INVOCATION'), (-1631104,'Blood will flow!',16728,1,0,0,'keleseth SAY_KELESETH_SPECIAL'), (-1631105,'Were you ever a threat?',16723,1,0,0,'keleseth SAY_KELESETH_SLAY_1'), -(-1631106,'Truth is found in death.',16724,1,0,0,'keleseth SAY_SKELESETH_SLAY_2'), +(-1631106,'Truth is found in death.',16724,1,0,0,'keleseth SAY_KELESETH_SLAY_2'), (-1631107,'%s cackles maniacally!',16726,2,0,0,'keleseth SAY_KELESETH_BERSERK'), -- TODO Can be wrong (-1631108,'My queen... they come...',16725,1,0,0,'keleseth SAY_KELESETH_DEATH'), From ba3d2665c329b38dbe8fa45a02c41d23dbe1fbc3 Mon Sep 17 00:00:00 2001 From: Xfurry Date: Thu, 12 Jan 2012 22:29:26 +0200 Subject: [PATCH 34/40] Backport [2382] to keep MakeFiles in sync Add placeholder for Oculus For Documentation purpose: The last 4 commits were done with 'git cherry-pick ' One was picked for compile fix, one was picked because ICC related, and the other two to keep the "makefiles" in sync for easier and faster compile. I didn't merge the master branch, to keep the history nice and clear --- VC100/100ScriptDev2.vcxproj | 4 +++ VC100/100ScriptDev2.vcxproj.filters | 12 ++++++++ VC80/80ScriptDev2.vcproj | 16 +++++++++++ VC90/90ScriptDev2.vcproj | 16 +++++++++++ .../northrend/nexus/oculus/boss_eregos.cpp | 28 +++++++++++++++++++ scripts/northrend/nexus/oculus/boss_urom.cpp | 28 +++++++++++++++++++ .../nexus/oculus/instance_oculus.cpp | 28 +++++++++++++++++++ scripts/northrend/nexus/oculus/oculus.h | 3 ++ system/ScriptLoader.cpp | 6 ++++ 9 files changed, 141 insertions(+) create mode 100644 scripts/northrend/nexus/oculus/boss_eregos.cpp create mode 100644 scripts/northrend/nexus/oculus/boss_urom.cpp create mode 100644 scripts/northrend/nexus/oculus/instance_oculus.cpp create mode 100644 scripts/northrend/nexus/oculus/oculus.h diff --git a/VC100/100ScriptDev2.vcxproj b/VC100/100ScriptDev2.vcxproj index 003dee807..cebfb83d5 100644 --- a/VC100/100ScriptDev2.vcxproj +++ b/VC100/100ScriptDev2.vcxproj @@ -546,6 +546,9 @@ + + + @@ -750,6 +753,7 @@ + diff --git a/VC100/100ScriptDev2.vcxproj.filters b/VC100/100ScriptDev2.vcxproj.filters index 400b891aa..41f594c92 100644 --- a/VC100/100ScriptDev2.vcxproj.filters +++ b/VC100/100ScriptDev2.vcxproj.filters @@ -1227,6 +1227,15 @@ scripts\northrend\nexus\nexus + + scripts\northrend\nexus\oculus + + + scripts\northrend\nexus\oculus + + + scripts\northrend\nexus\oculus + scripts\northrend\obsidian_sanctum @@ -1890,6 +1899,9 @@ scripts\northrend\nexus\nexus + + scripts\northrend\nexus\oculus + scripts\northrend\obsidian_sanctum diff --git a/VC80/80ScriptDev2.vcproj b/VC80/80ScriptDev2.vcproj index 11cffa20f..e0ace264c 100644 --- a/VC80/80ScriptDev2.vcproj +++ b/VC80/80ScriptDev2.vcproj @@ -2126,6 +2126,22 @@ + + + + + + + + + + + + + + + + + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +/* ScriptData +SDName: boss_eregos +SD%Complete: 0 +SDComment: Placeholder +SDCategory: Oculus +EndScriptData */ + +#include "precompiled.h" + +void AddSC_boss_eregos() +{ +} diff --git a/scripts/northrend/nexus/oculus/boss_urom.cpp b/scripts/northrend/nexus/oculus/boss_urom.cpp new file mode 100644 index 000000000..9fdb91b75 --- /dev/null +++ b/scripts/northrend/nexus/oculus/boss_urom.cpp @@ -0,0 +1,28 @@ +/* Copyright (C) 2006 - 2012 ScriptDev2 + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +/* ScriptData +SDName: boss_urom +SD%Complete: 0 +SDComment: Placeholder +SDCategory: Oculus +EndScriptData */ + +#include "precompiled.h" + +void AddSC_boss_urom() +{ +} diff --git a/scripts/northrend/nexus/oculus/instance_oculus.cpp b/scripts/northrend/nexus/oculus/instance_oculus.cpp new file mode 100644 index 000000000..e8659606e --- /dev/null +++ b/scripts/northrend/nexus/oculus/instance_oculus.cpp @@ -0,0 +1,28 @@ +/* Copyright (C) 2006 - 2012 ScriptDev2 + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +/* ScriptData +SDName: instance_oculus +SD%Complete: 0 +SDComment: Placeholder +SDCategory: Oculus +EndScriptData */ + +#include "precompiled.h" + +void AddSC_instance_oculus() +{ +} diff --git a/scripts/northrend/nexus/oculus/oculus.h b/scripts/northrend/nexus/oculus/oculus.h new file mode 100644 index 000000000..5871a49a1 --- /dev/null +++ b/scripts/northrend/nexus/oculus/oculus.h @@ -0,0 +1,3 @@ +/* Copyright (C) 2006 - 2012 ScriptDev2 + * This program is free software licensed under GPL version 2 + * Please see the included DOCS/LICENSE.TXT for more information */ diff --git a/system/ScriptLoader.cpp b/system/ScriptLoader.cpp index 3d01a903a..5798811bd 100644 --- a/system/ScriptLoader.cpp +++ b/system/ScriptLoader.cpp @@ -348,6 +348,9 @@ extern void AddSC_boss_keristrasza(); extern void AddSC_boss_ormorok(); extern void AddSC_boss_telestra(); extern void AddSC_instance_nexus(); +extern void AddSC_boss_eregos(); // nexus, oculus +extern void AddSC_boss_urom(); +extern void AddSC_instance_oculus(); extern void AddSC_boss_sartharion(); // obsidian_sanctum extern void AddSC_instance_obsidian_sanctum(); extern void AddSC_boss_baltharus(); // ruby_sanctum @@ -838,6 +841,9 @@ void AddScripts() AddSC_boss_ormorok(); AddSC_boss_telestra(); AddSC_instance_nexus(); + AddSC_boss_eregos(); // nexus, oculus + AddSC_boss_urom(); + AddSC_instance_oculus(); AddSC_boss_sartharion(); // obsidian_sanctum AddSC_instance_obsidian_sanctum(); AddSC_boss_baltharus(); // ruby_sanctum From d3a6d75198b6b0d075c18f02fc25f4377ebc6149 Mon Sep 17 00:00:00 2001 From: Schmoozerd Date: Tue, 17 Jan 2012 12:23:43 +0100 Subject: [PATCH 35/40] ICC, Instance - Add class for instance script In this commit I add the base layout for a SD2 instance script. This should be created as a subclass of ScriptedInstance, and implemented with a header declaration. The reason for the header declaration is, that this is required to create some special function in the instance class and use them from boss scripts. The script will be hooked to the ScriptName 'instance_icecrown_citadel' It will be added to SQL in the next commit. --- .../icecrown_citadel/icecrown_citadel.h | 22 +++++++++++++++++++ .../instance_icecrown_citadel.cpp | 22 +++++++++++++++++++ 2 files changed, 44 insertions(+) diff --git a/scripts/northrend/icecrown_citadel/icecrown_citadel/icecrown_citadel.h b/scripts/northrend/icecrown_citadel/icecrown_citadel/icecrown_citadel.h index b254d65cd..04146edf9 100644 --- a/scripts/northrend/icecrown_citadel/icecrown_citadel/icecrown_citadel.h +++ b/scripts/northrend/icecrown_citadel/icecrown_citadel/icecrown_citadel.h @@ -1,3 +1,25 @@ /* Copyright (C) 2006 - 2011 ScriptDev2 * This program is free software licensed under GPL version 2 * Please see the included DOCS/LICENSE.TXT for more information */ + + +#ifndef DEF_ICCRAID_H +#define DEF_ICCRAID_H + +enum +{ + MAX_ENCOUNTER = 1, +}; + +class MANGOS_DLL_DECL instance_icecrown_citadel : public ScriptedInstance +{ + public: + instance_icecrown_citadel(Map* pMap); + + void Initialize(); + + private: + uint32 m_auiEncounter[MAX_ENCOUNTER]; +}; + +#endif diff --git a/scripts/northrend/icecrown_citadel/icecrown_citadel/instance_icecrown_citadel.cpp b/scripts/northrend/icecrown_citadel/icecrown_citadel/instance_icecrown_citadel.cpp index dbdb66ef1..7c45d47dc 100644 --- a/scripts/northrend/icecrown_citadel/icecrown_citadel/instance_icecrown_citadel.cpp +++ b/scripts/northrend/icecrown_citadel/icecrown_citadel/instance_icecrown_citadel.cpp @@ -22,7 +22,29 @@ SDCategory: Icecrown Citadel EndScriptData */ #include "precompiled.h" +#include "icecrown_citadel.h" + +instance_icecrown_citadel::instance_icecrown_citadel(Map* pMap) : ScriptedInstance(pMap) +{ + Initialize(); +} + +void instance_icecrown_citadel::Initialize() +{ + memset(&m_auiEncounter, 0, sizeof(m_auiEncounter)); +} + +InstanceData* GetInstanceData_instance_icecrown_citadel(Map* pMap) +{ + return new instance_icecrown_citadel(pMap); +} void AddSC_instance_icecrown_citadel() { + Script* pNewScript; + + pNewScript = new Script; + pNewScript->Name = "instance_icecrown_citadel"; + pNewScript->GetInstanceData = &GetInstanceData_instance_icecrown_citadel; + pNewScript->RegisterSelf(); } From 6f93f52ae040508d133daa95f19eb984aff77648 Mon Sep 17 00:00:00 2001 From: Schmoozerd Date: Tue, 17 Jan 2012 12:42:29 +0100 Subject: [PATCH 36/40] ICC, Instance - Add ScriptName for instance script to SQL-files --- sql/mangos_scriptname_full.sql | 3 ++- sql/updates/r8801_mangos.sql | 1 + 2 files changed, 3 insertions(+), 1 deletion(-) create mode 100644 sql/updates/r8801_mangos.sql diff --git a/sql/mangos_scriptname_full.sql b/sql/mangos_scriptname_full.sql index de37e427d..45cda1cf6 100644 --- a/sql/mangos_scriptname_full.sql +++ b/sql/mangos_scriptname_full.sql @@ -709,12 +709,13 @@ UPDATE creature_template SET ScriptName='npc_silvermoon_harry' WHERE entry=24539 /* ICECROWN CITADEL */ UPDATE creature_template SET ScriptName='boss_festergut' WHERE entry=36626; +UPDATE instance_template SET ScriptName='instance_icecrown_citadel' WHERE map=631; /* FORGE OF SOULS */ +UPDATE instance_template SET ScriptName='instance_forge_of_souls' WHERE map=632; UPDATE creature_template SET ScriptName='boss_bronjahm' WHERE entry=36497; UPDATE creature_template SET ScriptName='npc_corrupted_soul_fragment' WHERE entry=36535; UPDATE creature_template SET ScriptName='boss_devourer_of_souls' WHERE entry=36502; -UPDATE instance_template SET ScriptName='instance_forge_of_souls' WHERE map=632; /* HALLS OF REFLECTION */ diff --git a/sql/updates/r8801_mangos.sql b/sql/updates/r8801_mangos.sql new file mode 100644 index 000000000..2a166591e --- /dev/null +++ b/sql/updates/r8801_mangos.sql @@ -0,0 +1 @@ +UPDATE instance_template SET ScriptName='instance_icecrown_citadel' WHERE map=631; From 85e51be07d4f7c27c141de2764930ad437a051c7 Mon Sep 17 00:00:00 2001 From: Schmoozerd Date: Tue, 17 Jan 2012 13:27:37 +0100 Subject: [PATCH 37/40] ICC, Instance - Add Types for ICC Bosses We store the state of the encounters in an instance in the array m_auiEncounter. To access (get and set) we use type-enums to identify which state corresponds to which encounter --- .../icecrown_citadel/icecrown_citadel.h | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/scripts/northrend/icecrown_citadel/icecrown_citadel/icecrown_citadel.h b/scripts/northrend/icecrown_citadel/icecrown_citadel/icecrown_citadel.h index 04146edf9..d07026c3b 100644 --- a/scripts/northrend/icecrown_citadel/icecrown_citadel/icecrown_citadel.h +++ b/scripts/northrend/icecrown_citadel/icecrown_citadel/icecrown_citadel.h @@ -8,7 +8,20 @@ enum { - MAX_ENCOUNTER = 1, + MAX_ENCOUNTER = 12, + + TYPE_MARROWGAR = 0, + TYPE_DEATHWHISPER = 1, + TYPE_GUNSHIP = 2, + TYPE_SAURFANG = 3, + TYPE_FESTERGUT = 4, + TYPE_ROTFACE = 5, + TYPE_PUTRICIDE = 6, + TYPE_COUNCIL = 7, + TYPE_BLOOD_QUEEN = 8, + TYPE_VALITHRIA = 9, + TYPE_SINDRAGOSA = 10, + TYPE_LICH_KING = 11, }; class MANGOS_DLL_DECL instance_icecrown_citadel : public ScriptedInstance From c43c76069da899612dfb5b6c5da6ce6fd5bdd69a Mon Sep 17 00:00:00 2001 From: Schmoozerd Date: Tue, 17 Jan 2012 13:33:15 +0100 Subject: [PATCH 38/40] ICC, Instance - Implement basic support to Access the instance state This commit implements the two functions SetData and GetData to get/set the state of the instance. --- .../icecrown_citadel/icecrown_citadel.h | 3 ++ .../instance_icecrown_citadel.cpp | 29 +++++++++++++++++++ 2 files changed, 32 insertions(+) diff --git a/scripts/northrend/icecrown_citadel/icecrown_citadel/icecrown_citadel.h b/scripts/northrend/icecrown_citadel/icecrown_citadel/icecrown_citadel.h index d07026c3b..523f88025 100644 --- a/scripts/northrend/icecrown_citadel/icecrown_citadel/icecrown_citadel.h +++ b/scripts/northrend/icecrown_citadel/icecrown_citadel/icecrown_citadel.h @@ -31,6 +31,9 @@ class MANGOS_DLL_DECL instance_icecrown_citadel : public ScriptedInstance void Initialize(); + void SetData(uint32 uiType, uint32 uiData); + uint32 GetData(uint32 uiType); + private: uint32 m_auiEncounter[MAX_ENCOUNTER]; }; diff --git a/scripts/northrend/icecrown_citadel/icecrown_citadel/instance_icecrown_citadel.cpp b/scripts/northrend/icecrown_citadel/icecrown_citadel/instance_icecrown_citadel.cpp index 7c45d47dc..91a69367e 100644 --- a/scripts/northrend/icecrown_citadel/icecrown_citadel/instance_icecrown_citadel.cpp +++ b/scripts/northrend/icecrown_citadel/icecrown_citadel/instance_icecrown_citadel.cpp @@ -34,6 +34,35 @@ void instance_icecrown_citadel::Initialize() memset(&m_auiEncounter, 0, sizeof(m_auiEncounter)); } +void instance_icecrown_citadel::SetData(uint32 uiType, uint32 uiData) +{ + switch (uiType) + { + case TYPE_MARROWGAR: + case TYPE_DEATHWHISPER: + case TYPE_GUNSHIP: + case TYPE_SAURFANG: + case TYPE_FESTERGUT: + case TYPE_ROTFACE: + case TYPE_PUTRICIDE: + case TYPE_COUNCIL: + case TYPE_BLOOD_QUEEN: + case TYPE_VALITHRIA: + case TYPE_SINDRAGOSA: + case TYPE_LICH_KING: + m_auiEncounter[uiType] = uiData; + break; + } +} + +uint32 instance_icecrown_citadel::GetData(uint32 uiType) +{ + if (uiType < MAX_ENCOUNTER) + return m_auiEncounter[uiType]; + + return 0; +} + InstanceData* GetInstanceData_instance_icecrown_citadel(Map* pMap) { return new instance_icecrown_citadel(pMap); From 0df574ad64247fc747c07b69a5bc86762d42a3d5 Mon Sep 17 00:00:00 2001 From: Schmoozerd Date: Tue, 17 Jan 2012 13:37:49 +0100 Subject: [PATCH 39/40] ICC, Instance - Add Save'n'Load support This implements support to store the state of the instance script also in case of grid unloads. The related functions Save and Load are used in MaNGOS to actually store the dataz --- .../icecrown_citadel/icecrown_citadel.h | 4 ++ .../instance_icecrown_citadel.cpp | 40 +++++++++++++++++++ 2 files changed, 44 insertions(+) diff --git a/scripts/northrend/icecrown_citadel/icecrown_citadel/icecrown_citadel.h b/scripts/northrend/icecrown_citadel/icecrown_citadel/icecrown_citadel.h index 523f88025..ef397ca04 100644 --- a/scripts/northrend/icecrown_citadel/icecrown_citadel/icecrown_citadel.h +++ b/scripts/northrend/icecrown_citadel/icecrown_citadel/icecrown_citadel.h @@ -34,8 +34,12 @@ class MANGOS_DLL_DECL instance_icecrown_citadel : public ScriptedInstance void SetData(uint32 uiType, uint32 uiData); uint32 GetData(uint32 uiType); + const char* Save() { return m_strInstData.c_str(); } + void Load(const char* chrIn); + private: uint32 m_auiEncounter[MAX_ENCOUNTER]; + std::string m_strInstData; }; #endif diff --git a/scripts/northrend/icecrown_citadel/icecrown_citadel/instance_icecrown_citadel.cpp b/scripts/northrend/icecrown_citadel/icecrown_citadel/instance_icecrown_citadel.cpp index 91a69367e..0072a3d9a 100644 --- a/scripts/northrend/icecrown_citadel/icecrown_citadel/instance_icecrown_citadel.cpp +++ b/scripts/northrend/icecrown_citadel/icecrown_citadel/instance_icecrown_citadel.cpp @@ -53,6 +53,46 @@ void instance_icecrown_citadel::SetData(uint32 uiType, uint32 uiData) m_auiEncounter[uiType] = uiData; break; } + + if (uiData == DONE) + { + OUT_SAVE_INST_DATA; + + std::ostringstream saveStream; + saveStream << m_auiEncounter[0] << " " << m_auiEncounter[1] << " " << m_auiEncounter[2] << " " + << m_auiEncounter[3] << " " << m_auiEncounter[4] << " " << m_auiEncounter[5] << " " + << m_auiEncounter[6] << " " << m_auiEncounter[7] << " " << m_auiEncounter[8] << " " + << m_auiEncounter[9] << " " << m_auiEncounter[10] << " " << m_auiEncounter[11]; + + m_strInstData = saveStream.str(); + + SaveToDB(); + OUT_SAVE_INST_DATA_COMPLETE; + } +} + +void instance_icecrown_citadel::Load(const char* chrIn) +{ + if (!chrIn) + { + OUT_LOAD_INST_DATA_FAIL; + return; + } + + OUT_LOAD_INST_DATA(chrIn); + + std::istringstream loadStream(chrIn); + loadStream >> m_auiEncounter[0] >> m_auiEncounter[1] >> m_auiEncounter[2] >> m_auiEncounter[3] + >> m_auiEncounter[4] >> m_auiEncounter[5] >> m_auiEncounter[6] >> m_auiEncounter[7] + >> m_auiEncounter[8] >> m_auiEncounter[9] >> m_auiEncounter[10] >> m_auiEncounter[11]; + + for (uint8 i = 0; i < MAX_ENCOUNTER; ++i) + { + if (m_auiEncounter[i] == IN_PROGRESS) + m_auiEncounter[i] = NOT_STARTED; + } + + OUT_LOAD_INST_DATA_COMPLETE; } uint32 instance_icecrown_citadel::GetData(uint32 uiType) From b22d51b76deaea9206471cb94eb1bb8f9b107c16 Mon Sep 17 00:00:00 2001 From: Schmoozerd Date: Tue, 17 Jan 2012 13:42:07 +0100 Subject: [PATCH 40/40] ICC, Instance - Add support for IsEncounterInProgress This function is used to check if an encounter is in progress. If this is the case players cannot enter the instance. (Checked by MaNGOS) --- .../icecrown_citadel/icecrown_citadel.h | 2 ++ .../icecrown_citadel/instance_icecrown_citadel.cpp | 11 +++++++++++ 2 files changed, 13 insertions(+) diff --git a/scripts/northrend/icecrown_citadel/icecrown_citadel/icecrown_citadel.h b/scripts/northrend/icecrown_citadel/icecrown_citadel/icecrown_citadel.h index ef397ca04..1efe456cc 100644 --- a/scripts/northrend/icecrown_citadel/icecrown_citadel/icecrown_citadel.h +++ b/scripts/northrend/icecrown_citadel/icecrown_citadel/icecrown_citadel.h @@ -31,6 +31,8 @@ class MANGOS_DLL_DECL instance_icecrown_citadel : public ScriptedInstance void Initialize(); + bool IsEncounterInProgress() const; + void SetData(uint32 uiType, uint32 uiData); uint32 GetData(uint32 uiType); diff --git a/scripts/northrend/icecrown_citadel/icecrown_citadel/instance_icecrown_citadel.cpp b/scripts/northrend/icecrown_citadel/icecrown_citadel/instance_icecrown_citadel.cpp index 0072a3d9a..1851d2081 100644 --- a/scripts/northrend/icecrown_citadel/icecrown_citadel/instance_icecrown_citadel.cpp +++ b/scripts/northrend/icecrown_citadel/icecrown_citadel/instance_icecrown_citadel.cpp @@ -34,6 +34,17 @@ void instance_icecrown_citadel::Initialize() memset(&m_auiEncounter, 0, sizeof(m_auiEncounter)); } +bool instance_icecrown_citadel::IsEncounterInProgress() const +{ + for (uint8 i = TYPE_MARROWGAR; i <= TYPE_LICH_KING; ++i) + { + if (m_auiEncounter[i] == IN_PROGRESS) + return true; + } + + return false; +} + void instance_icecrown_citadel::SetData(uint32 uiType, uint32 uiData) { switch (uiType)