Ejemplo n.º 1
0
 protected override void Initialize()
 {
     Content.RootDirectory = "Content";
     Service.Add(this);
     Service.Add(new SpriteBatch3D(this));
     Service.Add(new SpriteBatchUI(this));
     Service.Add <INetworkClient>(new NetworkClient());
     Service.Add <IInputService>(new InputService(Window.Handle));
     Service.Add(new AudioService());
     m_UserInterface = Service.Add(new UserInterfaceService());
     m_Plugins       = new PluginManager(AppDomain.CurrentDomain.BaseDirectory);
     m_Models        = new ModelManager();
     // Make sure we have a UO installation before loading IO.
     if (FileManager.IsUODataPresent)
     {
         // Initialize and load data
         IResourceProvider provider = new ResourceProvider(this);
         provider.RegisterResource(new EffectDataResource());
         Service.Add(provider);
         HueData.Initialize(GraphicsDevice);
         SkillsData.Initialize();
         GraphicsDevice.Textures[1] = HueData.HueTexture0;
         GraphicsDevice.Textures[2] = HueData.HueTexture1;
         m_IsRunning          = true;
         WorldModel.IsInWorld = false;
         Models.Current       = new LoginModel();
     }
     else
     {
         Tracer.Critical("Did not find a compatible UO Installation. JuicyUO is compatible with any version of UO through Mondian's Legacy.");
     }
 }
Ejemplo n.º 2
0
    public static Character GetCharacter(string characterName)
    {
        var character = JsonUtility.FromJson <Character>(PlayerPrefs.GetString(characterName, Constants.PpSerializeDefault));

        character.Weapons = new List <Weapon>();
        character.Weapons.Add(JsonUtility.FromJson <Weapon>(PlayerPrefs.GetString(characterName + Constants.PpWeapon1, Constants.PpSerializeDefault)));
        character.Weapons.Add(JsonUtility.FromJson <Weapon>(PlayerPrefs.GetString(characterName + Constants.PpWeapon2, Constants.PpSerializeDefault)));
        character.Skills = new List <Skill>();
        character.Skills.Add(SkillsData.GetSkillFromName(PlayerPrefs.GetString(characterName + Constants.PpSkill1, Constants.PpSerializeDefault)));
        character.Skills.Add(SkillsData.GetSkillFromName(PlayerPrefs.GetString(characterName + Constants.PpSkill2, Constants.PpSerializeDefault)));
        character.Inventory = new List <InventoryItem>();
        for (int i = 0; i < character.InventoryPlace; ++i)
        {
            var serialized = PlayerPrefs.GetString(characterName + Constants.PpInventoryItem + i, Constants.PpSerializeDefault);
            if (string.IsNullOrEmpty(serialized))
            {
                continue;
            }
            var typeId = PlayerPrefs.GetInt(characterName + Constants.PpInventoryItem + i + "Type");
            if (typeId == InventoryItemType.Weapon.GetHashCode())
            {
                character.Inventory.Add(JsonUtility.FromJson <Weapon>(serialized));
            }
            else if (typeId == InventoryItemType.Skill.GetHashCode())
            {
                character.Inventory.Add(SkillsData.GetSkillFromName(serialized));
            }
            else
            {
                character.Inventory.Add(ItemsData.GetItemFromName(serialized));
            }
        }
        return(character);
    }
Ejemplo n.º 3
0
 public override void levelXInit(SkillsData sData, int level)
 {
     base.priceAP       = Convert.ToInt32(sData.skillAPCost[level]);
     base.priceENE      = Convert.ToInt32(sData.skillEneCost[level]);
     base.skillCooldown = Convert.ToInt32(sData.skillCooldown[level]);
     base.skillTargets  = new SkillTargets(sData.skillValues[level]["Targets"]);
 }
Ejemplo n.º 4
0
    private List <InventoryItem> PopulateItemsForSale(InventoryItemType type)
    {
        var items   = new List <InventoryItem>();
        var nbItems = 3;

        if (Random.Range(0, 100) < 5)
        {
            nbItems = 6;
        }
        else if (Random.Range(0, 100) < 15)
        {
            nbItems = 5;
        }
        else if (Random.Range(0, 100) < 30)
        {
            nbItems = 4;
        }
        for (int i = 0; i < nbItems; ++i)
        {
            if (type == InventoryItemType.Weapon)
            {
                items.Add(WeaponsData.GetRandomWeapon());
            }
            else if (type == InventoryItemType.Skill)
            {
                items.Add(SkillsData.GetRandomSkill());
            }
            else if (type == InventoryItemType.Item)
            {
                items.Add(ItemsData.GetRandomItem());
            }
        }
        return(items);
    }
