Example #1
0
 public CharacterSheet(AbilityScores abilityScore, PersonalInformation personalInfo,
                       CharacterProgress characterProg, CombatScores cScores, SkillScores sScores, CharacterColors characterColors, Character character, CharacterLoadout loadout)
 {
     abilityScores        = abilityScore;
     personalInformation  = personalInfo;
     characterProgress    = characterProg;
     combatScores         = cScores;
     skillScores          = sScores;
     inventory            = new Inventory();
     inventory.character  = character;
     this.characterColors = characterColors;
     characterLoadout     = new CharacterLoadoutActual(loadout, character, characterColors);
     // Character Armor
     // Character Inventory
 }
Example #2
0
    public void finishCharacterCreation()
    {
        if (saving)
        {
            return;
        }
        string characterId = Saves.getnewCharacterUUID();

        saving = true;
        Color  raceColor    = Color.white;
        string characterStr = "";

        //Character first and last name
        characterStr += characterName + delimiter;
        characterStr += characterLastName + delimiter;
        //Character Sex: 0 = Male, 1 = Female
        if (character.sex == CharacterSex.Male)
        {
            characterStr += "0" + delimiter;
        }
        else
        {
            characterStr += "1" + delimiter;
        }
        //Character Race: 0 = Berrind, 1 = Ashpian, 2 = Rorrul
        switch (character.race.raceName)
        {
        case RaceName.Berrind:
            characterStr += "0" + delimiter;
            raceColor     = berrindColor;
            break;

        case RaceName.Ashpian:
            characterStr += "1" + delimiter;
            raceColor     = ashpianColor;
            break;

        case RaceName.Rorrul:
            characterStr += "1" + delimiter;
            raceColor     = rorrulColor;
            break;

        default:
            break;
        }
        //Character Background (contextualized by race): 0 = Fallen Noble | Commoner | Servant, 1 = White Gem | Immigrant | Unknown
        if (character.background == CharacterBackground.FallenNoble ||
            character.background == CharacterBackground.Commoner ||
            character.background == CharacterBackground.Servant)
        {
            characterStr += "0" + delimiter;
        }
        else
        {
            characterStr += "1" + delimiter;
        }
        //Age, Height, Weight are unused, but still in the character sheet
        characterStr += "0" + delimiter;
        characterStr += "0" + delimiter;
        characterStr += "0" + delimiter;
        //Character Class: 0 = Ex-Soldier, 1 = Engineer, 2 = Investigator, 3 = Researcher, 4 = Orator
        switch (character.cClass.getClassName())
        {
        case ClassName.ExSoldier:
            characterStr += "0" + delimiter;
            break;

        case ClassName.Engineer:
            characterStr += "1" + delimiter;
            break;

        case ClassName.Investigator:
            characterStr += "2" + delimiter;
            break;

        case ClassName.Researcher:
            characterStr += "3" + delimiter;
            break;

        case ClassName.Orator:
            characterStr += "4" + delimiter;
            break;

        default:
            break;
        }
        int[] scores = gameObject.GetComponent <CCPointAllocation>().getScores();
        int[] skills = gameObject.GetComponent <CCPointAllocation>().getSkills();

        //Add all Ability Scores and Skills
        for (int i = 0; i < scores.Length; i++)
        {
            characterStr += scores[i] + delimiter;
        }
        for (int i = 0; i < skills.Length; i++)
        {
            characterStr += skills[i] + delimiter;
        }

        //Add all colors
        characterStr += colorString(raceColor);
        characterStr += colorString(hairColor);
        characterStr += colorString(primaryColor);
        characterStr += colorString(secondaryColor);
        //HairStyle
        characterStr += hairStyle + delimiter;
        //Level and Experience
        characterStr += "1;0;";
        //Add in any copper the character may start with
        if (character.background == CharacterBackground.FallenNoble)
        {
            characterStr += "50" + delimiter;
        }
        else if (character.background == CharacterBackground.Commoner)
        {
            characterStr += "10" + delimiter;
        }
        else if (character.background == CharacterBackground.Servant)
        {
            characterStr += "30" + delimiter;
        }
        else
        {
            characterStr += "0" + delimiter;
        }
        //Add in health and composure
        characterStr += gameObject.GetComponent <CCPointAllocation>().calculateHealth() + delimiter;
        characterStr += gameObject.GetComponent <CCPointAllocation>().calculateComposure() + delimiter;
        //number of chosen features followed by each one.
        characterStr += "0;";
        //Weapon Focus:
        characterStr += "0;";
        //Number of inventory items followed by that many items.
        CharacterLoadoutActual loadout = new CharacterLoadoutActual();

        loadout.setItemInSlot(InventorySlot.Chest, clothChest.GetComponent <ItemArmor>().getItem());
        loadout.setItemInSlot(InventorySlot.Boots, clothBoots.GetComponent <ItemArmor>().getItem());
        loadout.setItemInSlot(InventorySlot.Pants, clothPants.GetComponent <ItemArmor>().getItem());
        switch (character.background)
        {
        case CharacterBackground.FallenNoble:
            loadout.setItemInSlot(InventorySlot.Chest, paddedVest.GetComponent <ItemArmor>().getItem());
            break;

        case CharacterBackground.WhiteGem:
            loadout.setItemInSlot(InventorySlot.RightHand, handAxe.GetComponent <ItemWeapon>().getItem());
            loadout.setItemInSlot(InventorySlot.Head, leatherCap.GetComponent <ItemArmor>().getItem());
            break;

        case CharacterBackground.Commoner:
            loadout.setItemInSlot(InventorySlot.RightHand, plank.GetComponent <ItemWeapon>().getItem());
            break;

        case CharacterBackground.Immigrant:
            loadout.setItemInSlot(InventorySlot.RightHand, shortSword.GetComponent <ItemWeapon>().getItem());
            loadout.setItemInSlot(InventorySlot.Shoulder, leatherSpaulder.GetComponent <ItemArmor>().getItem());
            break;

        case CharacterBackground.Unknown:
            loadout.setItemInSlot(InventorySlot.Head, clothHood.GetComponent <ItemArmor>().getItem());
            loadout.setItemInSlot(InventorySlot.RightHand, dagger.GetComponent <ItemWeapon>().getItem());
            break;

        default:
            break;
        }
//		characterStr += "0;";
        string inventoryString = "";
        int    inventorySize   = 0;

        if (character.cClass is Class_Engineer)
        {
            inventorySize++;
            inventoryString += "0;";
            if (turret)
            {
                Turret t = startingTurret.GetComponent <ItemMechanicalEditor>().getItem() as Turret;
                t.creatorId      = characterId;
                inventoryString += (int)t.getItemCode() + delimiter;
                inventoryString += t.getItemData() + delimiter;
            }
            else
            {
                Trap t = startingTrap.GetComponent <ItemMechanicalEditor>().getItem() as Trap;
                t.creatorId      = characterId;
                inventoryString += (int)t.getItemCode() + delimiter;
                inventoryString += t.getItemData() + delimiter;
            }
        }
        foreach (InventorySlot slot in UnitGUI.armorSlots)
        {
            Item i = loadout.getItemInSlot(slot);
            if (i != null)
            {
                inventorySize++;
                inventoryString += Character.getArmorSlotIndex(slot) + delimiter;
                inventoryString += (int)i.getItemCode() + delimiter;
                inventoryString += i.getItemData() + delimiter;
            }
        }
        characterStr += inventorySize + delimiter + inventoryString;
        //Favored Race
        characterStr += "0;";
        Saves.addCharacter(characterStr, characterId);
        if (Application.loadedLevel != 2)
        {
            Application.LoadLevel(2);
        }
    }