Welcome
Welcome to the Castle Age AutoPlayer forums

You are currently viewing our boards as a guest, which gives you limited access to view most discussions and access our other features. By joining our free community, you will have access to post topics, communicate privately with other members (PM), respond to polls, upload content, and access many other special features. In addition, registered members also see less advertisements. Registration is fast, simple, and absolutely free, so please, join our community today!

code contributions

Discussion and information regarding the current Community Build

code contributions

Postby magowiz » 16 Oct 2012, 20:54

This topic aim is to group code contributions from people, so if you want to propose your code you are welcome to do it , but please also explain what your code does .
magowiz
Site Admin
Site Admin
 
Posts: 641
Joined: 16 Jun 2011, 13:20
Has thanked: 33 time
Have thanks: 140 time

 

Re: code contributions

Postby 地獄の炎 » 17 Oct 2012, 21:55

Subject: parts order, for monsters like Fenix and poseidon.

Ain: Some group of monster hunter prefer to kill part 2 first and other group prefer part 3 first. So, for go for rules of each monster hunter group, we need to define which parts order to kill for specific monster.

Exemple:
I have 2 Fenix to kill.
The parts number of Fenix is 1 for head, 2 for Talons and 3 for Fire Shield.
First Fenix ruler (summoner name: Ruler)want to kill part 2 first, part 3 in second and 1 at last.
The other fenix don't have rule, so let the default rule order for part that is 3 first, 2 in second and 1 at last.
So, I will set in user monster order field:
Ruler:ach30m:po[2.3.1]
It will do 30 million activity achievement for the first Fenix summoned by Ruler and hit part 2 first, 3 in second and 1 at last.
And as I don't specify for other, it will hit other Fenix in default order (3->2->1).

Code in caap_monster.js at line 561:

Code: Select all
                // if the monster has parts, run through them in reverse order until we find one with health and hit it.
                var partsTargets = $j("div[id^='monster_target_']");
                if (partsTargets.length > 0) {
                var orderPartsArray=[];
                if(currentMonster['conditions'] && currentMonster['conditions'].match(/:po/i) ) {
                   orderPartsArray=currentMonster['conditions'].substring(currentMonster['conditions'].indexOf('[')+1,currentMonster['conditions'].lastIndexOf(']')).split(".");
                } else {
                   orderPartsArray = monsterInfo.partOrder;
                }
                if (monsterInfo.bodyparts!=orderPartsArray.length) {
                   $j().alert("Wrong number of parts in monster condition!");
                } else {
                   for (var ii=0; ii < monsterInfo.bodyparts; ii++) {                 
                      if (partsTargets[orderPartsArray[ii]-1].children[0].children[1].children[0].children[0].style.width.replace ('%', '') * 1 > 0) {
                         caap.click(partsTargets[orderPartsArray[ii]-1].children[0].children[1].children[1].children[0]);
                         break;
                      }
                   }
                }
                }
地獄の炎
First Knight
First Knight
 
Posts: 155
Joined: 24 Jun 2011, 18:10
Has thanked: 40 time
Have thanks: 26 time

Re: code contributions

Postby magowiz » 18 Oct 2012, 06:52

Thank you for your work and also for how you explained it, I really appreciate this way of working and I hope next contributors will be precise like you.
This said, I included your code in just released d79.
magowiz
Site Admin
Site Admin
 
Posts: 641
Joined: 16 Jun 2011, 13:20
Has thanked: 33 time
Have thanks: 140 time

Re: code contributions

Postby magowiz » 18 Oct 2012, 10:57

Since I understood that your code permits further settings in monster order I ask you 2 things :
  • please verify that d79 works as you expect for multipart monsters in the 2 cases : with and without user settings in part orders
  • read this post attack-monsters-in-this-order-clarified-t408.html and write me a few lines about how to use your part order definition so I can add it to explanation.
magowiz
Site Admin
Site Admin
 
Posts: 641
Joined: 16 Jun 2011, 13:20
Has thanked: 33 time
Have thanks: 140 time

Re: code contributions

Postby 地獄の炎 » 19 Oct 2012, 22:15

I don't have monster with parts for now. But, I'll test it as soon as posible.

For the howto, set is doing as it:
MonsterName:po[3.2.1]

For exemple, Abomination have 4 parts:
    1=Main
    2=Stomach
    3=Tentacle
    4=Slime Minions

If you need to attack Abomination's part in this order: Tentacle,Stomach,Slime Minions and Main, you need to set:
Abomination:po[3.2.4.1]

Important: you have to set correct number of part between the [ ]
Poseidon have 2 parts (1=Main,2=Trident)
Fenix have 3 parts (1=Head,2=Talons,3=Fire Shield)
Kessaran have 3 parts (1=Head,2=Blade Arm,3=Spell Arm)
Urmek have 4 parts (1=Essence,2=Left Arm,3=Stone Armor,4=Right Arm)
Abomination have 4 parts (1=Main,2=Stomach,3=Tentacle,4=Slime Minions)

Maybe a little correction will be nice to fix this last point.
地獄の炎
First Knight
First Knight
 
Posts: 155
Joined: 24 Jun 2011, 18:10
Has thanked: 40 time
Have thanks: 26 time