Ejemplo n.º 5
0
 public void SetNowSkill(int n)
 {
     nowSkill = skillList[n];
     nowSkill.effectNumber = 0;
     battleManager.ShowSkill(battle.status.iconFace[4], nowSkill.skillName);
     battle.nowMp -= nowSkill.cost;
 }
Ejemplo n.º 6
0
        public long Crits()
        {
            var result = from skill in Skills from source in skill.Value select SkillsData.Crits(source, _target, skill.Key.Id, _timed, _petinfo, Type);

            var enumerable = result as int[] ?? result.ToArray();

            return(!enumerable.Any() ? 0 : enumerable.Sum());
        }
Ejemplo n.º 7
0
        public long AmountWhite()
        {
            var result = from skill in Skills from source in skill.Value select SkillsData.AmountWhite(source, _target, skill.Key.Id, _timed, skill.Key.NpcInfo, Type);

            var enumerable = result as long[] ?? result.ToArray();

            return(!enumerable.Any() ? 0 : enumerable.Sum());
        }
Ejemplo n.º 8
0
        public long BiggestCrit()
        {
            var result = from skill in Skills from source in skill.Value select SkillsData.BiggestCrit(source, _target, skill.Key.Id, _timed, skill.Key.NpcInfo, Type);

            var enumerable = result as long[] ?? result.ToArray();

            return(!enumerable.Any() ? 0 : enumerable.Max());
        }
Ejemplo n.º 9
0
 public long DamagePercent(int skillId)
 {
     if (_playerDealtUnrelieable)
     {
         throw new Exception("Player Dealt unrelieable");
     }
     return(SkillsData.Amount(_playerDamageDealt.Source.User, _target, skillId, _timed, Type) * 100 / Amount());
 }
Ejemplo n.º 10
0
        public long Amount()
        {
            var result = from skill in Skills
                         from source in skill.Value
                         select SkillsData.Amount(source, _target, skill.Key.Id, _timed, Type);

            return(result.Sum());
        }
Ejemplo n.º 11
0
        public long Hits(int skillId)
        {
            var result = from skill in Skills
                         where skill.Key.Id == skillId
                         from source in skill.Value
                         select SkillsData.Hits(source, _target, skillId, _timed, Type);

            return(result.Sum());
        }
Ejemplo n.º 12
0
 protected override void Awake()
 {
     base.Awake();
     Debug.Log(11111);
     modelsData        = new ModelsData();
     modelsData.models = new ModelEntity[4];
     for (int i = 0; i < 4; i++)
     {
         modelsData.models[i] = Resources.Load <ModelEntity>("Data/Entity/Models/ModelEntity0" + (i + 1));
     }
     propsData           = new PropsData();
     propsData.medicines = new PropEntity[2];
     for (int i = 0; i < 2; i++)
     {
         propsData.medicines[i] = Resources.Load <PropEntity>("Data/Entity/Props/Prop_Medicine_0" + (i + 1));
     }
     equipsData         = new EquipsData();
     equipsData.weapons = new EquipEntity[2];
     for (int i = 0; i < 2; i++)
     {
         equipsData.weapons[i] = Resources.Load <EquipEntity>("Data/Entity/Equips/Equip_Weapon_0" + (i + 1));
     }
     equipsData.headers = new EquipEntity[1];
     for (int i = 0; i < equipsData.headers.Length; i++)
     {
         equipsData.headers[i] = Resources.Load <EquipEntity>("Data/Entity/Equips/Equip_Header_0" + (i + 1));
     }
     skillsData            = new SkillsData();
     skillsData.skillType1 = new SkillEntity[8];
     for (int i = 0; i < skillsData.skillType1.Length; i++)
     {
         skillsData.skillType1[i] = Resources.Load <SkillEntity>("Data/Entity/Skills/Skill_Type1_0" + (i + 1));
     }
     skillsData.skillType2 = new SkillEntity[8];
     for (int i = 0; i < skillsData.skillType2.Length; i++)
     {
         skillsData.skillType2[i] = Resources.Load <SkillEntity>("Data/Entity/Skills/Skill_Type2_0" + (i + 1));
     }
     skillsData.skillType3 = new SkillEntity[8];
     for (int i = 0; i < skillsData.skillType3.Length; i++)
     {
         skillsData.skillType3[i] = Resources.Load <SkillEntity>("Data/Entity/Skills/Skill_Type3_0" + (i + 1));
     }
     skillsData.skillType4 = new SkillEntity[8];
     for (int i = 0; i < skillsData.skillType4.Length; i++)
     {
         skillsData.skillType4[i] = Resources.Load <SkillEntity>("Data/Entity/Skills/Skill_Type4_0" + (i + 1));
     }
     skillsData.skillType5 = new SkillEntity[8];
     for (int i = 0; i < skillsData.skillType5.Length; i++)
     {
         skillsData.skillType5[i] = Resources.Load <SkillEntity>("Data/Entity/Skills/Skill_Type5_0" + (i + 1));
     }
     Constant.InitDescriptions();
     baseAbilityDes = Constant.baseAbilityDes;
 }
