Write() public static method

public static Write ( Object obj ) : void
obj Object
return void
示例#1
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++;
            }
        }
示例#2
0
        public void loadMobs(string path)
        {
            // This is just an example of loading CSV
            //return dataTable;
            Output.Write("Loading Hostile Mobs ..");
            ArrayList goDB      = loadCSV(path, ';');
            int       linecount = 1;

            foreach (string[] data in goDB)
            {
                //Output.WriteLine("Show Colums for Line : " + linecount.ToString() + " GOID:  " + data[1].ToString() + " Name " + data[0].ToString());
                if (linecount > 1)
                {
                    UInt64 currentEntityId = WorldSocket.entityIdCounter;
                    WorldSocket.entityIdCounter++;
                    uint rotation = 0;
                    if (data[10].Length > 0)
                    {
                        rotation = uint.Parse(data[10]);
                    }


                    if (data[4].Length > 0 && data[5].Length > 0)
                    {
                        bool error  = false;
                        Mob  theMob = new Mob();
                        theMob.setEntityId(currentEntityId);
                        theMob.setDistrict(Convert.ToUInt16(data[0]));
                        theMob.setDistrictName(data[1]);
                        theMob.setName(data[2]);
                        theMob.setLevel(ushort.Parse(data[3]));
                        theMob.setHealthM(UInt16.Parse(data[4]));
                        theMob.setHealthC(UInt16.Parse(data[4])); // As max Health should be the current onload
                        if (UInt16.Parse(data[4]) == 0)
                        {
                            error = true;
                        }

                        theMob.setMobId((ushort)linecount);
                        theMob.setRsiHex(data[6]);
                        if (!isNumberEven(data[6].Length))
                        {
                            error = true;
                        }

                        theMob.setXPos(double.Parse(data[7]));
                        theMob.setYPos(double.Parse(data[8]));
                        theMob.setZPos(double.Parse(data[9]));
                        theMob.xBase = double.Parse(data[7]);
                        theMob.yBase = double.Parse(data[8]);
                        theMob.zBase = double.Parse(data[9]);
                        theMob.setRotation(rotation);
                        theMob.setIsDead(bool.Parse(data[11]));
                        theMob.setIsLootable(bool.Parse(data[12]));
                        // Init the Mob Update
                        if (!error)
                        {
                            theMob.DoMobUpdate(theMob);
                            WorldSocket.mobs.Add(theMob);
                            WorldSocket.gameServerEntities.Add(theMob);
                        }
                    }
                }

                linecount++;
            }
        }