예제 #1
0
        public static void log_CharacterStat(NPCProto proto, CharStat stat, int value)
        {
            if (proto is NPC)
            {
                return;
            }
            Player player = (Player)proto;

            if (player.getAccount() == null || !player.IsSpawned())
            {
                return;
            }

            lock (connection)
            {
                using (SQLiteCommand command = new SQLiteCommand(connection))
                {
                    command.CommandText  = "INSERT INTO `logStats` (";
                    command.CommandText += "  `id`, `accountID`, `type`, `value`, `time`)";
                    command.CommandText += "VALUES( NULL, @accID, @type, @value, @time)";

                    command.Parameters.AddWithValue("@accID", player.getAccount().accountID);
                    command.Parameters.AddWithValue("@type", (int)stat);
                    command.Parameters.AddWithValue("@value", value);
                    command.Parameters.AddWithValue("@time", DateTime.Now.Ticks);

                    command.ExecuteNonQuery();
                }
            }
        }
예제 #2
0
        public void GetStatModel_Correct()
        {
            var stat = CharStat.GetStatModel("test");

            stat.Pairs.Single(x => x.Char == 't' && ((int)Math.Round(x.Frequency * 100)) == 50);
            stat.Pairs.Single(x => x.Char == 'e' && ((int)Math.Round(x.Frequency * 100)) == 25);
            stat.Pairs.Single(x => x.Char == 's' && ((int)Math.Round(x.Frequency * 100)) == 25);
            Assert.AreEqual(stat.Pairs.Count, 3);
        }
예제 #3
0
 public void SetCharacter(Character character)
 {
     this.character = character;
     iso            = character.GetComponent <Iso>();
     equip          = character.GetComponent <Equipment>();
     inventory      = character.GetComponent <Inventory>();
     charStat       = character.GetComponent <CharStat>();
     InventoryPanel.instance.equip = equip;
 }
예제 #4
0
        public void GetStat_Correct()
        {
            var stat  = CharStat.GetStat("test");
            var check = stat.Count == 3 &&
                        (((int)Math.Round(stat['t'] * 100)) == 50) &&
                        (((int)Math.Round(stat['e'] * 100)) == 25) &&
                        (((int)Math.Round(stat['s'] * 100)) == 25);

            Assert.IsTrue(check);
        }
예제 #5
0
 public int GetStat(CharStat stat)
 {
     for (int i = 0; i < StatWeights.Count; i++)
     {
         if (StatWeights[i].Name == stat)
         {
             return(StatWeights[i].Value);
         }
     }
     return(0);
 }
    private void RecordWeightScore()
    {
        AdjustDPSScore();

        foreach (KeyValuePair <string, float> entry in ItemStats)
        {
            if (StatEnums.ContainsKey(entry.Key))
            {
                CharStat statEnum = StatEnums[entry.Key];
                WeightScore += entry.Value * AutoEquipSettings.CurrentSettings.GetStat(statEnum);
            }
        }

        WeightScore += ItemLevel;
    }
예제 #7
0
    public void SetStat(CharStat stat, int value)
    {
        int key = -1;

        for (int i = 0; i < StatWeights.Count; i++)
        {
            if (StatWeights[i].Name == stat)
            {
                key = i;
                break;
            }
        }

        if (key == -1)
        {
            StatWeights.Add(new StatWeight(stat, value));
        }
        else
        {
            StatWeights[key] = new StatWeight(stat, value);
        }
    }