Ejemplo n.º 13
0
        public override void levelXInit(SkillsData sData, int level)
        {
            base.priceAP       = Convert.ToInt32(sData.skillAPCost[level]);
            base.priceENE      = Convert.ToInt32(sData.skillEneCost[level]);
            base.skillCooldown = Convert.ToInt32(sData.skillCooldown[level]);
            base.skillTargets  = new SkillTargets(sData.skillValues[level]["Targets"]);

            talismanDecreasePowerVal = Convert.ToInt32(sData.skillValues[level]["val1"]);
            talismanRechargePowerVal = Convert.ToInt32(sData.skillValues[level]["val2"]);
        }
Ejemplo n.º 14
0
        public override void levelXInit(SkillsData sData, int level)
        {
            base.priceAP       = Convert.ToInt32(sData.skillAPCost[level]);
            base.priceENE      = Convert.ToInt32(sData.skillEneCost[level]);
            base.skillCooldown = Convert.ToInt32(sData.skillCooldown[level]);
            base.skillTargets  = new SkillTargets(sData.skillValues[level]["Targets"]);

            physDmg      = Convert.ToInt32(sData.skillValues[level]["PhysDmg"]);
            cursedDmgMod = Convert.ToInt32(sData.skillValues[level]["CursedSigngDmgMod"]);
        }
Ejemplo n.º 15
0
        public override void levelXInit(SkillsData sData, int level)
        {
            base.priceAP       = Convert.ToInt32(sData.skillAPCost[level]);
            base.priceENE      = Convert.ToInt32(sData.skillEneCost[level]);
            base.skillCooldown = Convert.ToInt32(sData.skillCooldown[level]);
            base.skillTargets  = new SkillTargets(sData.skillValues[level]["Targets"]);

            dmgBonusPercentMark = Convert.ToInt32(sData.skillValues[level]["DamageBonusPercentMark"]);
            sDuration           = Convert.ToInt32(sData.skillValues[level]["Time"]);
        }
Ejemplo n.º 16
0
 public static string getSkillDuration(SkillsData skillData, int level, Dictionary <string, string> systemMessages)
 {
     if (!skillData.skillValues[level - 1].ContainsKey("Time"))
     {
         return(systemMessages["ThereIsnoDuration"]);
     }
     else
     {
         return(skillData.skillValues[level - 1]["Time"]);
     }
 }
Ejemplo n.º 17
0
        public override void levelXInit(SkillsData sData, int level)
        {
            base.priceAP       = Convert.ToInt32(sData.skillAPCost[level]);
            base.priceENE      = Convert.ToInt32(sData.skillEneCost[level]);
            base.skillCooldown = Convert.ToInt32(sData.skillCooldown[level]);
            base.skillTargets  = new SkillTargets(sData.skillValues[level]["Targets"]);

            physDmg      = Convert.ToInt32(sData.skillValues[level]["PhysDmg"]);
            steallDefVal = Convert.ToBoolean(sData.skillValues[level]["SteallAllDef"]);
            sDuration    = Convert.ToInt32(sData.skillValues[level]["Time"]);
        }
Ejemplo n.º 18
0
        public long BiggestHit(int skillId)
        {
            var result = from skill in Skills
                         where skill.Key.Id == skillId
                         from source in skill.Value
                         select SkillsData.BiggestHit(source, _target, skill.Key.Id, _timed, _petinfo, Type);

            var enumerable = result as long[] ?? result.ToArray();

            return(!enumerable.Any() ? 0 : enumerable.Max());
        }
Ejemplo n.º 19
0
        public long LowestCrit()
        {
            var result = from skill in Skills
                         from source in skill.Value
                         let res = SkillsData.LowestCrit(source, _target, skill.Key.Id, _timed, Type)
                                   where res != 0
                                   select res;
            var enumerable = result as long[] ?? result.ToArray();

            return(!enumerable.Any() ? 0 : enumerable.Min());
        }
