-
Member
Anyone knows how to transform a world position into screen position?
-
Active Member
I have edited code in my previous post. Check it out. Regarding screen position here is the code
Code:
Vec3 diff = pos - player_pos;
float w = -0.515f * diff.X + -0.514f * diff.Y + -0.686f * diff.Z + 97.985f;
float X = (-1.682f * diff.X + 1.683f * diff.Y + 0 * diff.Z + 7.045e-3f) / w;
float Y = (-1.54f * diff.X + -1.539f * diff.Y + 2.307f * diff.Z + 6.161f) / w;
float Z = (-0.515f * diff.X + -0.514f * diff.Y + -0.686f * diff.Z + 97.002f) / w;
X = (X + 1) / 2 * Constants.SCREEN_SIZE[0];
Y = (1 - Y) / 2 * Constants.SCREEN_SIZE[1];
return new Point((int)X + Constants.BORDER_WIDTH, (int)Y + Constants.TITLE_HEIGHT);
this assumes windowed mode and
Code:
public static readonly int[] SCREEN_SIZE = { 800, 600 };
public const int BORDER_WIDTH = 8;
public const int TITLE_HEIGHT = 30;
-
Post Thanks / Like - 2 Thanks
HI5,
betenner (2 members gave Thanks to CrEEzz for this useful post)
-
Member
Originally Posted by
CrEEzz
I have edited code in my previous post. Check it out. Regarding screen position here is the code
Code:
Vec3 diff = pos - player_pos;
float w = -0.515f * diff.X + -0.514f * diff.Y + -0.686f * diff.Z + 97.985f;
float X = (-1.682f * diff.X + 1.683f * diff.Y + 0 * diff.Z + 7.045e-3f) / w;
float Y = (-1.54f * diff.X + -1.539f * diff.Y + 2.307f * diff.Z + 6.161f) / w;
float Z = (-0.515f * diff.X + -0.514f * diff.Y + -0.686f * diff.Z + 97.002f) / w;
X = (X + 1) / 2 * Constants.SCREEN_SIZE[0];
Y = (1 - Y) / 2 * Constants.SCREEN_SIZE[1];
return new Point((int)X + Constants.BORDER_WIDTH, (int)Y + Constants.TITLE_HEIGHT);
this assumes windowed mode and
Code:
public static readonly int[] SCREEN_SIZE = { 800, 600 };
public const int BORDER_WIDTH = 8;
public const int TITLE_HEIGHT = 30;
Thank you very much! How did you know so much~
-
Member
I've tested your code. But the coords doesn't seem right. I have a fullscreen canvas (same size with D3 window). I want to show a certain ACD on this canvas. I used your code to calclate the coords but not right. (I used the canvas's width and height)
What should I do to show the ACD at correct location on the canvas?
-
Active Member
Originally Posted by
raler
Code:
public static Point FromD3toScreenCoords(Vector3 objectGameLocation)
{
Vector3 currentCharGameLoc = Game.Me.Location;
double xd = objectGameLocation.X - currentCharGameLoc.X;
double yd = objectGameLocation.Y - currentCharGameLoc.Y;
double zd = objectGameLocation.Z - currentCharGameLoc.Z;
double w = -0.515 * xd + -0.514 * yd + -0.686 * zd + 97.985;
double X = (-1.682 * xd + 1.683 * yd + 0 * zd + 7.045e-3) / w;
double Y = (-1.54 * xd + -1.539 * yd + 2.307 * zd + 6.161) / w;
double width = Engine.Current.VideoPreferences.x0C_DisplayMode.x20_Width;
double height = Engine.Current.VideoPreferences.x0C_DisplayMode.x24_Height;
double aspectChange = (double)((double)width / (double)height) / (double)(4.0f / 3.0f); // 4:3 = default aspect ratio
X /= aspectChange;
float rX = (float)((X + 1) / 2 * width);
float rY = (float)((1 - Y) / 2 * height);
return new Point((int)rX, (int)rY);
}
Try this. Its more universal case code.
-
Post Thanks / Like - 1 Thanks
betenner (1 members gave Thanks to CrEEzz for this useful post)
-
Member
Originally Posted by
CrEEzz
Try this. Its more universal case code.
Thanks! It works!
-
Member
One more question, how can I get players' name (the names that shows on the party panel), and if I already got one player's character acd, how can I know which player it belongs to? More specificly, how to get a PlayerData from a certain ACD (or actor)?
Last edited by betenner; 10-25-2015 at 12:10 AM.
-
Member
I just figured out all monster affixes for the current version, I'll post them here in case anyone needs:
Code:
public enum MonsterAffix
{
None = 0,
ArcaneEnchanted = -1669589516,
Avenger = 1165197192,
Electrified = -1752429632,
ExtraHealth = -1512481702,
Frozen = -163836908,
Fast = 3775118,
FireChains = -439707236,
FrozenPulse = 1886876669,
HealthLink = 1799201764,
Horde = 127452338,
Illusionist = 394214687,
Jailer = -27686857,
Knockback = -2088540441,
Minion = 99383434,
Molten = 106438735,
Mortar = 106654229,
Nightmarish = -1245918914,
Orbiter = 1905614711,
Plagued = -1333953694,
PoisonEnchanted = 1929212066,
Profane = -121983956,
ProjectileRestrain = -1412750743,
ReflectsDamage = -1374592233,
Shield = -725865705,
Teleport = -507706394,
Thunderstorm = -50556465,
Vampiric = 395423867,
Vortex = 458872904,
Waller = 481181063,
WormHole = 1156956365,
}
-
Active Member
I found an infinite loop while getting an attribute value from ACD (which is most probably not existing anymore). Code is stuck on infinite loop in Map<int,Enigma.D3.AttributeValue>.TryGetValue. When I stop my thread I always get smth like:
Code:
Enigma.Memory.dll!Enigma.Memory.ProcessMemoryReader.UnsafeReadBytes(Enigma.Memory.MemoryAddress address, byte[] buffer, int offset, int count) Line 50 + 0x35 bytes C#
Enigma.Memory.dll!Enigma.Memory.MemoryReader.Read<int>(Enigma.Memory.MemoryAddress address) Line 65 C#
Enigma.Memory.dll!Enigma.Memory.MemoryReader.ReadMemoryAddress(Enigma.Memory.MemoryAddress address) Line 197 + 0xc bytes C#
Enigma.Memory.dll!Enigma.Memory.MemoryObject.ReadMemoryAddress(int offset) Line 147 + 0x33 bytes C#
Enigma.Memory.dll!Enigma.Memory.MemoryObject.ReadPointer<Enigma.D3.Collections.Map<int,Enigma.D3.AttributeValue>.Entry>(int offset) Line 115 + 0x17 bytes C#
Enigma.Memory.dll!Enigma.Memory.MemoryObject.Dereference<Enigma.D3.Collections.Map<int,Enigma.D3.AttributeValue>.Entry>(int offset) Line 131 + 0x30 bytes C#
Enigma.D3.Memory.dll!Enigma.D3.Collections.Map<int,Enigma.D3.AttributeValue>.Entry.x00_Next.get() + 0x2b bytes
Enigma.D3.Memory.dll!Enigma.D3.Collections.Map<int,Enigma.D3.AttributeValue>.TryGetValue(int key, out Enigma.D3.AttributeValue value, System.Func<int,uint> hasher) + 0x12e bytes
Enigma.D3.Memory.dll!Enigma.D3.Helpers.AttributeHelper.TryGetAttributeValue(Enigma.D3.ActorCommonData acd, Enigma.D3.Enums.AttributeId attribId, int modifier, out Enigma.D3.AttributeValue value) + 0xdb bytes
Enigma.D3.Memory.dll!Enigma.D3.Helpers.Attributes.SimpleAttribute<float>.GetValue(Enigma.D3.ActorCommonData acd, int modifier) + 0x48 bytes
Enigma.D3.Memory.dll!Enigma.D3.Helpers.Attribute<float>.GetValue(Enigma.D3.ActorCommonData acd) + 0x2a bytes
I guess there is no way to check if ACD is released. Could you add a fail safe counter inside TryGetValue? Maybe You have other idea?
-
-
Active Member
Yeah this might be a way. But after all I doubt any check before getting attribute value will be good enough as ACD may be released any time after check because we have no way of synchronizing operations on ACDs. Yeah I know we are ****ed xD
-
Active Member
Can someone supply me with snippet getting which elemental we get bonus to from Convention of Elements?
-
Active Member
guys can someone reupload last source code for me? I have blocked subversion website in work thanks
-
Active Member
Originally Posted by
BuloZB
guys can someone reupload last source code for me? I have blocked subversion website in work thanks

Probably too late but here's latest source https://www.dropbox.com/sh/6leby1sgp...q418MEEga?dl=0
-
Post Thanks / Like - 1 Thanks
BuloZB (1 members gave Thanks to CrEEzz for this useful post)
-
Active Member
I figured out CoE :P here is the snippet that I asked for:
Code:
private Buff GetBuff(SnoPower power)
{
try
{
return Engine.Current.BuffManager.x1C_Buffs.FirstOrDefault(x => x.x000_PowerSnoId == (int)power);
}
catch (Exception)
{
}
return null;
}
public enum ElementalType
{
Unknown = 0xFF,
Physical = 0x00,
Fire = 0x01,
Lightning = 0x02,
Cold = 0x03,
Poison = 0x04,
Arcane = 0x05,
Holy = 0x06,
}
private static ElementalType[] CoE_mapping = new ElementalType[] { ElementalType.Unknown,
ElementalType.Arcane,
ElementalType.Cold,
ElementalType.Fire,
ElementalType.Holy,
ElementalType.Lightning,
ElementalType.Physical,
ElementalType.Poison };
public ElementalType GetConventionOfElementsElemental()
{
if (m_PlayerAcd == null)
return ElementalType.Unknown;
try
{
// SnoPower.__Convention_Of_Elements == 0x69252
Buff b = GetBuff(SnoPower.__Convention_Of_Elements);
if (b != null)
return CoE_mapping[b.x004_Neg1];
}
catch (Exception)
{
}
return ElementalType.Unknown;
}
Last edited by CrEEzz; 11-23-2015 at 01:57 AM.
Reason: Fixed Arcane and Poison mapping