예제 #8
0
    public void Use(int charToUseOn)
    {
        CharStat selectedChar = GameManager.instance.playerStats[charToUseOn];

        /*if we are using Item, do this if statement*/
        if (isItem)
        {
            if (affectHp)
            {
                /*if hp is already max hp, dont use it*/
                if (selectedChar.currentHP >= selectedChar.maxHP)
                {
                }
                else
                {
                    selectedChar.currentHP += amountOfChange;
                    if (selectedChar.currentHP > selectedChar.maxHP)
                    {
                        selectedChar.currentHP = selectedChar.maxHP;
                    }
                }
            }
            else if (affectMp)
            {
                if (selectedChar.currentMP >= selectedChar.maxMP)
                {
                }
                else
                {
                    selectedChar.currentMP += amountOfChange;
                    if (selectedChar.currentMP > selectedChar.maxMP)
                    {
                        selectedChar.currentMP = selectedChar.maxMP;
                    }
                }
            }
            else if (affectStr)
            {
                selectedChar.strength += amountOfChange;
            }
        }

        else if (isWeapon)
        {
            if (selectedChar.equippedWp != "")
            {
                GameManager.instance.AddItem(selectedChar.equippedWp);
            }

            selectedChar.equippedWp = itemName;
            selectedChar.wpPwr      = weaponStrength;
        }

        else if (isArmor)
        {
            if (selectedChar.equippedArmr != "")
            {
                GameManager.instance.AddItem(selectedChar.equippedArmr);
            }

            selectedChar.equippedArmr = itemName;
            selectedChar.armrPwr      = armerStrength;
        }

        GameManager.instance.removeItem(itemName);
    }
예제 #9
0
 public StatWeight(CharStat name, int value)
 {
     Name  = name;
     Value = value;
 }
예제 #10
0
        private static void _lcs_Hitchances(NPCProto proto, NPCTalent talent, int oldValue, int newValue)
        {
            CharStat cs = CharStat.HitChances + (int)talent;

            log_CharacterStat(proto, cs, newValue);
        }
예제 #11
0
        public void FilterTo_LettersAndDigits()
        {
            var filtered = CharStat.Filter("d*34- 4 ½ sfd 29€8sa", CharStat.CharStatOptions.IncludeDigits);

            Assert.AreEqual(filtered, "d344sfd298sa");
        }
예제 #12
0
        private static void _lcs_Attribute(NPCProto proto, NPCAttribute attrib, int oldValue, int newValue)
        {
            CharStat cs = CharStat.AttributeStart + (int)attrib;

            log_CharacterStat(proto, cs, newValue);
        }
예제 #13
0
        private static void _lcs_TalentSkill(NPCProto proto, NPCTalent talent, int oldValue, int newValue)
        {
            CharStat cs = CharStat.TalentSkillStart + (int)talent;

            log_CharacterStat(proto, cs, newValue);
        }
예제 #14
0
        public void GetStatModelAlphabeticalSortCheck_Correct()
        {
            var stat = CharStat.GetStatModel("abbbcc", true);

            Assert.IsTrue(stat.Pairs[0].Char == 'a' && stat.Pairs[2].Char == 'c');
        }
예제 #15
0
        public void GetStatNull_ListCountIsZero()
        {
            var stat = CharStat.GetStat(null);

            Assert.AreEqual(stat.Count, 0);
        }
예제 #16
0
        public void FilterTo_LettersAndWhitespaces()
        {
            var filtered = CharStat.Filter("d*34- 4 ½ sfd 29€8sa", CharStat.CharStatOptions.IncludeWhiteSpaces);

            Assert.AreEqual(filtered, "d   sfd sa");
        }
