My goal in this very small project was to create something that can be customized easily by server owners to allow for a more fair auto cp system.
The calculations WORK but they are not exactly set in stone, that's why I've made them so easy to edit to suit your server (not all servers need thousands of cps earnable in 5 minutes while others do, depends on your economy)
<edit>
Here's a link to the 5165 version: Full credit to walmartboi for converting it
This is for CoEmu but can be easily modified for use in an source. The principles are very basic and it's nothing complex by any means. Took all of like 5 minutes to code really
Code:
#region CpRates 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 #endregion double cpMobDropRate = (Convert.ToDouble(AttackedMob.Level) / Convert.ToDouble(CSocket.Client.Level)) * cpDroprate; if (Calculation.PercentSuccess(cpMobDropRate)) { int cpBaseReward = Nano.Rand.Next(cpLow, cpHigh); int cpToAdd = cpBaseReward * cpMultiplyer; CSocket.Client.CPs += cpToAdd; CSocket.Send(ConquerPacket.Status(CSocket, 2, CSocket.Client.CPs, Struct.StatusTypes.InvCPoints)); Database.Database.SaveCharacter(CSocket.Client); CSocket.Send(ConquerPacket.Chat(0, "SYSTEM", CSocket.Client.Name, "[CPs] You have gained: " + cpToAdd + " CPs for killing a(n) " + AttackedMob.Info.Name , Struct.ChatType.Top)); }
Drop AMOUNT is a random number between min/max drop rate multiplied by the server cp multiplier (could add more randomness ot he script by having the multiplier based on mob/player level and or random roll)
Install instructions!
doMonsterPlayer.cs search AttackedMob.Die(CSocket.Client.ID); and paste this code directly underneath. Nothing else should be required (make sure your SaveCharacter database void saves cp or this will not save properly. If you want, it would help to write a new database void for cp saving so you don't have to save the entire character every time you gain cp... redundant and resource consuming.
Please post any questions, problems or improvements to the script. This is not designed to be the ULTIMATE script, it's simply to help people think a bit more when implementing these systems. You could go a long way with this sort of thing (adding in different rates for lucky time, 2nd reborn, vip. Doing more complex calculations, etc) but this should point some ppl in the right direction.
Enjoy!
p4n