Ejemplo n.º 20
0
        public long White(int skillId)
        {
            var result = from skill in Skills
                         where skill.Key.Id == skillId
                         from source in skill.Value
                         select SkillsData.White(source, _target, skill.Key.Id, _timed, skill.Key.NpcInfo, Type);

            var enumerable = result as int[] ?? result.ToArray();

            return(!enumerable.Any() ? 0 : enumerable.Sum());
        }
Ejemplo n.º 21
0
        public override void levelXInit(SkillsData sData, int level)
        {
            base.priceAP       = Convert.ToInt32(sData.skillAPCost[level]);
            base.priceENE      = Convert.ToInt32(sData.skillEneCost[level]);
            base.skillCooldown = Convert.ToInt32(sData.skillCooldown[level]);
            base.skillTargets  = new SkillTargets(sData.skillValues[level]["Targets"]);

            airDmg        = Convert.ToInt32(sData.skillValues[level]["AirDmg"]);
            randomDefDecr = Convert.ToInt32(sData.skillValues[level]["RandomDefDecr"]);
            sDuration     = Convert.ToInt32(sData.skillValues[level]["Time"]);
        }
Ejemplo n.º 22
0
        public override void levelXInit(SkillsData sData, int level)
        {
            base.priceAP       = Convert.ToInt32(sData.skillAPCost[level]);
            base.priceENE      = Convert.ToInt32(sData.skillEneCost[level]);
            base.skillCooldown = Convert.ToInt32(sData.skillCooldown[level]);
            base.skillTargets  = new SkillTargets(sData.skillValues[level]["Targets"]);

            fireDmg   = Convert.ToInt32(sData.skillValues[level]["FireDmg"]);
            burnDmg   = Convert.ToInt32(sData.skillValues[level]["BurningFireDmg"]);
            sDuration = Convert.ToInt32(sData.skillValues[level]["Time"]);
        }
Ejemplo n.º 23
0
        public override void levelXInit(SkillsData sData, int level)
        {
            base.priceAP       = Convert.ToInt32(sData.skillAPCost[level]);
            base.priceENE      = Convert.ToInt32(sData.skillEneCost[level]);
            base.skillCooldown = Convert.ToInt32(sData.skillCooldown[level]);
            base.skillTargets  = new SkillTargets(sData.skillValues[level]["Targets"]);

            ricochetChance = Convert.ToInt32(sData.skillValues[level]["RicochetChance"]);
            ricochetCount  = Convert.ToInt32(sData.skillValues[level]["RicochetCount"]);
            sDuration      = Convert.ToInt32(sData.skillValues[level]["Time"]);
        }
Ejemplo n.º 24
0
        private string getLocalisedText(SkillsLocalisationData localisation, SkillsData data, int skillLevel)
        {
            string fullDescription = localisation.skillLocalisedLevelDescription[skillLevel - 1];

            foreach (KeyValuePair <string, string> pair in data.skillValues[skillLevel - 1])
            {
                fullDescription = fullDescription.Replace("$" + pair.Key + "$", pair.Value);
            }

            return(fullDescription);
        }
Ejemplo n.º 25
0
        public override void levelXInit(SkillsData sData, int level)
        {
            base.priceAP       = Convert.ToInt32(sData.skillAPCost[level]);
            base.priceENE      = Convert.ToInt32(sData.skillEneCost[level]);
            base.skillCooldown = Convert.ToInt32(sData.skillCooldown[level]);
            base.skillTargets  = new SkillTargets(sData.skillValues[level]["Targets"]);

            allDefdecrVal   = Convert.ToInt32(sData.skillValues[level]["AllDefDecr"]);
            criticalChBonus = Convert.ToInt32(sData.skillValues[level]["CrStrikeChancePlus"]);
            sDuration       = Convert.ToInt32(sData.skillValues[level]["Time"]);
        }
Ejemplo n.º 26
0
        public override void levelXInit(SkillsData sData, int level)
        {
            base.priceAP       = Convert.ToInt32(sData.skillAPCost[level]);
            base.priceENE      = Convert.ToInt32(sData.skillEneCost[level]);
            base.skillCooldown = Convert.ToInt32(sData.skillCooldown[level]);
            base.skillTargets  = new SkillTargets(sData.skillValues[level]["Targets"]);

            comboModIncr     = Convert.ToInt32(sData.skillValues[level]["CombomodIncr"]);
            damageToHeroIncr = Convert.ToInt32(sData.skillValues[level]["damageToHeroIncr"]);
            sDuration        = Convert.ToInt32(sData.skillValues[level]["Time"]);
        }
