Exemple #1
0
    static void SpawnPlayer(string className, Vector3 pos)
    {
        CharStatsInfo info   = CharStatsInfo.Find(className);
        var           player = new GameObject("Player");

        player.tag = "Player";
        player.transform.position = pos;
        var character = player.AddComponent <Character>();

        character.basePath       = @"data\global\chars";
        character.token          = info.token;
        character.weaponClass    = info.baseWClass;
        character.directionCount = 16;
        character.run            = true;
        character.walkSpeed      = 7;
        character.runSpeed       = 15;
        character.maxHealth      = 1000;
        character.health         = 1000;
        character.size           = 2;

        character.equip = player.AddComponent <Equipment>();
        Inventory.Create(player, 10, 4);
        var body = player.AddComponent <Rigidbody2D>();

        body.isKinematic = true;
        var collider = player.AddComponent <CircleCollider2D>();

        collider.radius = Iso.tileSizeY;
        var listenerObject = new GameObject("Audio Listener");

        listenerObject.AddComponent <AudioListener>();
        listenerObject.transform.SetParent(player.transform, true);
        listenerObject.transform.localPosition = new Vector3(0, 0, -1);

        PlayerController.instance.SetCharacter(character);

        foreach (var startingItem in info.startingItems)
        {
            if (startingItem.code == null)
            {
                continue;
            }

            var itemInfo = ItemInfo.Find(startingItem.code);
            for (int i = 0; i < startingItem.count; ++i)
            {
                var item = new Item(itemInfo);
                if (startingItem.loc != null)
                {
                    int loc = BodyLoc.GetIndex(startingItem.loc);
                    character.equip.Equip(item, loc);
                }
                else
                {
                    PlayerController.instance.Take(item);
                }
            }
        }
    }
        static GameObject CreateDummy(CharStatsInfo info)
        {
            var gameObject = new GameObject(info.className);
            var animator   = gameObject.AddComponent <COFAnimator>();

            animator.equip = new string[] { "LIT", "LIT", "LIT", "LIT", "LIT", "", "", "", "LIT", "LIT", "", "", "", "", "", "" };
            return(gameObject);
        }
        public void OnPointerEnter(PointerEventData eventData)
        {
            CharStatsInfo classInfo = CharStatsInfo.Find(className);

            dummyAnimator.selected = true;
            dummyAnimator.cof      = GetCof(classInfo, "SC");
            OnEnter(classInfo);
        }
        public void OnPointerExit(PointerEventData eventData)
        {
            CharStatsInfo classInfo = CharStatsInfo.Find(className);

            dummyAnimator.selected = false;
            dummyAnimator.cof      = GetCof(classInfo, "TN");
            OnExit(classInfo);
        }
Exemple #5
0
    void Start()
    {
        CharStatsInfo classInfo = CharStatsInfo.Find(className);

        dummy             = CreateDummy(classInfo, new Vector3(0, 0));
        dummyAnimator     = dummy.GetComponent <COFAnimator>();
        dummyAnimator.cof = GetCof(classInfo, "TN");
    }
        private void Awake()
        {
            Canvas.ForceUpdateCanvases();
            rectTransform = GetComponent <RectTransform>();
            className     = name;
            CharStatsInfo classInfo = CharStatsInfo.Find(className);

            dummy = CreateDummy(classInfo);
            dummy.transform.position = Camera.main.ScreenToWorldPoint(rectTransform.position);
            dummyAnimator            = dummy.GetComponent <COFAnimator>();
            dummyAnimator.cof        = GetCof(classInfo, "TN");
        }
Exemple #7
0
    static GameObject CreateDummy(CharStatsInfo info, Vector3 pos)
    {
        var gameObject = new GameObject(info.className);

        gameObject.transform.position = pos;

        var animator = gameObject.AddComponent <COFAnimator>();

        animator.equip = new string[] { "LIT", "LIT", "LIT", "LIT", "LIT", "", "", "", "LIT", "LIT", "", "", "", "", "", "" };

        return(gameObject);
    }
