public CharStats(int level, int totalHP, int totalTP, int currentHP, int currentTP, int exp, int defense, int dmg, float dmgModifier, float chanceToHit, ICharacterClass charClass) { this.level = level; this.totalHP = totalHP; this.totalTP = totalTP; this.currentHP = currentHP; this.currentTP = currentTP; this.exp = exp; this.defense = defense; this.dmg = dmg; this.dmgModifier = dmgModifier; this.chanceToHit = chanceToHit; this.charClass = charClass; }
/// <summary> /// Called to promote a player /// </summary> /// <param name="player">the player to promote</param> /// <param name="classid">the new classid</param> /// <param name="messageToPlayer">the message for the player</param> /// <param name="gifts">Array of inventory items as promotion gifts</param> /// <returns>true if successfull</returns> public bool PromotePlayer(GamePlayer player, int classid, string messageToPlayer, InventoryItem[] gifts) { if (player == null) { return(false); } ICharacterClass oldClass = player.CharacterClass; // Player was promoted if (player.SetCharacterClass(classid)) { player.RemoveAllStyles(); if (messageToPlayer != "") { player.Out.SendMessage(LanguageMgr.GetTranslation(player.Client.Account.Language, "GameTrainer.PromotePlayer.Says", this.Name, messageToPlayer), eChatType.CT_System, eChatLoc.CL_PopupWindow); } player.Out.SendMessage(LanguageMgr.GetTranslation(player.Client.Account.Language, "GameTrainer.PromotePlayer.Upgraded", player.CharacterClass.Name), eChatType.CT_Important, eChatLoc.CL_SystemWindow); player.CharacterClass.OnLevelUp(player, player.Level); player.RefreshSpecDependantSkills(true); player.StartPowerRegeneration(); //player.Out.SendUpdatePlayerSpells(); player.Out.SendUpdatePlayerSkills(); player.Out.SendUpdatePlayer(); // Initiate equipment if (gifts != null && gifts.Length > 0) { for (int i = 0; i < gifts.Length; i++) { player.ReceiveItem(this, gifts[i]); } } // after gifts player.Out.SendMessage(LanguageMgr.GetTranslation(player.Client.Account.Language, "GameTrainer.PromotePlayer.Accepted", player.CharacterClass.Profession), eChatType.CT_Important, eChatLoc.CL_SystemWindow); Notify(GameTrainerEvent.PlayerPromoted, this, new PlayerPromotedEventArgs(player, oldClass)); player.SaveIntoDatabase(); return(true); } return(false); }
public Color GetColor(ICharacterClass characterClass) { switch (characterClass) { case Hoarder h: return(Color.LawnGreen); case Speedy s: return(Color.LightBlue); case Brute b: return(Color.DarkRed); case DefaultClass d: default: return(Color.Black); } }
public Stats(ICharacterClass clazz) { stats = new List <StatSet> { new StatSet { Key = "MaxHealth", Value = 0 }, new StatSet { Key = "CurrentHealth", Value = 0 }, new StatSet { Key = "MaxMagicPoints", Value = 0 }, new StatSet { Key = "CurrentMagicPoints", Value = 0 }, new StatSet { Key = "Attack", Value = 0 }, new StatSet { Key = "Magic", Value = 0 }, new StatSet { Key = "Defense", Value = 0 }, new StatSet { Key = "Velocity", Value = 0 }, new StatSet { Key = "XPToNextLevel", Value = 0 }, new StatSet { Key = "CurrentXP", Value = 0 }, new StatSet { Key = "Level", Value = 0 } }; this.clazz = clazz; UnityEngine.Debug.Log(clazz); this.clazz?.CalculateStats(1, this); }
public Player(string name, int positionX, int positionY, int points, ICharacterClass characterClass, Bottle bottle, PictureBox playerObject) { Name = name; PositionX = positionX; PositionY = positionY; Points = points; Bottle = bottle; this.PlayerObject = playerObject; this.CharacterClass = characterClass; Color = new PlayerColor(characterClass); //Gets stats from player characterClass PlayerStats stats = characterClass.GetStats(); HealthPoints = stats.HealthPoints; Damage = stats.Damage; Color2 = stats.Color; Speed = stats.Speed; PointsBoost = stats.PointsBoost; }
public static void TakeDamage(this ICharacterClass characterClass, float damage) { if (characterClass.CheckIfDead() == false) { if (characterClass.CheckIfContainsCondition <DamageReduction>()) { Debug.Log("Hitting player on Damage reduction"); } characterClass.SetCurrentHealth(characterClass.GetCurrentHealth() - damage); if (characterClass.CheckIfDead()) { if (OnPlayerDeath != null) { OnPlayerDeath.Invoke(characterClass); } } characterClass.GetStatusBarManager().PerformValueChangeTextEffectWithColor(damage, StateValueChangeAction.TakingDamage); } }
private void Awake() { playerTransform = GetComponentInParent <Transform>(); characterClass = GetComponentInParent <ICharacterClass>(); changeValueTextAnimator = GetComponentInChildren <Animator>(); }
public static string GetTooltip(ICharacterClass characterClass) { IPlayerClass asPlayerClass = characterClass as IPlayerClass; StringBuilder sb = new StringBuilder(50); if (!string.IsNullOrWhiteSpace(characterClass.Desc)) { sb.Append("\"").Append(characterClass.Desc).AppendLine("\""); } if (asPlayerClass != null) { if (asPlayerClass.WeaponProficiency != WeaponType.Invalid) { sb.AppendLine("Weapon Proficiencies: "); bool any = false; sb.Append(" "); foreach (WeaponType weaponType in Enum.GetValues(typeof(WeaponType))) { if (weaponType == WeaponType.Invalid) { continue; } if (asPlayerClass.WeaponProficiency.HasFlag(weaponType)) { if (any) { sb.Append(" | "); } any = true; sb.Append(weaponType); } } sb.AppendLine(); } if (asPlayerClass.ArmorProficiency != ArmorType.Invalid) { sb.AppendLine("Armor Proficiencies: "); bool any = false; sb.Append(" "); foreach (ArmorType armorType in Enum.GetValues(typeof(ArmorType))) { if (armorType == ArmorType.Invalid) { continue; } if (asPlayerClass.ArmorProficiency.HasFlag(armorType)) { if (any) { sb.Append(" | "); } any = true; sb.Append(armorType); } } sb.AppendLine(); } } if (characterClass.IntrinsicDamageModification.Count > 0) { sb.AppendLine("Damage Modifiers: "); foreach (var dmgModKvp in characterClass.IntrinsicDamageModification) { sb.Append(" ").Append(dmgModKvp.Key).Append(": ").Append(dmgModKvp.Value).AppendLine("%"); } } if (characterClass.AbilitiesPerLevel.Count > 0) { sb.AppendLine("Learned Abilities: "); foreach (var abilitiesForLevel in characterClass.AbilitiesPerLevel) { uint level = abilitiesForLevel.Key; foreach (var ability in abilitiesForLevel.Value) { sb.Append(" [Lvl ").Append(level).Append("] ").AppendLine(ability.Name); } } } return(sb.ToString()); }
private void PlayerStatisticManager_OnPlayerDeath(ICharacterClass characterClass) { HandlePlayerDeath(characterClass); }
internal static void TranslatePossitionWithEffect(ICharacterClass characterClass, IAbility ability) { throw new NotImplementedException(); }
/// <summary> /// Constructs a new PlayerPromoted event argument class /// </summary> /// <param name="player">the player that was promoted</param> /// <param name="oldClass">the player old class</param> public PlayerPromotedEventArgs(GamePlayer player, ICharacterClass oldClass) { this.player = player; this.oldClass = oldClass; }
private void Awake() { characterClass = GetComponent <ICharacterClass>(); errorMessageWindow = GameObject.FindGameObjectWithTag("GUI").GetComponentInChildren <ErrorMessageWindow>(); spellBar = GameObject.FindGameObjectWithTag("GUI").GetComponentInChildren <SpellBar>(); }
private void DisablePlayerPhysic(ICharacterClass characterClass) { characterClass.PlayerClassManager.GetComponent <Rigidbody>().detectCollisions = false; }
public static bool CheckIfEnoughMana(this ICharacterClass characterClass, IAbility ability) { return(characterClass.GetCurrentMana() < ability.ManaCost); }
public static void HealthRegeneration(this ICharacterClass characterClass) { TakeHealing(characterClass, characterClass.GetHealthRegeneration()); characterClass.GetStatusBarManager().PerformValueChangeTextEffectWithColor(characterClass.GetHealthRegeneration(), StateValueChangeAction.TakingHealing); }
public static bool CheckIfDead(this ICharacterClass characterClass) { return(characterClass.GetCurrentHealth() <= default(float)); }
public static void StaminaRegeneration(this ICharacterClass characterClass) { AddStamina(characterClass, characterClass.GetStaminaRegeneration()); characterClass.GetStatusBarManager().PerformValueChangeTextEffectWithColor(characterClass.GetStaminaRegeneration(), StateValueChangeAction.ChangeStamina); }
public CharacterSheet(ICharacterClass characterClass, ICharacterRace race, IAttributeSet attributeSet) { _characterClass = characterClass; _race = race; _attributeSet = attributeSet; }
private void Awake() { characterClass = GetComponent <ICharacterClass>(); }
private static GamePlayer NewPlayer(ICharacterClass charClass) { return(GamePlayer.CreateTestableGamePlayer(charClass)); }
public void SetCharacterClass(ICharacterClass characterClass) { CharacterClass = characterClass; }
private void Awake() { characterClass = GetComponent <ICharacterClass>(); AttachRequiredPlayerScripts(); }
/// <summary> /// Check if a Character Needs update based to packet data /// </summary> /// <param name="pdata">packet data</param> /// <param name="client">client</param> /// <param name="character">db character</param> /// <returns>True if character need refreshment false if no refresh needed.</returns> private bool CheckCharacterForUpdates(CreationCharacterData pdata, GameClient client, DOLCharacters character) { int newModel = character.CurrentModel; if (pdata.CustomMode == 1 || pdata.CustomMode == 2 || pdata.CustomMode == 3) { bool flagChangedStats = false; if (Properties.ALLOW_CUSTOMIZE_FACE_AFTER_CREATION) { character.EyeSize = (byte)pdata.EyeSize; character.LipSize = (byte)pdata.LipSize; character.EyeColor = (byte)pdata.EyeColor; character.HairColor = (byte)pdata.HairColor; character.FaceType = (byte)pdata.FaceType; character.HairStyle = (byte)pdata.HairStyle; character.MoodType = (byte)pdata.MoodType; } if (pdata.CustomMode != 3 && client.Version >= GameClient.eClientVersion.Version189) { var stats = new Dictionary <eStat, int>(); stats[eStat.STR] = pdata.Strength; // Strength stats[eStat.DEX] = pdata.Dexterity; // Dexterity stats[eStat.CON] = pdata.NewConstitution; // New Constitution stats[eStat.QUI] = pdata.Quickness; // Quickness stats[eStat.INT] = pdata.Intelligence; // Intelligence stats[eStat.PIE] = pdata.Piety; // Piety stats[eStat.EMP] = pdata.Empathy; // Empathy stats[eStat.CHR] = pdata.Charisma; // Charisma // check for changed stats. flagChangedStats |= stats[eStat.STR] != character.Strength; flagChangedStats |= stats[eStat.CON] != character.Constitution; flagChangedStats |= stats[eStat.DEX] != character.Dexterity; flagChangedStats |= stats[eStat.QUI] != character.Quickness; flagChangedStats |= stats[eStat.INT] != character.Intelligence; flagChangedStats |= stats[eStat.PIE] != character.Piety; flagChangedStats |= stats[eStat.EMP] != character.Empathy; flagChangedStats |= stats[eStat.CHR] != character.Charisma; if (flagChangedStats) { ICharacterClass charClass = ScriptMgr.FindCharacterClass(character.Class); if (charClass != null) { int points; bool valid = IsCustomPointsDistributionValid(character, stats, out points); // Hacking attemp ? if (points > MAX_STARTING_BONUS_POINTS) { if ((ePrivLevel)client.Account.PrivLevel == ePrivLevel.Player) { if (ServerProperties.Properties.BAN_HACKERS) { client.BanAccount(string.Format("Autoban Hack char update : Wrong allowed points:{0}", points)); } client.Disconnect(); return(false); } } // Error in setting points if (!valid) { return(true); } if (Properties.ALLOW_CUSTOMIZE_STATS_AFTER_CREATION) { // Set Stats, valid is ok. character.Strength = stats[eStat.STR]; character.Constitution = stats[eStat.CON]; character.Dexterity = stats[eStat.DEX]; character.Quickness = stats[eStat.QUI]; character.Intelligence = stats[eStat.INT]; character.Piety = stats[eStat.PIE]; character.Empathy = stats[eStat.EMP]; character.Charisma = stats[eStat.CHR]; if (log.IsInfoEnabled) { log.InfoFormat("Character {0} Stats updated in cache!", character.Name); } if (client.Player != null) { foreach (var stat in stats.Keys) { client.Player.ChangeBaseStat(stat, (short)(stats[stat] - client.Player.GetBaseStat(stat))); } if (log.IsInfoEnabled) { log.InfoFormat("Character {0} Player Stats updated in cache!", character.Name); } } } } else if (log.IsErrorEnabled) { log.ErrorFormat("No CharacterClass with ID {0} found", character.Class); } } } if (pdata.CustomMode == 2) // change player customization { if (client.Account.PrivLevel == 1 && ((pdata.CreationModel >> 11) & 3) == 0) { if (ServerProperties.Properties.BAN_HACKERS) // Player size must be > 0 (from 1 to 3) { client.BanAccount(string.Format("Autoban Hack char update : zero character size in model:{0}", newModel)); client.Disconnect(); return(false); } return(true); } character.CustomisationStep = 2; // disable config button if (Properties.ALLOW_CUSTOMIZE_FACE_AFTER_CREATION) { if (pdata.CreationModel != character.CreationModel) { character.CurrentModel = newModel; } if (log.IsInfoEnabled) { log.InfoFormat("Character {0} face properties configured by account {1}!", character.Name, client.Account.Name); } } } else if (pdata.CustomMode == 3) //auto config -- seems someone thinks this is not possible? { character.CustomisationStep = 3; // enable config button to player } //Save the character in the database GameServer.Database.SaveObject(character); } return(false); }
internal void DispelConditionEffect(ICharacterClass characterClass, ICondition condition) { characterClass.RemoveConditionEffect(condition); }
public EnemyDefinition(string artName, RarityCategory rarity, NameGenerator nameGenerator, ICharacterClass characterClass) { ArtName = artName; Rarity = rarity; NameGenerator = nameGenerator; CharacterClass = characterClass; Id = characterClass.Id; }
public PlayerDefaultColor(ICharacterClass characterClass) { _characterClass = characterClass; }
/// <summary> /// Constructs a new PlayerPromoted event argument class /// </summary> /// <param name="player">the player that was promoted</param> /// <param name="oldClass">the player old class</param> public PlayerPromotedEventArgs(GamePlayer player, ICharacterClass oldClass) { this.player = player; this.oldClass = oldClass; }
private void Awake() { playerRigidbody = GetComponent <Rigidbody>(); characterClass = GetComponent <ICharacterClass>(); groundLayerMask = LayerMask.GetMask("Ground"); }
public PlayerColor(ICharacterClass characterClass) : base(characterClass) { _colorData = new ColorData(); }
private void Start() { characterClass = GetComponent <ICharacterClass>(); abilitiesManager = GetComponent <AbilitiesPerformanceManager>(); }
public void setClassDecision(ICharacterClass adventureClass) { classReason = adventureClass.setReason(); }