Ejemplo n.º 27
0
        public override void levelXInit(SkillsData sData, int level)
        {
            base.priceAP       = Convert.ToInt32(sData.skillAPCost[level]);
            base.priceENE      = Convert.ToInt32(sData.skillEneCost[level]);
            base.skillCooldown = Convert.ToInt32(sData.skillCooldown[level]);
            base.skillTargets  = new SkillTargets(sData.skillValues[level]["Targets"]);

            addResistFromIncomingDmg = Convert.ToBoolean(sData.skillValues[level]["AddResitFromIncomingDamage"]);
            addResistVal             = Convert.ToInt32(sData.skillValues[level]["AddDefVal"]);
            sDuration = Convert.ToInt32(sData.skillValues[level]["Time"]);
        }
Ejemplo n.º 28
0
        public long AmountCrit(int skillId)
        {
            var result = from skill in Skills
                         where skill.Key.Id == skillId
                         from source in skill.Value
                         select SkillsData.AmountCrit(source, _target, skill.Key.Id, _timed, Type);

            var enumerable = result as long[] ?? result.ToArray();

            return(!enumerable.Any() ? 0 : enumerable.Sum());
        }
Ejemplo n.º 29
0
        public override void levelXInit(SkillsData sData, int level)
        {
            base.priceAP       = Convert.ToInt32(sData.skillAPCost[level]);
            base.priceENE      = Convert.ToInt32(sData.skillEneCost[level]);
            base.skillCooldown = Convert.ToInt32(sData.skillCooldown[level]);
            base.skillTargets  = new SkillTargets(sData.skillValues[level]["Targets"]);

            allDefBonus        = Convert.ToInt32(sData.skillValues[level]["addAllDef"]);
            allDmgBonusPercent = Convert.ToInt32(sData.skillValues[level]["DamageBonusPercent"]);
            talismanPowerRegenerationPercent = Convert.ToInt32(sData.skillValues[level]["TalismanRegeneration"]);
        }
Ejemplo n.º 30
0
        public override void levelXInit(SkillsData sData, int level)
        {
            base.priceAP       = Convert.ToInt32(sData.skillAPCost[level]);
            base.priceENE      = Convert.ToInt32(sData.skillEneCost[level]);
            base.skillCooldown = Convert.ToInt32(sData.skillCooldown[level]);
            base.skillTargets  = new SkillTargets(sData.skillValues[level]["Targets"]);

            lightningDmgMod  = Convert.ToInt32(sData.skillValues[level]["LightningDmgMod"]);
            crStriceBonusDmg = Convert.ToInt32(sData.skillValues[level]["CrStrikeDmgPlus"]);
            sDuration        = Convert.ToInt32(sData.skillValues[level]["Time"]);
        }
Ejemplo n.º 31
0
    // Use this for initialization
    public ServerSkills()
    {
        functionName = "Skills";
        // Database tables name
        tableName = "skills";
        functionTitle = "Skills Configuration";
        loadButtonLabel = "Load Skills";
        notLoadedText = "No Skill loaded.";
        // Init
        dataRegister = new Dictionary<int, SkillsData> ();

        editingDisplay = new SkillsData ();
        originalDisplay = new SkillsData ();
    }
Ejemplo n.º 32
0
    // Draw the loaded list
    public override void DrawLoaded(Rect box)
    {
        // Setup the layout
        Rect pos = box;
        pos.x += ImagePack.innerMargin;
        pos.y += ImagePack.innerMargin;
        pos.width -= ImagePack.innerMargin;
        pos.height = ImagePack.fieldHeight;

        if (dataRegister.Count <= 0) {
            pos.y += ImagePack.fieldHeight;
            ImagePack.DrawLabel (pos.x, pos.y, "You must create a Skill before edit it.");
            return;
        }

        // Draw the content database info
        ImagePack.DrawLabel (pos.x, pos.y, "Skills Configuration");

        if (newItemCreated) {
            newItemCreated = false;
            LoadSelectList ();
            newSelectedDisplay = displayKeys.Count - 1;
        }

        // Draw data Editor
        if (newSelectedDisplay != selectedDisplay) {
            selectedDisplay = newSelectedDisplay;
            int displayKey = displayKeys [selectedDisplay];
            editingDisplay = dataRegister [displayKey];
            originalDisplay = editingDisplay.Clone ();
        }

        //if (!displayList.showList) {
        pos.y += ImagePack.fieldHeight;
        pos.x -= ImagePack.innerMargin;
        pos.y -= ImagePack.innerMargin;
        pos.width += ImagePack.innerMargin;
        DrawEditor (pos, false);
        pos.y -= ImagePack.fieldHeight;
        //pos.x += ImagePack.innerMargin;
        pos.y += ImagePack.innerMargin;
        pos.width -= ImagePack.innerMargin;
        //}

        if (state != State.Loaded) {
            // Draw combobox
            pos.width /= 2;
            pos.x += pos.width;
            newSelectedDisplay = ImagePack.DrawCombobox (pos, "", selectedDisplay, displayList);
            pos.x -= pos.width;
            pos.width *= 2;
        }
    }