Exemple #8
0
        public static void LoadAll()
        {
            var sw = System.Diagnostics.Stopwatch.StartNew();

            Translation.Load();
            SoundInfo.Load();
            SoundEnvironment.Load();
            ObjectInfo.Load();
            BodyLoc.Load();
            ExpTable.Load();
            LevelType.Load();
            LevelWarpInfo.Load();
            LevelPreset.Load();
            LevelMazeInfo.Load();
            LevelInfo.Load();
            OverlayInfo.Load();
            MissileInfo.Load();
            ItemStat.Load();
            ItemRatio.Load();
            ItemType.Load();
            ItemPropertyInfo.Load();
            ItemSet.Load();
            UniqueItem.Load();
            SetItem.Load();
            TreasureClass.Load();
            MagicAffix.Load();
            CharStatsInfo.Load();
            MonLvl.Load();
            MonPreset.Load();
            MonSound.Load();
            MonStatsExtended.Load();
            MonStat.Load();
            SuperUnique.Load();
            SkillDescription.Load();
            SkillInfo.Load();
            SpawnPreset.Load();
            StateInfo.Load();
            Debug.Log("All txt files loaded in " + sw.ElapsedMilliseconds + " ms");
        }
        static COF GetCof(CharStatsInfo info, string mode)
        {
            var basePath = @"data\global\chars";

            return(COF.Load(basePath, info.token, info.baseWClass, mode));
        }
        public void OnPointerClick(PointerEventData eventData)
        {
            CharStatsInfo classInfo = CharStatsInfo.Find(className);

            OnClick(classInfo);
        }
