Example #1
0
        public void processAbility(ref byte[] packet)
        {
            byte[] ability    = { packet[0], packet[1] };
            byte[] targetView = { packet[2], packet[3] };
            UInt16 AbilityID  = NumericalUtils.ByteArrayToUint16(ability, 1);

            UInt16 viewId = 0;

            currentTargetViewId = NumericalUtils.ByteArrayToUint16(targetView, 1);


            // load the ability name from a list to see if we match the right ability
            DataLoader AbilityLoader = DataLoader.getInstance();

            this.currentAbility = AbilityLoader.getAbilityByID(AbilityID);

            // lets create a message for the client - we will later execute the right AbilityScript for it
            ServerPackets pak = new ServerPackets();

            pak.sendSystemChatMessage(Store.currentClient,
                                      "Ability ID is " + AbilityID.ToString() + " and the name is " + currentAbility.getAbilityName() +
                                      " and Target ViewId Is " + currentTargetViewId, "BROADCAST");

            // ToDo: do something with the entity (or queue a fx hit animation or something lol)
            this.processAbilityScript(this.currentAbility);
        }
Example #2
0
        public void processSelfAnimation(AbilityItem ability)
        {
//            ServerPackets serverPackets = new ServerPackets();
//            serverPackets.sendAbilitySelfAnimation(2, ability.getAbilityID(), (UInt32) ability.getAbilityExecutionFX());

            ServerPackets serverPackets = new ServerPackets();

            serverPackets.sendAbilitySelfAnimation(2, ability.getAbilityID(), NumericalUtils.ByteArrayToUint32(ability.getCastAnimStart(), 1));
        }
Example #3
0
        public void processAbilityScript(AbilityItem abilityItem)
        {
            // Display Cast Bar if it is necessary
            ServerPackets pak = new ServerPackets();

            if (this.currentAbility.getCastingTime() > 0)
            {
                pak.sendCastAbilityBar(this.currentAbility.getAbilityID(), this.currentAbility.getCastingTime());
                this.processSelfAnimation(abilityItem);
            }
            this.processCharacterAnimationSelf(abilityItem.getAbilityID());

            if (currentAbility.getAbilityID() == 12 || currentAbility.getAbilityID() == 184)
            {
                pak.sendHyperSpeed();
            }
            pak.sendISCurrent(Store.currentClient, 50);
        }
Example #4
0
        public AbilityItem getAbilityByID(UInt16 id)
        {
            AbilityItem abTemp = AbilityDB.Find(delegate(AbilityItem a) { return(a.getAbilityID() == id); });

            return(abTemp);
        }
Example #5
0
        public void loadAbilityDB(string path)
        {
            Output.Write("Loading Abilities..");

            // load the CSV into an ArrayList collection
            ArrayList abilityDB = loadCSV(path, ';');

            int linecount = 1;

            // Create a new List



            foreach (string[] data in abilityDB)
            {
                AbilityItem ability = new AbilityItem();
                // we want to skip the first line as it should have the Names
                if (linecount > 1)
                {
                    ability.setAbilityID(Convert.ToUInt16(data[0]));
                    ability.setGOID(Convert.ToInt32(data[1]));
                    ability.setAbilityName(data[2]);
                    if (data[3].Length > 0)
                    {
                        ability.setIsCastable(bool.Parse(data[3]));
                    }

                    if (data.Length >= 5)
                    {
                        if (data[4].Length > 0)
                        {
                            ability.setCastingTime(float.Parse(data[4], CultureInfo.InvariantCulture));
                        }
                    }

                    if (data.Length >= 6)
                    {
                        if (data[5].Length > 2)
                        {
                            ability.setCastAnimStart(StringUtils.hexStringToBytes(data[5]));
                        }
                    }

                    if (data.Length >= 7)
                    {
                        if (data[6].Length > 2)
                        {
                            ability.setCastAnimMid(StringUtils.hexStringToBytes((data[6])));
                        }
                    }

                    if (data.Length >= 8)
                    {
                        if (data[7].Length > 2)
                        {
                            ability.setCastAnimEnd(StringUtils.hexStringToBytes(data[7]));
                        }
                    }

                    if (data.Length >= 9)
                    {
                        if (data[8].Length > 0)
                        {
                            ability.setActivationFX(UInt32.Parse(data[8]));
                        }
                    }

                    if (data.Length >= 10)
                    {
                        if (data[9].Length > 0)
                        {
                            ability.setValueFrom(Int16.Parse(data[9]));
                        }
                    }

                    if (data.Length >= 11)
                    {
                        if (data[10].Length > 0)
                        {
                            ability.setValueTo(UInt16.Parse(data[10]));
                        }
                    }

                    if (data.Length >= 12)
                    {
                        if (data[11].Length > 0)
                        {
                            ability.setIsBuff(bool.Parse(data[11]));
                        }
                    }

                    if (data.Length >= 13)
                    {
                        if (data[12].Length > 0)
                        {
                            CultureInfo ci = (CultureInfo)CultureInfo.CurrentCulture.Clone();
                            ci.NumberFormat.CurrencyDecimalSeparator = ".";
                            ability.setBuffTime(float.Parse(data[12], NumberStyles.Any, ci));
                        }
                    }

                    if (data.Length >= 14)
                    {
                        if (data[13].Length > 0)
                        {
                            ability.setAbilityExecutionFX(UInt32.Parse(data[13]));
                        }
                    }

                    AbilityDB.Add(ability);
                }


                linecount++;
            }
        }