예제 #17
0
    public void BattleStart(string[] enemiesToSpawn, bool cannotFlee)
    {
        if (!battleActive)
        {
            isBoss       = cannotFlee;
            battleActive = true;
            GameManager.instance.battleActive = true;

            //move battlescene as camera moves
            transform.position = new Vector3(Camera.main.transform.position.x, Camera.main.transform.position.y, transform.position.z);
            battleScene.SetActive(true);

            AudioManager.instance.PlayBGM(0);

            for (int i = 0; i < playerPosition.Length; i++)
            {
                if (GameManager.instance.playerStats[i].gameObject.activeInHierarchy)
                {
                    for (int j = 0; j < playerPrefabs.Length; j++)
                    {
                        //serch char
                        if (playerPrefabs[j].charName == GameManager.instance.playerStats[i].charName)
                        {
                            BattleChar newPlayer = Instantiate(playerPrefabs[j], playerPosition[i].position, playerPosition[i].rotation);
                            newPlayer.transform.parent = playerPosition[i];
                            activeBattlers.Add(newPlayer);

                            CharStat thePlayer = GameManager.instance.playerStats[i];
                            activeBattlers[i].currentHP = thePlayer.currentHP;
                            activeBattlers[i].currentMP = thePlayer.currentMP;
                            activeBattlers[i].maxHP     = thePlayer.maxHP;
                            activeBattlers[i].maxMP     = thePlayer.maxMP;
                            activeBattlers[i].strength  = thePlayer.strength;
                            activeBattlers[i].defence   = thePlayer.defence;
                            activeBattlers[i].wpnPower  = thePlayer.wpPwr;
                            activeBattlers[i].armrPower = thePlayer.armrPwr;
                        }
                    }
                }
            }

            for (int i = 0; i < enemiesToSpawn.Length; i++)
            {
                if (enemiesToSpawn[i] != "")
                {
                    for (int j = 0; j < enemyPrefabs.Length; j++)
                    {
                        if (enemyPrefabs[j].charName == enemiesToSpawn[i])
                        {
                            BattleChar newEnemy = Instantiate(enemyPrefabs[j], enemyPosition[i].position, enemyPosition[i].rotation);
                            newEnemy.transform.parent = enemyPosition[i];
                            activeBattlers.Add(newEnemy);
                        }
                    }
                }
            }
            turnWaiting = true;
            currentTurn = 0;

            UpdateStats();
        }
    }
예제 #18
0
        public void GetStatModelMultipleLanguage_Correct()
        {
            var stat = CharStat.GetStatModel("夢林玄解 維基電子版 幾乎全部都是亂1someother-text2что-тонарусском1");

            Assert.AreEqual(stat.Pairs.Count, 34);
        }
예제 #19
0
        public void GetStatModelEmptyString_ListCountIsZero()
        {
            var stat = CharStat.GetStatModel("");

            Assert.AreEqual(stat.Pairs.Count, 0);
        }
예제 #20
0
        public void FilterTo_LettersAndSymbols()
        {
            var filtered = CharStat.Filter("d*34- 4 ½ sfd 29€8sa", CharStat.CharStatOptions.IncludeSymbols);

            Assert.AreEqual(filtered, "d*-½sfd€sa");
        }
예제 #21
0
        public void FilterTo_LettersLowCase()
        {
            var filtered = CharStat.Filter("-*‡€⁋™Жקओを\U0001F000\U0001D49E");

            Assert.AreEqual(filtered, "жקओを");
        }
예제 #22
0
 public StatMod(CharStat stat, float value, StatModifierType type = StatModifierType.SUM)
 {
     Stat  = stat;
     Value = value;
     Type  = type;
 }
예제 #23
0
        public void GetStatModelNull_ListCountIsZero()
        {
            var stat = CharStat.GetStatModel(null);

            Assert.AreEqual(stat.Pairs.Count, 0);
        }
예제 #24
0
        public void FilterTo_NonWhitespaces()
        {
            var filtered = CharStat.Filter("d*34- 4 ½ sfd 29€8sa", CharStat.CharStatOptions.IncludeDigits | CharStat.CharStatOptions.IncludeSymbols);

            Assert.AreEqual(filtered, "d*34-4½sfd29€8sa");
        }
예제 #25
0
        public void GetStatModelFrequencySortCheck_Correct()
        {
            var stat = CharStat.GetStatModel("abbbcc");

            Assert.IsTrue(stat.Pairs[0].Char == 'b' && stat.Pairs[2].Char == 'a');
        }
예제 #26
0
//	CharAttribute(float baseValue, List<CharStat> dLisdept){
//		initialValue = baseValue;
//		dependent = dList;
//		CalculateAttribute();
//	}
//	void CalculateAttribute(){
//		baseValue = initialValue;
//		for (int i = 0; i < modifiers.Count; i++) {
//			baseValue +=  (float)dependent[i].StatsValue*modifiers[i];
//		}
//	}
    #region Public Methods

    public void AddModifier(float newModifier, CharStat statName)
    {
        mods.Add(newModifier);
        dependents.Add(statName);
    }