Exemple #11
0
        private void DescribeProperty(StringBuilder sb, Property prop)
        {
            foreach (var block in prop.info.blocks)
            {
                int value = prop.value;

                if (block.func == 5)
                {
                    sb.Append("\n");
                    sb.Append("+");
                    sb.Append(value);
                    sb.Append(" To Minimum Damage");
                    continue;
                }
                else if (block.func == 6)
                {
                    sb.Append("\n");
                    sb.Append("+");
                    sb.Append(value);
                    sb.Append(" To Maximum Damage");
                    continue;
                }
                else if (block.func == 7)
                {
                    sb.Append("\n");
                    sb.Append("+");
                    sb.Append(value);
                    sb.Append("% Enhanced Damage");
                    continue;
                }
                else if (block.func == 14)
                {
                    sb.Append("\nSocketed (");
                    sb.Append(prop.value);
                    sb.Append(")");
                }
                else if (block.func == 17)
                {
                    int characterLevel = 10;
                    int perLevel       = prop.param != null?int.Parse(prop.param) : 1;

                    value = perLevel * characterLevel;
                }
                if (block.stat == null)
                {
                    continue;
                }

                string sign = value > 0 ? "+" : "";
                string str1 = value > 0 ? block.stat.descPositive : block.stat.descNegative;
                sb.Append("\n");
                if (block.stat.descFunc == 1 || block.stat.descFunc == 12)
                {
                    if (block.stat.descVal == 1)
                    {
                        sb.Append(sign);
                        sb.Append(value);
                        sb.Append(" ");
                    }
                    sb.Append(str1);
                    if (block.stat.descVal == 2)
                    {
                        sb.Append(" ");
                        sb.Append(sign);
                        sb.Append(value);
                    }
                }
                else if (block.stat.descFunc == 2)
                {
                    if (block.stat.descVal == 1)
                    {
                        sb.Append(value);
                        sb.Append("% ");
                    }
                    sb.Append(str1);
                    if (block.stat.descVal == 2)
                    {
                        sb.Append(" ");
                        sb.Append(value);
                        sb.Append("%");
                    }
                }
                else if (block.stat.descFunc == 3)
                {
                    if (block.stat.descVal == 1)
                    {
                        sb.Append(value);
                        sb.Append(" ");
                    }
                    sb.Append(str1);
                    if (block.stat.descVal == 2)
                    {
                        sb.Append(" ");
                        sb.Append(value);
                    }
                }
                else if (block.stat.descFunc == 4)
                {
                    if (block.stat.descVal == 1)
                    {
                        sb.Append(sign);
                        sb.Append(value);
                        sb.Append("% ");
                    }
                    sb.Append(str1);
                    if (block.stat.descVal == 2)
                    {
                        sb.Append(" ");
                        sb.Append(sign);
                        sb.Append(value);
                        sb.Append("%");
                    }
                }
                else if (block.stat.descFunc == 5)
                {
                    sb.Append(value * 100 / 128);
                    sb.Append("% ");
                    sb.Append(str1);
                }
                else if (block.stat.descFunc == 6)
                {
                    sb.Append(sign);
                    sb.Append(value);
                    sb.Append(" ");
                    sb.Append(str1);
                    sb.Append(" ");
                    sb.Append(block.stat.desc2);
                }
                else if (block.stat.descFunc == 7)
                {
                    sb.Append(value);
                    sb.Append("% ");
                    sb.Append(str1);
                    sb.Append(" ");
                    sb.Append(block.stat.desc2);
                }
                else if (block.stat.descFunc == 8)
                {
                    sb.Append(sign);
                    sb.Append(value);
                    sb.Append("% ");
                    sb.Append(str1);
                    sb.Append(" ");
                    sb.Append(block.stat.desc2);
                }
                else if (block.stat.descFunc == 9)
                {
                    sb.Append(value);
                    sb.Append(" ");
                    sb.Append(str1);
                    sb.Append(" ");
                    sb.Append(block.stat.desc2);
                }
                else if (block.stat.descFunc == 10)
                {
                    sb.Append(value * 100 / 128);
                    sb.Append("% ");
                    sb.Append(str1);
                    sb.Append(" ");
                    sb.Append(block.stat.desc2);
                }
                else if (block.stat.descFunc == 11)
                {
                    sb.Append("Repairs 1 Durability In ");
                    sb.Append(100 / value);
                    sb.Append(" Seconds");
                }
                else if (block.stat.descFunc == 13)
                {
                    sb.Append("+");
                    sb.Append(value);
                    sb.Append(" to ");
                    string className = CharStatsInfo.sheet[block.value].className;
                    sb.Append(className);
                    sb.Append(" Skill Levels");
                }
                else if (block.stat.descFunc == 14)
                {
                    string skillTabId = prop.param;
                    var    charStat   = CharStatsInfo.FindByCode(prop.classSpecific);
                    string className  = charStat != null ? charStat.className : "NULL";
                    sb.Append(sign);
                    sb.Append(value);
                    sb.Append(" to ");
                    sb.Append("skilltab" + skillTabId);
                    sb.Append(" Skill Levels (");
                    sb.Append(className);
                    sb.Append(" Only)");
                }
                else if (block.stat.descFunc == 15)
                {
                    string skillId    = prop.param;
                    var    skillInfo  = SkillInfo.Find(skillId);
                    int    chance     = prop.min;
                    int    skillLevel = prop.max;
                    sb.Append(chance);
                    sb.Append("% to cast Level ");
                    sb.Append(skillLevel);
                    sb.Append(" ");
                    sb.Append(skillInfo.name);
                    sb.Append(" on ");
                    sb.Append(block.stat.itemEvent1);
                }
                else if (block.stat.descFunc == 16)
                {
                    sb.Append("Level [sLvl] [skill] Aura When Equipped");
                }
                else if (block.stat.descFunc == 17)
                {
                    sb.Append("[value] [string1] (Increases near [time]) ");
                }
                else if (block.stat.descFunc == 18)
                {
                    sb.Append("[value]% [string1] (Increases near [time])");
                }
                else if (block.stat.descFunc == 19)
                {
                    sb.Append("sprintf");
                }
                else if (block.stat.descFunc == 20)
                {
                    sb.Append(-value);
                    sb.Append("% ");
                    sb.Append(str1);
                }
                else if (block.stat.descFunc == 21)
                {
                    sb.Append(-value);
                    sb.Append(" ");
                    sb.Append(str1);
                }
                else if (block.stat.descFunc == 22)
                {
                    sb.Append("[value]% [string1] [montype]");
                }
                else if (block.stat.descFunc == 23)
                {
                    sb.Append("[value]% [string1] [monster]");
                }
                else if (block.stat.descFunc == 24)
                {
                    int    chargeCount = -prop.min;
                    int    skillLevel  = -prop.max;
                    string skillId     = prop.param;
                    var    skillInfo   = SkillInfo.Find(skillId);
                    sb.Append("Level ");
                    sb.Append(skillLevel);
                    sb.Append(" ");
                    sb.Append(skillInfo.name);
                    sb.Append(" (");
                    sb.Append(chargeCount);
                    sb.Append("/");
                    sb.Append(chargeCount);
                    sb.Append(" Charges)");
                }
                else if (block.stat.descFunc == 27)
                {
                    string skillId   = prop.param;
                    var    skillInfo = SkillInfo.Find(skillId);
                    var    className = CharStatsInfo.FindByCode(skillInfo.charClass).className;
                    sb.Append("+");
                    sb.Append(value);
                    sb.Append(" to ");
                    sb.Append(skillInfo.name);
                    sb.Append(" (");
                    sb.Append(className);
                    sb.Append(" Only)");
                }
                else if (block.stat.descFunc == 28)
                {
                    string skillId   = prop.param;
                    var    skillInfo = SkillInfo.Find(skillId);
                    sb.Append("+");
                    sb.Append(value);
                    sb.Append(" to ");
                    sb.Append(skillInfo.name);
                }
                else
                {
                    AppendColored(sb, block.statId + "(descFunc " + block.stat.descFunc + ")" + ": " + str1, Colors.ItemLowQualityHex);
                }
            }
        }
