|
You last visited: Today at 21:16
Advertisement
[Question] about the mount/movement
Discussion on [Question] about the mount/movement within the CO2 Private Server forum part of the Conquer Online 2 category.
07/14/2013, 08:49
|
#1
|
elite*gold: 0
Join Date: Oct 2007
Posts: 21
Received Thanks: 0
|
[help] about the mount/movement
this is the video
this is my char/entity.cs
Code:
public bool Move(Enums.ConquerAngle Direction)
{
ushort _X = X, _Y = Y;
Facing = Direction;
sbyte xi = 0, yi = 0;
switch (Direction)
{
case Enums.ConquerAngle.North: xi = -1; yi = -1; break;
case Enums.ConquerAngle.South: xi = 1; yi = 1; break;
case Enums.ConquerAngle.East: xi = 1; yi = -1; break;
case Enums.ConquerAngle.West: xi = -1; yi = 1; break;
case Enums.ConquerAngle.NorthWest: xi = -1; break;
case Enums.ConquerAngle.SouthWest: yi = 1; break;
case Enums.ConquerAngle.NorthEast: yi = -1; break;
case Enums.ConquerAngle.SouthEast: xi = 1; break;
}
_X = (ushort)(X + xi);
_Y = (ushort)(Y + yi);
Game.Map Map = null;
if (ServerBase.Kernel.Maps.TryGetValue(MapID, out Map))
{
if (Map.Floor[_X, _Y, MapObjType, this])
{
if (MapObjType == MapObjectType.Monster)
{
Map.Floor[_X, _Y, MapObjType, this] = false;
Map.Floor[X, Y, MapObjType, this] = true;
}
X = _X;
Y = _Y;
return true;
}
else
{
if (Mode == Enums.Mode.None)
{
if (EntityFlag != EntityFlag.Monster)
Teleport(MapID, X, Y);
else
return false;
}
}
}
else
{
if (EntityFlag != EntityFlag.Monster)
Teleport(MapID, X, Y);
else
return false;
}
return true;
}
This is my Packet
Code:
static void PlayerGroundMovment(GroundMovement groundMovement, Client.GameState client)
if (client.Entity.ContainsFlag(Update.Flags.Ride))
client.Entity.Vigor -= 1;
// client.Entity.PX = client.Entity.X;
//client.Entity.PY = client.Entity.Y;*/
if (groundMovement.Direction > Enums.ConquerAngle.South)
{
groundMovement.Direction = (JudeProject.Game.Enums.ConquerAngle)((byte)groundMovement.Direction % 8);
}
client.Entity.Move(groundMovement.Direction);
if (groundMovement.GroundMovementType == 9)
{
client.Entity.Move(groundMovement.Direction);
}
client.SendScreen(groundMovement, true);
client.Screen.Reload(groundMovement);
My Groundmovement
Code:
namespace JudeProject.Network.GamePackets
{
using JudeProject;
using JudeProject.Client;
using JudeProject.Game;
using JudeProject.Interfaces;
using JudeProject.Network;
using System;
public class GroundMovement : Writer, IPacket
{
private byte[] Buffer;
public const uint Run = 1;
public const uint TwoCoordonates = 9;
public const uint Walk = 0;
public GroundMovement(bool CreateInstance)
{
if (CreateInstance)
{
this.Buffer = new byte[32];
Writer.WriteUInt32(24, 0, this.Buffer);
Writer.WriteUInt32(10005, 2, this.Buffer);
}
}
public void Deserialize(byte[] buffer)
{
this.Buffer = buffer;
}
public void Send(GameState client)
{
client.Send(this.Buffer);
}
public byte[] ToArray()
{
return this.Buffer;
}
public Enums.ConquerAngle Direction
{
get
{
return (Enums.ConquerAngle)((byte)(this.Buffer[4] % 8));
}
set
{
this.Buffer[4] = (byte)value;
}
}
public uint GroundMovementType
{
get
{
return JudeProject.BitConverter.ToUInt32(this.Buffer, 12);
}
set
{
Writer.WriteUInt32(value, 12, this.Buffer);
}
}
public uint MapID
{
get
{
return JudeProject.BitConverter.ToUInt32(this.Buffer, 20);
}
set
{
Writer.WriteUInt32(value, 20, this.Buffer);
}
}
public uint TimeStamp
{
get
{
return JudeProject.BitConverter.ToUInt32(this.Buffer, 0x10);
}
set
{
Writer.WriteUInt32(value, 0x10, this.Buffer);
}
}
public uint UID
{
get
{
return JudeProject.BitConverter.ToUInt32(this.Buffer, 8);
}
set
{
Writer.WriteUInt32(value, 8, this.Buffer);
}
}
}
}
my movement angle
Code:
public enum ConquerAngle : byte
{
East = 5,
North = 3,
NorthEast = 4,
NorthWest = 2,
South = 7,
SouthEast = 6,
SouthWest = 0,
West = 1
}
how do i fix my walking problem? does anyone know how? thanks
my bad for duplicating threads.
|
|
|
07/14/2013, 09:40
|
#2
|
elite*gold: 21
Join Date: Jul 2005
Posts: 9,193
Received Thanks: 5,380
|
Your walk code is incorrect for steed mode.
Code:
dir = (int) receive.Direction % 24;
newX = user.X + Common.DeltaMountX[dir];
newY = user.Y + Common.DeltaMountY[dir];
Where delta mount x/y are
Code:
DeltaMountX = new sbyte[] { 0, -2, -2, -2, 0, 2, 2, 2, 1, 0, -2, 0, 1, 0, 2, 0, 0, -2, 0, -1, 0, 2, 0, 1, 0 };
DeltaMountY = new sbyte[] { 2, 2, 0, -2, -2, -2, 0, 2, 2, 0, -1, 0, -2, 0, 1, 0, 0, 1, 0, -2, 0, -1, 0, 2, 0 };
|
|
|
07/15/2013, 06:57
|
#3
|
elite*gold: 0
Join Date: Oct 2007
Posts: 21
Received Thanks: 0
|
Quote:
Originally Posted by pro4never
Your walk code is incorrect for steed mode.
Code:
dir = (int) receive.Direction % 24;
newX = user.X + Common.DeltaMountX[dir];
newY = user.Y + Common.DeltaMountY[dir];
Where delta mount x/y are
Code:
DeltaMountX = new sbyte[] { 0, -2, -2, -2, 0, 2, 2, 2, 1, 0, -2, 0, 1, 0, 2, 0, 0, -2, 0, -1, 0, 2, 0, 1, 0 };
DeltaMountY = new sbyte[] { 2, 2, 0, -2, -2, -2, 0, 2, 2, 0, -1, 0, -2, 0, 1, 0, 0, 1, 0, -2, 0, -1, 0, 2, 0 };
|
would you mind telling me in what file should i change it?
|
|
|
07/15/2013, 07:35
|
#4
|
elite*gold: 21
Join Date: Jul 2005
Posts: 9,193
Received Thanks: 5,380
|
I explained one way to handle walking. You need to re-write your walking handler to behave in a similar fashion.
|
|
|
07/15/2013, 08:16
|
#5
|
elite*gold: 12
Join Date: Jul 2011
Posts: 8,283
Received Thanks: 4,192
|
It might not help with your case, but it might help the majority of members wondering where Chris's logic comes from. Below was the diagram I created to figure it out (back in the day). It might also help the next person who wants to help you locate where the code is in your source to change. Cheers.
|
|
|
07/15/2013, 08:18
|
#6
|
elite*gold: 0
Join Date: Oct 2007
Posts: 21
Received Thanks: 0
|
Quote:
Originally Posted by pro4never
I explained one way to handle walking. You need to re-write your walking handler to behave in a similar fashion.
|
is this right sir pro?
Code:
using System;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace JudeProject.Game
{
public class Misc
{
public static bool ChanceSuccess(double percent)
{
return ((percent * 10000.0) >= Program.Random.Next(0xf4240));
}
private static sbyte[] _walkXCoords = new sbyte[8] { 0, -1, -1, -1, 0, 1, 1, 1 };
private static sbyte[] _walkYCoords = new sbyte[8] { 1, 1, 0, -1, -1, -1, 0, 1 };
private static sbyte[] _rideXCoords = new sbyte[24] { 0, -2, -2, -2, 0, 2, 2, 2, -1, -2, -2, -1, 1, 2, 2, 1, -1, -2, -2, -1, 1, 2, 2, 1 };
private static sbyte[] _rideYCoords = new sbyte[24] { 2, 2, 0, -2, -2, -2, 0, 2, 2, 1, -1, -2, -2, -1, 1, 2, 2, 1, -1, -2, -2, -1, 1, 2 };
static Misc()
{
}
public static int JumpSpeed(int distance, ushort movespeed = (ushort) 400)
{
return (int)Math.Floor((double)movespeed * Math.Floor((double)distance / 10.0));
}
public static int Distance(ushort x, ushort y, ushort x2, ushort y2)
{
return Math.Max(Math.Abs((int)x - (int)x2), Math.Abs((int)y - (int)y2));
}
public static byte Angle(ushort x, ushort y, ushort x2, ushort y2)
{
return (byte)((uint)(byte)(7.0 - Math.Floor(Misc.PointDirecton((double)x, (double)y, (double)x2, (double)y2) / 45.0 % 8.0) - 1.0) % 8U);
}
public static double PointDirecton(double x1, double y1, double x2, double y2)
{
double x = x2 - x1;
double num = Math.Atan2(y2 - y1, x);
if (num < 0.0)
num += 2.0 * Math.PI;
return Math.Ceiling(360.0 - num * 180.0 / Math.PI);
}
public static void IncXY(byte Facing, ref ushort x, ref ushort y, bool Riding = false)
{
sbyte num1;
sbyte num2;
if (!Riding)
{
num1 = Misc._walkXCoords[(int)Facing % 8];
num2 = Misc._walkYCoords[(int)Facing % 8];
}
else
{
num1 = Misc._rideXCoords[(int)Facing % 24];
num2 = Misc._rideYCoords[(int)Facing % 24];
}
x = (ushort)((uint)x + (uint)num1);
y = (ushort)((uint)y + (uint)num2);
}
}
}
|
|
|
07/15/2013, 08:18
|
#7
|
elite*gold: 21
Join Date: Jul 2005
Posts: 9,193
Received Thanks: 5,380
|
Quote:
Originally Posted by Fаng
Old reference I made a year ago:
|
good reference to have as I feel like I copied my post out of an incomplete/old source that has some wrong values ahaha.
|
|
|
07/16/2013, 01:29
|
#8
|
elite*gold: 0
Join Date: Oct 2007
Posts: 21
Received Thanks: 0
|
Quote:
Originally Posted by pro4never
good reference to have as I feel like I copied my post out of an incomplete/old source that has some wrong values ahaha.
|
Code:
using System;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace JudeProject.Game
{
public class Misc
{
public static bool ChanceSuccess(double percent)
{
return ((percent * 10000.0) >= Program.Random.Next(0xf4240));
}
private static sbyte[] _walkXCoords = new sbyte[8] { 0, -1, -1, -1, 0, 1, 1, 1 };
private static sbyte[] _walkYCoords = new sbyte[8] { 1, 1, 0, -1, -1, -1, 0, 1 };
private static sbyte[] _rideXCoords = new sbyte[24] { 0, -2, -2, -2, 0, 2, 2, 2, -1, -2, -2, -1, 1, 2, 2, 1, -1, -2, -2, -1, 1, 2, 2, 1 };
private static sbyte[] _rideYCoords = new sbyte[24] { 2, 2, 0, -2, -2, -2, 0, 2, 2, 1, -1, -2, -2, -1, 1, 2, 2, 1, -1, -2, -2, -1, 1, 2 };
static Misc()
{
}
public static int JumpSpeed(int distance, ushort movespeed = (ushort) 400)
{
return (int)Math.Floor((double)movespeed * Math.Floor((double)distance / 10.0));
}
public static int Distance(ushort x, ushort y, ushort x2, ushort y2)
{
return Math.Max(Math.Abs((int)x - (int)x2), Math.Abs((int)y - (int)y2));
}
public static byte Angle(ushort x, ushort y, ushort x2, ushort y2)
{
return (byte)((uint)(byte)(7.0 - Math.Floor(Misc.PointDirecton((double)x, (double)y, (double)x2, (double)y2) / 45.0 % 8.0) - 1.0) % 8U);
}
public static double PointDirecton(double x1, double y1, double x2, double y2)
{
double x = x2 - x1;
double num = Math.Atan2(y2 - y1, x);
if (num < 0.0)
num += 2.0 * Math.PI;
return Math.Ceiling(360.0 - num * 180.0 / Math.PI);
}
public static void IncXY(byte Facing, ref ushort x, ref ushort y, bool Riding = false)
{
sbyte num1;
sbyte num2;
if (!Riding)
{
num1 = Misc._walkXCoords[(int)Facing % 8];
num2 = Misc._walkYCoords[(int)Facing % 8];
}
else
{
num1 = Misc._rideXCoords[(int)Facing % 24];
num2 = Misc._rideYCoords[(int)Facing % 24];
}
x = (ushort)((uint)x + (uint)num1);
y = (ushort)((uint)y + (uint)num2);
}
}
}
it still doesnt work..
|
|
|
07/27/2013, 18:29
|
#9
|
elite*gold: 0
Join Date: Oct 2007
Posts: 21
Received Thanks: 0
|
BUMP
|
|
|
08/09/2013, 06:45
|
#10
|
elite*gold: 0
Join Date: Oct 2007
Posts: 21
Received Thanks: 0
|
BUMP
|
|
|
08/09/2013, 08:25
|
#11
|
elite*gold: 12
Join Date: Jul 2011
Posts: 8,283
Received Thanks: 4,192
|
Quote:
Originally Posted by pounder
BUMP
|
Why exactly are you bumping this? All of the answers for how this feature works has been posted above. What exactly do you need that hasn't been posted already? You posted the implementation.
|
|
|
08/09/2013, 14:01
|
#12
|
elite*gold: 0
Join Date: Dec 2012
Posts: 1,761
Received Thanks: 950
|
Code:
/// <summary>
/// Handles the movement packet.
/// </summary>
/// <param name="client">The client.</param>
/// <param name="packet">The packet.</param>
public static void Handle(Entities.GameClient client, DataPacket packet)
{
client.Action = Enums.ActionType.None;
client.AttackPacket = null;
client.LastMoveJump = false;
using (var move = new MovementPacket(packet))
{
if (move.EntityUID != client.EntityUID)
return;
int NewX = 0, NewY = 0;
int NewDir = 0;
switch (move.WalkMode)
{
case Enums.WalkMode.Run:
case Enums.WalkMode.Walk:
{
NewDir = (int)move.Direction % 8;
NewX = client.X + DeltaX[NewDir];
NewY = client.Y + DeltaY[NewDir];
break;
}
case Enums.WalkMode.Mount:
{
NewDir = (int)move.Direction % 24;
NewX = client.X + DeltaMountX[NewDir];
NewY = client.Y + DeltaMountY[NewDir];
break;
}
}
if (client.Map.ValidCoord(NewX, NewY))
{
client.LastMovement = DateTime.Now;
client.X = (ushort)NewX;
client.Y = (ushort)NewY;
client.Direction = (byte)NewDir;
client.SendToScreen(move, true);
}
}
}
|
|
|
 |
Similar Threads
|
[Question] how to make/add sql for mount/pet
10/16/2012 - Eudemons Online - 1 Replies
How to make/add sql for mount/pet? i already have data for client but dont have sql.. what i need is sql mount frog.. anyone can teach me please :(
|
please help Question bout mount
08/05/2012 - EO PServer Hosting - 0 Replies
when on my mount i use Exp skill or other skill and it kicks me off my mount i have seen this on elitepvpers some where but i cannot find it ive justed searched Releases and hosting cant find anything :/ please can some one point me in the right direction , im sure its in cq_config ... but not sure what to edit
|
Dalaran Sewer Mount arena (Aq 40 opening mount)
02/09/2009 - WoW Exploits, Hacks, Tools & Macros - 14 Replies
Well, you cant use any mounts in dalaran arena, except Black Qiraji Resonating Crystal. I know not much people have it, but still it is not intended to be able to mount in this arena, so i posted it there) Btw, you still can get the Scarab Lord title and mount, there are several servers, where gates are not open yet, all new servers where transfer is closed for first 3 months have their gates closed, so you can make the scepter on your server and then transfer to another server with closed...
|
All times are GMT +1. The time now is 21:18.
|
|