Ejemplo n.º 33
0
    // Load Database Data
    public override void Load()
    {
        if (!dataLoaded) {
            // Clean old data
            dataRegister.Clear ();
            displayKeys.Clear ();

            // Read all entries from the table
            string query = "SELECT * FROM " + tableName;

            // If there is a row, clear it.
            if (rows != null)
                rows.Clear ();

            // Load data
            rows = DatabasePack.LoadData (DatabasePack.contentDatabasePrefix, query);
            //Debug.Log("#Rows:"+rows.Count);
            // Read all the data
            if ((rows != null) && (rows.Count > 0)) {
                foreach (Dictionary<string,string> data in rows) {
                    //foreach(string key in data.Keys)
                    //	Debug.Log("Name[" + key + "]:" + data[key]);
                    //return;
                    SkillsData display = new SkillsData ();

                    display.id = int.Parse (data ["id"]);
                    display.name = data ["name"];
                    display.icon = data ["icon"];
                    display.aspect = data ["aspect"];
                    display.oppositeAspect = data ["oppositeAspect"];
                    display.primaryStat = data ["primaryStat"];
                    display.secondaryStat = data ["secondaryStat"];
                    display.thirdStat = data ["thirdStat"];
                    display.fourthStat = data ["fourthStat"];

                    display.maxLevel = int.Parse (data ["maxLevel"]);
                    display.automaticallyLearn = bool.Parse (data ["automaticallyLearn"]);
                    display.skillPointCost = int.Parse (data ["skillPointCost"]);
                    display.parentSkill = int.Parse (data ["parentSkill"]);
                    display.parentSkillLevelReq = int.Parse (data ["parentSkillLevelReq"]);

                    display.prereqSkill1 = int.Parse (data ["prereqSkill1"]);
                    display.prereqSkill1Level = int.Parse (data ["prereqSkill1Level"]);
                    display.prereqSkill2 = int.Parse (data ["prereqSkill2"]);
                    display.prereqSkill2Level = int.Parse (data ["prereqSkill2Level"]);
                    display.prereqSkill3 = int.Parse (data ["prereqSkill3"]);
                    display.prereqSkill3Level = int.Parse (data ["prereqSkill3Level"]);
                    display.playerLevelReq = int.Parse (data ["playerLevelReq"]);

                    display.isLoaded = true;
                    //Debug.Log("Name:" + display.name  + "=[" +  display.id  + "]");
                    dataRegister.Add (display.id, display);
                    displayKeys.Add (display.id);
                }
                LoadSelectList ();
            }
            dataLoaded = true;
            foreach (SkillsData skillData in dataRegister.Values) {
                LoadSkillAbilities (skillData);
            }
        }
    }
