// Use this for initialization void Start() { BaseRace race = new BaseRace(); Debug.Log("Race Name;" + race.RaceName); Debug.Log("Race Decs;" + race.RaceDesc); Debug.Log(race.HasStaminaBonus); }
public Human(string subrace = "standard") { Array alignments = Enum.GetValues(typeof(AlignmentsEnum)); var languages = LanguagesDictionary.List; var commonLanguages = LanguagesDictionary.List.Where(l => l.Value.Type == LanguageTypesEnum.Common); BaseRace human = new BaseRace(); Random rng = new Random(); // Get common languages only this.character.Age = rng.Next(15, 80); this.character.Alignment = (AlignmentsEnum)alignments.GetValue(rng.Next(alignments.Length)); this.character.Languages.Add("Common"); this.character.Languages.Add("+1"); this.character.Size = SizesEnum.Medium; this.character.Speed = 30; if (subrace == "variant") { this.character.Asi = "0,0,0,0,0,0"; this.character.Feats.Add("+1"); this.character.Skills.Add("+1"); } else { this.character.Asi = "1,1,1,1,1,1"; } }
public static void Create() { BaseRace asset = ScriptableObject.CreateInstance <BaseRace> (); AssetDatabase.CreateAsset(asset, "Assets/Data/Races/NewRace.asset"); AssetDatabase.SaveAssets(); EditorUtility.FocusProjectWindow(); Selection.activeObject = asset; }
public static bool BeauteValide(NubiaPlayer from) { bool ok = (from.Beaute != Apparence.None); if (ok) { BaseRace race = from.Race; ok = (from.Beaute <= from.Race.ApparenceMaxi && from.Beaute >= from.Race.ApparenceMini); } return(ok); }
public void rollRandomRace() { var randomIndex = UnityEngine.Random.Range(0, Enum.GetNames(typeof(CharacterRaces)).Length); characterRace = (CharacterRaces)randomIndex; switch (characterRace) { case CharacterRaces.Human: racialModifiers = this.gameObject.AddComponent <Human> (); break; case CharacterRaces.Dwarf: racialModifiers = this.gameObject.AddComponent <Dwarf> (); break; case CharacterRaces.Elf: racialModifiers = this.gameObject.AddComponent <Elf> (); break; case CharacterRaces.Gnome: racialModifiers = this.gameObject.AddComponent <Gnome> (); break; case CharacterRaces.HalfElf: racialModifiers = this.gameObject.AddComponent <HalfElf> (); break; case CharacterRaces.HalfOrc: racialModifiers = this.gameObject.AddComponent <HalfOrc> (); break; case CharacterRaces.Halfling: racialModifiers = this.gameObject.AddComponent <Halfling> (); break; default: break; } }
public static void CharCreateRequest(RealmClient client, RealmPacketIn packet) { if (client.Account == null) { return; } try { string characterName = packet.ReadString(); if (Character.Exists(characterName)) { SendCharCreateReply(client, CharacterErrorCodes.CreateNameInUse); return; } if (characterName.Length < 3) { SendCharCreateReply(client, CharacterErrorCodes.NameTooShort); return; } if (characterName.Length > 12) { SendCharCreateReply(client, CharacterErrorCodes.NameTooLong); return; } if (Character.DoesNameViolate(characterName)) { SendCharCreateReply(client, CharacterErrorCodes.NameProfanity); return; } RaceType chrRace = (RaceType)packet.ReadByte(); ClassType chrClass = (ClassType)packet.ReadByte(); CharacterErrorCodes createError; if (!RealmServer.Instance.ServerRules.CanCreateCharacter(client, chrRace, chrClass, out createError)) { SendCharCreateReply(client, createError); return; } CharacterRecord ch = CharacterRecord.CreateNewCharacterRecord(client.Account, characterName); if (ch == null) { s_log.Error("Unable to create character record!"); SendCharCreateReply(client, CharacterErrorCodes.CreateError); return; } ch.Race = chrRace; ch.Class = chrClass; ch.Gender = (GenderType)packet.ReadByte(); ch.Skin = packet.ReadByte(); ch.Face = packet.ReadByte(); ch.HairStyle = packet.ReadByte(); ch.HairColor = packet.ReadByte(); ch.FacialHair = packet.ReadByte(); ch.Outfit = packet.ReadByte(); #warning // TODO - Ogre: This should be handled elsewhere, when we have world events and stuff BaseRace race = GetRace(ch.Race); ch.Level = 1; ch.PositionX = race.StartPosition.X; ch.PositionY = race.StartPosition.Y; ch.PositionZ = race.StartPosition.Z; ch.Orientation = race.StartPosition.W; ch.CurrentMap = race.StartMap; ch.CurrentZone = race.StartZone; ch.TotalPlayTime = 0; ch.LevelPlayTime = 0; ch.PrivilegeLevel = "Guest"; ch.TutorialFlags = new byte[32]; ch.SerializedFields = new byte[0]; if (race.Type == RaceType.BloodElf) { ch.DisplayId = race.ModelOffset - (uint)ch.Gender; } else { ch.DisplayId = race.ModelOffset + (uint)ch.Gender; } if (DBSetup.IsActive) { ch.CreateAndFlush(); // Is it necessary to reload all? client.Account.ReloadCharacters(); } else { client.Account.Characters.Add(EntityId.GetPlayerId(ch.EntityId), ch); } SendCharCreateReply(client, CharacterErrorCodes.CreateSucceeded); } catch (Exception e) { s_log.Error(e); SendCharCreateReply(client, CharacterErrorCodes.CreateError); } }
protected virtual void GUICoreDisplay(ref CharacterBase cc) { // name of the character GUILayout.BeginHorizontal(); GUILayout.Label("Name", GUILayout.Width(75)); cc.Name = GUILayout.TextField(cc.Name, GUILayout.ExpandWidth(true)); GUILayout.EndHorizontal(); // axis GUILayout.BeginHorizontal(); GUILayout.Label("Axis", GUILayout.Width(75)); BaseAxis NewAxis = (BaseAxis)EditorGUILayout.EnumPopup(cc.CurrentAxis, GUILayout.ExpandWidth(true)); if (cc.CurrentAxis != NewAxis) { cc.CurrentAxis = NewAxis; cc.RebuildModifiers(); } GUILayout.EndHorizontal(); // alignment if (cc.CurrentAxis != BaseAxis.Neutral) { GUILayout.BeginHorizontal(); GUILayout.Label("Alignment", GUILayout.Width(75)); BaseAlignment NewAlignment = (BaseAlignment)EditorGUILayout.EnumPopup(cc.CurrentAlignment, GUILayout.ExpandWidth(true)); if (cc.CurrentAlignment != NewAlignment) { cc.CurrentAlignment = NewAlignment; cc.RebuildModifiers(); } GUILayout.EndHorizontal(); } // race GUILayout.BeginHorizontal(); GUILayout.Label("Race", GUILayout.Width(75)); BaseRace NewRace = (BaseRace)EditorGUILayout.EnumPopup(cc.CurrentRace, GUILayout.ExpandWidth(true)); if (cc.CurrentRace != NewRace) { cc.CurrentRace = NewRace; cc.RebuildModifiers(); } GUILayout.EndHorizontal(); // class GUILayout.BeginHorizontal(); GUILayout.Label("Class", GUILayout.Width(75)); BaseClass NewClass = (BaseClass)EditorGUILayout.EnumPopup(cc.CurrentClass, GUILayout.ExpandWidth(true)); if (cc.CurrentClass != NewClass) { cc.CurrentClass = NewClass; cc.RebuildModifiers(); } GUILayout.EndHorizontal(); // rank GUILayout.BeginHorizontal(); GUILayout.Label("Rank", GUILayout.Width(75)); BaseRank NewRank = (BaseRank)EditorGUILayout.EnumPopup(cc.CurrentRank, GUILayout.ExpandWidth(true)); if (cc.CurrentRank != NewRank) { cc.CurrentRank = NewRank; cc.RebuildModifiers(); } GUILayout.EndHorizontal(); // life GUILayout.BeginHorizontal(); GUILayout.Label("Life", GUILayout.Width(75)); GUI.skin.label.alignment = TextAnchor.UpperRight; GUILayout.Label(cc.CurrentLife.ToString("#,##0") + "/" + (cc.MAXLife + cc.BonusMAXLife).ToString("#,##0"), GUILayout.ExpandWidth(true)); GUI.skin.label.alignment = TextAnchor.UpperLeft; GUILayout.EndHorizontal(); // life regen GUILayout.BeginHorizontal(); GUILayout.Label("Life Regen", GUILayout.Width(75)); GUIGenericValueDisplay(ref cc, ref cc.RegenLife, 0, 999); GUI.skin.label.alignment = TextAnchor.UpperRight; GUILayout.Label((cc.RegenLife + cc.BonusRegenLife).ToString() + " per sec", GUILayout.ExpandWidth(true)); GUI.skin.label.alignment = TextAnchor.UpperLeft; GUILayout.EndHorizontal(); // mana GUILayout.BeginHorizontal(); GUILayout.Label("Mana", GUILayout.Width(75)); GUI.skin.label.alignment = TextAnchor.UpperRight; GUILayout.Label(cc.CurrentMana.ToString("#,##0") + "/" + (cc.MAXMana + cc.BonusMAXMana).ToString("#,##0"), GUILayout.ExpandWidth(true)); GUI.skin.label.alignment = TextAnchor.UpperLeft; GUILayout.EndHorizontal(); // mana regen GUILayout.BeginHorizontal(); GUILayout.Label("Mana Regen", GUILayout.Width(75)); GUIGenericValueDisplay(ref cc, ref cc.RegenMana, 0, 999); GUI.skin.label.alignment = TextAnchor.UpperRight; GUILayout.Label((cc.RegenMana + cc.BonusRegenMana).ToString() + " per sec", GUILayout.ExpandWidth(true)); GUI.skin.label.alignment = TextAnchor.UpperLeft; GUILayout.EndHorizontal(); // stamina GUILayout.BeginHorizontal(); GUILayout.Label("Stamina", GUILayout.Width(75)); GUI.skin.label.alignment = TextAnchor.UpperRight; GUILayout.Label((cc.MAXStamina + cc.BonusMAXStamina).ToString("#,##0"), GUILayout.ExpandWidth(true)); //cc.CurrentStamina.ToString("#,##0") + "/" + GUI.skin.label.alignment = TextAnchor.UpperLeft; GUILayout.EndHorizontal(); // armour GUILayout.BeginHorizontal(); GUILayout.Label("Armour", GUILayout.Width(75)); GUI.skin.label.alignment = TextAnchor.UpperRight; GUILayout.Label("Base " + cc.CurrentArmour.ToString("#,##0") + " Equipped " + cc.BonusArmour.ToString("#,##0"), GUILayout.ExpandWidth(true)); GUI.skin.label.alignment = TextAnchor.UpperLeft; GUILayout.EndHorizontal(); // weight GUILayout.BeginHorizontal(); GUILayout.Label("EquipLoad", GUILayout.Width(75)); GUI.skin.label.alignment = TextAnchor.UpperRight; GUILayout.Label(cc.CurrentEquipLoad.ToString("#,##0") + "/" + cc.MAXEquipLoad.ToString("#,##0"), GUILayout.ExpandWidth(true)); GUI.skin.label.alignment = TextAnchor.UpperLeft; GUILayout.EndHorizontal(); // XP & next level GUILayout.BeginHorizontal(); GUILayout.Label("XP", GUILayout.Width(75)); GUI.skin.label.alignment = TextAnchor.UpperRight; GUILayout.Label(cc.CurrentXP.ToString("#,##0") + "/" + cc.XPToNextLevel.ToString("#,##0"), GUILayout.ExpandWidth(true)); GUI.skin.label.alignment = TextAnchor.UpperLeft; GUILayout.EndHorizontal(); // current level GUILayout.BeginHorizontal(); GUILevelDisplay(ref cc); GUILayout.EndHorizontal(); }