Example #6
0
        public void loadAbilityDB(string path)
        {
            Output.Write("Loading Abilities..");

            // load the CSV into an ArrayList collection
            ArrayList abilityDB = loadCSV(path,';');

            int linecount = 1;

            // Create a new List

            foreach (string[] data in abilityDB)
            {

                //Output.WriteLine("Show Colums for Line : " + linecount.ToString() + " Ability ID:  " + data[0].ToString() + " GOID " + data[1].ToString() + " Ability Name : " + data[2].ToString());
                AbilityItem ability = new AbilityItem();
                // we want to skip the first line as it should have the Names
                if (linecount > 1)
                {
                    ability.setAbilityID(Convert.ToUInt16(data[0].ToString()));
                    ability.setGOID(Convert.ToInt32(data[1].ToString()));
                    ability.setAbilityName(data[2].ToString());
                    if (data[3].ToString().Length > 0)
                    {
                        ability.setIsCastable(bool.Parse(data[3].ToString()));
                    }

                    if (data.Length >= 5)
                    {
                        if (data[4].ToString().Length > 0)
                        {
                            CultureInfo ci = (CultureInfo)CultureInfo.CurrentCulture.Clone();
                            ci.NumberFormat.CurrencyDecimalSeparator = ".";
                            ability.setCastingTime(float.Parse(data[4].ToString(), NumberStyles.Any, ci));
                        }
                    }

                    if (data.Length >= 6)
                    {
                        if (data[5].ToString().Length > 2)
                        {
                            ability.setCastAnimStart(StringUtils.hexStringToBytes(data[5].ToString()));
                        }
                    }

                    if (data.Length >= 7)
                    {
                        if (data[6].ToString().Length > 2)
                        {
                            ability.setCastAnimMid(StringUtils.hexStringToBytes((data[6].ToString())));
                        }
                    }

                    if (data.Length >= 8)
                    {
                        if (data[7].ToString().Length > 2)
                        {
                            ability.setCastAnimEnd(StringUtils.hexStringToBytes(data[7].ToString()));
                        }
                    }

                    if (data.Length >= 9)
                    {
                        if (data[8].ToString().Length > 0)
                        {
                            ability.setActivationFX(UInt32.Parse(data[8].ToString()));
                        }
                    }

                    if (data.Length >= 10)
                    {
                        if (data[9].ToString().Length > 0)
                        {
                            ability.setValueFrom(Int16.Parse(data[9].ToString()));
                        }
                    }

                    if (data.Length >= 11)
                    {
                        if (data[10].ToString().Length > 0)
                        {
                            ability.setValueTo(UInt16.Parse(data[10].ToString()));
                        }
                    }

                    if (data.Length >= 12)
                    {
                        if (data[11].ToString().Length > 0)
                        {
                            ability.setIsBuff(bool.Parse(data[11].ToString()));
                        }
                    }

                    if (data.Length >= 13)
                    {
                        if (data[12].ToString().Length > 0)
                        {
                            CultureInfo ci = (CultureInfo)CultureInfo.CurrentCulture.Clone();
                            ci.NumberFormat.CurrencyDecimalSeparator = ".";
                            ability.setBuffTime(float.Parse(data[12].ToString(), NumberStyles.Any, ci));
                        }
                    }

                    if (data.Length >= 14)
                    {
                        if (data[13].ToString().Length > 0)
                        {
                            ability.setAbilityExecutionFX(UInt32.Parse(data[13].ToString()));
                        }
                    }

                    this.AbilityDB.Add(ability);
                }

                linecount++;
            }
        }