Zenith Sword code

Both the projectile and item ids can be found on the wiki page at the bottom of the box everything has on the far right.
Alright: The item.cs load code looks like this:
useStyle = 1;
width = 24;
height = 24;
UseSound = SoundID.Item169;
autoReuse = true;
melee = true;
melee = true;
shoot = 933;
useAnimation = 30;
useTime = useAnimation / 3;
shootSpeed = 16f;
damage = 190;
knockBack = 6.5f;
value = sellPrice(0, 20);
crit = 10;
rare = 10;
noUseGraphic = true;
noMelee = true;
break;
You probably got that easy enough

It also has this line:
case 4956:
return new Color(255, 255, 255, newColor.A - alpha);
In GetAlpha() for whatever.

The projectile side is more important, in Projectile.cs the load code is:
width = 32;
height = 32;
aiStyle = 182;
friendly = true;
melee = true;
tileCollide = false;
ignoreWater = true;
alpha = 255;
extraUpdates = 1;
usesLocalNPCImmunity = true;
manualDirectionChange = true;
localNPCHitCooldown = 15;
penetrate = -1;
noEnchantmentVisuals = true;

and in Colliding():
if (type == 933)
{
float collisionPoint = 0f;
float scaleFactor = 40f;
for (int i = 14; i < oldPos.Length; i += 15)
{
float num2 = localAI[0] - (float)i;
if (!(num2 < 0f) && !(num2 > 60f))
{
Vector2 value2 = oldPos + base.Size / 2f;
Vector2 value3 = (oldRot + (float)Math.PI / 2f).ToRotationVector2();
_lanceHitboxBounds.X = (int)value2.X - _lanceHitboxBounds.Width / 2;
_lanceHitboxBounds.Y = (int)value2.Y - _lanceHitboxBounds.Height / 2;
if (_lanceHitboxBounds.Intersects(targetRect) && Collision.CheckAABBvLineCollision(targetRect.TopLeft(), targetRect.Size(), value2 - value3 * scaleFactor, value2 + value3 * scaleFactor, 20f, ref collisionPoint))
{
return true;
}
}
}
Vector2 value4 = (rotation + (float)Math.PI / 2f).ToRotationVector2();
_lanceHitboxBounds.X = (int)position.X - _lanceHitboxBounds.Width / 2;
_lanceHitboxBounds.Y = (int)position.Y - _lanceHitboxBounds.Height / 2;
if (_lanceHitboxBounds.Intersects(targetRect) && Collision.CheckAABBvLineCollision(targetRect.TopLeft(), targetRect.Size(), base.Center - value4 * scaleFactor, base.Center + value4 * scaleFactor, 20f, ref collisionPoint))
{
return true;
}
return false;
}


It returns at the beggining at UpdatePosition, It'll probably do that manually in the ai code, unsurprising due to its movement
In GetAlpha()
if (type == 933)
{
newColor = Color.White * Opacity;
}








And the code that was giving you the run around is in Player.cs within the ItemCheck_Shoot() function

int num158 = (itemAnimationMax - itemAnimation) / itemTime;
Vector2 vector30 = new Vector2(num2, num3);
int num159 = FinalFractalHelper.GetRandomProfileIndex();
if (num158 == 0)
{
num159 = 4956;
}
Vector2 pointPoisition4 = Main.MouseWorld;
LimitPointToPlayerReachableArea(ref pointPoisition4);
Vector2 value14 = pointPoisition4 - MountedCenter;
if (num158 == 1 || num158 == 2)
{
int npcTargetIndex;
bool zenithTarget = GetZenithTarget(pointPoisition4, 400f, out npcTargetIndex);
if (zenithTarget)
{
value14 = Main.npc[npcTargetIndex].Center - MountedCenter;
}
bool flag5 = num158 == 2;
if (num158 == 1 && !zenithTarget)
{
flag5 = true;
}
if (flag5)
{
value14 += Main.rand.NextVector2Circular(150f, 150f);
}
}
vector30 = value14 / 2f;
float ai5 = Main.rand.Next(-100, 101);
Projectile.NewProjectile(projectileSource_Item_WithPotentialAmmo, pointPoisition, vector30, projToShoot, Damage, KnockBack, i, ai5, num159);



Everything I found was just by ctrl-f searching for the internal item and projectile IDs, these are the results from the main 3 classes in charge of this stuff Player.cs, Item.cs and Projectile.cs, final piece of code is probably the code you were looking for, I'd try messing that around within the ModItem's Shoot function


*Fun note,
FinalFractalHelper.GetRandomProfileIndex();
is a cool little egg from the final fractal, wasn't expecting that.
 
Back
Top