private AbilityOutline CreateAbility(string name, byte ID, NetIncomingMessage inc) { var ability = new AbilityOutline(); ability.Username = name; ability.ID = ID; ability.Type = (AbilityOutline.AbilityType)inc.ReadByte(); ability.XPosition = inc.ReadInt16(); ability.YPosition = inc.ReadInt16(); ability.Direction = inc.ReadDouble(); ability.Damage = inc.ReadSByte(); return(ability); }
private void SendAbility(Server server, AbilityOutline ability, ManagerLogger managerLogger) { var outmsg = server.NetServer.CreateMessage(); outmsg.Write((byte)PacketType.AbilityUpdate); outmsg.Write(ability.Username); outmsg.Write(ability.ID); outmsg.Write(ability.XPosition); outmsg.Write(ability.YPosition); outmsg.Write(ability.Animation.XRecPos); outmsg.Write(ability.Animation.YRecPos); outmsg.Write(ability.Animation.Width); outmsg.Write(ability.Animation.Height); server.NetServer.SendToAll(outmsg, NetDeliveryMethod.ReliableOrdered); }
private void ReceiveAbilityCreate(NetIncomingMessage inc) { var name = inc.ReadString(); byte ID = inc.ReadByte(); if (!ServerAbilities.Any(a => a.ID == ID && a.Username == Username)) { var newAbility = new AbilityOutline(); newAbility.Username = name; newAbility.ID = ID; newAbility.Type = (AbilityOutline.AbilityType)inc.ReadByte(); newAbility.XPosition = inc.ReadInt16(); newAbility.YPosition = inc.ReadInt16(); newAbility.Direction = inc.ReadDouble(); newAbility.Damage = inc.ReadSByte(); ServerAbilities.Add(newAbility); } }
private void DrawAbility(SpriteBatch spriteBatch, AbilityOutline ability, Player.ClassType playerType) { Rectangle source = new Rectangle(ability.Animation.XRecPos, ability.Animation.YRecPos, ability.Animation.Width, ability.Animation.Height); switch (playerType) { case Player.ClassType.Wizard: if (ability.Type == AbilityOutline.AbilityType.Projectile) { spriteBatch.Draw(AssetManager.WizardWandProjectile, new Vector2(ability.XPosition, ability.YPosition), source, Color.White, (float)ability.Direction, Vector2.Zero, Game1.SCALE, SpriteEffects.None, 1.0f); spriteBatch.DrawString(AssetManager.CooldownFont, $"{ability.Username} - {ability.ID}", new Vector2(ability.XPosition, ability.YPosition + 5), Color.White); } else if (ability.Type == AbilityOutline.AbilityType.AbilityOne) { spriteBatch.Draw(AssetManager.WizardIceBlock, new Vector2(ability.XPosition, ability.YPosition), source, Color.White, 0.0f, Vector2.Zero, Game1.SCALE, SpriteEffects.None, 1.0f); } else if (ability.Type == AbilityOutline.AbilityType.AbilityTwo) { spriteBatch.Draw(AssetManager.WizardSpriteSheet, new Vector2(ability.XPosition, ability.YPosition), source, Color.White, 0.0f, Vector2.Zero, Game1.SCALE, SpriteEffects.None, 1.0f); } break; case Player.ClassType.Ogre: if (ability.Type == AbilityOutline.AbilityType.AbilityOne) { spriteBatch.Draw(AssetManager.groundSmashCrackle, new Vector2(ability.XPosition, ability.YPosition), source, Color.White, 0.0f, Vector2.Zero, Game1.SCALE, SpriteEffects.None, 1.0f); } else if (ability.Type == AbilityOutline.AbilityType.AbilityTwo) { } break; case Player.ClassType.Huntress: if (ability.Type == AbilityOutline.AbilityType.Projectile) { spriteBatch.Draw(AssetManager.HuntressArrow, new Vector2(ability.XPosition, ability.YPosition), source, Color.White, (float)ability.Direction, Vector2.Zero, Game1.SCALE, SpriteEffects.None, 1.0f); } if (ability.Type == AbilityOutline.AbilityType.AbilityOne) { spriteBatch.Draw(AssetManager.HuntressBoar, new Vector2(ability.XPosition, ability.YPosition), source, Color.White, 0.0f, Vector2.Zero, Game1.SCALE, SpriteEffects.None, 1.0f); } else if (ability.Type == AbilityOutline.AbilityType.AbilityTwo) { spriteBatch.Draw(AssetManager.HuntressBearTrap, new Vector2(ability.XPosition, ability.YPosition), source, Color.White, 0.0f, Vector2.Zero, Game1.SCALE, SpriteEffects.None, 1.0f); } break; case Player.ClassType.TimeTraveler: if (ability.Type == AbilityOutline.AbilityType.Projectile) { spriteBatch.Draw(AssetManager.WizardWandProjectile, new Vector2(ability.XPosition, ability.YPosition), source, Color.White, (float)ability.Direction, Vector2.Zero, Game1.SCALE, SpriteEffects.None, 1.0f); } if (ability.Type == AbilityOutline.AbilityType.AbilityOne) { } else if (ability.Type == AbilityOutline.AbilityType.AbilityTwo) { spriteBatch.Draw(AssetManager.TimeTravelerTimeZone, new Vector2(ability.XPosition, ability.YPosition), source, Color.White, 0.0f, Vector2.Zero, Game1.SCALE, SpriteEffects.None, 1.0f); } break; case Player.ClassType.Assassin: if (ability.Type == AbilityOutline.AbilityType.AbilityOne) { } else if (ability.Type == AbilityOutline.AbilityType.AbilityTwo) { } break; case Player.ClassType.Knight: if (ability.Type == AbilityOutline.AbilityType.AbilityOne) { } else if (ability.Type == AbilityOutline.AbilityType.AbilityTwo) { } break; } }