5165 Version of p4n's Intelligent Auto CP System

02/25/2010 20:50 walmartboi#1
OK, so this isn't entirely my idea, I just simply converted it to 5165. :)

You can give me thanks, but also give pro4never thanks too if he posts here(even though I know he will post here lol).

Find in Mob.cs:

Code:
if (MyMath.ChanceSuccess(100))
                {
or whatever you have your auto CPs as in your source.

Replace it with this:

Code:
if (MyMath.ChanceSuccess(100))
                {
                    string acc = "";
                    int cpDroprate = 10;//rate of cp for server
                    int cpLow = 1;//min cp drop
                    int cpHigh = 25;// max cp drop
                    int cpMultiplyer = 5;// cp drop multiplier
                    double cpMobDropRate = (Convert.ToDouble(MobTarget.Level) / Convert.ToDouble(Char.Level)) * cpDroprate;
                    if (MyMath.ChanceSuccess(cpMobDropRate))
                    {
                        Random rand = new Random();
                        int cpBaseReward = rand.Next(cpLow, cpHigh);
                        int cpToAdd = cpBaseReward * cpMultiplyer;

                        Char.CPs += Convert.ToUInt32(cpToAdd);
                        Char.MyClient.LocalMessage(2005, "[CPs] You have gained: " + cpToAdd + " CPs for killing a(n) " + MobTarget.Name);
                        Database.SaveCharacter(Char, acc);
                    }
                }
There, all done. :p
02/25/2010 21:26 ~Yuki~#2
good work.
02/25/2010 21:27 killersub#3
awesome job bro, no errors!
02/25/2010 21:35 NukingFuts#4
well done mate :) keep up da good work
02/25/2010 22:57 pro4never#5
Good job, nice to see things being transferred over to a source ppl will actually bother with.
02/25/2010 23:17 walmartboi#6
Quote:
Originally Posted by pro4never View Post
Good job, nice to see things being transferred over to a source ppl will actually bother with.
Thanks, you mind adding a link to this on your original thread?
02/25/2010 23:21 killerbee#7
this line is throwing an error on my console when my char or a guard kills mobs:

double cpMobDropRate = (Convert.ToDouble(MobTarget.Level) / Convert.ToDouble(Char.Level)) * cpDroprate;

my console says=> System.NullReferenceException: Object reference not set to an instance of an object.
02/26/2010 00:37 Arcо#8
Nice work mate.
02/26/2010 06:17 walmartboi#9
Quote:
Originally Posted by killerbee View Post
this line is throwing an error on my console when my char or a guard kills mobs:

double cpMobDropRate = (Convert.ToDouble(MobTarget.Level) / Convert.ToDouble(Char.Level)) * cpDroprate;

my console says=> System.NullReferenceException: Object reference not set to an instance of an object.
Try replacing that line with this:

Code:
double dub = (Convert.ToDouble(MobTarget.Level) / Convert.ToDouble(Char.Level));
double cpMobDropRate = (dub * cpDroprate);
And tell me if that works :)
02/27/2010 00:00 killerbee#10
Quote:
Originally Posted by walmartboi View Post
Try replacing that line with this:

Code:
double dub = (Convert.ToDouble(MobTarget.Level) / Convert.ToDouble(Char.Level));
double cpMobDropRate = (dub * cpDroprate);
And tell me if that works :)
doesnt work.
02/27/2010 04:07 walmartboi#11
Quote:
Originally Posted by killerbee View Post
doesnt work.
Well that's strange, it works perfectly for me, and apparently everyone else that has posted here. :confused:
02/27/2010 04:10 Arcо#12
@killer
More than likely you are pasting it wrong.
02/27/2010 04:14 walmartboi#13
Quote:
Originally Posted by .Arco View Post
@killer
More than likely you are pasting it wrong.
Yeah, if he left out the ChanceSuccess part it would cause the NullException error.
02/28/2010 03:02 pro4never#14
Quote:
Originally Posted by walmartboi View Post
Thanks, you mind adding a link to this on your original thread?
Done


Always appreciate things that mean I don't have to go anywhere near lotf.
02/28/2010 03:04 walmartboi#15
Quote:
Originally Posted by pro4never View Post
Done


Always appreciate things that mean I don't have to go anywhere near lotf.
<sarcasm>LOTF is the best</end sarcasm> :rolleyes: