-
Member
[C#] CustomClass
Hi,
some months ago, i found a half working source code of a bot, here somewhere.
I decided to take some code pieces as base for my bot (my first big project) and everything went fine.
One of the last things I have to implement now is the possibility to let the user create his own fighting routines and to save, load and modify them. And after some more days of searching for a entry point to this topic i found some "golden threads" but no point where i can say: thats my beginning.
with other words: i have some questions
1.
now i solved the routines in a fighting class. It looks something like this:
Code:
internal static void FightMode(UnitObject pullMob)
{
if (Program.runMainTread2)
{
PrePull();
Pull(pullMob);
Fight(pullMob);
LootClosest();
Rest();
}
}
internal static void Pull(UnitObject mob)
{
ranged.Cast(mob);
}
internal static void Fight(UnitObject mob)
{
while (Internal.timeToFight)
{
if (Internal.playerIsCritLow)
{
critLowHealthAction.Cast(mob);
}
if (Internal.playerIsLowHP)
{
lowHealthAction.CastBuff();
}
if (Internal.playerIsDead) return;
if (Internal.playerHaveAdds) {
HandleAdds(mob);
}
if (Internal.isInMeleeRange)
{
if (ObjectManager.GetComboPoints() >= 2 && mob.health > 60) {
Spell3.Cast(mob);
}
if (ObjectManager.GetComboPoints() >= 3) {
Eviscerate.Cast(mob);
}
SinisterStrike.Cast(mob);
}
}
}
internal static void Rest()
{
EatAndDrink();
}
Now my Question: is there a possibility in c# to generate and compile dynamically code in runtime or do i have to learn skripting languages?
If I have to learn skripting languages, can you give me a entry point for my terms?
If it is possible to solve this in c#, i would prefer that. At least in theory I know how to use XML in C#. So the "save and load"-part can be done...but the rest stays a big questionmark for me and i dont know where i should start my learning process. Even some key words would be enough i think 
Greetings,
Your wood and grassland programmer,
pabloxxx
-
Hey mate,
what you are looking for is called CodeDom. I utilised this in an old bot project I released a while ago:
http://www.ownedcore.com/forums/worl...ml#post3271873 (/ [Bot] 1.12.1 WoW Bot Source Code)
Check my blog: https://zzuks.blogspot.com
-
Post Thanks / Like - 1 Thanks
pabloxxx (1 members gave Thanks to Corthezz for this useful post)
-
Now my Question: is there a possibility in c# to generate and compile dynamically code in runtime or do i have to learn skripting languages?
Yes you can generate and compile code dynamically with C# and it's surprisingly simple. My best suggestion to keep it clean though is to use interfaces for this.
Check out this for an example - https://github.com/unknowndev/CoolFi...h/PluginSystem
In the manager, it loads all assemblies with in the app folder or domain that implement the IPlugin interface.
You can also look at a fully working example of dynamically running new code on the fly at any point, here:
https://github.com/aganonki/Internal...er/Compiler.cs
-
Post Thanks / Like - 1 Thanks
pabloxxx (1 members gave Thanks to lolp1 for this useful post)
-
Member
wow cool!
great thanks mates! this helps a lot
@corthezz:
yah...this is the code i used and got my injection parts. Now your CC-Part is making sence :]
thanks for your code!
@lolp1:
good complement! Thanks
cheers :]