Exemple #12
0
        public string GetDescription()
        {
            var sb = new StringBuilder();

            sb.Append(GetTitle());

            if (info.weapon != null)
            {
                if (info.weapon.missileType != null)
                {
                    sb.Append("\nThrow Damage: " + info.weapon.missileMinDamage + " to " + info.weapon.missileMaxDamage);
                }
                if (!info.weapon.twoHanded || info.weapon.oneOrTwoHanded)
                {
                    sb.Append("\nOne-Hand Damage: " + info.weapon.minDamage + " to " + info.weapon.maxDamage);
                }
                if (info.weapon.twoHanded)
                {
                    sb.Append("\nTwo-Hand Damage: " + info.weapon.twoHandedMinDamage + " to " + info.weapon.twoHandedMaxDamage);
                }
                if (!info.weapon.noDurability)
                {
                    sb.Append("\nDurability: " + info.weapon.durability);
                }
                if (info.weapon.reqDex > 0)
                {
                    sb.Append("\nRequired Dexterity: " + info.weapon.reqDex);
                }
                if (info.weapon.reqStr > 0)
                {
                    sb.Append("\nRequired Strength: " + info.weapon.reqStr);
                }
            }

            if (info.armor != null)
            {
                sb.Append("\nDefense: " + info.armor.minAC);
                if (!info.armor.noDurability)
                {
                    sb.Append("\nDurability: " + info.armor.durability);
                }
            }

            var onlyForClass = CharStatsInfo.FindByCode(info.type.classCode);

            if (onlyForClass != null)
            {
                bool classMatched = CurrentCharacterClass() == onlyForClass;
                if (!classMatched)
                {
                    StartColor(sb, Colors.ItemRedHex);
                }
                sb.Append("\n(" + onlyForClass.className + " only)");
                if (!classMatched)
                {
                    EndColor(sb);
                }
            }

            if (info.armor != null)
            {
                if (info.armor.reqStr > 0)
                {
                    sb.Append("\nRequired Strength: " + info.armor.reqStr);
                }
            }

            if (levelReq > 0)
            {
                sb.Append("\nRequired Level: " + levelReq);
            }

            if (identified)
            {
                DescribeProperties(sb);
                DescribeSet(sb);
            }
            else
            {
                AppendColored(sb, "\nUnidentified", Colors.ItemRedHex);
            }

            return(sb.ToString());
        }