Ejemplo n.º 34
0
    // Edit or Create
    public override void DrawEditor(Rect box, bool newItem)
    {
        // Setup the layout
        Rect pos = box;
        pos.x += ImagePack.innerMargin;
        pos.y += ImagePack.innerMargin;
        pos.width -= ImagePack.innerMargin;
        pos.height = ImagePack.fieldHeight;

        if (!linkedTablesLoaded) {
            LoadAbilityOptions ();
            LoadSkillOptions();
            LoadStatOptions ();
            aspectOptions = ServerOptionChoices.LoadAtavismChoiceOptions("Class", true);
            linkedTablesLoaded = true;
        }

        // Draw the content database info
        //pos.y += ImagePack.fieldHeight;

        if (newItem) {
            ImagePack.DrawLabel (pos.x, pos.y, "Create a new Skill");
            pos.y += ImagePack.fieldHeight;
        }

        editingDisplay.name = ImagePack.DrawField (pos, "Name:", editingDisplay.name, 0.75f);
        pos.y += ImagePack.fieldHeight;
        pos.width /= 2;
        editingDisplay.maxLevel = ImagePack.DrawField (pos, "Max Level:", editingDisplay.maxLevel);
        pos.x += pos.width;
        editingDisplay.icon = ImagePack.DrawTextureAsset (pos, "Icon:", editingDisplay.icon);
        pos.x -= pos.width;
        pos.y += ImagePack.fieldHeight;
        editingDisplay.skillPointCost = ImagePack.DrawField (pos, "Skill Point Cost:", editingDisplay.skillPointCost);
        pos.y += ImagePack.fieldHeight;
        editingDisplay.automaticallyLearn = ImagePack.DrawToggleBox (pos, "Automatically Learn:", editingDisplay.automaticallyLearn);
        pos.y += ImagePack.fieldHeight * 2f;
        editingDisplay.aspect = ImagePack.DrawSelector (pos, "Skill Class:", editingDisplay.aspect, aspectOptions);
        pos.x += pos.width;
        editingDisplay.oppositeAspect = ImagePack.DrawSelector (pos, "Opposite Class:", editingDisplay.oppositeAspect, aspectOptions);
        pos.x -= pos.width;
        pos.y += ImagePack.fieldHeight;
        editingDisplay.primaryStat = ImagePack.DrawSelector (pos, "Primary Stat:", editingDisplay.primaryStat, statOptions);
        pos.x += pos.width;
        editingDisplay.secondaryStat = ImagePack.DrawSelector (pos, "Secondary Stat:", editingDisplay.secondaryStat, statOptions);
        pos.x -= pos.width;
        pos.y += ImagePack.fieldHeight;
        editingDisplay.thirdStat = ImagePack.DrawSelector (pos, "Third Stat:", editingDisplay.thirdStat, statOptions);
        pos.x += pos.width;
        editingDisplay.fourthStat = ImagePack.DrawSelector (pos, "Fourth Stat:", editingDisplay.fourthStat, statOptions);
        pos.x -= pos.width;
        pos.y += 1.5f * ImagePack.fieldHeight;
        // Requirements
        ImagePack.DrawLabel (pos.x, pos.y, "Requirements");
        pos.y += ImagePack.fieldHeight;
        int selectedSkill = GetPositionOfSkill (editingDisplay.parentSkill);
        selectedSkill = ImagePack.DrawSelector (pos, "Parent Skill:", selectedSkill, skillOptions);
        editingDisplay.parentSkill = skillIds[selectedSkill];
        pos.x += pos.width;
        editingDisplay.parentSkillLevelReq = ImagePack.DrawField (pos, "Skill Level Req:", editingDisplay.parentSkillLevelReq);
        pos.x -= pos.width;
        pos.y += ImagePack.fieldHeight;
        // prereq 1
        selectedSkill = GetPositionOfSkill (editingDisplay.prereqSkill1);
        selectedSkill = ImagePack.DrawSelector (pos, "Prereq Skill 1:", selectedSkill, skillOptions);
        editingDisplay.prereqSkill1 = skillIds[selectedSkill];
        pos.x += pos.width;
        editingDisplay.prereqSkill1Level = ImagePack.DrawField (pos, "Skill Level Req:", editingDisplay.prereqSkill1Level);
        pos.x -= pos.width;
        pos.y += ImagePack.fieldHeight;
        // prereq 2
        selectedSkill = GetPositionOfSkill (editingDisplay.prereqSkill2);
        selectedSkill = ImagePack.DrawSelector (pos, "Prereq Skill 2:", selectedSkill, skillOptions);
        editingDisplay.prereqSkill2 = skillIds[selectedSkill];
        pos.x += pos.width;
        editingDisplay.prereqSkill2Level = ImagePack.DrawField (pos, "Skill Level Req:", editingDisplay.prereqSkill2Level);
        pos.x -= pos.width;
        pos.y += ImagePack.fieldHeight;
        // prereq 3
        selectedSkill = GetPositionOfSkill (editingDisplay.prereqSkill3);
        selectedSkill = ImagePack.DrawSelector (pos, "Prereq Skill 3:", selectedSkill, skillOptions);
        editingDisplay.prereqSkill3 = skillIds[selectedSkill];
        pos.x += pos.width;
        editingDisplay.prereqSkill3Level = ImagePack.DrawField (pos, "Skill Level Req:", editingDisplay.prereqSkill3Level);
        pos.x -= pos.width;
        pos.y += ImagePack.fieldHeight;
        editingDisplay.playerLevelReq = ImagePack.DrawField (pos, "Player Level Req:", editingDisplay.playerLevelReq);
        pos.y += 1.5f * ImagePack.fieldHeight;
        ImagePack.DrawLabel (pos.x, pos.y, "Skill Abilities");
        pos.y += 1.5f * ImagePack.fieldHeight;
        if (editingDisplay.skillAbilities.Count == 0) {
            editingDisplay.skillAbilities.Add (new SkillAbilityEntry (0, -1));
        }
        for (int i = 0; i < editingDisplay.skillAbilities.Count; i++) {
            editingDisplay.skillAbilities [i].skillLevelReq = ImagePack.DrawField (pos, "Level:", editingDisplay.skillAbilities [i].skillLevelReq);
            pos.x += pos.width;
            int selectedAbility = GetPositionOfAbility (editingDisplay.skillAbilities [i].abilityID);
            selectedAbility = ImagePack.DrawSelector (pos, "Ability " + (i + 1) + ":", selectedAbility, abilityOptions);
            editingDisplay.skillAbilities [i].abilityID = abilityIds [selectedAbility];
            pos.x -= pos.width;
            pos.y += ImagePack.fieldHeight;
            editingDisplay.skillAbilities [i].automaticallyLearn = ImagePack.DrawToggleBox (pos, "Automatically Learn:", editingDisplay.skillAbilities [i].automaticallyLearn);
            pos.x += pos.width;
            if (ImagePack.DrawButton (pos.x, pos.y, "Remove Ability")) {
                if (editingDisplay.skillAbilities[i].id > 0)
                    editingDisplay.abilitiesToBeDeleted.Add(editingDisplay.skillAbilities[i].id);
                editingDisplay.skillAbilities.RemoveAt(i);
            }
            pos.x -= pos.width;
            pos.y += ImagePack.fieldHeight;
        }
        if (ImagePack.DrawButton (pos.x, pos.y, "Add Ability")) {
            editingDisplay.skillAbilities.Add (new SkillAbilityEntry (0, -1));
        }

        pos.width *= 2;
        pos.y += 1.4f * ImagePack.fieldHeight;
        // Save data
        pos.x -= ImagePack.innerMargin;
        pos.width /= 3;
        if (ImagePack.DrawButton (pos.x, pos.y, "Save Data")) {
            if (newItem)
                InsertEntry ();
            else
                UpdateEntry ();

            state = State.Loaded;
        }

        // Delete data
        if (!newItem) {
            pos.x += pos.width;
            if (ImagePack.DrawButton (pos.x, pos.y, "Delete Data")) {
                DeleteEntry ();
                newSelectedDisplay = 0;
                state = State.Loaded;
            }
        }

        // Cancel editing
        pos.x += pos.width;
        if (ImagePack.DrawButton (pos.x, pos.y, "Cancel")) {
            editingDisplay = originalDisplay.Clone ();
            if (newItem)
                state = State.New;
            else
                state = State.Loaded;
        }

        if (resultTimeout != -1 && resultTimeout > Time.realtimeSinceStartup) {
            pos.y += ImagePack.fieldHeight;
            ImagePack.DrawText (pos, result);
        }

        if (!newItem)
            EnableScrollBar (pos.y - box.y + ImagePack.fieldHeight + 28);
        else
            EnableScrollBar (pos.y - box.y + ImagePack.fieldHeight);
    }
Ejemplo n.º 35
0
    void LoadSkillAbilities(SkillsData skillData)
    {
        // Read all entries from the table
        string query = "SELECT * FROM " + "skill_ability_gain" + " where skillID = " + skillData.id;

        // If there is a row, clear it.
        if (rows != null)
            rows.Clear ();

        // Load data
        rows = DatabasePack.LoadData (DatabasePack.contentDatabasePrefix, query);
        //Debug.Log("#Rows:"+rows.Count);
        // Read all the data
        if ((rows != null) && (rows.Count > 0)) {
            foreach (Dictionary<string,string> data in rows) {
                SkillAbilityEntry entry = new SkillAbilityEntry ();

                entry.id = int.Parse (data ["id"]);
                entry.skillLevelReq = int.Parse (data ["skillLevelReq"]);
                entry.abilityID = int.Parse (data ["abilityID"]);
                entry.automaticallyLearn = bool.Parse (data ["automaticallyLearn"]);
                skillData.skillAbilities.Add (entry);
            }
        }
    }
Ejemplo n.º 36
0
 public override void CreateNewData()
 {
     editingDisplay = new SkillsData ();
     originalDisplay = new SkillsData ();
     selectedDisplay = -1;
 }