Register for your free account! | Forgot your password?

Go Back   elitepvpers > MMORPGs > Conquer Online 2 > CO2 Private Server > CO2 PServer Guides & Releases
You last visited: Today at 20:00

  • Please register to post and access all features, it's quick, easy and FREE!

Advertisement



[Impulse's source][Release]Part code for Duelist

Discussion on [Impulse's source][Release]Part code for Duelist within the CO2 PServer Guides & Releases forum part of the CO2 Private Server category.

Reply
 
Old   #1
 
elite*gold: 0
Join Date: May 2010
Posts: 298
Received Thanks: 57
[Impulse's source][Release]Part code for Duelist

Heres abit of code for Impulse's 5165 source recently released this is 25% of the code for AIDuelist
well I used a hashtable and added this into GameState.cs
Code:
 public void DuelistTest()
        {
            Game.Entity duelist = new Game.Entity(Game.EntityFlag.Bot);
            duelist.MapObjType = Game.MapObjectType.Bot;
            this.BotOwner = Entity;
            BotOwner = Entity;
            duelist.Name = Entity.Name + "[BOT]";
            duelist.X = Entity.X += 1;
            duelist.Y = Entity.Y += 1;
            duelist.Dodge = Entity.Dodge *= 2;
            duelist.Defence = Entity.Defence *= 2;
            duelist.MapID = Entity.MapID;
            duelist.Body = Entity.Body;
            duelist.Hitpoints = Entity.MaxHitpoints;
            duelist.Level = Entity.Level;
            duelist.Stamina = 250;
            duelist.Face = Entity.Face;
            duelist.Facing = Entity.Facing;
            duelist.HairColor = Entity.HairColor;
            duelist.HairStyle = Entity.HairStyle;
            duelist.Strength = 750;
            duelist.Agility = 750;
            duelist.Spirit = 750;
            duelist.Vitality = 750;
            duelist.Spouse = "TheServer";
            duelist.MinAttack = 500;
            duelist.MaxAttack = 3000;
            duelist.BaseMinAttack = 500;
            duelist.BaseMaxAttack = 3000;
            duelist.BaseMagicDefence = 300;
            duelist.BaseMagicAttack = 5000;
            duelist.Class = Entity.Class;
            duelist.ItemBless = Entity.ItemBless;
            duelist.ItemHP = Entity.ItemHP;
            duelist.ItemMP = Entity.ItemMP;
            duelist.PKMode = Game.Enums.PKMode.PK;
            // entity.UID = 400001;
            duelist.UID = (uint)ServerBase.Kernel.Random.Next(400000, 500000);
            ServerBase.Kernel.Bots.Add(duelist.UID, this);
            duelist.SendSpawn(this);
        }
        public void DuelistTestMove()
        {
            if (DateTime.Now > LastBotMove.AddMilliseconds(250))
            {
                LastBotMove = DateTime.Now;
                if (Game.Attacking.Calculate.PointDistance(BotOwner.X, BotOwner.Y, Entity.X, Entity.Y) >= 4)
                {
                    DuelistJumpAround();
                }
            }
        }
        void DuelistJumpAround()
        {
            BotOwner.X = (ushort)(Entity.X + ServerBase.Kernel.Random.Next(7) - ServerBase.Kernel.Random.Next(7));
            BotOwner.Y = (ushort)(Entity.Y + ServerBase.Kernel.Random.Next(7) - ServerBase.Kernel.Random.Next(7));
            BotOwner.Action = Game.Enums.ConquerAction.Jump;
        }
and these
Code:
        public static DateTime LastBotMove = DateTime.Now;
        public static DateTime LastBotAttack = DateTime.Now;
        public static bool BotInUse = false;
        public Game.Entity BotOwner;
in kernel.cs I made the top look like
Code:
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;
using System.Runtime.InteropServices;
and then added
Code:
public static Hashtable Bots = new Hashtable();
In program.cs I added
Code:
        static void BotThread_Execute()
        {
           
        }
and I added
Code:
ServerBase.Thread BotThread = new ServerBase.Thread(10);
                BotThread.Execute += new Action(BotThread_Execute);
and the
Code:
GC.KeepAlive(CharacterThread); GC.KeepAlive(FloorItems); GC.KeepAlive(StatusFlagChange);
I made look like
Code:
GC.KeepAlive(CharacterThread); GC.KeepAlive(FloorItems); GC.KeepAlive(StatusFlagChange); GC.KeepAlive(BotThread);
then added the command in packerhandler.cs
Code:
case "bot":
                                        {
                                            client.DuelistTest();
                                            break;
                                        }
About 25% done. OH I also find
Code:
public enum EntityFlag : byte
    {
and make it look like
Code:
        Player = 1,
        Monster = 2,
        Bot = 3
then find
Code:
 public enum MapObjectType
    {
and make it look like
Code:
    public enum MapObjectType
    {
        Npc, Item, Monster, Player, Nothing, InvalidCast, Bot
    }
again as I said 25% done. Wrote this thread kinda quickly p.s not tested jumping.
MonstersAbroad is offline  
Thanks
4 Users
Old 05/26/2010, 21:15   #2
 
BlueFlame11's Avatar
 
elite*gold: 0
Join Date: Apr 2010
Posts: 116
Received Thanks: 12
I already pressed thanks on the other thread so no need for it here =P
BlueFlame11 is offline  
Old 05/26/2010, 21:19   #3
 
elite*gold: 0
Join Date: May 2010
Posts: 298
Received Thanks: 57
Thanks, =P I do plan to complete this too
MonstersAbroad is offline  
Old 05/26/2010, 23:16   #4
 
CIRASH's Avatar
 
elite*gold: 0
Join Date: Jul 2008
Posts: 259
Received Thanks: 73
Isn't a dictionary better to use because hashtables have depreciated since .Net 2.0, right?
CIRASH is offline  
Old 05/26/2010, 23:24   #5
 
elite*gold: 20
Join Date: Jan 2008
Posts: 2,338
Received Thanks: 490
exactly
~Yuki~ is offline  
Old 05/27/2010, 00:06   #6
 
elite*gold: 21
Join Date: Jul 2005
Posts: 9,193
Received Thanks: 5,376
Quote:
Originally Posted by CIRASH View Post
Isn't a dictionary better to use because hashtables have depreciated since .Net 2.0, right?
Yah not sure why he switched to hashtable.. i mean the code i posted for it used dict... ahh well it's an easy change.
pro4never is offline  
Old 05/27/2010, 00:11   #7
 
hunterman01's Avatar
 
elite*gold: 20
Join Date: Dec 2006
Posts: 945
Received Thanks: 175
You have to admit though his coding skills have definatly improved
hunterman01 is offline  
Thanks
1 User
Old 05/27/2010, 17:17   #8
 
elite*gold: 0
Join Date: May 2010
Posts: 298
Received Thanks: 57
The hashtable for me atm is easyer but as said easy to change ill do that later for now its testing stage,
MonstersAbroad is offline  
Old 05/27/2010, 17:52   #9


 
Korvacs's Avatar
 
elite*gold: 20
Join Date: Mar 2006
Posts: 6,125
Received Thanks: 2,518
Quote:
Originally Posted by MonstersAbroad View Post
The hashtable for me atm is easyer but as said easy to change ill do that later for now its testing stage,
Using a hashtable will reduce performance drastically just so you know.
Korvacs is offline  
Thanks
1 User
Old 05/27/2010, 18:32   #10
 
elite*gold: 0
Join Date: May 2010
Posts: 298
Received Thanks: 57
I understand, I will change to a dict soon.
MonstersAbroad is offline  
Old 05/27/2010, 18:38   #11
 
xScott's Avatar
 
elite*gold: 0
Join Date: Nov 2009
Posts: 322
Received Thanks: 63
interesting :O i wanna see if i can attempt this using Elite-CoEmu, just the basics thou like spawning the bot.

Goodjob
xScott is offline  
Old 05/27/2010, 22:03   #12
 
elite*gold: 21
Join Date: Jul 2005
Posts: 9,193
Received Thanks: 5,376
Quote:
Originally Posted by xScott View Post
interesting :O i wanna see if i can attempt this using Elite-CoEmu, just the basics thou like spawning the bot.

Goodjob
Note that I already released almost full working code for EliteCoEmu (before I added actions/ai) but it spawns and everything else works properly.

Refer to my project thread... like 2-3 posts down.

<edit>

released the entire test source for simplicity sake

pro4never is offline  
Thanks
1 User
Reply


Similar Threads Similar Threads
[Release] Breeder NPC (Impulse's source)
07/25/2010 - CO2 PServer Guides & Releases - 4 Replies
Hello, I am very very pleased and proud of myself that I managed to do this FIRST time trying to send a packet via npc so I'm happy :) SPECIAL THANKS TO: .Arco's thread Breeder packet with NPC. That gave me the packet id's. all it is, is this npc in dialog.cs #region Breeder case 13118:
[Release] No whisper's command (Impulse's source)
07/23/2010 - CO2 PServer Guides & Releases - 2 Replies
Here. First define in entity.cs public bool nowhsp = false; then goto packethandler.cs and where whisper is handled make it this foreach (Client.GameState pClient in ServerBase.Kernel.GamePool.Values) {
[Release]Mount/Demound steed Impulse's source
05/25/2010 - CO2 PServer Guides & Releases - 13 Replies
Goto PacketHandler.cs and find #region Fastblade Under that whole region add #region RideSteed if (SpellID == 7001) { if (client.Spells.ContainsKey(SpellID))



All times are GMT +2. The time now is 20:00.


Powered by vBulletin®
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
SEO by vBSEO ©2011, Crawlability, Inc.
This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

Support | Contact Us | FAQ | Advertising | Privacy Policy | Terms of Service | Abuse
Copyright ©2024 elitepvpers All Rights Reserved.