Re: code contributions

Postby magowiz » 20 Oct 2012, 06:46

thank you, I took your instructions and adjusted to fit the post I linked you before, please take a look and tell me if you think it's ok :
post436.html#p436

magowiz has been thanked by:
magowiz
Site Admin
Site Admin
 
Posts: 641
Joined: 16 Jun 2011, 13:20
Has thanked: 33 time
Have thanks: 140 time

Re: code contributions

Postby 地獄の炎 » 22 Oct 2012, 06:21

good! nothing to say!
地獄の炎
First Knight
First Knight
 
Posts: 155
Joined: 24 Jun 2011, 18:10
Has thanked: 40 time
Have thanks: 26 time

Re: code contributions

Postby 地獄の炎 » 26 Oct 2012, 19:23

Ok, I tried. it works for monsters with parts that do not have minions.

Because minions seem like parts, but disappear when they died. So, I'm working on a fix for "Vorak" and "Abomination".

"Slime Minions" is the minion part of Abomination. And "Wind Elemental" is the minion of Vorak.
地獄の炎
First Knight
First Knight
 
Posts: 155
Joined: 24 Jun 2011, 18:10
Has thanked: 40 time
Have thanks: 26 time

Re: code contributions

Postby 地獄の炎 » 26 Oct 2012, 21:42

Corrections:

caap_monster.js on line 563:
Code: Select all
             

            // if the monster has parts, run through them in reverse order until we find one with health and hit it.
                var partsTargets = $j("div[id^='monster_target_']");
                if (partsTargets.length > 0) {
               
               // Define if use user or default order parts
               var orderPartsArray=[];
               if(currentMonster['conditions'] && currentMonster['conditions'].match(/:po/i) ) {
                  orderPartsArray=currentMonster['conditions'].substring(currentMonster['conditions'].indexOf('[')+1,currentMonster['conditions'].lastIndexOf(']')).split(".");
                  if (monsterInfo.bodyparts!=orderPartsArray.length) {
                     // Wrong number of parts in monster condition.
                     // Set Default Order parts
                     orderPartsArray = monsterInfo.partOrder;
                  }
               } else {
                  orderPartsArray = monsterInfo.partOrder;
               }
               
               // If minions dead, remove index of minions
               if (orderPartsArray.length>partsTargets.length) {
                  var max_index = -1;
                  var max_value = Number.MIN_VALUE;
                  for(var i = 0; i < orderPartsArray.length; i++)   {
                     if(orderPartsArray[i] > max_value) {
                        max_value = orderPartsArray[i];
                        max_index = i;
                     }
                  }
                  if (max_index>-1) {
                     orderPartsArray.splice(max_index, 1);
                  }
               }
               
               // Click first order parts which have health
               for (var ii=0; ii < orderPartsArray.length; ii++) {
               
                  if (partsTargets[orderPartsArray[ii]-1].children[0].children[partsTargets[orderPartsArray[ii]-1].children[0].children.length-1].children[0].children[0].style.width.replace ('%', '') * 1 > 0) {
                     caap.click(partsTargets[orderPartsArray[ii]-1].children[0].children[partsTargets[orderPartsArray[ii]-1].children[0].children.length-1].children[1].children[0]);
                     break;
                  }
               }
               
                }





add vorak to monsters.js :

Code: Select all
            "Vorak" : {
               alpha        : true,
                duration     : 168,
                hp           : 650000000,
                ach          : 1000000,
                siege        : 10,
                siegeClicks  : [15, 30, 45, 60, 70, 100, 150, 200, 250, 300],
                siegeDam     : [9000000, 11000000, 15000000, 19000000, 23000000, 27000000, 31000000, 35000000, 39000000, 44000000],
                siege_img    : [
                    '/graphics/earth_siege_small',
                    '/graphics/castle_siege_small',
                    '/graphics/skaar_siege_small',
                    '/graphics/death_siege_small'
                ],
                fort         : true,
                staUse       : 10,
                staLvl       : [0, 100, 200, 500],
                staMax       : [10, 20, 50, 100, 200],
                nrgMax       : [20, 40, 100, 200, 200],
                defense_img  : 'nm_green.jpg',
                levels       : [1,  50, 100, 150],
                join         : [30, 30, 35,  60],
                mClass       : 'Epic Boss',
                mpool        : 1,
                newbg_img    : ['monster_header_vorak.jpg'],
                list_img     : ['monster_header_vorak.jpg'],
                cta_img      : ['cta_vorak.gif'],
                bodyparts    : 4,
                partOrder    : [4,3,2,1]
            },

地獄の炎 has been thanked by:
地獄の炎
First Knight
First Knight
 
Posts: 155
Joined: 24 Jun 2011, 18:10
Has thanked: 40 time
Have thanks: 26 time

Re: code contributions

Postby magowiz » 26 Oct 2012, 22:11

thank you very much, your code will be committed on upcoming d81

magowiz has been thanked by:
magowiz
Site Admin
Site Admin
 
Posts: 641
Joined: 16 Jun 2011, 13:20
Has thanked: 33 time
Have thanks: 140 time

Next

Return to Community Build

Who is online

Users browsing this forum: No registered users and 1 guest

cron
suspicion-preferred