public static byte[] CreateFormedParty(WorldMgr.party pt)
 {
     //Create new packet writer
     PacketWriter Writer = new PacketWriter();
     //Add opcode to packet
     Writer.Create(OperationCode.SERVER_FORMED_PARTY_CREATED);
     //Static byte
     Writer.Byte(1);
     //Party id
     Writer.DWord(pt.ptid);
     //0 Dword value
     Writer.DWord(0);
     //Party type
     Writer.Byte(pt.Type);
     //Party purpose
     Writer.Byte(pt.ptpurpose);
     //Party min level required
     Writer.Byte(pt.minlevel);
     //Party max level allowed
     Writer.Byte(pt.maxlevel);
     //Party name
     Writer.Text3(pt.partyname);
     //Return all bytes to send
     return Writer.GetBytes();
 }
        public static byte[] PrivateMessageCheck(WorldMgr.character c)
        {
            DB ms = new DB("SELECT * FROM message WHERE receiver='" + c.Information.Name + "'");
            PacketWriter Writer = new PacketWriter();
            int count = ms.Count();

            Writer.Create(OperationCode.SERVER_PM_MESSAGE);
            Writer.Byte(1);//Static
            Writer.Byte(Convert.ToByte(count));//Total count
            using (System.Data.SqlClient.SqlDataReader reader = ms.Read())
            {
                while (reader.Read())
                {
                    string pmfrom       = reader.GetString(1);
                    string pmto         = reader.GetString(2);
                    string pmmessage    = reader.GetString(3);
                    byte pmstatus       = reader.GetByte(4);
                    DateTime pmdate     = Convert.ToDateTime(reader.GetDateTime(5));

                    Writer.Text(pmfrom);            // Message From
                    Writer.DWord(0x8A070000);       // date
                    Writer.DWord(0xC7058401);       // date
                    Writer.Byte(pmstatus);          // Status (0 = Unread) (1 = Read)
                }
                ms.Close();
            }
            return Writer.GetBytes();
        }
 public void CheckCharStats(WorldMgr.character ch)
 {
     //Wrap our code inside a catcher
     try
     {
         //Stats checks
         if (ch.Stat.AttackPower < 0)
             Math.Abs(ch.Stat.AttackPower);
         if (ch.Stat.Hit < 0)
             Math.Abs(ch.Stat.Hit);
         if (ch.Stat.MagDef < 0)
             Math.Abs(ch.Stat.MagDef);
         if (ch.Stat.PhyDef < 0)
             Math.Abs(ch.Stat.PhyDef);
         if (ch.Stat.MinPhyAttack < 0)
             Math.Abs(ch.Stat.MinPhyAttack);
         if (ch.Stat.MinMagAttack < 0)
             Math.Abs(ch.Stat.MinMagAttack);
         if (ch.Stat.MaxPhyAttack < 0)
             Math.Abs(ch.Stat.MaxPhyAttack);
         if (ch.Stat.MaxMagAttack < 0)
             Math.Abs(ch.Stat.MaxMagAttack);
         if (ch.Information.XP < 0)
             Math.Abs(ch.Information.XP);
     }
     catch (Exception ex)
     {
         Log.Exception(ex);
     }
 }
        public static void LoadBlues(WorldMgr.character c)
        {
            try
            {
                DB ms = new DB("SELECT * FROM char_items WHERE owner='"+ c.Information.CharacterID +"'");
                using (SqlDataReader reader = ms.Read())
                {
                    while (reader.Read())
                    {
                        int a = 10;
                        int b = 11;

                        int id = reader.GetInt32(0);
                        ObjData.itemblue it = new ObjData.itemblue();
                        it.blue = new ArrayList();
                        it.blueamount = new ArrayList();
                        it.totalblue = reader.GetInt32(9);
                        for (int i = 0; i <= it.totalblue; i++)
                        {
                            it.blue.Add(reader.GetString(a));
                            it.blueamount.Add(reader.GetInt32(b));
                            a += 2;
                            b += 2;
                        }

                        ObjData.Manager.ItemBlue[id] = it;

                    }
                }
            }
            catch (Exception ex)
            {
                Console.WriteLine("Blue error: {0}",ex);
            }
        }
 public static byte[] FriendData(int target, byte type, string name, WorldMgr.character c, bool state)
 {
     PacketWriter Writer = new PacketWriter();
     Writer.Create(OperationCode.SERVER_FRIEND_DATA);
     switch (type)
     {
         case 2:
             //Friend invite accepted
             Writer.Byte(2);
             Writer.DWord(target); //Id
             Writer.Text(c.Information.Name);  //Name
             Writer.DWord(c.Information.Model); //Model
             break;
         case 3:
             //Remove friend from own list
             Writer.Byte(3);
             Writer.DWord(target);
             break;
         case 4:
             //Fried online / offline update
             Writer.Byte(4);
             Writer.DWord(target);
             Writer.Byte(state);
             break;
         case 5:
             //Send private message..
             Writer.Byte(8);
             Writer.Text(name);
             Writer.DWord(0);
             Writer.DWord(0);//time info
             break;
     }
     return Writer.GetBytes();
 }
        public static void RemoveOnDisconnect(WorldMgr.party p, PlayerMgr c)
        {
            //Remove client and member if it contains our removing character
            if (p.Members.Contains(c.Character.Information.UniqueID))
            {
                p.Members.Remove(c.Character.Information.UniqueID);
                p.MembersClient.Remove(c.client);
            }
            //Send packet to each player
            foreach (int member in p.Members)
            {
                PlayerMgr playerdetail = Helpers.GetInformation.GetPlayer(member);

                if (p.Members.Count > 1)
                {
                    playerdetail.client.Send(Packet.Party_Data(1, 0));
                }
                else
                {
                    //Send removal of party
                    playerdetail.client.Send(Packet.Party_Data(3, playerdetail.Character.Information.UniqueID));
                    //Remove party state
                    playerdetail.Character.Network.Party = null;
                }
            }
        }
Exemplo n.º 7
0
        static void Main(string[] args)
        {
            Log.Texte("", "-------------------------------", ConsoleColor.DarkBlue);
            Log.Texte("", "          _____   _____ ", ConsoleColor.Cyan);
            Log.Texte("", "    /\\   |  __ \\ / ____|", ConsoleColor.Cyan);
            Log.Texte("", "   /  \\  | |__) | (___  ", ConsoleColor.Cyan);
            Log.Texte("", "  / /\\ \\ |  ___/ \\___ \\ ", ConsoleColor.Cyan);
            Log.Texte("", " / ____ \\| |     ____) |", ConsoleColor.Cyan);
            Log.Texte("", "/_/    \\_\\_|    |_____/ Rift", ConsoleColor.Cyan);
            Log.Texte("", "http://AllPrivateServer.com", ConsoleColor.DarkCyan);
            Log.Texte("", "-------------------------------", ConsoleColor.DarkBlue);

            // Loading all configs files
            ConfigMgr.LoadConfigs();
            Config = ConfigMgr.GetConfig<RealmConfig>();
            Config.RealmInfo.GenerateName();

            // Loading log level from file
            if (!Log.InitLog(Config.LogLevel,"Realm"))
                ConsoleMgr.WaitAndExit(2000);

            CharactersMgr.CharactersDB = DBManager.Start(Config.CharactersDB.Total(), ConnectionType.DATABASE_MYSQL, "Characters");
            if (CharactersMgr.CharactersDB == null)
                ConsoleMgr.WaitAndExit(2000);

            WorldMgr.WorldDB = DBManager.Start(Config.WorldDB.Total(), ConnectionType.DATABASE_MYSQL, "World");
            if (WorldMgr.WorldDB == null)
                ConsoleMgr.WaitAndExit(2000);

            PacketProcessor.RegisterDefinitions();

            // Starting Remote Client
            Client = new RpcClient("Realm-" + Config.RealmInfo.RealmId, Config.RpcCharacter.RpcLocalIp, 1);
            if (!Client.Start(Config.RpcCharacter.RpcServerIp, Config.RpcCharacter.RpcServerPort))
                ConsoleMgr.WaitAndExit(2000);

            Server = new RpcServer(Config.RpcMapServer.RpcClientStartingPort, 2);
            if (!Server.Start(Config.RpcMapServer.RpcIp, Config.RpcMapServer.RpcPort))
                ConsoleMgr.WaitAndExit(2000);

            World = Client.GetLocalObject<WorldMgr>();
            Accounts = Client.GetServerObject<AccountMgr>();
            Characters = Client.GetLocalObject<CharactersMgr>();

            // 1 : Loading WorldMgr
            World.Load();

            // 2 : Loading CharactersMgr
            CharactersMgr.Client = Client;
            CharactersMgr.MyRealm = Config.RealmInfo;
            CharactersMgr.MyRealm.RpcInfo = Client.Info;
            Characters.Load();

            // 3 : Loading AccountsMgr
            Accounts.RegisterRealm(Config.RealmInfo, Client.Info);

            ConsoleMgr.Start();
        }
 public static bool CheckGuildMemberAdd(WorldMgr.character c)
 {
     foreach (int member in c.Network.Guild.Members)
     {
         if (member == c.Information.CharacterID)
             return true;
     }
     return false;
 }
 public static byte[] FriendInviteTarget(WorldMgr.character c)
 {
     PacketWriter Writer = new PacketWriter();
     Writer.Create(OperationCode.SERVER_FRIEND_INVITE_SEND);
     Writer.DWord(c.Information.CharacterID);
     Writer.DWord(c.Information.UniqueID);
     Writer.Text(c.Information.Name);
     return Writer.GetBytes();
 }
 public static byte[] AttackPetHGP(WorldMgr.pet_obj c)
 {
     CLFramework.PacketWriter writer = new CLFramework.PacketWriter();
     writer.Create(OperationCode.SERVER_PET_HGP);
     writer.DWord(c.UniqueID);
     writer.Byte(3);
     writer.Byte(0);
     writer.Byte(0);
     return writer.GetBytes();
 }
        public static ushort LoginUser(string aID, ref string aPass, ref WorldMgr.player aPlayer, bool localConnect)
        {
            if (Helpers.Manager.clients.Count >= Helpers.Manager.maxSlots)
            {
                return 0; // crowded
            }
            DB ms = new DB("SELECT * FROM users WHERE id = '" + aID + "'");
            if (ms.Count() == 0)
            {
                ms.Close();
                return 1;
            }
            ms = new DB("SELECT * FROM users WHERE id = '" + aID + "' AND password='******'");
            if (ms.Count() == 0)
            {
                ms.Close();
                return 5;
            }
            using (System.Data.SqlClient.SqlDataReader reader = ms.Read())
            {
                while (reader.Read())
                {
                    if (reader.GetString(1).ToLower() == aID.ToLower()) // id
                    {
                        if (reader.GetByte(3) == 1) // online
                        {
                            ms.Close();
                            return 2; // already online
                        }

                        if (reader.GetInt32(5) == 1) // banned
                        {
                            aPass = reader.GetString(4);
                            ms.Close();
                            return 3; // banned
                        }

                        if (aPlayer == null && localConnect) DB.query("UPDATE users SET online=1 WHERE userid='" + reader.GetInt32(0) + "'");
                        aPlayer = new WorldMgr.player();
                        aPlayer.AccountName = aID;
                        aPlayer.Password = aPass; // Nukei: ?? whats the reason for saving password in memory ?
                        aPlayer.ID = reader.GetInt32(0);
                        aPlayer.pGold = reader.GetInt64(7);
                        aPlayer.Silk = reader.GetInt32(6);
                        aPlayer.SilkPrem = reader.GetInt32(9);
                        aPlayer.wSlots = reader.GetByte(11);
                        ms.Close();
                        return 4;
                    }
                }
            }
            ms.Close();
            return 6; // Bilinmeyen geri dönüş:Özel bir durum oluşmadı. (Mecburi Gönderim)
        }
 public static double gamedistance(WorldMgr.Monsters p1, WorldMgr.character._pos p2)
 {
     // Nukei: for test with range checking on objects, maybe faster than only calculating distance
     if ((p1.xSec >= p2.xSec - 1) && (p1.xSec <= p2.xSec + 1) && (p1.ySec >= p2.ySec - 1) && (p1.ySec <= p2.ySec + 1))
     {
         return gamedistance(p1.x, p1.y, p2.x, p2.y);
     }
     else
     {
         return 99999999999999;
     }
 }
 public static byte[] JoinFormedRequest(WorldMgr.character requesting, WorldMgr.character owner)
 {
     //Create new packet writer
     PacketWriter Writer = new PacketWriter();
     //Add opcode for packet
     Writer.Create(OperationCode.SERVER_PARTY_JOIN_FORMED);
     //Character model information (Req).
     Writer.DWord(requesting.Information.Model);
     //Leader id
     Writer.DWord(requesting.Information.UniqueID);
     //Party id
     Writer.DWord(owner.Network.Party.ptid);
     //Static
     Writer.DWord(0);
     Writer.DWord(0);
     Writer.Byte(0);
     Writer.Byte(0xFF);
     //Write character unique id
     Writer.DWord(requesting.Information.UniqueID);
     //Write character name
     Writer.Text(requesting.Information.Name);
     //Write model information
     Writer.DWord(requesting.Information.Model);
     //Write level information
     Writer.Byte(requesting.Information.Level);
     //Static
     Writer.Byte(0xAA);
     //X and Y Sector
     Writer.Byte(requesting.Position.xSec);
     Writer.Byte(requesting.Position.ySec);
     //Static
     Writer.Word(0);
     Writer.Word(0);
     Writer.Word(0);
     Writer.Word(1);
     Writer.Word(1);
     //If character is in a guild
     if (requesting.Network.Guild != null)
         //Write guild name
         Writer.Text(requesting.Network.Guild.Name);
     //If character is not in a guild
     else
         //Write word value 0
         Writer.Word(0);
     //Static
     Writer.Byte(0);
     Writer.DWord(0);
     Writer.DWord(0);
     //Return all bytes to send
     return Writer.GetBytes();
 }
 public static byte[] GuildSetOnline(WorldMgr.guild c, int memberid)
 {
     PacketWriter Writer = new PacketWriter();
     Writer.Create(OperationCode.SERVER_GUILD_ONLINE);
     Writer.DWord(memberid);
     Writer.DWord(c.Guildid);
     Writer.Text(c.Name);
     Writer.Word(0);
     Writer.DWord(0);
     Writer.DWord(0);
     Writer.DWord(0);
     Writer.Byte(0);
     Writer.Byte(1);
     return Writer.GetBytes();
 }
 ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
 ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
 // Close Pets
 ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
 ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
 public void ClosePet(int petid, WorldMgr.pet_obj o)
 {
     try
     {
         if (petid == o.UniqueID && o != null)
         {
             Send(Packet.PetSpawn(petid, 1, o));
             //Below is for icon change from flashing to none flashing in inventory
             //client.Send(Packet.ChangeStatus(0,6, //Slot here //));
             o.DeSpawnMe();
         }
     }
     catch (Exception ex)
     {
         Log.Exception(ex);
     }
 }
        public static byte[] OpenWarehouse2(byte storageslots, WorldMgr.player c)
        {
            PacketWriter Writer = new PacketWriter();
            Writer.Create(OperationCode.SERVER_OPEN_WAREPROB);
            Writer.Byte(storageslots);

            DB ms = new DB("SELECT * FROM char_items WHERE storageacc='" + c.ID + "' AND storagetype='1'");

            Writer.Byte(ms.Count());
            using (System.Data.SqlClient.SqlDataReader reader = ms.Read())
            {
                while (reader.Read())

                    Item.AddItemPacket(Writer, reader.GetByte(5), reader.GetInt32(2), reader.GetByte(4), reader.GetInt16(6), reader.GetInt32(7), reader.GetInt32(0), reader.GetInt32(9),reader.GetInt32(30));
            }
            ms.Close();
            return Writer.GetBytes();
        }
        public static byte[] HonorRank(WorldMgr.character c)
        {
            DB ms = new DB("SELECT * FROM rank_honor");
            PacketWriter Writer = new PacketWriter();
            int countinfo = ms.Count();

            Writer.Create(OperationCode.SERVER_HONOR_RANK);
            Writer.Byte(1);
            int i = 0;
            Writer.Byte(Convert.ToByte(countinfo));
            using (SqlDataReader reader = ms.Read())
            {
                while (reader.Read())
                {
                    byte rankicon = reader.GetByte(1);
                    string rankname = reader.GetString(2);
                    byte ranklevel = reader.GetByte(3);
                    byte ranklevelc = reader.GetByte(4);
                    int graduatesc = reader.GetInt32(5);
                    int rankposc = reader.GetInt32(6);

                    Writer.DWord(i + 1);
                    Writer.Byte(rankicon);
                    Writer.Text(rankname);
                    Writer.Byte(ranklevel);
                    Writer.Byte(ranklevelc);
                    Writer.DWord(graduatesc);
                    //If player has no guild, we write a 0 word value
                    if (c.Network.Guild.Name == null)
                    {
                        Writer.Word(0);
                    }
                    //If player has a guild we write the guild name.
                    else
                    {
                        Writer.Text(c.Network.Guild.Name);
                    }
                    i++;
                }
                ms.Close();
            }
            return Writer.GetBytes();
        }
        public static byte[] EnterStall(int CharacterID, WorldMgr.stall stall)
        {
            PacketWriter Writer = new PacketWriter();
            Writer.Create(OperationCode.SERVER_STALL_OTHER_OPEN);
            Writer.Byte(1);
            Writer.DWord(stall.ownerID);
            Writer.Text3(stall.WelcomeMsg);
            Writer.Bool(stall.isOpened);
            Writer.Byte(0);
            StallItemPacket(stall.ItemList, Writer);
            Writer.Byte(stall.Members.Count - 2);
            for (byte i = 0; i < stall.Members.Count; i++)
            {
                if (stall.Members[i] != stall.ownerID && stall.Members[i] != CharacterID)
                    Writer.DWord(stall.Members[i]);
            }

            return Writer.GetBytes();
        }
 public static byte[] GuildStorageData(WorldMgr.character c)
 {
     DB getstorage = new DB("SELECT * FROM char_items WHERE guild_storage_id='" + c.Network.Guild.Guildid + "' AND storagetype='3'");
     int itemcount = getstorage.Count();
     PacketWriter Writer = new PacketWriter();
     Writer.Create(OperationCode.SERVER_GUILD_STORAGE3);
     Writer.Byte(c.Network.Guild.StorageSlots);
     Writer.Byte(itemcount);
     if (itemcount != 0)
     {
         using (System.Data.SqlClient.SqlDataReader reader = getstorage.Read())
         {
             while (reader.Read())
             {
                 Item.AddItemPacket(Writer, reader.GetByte(5), reader.GetInt32(2), reader.GetByte(4), reader.GetInt16(6), reader.GetInt32(7), reader.GetInt32(0), reader.GetInt32(9), reader.GetInt32(30));
             }
         }
     }
     getstorage.Close();
     return Writer.GetBytes();
 }
        public static byte[] AttackPetStats(WorldMgr.pet_obj c,byte slot)
        {
            CLFramework.PacketWriter writer = new CLFramework.PacketWriter();
            writer.Create(OperationCode.SERVER_PET_INFORMATION);
            writer.DWord(c.UniqueID);
            writer.DWord(c.Model);
            writer.DWord(0x00000168);//stats
            writer.DWord(0x00000168);//stats
            writer.LWord(c.exp);//Experience
            writer.Byte(c.Level);//Level
            writer.Word(0);//Angle
            writer.DWord(0x00000001);//1 = Attack icon enabled, 2 = disabled
            if (c.Petname != "No name") writer.Text(c.Petname);//Petname
            else
                writer.Word(0);//No name

            writer.Byte(0);//Static perhaps
            writer.DWord(c.OwnerID);//Owner
            writer.Byte(slot);
            return writer.GetBytes();
        }
Exemplo n.º 21
0
        public static GameNPC GetDalikor()
        {
            GameNPC[] npcs = WorldMgr.GetNPCsByName("Dalikor", eRealm.Midgard);

            GameNPC dalikor = null;

            if (npcs.Length == 0)
            {
                dalikor       = new GameNPC();
                dalikor.Model = 159;
                dalikor.Name  = "Dalikor";
                if (log.IsWarnEnabled)
                {
                    log.Warn("Could not find " + dalikor.Name + ", creating him ...");
                }
                dalikor.GuildName       = "Part of Dalikor Quests";
                dalikor.Realm           = eRealm.Midgard;
                dalikor.CurrentRegionID = locationDalikor.RegionID;

                GameNpcInventoryTemplate template = new GameNpcInventoryTemplate();
                template.AddNPCEquipment(eInventorySlot.TorsoArmor, 348);
                template.AddNPCEquipment(eInventorySlot.LegsArmor, 349);
                template.AddNPCEquipment(eInventorySlot.ArmsArmor, 350);
                template.AddNPCEquipment(eInventorySlot.HandsArmor, 351);
                template.AddNPCEquipment(eInventorySlot.FeetArmor, 352);
                template.AddNPCEquipment(eInventorySlot.RightHandWeapon, 4);
                dalikor.Inventory = template.CloseTemplate();
                dalikor.SwitchWeapon(GameLiving.eActiveWeaponSlot.Standard);

//				dalikor.AddNPCEquipment((byte) eEquipmentItems.TORSO, 348, 0, 0, 0);
//				dalikor.AddNPCEquipment((byte) eEquipmentItems.LEGS, 349, 0, 0, 0);
//				dalikor.AddNPCEquipment((byte) eEquipmentItems.ARMS, 350, 0, 0, 0);
//				dalikor.AddNPCEquipment((byte) eEquipmentItems.HAND, 351, 0, 0, 0);
//				dalikor.AddNPCEquipment((byte) eEquipmentItems.FEET, 352, 0, 0, 0);
//				dalikor.AddNPCEquipment((byte) eVisibleItems.RIGHT_HAND, 4, 0, 0, 0);

                dalikor.Size     = 50;
                dalikor.Level    = 50;
                dalikor.Position = locationDalikor.Position;
                dalikor.Heading  = locationDalikor.Heading;

                StandardMobBrain brain = new StandardMobBrain();
                brain.AggroLevel = 0;
                brain.AggroRange = 0;
                dalikor.SetOwnBrain(brain);

                //You don't have to store the created mob in the db if you don't want,
                //it will be recreated each time it is not found, just comment the following
                //line if you rather not modify your database
                if (SAVE_INTO_DATABASE)
                {
                    dalikor.SaveIntoDatabase();
                }

                dalikor.AddToWorld();
            }
            else
            {
                dalikor = npcs[0];
            }

            return(dalikor);
        }
Exemplo n.º 22
0
 /// <summary>
 /// Returns TRUE if the character with the given name is logged in
 /// </summary>
 /// <param name="charname">the charactername</param>
 /// <returns>true if the char is logged in</returns>
 private bool CharacterIsOnline(string charname)
 {
     return(WorldMgr.GetClientByPlayerName(charname, true, false) != null);
 }
 public static byte[] SendGuildInfo2(WorldMgr.character c)
 {
     PacketWriter Writer = new PacketWriter();
     Writer.Create(OperationCode.SERVER_GUILD_ONLINE);
     Writer.DWord(c.Information.UniqueID);               // Guildmaster ID
     Writer.DWord(c.Network.Guild.Guildid);              // Guild ID
     Writer.Text(c.Network.Guild.Name);
     if (c.Network.Guild.GrantName != "")
         Writer.Text(c.Network.Guild.GrantName);         // Guildmaster grand name len
     else
         Writer.Word(0);
     Writer.DWord(0);                                    // ?
     Writer.DWord(0);                                    // ?
     Writer.DWord(0);                                    // ? Amount of guilds in union ?
     Writer.Byte(1);                                     // ?
     Writer.Byte(1);
     return Writer.GetBytes();
 }
Exemplo n.º 24
0
        public static void ScriptLoaded(DOLEvent e, object sender, EventArgs args)
        {
            if (!ServerProperties.Properties.LOAD_QUESTS)
            {
                return;
            }

            if (log.IsInfoEnabled)
            {
                log.Info("Quest \"" + questTitle + "\" initializing ...");
            }

            /* First thing we do in here is to search for the NPCs inside
             * the world who comes from the certain Realm. If we find a the players,
             * this means we don't have to create a new one.
             *
             * NOTE: You can do anything you want in this method, you don't have
             * to search for NPC's ... you could create a custom item, place it
             * on the ground and if a player picks it up, he will get the quest!
             * Just examples, do anything you like and feel comfortable with :)
             */

            GameNPC[] npcs = WorldMgr.GetObjectsByName <GameNPC>("Andrew Wyatt", eRealm.Albion);

            /* Whops, if the npcs array length is 0 then no npc exists in
             * this users Mob Database, so we simply create one ;-)
             * else we take the existing one. And if more than one exist, we take
             * the first ...
             */
            if (npcs.Length == 0)
            {
                andrewWyatt       = new GameNPC();
                andrewWyatt.Model = 80;
                andrewWyatt.Name  = "Andrew Wyatt";
                if (log.IsWarnEnabled)
                {
                    log.Warn("Could not find " + andrewWyatt.Name + ", creating him ...");
                }

                andrewWyatt.GuildName       = "Part of " + questTitle + " Quest";
                andrewWyatt.Realm           = eRealm.Albion;
                andrewWyatt.CurrentRegionID = 1;

                GameNpcInventoryTemplate template = new GameNpcInventoryTemplate();
                template.AddNPCEquipment(eInventorySlot.HandsArmor, 80);
                template.AddNPCEquipment(eInventorySlot.FeetArmor, 54);
                template.AddNPCEquipment(eInventorySlot.TorsoArmor, 51);
                template.AddNPCEquipment(eInventorySlot.LegsArmor, 52);
                andrewWyatt.Inventory = template.CloseTemplate();
                andrewWyatt.SwitchWeapon(GameLiving.eActiveWeaponSlot.Standard);

                andrewWyatt.Size    = 48;
                andrewWyatt.Level   = 30;
                andrewWyatt.X       = 559590;
                andrewWyatt.Y       = 511039;
                andrewWyatt.Z       = 2488;
                andrewWyatt.Heading = 1524;

                // You don't have to store the created mob in the db if you don't want,
                // it will be recreated each time it is not found, just comment the following
                // line if you rather not modify your database
                if (SAVE_INTO_DATABASE)
                {
                    andrewWyatt.SaveIntoDatabase();
                }

                andrewWyatt.AddToWorld();
            }
            else
            {
                andrewWyatt = npcs[0];
            }

            npcs = WorldMgr.GetObjectsByName <GameNPC>("Geor Nadren", eRealm.Albion);
            if (npcs.Length == 0)
            {
                if (log.IsWarnEnabled)
                {
                    log.Warn("Could not find Geor Nadren, creating him ...");
                }

                georNadren                 = new GameNPC();
                georNadren.Model           = 9;
                georNadren.Name            = "Geor Nadren";
                georNadren.GuildName       = "Part of " + questTitle + " Quest";
                georNadren.Realm           = eRealm.Albion;
                georNadren.CurrentRegionID = 10;

                GameNpcInventoryTemplate template = new GameNpcInventoryTemplate();
                template.AddNPCEquipment(eInventorySlot.HandsArmor, 39);
                template.AddNPCEquipment(eInventorySlot.FeetArmor, 40);
                template.AddNPCEquipment(eInventorySlot.TorsoArmor, 36);
                template.AddNPCEquipment(eInventorySlot.LegsArmor, 37);
                template.AddNPCEquipment(eInventorySlot.ArmsArmor, 38);
                georNadren.Inventory = template.CloseTemplate();
                georNadren.SwitchWeapon(GameLiving.eActiveWeaponSlot.Standard);

                georNadren.Size    = 51;
                georNadren.Level   = 8;
                georNadren.X       = 37355;
                georNadren.Y       = 30943;
                georNadren.Z       = 8002;
                georNadren.Heading = 3231;

                // You don't have to store the created mob in the db if you don't want,
                // it will be recreated each time it is not found, just comment the following
                // line if you rather not modify your database
                if (SAVE_INTO_DATABASE)
                {
                    georNadren.SaveIntoDatabase();
                }

                georNadren.AddToWorld();
            }
            else
            {
                georNadren = npcs[0];
            }

            npcs = WorldMgr.GetObjectsByName <GameNPC>("Ver Nuren", eRealm.Albion);
            if (npcs.Length == 0)
            {
                if (log.IsWarnEnabled)
                {
                    log.Warn("Could not find Ver Nuren, creating him ...");
                }

                verNuren                 = new GameNPC();
                verNuren.Model           = 9;
                verNuren.Name            = "Ver Nuren";
                verNuren.GuildName       = "Part of " + questTitle + " Quest";
                verNuren.Realm           = eRealm.Albion;
                verNuren.CurrentRegionID = 10;

                GameNpcInventoryTemplate template = new GameNpcInventoryTemplate();
                template.AddNPCEquipment(eInventorySlot.LeftHandWeapon, 61);
                template.AddNPCEquipment(eInventorySlot.HandsArmor, 39);
                template.AddNPCEquipment(eInventorySlot.FeetArmor, 40);
                template.AddNPCEquipment(eInventorySlot.TorsoArmor, 36);
                template.AddNPCEquipment(eInventorySlot.LegsArmor, 37);
                template.AddNPCEquipment(eInventorySlot.ArmsArmor, 38);
                verNuren.Inventory = template.CloseTemplate();
                verNuren.SwitchWeapon(GameLiving.eActiveWeaponSlot.Standard);

                verNuren.Size    = 51;
                verNuren.Level   = 8;
                verNuren.X       = 36799;
                verNuren.Y       = 30786;
                verNuren.Z       = 8010;
                verNuren.Heading = 625;

                // You don't have to store the created mob in the db if you don't want,
                // it will be recreated each time it is not found, just comment the following
                // line if you rather not modify your database
                if (SAVE_INTO_DATABASE)
                {
                    verNuren.SaveIntoDatabase();
                }

                verNuren.AddToWorld();
            }
            else
            {
                verNuren = npcs[0];
            }

            // item db check
            bundleOfBearSkins = GameServer.Database.FindObjectByKey <ItemTemplate>("bundle_of_bear_skins");
            if (bundleOfBearSkins == null)
            {
                bundleOfBearSkins      = new ItemTemplate();
                bundleOfBearSkins.Name = "Bundle of Bear Skins";
                if (log.IsWarnEnabled)
                {
                    log.Warn("Could not find " + bundleOfBearSkins.Name + ", creating it ...");
                }

                bundleOfBearSkins.Level  = 0;
                bundleOfBearSkins.Weight = 0;
                bundleOfBearSkins.Model  = 100;

                bundleOfBearSkins.Object_Type = (int)eObjectType.GenericItem;
                bundleOfBearSkins.Id_nb       = "bundle_of_bear_skins";
                bundleOfBearSkins.Price       = 0;
                bundleOfBearSkins.IsPickable  = false;
                bundleOfBearSkins.IsDropable  = false;

                bundleOfBearSkins.Quality       = 100;
                bundleOfBearSkins.Condition     = 1000;
                bundleOfBearSkins.MaxCondition  = 1000;
                bundleOfBearSkins.Durability    = 1000;
                bundleOfBearSkins.MaxDurability = 1000;
                GameServer.Database.AddObject(bundleOfBearSkins);
            }

            // item db check
            spoolOfLeatherworkingThread = GameServer.Database.FindObjectByKey <ItemTemplate>("spool_of_leatherworking_thread");
            if (spoolOfLeatherworkingThread == null)
            {
                spoolOfLeatherworkingThread      = new ItemTemplate();
                spoolOfLeatherworkingThread.Name = "Spool of Leatherworking Thread";
                if (log.IsWarnEnabled)
                {
                    log.Warn("Could not find " + spoolOfLeatherworkingThread.Name + ", creating it ...");
                }

                spoolOfLeatherworkingThread.Level  = 0;
                spoolOfLeatherworkingThread.Weight = 0;
                spoolOfLeatherworkingThread.Model  = 537;

                spoolOfLeatherworkingThread.Object_Type = (int)eObjectType.GenericItem;
                spoolOfLeatherworkingThread.Id_nb       = "spool_of_leatherworking_thread";
                spoolOfLeatherworkingThread.Price       = 0;
                spoolOfLeatherworkingThread.IsPickable  = false;
                spoolOfLeatherworkingThread.IsDropable  = false;

                spoolOfLeatherworkingThread.Quality       = 100;
                spoolOfLeatherworkingThread.Condition     = 1000;
                spoolOfLeatherworkingThread.MaxCondition  = 1000;
                spoolOfLeatherworkingThread.Durability    = 1000;
                spoolOfLeatherworkingThread.MaxDurability = 1000;
                GameServer.Database.AddObject(spoolOfLeatherworkingThread);
            }

            // item db check
            chokerOfTheBear = GameServer.Database.FindObjectByKey <ItemTemplate>("choker_of_the_bear");
            if (chokerOfTheBear == null)
            {
                chokerOfTheBear      = new ItemTemplate();
                chokerOfTheBear.Name = "Choker of the Bear";
                if (log.IsWarnEnabled)
                {
                    log.Warn("Could not find " + chokerOfTheBear.Name + ", creating it ...");
                }

                chokerOfTheBear.Level  = 5;
                chokerOfTheBear.Weight = 6;
                chokerOfTheBear.Model  = 101;

                chokerOfTheBear.Object_Type = (int)eObjectType.Magical;
                chokerOfTheBear.Item_Type   = (int)eEquipmentItems.NECK;
                chokerOfTheBear.Id_nb       = "choker_of_the_bear";

                chokerOfTheBear.Price      = Money.GetMoney(0, 0, 0, 0, 30);
                chokerOfTheBear.IsPickable = true;
                chokerOfTheBear.IsDropable = true;

                chokerOfTheBear.Bonus      = 1;
                chokerOfTheBear.Bonus1Type = (int)eProperty.Strength;
                chokerOfTheBear.Bonus1     = 4;
                chokerOfTheBear.Bonus2Type = (int)eProperty.Resist_Thrust;
                chokerOfTheBear.Bonus2     = 1;

                chokerOfTheBear.Quality       = 100;
                chokerOfTheBear.Condition     = 1000;
                chokerOfTheBear.MaxCondition  = 1000;
                chokerOfTheBear.Durability    = 1000;
                chokerOfTheBear.MaxDurability = 1000;
                GameServer.Database.AddObject(chokerOfTheBear);
            }

            /* Now we add some hooks to the npc we found.
             * Actually, we want to know when a player interacts with him.
             * So, we hook the right-click (interact) and the whisper method
             * of npc and set the callback method to the "TalkToXXX"
             * method. This means, the "TalkToXXX" method is called whenever
             * a player right clicks on him or when he whispers to him.
             */

            GameEventMgr.AddHandler(GamePlayerEvent.AcceptQuest, new DOLEventHandler(SubscribeQuest));
            GameEventMgr.AddHandler(GamePlayerEvent.DeclineQuest, new DOLEventHandler(SubscribeQuest));

            GameEventMgr.AddHandler(andrewWyatt, GameLivingEvent.Interact, new DOLEventHandler(TalkToAndrewWyatt));
            GameEventMgr.AddHandler(andrewWyatt, GameLivingEvent.WhisperReceive, new DOLEventHandler(TalkToAndrewWyatt));

            GameEventMgr.AddHandler(georNadren, GameObjectEvent.Interact, new DOLEventHandler(TalkToGeorNadren));
            GameEventMgr.AddHandler(georNadren, GameLivingEvent.WhisperReceive, new DOLEventHandler(TalkToGeorNadren));

            GameEventMgr.AddHandler(verNuren, GameObjectEvent.Interact, new DOLEventHandler(TalkToVerNuren));
            GameEventMgr.AddHandler(verNuren, GameLivingEvent.WhisperReceive, new DOLEventHandler(TalkToVerNuren));

            /* Now we bring to Ydenia the possibility to give this quest to players */
            andrewWyatt.AddQuestToGive(typeof(AndrewsSkins));

            if (log.IsInfoEnabled)
            {
                log.Info("Quest \"" + questTitle + "\" initialized");
            }
        }
Exemplo n.º 25
0
        public override int HandlePacket(GamePlayer player, GSPacketIn packet)
        {
            int result;

            if (player.CurrentRoom == null)
            {
                result = 0;
            }
            else
            {
                GSPacketIn pkg = packet.Clone();
                pkg.ClearContext();
                int        id    = packet.ReadInt();
                GamePlayer other = WorldMgr.GetPlayerById(id);
                if (other == player)
                {
                    result = 0;
                }
                else
                {
                    if (other == null)
                    {
                        player.Out.SendMessage(eMessageType.ERROR, LanguageMgr.GetTranslation("friendnotinthesameserver.Fail", new object[0]));
                        result = 0;
                    }
                    else
                    {
                        int copyInviteLevelLimit = 1;
                        if (other.PlayerCharacter.Grade < copyInviteLevelLimit && (player.CurrentRoom.RoomType == eRoomType.Treasure || player.CurrentRoom.RoomType == eRoomType.Boss || player.CurrentRoom.RoomType == eRoomType.Exploration))
                        {
                            player.Out.SendMessage(eMessageType.ERROR, LanguageMgr.GetTranslation("GameInviteHandler.LessThanLevelLimit", new object[]
                            {
                                copyInviteLevelLimit
                            }));
                            result = 0;
                        }
                        else
                        {
                            List <GamePlayer> players = player.CurrentRoom.GetPlayers();
                            foreach (GamePlayer p in players)
                            {
                                if (p == other)
                                {
                                    player.Out.SendMessage(eMessageType.ERROR, LanguageMgr.GetTranslation("friendnotinthesameserver.Sameroom", new object[0]));
                                    result = 0;
                                    return(result);
                                }
                            }
                            if (other != null && other.CurrentRoom == null)
                            {
                                pkg.WriteInt(player.PlayerCharacter.ID);
                                pkg.WriteInt(player.CurrentRoom.RoomId);
                                pkg.WriteInt(player.CurrentRoom.MapId);
                                pkg.WriteByte(player.CurrentRoom.TimeMode);
                                pkg.WriteByte((byte)player.CurrentRoom.RoomType);
                                pkg.WriteByte((byte)player.CurrentRoom.HardLevel);
                                pkg.WriteByte((byte)player.CurrentRoom.LevelLimits);
                                pkg.WriteString(player.PlayerCharacter.NickName);
                                pkg.WriteString(player.CurrentRoom.Name);
                                pkg.WriteString(player.CurrentRoom.Password);
                                if (player.CurrentRoom.RoomType == eRoomType.Treasure)
                                {
                                    if (player.CurrentRoom.Game != null)
                                    {
                                        pkg.WriteInt((player.CurrentRoom.Game as PVEGame).SessionId);
                                    }
                                    else
                                    {
                                        pkg.WriteInt(0);
                                    }
                                }
                                else
                                {
                                    pkg.WriteInt(-1);
                                }
                                other.Out.SendTCP(pkg);
                            }
                            else
                            {
                                if (other != null && other.CurrentRoom != null && other.CurrentRoom != player.CurrentRoom)
                                {
                                    player.Out.SendMessage(eMessageType.ERROR, LanguageMgr.GetTranslation("friendnotinthesameserver.Room", new object[0]));
                                }
                            }
                            result = 0;
                        }
                    }
                }
            }
            return(result);
        }
Exemplo n.º 26
0
        public static void ScriptLoaded(DOLEvent e, object sender, EventArgs args)
        {
            if (!ServerProperties.Properties.LOAD_QUESTS)
            {
                return;
            }

            if (log.IsInfoEnabled)
            {
                log.Info("Quest \"" + questTitle + "\" initializing ...");
            }

            /* First thing we do in here is to search for the NPCs inside
             * the world who comes from the certain Realm. If we find a the players,
             * this means we don't have to create a new one.
             *
             * NOTE: You can do anything you want in this method, you don't have
             * to search for NPC's ... you could create a custom item, place it
             * on the ground and if a player picks it up, he will get the quest!
             * Just examples, do anything you like and feel comfortable with :)
             */

            GameNPC[] npcs = WorldMgr.GetObjectsByName <GameNPC>("Hugh Gallen", eRealm.Albion);

            /* Whops, if the npcs array length is 0 then no npc exists in
             * this users Mob Database, so we simply create one ;-)
             * else we take the existing one. And if more than one exist, we take
             * the first ...
             */
            if (npcs.Length == 0)
            {
                hughGallen       = new GameNPC();
                hughGallen.Model = 40;
                hughGallen.Name  = "Hugh Gallen";
                if (log.IsWarnEnabled)
                {
                    log.Warn("Could not find " + hughGallen.Name + ", creating him ...");
                }

                hughGallen.GuildName       = "Part of " + questTitle + " Quest";
                hughGallen.Realm           = eRealm.Albion;
                hughGallen.CurrentRegionID = 1;

                GameNpcInventoryTemplate template = new GameNpcInventoryTemplate();
                template.AddNPCEquipment(eInventorySlot.HandsArmor, 39);
                template.AddNPCEquipment(eInventorySlot.FeetArmor, 40);
                template.AddNPCEquipment(eInventorySlot.TorsoArmor, 36);
                template.AddNPCEquipment(eInventorySlot.LegsArmor, 37);
                template.AddNPCEquipment(eInventorySlot.ArmsArmor, 38);
                hughGallen.Inventory = template.CloseTemplate();
                hughGallen.SwitchWeapon(GameLiving.eActiveWeaponSlot.Standard);

                hughGallen.Size    = 49;
                hughGallen.Level   = 38;
                hughGallen.X       = 574640;
                hughGallen.Y       = 531109;
                hughGallen.Z       = 2896;
                hughGallen.Heading = 2275;

                // You don't have to store the created mob in the db if you don't want,
                // it will be recreated each time it is not found, just comment the following
                // line if you rather not modify your database
                if (SAVE_INTO_DATABASE)
                {
                    hughGallen.SaveIntoDatabase();
                }

                hughGallen.AddToWorld();
            }
            else
            {
                hughGallen = npcs[0];
            }

            // item db check
            beltOfAnimation = GameServer.Database.FindObjectByKey <ItemTemplate>("belt_of_animation");
            if (beltOfAnimation == null)
            {
                beltOfAnimation      = new ItemTemplate();
                beltOfAnimation.Name = "Belt of Animation";
                if (log.IsWarnEnabled)
                {
                    log.Warn("Could not find " + beltOfAnimation.Name + ", creating it ...");
                }

                beltOfAnimation.Level  = 5;
                beltOfAnimation.Weight = 3;
                beltOfAnimation.Model  = 597;

                beltOfAnimation.Object_Type = (int)eObjectType.Magical;
                beltOfAnimation.Item_Type   = (int)eEquipmentItems.WAIST;
                beltOfAnimation.Id_nb       = "belt_of_animation";
                beltOfAnimation.Price       = 0;
                beltOfAnimation.IsPickable  = true;
                beltOfAnimation.IsDropable  = false; // can't be sold to merchand

                beltOfAnimation.Bonus1     = 6;
                beltOfAnimation.Bonus1Type = (int)eProperty.MaxHealth;

                beltOfAnimation.Quality       = 100;
                beltOfAnimation.Condition     = 1000;
                beltOfAnimation.MaxCondition  = 1000;
                beltOfAnimation.Durability    = 1000;
                beltOfAnimation.MaxDurability = 1000;

                // You don't have to store the created item in the db if you don't want,
                // it will be recreated each time it is not found, just comment the following
                // line if you rather not modify your database
                GameServer.Database.AddObject(beltOfAnimation);
            }

            /* Now we add some hooks to the npc we found.
             * Actually, we want to know when a player interacts with him.
             * So, we hook the right-click (interact) and the whisper method
             * of npc and set the callback method to the "TalkToXXX"
             * method. This means, the "TalkToXXX" method is called whenever
             * a player right clicks on him or when he whispers to him.
             */

            GameEventMgr.AddHandler(GamePlayerEvent.AcceptQuest, new DOLEventHandler(SubscribeQuest));
            GameEventMgr.AddHandler(GamePlayerEvent.DeclineQuest, new DOLEventHandler(SubscribeQuest));

            GameEventMgr.AddHandler(hughGallen, GameLivingEvent.Interact, new DOLEventHandler(TalkToHughGallen));
            GameEventMgr.AddHandler(hughGallen, GameLivingEvent.WhisperReceive, new DOLEventHandler(TalkToHughGallen));

            /* Now we bring to Yetta Fletcher the possibility to give this quest to players */
            hughGallen.AddQuestToGive(typeof(ClericMulgrut));

            if (log.IsInfoEnabled)
            {
                log.Info("Quest \"" + questTitle + "\" initialized");
            }
        }
Exemplo n.º 27
0
        private static void Resynch(object nullValue)
        {
            long syncTime = watch.ElapsedMilliseconds;

            //Check alive
            foreach (GameTimer.TimeManager mgr in WorldMgr.GetRegionTimeManagers())
            {
                if (old_time.ContainsKey(mgr) && old_time[mgr] > 0 && old_time[mgr] == mgr.CurrentTime)
                {
                    if (log.IsErrorEnabled)
                    {
                        // Tolakram: Can't do StackTrace call here.  If thread is stopping will result in UAE app stop
                        log.ErrorFormat("----- Found Frozen Region Timer -----\nName: {0} - Current Time: {1}", mgr.Name, mgr.CurrentTime);
                    }

                    //if(mgr.Running)
                    try
                    {
                        if (!mgr.Stop())
                        {
                            log.ErrorFormat("----- Failed to Stop the TimeManager: {0}", mgr.Name);
                        }
                    }
                    catch (Exception mex)
                    {
                        log.ErrorFormat("----- Errors while trying to stop the TimeManager: {0}\n{1}", mgr.Name, mex);
                    }

                    foreach (GameClient clients in WorldMgr.GetAllClients())
                    {
                        if (clients.Player == null || clients.ClientState == GameClient.eClientState.Linkdead)
                        {
                            if (log.IsErrorEnabled)
                            {
                                log.ErrorFormat("----- Disconnected Client: {0}", clients.Account.Name);
                            }
                            if (clients.Player != null)
                            {
                                clients.Player.SaveIntoDatabase();
                                clients.Player.Quit(true);
                            }
                            clients.Out.SendPlayerQuit(true);
                            clients.Disconnect();
                            GameServer.Instance.Disconnect(clients);
                            WorldMgr.RemoveClient(clients);
                        }
                    }

                    if (!mgr.Start())
                    {
                        log.ErrorFormat("----- Failed to (re)Start the TimeManager: {0}", mgr.Name);
                    }

                    foreach (Region reg in WorldMgr.GetAllRegions())
                    {
                        if (reg.TimeManager == mgr)
                        {
                            foreach (GameObject obj in reg.Objects)
                            {
                                //Restart Player regen & remove PvP immunity
                                if (obj is GamePlayer)
                                {
                                    GamePlayer plr = obj as GamePlayer;
                                    if (plr.IsAlive)
                                    {
                                        plr.StopHealthRegeneration();
                                        plr.StopPowerRegeneration();
                                        plr.StopEnduranceRegeneration();
                                        plr.StopCurrentSpellcast();
                                        plr.StartHealthRegeneration();
                                        plr.StartPowerRegeneration();
                                        plr.StartEnduranceRegeneration();
                                        plr.StartInvulnerabilityTimer(1000, null);


                                        try
                                        {
                                            foreach (IGameEffect effect in plr.EffectList)
                                            {
                                                var gsp = effect as GameSpellEffect;
                                                if (gsp != null)
                                                {
                                                    gsp.RestartTimers();
                                                }
                                            }
                                        }
                                        catch (Exception e)
                                        {
                                            log.Error("Can't cancel immunty effect : " + e);
                                        }
                                    }
                                    // Warn Player
                                    plr.Client.Out.SendMessage("[" + reg.Description + "] detected as frozen, restarting the zone.", eChatType.CT_Broadcast, eChatLoc.CL_ChatWindow);
                                }

                                //Restart Brains & Paths
                                if (obj is GameNPC && (obj as GameNPC).Brain != null)
                                {
                                    GameNPC npc = obj as GameNPC;

                                    if (npc.Brain is IControlledBrain)
                                    {
                                        npc.Die(null);
                                    }
                                    else if (!(npc.Brain is BlankBrain))
                                    {
                                        npc.Brain.Stop();
                                        DOL.AI.ABrain brain = npc.Brain;
                                        npc.RemoveBrain(npc.Brain);
                                        //npc.Brain.Stop();
                                        if (npc.MaxSpeedBase > 0 && npc.PathID != null && npc.PathID != "" && npc.PathID != "NULL")
                                        {
                                            npc.StopMovingOnPath();
                                            PathPoint path = MovementMgr.LoadPath(npc.PathID);
                                            if (path != null)
                                            {
                                                var p = path.GetNearestNextPoint(npc.Position);
                                                npc.CurrentWayPoint = p;
                                                npc.MoveOnPath((short)p.MaxSpeed);
                                            }
                                        }
                                        try
                                        {
                                            npc.SetOwnBrain(brain);
                                            npc.Brain.Start();
                                        }
                                        catch (Exception e)
                                        {
                                            log.Error("Can't restart Brain in RegionTimerResynch, NPC Name = " + npc.Name + " Position=" + npc.Position.ToString("F0") + "/R=" + npc.CurrentRegion.ID + " " + e);
                                            try
                                            {
                                                npc.Die(null);
                                            }
                                            catch (Exception ee)
                                            {
                                                log.Error("Can't restart Brain and Kill NPC in RegionTimerResynch, NPC Name = " + npc.Name + " Position=" + npc.Position.ToString("F0") + "/R=" + npc.CurrentRegion.ID + " " + ee);
                                            }
                                        }
                                    }
                                }
                            }

                            //Restart Respawn Timers
                            List <GameNPC> respawnings = new List <GameNPC>(reg.MobsRespawning.Keys);
                            foreach (GameNPC deadMob in respawnings)
                            {
                                GameNPC mob = deadMob;
                                if (mob != null)
                                {
                                    mob.StartRespawn();
                                }
                            }
                        }
                    }
                    //RegionTimerUnfrozen(mgr, syncTime);
                }

                if (old_time.ContainsKey(mgr))
                {
                    old_time[mgr] = mgr.CurrentTime;
                }
                else
                {
                    old_time.Add(mgr, mgr.CurrentTime);
                }
            }
        }
Exemplo n.º 28
0
        public void OnCommand(GameClient client, string[] args)
        {
            if (IsSpammingCommand(client.Player, "chatgroup"))
            {
                return;
            }

            if (args.Length < 2)
            {
                PrintHelp(client);
                return;
            }

            switch (args[1].ToLower())
            {
            case "help":
            {
                PrintHelp(client);
            }

            break;

            case "invite":
            {
                if (args.Length < 3)
                {
                    client.Out.SendMessage(LanguageMgr.GetTranslation(client.Account.Language, "Scripts.Players.Chatgroup.UsageInvite"), eChatType.CT_System, eChatLoc.CL_SystemWindow);
                    return;
                }

                GameClient inviteeclient = WorldMgr.GetClientByPlayerName(args[2], false, true);
                if (inviteeclient == null || !GameServer.ServerRules.IsSameRealm(inviteeclient.Player, client.Player, true))         // allow priv level>1 to invite anyone
                {
                    client.Out.SendMessage(LanguageMgr.GetTranslation(client.Account.Language, "Scripts.Players.Chatgroup.NoPlayer"), eChatType.CT_System, eChatLoc.CL_SystemWindow);
                    return;
                }

                if (client == inviteeclient)
                {
                    client.Out.SendMessage(LanguageMgr.GetTranslation(client.Account.Language, "Scripts.Players.Chatgroup.InviteYourself"), eChatType.CT_System, eChatLoc.CL_SystemWindow);
                    return;
                }

                ChatGroup oldchatgroup = (ChatGroup)inviteeclient.Player.TempProperties.getProperty <object>(ChatGroup.CHATGROUP_PROPERTY, null);
                if (oldchatgroup != null)
                {
                    client.Out.SendMessage(LanguageMgr.GetTranslation(client.Account.Language, "Scripts.Players.Chatgroup.PlayerInChatgroup", inviteeclient.Player.Name), eChatType.CT_System, eChatLoc.CL_SystemWindow);
                    return;
                }

                ChatGroup mychatgroup = (ChatGroup)client.Player.TempProperties.getProperty <object>(ChatGroup.CHATGROUP_PROPERTY, null);
                if (mychatgroup == null)
                {
                    mychatgroup = new ChatGroup();
                    mychatgroup.AddPlayer(client.Player, true);
                }
                else if (((bool)mychatgroup.Members[client.Player]) == false)
                {
                    client.Out.SendMessage(LanguageMgr.GetTranslation(client.Account.Language, "Scripts.Players.Chatgroup.LeaderInvite"), eChatType.CT_System, eChatLoc.CL_SystemWindow);
                    return;
                }

                inviteeclient.Player.TempProperties.setProperty(JOIN_CHATGROUP_PROPERTY, mychatgroup);
                inviteeclient.Player.Out.SendCustomDialog(LanguageMgr.GetTranslation(client.Account.Language, "Scripts.Players.Chatgroup.JoinChatGroup", client.Player.Name), new CustomDialogResponse(JoinChatGroup));
            }

            break;

            case "who":
            {
                ChatGroup mychatgroup = (ChatGroup)client.Player.TempProperties.getProperty <object>(ChatGroup.CHATGROUP_PROPERTY, null);
                if (mychatgroup == null)
                {
                    client.Out.SendMessage(LanguageMgr.GetTranslation(client.Account.Language, "Scripts.Players.Chatgroup.InChatGroup"), eChatType.CT_System, eChatLoc.CL_SystemWindow);
                    return;
                }

                int           i    = 0;
                StringBuilder text = new StringBuilder(64);
                foreach (GamePlayer player in mychatgroup.Members.Keys)
                {
                    i++;
                    text.Length = 0;
                    text.Append(i);
                    text.Append(") ");
                    text.Append(player.Name);
                    if (player.Guild != null)
                    {
                        text.Append(" <");
                        text.Append(player.GuildName);
                        text.Append(">");
                    }

                    text.Append(" (");
                    text.Append(player.CharacterClass.Name);
                    text.Append(")");
                    client.Out.SendMessage(text.ToString(), eChatType.CT_System, eChatLoc.CL_SystemWindow);

                    // TODO: make function formatstring
                }
            }

            break;

            case "remove":
            {
                ChatGroup mychatgroup = (ChatGroup)client.Player.TempProperties.getProperty <object>(ChatGroup.CHATGROUP_PROPERTY, null);
                if (mychatgroup == null)
                {
                    client.Out.SendMessage(LanguageMgr.GetTranslation(client.Account.Language, "Scripts.Players.Chatgroup.InChatGroup"), eChatType.CT_System, eChatLoc.CL_SystemWindow);
                    return;
                }

                if (args.Length < 3)
                {
                    PrintHelp(client);
                }

                GameClient inviteeclient = WorldMgr.GetClientByPlayerName(args[2], false, false);
                if (inviteeclient == null)
                {
                    client.Out.SendMessage(LanguageMgr.GetTranslation(client.Account.Language, "Scripts.Players.Chatgroup.NoPlayer"), eChatType.CT_System, eChatLoc.CL_SystemWindow);
                    return;
                }

                mychatgroup.RemovePlayer(inviteeclient.Player);
            }

            break;

            case "leave":
            {
                ChatGroup mychatgroup = (ChatGroup)client.Player.TempProperties.getProperty <object>(ChatGroup.CHATGROUP_PROPERTY, null);
                if (mychatgroup == null)
                {
                    client.Out.SendMessage(LanguageMgr.GetTranslation(client.Account.Language, "Scripts.Players.Chatgroup.InChatGroup"), eChatType.CT_System, eChatLoc.CL_SystemWindow);
                    return;
                }

                mychatgroup.RemovePlayer(client.Player);
            }

            break;

            case "listen":
            {
                ChatGroup mychatgroup = (ChatGroup)client.Player.TempProperties.getProperty <object>(ChatGroup.CHATGROUP_PROPERTY, null);
                if (mychatgroup == null)
                {
                    client.Out.SendMessage(LanguageMgr.GetTranslation(client.Account.Language, "Scripts.Players.Chatgroup.InChatGroup"), eChatType.CT_System, eChatLoc.CL_SystemWindow);
                    return;
                }

                if ((bool)mychatgroup.Members[client.Player] == false)
                {
                    client.Out.SendMessage(LanguageMgr.GetTranslation(client.Account.Language, "Scripts.Players.Chatgroup.LeaderCommand"), eChatType.CT_System, eChatLoc.CL_SystemWindow);
                    return;
                }

                mychatgroup.Listen = !mychatgroup.Listen;
                string message = LanguageMgr.GetTranslation(client.Account.Language, "Scripts.Players.Chatgroup.ListenMode") + (mychatgroup.Listen ? "on." : "off.");
                foreach (GamePlayer ply in mychatgroup.Members.Keys)
                {
                    ply.Out.SendMessage(message, eChatType.CT_Chat, eChatLoc.CL_ChatWindow);
                }
            }

            break;

            case "leader":
            {
                ChatGroup mychatgroup = (ChatGroup)client.Player.TempProperties.getProperty <object>(ChatGroup.CHATGROUP_PROPERTY, null);
                if (mychatgroup == null)
                {
                    client.Out.SendMessage(LanguageMgr.GetTranslation(client.Account.Language, "Scripts.Players.Chatgroup.InChatGroup"), eChatType.CT_System, eChatLoc.CL_SystemWindow);
                    return;
                }

                if ((bool)mychatgroup.Members[client.Player] == false)
                {
                    client.Out.SendMessage(LanguageMgr.GetTranslation(client.Account.Language, "Scripts.Players.Chatgroup.LeaderCommand"), eChatType.CT_System, eChatLoc.CL_SystemWindow);
                    return;
                }

                if (args.Length < 3)
                {
                    PrintHelp(client);
                }

                string     invitename    = string.Join(" ", args, 2, args.Length - 2);
                GameClient inviteeclient = WorldMgr.GetClientByPlayerName(invitename, false, false);
                if (inviteeclient == null)
                {
                    client.Out.SendMessage(LanguageMgr.GetTranslation(client.Account.Language, "Scripts.Players.Chatgroup.NoPlayer"), eChatType.CT_System, eChatLoc.CL_SystemWindow);
                    return;
                }

                mychatgroup.Members[inviteeclient.Player] = true;
                string message = LanguageMgr.GetTranslation(client.Account.Language, "Scripts.Players.Chatgroup.Moderator", inviteeclient.Player.Name);
                foreach (GamePlayer ply in mychatgroup.Members.Keys)
                {
                    ply.Out.SendMessage(message, eChatType.CT_Chat, eChatLoc.CL_ChatWindow);
                }
            }

            break;

            case "public":
            {
                ChatGroup mychatgroup = (ChatGroup)client.Player.TempProperties.getProperty <object>(ChatGroup.CHATGROUP_PROPERTY, null);
                if (mychatgroup == null)
                {
                    client.Out.SendMessage(LanguageMgr.GetTranslation(client.Account.Language, "Scripts.Players.Chatgroup.InChatGroup"), eChatType.CT_System, eChatLoc.CL_SystemWindow);
                    return;
                }

                if ((bool)mychatgroup.Members[client.Player] == false)
                {
                    client.Out.SendMessage(LanguageMgr.GetTranslation(client.Account.Language, "Scripts.Players.Chatgroup.LeaderCommand"), eChatType.CT_System, eChatLoc.CL_SystemWindow);
                    return;
                }

                if (mychatgroup.IsPublic)
                {
                    client.Out.SendMessage(LanguageMgr.GetTranslation(client.Account.Language, "Scripts.Players.Chatgroup.PublicAlready"), eChatType.CT_System, eChatLoc.CL_SystemWindow);
                    return;
                }
                else
                {
                    mychatgroup.IsPublic = true;
                    string message = LanguageMgr.GetTranslation(client.Account.Language, "Scripts.Players.Chatgroup.Public");
                    foreach (GamePlayer ply in mychatgroup.Members.Keys)
                    {
                        ply.Out.SendMessage(message, eChatType.CT_Chat, eChatLoc.CL_ChatWindow);
                    }
                }
            }

            break;

            case "private":
            {
                ChatGroup mychatgroup = (ChatGroup)client.Player.TempProperties.getProperty <object>(ChatGroup.CHATGROUP_PROPERTY, null);
                if (mychatgroup == null)
                {
                    client.Out.SendMessage(LanguageMgr.GetTranslation(client.Account.Language, "Scripts.Players.Chatgroup.InChatGroup"), eChatType.CT_System, eChatLoc.CL_SystemWindow);
                    return;
                }

                if ((bool)mychatgroup.Members[client.Player] == false)
                {
                    client.Out.SendMessage(LanguageMgr.GetTranslation(client.Account.Language, "Scripts.Players.Chatgroup.LeaderCommand"), eChatType.CT_System, eChatLoc.CL_SystemWindow);
                    return;
                }

                if (!mychatgroup.IsPublic)
                {
                    client.Out.SendMessage(LanguageMgr.GetTranslation(client.Account.Language, "Scripts.Players.Chatgroup.PrivateAlready"), eChatType.CT_System, eChatLoc.CL_SystemWindow);
                    return;
                }
                else
                {
                    mychatgroup.IsPublic = false;
                    string message = LanguageMgr.GetTranslation(client.Account.Language, "Scripts.Players.Chatgroup.Private");
                    foreach (GamePlayer ply in mychatgroup.Members.Keys)
                    {
                        ply.Out.SendMessage(message, eChatType.CT_Chat, eChatLoc.CL_ChatWindow);
                    }
                }
            }

            break;

            case "join":
            {
                if (args.Length < 3)
                {
                    PrintHelp(client);
                    return;
                }

                GameClient inviteeclient = WorldMgr.GetClientByPlayerName(args[2], false, false);
                if (inviteeclient == null || !GameServer.ServerRules.IsSameRealm(client.Player, inviteeclient.Player, true))         // allow priv level>1 to join anywhere
                {
                    client.Out.SendMessage(LanguageMgr.GetTranslation(client.Account.Language, "Scripts.Players.Chatgroup.NoPlayer"), eChatType.CT_System, eChatLoc.CL_SystemWindow);
                    return;
                }

                if (client == inviteeclient)
                {
                    client.Out.SendMessage(LanguageMgr.GetTranslation(client.Account.Language, "Scripts.Players.Chatgroup.OwnChatGroup"), eChatType.CT_System, eChatLoc.CL_SystemWindow);
                    return;
                }

                ChatGroup mychatgroup = (ChatGroup)inviteeclient.Player.TempProperties.getProperty <object>(ChatGroup.CHATGROUP_PROPERTY, null);
                if (mychatgroup == null)
                {
                    client.Out.SendMessage(LanguageMgr.GetTranslation(client.Account.Language, "Scripts.Players.Chatgroup.NotChatGroupMember"), eChatType.CT_System, eChatLoc.CL_SystemWindow);
                    return;
                }

                if ((bool)mychatgroup.Members[inviteeclient.Player] == false)
                {
                    client.Out.SendMessage(LanguageMgr.GetTranslation(client.Account.Language, "Scripts.Players.Chatgroup.NotChatGroupLeader"), eChatType.CT_System, eChatLoc.CL_SystemWindow);
                    return;
                }

                if (!mychatgroup.IsPublic)
                {
                    if (args.Length == 4 && args[3] == mychatgroup.Password)
                    {
                        mychatgroup.AddPlayer(client.Player, false);
                    }
                    else
                    {
                        client.Player.Out.SendMessage(LanguageMgr.GetTranslation(client.Account.Language, "Scripts.Players.Chatgroup.NotPublic"), eChatType.CT_System, eChatLoc.CL_SystemWindow);
                    }
                }
                else
                {
                    mychatgroup.AddPlayer(client.Player, false);
                }
            }

            break;

            case "password":
            {
                ChatGroup mychatgroup = (ChatGroup)client.Player.TempProperties.getProperty <object>(ChatGroup.CHATGROUP_PROPERTY, null);
                if (mychatgroup == null)
                {
                    client.Out.SendMessage(LanguageMgr.GetTranslation(client.Account.Language, "Scripts.Players.Chatgroup.InChatGroup"), eChatType.CT_System, eChatLoc.CL_SystemWindow);
                    return;
                }

                if ((bool)mychatgroup.Members[client.Player] == false)
                {
                    client.Out.SendMessage(LanguageMgr.GetTranslation(client.Account.Language, "Scripts.Players.Chatgroup.LeaderCommand"), eChatType.CT_System, eChatLoc.CL_SystemWindow);
                    return;
                }

                if (args.Length < 3)
                {
                    if (mychatgroup.Password.Equals(string.Empty))
                    {
                        client.Out.SendMessage(LanguageMgr.GetTranslation(client.Account.Language, "Scripts.Players.Chatgroup.PasswordUnset", mychatgroup.Password), eChatType.CT_System, eChatLoc.CL_SystemWindow);
                        return;
                    }
                    else
                    {
                        client.Out.SendMessage(LanguageMgr.GetTranslation(client.Account.Language, "Scripts.Players.Chatgroup.Password", mychatgroup.Password), eChatType.CT_System, eChatLoc.CL_SystemWindow);
                        return;
                    }
                }

                if (args[2] == "clear")
                {
                    mychatgroup.Password = string.Empty;
                    client.Out.SendMessage(LanguageMgr.GetTranslation(client.Account.Language, "Scripts.Players.Chatgroup.PasswordClear", mychatgroup.Password), eChatType.CT_System, eChatLoc.CL_SystemWindow);
                    return;
                }

                mychatgroup.Password = args[2];
                client.Out.SendMessage(LanguageMgr.GetTranslation(client.Account.Language, "Scripts.Players.Chatgroup.PasswordChanged", mychatgroup.Password), eChatType.CT_System, eChatLoc.CL_SystemWindow);
            }

            break;
            }
        }
Exemplo n.º 29
0
        public override bool WhisperReceive(GameLiving source, string str)
        {
            if (!base.WhisperReceive(source, str))
            {
                return(false);
            }
            if (!(source is GamePlayer))
            {
                return(false);
            }
            GamePlayer player = (GamePlayer)source;

            TurnTo(player.X, player.Y);
            ClearChat(player);
            msg = "Hello, which morph do you wish to morph in to? \n";
            if (str == "Reload")
            {
                cachedMorphList = new Dictionary <int, List <string> >(); // RR required and list of mob names

                List <GameNPC> morphs = WorldMgr.GetNPCsByGuild("Morphs", eRealm.None);
                foreach (GameNPC morph in morphs)
                {
                    List <string> names = new List <string>();
                    if (cachedMorphList.ContainsKey(morph.Level))
                    {
                        names = cachedMorphList[morph.Level];
                        cachedMorphList.Remove(morph.Level);
                    }
                    names.Add(morph.Name);

                    cachedMorphList.Add(morph.Level, names);
                }
            }
            if (str.Contains("RR"))
            {
                int rr = int.Parse(str.Replace("RR", "").Replace("L", ""));
                if (cachedMorphList.ContainsKey(rr))
                {
                    List <string> npcs = cachedMorphList[rr];
                    foreach (string mobName in npcs)
                    {
                        msg += "[" + mobName + "]\n";
                    }
                    SendReply(player, msg);
                }
            }
            else
            {
                GameNPC[] npcs = WorldMgr.GetNPCsByName(str, eRealm.None);
                if (npcs != null)
                {
                    if (player.RealmLevel >= npcs[0].Level)
                    {
                        player.Model = npcs[0].Model;
                        player.SaveIntoDatabase();
                    }
                }
            }
            msg = "";


            return(true);
        }
Exemplo n.º 30
0
        protected static void EndVoting()
        {
            if (m_Timer != null)
            {
                m_Timer.Dispose();
            }
            m_Timer = null;
            DBVoting voting = m_Current;

            m_Current = null;

            string msg = "Voting ended!";

            ArrayList clients = WorldMgr.GetAllPlayingClients();

            lock (clients)
            {
                // counting the votes for each option
                uint      count = 0;
                ArrayList votes = new ArrayList();
                for (int i = 0; i < voting.Options.Length; i++)
                {
                    votes.Add(new KVP(voting.Options[i], 0));
                }

                foreach (GameClient client in clients)
                {
                    client.Out.SendMessage(msg, eChatType.CT_ScreenCenter, eChatLoc.CL_SystemWindow);
                    client.Out.SendMessage(msg, eChatType.CT_Staff, eChatLoc.CL_SystemWindow);
                    client.Out.SendPlaySound(eSoundType.Craft, 0x04);

                    int vote = client.Player.TempProperties.getProperty(PLY_TEMP_PROP_KEY, -1);
                    client.Player.TempProperties.removeProperty(PLY_TEMP_PROP_KEY);
                    if (vote >= 0 && vote < voting.Options.Length)
                    {
                        ((KVP)votes[vote]).Value++;
                        ++count;
                    }
                }

                // generating result
                StringBuilder msg1 = new StringBuilder(); // for PrivLevel < GM
                StringBuilder msg2 = new StringBuilder(); // for PrivLevel >= GM
                string        tmp  = string.Format(
                    "Altogether {0} of {1} players voted ({2}%).\n",
                    count, clients.Count, PDivide(count, clients.Count));
                msg1.Append(tmp);
                msg2.Append("VoteID: ").Append(voting.VoteID).Append("\n").Append(tmp);
                if (voting.Description != string.Empty)
                {
                    msg2.Append("\n").Append(voting.Description).Append("\n");
                }

                votes.Sort(new SortByKVP());
                votes.Reverse();
                foreach (KVP kvp in votes)
                {
                    tmp = string.Format(
                        "- {0}: {1} ({2}%)\n",
                        kvp.Key, kvp.Value, PDivide(kvp.Value, clients.Count));
                    msg1.Append(tmp);
                    msg2.Append(tmp);
                }
                tmp = string.Format(
                    "{0} players did not vote ({1}%).\n",
                    (clients.Count - count), PDivide(clients.Count - count, clients.Count));
                msg1.Append(tmp);
                msg2.Append(tmp);
                string   str1   = msg1.ToString();
                string   str2   = msg2.ToString();
                string[] array1 = str1.Split('\n');
                string[] array2 = str2.Split('\n');


                foreach (GameClient client in clients)
                {
                    if (client.Account.PrivLevel <= (uint)ePrivLevel.GM)
                    {
                        client.Out.SendCustomTextWindow("Voting", array1);
                        client.Out.SendMessage(str1, eChatType.CT_Staff, eChatLoc.CL_SystemWindow);
                    }
                    else
                    {
                        client.Out.SendCustomTextWindow("Voting", array2);
                        client.Out.SendMessage(str2, eChatType.CT_Staff, eChatLoc.CL_SystemWindow);
                    }
                }
                m_Result = str2;
            }
        }
        public void HandlePacket(GameClient client, GSPacketIn packet)
        {
            ushort jumpSpotId = packet.ReadShort();

            eRealm targetRealm = client.Player.Realm;

            if (client.Player.CurrentRegion.Expansion == (int)eClientExpansion.TrialsOfAtlantis && client.Player.CurrentZone.Realm != eRealm.None)
            {
                // if we are in TrialsOfAtlantis then base the target jump on the current region realm instead of the players realm
                // this is only used if zone table has the proper realms defined, otherwise it reverts to old behavior - Tolakram
                targetRealm = client.Player.CurrentZone.Realm;
            }

            var zonePoint = GameServer.Database.SelectObjects <ZonePoint>(
                "`Id` = @Id AND (`Realm` = @Realm OR `Realm` = @DefaultRealm OR `Realm` IS NULL)",
                new[]
            {
                new QueryParameter("@Id", jumpSpotId), new QueryParameter("@Realm", (byte)targetRealm),
                new QueryParameter("@DefaultRealm", 0)
            })
                            .FirstOrDefault();

            if (zonePoint == null || zonePoint.TargetRegion == 0)
            {
                ChatUtil.SendDebugMessage(client, $"Invalid Jump (ZonePoint table): [{jumpSpotId}]{((zonePoint == null) ? ". Entry missing!" : ". TargetRegion is 0!")}");
                zonePoint = new ZonePoint
                {
                    Id = jumpSpotId
                };
            }

            if (client.Account.PrivLevel > 1)
            {
                client.Out.SendMessage($"JumpSpotID = {jumpSpotId}", eChatType.CT_System, eChatLoc.CL_SystemWindow);
                client.Out.SendMessage($"ZonePoint Target: Region = {zonePoint.TargetRegion}, ClassType = \'{zonePoint.ClassType}\'", eChatType.CT_System, eChatLoc.CL_SystemWindow);
            }

            // Dinberg: Fix - some jump points are handled code side, such as instances.
            // As such, region MAY be zero in the database, so this causes an issue.
            if (zonePoint.TargetRegion != 0)
            {
                Region reg = WorldMgr.GetRegion(zonePoint.TargetRegion);
                if (reg != null)
                {
                    // check for target region disabled if player is in a standard region
                    // otherwise the custom region should handle OnZonePoint for this check
                    if (client.Player.CurrentRegion.IsCustom == false && reg.IsDisabled)
                    {
                        if ((client.Player.Mission is TaskDungeonMission mission &&
                             mission.TaskRegion.Skin == reg.Skin) == false)
                        {
                            client.Out.SendMessage("This region has been disabled!", eChatType.CT_System, eChatLoc.CL_SystemWindow);
                            if (client.Account.PrivLevel == 1)
                            {
                                return;
                            }
                        }
                    }
                }
            }

            // Allow the region to either deny exit or handle the zonepoint in a custom way
            if (client.Player.CurrentRegion.OnZonePoint(client.Player, zonePoint) == false)
            {
                return;
            }

            // check caps for battleground
            Battleground bg = GameServer.KeepManager.GetBattleground(zonePoint.TargetRegion);

            if (client.Player.Level < bg?.MinLevel && client.Player.Level > bg.MaxLevel &&
                client.Player.RealmLevel >= bg.MaxRealmLevel)
            {
                return;
            }

            IJumpPointHandler customHandler = null;

            if (string.IsNullOrEmpty(zonePoint.ClassType) == false)
            {
                customHandler = (IJumpPointHandler)_customJumpPointHandlers[zonePoint.ClassType];

                // check for db change to update cached handler
                if (customHandler != null && customHandler.GetType().FullName != zonePoint.ClassType)
                {
                    customHandler = null;
                }

                if (customHandler == null)
                {
                    // Dinberg - Instances need to use a special handler. This is because some instances will result
                    // in duplicated zonepoints, such as if Tir Na Nog were to be instanced for a quest.
                    string type = client.Player.CurrentRegion.IsInstance
                        ? "DOL.GS.ServerRules.InstanceDoorJumpPoint"
                        : zonePoint.ClassType;
                    Type t = ScriptMgr.GetType(type);

                    if (t == null)
                    {
                        Log.Error($"jump point {zonePoint.Id}: class {zonePoint.ClassType} not found!");
                    }
                    else if (!typeof(IJumpPointHandler).IsAssignableFrom(t))
                    {
                        Log.Error($"jump point {zonePoint.Id}: class {zonePoint.ClassType} must implement IJumpPointHandler interface!");
                    }
                    else
                    {
                        try
                        {
                            customHandler = (IJumpPointHandler)Activator.CreateInstance(t);
                        }
                        catch (Exception e)
                        {
                            customHandler = null;
                            Log.Error($"jump point {zonePoint.Id}: error creating a new instance of jump point handler {zonePoint.ClassType}", e);
                        }
                    }
                }

                if (customHandler != null)
                {
                    _customJumpPointHandlers[zonePoint.ClassType] = customHandler;
                }
            }

            new RegionChangeRequestHandler(client.Player, zonePoint, customHandler).Start(1);
        }
Exemplo n.º 32
0
        public override int HandlePacket(GamePlayer player, GSPacketIn packet)
        {
            int  pRICE_STRENGHTN_GOLD = AppConfig.AppSettings["StrengthenGold"].ConvertToInt(1000);
            bool flag = player.PlayerCharacter.Gold < pRICE_STRENGHTN_GOLD;
            int  num;
            int  result;

            if (flag)
            {
                player.Out.SendMessage(0, LanguageMgr.GetTranslation("ItemStrengthenHandler.NoMoney", new object[0]));
                num = 0;
            }
            else
            {
                GSPacketIn gSPacketIn = packet.Clone();
                gSPacketIn.ClearContext();
                ItemInfo itemInfo = player.HideBag.GetItemAt(5);
                bool     flag2    = itemInfo != null && itemInfo.Template.CanStrengthen && itemInfo.Count == 1;
                if (flag2)
                {
                    StrengthenInfo strengthenInfo = StrengthenMgr.FindStrengthenInfo(itemInfo.StrengthenLevel + 1);
                    bool           flag3          = strengthenInfo == null;
                    if (flag3)
                    {
                        bool flag4 = itemInfo.StrengthenLevel == 9 || itemInfo.StrengthenLevel == 15;
                        if (flag4)
                        {
                            player.Out.SendMessage(0, LanguageMgr.GetTranslation("ItemStrengthenHandler.FullStrengthLevel", new object[0]));
                        }
                        else
                        {
                            player.Out.SendMessage(0, LanguageMgr.GetTranslation("ItemStrengthenHandler.NoStrength", new object[0]));
                        }
                        num    = 0;
                        result = num;
                        return(result);
                    }
                    bool          flag5          = itemInfo.IsBinds;
                    bool          flag6          = packet.ReadBoolean();
                    StringBuilder stringBuilder  = new StringBuilder();
                    string        propertyString = itemInfo.GetPropertyString();
                    double        num2           = 0.0;
                    bool          flag7          = false;
                    ItemInfo      itemInfo2      = player.HideBag.GetItemAt(3);
                    bool          flag8          = itemInfo2 != null && itemInfo2.Template.CategoryID == 11 && itemInfo2.Template.Property1 == 7;
                    if (flag8)
                    {
                        flag5 |= itemInfo2.IsBinds;
                        stringBuilder.Append(itemInfo2.ToShortString());
                        flag7 = true;
                    }
                    else
                    {
                        itemInfo2 = null;
                    }
                    bool            flag9  = false;
                    List <ItemInfo> list   = new List <ItemInfo>();
                    ItemInfo        itemAt = player.HideBag.GetItemAt(0);
                    bool            flag10 = itemAt != null && itemAt.Template.CategoryID == 11 && (itemAt.Template.Property1 == 2 || itemAt.Template.Property1 == 35) && !list.Contains(itemAt);
                    if (flag10)
                    {
                        bool flag11 = itemInfo.StrengthenLevel >= 15 && itemAt.Template.Property8 == 2;
                        if (flag11)
                        {
                            player.Out.SendMessage(0, "不能使用[" + itemAt.Template.Name + "]来强化此装备.");
                            num    = 1;
                            result = num;
                            return(result);
                        }
                        flag5 |= itemAt.IsBinds;
                        flag9 |= (itemAt.Template.Property1 == 35 && itemAt.Template.CategoryID == 11);
                        num2  += (double)itemAt.Template.Property2;
                        stringBuilder.Append(itemAt.ToShortString());
                        list.Add(itemAt);
                    }
                    ItemInfo itemAt2 = player.HideBag.GetItemAt(1);
                    bool     flag12  = itemAt2 != null && itemAt2.Template.CategoryID == 11 && (itemAt2.Template.Property1 == 2 || itemAt2.Template.Property1 == 35) && !list.Contains(itemAt2);
                    if (flag12)
                    {
                        bool flag13 = itemInfo.StrengthenLevel >= 15 && itemAt2.Template.Property8 == 2;
                        if (flag13)
                        {
                            player.Out.SendMessage(0, "不能使用[" + itemAt2.Template.Name + "]来强化此装备.");
                            num    = 1;
                            result = num;
                            return(result);
                        }
                        flag5 |= itemAt2.IsBinds;
                        flag9 |= (itemAt2.Template.Property1 == 35 && itemAt2.Template.CategoryID == 11);
                        num2  += (double)itemAt2.Template.Property2;
                        stringBuilder.Append(itemAt2.ToShortString());
                        list.Add(itemAt2);
                    }
                    ItemInfo itemAt3 = player.HideBag.GetItemAt(2);
                    bool     flag14  = itemAt3 != null && itemAt3.Template.CategoryID == 11 && (itemAt3.Template.Property1 == 2 || itemAt3.Template.Property1 == 35) && !list.Contains(itemAt3);
                    if (flag14)
                    {
                        bool flag15 = itemInfo.StrengthenLevel >= 15 && itemAt3.Template.Property8 == 2;
                        if (flag15)
                        {
                            player.Out.SendMessage(0, "不能使用[" + itemAt3.Template.Name + "]来强化此装备.");
                            num    = 1;
                            result = num;
                            return(result);
                        }
                        flag5 |= itemAt3.IsBinds;
                        flag9 |= (itemAt3.Template.Property1 == 35 && itemAt3.Template.CategoryID == 11);
                        num2  += (double)itemAt3.Template.Property2;
                        stringBuilder.Append(itemAt3.ToShortString());
                        list.Add(itemAt3);
                    }
                    ItemInfo itemInfo3 = player.HideBag.GetItemAt(4);
                    bool     flag16    = itemInfo3 != null && itemInfo3.Template.CategoryID == 11 && itemInfo3.Template.Property1 == 3;
                    if (flag16)
                    {
                        flag5 |= itemInfo3.IsBinds;
                        num2  *= (double)(itemInfo3.Template.Property2 + 100);
                        stringBuilder.Append(itemInfo3.ToShortString());
                    }
                    else
                    {
                        num2     *= 100.0;
                        itemInfo3 = null;
                    }
                    bool          flag17        = false;
                    ConsortiaInfo consortiaInfo = null;
                    bool          flag18        = flag6;
                    if (flag18)
                    {
                        consortiaInfo = ConsortiaMgr.FindConsortiaInfo(player.PlayerCharacter.ConsortiaID);
                        bool flag19 = consortiaInfo == null;
                        if (flag19)
                        {
                            player.Out.SendMessage(0, LanguageMgr.GetTranslation("ItemStrengthenHandler.Fail", new object[0]));
                        }
                        else
                        {
                            using (ConsortiaBussiness consortiaBussiness = new ConsortiaBussiness())
                            {
                                ConsortiaEquipControlInfo consortiaEuqipRiches = consortiaBussiness.GetConsortiaEuqipRiches(player.PlayerCharacter.ConsortiaID, 0, 2);
                                bool flag20 = player.PlayerCharacter.Riches < consortiaEuqipRiches.Riches;
                                if (flag20)
                                {
                                    player.Out.SendMessage(eMessageType.ERROR, LanguageMgr.GetTranslation("ItemStrengthenHandler.FailbyPermission", new object[0]));
                                    num    = 1;
                                    result = num;
                                    return(result);
                                }
                                flag17 = true;
                            }
                        }
                    }
                    bool flag21 = list.Count >= 1;
                    if (flag21)
                    {
                        StrengthenGoodsInfo strengthenGoodsInfo = StrengthenMgr.FindStrengthenGoodsInfo(itemInfo.StrengthenLevel + 1, itemInfo.TemplateID);
                        ItemInfo            itemInfo4           = null;
                        bool flag22 = strengthenGoodsInfo != null;
                        if (flag22)
                        {
                            itemInfo4 = ItemInfo.CreateFromTemplate(ItemMgr.FindItemTemplate(strengthenGoodsInfo.GainEquip), 1, 116);
                            bool flag23 = itemInfo4 == null;
                            if (flag23)
                            {
                                num    = 0;
                                result = num;
                                return(result);
                            }
                        }
                        string text = null;
                        player.HideBag.BeginChanges();
                        try
                        {
                            num2 /= (double)strengthenInfo.Rock;
                            int num3;
                            for (int i = 0; i < list.Count; i = num3 + 1)
                            {
                                player.HideBag.RemoveCountFromStack(list[i], 1, (eItemRemoveType)5);
                                num3 = i;
                            }
                            bool flag24 = itemInfo3 != null;
                            if (flag24)
                            {
                                player.HideBag.RemoveCountFromStack(itemInfo3, 1, (eItemRemoveType)5);
                            }
                            bool flag25 = itemInfo2 != null;
                            if (flag25)
                            {
                                player.HideBag.RemoveCountFromStack(itemInfo2, 1, (eItemRemoveType)5);
                            }
                            bool flag26 = flag17;
                            if (flag26)
                            {
                                num2 *= 1.0 + 0.1 * (double)consortiaInfo.SmithLevel;
                            }
                            itemInfo.IsBinds = flag5;
                            int  num4   = 1;
                            bool flag27 = num2 > (double)ItemStrengthenHandler.random.Next(10000);
                            if (flag27)
                            {
                                num4 = 0;
                                bool flag28 = strengthenGoodsInfo != null && itemInfo4 != null;
                                if (flag28)
                                {
                                    StrengthenMgr.InheritProperty(itemInfo, itemInfo4);
                                    itemInfo4.StrengthenLevel = (itemInfo.StrengthenLevel + 1);
                                    player.HideBag.RemoveItem(itemInfo, (eItemRemoveType)5);
                                    player.HideBag.AddItemTo(itemInfo4, 5);
                                    text     = string.Format("temp_place_{0}", itemInfo.ItemID);
                                    itemInfo = itemInfo4;
                                    bool flag29 = itemInfo.ItemID == 0;
                                    if (flag29)
                                    {
                                        using (PlayerBussiness playerBussiness = new PlayerBussiness())
                                        {
                                            playerBussiness.AddGoods(itemInfo);
                                        }
                                    }
                                }
                                else
                                {
                                    ItemInfo itemInfo5 = itemInfo;
                                    num3 = itemInfo5.StrengthenLevel;
                                    itemInfo5.StrengthenLevel = (num3 + 1);
                                }
                                player.OnItemStrengthen(itemInfo.Template.CategoryID, itemInfo.StrengthenLevel);
                                bool flag30 = itemInfo.StrengthenLevel >= 7;
                                if (flag30)
                                {
                                    string translation = LanguageMgr.GetTranslation("ItemStrengthenHandler.congratulation", new object[]
                                    {
                                        player.PlayerCharacter.NickName,
                                        itemInfo.StrengthenLevel
                                    });
                                    GSPacketIn packet2 = WorldMgr.SendSysNotice(translation, itemInfo, player);
                                    GameServer.Instance.LoginServer.SendPacket(packet2);
                                }
                            }
                            else
                            {
                                num4 = 1;
                                bool flag31 = !flag7;
                                if (flag31)
                                {
                                    StrengthenGoodsInfo strengthenGoodsInfo2 = StrengthenMgr.FindStrengthenFailGoodsInfo(itemInfo.StrengthenLevel, itemInfo.TemplateID);
                                    itemInfo.StrengthenLevel = ((itemInfo.StrengthenLevel == 0) ? 0 : (itemInfo.StrengthenLevel - 1));
                                    bool flag32 = strengthenGoodsInfo2 != null;
                                    if (flag32)
                                    {
                                        ItemInfo itemInfo6 = ItemInfo.CreateFromTemplate(ItemMgr.FindItemTemplate(strengthenGoodsInfo2.CurrentEquip), 1, 116);
                                        bool     flag33    = itemInfo6 == null;
                                        if (flag33)
                                        {
                                            num    = 0;
                                            result = num;
                                            return(result);
                                        }
                                        StrengthenMgr.InheritProperty(itemInfo, itemInfo6);
                                        itemInfo6.StrengthenLevel = (itemInfo.StrengthenLevel);
                                        player.HideBag.RemoveItem(itemInfo, (eItemRemoveType)5);
                                        player.HideBag.AddItemTo(itemInfo6, 5);
                                    }
                                }
                            }
                            player.HideBag.UpdateItem(itemInfo);
                            gSPacketIn.WriteByte((byte)num4);
                            gSPacketIn.WriteBoolean(itemInfo.IsOpenHole);
                            player.RemoveGold(pRICE_STRENGHTN_GOLD);
                            //LogMgr.LogItemAdd(player.PlayerCharacter.ID, 1, propertyString, itemInfo, stringBuilder.ToString(), (num4 == 1) ? 0 : 1);
                        }
                        finally
                        {
                            player.HideBag.CommitChanges();
                            player.Out.SendTCP(gSPacketIn);
                        }
                        player.SaveIntoDatabase();
                        bool flag34 = text != null && player.TempProperties.ContainsKey(text);
                        if (flag34)
                        {
                            int num5 = (int)player.TempProperties[text];
                            player.TempProperties.Remove(text);
                            text = string.Format("temp_place_{0}", itemInfo.ItemID);
                            player.TempProperties.Add(text, num5);
                        }
                    }
                    else
                    {
                        player.Out.SendMessage(0, LanguageMgr.GetTranslation("ItemStrengthenHandler.Content1", new object[0]) + 1 + LanguageMgr.GetTranslation("ItemStrengthenHandler.Content2", new object[0]));
                    }
                }
                else
                {
                    player.Out.SendMessage(0, LanguageMgr.GetTranslation("ItemStrengthenHandler.Success", new object[0]));
                }
                num = 0;
            }
            result = num;
            return(result);
        }
Exemplo n.º 33
0
        public void HandlePacket(GameClient client, GSPacketIn packet)
        {
            if (client == null)
            {
                return;
            }

            string ipAddress = client.TcpEndpointAddress;

            byte   major;
            byte   minor;
            byte   build;
            string password;
            string userName;

            if (client.Version >= GameClient.eClientVersion.Version1126)
            {
                // Read Login
                userName = packet.ReadIntPascalStringLowEndian();

                // Read Password
                password = packet.ReadIntPascalStringLowEndian();
            }
            else if (client.Version == GameClient.eClientVersion.Version1125)
            {
                // 1.125

                // client type
                packet.Skip(1);

                //version
                major = (byte)packet.ReadByte();
                minor = (byte)packet.ReadByte();
                build = (byte)packet.ReadByte();

                // revision
                packet.Skip(1);
                // build
                packet.Skip(2);

                // Read Login
                userName = packet.ReadIntPascalStringLowEndian();

                // Read Password
                password = packet.ReadIntPascalStringLowEndian();
            }
            else
            {
                // 1.115c - 1.124

                // client type
                packet.Skip(1);

                //version
                major = (byte)packet.ReadByte();
                minor = (byte)packet.ReadByte();
                build = (byte)packet.ReadByte();

                // revision
                packet.Skip(1);
                // build
                packet.Skip(2);

                // Read Login
                userName = packet.ReadShortPascalStringLowEndian();

                // Read Password
                password = packet.ReadShortPascalStringLowEndian();
            }

            // check server status
            if (GameServer.Instance.ServerStatus == eGameServerStatus.GSS_Closed)
            {
                client.IsConnected = false;
                client.Out.SendLoginDenied(eLoginError.GameCurrentlyClosed);
                log.Info(ipAddress + " disconnected because game is closed!");
                GameServer.Instance.Disconnect(client);

                return;
            }

            // check connection allowed with serverrules
            try
            {
                if (!GameServer.ServerRules.IsAllowedToConnect(client, userName))
                {
                    if (log.IsInfoEnabled)
                    {
                        log.Info($"{ipAddress} disconnected because IsAllowedToConnect returned false!");
                    }

                    GameServer.Instance.Disconnect(client);

                    return;
                }
            }
            catch (Exception e)
            {
                if (log.IsErrorEnabled)
                {
                    log.Error("Error shutting down Client after IsAllowedToConnect failed!", e);
                }
            }

            // Handle connection
            EnterLock(userName);

            try
            {
                // Make sure that client won't quit
                lock (client)
                {
                    GameClient.eClientState state = client.ClientState;
                    if (state != GameClient.eClientState.NotConnected)
                    {
                        log.Debug($"wrong client state on connect {userName} {state}");
                        return;
                    }

                    if (log.IsInfoEnabled)
                    {
                        log.Info($"({ipAddress})User {userName} logging on! ({client.Version} type:{client.ClientType} add:{client.ClientAddons:G})");
                    }

                    // check client already connected
                    GameClient findclient = WorldMgr.GetClientByAccountName(userName, true);
                    if (findclient != null)
                    {
                        client.IsConnected = false;

                        if (findclient.ClientState == GameClient.eClientState.Connecting)
                        {
                            if (log.IsInfoEnabled)
                            {
                                log.Info("User is already connecting, ignored.");
                            }

                            client.Out.SendLoginDenied(eLoginError.AccountAlreadyLoggedIn);

                            return;
                        } // in login

                        if (findclient.ClientState == GameClient.eClientState.Linkdead)
                        {
                            if (log.IsInfoEnabled)
                            {
                                log.Info("User is still being logged out from linkdeath!");
                            }

                            client.Out.SendLoginDenied(eLoginError.AccountIsInLogoutProcedure);
                        }
                        else
                        {
                            if (log.IsInfoEnabled)
                            {
                                log.Info("User already logged in!");
                            }

                            client.Out.SendLoginDenied(eLoginError.AccountAlreadyLoggedIn);
                        }

                        GameServer.Instance.Disconnect(client);

                        return;
                    }

                    Regex   goodName = new Regex("^[a-zA-Z0-9]*$");
                    Account playerAccount;
                    if (!goodName.IsMatch(userName) || string.IsNullOrWhiteSpace(userName))
                    {
                        if (log.IsInfoEnabled)
                        {
                            log.Info($"Invalid symbols in account name \"{userName}\" found!");
                        }

                        client.IsConnected = false;
                        if (client.Out != null)
                        {
                            client.Out.SendLoginDenied(eLoginError.AccountInvalid);
                        }
                        else
                        {
                            log.Warn("Client or Client.Out null on invalid name failure.  Disconnecting.");
                        }

                        GameServer.Instance.Disconnect(client);

                        return;
                    }
                    else
                    {
                        playerAccount = GameServer.Database.FindObjectByKey <Account>(userName);

                        client.PingTime = DateTime.Now.Ticks;

                        if (playerAccount == null)
                        {
                            // check autocreate ...
                            if (GameServer.Instance.Configuration.AutoAccountCreation && Properties.ALLOW_AUTO_ACCOUNT_CREATION)
                            {
                                // autocreate account
                                if (string.IsNullOrEmpty(password))
                                {
                                    client.IsConnected = false;
                                    client.Out.SendLoginDenied(eLoginError.AccountInvalid);
                                    GameServer.Instance.Disconnect(client);

                                    if (log.IsInfoEnabled)
                                    {
                                        log.Info($"Account creation failed, no password set for Account: {userName}");
                                    }

                                    return;
                                }

                                // check for account bombing
                                TimeSpan        ts;
                                IList <Account> allAccByIp = GameServer.Database.SelectObjects <Account>("`LastLoginIP` = @LastLoginIP", new QueryParameter("@LastLoginIP", ipAddress));
                                int             totalacc   = 0;
                                foreach (Account ac in allAccByIp)
                                {
                                    ts = DateTime.Now - ac.CreationDate;
                                    if (ts.TotalMinutes < Properties.TIME_BETWEEN_ACCOUNT_CREATION_SAMEIP && totalacc > 1)
                                    {
                                        log.Warn($"Account creation: too many from same IP within set minutes - {userName} : {ipAddress}");

                                        client.IsConnected = false;
                                        client.Out.SendLoginDenied(eLoginError.PersonalAccountIsOutOfTime);
                                        GameServer.Instance.Disconnect(client);

                                        return;
                                    }

                                    totalacc++;
                                }

                                if (totalacc >= Properties.TOTAL_ACCOUNTS_ALLOWED_SAMEIP)
                                {
                                    log.Warn($"Account creation: too many accounts created from same ip - {userName} : {ipAddress}");

                                    client.IsConnected = false;
                                    client.Out.SendLoginDenied(eLoginError.AccountNoAccessThisGame);
                                    GameServer.Instance.Disconnect(client);

                                    return;
                                }

                                // per timeslice - for preventing account bombing via different ip
                                if (Properties.TIME_BETWEEN_ACCOUNT_CREATION > 0)
                                {
                                    ts = DateTime.Now - _lastAccountCreateTime;
                                    if (ts.TotalMinutes < Properties.TIME_BETWEEN_ACCOUNT_CREATION)
                                    {
                                        log.Warn($"Account creation: time between account creation too small - {userName} : {ipAddress}");

                                        client.IsConnected = false;
                                        client.Out.SendLoginDenied(eLoginError.PersonalAccountIsOutOfTime);
                                        GameServer.Instance.Disconnect(client);

                                        return;
                                    }
                                }

                                _lastAccountCreateTime = DateTime.Now;

                                playerAccount = new Account
                                {
                                    Name              = userName,
                                    Password          = CryptPassword(password),
                                    Realm             = 0,
                                    CreationDate      = DateTime.Now,
                                    LastLogin         = DateTime.Now,
                                    LastLoginIP       = ipAddress,
                                    LastClientVersion = ((int)client.Version).ToString(),
                                    Language          = Properties.SERV_LANGUAGE,
                                    PrivLevel         = 1
                                };

                                if (log.IsInfoEnabled)
                                {
                                    log.Info($"New account created: {userName}");
                                }

                                GameServer.Database.AddObject(playerAccount);

                                // Log account creation
                                AuditMgr.AddAuditEntry(client, AuditType.Account, AuditSubtype.AccountCreate, string.Empty, userName);
                            }
                            else
                            {
                                if (log.IsInfoEnabled)
                                {
                                    log.Info("No such account found and autocreation deactivated!");
                                }

                                client.IsConnected = false;
                                client.Out.SendLoginDenied(eLoginError.AccountNotFound);
                                GameServer.Instance.Disconnect(client);

                                return;
                            }
                        }
                        else
                        {
                            // check password
                            if (!playerAccount.Password.StartsWith("##"))
                            {
                                playerAccount.Password = CryptPassword(playerAccount.Password);
                            }

                            if (!CryptPassword(password).Equals(playerAccount.Password))
                            {
                                if (log.IsInfoEnabled)
                                {
                                    log.Info($"({client.TcpEndpoint}) Wrong password!");
                                }

                                client.IsConnected = false;
                                client.Out.SendLoginDenied(eLoginError.WrongPassword);

                                // Log failure
                                AuditMgr.AddAuditEntry(client, AuditType.Account, AuditSubtype.AccountFailedLogin, string.Empty, userName);

                                GameServer.Instance.Disconnect(client);

                                return;
                            }

                            // save player infos
                            playerAccount.LastLogin         = DateTime.Now;
                            playerAccount.LastLoginIP       = ipAddress;
                            playerAccount.LastClientVersion = ((int)client.Version).ToString();
                            if (string.IsNullOrEmpty(playerAccount.Language))
                            {
                                playerAccount.Language = Properties.SERV_LANGUAGE;
                            }

                            GameServer.Database.SaveObject(playerAccount);
                        }
                    }

                    // Save the account table
                    client.Account = playerAccount;

                    // create session ID here to disable double login bug
                    if (WorldMgr.CreateSessionID(client) < 0)
                    {
                        if (log.IsInfoEnabled)
                        {
                            log.InfoFormat("Too many clients connected, denied login to {0}", playerAccount.Name);
                        }

                        client.IsConnected = false;
                        client.Out.SendLoginDenied(eLoginError.TooManyPlayersLoggedIn);
                        client.Disconnect();

                        return;
                    }

                    client.Out.SendLoginGranted();
                    client.ClientState = GameClient.eClientState.Connecting;

                    // Log entry
                    AuditMgr.AddAuditEntry(client, AuditType.Account, AuditSubtype.AccountSuccessfulLogin, string.Empty, userName);
                }
            }
            catch (DatabaseException e)
            {
                if (log.IsErrorEnabled)
                {
                    log.Error("LoginRequestHandler", e);
                }

                client.IsConnected = false;
                client.Out.SendLoginDenied(eLoginError.CannotAccessUserAccount);
                GameServer.Instance.Disconnect(client);
            }
            catch (Exception e)
            {
                if (log.IsErrorEnabled)
                {
                    log.Error("LoginRequestHandler", e);
                }

                client.Out.SendLoginDenied(eLoginError.CannotAccessUserAccount);
                GameServer.Instance.Disconnect(client);
            }
            finally
            {
                ExitLock(userName);
            }
        }
Exemplo n.º 34
0
        public static void ScriptLoaded(DOLEvent e, object sender, EventArgs args)
        {
            if (!ServerProperties.Properties.LOAD_QUESTS)
            {
                return;
            }

            if (log.IsInfoEnabled)
            {
                log.Info("Quest \"" + questTitle + "\" initializing ...");
            }

            GameNPC[] npcs = WorldMgr.GetObjectsByName <GameNPC>("Lady Grynoch", eRealm.Albion);

            if (npcs.Length == 0)
            {
                LadyGrynoch       = new GameNPC();
                LadyGrynoch.Model = 5;
                LadyGrynoch.Name  = "Lady Grynoch";
                if (log.IsWarnEnabled)
                {
                    log.Warn("Could not find " + LadyGrynoch.Name + ", creating her ...");
                }

                // k109: My preference, no guildname for quest NPCs.  Uncomment if you like that...
                // LadyGrynoch.GuildName = "Part of " + questTitle + " Quest";
                LadyGrynoch.Realm           = eRealm.Albion;
                LadyGrynoch.CurrentRegionID = 1;

                GameNpcInventoryTemplate template = new GameNpcInventoryTemplate();
                template.AddNPCEquipment(eInventorySlot.TorsoArmor, 58);    // Slot 25
                LadyGrynoch.Inventory = template.CloseTemplate();
                LadyGrynoch.SwitchWeapon(GameLiving.eActiveWeaponSlot.Standard);

                LadyGrynoch.Size    = 51;
                LadyGrynoch.Level   = 38;
                LadyGrynoch.X       = 559698;
                LadyGrynoch.Y       = 513578;
                LadyGrynoch.Z       = 2428;
                LadyGrynoch.Heading = 2742;

                if (SAVE_INTO_DATABASE)
                {
                    LadyGrynoch.SaveIntoDatabase();
                }

                LadyGrynoch.AddToWorld();
            }
            else
            {
                LadyGrynoch = npcs[0];
            }

            Burial_Tomb_Area = WorldMgr.GetRegion(Burial_Tomb.RegionID).AddArea(new Area.Circle(string.Empty, Burial_Tomb.X, Burial_Tomb.Y, Burial_Tomb.Z, 200));
            Burial_Tomb_Area.RegisterPlayerEnter(new DOLEventHandler(PlayerEnterBurialTombArea));

            GameEventMgr.AddHandler(GamePlayerEvent.AcceptQuest, new DOLEventHandler(SubscribeQuest));
            GameEventMgr.AddHandler(GamePlayerEvent.DeclineQuest, new DOLEventHandler(SubscribeQuest));

            GameEventMgr.AddHandler(LadyGrynoch, GameLivingEvent.Interact, new DOLEventHandler(TalkToLadyGrynoch));
            GameEventMgr.AddHandler(LadyGrynoch, GameLivingEvent.WhisperReceive, new DOLEventHandler(TalkToLadyGrynoch));

            LadyGrynoch.AddQuestToGive(typeof(TombWithAView));

            if (log.IsInfoEnabled)
            {
                log.Info("Quest \"" + questTitle + "\" initialized");
            }
        }
Exemplo n.º 35
0
        public static void ScriptLoaded(DOLEvent e, object sender, EventArgs args)
        {
            if (!ServerProperties.Properties.LOAD_QUESTS)
            {
                return;
            }

            if (log.IsInfoEnabled)
            {
                log.Info("Quest \"" + questTitle + "\" initializing ...");
            }

            /* First thing we do in here is to search for the NPCs inside
             * the world who comes from the certain Realm. If we find a the players,
             * this means we don't have to create a new one.
             *
             * NOTE: You can do anything you want in this method, you don't have
             * to search for NPC's ... you could create a custom item, place it
             * on the ground and if a player picks it up, he will get the quest!
             * Just examples, do anything you like and feel comfortable with :)
             */

            GameNPC[] npcs = WorldMgr.GetObjectsByName <GameNPC>("Commander Burcrif", eRealm.Albion);

            /* Whops, if the npcs array length is 0 then no npc exists in
             * this users Mob Database, so we simply create one ;-)
             * else we take the existing one. And if more than one exist, we take
             * the first ...
             */
            if (npcs.Length == 0)
            {
                commanderBurcrif       = new GameNPC();
                commanderBurcrif.Model = 28;
                commanderBurcrif.Name  = "Commander Burcrif";
                if (log.IsWarnEnabled)
                {
                    log.Warn("Could not find " + commanderBurcrif.Name + ", creating him ...");
                }

                commanderBurcrif.GuildName       = "Part of " + questTitle + " Quest";
                commanderBurcrif.Realm           = eRealm.Albion;
                commanderBurcrif.CurrentRegionID = 1;

                GameNpcInventoryTemplate template = new GameNpcInventoryTemplate();
                template.AddNPCEquipment(eInventorySlot.TwoHandWeapon, 26);
                template.AddNPCEquipment(eInventorySlot.HeadArmor, 93);
                template.AddNPCEquipment(eInventorySlot.HandsArmor, 49);
                template.AddNPCEquipment(eInventorySlot.FeetArmor, 50);
                template.AddNPCEquipment(eInventorySlot.TorsoArmor, 662);
                template.AddNPCEquipment(eInventorySlot.Cloak, 91);
                template.AddNPCEquipment(eInventorySlot.LegsArmor, 47);
                template.AddNPCEquipment(eInventorySlot.ArmsArmor, 48);
                commanderBurcrif.Inventory = template.CloseTemplate();
                commanderBurcrif.SwitchWeapon(GameLiving.eActiveWeaponSlot.TwoHanded);

                commanderBurcrif.Size    = 53;
                commanderBurcrif.Level   = 45;
                commanderBurcrif.X       = 517270;
                commanderBurcrif.Y       = 495711;
                commanderBurcrif.Z       = 3352;
                commanderBurcrif.Heading = 2093;

                // You don't have to store the created mob in the db if you don't want,
                // it will be recreated each time it is not found, just comment the following
                // line if you rather not modify your database
                if (SAVE_INTO_DATABASE)
                {
                    commanderBurcrif.SaveIntoDatabase();
                }

                commanderBurcrif.AddToWorld();
            }
            else
            {
                commanderBurcrif = npcs[0];
            }

            // item db check
            slithsTail = GameServer.Database.FindObjectByKey <ItemTemplate>("sliths_tail");
            if (slithsTail == null)
            {
                slithsTail      = new ItemTemplate();
                slithsTail.Name = "Slith's Tail";
                if (log.IsWarnEnabled)
                {
                    log.Warn("Could not find " + slithsTail.Name + ", creating it ...");
                }

                slithsTail.Level  = 7;
                slithsTail.Weight = 10;
                slithsTail.Model  = 515;

                slithsTail.Object_Type = (int)eObjectType.Magical;
                slithsTail.Item_Type   = (int)eEquipmentItems.L_RING;
                slithsTail.Id_nb       = "sliths_tail";
                slithsTail.Price       = Money.GetMoney(0, 0, 0, 0, 30);
                slithsTail.IsPickable  = true;
                slithsTail.IsDropable  = true;

                slithsTail.Bonus1     = 3;
                slithsTail.Bonus1Type = (int)eProperty.Dexterity;

                slithsTail.Quality       = 100;
                slithsTail.Condition     = 1000;
                slithsTail.MaxCondition  = 1000;
                slithsTail.Durability    = 1000;
                slithsTail.MaxDurability = 1000;

                // You don't have to store the created item in the db if you don't want,
                // it will be recreated each time it is not found, just comment the following
                // line if you rather not modify your database
                GameServer.Database.AddObject(slithsTail);
            }

            /* Now we add some hooks to the npc we found.
             * Actually, we want to know when a player interacts with him.
             * So, we hook the right-click (interact) and the whisper method
             * of npc and set the callback method to the "TalkToXXX"
             * method. This means, the "TalkToXXX" method is called whenever
             * a player right clicks on him or when he whispers to him.
             */

            GameEventMgr.AddHandler(GamePlayerEvent.AcceptQuest, new DOLEventHandler(SubscribeQuest));
            GameEventMgr.AddHandler(GamePlayerEvent.DeclineQuest, new DOLEventHandler(SubscribeQuest));

            GameEventMgr.AddHandler(commanderBurcrif, GameLivingEvent.Interact, new DOLEventHandler(TalkToCommanderBurcrif));
            GameEventMgr.AddHandler(commanderBurcrif, GameLivingEvent.WhisperReceive, new DOLEventHandler(TalkToCommanderBurcrif));

            /* Now we bring to Yetta Fletcher the possibility to give this quest to players */
            commanderBurcrif.AddQuestToGive(typeof(HuntForSlith));

            if (log.IsInfoEnabled)
            {
                log.Info("Quest \"" + questTitle + "\" initialized");
            }
        }
Exemplo n.º 36
0
        public static void HandleMoveUpdate(ulong guid, ObjectMovementValues movementValues, Vector4 vector)
        {
            PacketWriter moveUpdate = new PacketWriter(ServerMessage.MoveUpdate);
            BitPack      BitPack    = new BitPack(moveUpdate, guid);

            BitPack.WriteGuidMask(2);
            BitPack.Write(0);
            BitPack.WriteGuidMask(1);
            BitPack.Write(!movementValues.HasMovementFlags2);
            BitPack.Write(true);
            BitPack.Write(true);
            BitPack.Write <uint>(0, 22);
            BitPack.WriteGuidMask(3);
            BitPack.Write(!movementValues.IsAlive);
            BitPack.Write(!movementValues.HasMovementFlags);
            BitPack.WriteGuidMask(6);

            if (movementValues.HasMovementFlags2)
            {
                BitPack.Write((uint)movementValues.MovementFlags2, 13);
            }

            BitPack.WriteGuidMask(4, 7);
            BitPack.Write(movementValues.IsInterpolated);
            BitPack.Write(0);

            if (movementValues.HasMovementFlags)
            {
                BitPack.Write((uint)movementValues.MovementFlags, 30);
            }

            BitPack.Write(!movementValues.HasRotation);
            BitPack.Write(movementValues.IsTransport);
            BitPack.WriteGuidMask(5);

            if (movementValues.IsInterpolated)
            {
                BitPack.Write(movementValues.IsInterpolated2);
            }

            BitPack.Write(true);
            BitPack.Write(0);
            BitPack.WriteGuidMask(0);

            BitPack.Flush();

            moveUpdate.WriteFloat(vector.Z);

            BitPack.WriteGuidBytes(3);

            moveUpdate.WriteFloat(vector.X);

            BitPack.WriteGuidBytes(0, 7);

            moveUpdate.WriteFloat(vector.Y);

            BitPack.WriteGuidBytes(5);

            if (movementValues.IsInterpolated)
            {
                moveUpdate.WriteFloat(0);

                if (movementValues.IsInterpolated2)
                {
                    moveUpdate.WriteFloat(0);
                    moveUpdate.WriteFloat(0);
                    moveUpdate.WriteFloat(0);
                }

                moveUpdate.WriteUInt32(0);
            }

            BitPack.WriteGuidBytes(6, 2);

            if (movementValues.IsAlive)
            {
                moveUpdate.WriteUInt32(movementValues.Time);
            }

            BitPack.WriteGuidBytes(1, 4);

            if (movementValues.HasRotation)
            {
                moveUpdate.WriteFloat(vector.O);
            }

            var session = WorldMgr.GetSession(guid);

            if (session != null)
            {
                Character pChar = session.Character;

                ObjectMgr.SetPosition(ref pChar, vector, false);
                WorldMgr.SendToInRangeCharacter(pChar, moveUpdate);
            }
        }
Exemplo n.º 37
0
        public static void SendMessage(ref WorldClass session, ChatMessageValues chatMessage, WorldClass pSession = null)
        {
            byte[] GuidMask   = { 5, 4, 1, 0, 6, 2, 7, 3 };
            byte[] GuidMask3  = { 1, 5, 7, 4, 2, 0, 6, 3 };
            byte[] GuidBytes  = { 5, 0, 7, 4, 3, 2, 1, 6 };
            byte[] GuidBytes3 = { 7, 4, 2, 3, 1, 5, 6, 0 };

            var pChar = session.Character;
            var guid  = pChar.Guid;

            if (pSession != null)
            {
                guid = pSession.Character.Guid;
            }

            PacketWriter chat    = new PacketWriter(ServerMessage.Chat);
            BitPack      BitPack = new BitPack(chat, guid);

            BitPack.Write(1);
            BitPack.Write(0);
            BitPack.Write(1);
            BitPack.Write(1);
            BitPack.Write(0, 8);
            BitPack.Write(0);
            BitPack.Write(1);
            BitPack.WriteGuidMask(GuidMask3);
            BitPack.Write(0);
            BitPack.Write(1);
            BitPack.Write(1);
            BitPack.Write(0, 8);
            BitPack.Write(0);
            BitPack.Write(1);
            BitPack.WriteStringLength(chatMessage.Message, 12);
            BitPack.Write(!chatMessage.HasRealmId);
            BitPack.Write(1);
            BitPack.Write(0);
            BitPack.WriteGuidMask(GuidMask);
            BitPack.Write(0);
            BitPack.Write(8, 9);
            BitPack.Write(!chatMessage.HasLanguage);

            BitPack.Flush();

            BitPack.WriteGuidBytes(GuidBytes3);
            BitPack.WriteGuidBytes(GuidBytes);

            chat.WriteUInt8((byte)chatMessage.ChatType);
            chat.WriteString(chatMessage.Message, false);

            if (chatMessage.HasRealmId)
            {
                chat.WriteInt32(chatMessage.RealmId);
            }

            if (chatMessage.HasLanguage)
            {
                chat.WriteUInt8(chatMessage.Language);
            }

            switch (chatMessage.ChatType)
            {
            case MessageType.ChatMessageSay:
                WorldMgr.SendByDist(pChar, chat, 625);
                break;

            case MessageType.ChatMessageYell:
                WorldMgr.SendByDist(pChar, chat, 90000);
                break;

            default:
                session.Send(ref chat);
                break;
            }
        }
Exemplo n.º 38
0
        public override bool Interact(GamePlayer player)
        {
            if (!base.Interact(player))
            {
                return(false);
            }
            TurnTo(player.X, player.Y);
            player.Out.SendMessage("Hello " + player.Name + ", You can currently be translocated to the [PvP Safe Zone].  Number of Players Currently In the PvP Safe Zone = " + WorldMgr.GetClientsOfRegionCount(91) + " ", eChatType.CT_Say, eChatLoc.CL_PopupWindow);

            return(true);
        }
Exemplo n.º 39
0
        public void OnCommand(GameClient client, string[] args)
        {
            uint hour    = WorldMgr.GetCurrentGameTime() / 1000 / 60 / 60;
            uint minute  = WorldMgr.GetCurrentGameTime() / 1000 / 60 % 60;
            uint seconde = WorldMgr.GetCurrentGameTime() / 1000 % 60;

            string name = "(NoName)";
            var    info = new List <string>();

            info.Add("        Current Region : " + client.Player.CurrentRegionID);
            info.Add(" ");
            Type regionType = client.Player.CurrentRegion.GetType();

            info.Add("       Region ClassType: " + regionType.FullName);
            info.Add(" ");

            if (client.Player.TargetObject != null)
            {
                #region Mob
                /********************* MOB ************************/
                if (client.Player.TargetObject is GameNPC)
                {
                    var target = client.Player.TargetObject as GameNPC;
                    name = target.Name;


                    info.Add(" + Class: " + target.GetType().ToString());
                    info.Add(" + Brain: " + (target.Brain == null ? "(null)" : target.Brain.GetType().ToString()));
                    if (target.LoadedFromScript)
                    {
                        info.Add(" + Loaded: from Script");
                    }
                    else
                    {
                        info.Add(" + Loaded: from Database");
                    }
                    info.Add(" ");
                    if (client.Player.TargetObject is GameMerchant)
                    {
                        var targetM = client.Player.TargetObject as GameMerchant;

                        info.Add(" + Is Merchant ");
                        if (targetM.TradeItems != null)
                        {
                            info.Add(" + Sell List: \n   " + targetM.TradeItems.ItemsListID);
                        }
                        else
                        {
                            info.Add(" + Sell List:  Not Present !\n");
                        }
                        info.Add(" ");
                    }
                    if (client.Player.TargetObject is GamePet)
                    {
                        var targetP = client.Player.TargetObject as GamePet;
                        info.Add(" + Is Pet ");
                        info.Add(" + Pet Owner:   " + targetP.Owner);
                        info.Add(" ");
                    }

                    if (client.Player.TargetObject is GameMovingObject)
                    {
                        var targetM = client.Player.TargetObject as GameMovingObject;
                        info.Add(" + Is GameMovingObject  ");
                        info.Add(" + ( Boats - Siege weapons - Custom Object");
                        info.Add(" + Emblem:   " + targetM.Emblem);
                        info.Add(" ");
                    }

                    info.Add(" + Name: " + name);
                    if (target.GuildName != null && target.GuildName.Length > 0)
                    {
                        info.Add(" + Guild: " + target.GuildName);
                    }
                    info.Add(" + Level: " + target.Level);
                    info.Add(" + Realm: " + GlobalConstants.RealmToName(target.Realm));
                    info.Add(" + Model:  " + target.Model);
                    info.Add(" + Size " + target.Size);
                    info.Add(string.Format(" + Flags: {0} (0x{1})", ((GameNPC.eFlags)target.Flags).ToString("G"), target.Flags.ToString("X")));
                    info.Add(" ");

                    info.Add(" + Speed(current/max): " + target.CurrentSpeed + "/" + target.MaxSpeedBase);
                    info.Add(" + Health: " + target.Health + "/" + target.MaxHealth);

                    IOldAggressiveBrain aggroBrain = target.Brain as IOldAggressiveBrain;
                    if (aggroBrain != null)
                    {
                        info.Add(" + Aggro level: " + aggroBrain.AggroLevel);
                        info.Add(" + Aggro range: " + aggroBrain.AggroRange);

                        if (target.MaxDistance < 0)
                        {
                            info.Add(" + MaxDistance: " + -target.MaxDistance * aggroBrain.AggroRange / 100);
                        }
                        else
                        {
                            info.Add(" + MaxDistance: " + target.MaxDistance);
                        }
                    }
                    else
                    {
                        info.Add(" + Not aggressive brain");
                    }

                    if (target.NPCTemplate != null)
                    {
                        info.Add(" + NPCTemplate: " + "[" + target.NPCTemplate.TemplateId + "] " + target.NPCTemplate.Name);
                    }

                    info.Add(" + Roaming Range: " + target.RoamingRange);

                    TimeSpan respawn = TimeSpan.FromMilliseconds(target.RespawnInterval);
                    if (target.RespawnInterval <= 0)
                    {
                        info.Add(" + Respawn: NPC will not respawn");
                    }
                    else
                    {
                        string days  = "";
                        string hours = "";
                        if (respawn.Days > 0)
                        {
                            days = respawn.Days + " days ";
                        }
                        if (respawn.Hours > 0)
                        {
                            hours = respawn.Hours + " hours ";
                        }
                        info.Add(" + Respawn: " + days + hours + respawn.Minutes + " minutes " + respawn.Seconds + " seconds");
                        info.Add(" + SpawnPoint:  " + target.SpawnPoint.X + ", " + target.SpawnPoint.Y + ", " + target.SpawnPoint.Z);
                    }

                    if (target.QuestListToGive.Count > 0)
                    {
                        info.Add(" + Quests to give:  " + target.QuestListToGive.Count);
                    }

                    if (target.PathID != null && target.PathID.Length > 0)
                    {
                        info.Add(" + Path: " + target.PathID);
                    }

                    if (target.OwnerID != null && target.OwnerID.Length > 0)
                    {
                        info.Add(" + OwnerID: " + target.OwnerID);
                    }

                    info.Add(" ");
                    if (target.Strength > 0)
                    {
                        info.Add(" + STR: " + target.Strength);
                    }
                    if (target.Constitution > 0)
                    {
                        info.Add(" + CON: " + target.Constitution);
                    }
                    if (target.Dexterity > 0)
                    {
                        info.Add(" + DEX: " + target.Dexterity);
                    }
                    if (target.Quickness > 0)
                    {
                        info.Add(" + QUI: " + target.Quickness);
                    }
                    if (target.Intelligence > 0)
                    {
                        info.Add(" + INT: " + target.Intelligence);
                    }
                    if (target.Empathy > 0)
                    {
                        info.Add(" + EMP: " + target.Empathy);
                    }
                    if (target.Piety > 0)
                    {
                        info.Add(" + PIE: " + target.Piety);
                    }
                    if (target.Charisma > 0)
                    {
                        info.Add(" + CHR: " + target.Charisma);
                    }
                    if (target.BlockChance > 0)
                    {
                        info.Add(" + Block: " + target.BlockChance);
                    }
                    if (target.ParryChance > 0)
                    {
                        info.Add(" + Parry: " + target.ParryChance);
                    }
                    if (target.EvadeChance > 0)
                    {
                        info.Add(" + Evade %:  " + target.EvadeChance);
                    }

                    info.Add(" + Damage type: " + target.MeleeDamageType);
                    if (target.LeftHandSwingChance > 0)
                    {
                        info.Add(" + Left Swing %: " + target.LeftHandSwingChance);
                    }

                    if (target.Abilities != null && target.Abilities.Count > 0)
                    {
                        info.Add(" + Abilities: " + target.Abilities.Count);
                    }

                    if (target.Spells != null && target.Spells.Count > 0)
                    {
                        info.Add(" + Spells: " + target.Spells.Count);
                    }

                    if (target.Styles != null && target.Styles.Count > 0)
                    {
                        info.Add(" + Styles: " + target.Styles.Count);
                    }

                    info.Add(" ");
                    if (target.Race > 0)
                    {
                        info.Add(" + Race:  " + target.Race);
                    }

                    if (target.BodyType > 0)
                    {
                        info.Add(" + Body Type:  " + target.BodyType);
                    }

                    if (target.GetDamageResist(eProperty.Resist_Crush) > 0)
                    {
                        info.Add(" + Resist Crush:  " + target.GetDamageResist(eProperty.Resist_Crush));
                    }
                    if (target.GetDamageResist(eProperty.Resist_Slash) > 0)
                    {
                        info.Add(" + Resist Slash:  " + target.GetDamageResist(eProperty.Resist_Slash));
                    }
                    if (target.GetDamageResist(eProperty.Resist_Thrust) > 0)
                    {
                        info.Add(" + Resist Thrust:  " + target.GetDamageResist(eProperty.Resist_Thrust));
                    }
                    if (target.GetDamageResist(eProperty.Resist_Heat) > 0)
                    {
                        info.Add(" + Resist Heat:  " + target.GetDamageResist(eProperty.Resist_Heat));
                    }
                    if (target.GetDamageResist(eProperty.Resist_Cold) > 0)
                    {
                        info.Add(" + Resist Cold:  " + target.GetDamageResist(eProperty.Resist_Cold));
                    }
                    if (target.GetDamageResist(eProperty.Resist_Matter) > 0)
                    {
                        info.Add(" + Resist Matter:  " + target.GetDamageResist(eProperty.Resist_Matter));
                    }
                    if (target.GetDamageResist(eProperty.Resist_Natural) > 0)
                    {
                        info.Add(" + Resist Natural:  " + target.GetDamageResist(eProperty.Resist_Natural));
                    }
                    if (target.GetDamageResist(eProperty.Resist_Body) > 0)
                    {
                        info.Add(" + Resist Body:  " + target.GetDamageResist(eProperty.Resist_Body));
                    }
                    if (target.GetDamageResist(eProperty.Resist_Spirit) > 0)
                    {
                        info.Add(" + Resist Spirit:  " + target.GetDamageResist(eProperty.Resist_Spirit));
                    }
                    if (target.GetDamageResist(eProperty.Resist_Energy) > 0)
                    {
                        info.Add(" + Resist Energy:  " + target.GetDamageResist(eProperty.Resist_Energy));
                    }
                    info.Add(" + Active weapon slot: " + target.ActiveWeaponSlot);
                    info.Add(" + Visible weapon slot: " + target.VisibleActiveWeaponSlots);

                    if (target.EquipmentTemplateID != null && target.EquipmentTemplateID.Length > 0)
                    {
                        info.Add(" + Equipment Template ID: " + target.EquipmentTemplateID);
                    }

                    if (target.Inventory != null)
                    {
                        info.Add(" + Inventory: " + target.Inventory.AllItems.Count + " items");
                    }

                    info.Add(" ");
                    info.Add(" + Mob_ID:  " + target.InternalID);
                    info.Add(" + Position:  " + target.X + ", " + target.Y + ", " + target.Z + ", " + target.Heading);
                    info.Add(" + OID: " + target.ObjectID);
                    info.Add(" + Package ID:  " + target.PackageID);

                    /*	if (target.Brain != null && target.Brain.IsActive)
                     *      {
                     *              info.Add(target.Brain.GetType().FullName);
                     *              info.Add(target.Brain.ToString());
                     *              info.Add("");
                     *      }
                     */
                    info.Add("");
                    info.Add(" ------ State ------");
                    if (target.IsReturningHome || target.IsReturningToSpawnPoint)
                    {
                        info.Add("IsReturningHome: " + target.IsReturningHome);
                        info.Add("IsReturningToSpawnPoint: " + target.IsReturningToSpawnPoint);
                        info.Add("");
                    }

                    info.Add("InCombat: " + target.InCombat);
                    info.Add("AttackState: " + target.AttackState);
                    info.Add("LastCombatPVE: " + target.LastAttackedByEnemyTickPvE);
                    info.Add("LastCombatPVP: " + target.LastAttackedByEnemyTickPvP);

                    if (target.InCombat || target.AttackState)
                    {
                        info.Add("RegionTick: " + target.CurrentRegion.Time);
                    }

                    info.Add("");

                    if (target.TargetObject != null)
                    {
                        info.Add("TargetObject: " + target.TargetObject.Name);
                        info.Add("InView: " + target.TargetInView);
                    }

                    if (target.Brain != null && target.Brain is StandardMobBrain)
                    {
                        Dictionary <GameLiving, long> aggroList = (target.Brain as StandardMobBrain).AggroTable;

                        if (aggroList.Count > 0)
                        {
                            info.Add("");
                            info.Add("Aggro List:");

                            foreach (GameLiving living in aggroList.Keys)
                            {
                                info.Add(living.Name + ": " + aggroList[living]);
                            }
                        }
                    }

                    if (target.Attackers != null && target.Attackers.Count > 0)
                    {
                        info.Add("");
                        info.Add("Attacker List:");

                        foreach (GameLiving attacker in target.Attackers)
                        {
                            info.Add(attacker.Name);
                        }
                    }

                    if (target.EffectList.Count > 0)
                    {
                        info.Add("");
                        info.Add("Effect List:");

                        foreach (IGameEffect effect in target.EffectList)
                        {
                            info.Add(effect.Name + " remaining " + effect.RemainingTime);
                        }
                    }

                    info.Add("");
                    info.Add(" + Loot:");

                    var template = DOLDB <LootTemplate> .SelectObjects(DB.Column(nameof(LootTemplate.TemplateName)).IsEqualTo(target.Name));

                    foreach (LootTemplate loot in template)
                    {
                        ItemTemplate drop = GameServer.Database.FindObjectByKey <ItemTemplate>(loot.ItemTemplateID);

                        string message = "";
                        if (drop == null)
                        {
                            message += loot.ItemTemplateID + " (Template Not Found)";
                        }
                        else
                        {
                            message += drop.Name + " (" + drop.Id_nb + ")";
                        }

                        message += " Chance: " + loot.Chance.ToString();
                        info.Add("- " + message);
                    }
                }

                #endregion Mob

                #region Player
                /********************* PLAYER ************************/
                if (client.Player.TargetObject is GamePlayer)
                {
                    var target = client.Player.TargetObject as GamePlayer;

                    info.Add("PLAYER INFORMATION (Client # " + target.Client.SessionID + ")");
                    info.Add("  - Name : " + target.Name);
                    info.Add("  - Lastname : " + target.LastName);
                    info.Add("  - Realm : " + GlobalConstants.RealmToName(target.Realm));
                    info.Add("  - Level : " + target.Level);
                    info.Add("  - Class : " + target.CharacterClass.Name);
                    info.Add("  - Guild : " + target.GuildName);
                    info.Add(" ");
                    info.Add("  - Account Name : " + target.AccountName);
                    info.Add("  - IP : " + target.Client.Account.LastLoginIP);
                    info.Add("  - Priv. Level : " + target.Client.Account.PrivLevel);
                    info.Add("  - Client Version: " + target.Client.Account.LastClientVersion);
                    info.Add(" ");
                    info.Add("  - Craftingskill : " + target.CraftingPrimarySkill + "");
                    info.Add("  - Model ID : " + target.Model);
                    info.Add("  - AFK Message: " + target.TempProperties.getProperty <string>(GamePlayer.AFK_MESSAGE) + "");
                    info.Add(" ");
                    info.Add("  - Money : " + Money.GetString(target.GetCurrentMoney()) + "\n");
                    info.Add("  - Speed : " + target.MaxSpeedBase);
                    info.Add("  - XPs : " + target.Experience);
                    info.Add("  - RPs : " + target.RealmPoints);
                    info.Add("  - BPs : " + target.BountyPoints);

                    String sCurrent = "";
                    String sTitle   = "";
                    int    cnt      = 0;

                    info.Add(" ");
                    info.Add("SPECCING INFORMATIONS ");
                    info.Add("  - Remaining spec. points : " + target.SkillSpecialtyPoints);
                    sTitle   = "  - Player specialisations / level: \n";
                    sCurrent = "";
                    foreach (Specialization spec in target.GetSpecList())
                    {
                        sCurrent += "  - " + spec.Name + " = " + spec.Level + " \n";
                    }
                    info.Add(sTitle + sCurrent);

                    sCurrent = "";
                    sTitle   = "";

                    info.Add(" ");
                    info.Add("CHARACTER STATS ");
                    info.Add("  - Maximum Health : " + target.MaxHealth);
                    info.Add("  - Current AF : " + target.GetModified(eProperty.ArmorFactor));
                    info.Add("  - Current ABS : " + target.GetModified(eProperty.ArmorAbsorption));

                    for (eProperty stat = eProperty.Stat_First; stat <= eProperty.Stat_Last; stat++, cnt++)
                    {
                        sTitle   += GlobalConstants.PropertyToName(stat);
                        sCurrent += target.GetModified(stat);

                        info.Add("  - " + sTitle + " : " + sCurrent);
                        sCurrent = "";
                        sTitle   = "";
                    }

                    sCurrent = "";
                    sTitle   = "";
                    cnt      = 0;
                    for (eProperty res = eProperty.Resist_First; res <= eProperty.Resist_Last; res++, cnt++)
                    {
                        sTitle   += GlobalConstants.PropertyToName(res);
                        sCurrent += target.GetModified(res);
                        info.Add("  - " + sTitle + " : " + sCurrent);
                        sCurrent = "";
                        sTitle   = "";
                    }

                    info.Add(" ");
                    info.Add(" ");
                    info.Add("  - Respecs dol : " + target.RespecAmountDOL);
                    info.Add("  - Respecs single : " + target.RespecAmountSingleSkill);
                    info.Add("  - Respecs full : " + target.RespecAmountAllSkill);

                    info.Add(" ");
                    info.Add(" ");
                    info.Add("  --------------------------------------");
                    info.Add("  -----  Inventory Equiped -----");
                    info.Add("  --------------------------------------");
                    ////////////// Inventaire /////////////
                    info.Add("  ----- Money:");
                    info.Add(Money.GetShortString(target.GetCurrentMoney()));
                    info.Add(" ");

                    info.Add("  ----- Wearing:");
                    foreach (InventoryItem item in target.Inventory.EquippedItems)
                    {
                        info.Add(" [" + GlobalConstants.SlotToName(item.Item_Type) + "] " + item.Name);
                    }
                    info.Add(" ");
                }

                #endregion Player

                #region StaticItem

                /********************* OBJECT ************************/
                if (client.Player.TargetObject is GameStaticItem)
                {
                    var target = client.Player.TargetObject as GameStaticItem;

                    if (!string.IsNullOrEmpty(target.Name))
                    {
                        name = target.Name;
                    }
                    info.Add("  ------- OBJECT ------\n");
                    info.Add(" Name: " + name);
                    info.Add(" Model: " + target.Model);
                    info.Add(" Emblem: " + target.Emblem);
                    info.Add(" Realm: " + target.Realm);
                    if (target.Owners.LongLength > 0)
                    {
                        info.Add(" ");
                        info.Add(" Owner Name: " + target.Owners[0].Name);
                    }
                    info.Add(" ");
                    info.Add(" OID: " + target.ObjectID);
                    info.Add(" Type: " + target.GetType());

                    WorldInventoryItem invItem = target as WorldInventoryItem;
                    if (invItem != null)
                    {
                        info.Add(" Count: " + invItem.Item.Count);
                    }

                    info.Add(" ");
                    info.Add(" Location: X= " + target.X + " ,Y= " + target.Y + " ,Z= " + target.Z);
                }

                #endregion StaticItem

                #region Door

                /********************* DOOR ************************/
                if (client.Player.TargetObject is GameDoor)
                {
                    var target = client.Player.TargetObject as GameDoor;

                    string Realmname = "";
                    string statut    = "";

                    name = target.Name;

                    if (target.Realm == eRealm.None)
                    {
                        Realmname = "None";
                    }

                    if (target.Realm == eRealm.Albion)
                    {
                        Realmname = "Albion";
                    }

                    if (target.Realm == eRealm.Midgard)
                    {
                        Realmname = "Midgard";
                    }

                    if (target.Realm == eRealm.Hibernia)
                    {
                        Realmname = "Hibernia";
                    }

                    if (target.Realm == eRealm.Door)
                    {
                        Realmname = "All";
                    }

                    if (target.Locked == 1)
                    {
                        statut = " Locked";
                    }

                    if (target.Locked == 0)
                    {
                        statut = " Unlocked";
                    }

                    info.Add("  ------- DOOR ------\n");
                    info.Add(" ");
                    info.Add(" + Name : " + target.Name);
                    info.Add(" + ID : " + target.DoorID);
                    info.Add(" + Realm : " + (int)target.Realm + " : " + Realmname);
                    info.Add(" + Level : " + target.Level);
                    info.Add(" + Guild : " + target.GuildName);
                    info.Add(" + Health : " + target.Health + " / " + target.MaxHealth);
                    info.Add(" + Statut : " + statut);
                    info.Add(" + Type : " + DoorRequestHandler.m_handlerDoorID / 100000000);
                    info.Add(" ");
                    info.Add(" + X : " + target.X);
                    info.Add(" + Y : " + target.Y);
                    info.Add(" + Z : " + target.Z);
                    info.Add(" + Heading : " + target.Heading);
                }

                #endregion Door

                #region Keep

                /********************* KEEP ************************/
                if (client.Player.TargetObject is GameKeepComponent)
                {
                    var target = client.Player.TargetObject as GameKeepComponent;

                    name = target.Name;

                    string realm = " other realm";
                    if ((byte)target.Realm == 0)
                    {
                        realm = " Monster";
                    }
                    if ((byte)target.Realm == 1)
                    {
                        realm = " Albion";
                    }
                    if ((byte)target.Realm == 2)
                    {
                        realm = " Midgard";
                    }
                    if ((byte)target.Realm == 3)
                    {
                        realm = " Hibernia";
                    }

                    info.Add("  ------- KEEP ------\n");
                    info.Add(" + Name : " + target.Name);
                    info.Add(" + KeepID : " + target.Keep.KeepID);
                    info.Add(" + Level : " + target.Level);
                    info.Add(" + BaseLevel : " + target.Keep.BaseLevel);
                    info.Add(" + Realm : " + realm);
                    info.Add(" ");
                    info.Add(" + Model : " + target.Model);
                    info.Add(" + Skin : " + target.Skin);
                    info.Add(" + Height : " + target.Height);
                    info.Add(" + ID : " + target.ID);
                    info.Add(" ");
                    info.Add(" + Health : " + target.Health);
                    info.Add(" + IsRaized : " + target.IsRaized);
                    info.Add(" + Status : " + target.Status);
                    info.Add(" ");
                    info.Add(" + Climbing : " + target.Climbing);
                    info.Add(" ");
                    info.Add(" + ComponentX : " + target.ComponentX);
                    info.Add(" + ComponentY : " + target.ComponentY);
                    info.Add(" + ComponentHeading : " + target.ComponentHeading);
                    info.Add(" ");
                    info.Add(" + HookPoints : " + target.HookPoints.Count);
                    info.Add(" + Positions : " + target.Positions.Count);
                    info.Add(" ");
                    info.Add(" + RealmPointsValue : " + target.RealmPointsValue);
                    info.Add(" + ExperienceValue : " + target.ExperienceValue);
                    info.Add(" + AttackRange : " + target.AttackRange);
                    info.Add(" ");
                    if (GameServer.KeepManager.GetFrontierKeeps().Contains(target.Keep))
                    {
                        info.Add(" + Keep Manager : " + GameServer.KeepManager.GetType().FullName);
                        info.Add(" + Frontiers");
                    }
                    else if (GameServer.KeepManager.GetBattleground(target.CurrentRegionID) != null)
                    {
                        info.Add(" + Keep Manager : " + GameServer.KeepManager.GetType().FullName);
                        Battleground bg = GameServer.KeepManager.GetBattleground(client.Player.CurrentRegionID);
                        info.Add(" + Battleground (" + bg.MinLevel + " to " + bg.MaxLevel + ", max RL: " + bg.MaxRealmLevel + ")");
                    }
                    else
                    {
                        info.Add(" + Keep Manager :  Not Managed");
                    }
                }

                #endregion Keep

                client.Out.SendCustomTextWindow("[ " + name + " ]", info);
                return;
            }

            if (client.Player.TargetObject == null)
            {
                /*********************** HOUSE *************************/
                if (client.Player.InHouse)
                {
                    #region House

                    House house = client.Player.CurrentHouse as House;

                    name = house.Name;

                    int      level = house.Model - ((house.Model - 1) / 4) * 4;
                    TimeSpan due   = (house.LastPaid.AddDays(ServerProperties.Properties.RENT_DUE_DAYS).AddHours(1) - DateTime.Now);

                    info.Add("  ------- HOUSE ------\n");
                    info.Add(LanguageMgr.GetTranslation(client.Account.Language, "House.SendHouseInfo.Owner", name));
                    info.Add(LanguageMgr.GetTranslation(client.Account.Language, "House.SendHouseInfo.Lotnum", house.HouseNumber));
                    info.Add("Unique ID: " + house.UniqueID);
                    info.Add(LanguageMgr.GetTranslation(client.Account.Language, "House.SendHouseInfo.Level", level));
                    info.Add(" ");
                    info.Add(LanguageMgr.GetTranslation(client.Account.Language, "House.SendHouseInfo.Porch"));
                    info.Add(LanguageMgr.GetTranslation(client.Account.Language, "House.SendHouseInfo.PorchEnabled", (house.Porch ? " Present" : " Not Present")));
                    info.Add(LanguageMgr.GetTranslation(client.Account.Language, "House.SendHouseInfo.PorchRoofColor", Color(house.PorchRoofColor)));
                    info.Add(" ");
                    info.Add(LanguageMgr.GetTranslation(client.Account.Language, "House.SendHouseInfo.ExteriorMaterials"));
                    info.Add(LanguageMgr.GetTranslation(client.Account.Language, "House.SendHouseInfo.RoofMaterial", MaterialWall(house.RoofMaterial)));
                    info.Add(LanguageMgr.GetTranslation(client.Account.Language, "House.SendHouseInfo.WallMaterial", MaterialWall(house.WallMaterial)));

                    info.Add(LanguageMgr.GetTranslation(client.Account.Language, "House.SendHouseInfo.DoorMaterial", MaterialDoor(house.DoorMaterial)));

                    info.Add(LanguageMgr.GetTranslation(client.Account.Language, "House.SendHouseInfo.TrussMaterial", MaterialTruss(house.TrussMaterial)));
                    info.Add(LanguageMgr.GetTranslation(client.Account.Language, "House.SendHouseInfo.PorchMaterial", MaterialTruss(house.PorchMaterial)));
                    info.Add(LanguageMgr.GetTranslation(client.Account.Language, "House.SendHouseInfo.WindowMaterial", MaterialTruss(house.WindowMaterial)));

                    info.Add(" ");
                    info.Add(LanguageMgr.GetTranslation(client.Account.Language, "House.SendHouseInfo.ExteriorUpgrades"));
                    info.Add(LanguageMgr.GetTranslation(client.Account.Language, "House.SendHouseInfo.OutdoorGuildBanner", ((house.OutdoorGuildBanner) ? " Present" : " Not Present")));
                    info.Add(LanguageMgr.GetTranslation(client.Account.Language, "House.SendHouseInfo.OutdoorGuildShield", ((house.OutdoorGuildShield) ? " Present" : " Not Present")));
                    info.Add(" ");
                    info.Add(LanguageMgr.GetTranslation(client.Account.Language, "House.SendHouseInfo.InteriorUpgrades"));
                    info.Add(LanguageMgr.GetTranslation(client.Account.Language, "House.SendHouseInfo.IndoorGuildBanner", ((house.IndoorGuildBanner) ? " Present" : " Not Present")));
                    info.Add(LanguageMgr.GetTranslation(client.Account.Language, "House.SendHouseInfo.IndoorGuildShield", ((house.IndoorGuildShield) ? " Present" : " Not Present")));
                    info.Add(" ");
                    info.Add(LanguageMgr.GetTranslation(client.Account.Language, "House.SendHouseInfo.InteriorCarpets"));
                    if (house.Rug1Color != 0)
                    {
                        info.Add(LanguageMgr.GetTranslation(client.Account.Language, "House.SendHouseInfo.Rug1Color", Color(house.Rug1Color)));
                    }
                    if (house.Rug2Color != 0)
                    {
                        info.Add(LanguageMgr.GetTranslation(client.Account.Language, "House.SendHouseInfo.Rug2Color", Color(house.Rug2Color)));
                    }
                    if (house.Rug3Color != 0)
                    {
                        info.Add(LanguageMgr.GetTranslation(client.Account.Language, "House.SendHouseInfo.Rug3Color", Color(house.Rug3Color)));
                    }
                    if (house.Rug4Color != 0)
                    {
                        info.Add(LanguageMgr.GetTranslation(client.Account.Language, "House.SendHouseInfo.Rug4Color", Color(house.Rug4Color)));
                    }
                    info.Add(" ");
                    info.Add(LanguageMgr.GetTranslation(client.Account.Language, "House.SendHouseInfo.Lockbox", Money.GetString(house.KeptMoney)));
                    info.Add(LanguageMgr.GetTranslation(client.Account.Language, "House.SendHouseInfo.RentalPrice", Money.GetString(HouseMgr.GetRentByModel(house.Model))));
                    info.Add(LanguageMgr.GetTranslation(client.Account.Language, "House.SendHouseInfo.MaxLockbox", Money.GetString(HouseMgr.GetRentByModel(house.Model) * ServerProperties.Properties.RENT_LOCKBOX_PAYMENTS)));
                    info.Add(LanguageMgr.GetTranslation(client.Account.Language, "House.SendHouseInfo.RentDueIn", due.Days, due.Hours));

                    #endregion House

                    client.Out.SendCustomTextWindow(LanguageMgr.GetTranslation(client.Account.Language, "House.SendHouseInfo.HouseOwner", name), info);
                }
                else                 // No target and not in a house
                {
                    string realm = " other realm";
                    if (client.Player.CurrentZone.Realm == eRealm.Albion)
                    {
                        realm = " Albion";
                    }
                    if (client.Player.CurrentZone.Realm == eRealm.Midgard)
                    {
                        realm = " Midgard";
                    }
                    if (client.Player.CurrentZone.Realm == eRealm.Hibernia)
                    {
                        realm = " Hibernia";
                    }

                    info.Add(" Game Time: \t" + hour.ToString() + ":" + minute.ToString());
                    info.Add(" ");
                    info.Add(" Server Rules: " + GameServer.ServerRules.GetType().FullName);

                    if (GameServer.KeepManager.FrontierRegionsList.Contains(client.Player.CurrentRegionID))
                    {
                        info.Add(" Keep Manager: " + GameServer.KeepManager.GetType().FullName);
                        info.Add(" Frontiers");
                    }
                    else if (GameServer.KeepManager.GetBattleground(client.Player.CurrentRegionID) != null)
                    {
                        info.Add(" Keep Manager: " + GameServer.KeepManager.GetType().FullName);
                        Battleground bg = GameServer.KeepManager.GetBattleground(client.Player.CurrentRegionID);
                        info.Add(" Battleground (" + bg.MinLevel + " to " + bg.MaxLevel + ", max RL: " + bg.MaxRealmLevel + ")");
                    }
                    else
                    {
                        info.Add(" Keep Manager :  None for this region");
                    }

                    info.Add(" ");
                    info.Add(" Server players: " + WorldMgr.GetAllPlayingClientsCount());
                    info.Add(" ");
                    info.Add(" Region Players:");
                    info.Add(" All players: " + WorldMgr.GetClientsOfRegionCount(client.Player.CurrentRegion.ID));
                    info.Add(" ");
                    info.Add(" Alb players: " + WorldMgr.GetClientsOfRegionCount(client.Player.CurrentRegion.ID, eRealm.Albion));
                    info.Add(" Hib players: " + WorldMgr.GetClientsOfRegionCount(client.Player.CurrentRegion.ID, eRealm.Hibernia));
                    info.Add(" Mid players: " + WorldMgr.GetClientsOfRegionCount(client.Player.CurrentRegion.ID, eRealm.Midgard));

                    info.Add(" ");
                    info.Add(" Total objects in region: " + client.Player.CurrentRegion.TotalNumberOfObjects);

                    info.Add(" ");
                    info.Add(" NPC in zone:");
                    info.Add(" Alb : " + client.Player.CurrentZone.GetNPCsOfZone(eRealm.Albion).Count);
                    info.Add(" Hib : " + client.Player.CurrentZone.GetNPCsOfZone(eRealm.Hibernia).Count);
                    info.Add(" Mid: " + client.Player.CurrentZone.GetNPCsOfZone(eRealm.Midgard).Count);
                    info.Add(" None : " + client.Player.CurrentZone.GetNPCsOfZone(eRealm.None).Count);
                    info.Add(" ");
                    info.Add(" Total objects in zone: " + client.Player.CurrentZone.TotalNumberOfObjects);
                    info.Add(" ");
                    info.Add(" Zone Description: " + client.Player.CurrentZone.Description);
                    info.Add(" Zone Realm: " + realm);
                    info.Add(" Zone ID: " + client.Player.CurrentZone.ID);
                    info.Add(" Zone IsDungeon: " + client.Player.CurrentZone.IsDungeon);
                    info.Add(" Zone SkinID: " + client.Player.CurrentZone.ZoneSkinID);
                    info.Add(" Zone X: " + client.Player.CurrentZone.XOffset);
                    info.Add(" Zone Y: " + client.Player.CurrentZone.YOffset);
                    info.Add(" Zone Width: " + client.Player.CurrentZone.Width);
                    info.Add(" Zone Height: " + client.Player.CurrentZone.Height);
                    info.Add(" Zone DivingEnabled: " + client.Player.CurrentZone.IsDivingEnabled);
                    info.Add(" Zone Waterlevel: " + client.Player.CurrentZone.Waterlevel);
                    info.Add(" ");
                    info.Add(" Region Name: " + client.Player.CurrentRegion.Name);
                    info.Add(" Region Description: " + client.Player.CurrentRegion.Description);
                    info.Add(" Region Skin: " + client.Player.CurrentRegion.Skin);
                    info.Add(" Region ID: " + client.Player.CurrentRegion.ID);
                    info.Add(" Region Expansion: " + client.Player.CurrentRegion.Expansion);
                    info.Add(" Region IsRvR: " + client.Player.CurrentRegion.IsRvR);
                    info.Add(" Region IsFrontier: " + client.Player.CurrentRegion.IsFrontier);
                    info.Add(" Region IsDungeon: " + client.Player.CurrentRegion.IsDungeon);
                    info.Add(" Zone in Region: " + client.Player.CurrentRegion.Zones.Count);
                    info.Add(" Region WaterLevel: " + client.Player.CurrentRegion.WaterLevel);
                    info.Add(" Region HousingEnabled: " + client.Player.CurrentRegion.HousingEnabled);
                    info.Add(" Region IsDisabled: " + client.Player.CurrentRegion.IsDisabled);
                    info.Add(" ");
                    info.Add(" Region ServerIP: " + client.Player.CurrentRegion.ServerIP);
                    info.Add(" Region ServerPort: " + client.Player.CurrentRegion.ServerPort);

                    client.Out.SendCustomTextWindow("[ " + client.Player.CurrentRegion.Description + " ]", info);
                }
            }
        }
        public static byte[] SendFriendList(byte count, WorldMgr.character c)
        {
            PacketWriter Writer = new PacketWriter();
            Writer.Create(OperationCode.SERVER_SEND_FRIEND_LIST);
            //Groups
            DB ms = new DB("SELECT * FROM friends_groups WHERE playerid='"+ c.Information.CharacterID  +"'");
            int groupcount = ms.Count();
            groupcount = groupcount + 1;
            Writer.Byte((byte)groupcount);

            Writer.Word(0);
            Writer.Text("NonClassified");
            int groupid = 0;
            using (System.Data.SqlClient.SqlDataReader reader = ms.Read())
            {
                while (reader.Read())
                {
                    string groupname = reader.GetString(2);
                    groupid = groupid +1;
                    Writer.Word((short)groupid);
                    Writer.Text(groupname);
                }
            }
            //Friends
            Writer.Byte(count);
            ms = new DB("SELECT * FROM friends WHERE owner='"+ c.Information.CharacterID  +"'");
            using (System.Data.SqlClient.SqlDataReader reader = ms.Read())
            {
                while (reader.Read())
                {
                    int model       = Convert.ToInt32(DB.GetData("SELECT * FROM character WHERE id='" + reader.GetInt32(2) + "'", "chartype"));
                    int status      = Convert.ToInt32(DB.GetData("SELECT * FROM character WHERE id='" + reader.GetInt32(2) + "'", "Online"));
                    int charid = Convert.ToInt32(DB.GetData("SELECT * FROM character WHERE id='" + reader.GetInt32(2) + "'", "id"));
                    string charname = DB.GetData("SELECT * FROM character WHERE id='" + reader.GetInt32(2) + "'", "name");
                    string groupname = reader.GetString(4);

                    Writer.DWord(charid);               // Friend CharID
                    Writer.Text(charname);              // Friend Name
                    Writer.DWord(model);                // Friend Model Type
                    if (groupname == "none")
                        Writer.Word(0);
                    else
                        Writer.Word(groupid);

                    if (status != 0)
                    {
                        Writer.Byte(0);                 // Friend is online
                    }
                    else
                    {
                        Writer.Byte(1);                 // Inverted, Friend is offline
                    }
                }
                reader.Close();
            }
            ms.Close();
            return Writer.GetBytes();
        }
Exemplo n.º 41
0
        public static void ScriptLoaded(DOLEvent e, object sender, EventArgs args)
        {
            if (!ServerProperties.Properties.LOAD_QUESTS)
            {
                return;
            }
            if (log.IsInfoEnabled)
            {
                log.Info("Quest \"" + questTitle + "\" initializing ...");
            }

            /* First thing we do in here is to search for the NPCs inside
             * the world who comes from the Albion realm. If we find a the players,
             * this means we don't have to create a new one.
             *
             * NOTE: You can do anything you want in this method, you don't have
             * to search for NPC's ... you could create a custom item, place it
             * on the ground and if a player picks it up, he will get the quest!
             * Just examples, do anything you like and feel comfortable with :)
             */

            #region defineNPCs

            dalikor = GetDalikor();

            GameNPC[] npcs = WorldMgr.GetNPCsByName("Abohas", eRealm.Midgard);
            if (npcs.Length == 0)
            {
                abohas       = new GameNPC();
                abohas.Model = 215;
                abohas.Name  = "Abohas";
                if (log.IsWarnEnabled)
                {
                    log.Warn("Could not find" + abohas.Name + " , creating her ...");
                }
                abohas.GuildName       = "Part of " + questTitle + " Quest";
                abohas.Realm           = eRealm.Midgard;
                abohas.CurrentRegionID = 100;
                abohas.Size            = 49;
                abohas.Level           = 21;
                abohas.X       = GameLocation.ConvertLocalXToGlobalX(52274, 100);
                abohas.Y       = GameLocation.ConvertLocalYToGlobalY(29985, 100);
                abohas.Z       = 4960;
                abohas.Heading = 123;
                //abohas.EquipmentTemplateID = "1707754";
                //You don't have to store the created mob in the db if you don't want,
                //it will be recreated each time it is not found, just comment the following
                //line if you rather not modify your database
                if (SAVE_INTO_DATABASE)
                {
                    abohas.SaveIntoDatabase();
                }
                abohas.AddToWorld();
            }
            else
            {
                abohas = npcs[0];
            }

            npcs = WorldMgr.GetNPCsByName("Harlfug", eRealm.Midgard);
            if (npcs.Length == 0)
            {
                harlfug       = new GameStableMaster();
                harlfug.Model = 215;
                harlfug.Name  = "Harlfug";
                if (log.IsWarnEnabled)
                {
                    log.Warn("Could not find " + harlfug.Name + ", creating her ...");
                }
                harlfug.GuildName       = "Stable Master";
                harlfug.Realm           = eRealm.Midgard;
                harlfug.CurrentRegionID = 100;
                harlfug.Size            = 52;
                harlfug.Level           = 41;
                harlfug.X                   = 773458;
                harlfug.Y                   = 754240;
                harlfug.Z                   = 4600;
                harlfug.Heading             = 2707;
                harlfug.EquipmentTemplateID = "5100798";

                //You don't have to store the created mob in the db if you don't want,
                //it will be recreated each time it is not found, just comment the following
                //line if you rather not modify your database
                if (SAVE_INTO_DATABASE)
                {
                    harlfug.SaveIntoDatabase();
                }
                harlfug.AddToWorld();
            }
            else
            {
                harlfug = npcs[0];
            }

            npcs = WorldMgr.GetNPCsByName("Gularg", eRealm.Midgard);
            if (npcs.Length == 0)
            {
                gularg       = new GameStableMaster();
                gularg.Model = 212;
                gularg.Name  = "Gularg";
                if (log.IsWarnEnabled)
                {
                    log.Warn("Could not find " + gularg.Name + ", creating her ...");
                }
                gularg.GuildName       = "Stable Master";
                gularg.Realm           = eRealm.Midgard;
                gularg.CurrentRegionID = 100;
                gularg.Size            = 50;
                gularg.Level           = 41;
                gularg.X                   = 803766;
                gularg.Y                   = 721959;
                gularg.Z                   = 4686;
                gularg.Heading             = 3925;
                gularg.EquipmentTemplateID = "5100798";

                //You don't have to store the created mob in the db if you don't want,
                //it will be recreated each time it is not found, just comment the following
                //line if you rather not modify your database
                if (SAVE_INTO_DATABASE)
                {
                    gularg.SaveIntoDatabase();
                }

                gularg.AddToWorld();
            }
            else
            {
                gularg = npcs[0];
            }

            npcs = WorldMgr.GetNPCsByName("Yolafson", eRealm.Midgard);
            if (npcs.Length == 0)
            {
                yolafson       = new GameStableMaster();
                yolafson.Model = 214;
                yolafson.Name  = "Yolafson";
                if (log.IsWarnEnabled)
                {
                    log.Warn("Could not find " + yolafson.Name + ", creating her ...");
                }
                yolafson.GuildName       = "Stable Master";
                yolafson.Realm           = eRealm.Midgard;
                yolafson.CurrentRegionID = 100;
                yolafson.Size            = 51;
                yolafson.Level           = 41;
                yolafson.X                   = 805721;
                yolafson.Y                   = 700414;
                yolafson.Z                   = 4960;
                yolafson.Heading             = 1206;
                yolafson.EquipmentTemplateID = "5100798";

                //You don't have to store the created mob in the db if you don't want,
                //it will be recreated each time it is not found, just comment the following
                //line if you rather not modify your database
                if (SAVE_INTO_DATABASE)
                {
                    yolafson.SaveIntoDatabase();
                }
                yolafson.AddToWorld();
            }
            else
            {
                yolafson = npcs[0];
            }

            #endregion

            #region defineItems

            ticketToHaggerfel = CreateTicketTo("Haggerfel", "hs_src_haggerfel");
            ticketToVasudheim = CreateTicketTo("Vasudheim", "hs_src_vasudheim");


            sackOfSupplies = GameServer.Database.FindObjectByKey <ItemTemplate>("sack_of_supplies");
            if (sackOfSupplies == null)
            {
                sackOfSupplies      = new ItemTemplate();
                sackOfSupplies.Name = "Sack of Supplies";
                if (log.IsWarnEnabled)
                {
                    log.Warn("Could not find " + sackOfSupplies.Name + " , creating it ...");
                }

                sackOfSupplies.Weight = 10;
                sackOfSupplies.Model  = 488;

                sackOfSupplies.Object_Type = (int)eObjectType.GenericItem;

                sackOfSupplies.Id_nb      = "sack_of_supplies";
                sackOfSupplies.IsPickable = true;
                sackOfSupplies.IsDropable = false;

                //You don't have to store the created item in the db if you don't want,
                //it will be recreated each time it is not found, just comment the following
                //line if you rather not modify your database
                if (SAVE_INTO_DATABASE)
                {
                    GameServer.Database.AddObject(sackOfSupplies);
                }
            }

            crateOfVegetables = GameServer.Database.FindObjectByKey <ItemTemplate>("crate_of_vegetables");
            if (crateOfVegetables == null)
            {
                crateOfVegetables      = new ItemTemplate();
                crateOfVegetables.Name = "Crate of Vegetables";
                if (log.IsWarnEnabled)
                {
                    log.Warn("Could not find " + crateOfVegetables.Name + " , creating it ...");
                }

                crateOfVegetables.Weight = 15;
                crateOfVegetables.Model  = 602;

                crateOfVegetables.Object_Type = (int)eObjectType.GenericItem;

                crateOfVegetables.Id_nb      = "crate_of_vegetables";
                crateOfVegetables.IsPickable = true;
                crateOfVegetables.IsDropable = false;

                //You don't have to store the created item in the db if you don't want,
                //it will be recreated each time it is not found, just comment the following
                //line if you rather not modify your database
                if (SAVE_INTO_DATABASE)
                {
                    GameServer.Database.AddObject(crateOfVegetables);
                }
            }

            // item db check
            recruitsCloak = GameServer.Database.FindObjectByKey <ItemTemplate>("recruits_cloak_mid");
            if (recruitsCloak == null)
            {
                recruitsCloak      = new ItemTemplate();
                recruitsCloak.Name = "Recruit's Cloak (Mid)";
                if (log.IsWarnEnabled)
                {
                    log.Warn("Could not find " + recruitsCloak.Name + ", creating it ...");
                }
                recruitsCloak.Level = 3;

                recruitsCloak.Weight = 3;
                recruitsCloak.Model  = 57;

                recruitsCloak.Object_Type = (int)eObjectType.Cloth;
                recruitsCloak.Item_Type   = (int)eEquipmentItems.CLOAK;
                recruitsCloak.Id_nb       = "recruits_cloak_mid";
                recruitsCloak.Price       = Money.GetMoney(0, 0, 0, 1, 0);
                recruitsCloak.IsPickable  = true;
                recruitsCloak.IsDropable  = true;
                recruitsCloak.Color       = 44;          // brown

                recruitsCloak.Bonus = 1;                 // default bonus

                recruitsCloak.Bonus1     = 1;
                recruitsCloak.Bonus1Type = (int)eStat.CON;

                recruitsCloak.Bonus2     = 1;
                recruitsCloak.Bonus2Type = (int)eResist.Slash;

                recruitsCloak.Quality       = 100;
                recruitsCloak.Condition     = 1000;
                recruitsCloak.MaxCondition  = 1000;
                recruitsCloak.Durability    = 1000;
                recruitsCloak.MaxDurability = 1000;

                //You don't have to store the created item in the db if you don't want,
                //it will be recreated each time it is not found, just comment the following
                //line if you rather not modify your database
                if (SAVE_INTO_DATABASE)
                {
                    GameServer.Database.AddObject(recruitsCloak);
                }
            }

            #endregion

            /* Now we add some hooks to the npc we found.
             * Actually, we want to know when a player interacts with him.
             * So, we hook the right-click (interact) and the whisper method
             * of npc and set the callback method to the "TalkToXXX"
             * method. This means, the "TalkToXXX" method is called whenever
             * a player right clicks on him or when he whispers to him.
             */
            //We want to be notified whenever a player enters the world
            GameEventMgr.AddHandler(GamePlayerEvent.AcceptQuest, new DOLEventHandler(SubscribeQuest));
            GameEventMgr.AddHandler(GamePlayerEvent.DeclineQuest, new DOLEventHandler(SubscribeQuest));

            GameEventMgr.AddHandler(dalikor, GameLivingEvent.Interact, new DOLEventHandler(TalkToDalikor));
            GameEventMgr.AddHandler(dalikor, GameLivingEvent.WhisperReceive, new DOLEventHandler(TalkToDalikor));

            GameEventMgr.AddHandler(harlfug, GameLivingEvent.Interact, new DOLEventHandler(TalkToHarlfug));
            GameEventMgr.AddHandler(harlfug, GameLivingEvent.WhisperReceive, new DOLEventHandler(TalkToHarlfug));

            GameEventMgr.AddHandler(abohas, GameLivingEvent.Interact, new DOLEventHandler(TalkToAbohas));
            GameEventMgr.AddHandler(abohas, GameLivingEvent.WhisperReceive, new DOLEventHandler(TalkToAbohas));

            /* Now we bring to dalikor the possibility to give this quest to players */
            dalikor.AddQuestToGive(typeof(ImportantDelivery));

            if (log.IsInfoEnabled)
            {
                log.Info("Quest \"" + questTitle + "\" initialized");
            }
        }
        public static byte[] CharacterDataLoad(WorldMgr.character c)
        {
            PacketWriter Writer = new PacketWriter();
            Writer.Create(OperationCode.SERVER_PLAYERDATA);
            /////////////////////////////////////////////////////// Character basic info
            #region Basic info
            Writer.DWord(c.Ids.GetLoginID);
            Writer.DWord(c.Information.Model);
            Writer.Byte(c.Information.Volume);
            Writer.Byte(c.Information.Level);
            Writer.Byte(c.Information.Level);
            Writer.LWord(c.Information.XP);
            Writer.DWord(c.Information.SpBar);
            Writer.LWord(c.Information.Gold);
            Writer.DWord(c.Information.SkillPoint);
            Writer.Word(c.Information.Attributes);
            Writer.Byte(c.Information.BerserkBar);
            Writer.DWord(988);
            Writer.DWord(c.Stat.SecondHp);
            Writer.DWord(c.Stat.SecondMP);
            Writer.Bool(c.Information.Level < 20 ? true : false);
            #endregion
            /////////////////////////////////////////////////////// Character Player Kill Info
            #region Pk information
            //DB perfection reading with multiple data adapters... while this one is open i can still read anything else from the database
            //With no speed reduction...
            DB checkpk = new DB("SELECT * FROM character WHERE name ='" + c.Information.Name + "'");
            using (System.Data.SqlClient.SqlDataReader getinfo = checkpk.Read())
            {
                while (getinfo.Read())
                {
                    byte dailypk = getinfo.GetByte(48);
                    byte pklevel = getinfo.GetByte(49);
                    byte murderlevel = getinfo.GetByte(50);

                    Writer.Byte(dailypk);
                    Writer.Word(pklevel);
                    Writer.DWord(murderlevel);
                    if (murderlevel != 0) c.Information.Murderer = true;
                }
            }
            #endregion
            /////////////////////////////////////////////////////// Character Title
            #region Title
            Writer.Byte(c.Information.Title);
            #endregion
            /////////////////////////////////////////////////////// Character Pvpstate
            #region Pvp
            Writer.Byte(c.Information.Pvpstate);
            if (c.Information.Pvpstate > 0)
                c.Information.PvP = true;
            #endregion
            /////////////////////////////////////////////////////// Character Items
            #region Item

            Writer.Byte(c.Information.Slots);

            DB ms = new DB("SELECT * FROM char_items WHERE owner='" + c.Information.CharacterID + "' AND slot >= '0' AND slot <= '" + c.Information.Slots + "' AND inavatar='0' AND storagetype='0'");
            Writer.Byte(ms.Count());
            using (System.Data.SqlClient.SqlDataReader msreader = ms.Read())
            {

                while (msreader.Read())
                {

                    short amount = msreader.GetInt16(6);

                    if (amount < 1) amount = 1;
                    DB.query("UPDATE char_items SET quantity='" + amount + "' WHERE owner='" + c.Information.CharacterID + "' AND itemid='" + msreader.GetInt32(2) + "' AND id='" + msreader.GetInt32(0) + "' AND storagetype='0'");

                    if (msreader.GetByte(5) == 6)
                        c.Information.Item.wID = Convert.ToInt32(msreader.GetInt32(2));
                    if (msreader.GetByte(5) == 7)
                    {
                        c.Information.Item.sID = msreader.GetInt32(2);
                        c.Information.Item.sAmount = msreader.GetInt16(6);
                    }

                    Item.AddItemPacket(Writer, msreader.GetByte(5), msreader.GetInt32(2), msreader.GetByte(4), amount, msreader.GetInt32(7),msreader.GetInt32(0), msreader.GetInt32(9), msreader.GetInt32(30));
                }
            }
            ms.Close();

            //Avatar
            Writer.Byte(5);

            ms = new DB("SELECT * FROM char_items WHERE owner='" + c.Information.CharacterID + "' AND slot >= '0' AND slot <= '" + c.Information.Slots + "' AND inavatar='1' AND storagetype='0'");

            Writer.Byte(ms.Count());
            using (System.Data.SqlClient.SqlDataReader msreader = ms.Read())
            {
                while (msreader.Read())
                {
                    Item.AddItemPacket(Writer, msreader.GetByte(5), msreader.GetInt32(2), msreader.GetByte(4), msreader.GetInt16(6), msreader.GetInt32(7), msreader.GetInt32(0), msreader.GetInt32(9),msreader.GetInt32(30));
                }
            }
            ms.Close();

            Writer.Byte(0);

            // job mastery
            Writer.Byte(0x0B);
            Writer.Byte(0);
            Writer.Byte(0);

            #endregion
            ///////////////////////////////////////////////////////  Mastery
            #region Mastery
            if (c.Information.Model <= 12000)
            {
                for (byte i = 1; i <= 7; i++)
                {
                    Writer.Byte(1);
                    Writer.DWord(c.Stat.Skill.Mastery[i]);
                    Writer.Byte(c.Stat.Skill.Mastery_Level[i]);
                }
            }
            else
            {
                if (c.Information.Model >= 14000)
                {
                    for (byte i = 1; i < 7; i++)
                    {
                        Writer.Byte(1);
                        Writer.DWord(c.Stat.Skill.Mastery[i]);
                        Writer.Byte(c.Stat.Skill.Mastery_Level[i]);
                    }
                }
            }
            #endregion
            /////////////////////////////////////////////////////// Skills
            #region Skill
            Writer.Byte(2);
            Writer.Byte(0);
                for (int i = 1; i <= c.Stat.Skill.AmountSkill; i++)
                {
                    Writer.Byte(1);
                    Writer.DWord(c.Stat.Skill.Skill[i]);
                    Writer.Byte(1);
                }
            Writer.Byte(2);
            #endregion
            /////////////////////////////////////////////////////// Quests
            #region Quest
            Writer.Word(1); // how many Quest ids completed/aborted
            Writer.DWord(1);// Quest id
            Writer.Byte(0);//number of Quests that are live
            #endregion
            Writer.Byte(0);//? for now
            /////////////////////////////////////////////////////// Talisman
            #region Talisman
            Writer.DWord(1);//new
            Writer.DWord(1);//new
            Writer.DWord(0);//? for now
            Writer.DWord(0x0C);//new
            #endregion
            /////////////////////////////////////////////////////// Position + id + speed
            #region Character id / Position / Speed
            Writer.DWord(c.Information.UniqueID);
            Writer.Byte(c.Position.xSec);
            Writer.Byte(c.Position.ySec);
            if (!FileDB.CheckCave(c.Position.xSec, c.Position.ySec))
            {
                Writer.Float(Formule.packetx(c.Position.x, c.Position.xSec));
                Writer.Float(c.Position.z);
                Writer.Float(Formule.packety(c.Position.y, c.Position.ySec));
            }
            else
            {
                Writer.Float(Formule.cavepacketx(c.Position.x));// Added for cave Coords
                Writer.Float(c.Position.z);
                Writer.Float(Formule.cavepackety(c.Position.y));// Added for cave Coords

            }
            Writer.Word(0);							// Angle
            Writer.Byte(0);
            Writer.Byte(1);
            Writer.Byte(0);
            Writer.Word(0);							// Angle
            Writer.Word(0);
            Writer.Byte(0);
            Writer.Bool(false); //berserk

            Writer.Byte(0);//new ?

            Writer.Float(c.Speed.WalkSpeed);
            Writer.Float(c.Speed.RunSpeed);
            Writer.Float(c.Speed.BerserkSpeed);
            #endregion
            /////////////////////////////////////////////////////// Premium Tickets
            #region Premium ticket
            Writer.Byte(0); //ITEM_MALL_GOLD_TIME_SERVICE_TICKET_4W
            #endregion
            /////////////////////////////////////////////////////// GM Check + Name
            #region GM Check + Name
            Writer.Text(c.Information.Name);
            #endregion
            /////////////////////////////////////////////////////// Character jobs
            #region Character Job / hunter thief trader ( old job things )
                //Writer info with job name when on job
                /*if (c.Job.state == 1 && c.Job.Jobname != "0")
                {
                    Writer.Text(c.Job.Jobname);
                    Writer.Byte(3);
                    Writer.Byte(1);
                    Writer.DWord(0);
                    Writer.DWord(0);
                    Writer.DWord(0);
                    Writer.Byte(0);
                    Writer.Byte(0);
                    Writer.Byte(0);
                }
                //Write basic info noname
                if (c.Job.Jobname == "0")
                {
                    Writer.Word(0);
                    Writer.Byte(3);
                    Writer.Byte(1);
                    Writer.DWord(0);
                    Writer.DWord(0);
                    Writer.DWord(0);
                    Writer.Byte(0);
                    Writer.Byte(0);
                    Writer.Byte(0);
                }
                //Write no info
                else
                {
                    Writer.Word(0);
                    Writer.Byte(0);
                    Writer.Byte(1);
                    Writer.DWord(0);
                    Writer.DWord(0);
                    Writer.DWord(0);
                    Writer.Byte(0);
                    Writer.Byte(0);
                    Writer.Byte(0);
                }*/
            #endregion
            #region New job system
            if (c.Job.state == 1)
            {
                Writer.Text(c.Job.Jobname);
                Writer.Byte(1);
                Writer.Byte(c.Job.level);//Level job
                Writer.Byte(c.Information.Level);//Level char
                Writer.Byte(1); // job level? myb
                Writer.LWord(0);// job exp probably y
                Writer.Byte(0);
                Writer.Byte(0);
                Writer.Byte(0);
                Writer.Byte(0);
            }
            else
            {

                Writer.Word(0);
                Writer.Byte(0);
                Writer.Byte(0);
                Writer.Byte(2); // job type
                Writer.Byte(1); // job level? myb
                Writer.LWord(0);// job exp probably y
                Writer.Byte(0);
                Writer.Byte(0);
                Writer.Byte(0);
                Writer.Byte(0);
            }

            #endregion
                /////////////////////////////////////////////////////// Pvp / Pk State
            #region Pvp / Pk State
            if (c.Information.Pvpstate == 1 || c.Information.Murderer)
            {
                Writer.Byte(0x22);
            }
            else if (c.Information.Pvpstate == 0 || !c.Information.Murderer)
            {
                Writer.Byte(0xFF);
            }
            #endregion
            /////////////////////////////////////////////////////// Guide Data
            #region Guide Data this data stacks on itself so if guide id is 0400000000000000 and next guide is 0300000000000000 the data to send is 0700000000000000

            for (int i = 0; i < 8; ++i)//Main Guide Packet Info
            {
                Writer.Byte(c.Guideinfo.G1[i]);//Reads From Int Array
            }
            #endregion
            /////////////////////////////////////////////////////// Account / Gm Check
            #region Account ID + Gm Check
            Writer.DWord(c.Account.ID);
            Writer.Byte(c.Information.GM);
            #endregion
            /////////////////////////////////////////////////////// Quickbar + Autopotion
            #region Bar information
            Writer.Byte(7);
            PlayerQuickBar(Writer, c.Information.CharacterID);
            PlayerAutoPot(Writer, c.Information.CharacterID);
            #endregion
            /////////////////////////////////////////////////////// Academy
            #region Academy
            Writer.Byte(0); // number of player in academy
            /* // if we have players there
             Writer.Byte(1);
             Writer.Text("asd");
             */
            Writer.Byte(0);//added byte today for 1.310
            Writer.Byte(0);
            Writer.Word(1);
            Writer.Word(1);
            Writer.Byte(0);
            Writer.Byte(1);
            #endregion
            return Writer.GetBytes();
        }
Exemplo n.º 43
0
        //private static readonly double[] rateItems = new double[] { 0.75, 3, 12, 48, 240, 768 };
        //public static int countConnect = 0;
        public int HandlePacket(GameClient client, GSPacketIn packet)
        {
            //if (countConnect >= 3000)
            //{
            //    client.Disconnect();
            //    return 0;
            //}
            StringBuilder str           = new StringBuilder();
            bool          isBinds       = false;
            bool          consortia     = packet.ReadBoolean();
            bool          MultiSelected = packet.ReadBoolean();

            GSPacketIn pkg = packet.Clone();

            pkg.ClearContext();

            List <ItemInfo> stones = new List <ItemInfo>();
            ItemInfo        stone  = client.Player.StoreBag2.GetItemAt(0);
            ItemInfo        item   = client.Player.StoreBag2.GetItemAt(1);

            //ItemInfo luck = null;
            //ItemInfo god = null;
            string BeginProperty = null;
            string AddItem       = "";

            using (ItemRecordBussiness db = new ItemRecordBussiness())
            {
                db.PropertyString(item, ref BeginProperty);
            }

            if (item != null && item.Template.CanStrengthen && item.Template.CategoryID < 18 && item.Count == 1)
            {
                isBinds = isBinds ? true : item.IsBinds;
                str.Append(item.ItemID + ":" + item.TemplateID + ",");
                double exp1     = 0;
                double exp2     = 0;
                double exp3     = 0;
                double totalExp = 0;

                if (stone != null && stone.Template.CategoryID == 11 && (stone.Template.Property1 == 2 || stone.Template.Property1 == 35))
                {
                    isBinds  = isBinds ? true : stone.IsBinds;
                    AddItem += "," + stone.ItemID.ToString() + ":" + stone.Template.Name;
                    stones.Add(stone);
                    exp1 += stone.Template.Property2;
                }

                bool          ConsortiaRate = false;
                ConsortiaInfo info          = ConsortiaMgr.FindConsortiaInfo(client.Player.PlayerCharacter.ConsortiaID);
                //判断是公会铁匠铺还是铁匠铺??
                if (consortia)
                {
                    ConsortiaBussiness        csbs    = new ConsortiaBussiness();
                    ConsortiaEquipControlInfo cecInfo = csbs.GetConsortiaEuqipRiches(client.Player.PlayerCharacter.ConsortiaID, 0, 2);

                    if (info == null)
                    {
                        client.Out.SendMessage(eMessageType.Normal, LanguageMgr.GetTranslation("ItemStrengthenHandler.Fail"));
                    }
                    else
                    {
                        if (client.Player.PlayerCharacter.Riches < cecInfo.Riches)
                        {
                            client.Out.SendMessage(eMessageType.ERROR, LanguageMgr.GetTranslation("ItemStrengthenHandler.FailbyPermission"));
                            return(1);
                        }
                        ConsortiaRate = true;
                    }
                }
                if (ConsortiaRate)
                {
                    //ConsortiaRateManager.instance.getConsortiaStrengthenEx(PlayerManager.Instance.Self.consortiaInfo.SmithLevel)
                    //"ConsortiaStrengthenEx" Value="10|20|30|40|50|60|70|80|90|100"
                    List <double> ConsortiaStrengthenEx = new List <double> {
                        10, 20, 30, 40, 50, 60, 70, 80, 90, 100
                    };
                    exp2 = ConsortiaStrengthenEx[info.SmithLevel - 1] / 100 * exp1;
                }
                if (client.Player.PlayerCharacter.VIPExpireDay >= DateTime.Now)
                {
                    //_loc_4 = VipController.instance.getVIPStrengthenEx(PlayerManager.Instance.Self.VIPLevel)
                    //"VIPStrengthenEx" Value="25|25|25|35|35|50|50|50|50|50|50|50"
                    List <double> VIPStrengthenEx = new List <double> {
                        25, 25, 25, 35, 35, 50, 50, 50, 50, 50, 50, 50
                    };
                    exp3 = VIPStrengthenEx[client.Player.PlayerCharacter.VIPLevel - 1] / 100 * exp1;
                }
                totalExp += Math.Floor(exp1 + exp2 + exp3);
                str.Append("true");
                List <int> StrengThenExp = new List <int> {
                    0, 10, 50, 150, 350, 700, 1500, 2300, 3300, 4500, 6000, 7500, 9000
                };

                //Console.WriteLine("-------Total: " + stone.Count.ToString() + "| Inject: " + MultiSelected);
                if (MultiSelected)// && stone.Count > 1)
                {
                    //for (int i = 0; i < stone.Count; i++)
                    //{
                    item.StrengthenExp += (int)totalExp * stone.Count;
                    client.Player.StoreBag2.RemoveTemplate(stone.TemplateID, stone.Count);
                    //}
                }
                else
                {
                    item.StrengthenExp += (int)totalExp;
                    client.Player.StoreBag2.RemoveTemplate(stone.TemplateID, 1);
                }

                if (item.StrengthenExp >= StrengThenExp[item.StrengthenLevel + 1])
                {
                    //for (int a = StrengThenExp[item.StrengthenLevel]; a < item.StrengthenExp; a++)
                    int a = StrengThenExp[item.StrengthenLevel];
                    do
                    {
                        if (item.StrengthenLevel < 13)
                        {
                            if (item.StrengthenExp >= StrengThenExp[item.StrengthenLevel + 1])
                            {
                                item.StrengthenLevel++;
                                item.StrengthenExp -= StrengThenExp[item.StrengthenLevel];
                                a = StrengThenExp[item.StrengthenLevel];
                            }
                            else
                            {
                                break;
                            }
                        }
                    }while (item.StrengthenExp > a);
                    if (item.StrengthenLevel == 12 && (item.StrengthenExp / totalExp) > 0)
                    {
                        stone.Count = (int)Math.Floor(item.StrengthenExp / totalExp);
                        client.Player.StoreBag2.AddItemTo(stone, 0);
                        client.Player.StoreBag2.UpdateItem(stone);
                        //if (item.StrengthenLevel == 12)
                        item.StrengthenExp = 0;
                    }
                    pkg.WriteByte(1);

                    StrengthenGoodsInfo strengthenGoodsInfo = StrengthenMgr.FindStrengthenGoodsInfo(item.StrengthenLevel, item.TemplateID);
                    if (strengthenGoodsInfo != null && item.Template.CategoryID == 7)
                    {
                        ItemTemplateInfo Temp = Bussiness.Managers.ItemMgr.FindItemTemplate(strengthenGoodsInfo.GainEquip);
                        if (Temp != null)
                        {
                            ItemInfo newItem = ItemInfo.CreateFromTemplate(Temp, 1, (int)ItemAddType.Strengthen);
                            newItem.StrengthenLevel = item.StrengthenLevel;
                            newItem.StrengthenExp   = item.StrengthenExp;
                            ItemInfo.OpenHole(ref newItem);
                            StrengthenMgr.InheritProperty(item, ref newItem);
                            client.Player.StoreBag2.RemoveItemAt(1);
                            client.Player.StoreBag2.AddItemTo(newItem, 1);
                            //client.Player.StoreBag2.UpdateItem(newItem);
                            item = newItem;
                            if ((item.StrengthenLevel == 3 || item.StrengthenLevel == 6 || item.StrengthenLevel == 9 || item.StrengthenLevel == 12) && item.Template.CategoryID != 17)
                            {
                                pkg.WriteBoolean(true);
                            }
                            else
                            {
                                pkg.WriteBoolean(false);
                            }
                        }
                    }
                    else
                    {
                        ItemInfo.OpenHole(ref item);
                        //client.Player.StoreBag2.AddItemTo(item, 1);
                        if ((item.StrengthenLevel == 3 || item.StrengthenLevel == 6 || item.StrengthenLevel == 9 || item.StrengthenLevel == 12) && item.Template.CategoryID != 17)
                        {
                            pkg.WriteBoolean(true);
                        }
                        else
                        {
                            pkg.WriteBoolean(false);
                        }
                    }

                    //系统广播
                    if (item.StrengthenLevel >= 7)
                    {
                        string     msg        = LanguageMgr.GetTranslation("ItemStrengthenHandler.congratulation", client.Player.PlayerCharacter.NickName, item.Template.Name, item.StrengthenLevel);
                        GSPacketIn sys_notice = WorldMgr.SendSysNotice(msg);
                        GameServer.Instance.LoginServer.SendPacket(sys_notice);
                    }
                }
                else
                {
                    pkg.WriteByte(1);
                    pkg.WriteBoolean(false);
                }

                client.Player.StoreBag2.UpdateItem(item);
                client.Player.OnItemStrengthen(item.Template.CategoryID, item.StrengthenLevel);                               //任务<强化>
                LogMgr.LogItemAdd(client.Player.PlayerCharacter.ID, LogItemType.Strengthen, BeginProperty, item, AddItem, 1); //强化日志

                //client.Player.SaveIntoDatabase();//保存到数据库
                client.Out.SendTCP(pkg);
                str.Append(item.StrengthenLevel);
                //client.Player.BeginChanges();
                //client.Player.CommitChanges();
            }
            else
            {
                client.Out.SendMessage(eMessageType.Normal, LanguageMgr.GetTranslation("ItemStrengthenHandler.Content1") + stone.Template.Name + LanguageMgr.GetTranslation("ItemStrengthenHandler.Content2"));
            }
            if (item.Place < 31)
            {
                client.Player.MainBag.UpdatePlayerProperties();
            }

            return(0);
        }
Exemplo n.º 44
0
        public void OnCommand(GameClient client, string[] args)
        {
            if (args.Length < 3)
            {
                DisplaySyntax(client);
                return;
            }

            GameClient gc = null;

            if (args[2].StartsWith("#"))
            {
                try
                {
                    var sessionID = Convert.ToUInt32(args[1].Substring(1));
                    gc = WorldMgr.GetClientFromID(sessionID);
                }
                catch
                {
                    DisplayMessage(client, "Invalid client ID");
                }
            }
            else
            {
                gc = WorldMgr.GetClientByPlayerName(args[2], false, false);
            }

            Account acc = gc != null ? gc.Account : GameServer.Database.SelectObjects <Account>("`Name` LIKE @Name", new QueryParameter("@Name", args[2])).FirstOrDefault();

            if (acc == null)
            {
                client.Out.SendMessage(LanguageMgr.GetTranslation(client.Account.Language, "GMCommands.Ban.UnableToFindPlayer"), eChatType.CT_System, eChatLoc.CL_SystemWindow);
                return;
            }

            if (client.Account.PrivLevel < acc.PrivLevel)
            {
                DisplayMessage(client, "Your privlevel is not high enough to ban this player.");
                return;
            }

            if (client.Account.Name == acc.Name)
            {
                DisplayMessage(client, "Your can't ban yourself!");
                return;
            }

            try
            {
                DBBannedAccount b = new DBBannedAccount
                {
                    DateBan = DateTime.Now,
                    Author  = client.Player.Name,
                    Ip      = acc.LastLoginIP,
                    Account = acc.Name
                };

                if (args.Length >= 4)
                {
                    b.Reason = String.Join(" ", args, 3, args.Length - 3);
                }
                else
                {
                    b.Reason = "No Reason.";
                }

                switch (args[1].ToLower())
                {
                    #region Account
                case "account":
                    var acctBans = GameServer.Database.SelectObjects <DBBannedAccount>("(`Type` = @TypeA OR `Type` = @TypeB) AND `Account` = @Account", new[] { new QueryParameter("@TypeA", "A"), new QueryParameter("@TypeB", "B"), new QueryParameter("@Account", acc.Name) });
                    if (acctBans.Count > 0)
                    {
                        client.Out.SendMessage(LanguageMgr.GetTranslation(client.Account.Language, "GMCommands.Ban.AAlreadyBanned"), eChatType.CT_Important, eChatLoc.CL_SystemWindow);
                        return;
                    }

                    b.Type = "A";
                    client.Out.SendMessage(LanguageMgr.GetTranslation(client.Account.Language, "GMCommands.Ban.ABanned", acc.Name), eChatType.CT_Important, eChatLoc.CL_SystemWindow);
                    break;

                    #endregion Account
                    #region IP
                case "ip":
                    var ipBans = GameServer.Database.SelectObjects <DBBannedAccount>("(`Type` = @TypeI OR `Type` = @TypeB) AND `Ip` = @Ip", new[] { new QueryParameter("@TypeI", "I"), new QueryParameter("@TypeB", "B"), new QueryParameter("@Ip", acc.LastLoginIP) });
                    if (ipBans.Count > 0)
                    {
                        client.Out.SendMessage(LanguageMgr.GetTranslation(client.Account.Language, "GMCommands.Ban.IAlreadyBanned"), eChatType.CT_Important, eChatLoc.CL_SystemWindow);
                        return;
                    }

                    b.Type = "I";
                    client.Out.SendMessage(LanguageMgr.GetTranslation(client.Account.Language, "GMCommands.Ban.IBanned", acc.LastLoginIP), eChatType.CT_Important, eChatLoc.CL_SystemWindow);
                    break;

                    #endregion IP
                    #region Both
                case "both":
                    var acctIpBans = GameServer.Database.SelectObjects <DBBannedAccount>("`Type` = @Type AND `Account` = @Account AND `Ip` = @Ip", new[] { new QueryParameter("@Type", "B"), new QueryParameter("@Account", acc.Name), new QueryParameter("@Ip", acc.LastLoginIP) });
                    if (acctIpBans.Count > 0)
                    {
                        client.Out.SendMessage(LanguageMgr.GetTranslation(client.Account.Language, "GMCommands.Ban.BAlreadyBanned"), eChatType.CT_Important, eChatLoc.CL_SystemWindow);
                        return;
                    }

                    b.Type = "B";
                    client.Out.SendMessage(LanguageMgr.GetTranslation(client.Account.Language, "GMCommands.Ban.BBanned", acc.Name, acc.LastLoginIP), eChatType.CT_Important, eChatLoc.CL_SystemWindow);
                    break;

                    #endregion Both
                    #region Default
                default:
                {
                    DisplaySyntax(client);
                    return;
                }
                    #endregion Default
                }
                GameServer.Database.AddObject(b);

                if (log.IsInfoEnabled)
                {
                    log.Info("Ban added [" + args[1].ToLower() + "]: " + acc.Name + "(" + acc.LastLoginIP + ")");
                }
                return;
            }
            catch (Exception e)
            {
                if (log.IsErrorEnabled)
                {
                    log.Error("/ban Exception", e);
                }
            }

            // if not returned here, there is an error
            DisplaySyntax(client);
        }
        public static WorldMgr.character._usingSkill Info(int SkillID, WorldMgr.character Character)
        {
            //Create new global information
            WorldMgr.character._usingSkill info = new WorldMgr.character._usingSkill();
            //Wrap our function inside a catcher
            try
            {
                //Set default skill information
                info.MainSkill = SkillID;
                info.SkillID = new int[10];
                info.FoundID = new int[10];
                info.TargetType = new bool[10];
                info.NumberOfAttack = NumberAttack(SkillID, ref info.SkillID);
                info.Targethits = 1;
                info.Distance = Convert.ToByte(ObjData.Manager.SkillBase[SkillID].Distance);
                info.Tdistance = 0;
                info.canUse = true;
                //Switch on skills series
                switch (ObjData.Manager.SkillBase[SkillID].Series)
                {
                    case "SKILL_EU_ROG_TRANSFORMA_MASK_A":
                        break;
                    #region Bicheon
                    #region Smashing Series
                    case "SKILL_CH_SWORD_SMASH_A":
                        info.Instant = 0;
                        info.P_M = false;
                        break;
                    case "SKILL_CH_SWORD_SMASH_B":
                        info.Instant = 0;
                        info.P_M = false;
                        break;
                    case "SKILL_CH_SWORD_SMASH_C":
                        info.Instant = 0;
                        info.P_M = false;
                        break;
                    case "SKILL_CH_SWORD_SMASH_D":
                        info.Instant = 0;
                        info.P_M = false;
                        break;
                    case "SKILL_CH_SWORD_SMASH_E":
                        info.Instant = 0;
                        info.P_M = false;
                        break;
                    #endregion
                    #region Chain Sword Attack Series
                    case "SKILL_CH_SWORD_CHAIN_A":
                        info.Instant = 0;
                        info.P_M = false;
                        break;
                    case "SKILL_CH_SWORD_CHAIN_B":
                        info.Instant = 0;
                        info.P_M = false;
                        break;
                    case "SKILL_CH_SWORD_CHAIN_C":
                        info.Instant = 0;
                        info.P_M = false;
                        break;
                    case "SKILL_CH_SWORD_CHAIN_D":
                        info.Instant = 0;
                        info.P_M = false;
                        break;
                    case "SKILL_CH_SWORD_CHAIN_E":
                        info.Instant = 0;
                        info.P_M = false;
                        break;
                    case "SKILL_CH_SWORD_CHAIN_F":
                        info.Instant = 0;
                        info.P_M = false;
                        break;
                    case "SKILL_CH_SWORD_CHAIN_G":
                        info.Instant = 0;
                        info.P_M = false;
                        break;
                    #endregion
                    #region Blade Force Series
                    case "SKILL_CH_SWORD_GEOMGI_A":
                        info.Instant = 0;
                        info.Distance = 4;
                        info.P_M = false;
                        break;
                    case "SKILL_CH_SWORD_GEOMGI_B":
                        info.Instant = 0;
                        info.Distance = 4;
                        info.P_M = false;
                        break;
                    case "SKILL_CH_SWORD_GEOMGI_C":
                        info.Instant = 0;
                        info.Distance = 4;
                        info.P_M = false;
                        break;
                    case "SKILL_CH_SWORD_GEOMGI_D":
                        info.Instant = 0;
                        info.Distance = 4;
                        info.P_M = false;
                        break;
                    case "SKILL_CH_SWORD_GEOMGI_E":
                        info.Instant = 0;
                        info.Distance = 4;
                        info.P_M = false;
                        break;
                    #endregion
                    #region Hidden Blade Series
                    case "SKILL_CH_SWORD_KNOCKDOWN_A":
                        info.Instant = 0;
                        info.P_M = false;
                        info.OzelEffect = 4;
                        break;
                    case "SKILL_CH_SWORD_KNOCKDOWN_B":
                        info.Instant = 0;
                        info.P_M = false;
                        info.Targethits = 3;
                        info.Tdistance = 2;
                        info.OzelEffect = 4;
                        break;
                    case "SKILL_CH_SWORD_KNOCKDOWN_C":
                        info.Instant = 0;
                        info.P_M = false;
                        info.OzelEffect = 4;
                        break;
                    case "SKILL_CH_SWORD_KNOCKDOWN_D":
                        info.Instant = 0;
                        info.P_M = false;
                        info.Targethits = 3;
                        info.Tdistance = 3;
                        info.OzelEffect = 4;
                        break;
                    #endregion
                    #region Killing Heaven Blade Series
                    case "SKILL_CH_SWORD_DOWNATTACK_A":
                        info.Instant = 0;
                        info.P_M = false;
                        info.OzelEffect = 5;
                        break;
                    case "SKILL_CH_SWORD_DOWNATTACK_B":
                        info.Instant = 0;
                        info.P_M = false;
                        info.OzelEffect = 5;
                        break;
                    case "SKILL_CH_SWORD_DOWNATTACK_C":
                        info.Instant = 0;
                        info.P_M = false;
                        info.OzelEffect = 5;
                        break;
                    case "SKILL_CH_SWORD_DOWNATTACK_D":
                        info.Instant = 0;
                        info.P_M = false;
                        info.OzelEffect = 5;
                        break;
                    #endregion
                    #region Sword Dance Series
                    case "SKILL_CH_SWORD_SPECIAL_A":
                        info.Instant = 0;
                        info.Distance = 4;
                        info.P_M = false;
                        info.Targethits = 3;
                        info.Tdistance = 7;
                        break;
                    case "SKILL_CH_SWORD_SPECIAL_B":
                        info.Instant = 0;
                        info.Distance = 4;
                        info.P_M = false;
                        info.Targethits = 3;
                        info.Tdistance = 15;
                        break;
                    case "SKILL_CH_SWORD_SPECIAL_C":
                        info.Instant = 0;
                        info.Distance = 4;
                        info.P_M = false;
                        info.Targethits = 3;
                        info.Tdistance = 15;
                        break;
                    case "SKILL_CH_SWORD_SPECIAL_D":
                        info.Instant = 0;
                        info.Distance = 4;
                        info.P_M = false;
                        info.Targethits = 4;
                        info.Tdistance = 15;
                        break;
                    #endregion
                    #endregion

                    #region Heuksal
                    #region Annihilating Blade Series
                    case "SKILL_CH_SPEAR_PIERCE_A":
                        info.Instant = 0;
                        info.P_M = false;
                        break;
                    case "SKILL_CH_SPEAR_PIERCE_B":
                        info.Instant = 0;
                        info.P_M = false;
                        break;
                    case "SKILL_CH_SPEAR_PIERCE_C":
                        info.Instant = 0;
                        info.P_M = false;
                        break;
                    case "SKILL_CH_SPEAR_PIERCE_D":
                        info.Instant = 0;
                        info.P_M = false;
                        break;
                    case "SKILL_CH_SPEAR_PIERCE_E":
                        info.Instant = 0;
                        info.P_M = false;
                        break;
                    #endregion
                    #region Heuksal Spear Series
                    case "SKILL_CH_SPEAR_FRONTAREA_A":
                        info.Instant = 0;
                        info.P_M = false;
                        info.Targethits = 3;
                        info.Tdistance = 1;
                        break;
                    case "SKILL_CH_SPEAR_FRONTAREA_B":
                        info.Instant = 0;
                        info.P_M = false;
                        info.Targethits = 3;
                        info.Tdistance = 1;
                        break;
                    case "SKILL_CH_SPEAR_FRONTAREA_C":
                        info.Instant = 0;
                        info.P_M = false;
                        info.Targethits = 3;
                        info.Tdistance = 1;
                        break;
                    case "SKILL_CH_SPEAR_FRONTAREA_D":
                        info.Instant = 0;
                        info.P_M = false;
                        info.Targethits = 3;
                        info.Tdistance = 2;
                        break;
                    case "SKILL_CH_SPEAR_FRONTAREA_E":
                        info.Instant = 0;
                        info.P_M = false;
                        info.Targethits = 3;
                        info.Tdistance = 2;
                        break;
                    #endregion
                    #region Soul Departs Spear Series
                    case "SKILL_CH_SPEAR_STUN_A":
                        info.Instant = 0;
                        info.P_M = false;
                        break;
                    case "SKILL_CH_SPEAR_STUN_B":
                        info.Instant = 0;
                        info.P_M = false;
                        break;
                    case "SKILL_CH_SPEAR_STUN_C":
                        info.Instant = 0;
                        info.P_M = false;
                        break;
                    case "SKILL_CH_SPEAR_STUN_D":
                        info.Instant = 0;
                        info.P_M = false;
                        break;
                    case "SKILL_CH_SPEAR_STUN_E":
                        info.Instant = 0;
                        info.P_M = false;
                        break;
                    #endregion
                    #region Ghost Spear Attack Series
                    case "SKILL_CH_SPEAR_ROUNDAREA_A":
                        info.Instant = 0;
                        info.P_M = false;
                        info.Targethits = 5;
                        info.Tdistance = 2;
                        break;
                    case "SKILL_CH_SPEAR_ROUNDAREA_B":
                        info.Instant = 0;
                        info.P_M = false;
                        info.Targethits = 5;
                        info.Tdistance = 3;
                        break;
                    case "SKILL_CH_SPEAR_ROUNDAREA_C":
                        info.Instant = 0;
                        info.P_M = false;
                        info.Targethits = 5;
                        info.Tdistance = 4;
                        break;
                    case "SKILL_CH_SPEAR_ROUNDAREA_D":
                        info.Instant = 0;
                        info.P_M = false;
                        info.Targethits = 5;
                        info.Tdistance = 5;
                        break;
                    #endregion
                    #region Chain Spear Attack Series
                    case "SKILL_CH_SPEAR_CHAIN_A":
                        info.Instant = 0;
                        info.P_M = false;
                        break;
                    case "SKILL_CH_SPEAR_CHAIN_B":
                        info.Instant = 0;
                        info.P_M = false;
                        break;
                    case "SKILL_CH_SPEAR_CHAIN_C":
                        info.Instant = 0;
                        info.P_M = false;
                        info.Targethits = 3;
                        info.Tdistance = 2;
                        break;
                    case "SKILL_CH_SPEAR_CHAIN_D":
                        info.Instant = 0;
                        info.P_M = false;
                        break;
                    case "SKILL_CH_SPEAR_CHAIN_E":
                        info.Instant = 0;
                        info.P_M = false;
                        info.Targethits = 5;
                        info.Tdistance = 3;
                        break;
                    case "SKILL_CH_SPEAR_CHAIN_F":
                        info.Instant = 0;
                        info.P_M = false;
                        info.Targethits = 5;
                        info.Tdistance = 3;
                        break;
                    #endregion
                    #region Flying Dragon Spear Series
                    case "SKILL_CH_SPEAR_SHOOT_A":
                        info.Instant = 0;
                        info.Distance = 6;
                        info.P_M = false;
                        break;
                    case "SKILL_CH_SPEAR_SHOOT_B":
                        info.Instant = 0;
                        info.Distance = 6;
                        info.P_M = false;
                        break;
                    case "SKILL_CH_SPEAR_SHOOT_C":
                        info.Instant = 0;
                        info.Distance = 6;
                        info.P_M = false;
                        break;
                    case "SKILL_CH_SPEAR_SHOOT_D":
                        info.Instant = 0;
                        info.Distance = 6;
                        info.P_M = false;
                        break;
                    #endregion
                    #endregion

                    #region Pacheon
                    #region Anti Devil Bow Series
                    case "SKILL_CH_BOW_CRITICAL_A":
                        info.Instant = 2;
                        info.Distance = 7;
                        info.P_M = false;
                        break;
                    case "SKILL_CH_BOW_CRITICAL_B":
                        info.Instant = 2;
                        info.Distance = 7;
                        info.P_M = false;
                        break;
                    case "SKILL_CH_BOW_CRITICAL_C":
                        info.Instant = 2;
                        info.Distance = 7;
                        info.P_M = false;
                        break;
                    case "SKILL_CH_BOW_CRITICAL_D":
                        info.Instant = 2;
                        info.Distance = 7;
                        info.P_M = false;
                        break;
                    case "SKILL_CH_BOW_CRITICAL_E":
                        info.Instant = 2;
                        info.Distance = 7;
                        info.P_M = false;
                        break;
                    #endregion
                    #region Arrow Combo Attack Series
                    case "SKILL_CH_BOW_CHAIN_A":
                        info.NumberOfAttack = 2;
                        info.SkillID[1] = SkillID;
                        info.SkillID[2] = SkillID;
                        info.Instant = 0;
                        info.Distance = 7;
                        info.P_M = false;
                        info.OzelEffect = 5;
                        break;
                    case "SKILL_CH_BOW_CHAIN_B":
                        info.NumberOfAttack = 3;
                        info.SkillID[1] = SkillID;
                        info.SkillID[2] = SkillID;
                        info.SkillID[3] = SkillID;
                        info.Instant = 0;
                        info.Distance = 7;
                        info.OzelEffect = 5;
                        info.P_M = false;
                        break;
                    case "SKILL_CH_BOW_CHAIN_C":
                        info.NumberOfAttack = 4;
                        info.SkillID[1] = SkillID;
                        info.SkillID[2] = SkillID;
                        info.SkillID[3] = SkillID;
                        info.SkillID[4] = SkillID;
                        info.Instant = 0;
                        info.Distance = 7;
                        info.OzelEffect = 5;
                        info.P_M = false;
                        break;
                    case "SKILL_CH_BOW_CHAIN_D":
                        info.NumberOfAttack = 5;
                        info.SkillID[1] = SkillID;
                        info.SkillID[2] = SkillID;
                        info.SkillID[3] = SkillID;
                        info.SkillID[4] = SkillID;
                        info.SkillID[5] = SkillID;
                        info.Instant = 0;
                        info.Distance = 7;
                        info.OzelEffect = 5;
                        info.P_M = false;
                        break;
                    case "SKILL_CH_BOW_CHAIN_E":
                        info.NumberOfAttack = 6;
                        info.SkillID[1] = SkillID;
                        info.SkillID[2] = SkillID;
                        info.SkillID[3] = SkillID;
                        info.SkillID[4] = SkillID;
                        info.SkillID[5] = SkillID;
                        info.SkillID[6] = SkillID;
                        info.Instant = 0;
                        info.Distance = 7;
                        info.OzelEffect = 5;
                        info.P_M = false;
                        break;
                    #endregion
                    #region Autumn Wind Arrow Series
                    case "SKILL_CH_BOW_PIERCE_A":
                        info.Instant = 2;
                        info.Distance = 7;
                        info.P_M = false;
                        break;
                    case "SKILL_CH_BOW_PIERCE_B":
                        info.Instant = 2;
                        info.Distance = 7;
                        info.P_M = false;
                        break;
                    case "SKILL_CH_BOW_PIERCE_C":
                        info.Instant = 2;
                        info.Distance = 7;
                        info.P_M = false;
                        break;
                    case "SKILL_CH_BOW_PIERCE_D":
                        info.Instant = 2;
                        info.Distance = 7;
                        info.P_M = false;
                        break;
                    #endregion
                    #region Explosion Arrow Series
                    case "SKILL_CH_BOW_AREA_A":
                        info.Instant = 2;
                        info.Distance = 7;
                        info.P_M = false;
                        info.Targethits = 4;
                        info.Tdistance = 4;
                        break;
                    case "SKILL_CH_BOW_AREA_B":
                        info.Instant = 2;
                        info.Distance = 7;
                        info.P_M = false;
                        info.Targethits = 4;
                        info.Tdistance = 4;
                        break;
                    case "SKILL_CH_BOW_AREA_C":
                        info.Instant = 2;
                        info.Distance = 7;
                        info.P_M = false;
                        info.Targethits = 4;
                        info.Tdistance = 4;
                        break;
                    case "SKILL_CH_BOW_AREA_D":
                        info.Instant = 2;
                        info.Distance = 7;
                        info.P_M = false;
                        info.Targethits = 4;
                        info.Tdistance = 5;
                        break;
                    #endregion
                    #region Strong Bow Series
                    case "SKILL_CH_BOW_POWER_A":
                        info.Instant = 2;
                        info.Distance = 7;
                        info.P_M = false;
                        break;
                    case "SKILL_CH_BOW_POWER_B":
                        info.Instant = 2;
                        info.Distance = 7;
                        info.P_M = false;
                        break;
                    case "SKILL_CH_BOW_POWER_C":
                        info.Instant = 2;
                        info.Distance = 7;
                        info.P_M = false;
                        break;
                    case "SKILL_CH_BOW_POWER_D":
                        info.Instant = 2;
                        info.Distance = 7;
                        info.P_M = false;
                        break;
                    #endregion
                    #region Mind Bow Series
                    case "SKILL_CH_BOW_SPECIAL_A":
                        info.Instant = 2;
                        info.Distance = 7;
                        info.P_M = false;
                        info.Targethits = 2;
                        info.Tdistance = 20;
                        break;
                    case "SKILL_CH_BOW_SPECIAL_B":
                        info.Instant = 2;
                        info.Distance = 7;
                        info.P_M = false;
                        info.Targethits = 3;
                        info.Tdistance = 22;
                        break;
                    case "SKILL_CH_BOW_SPECIAL_C":
                        info.Instant = 2;
                        info.Distance = 7;
                        info.P_M = false;
                        info.Targethits = 4;
                        info.Tdistance = 23;
                        break;
                    case "SKILL_CH_BOW_SPECIAL_D":
                        info.Instant = 2;
                        info.Distance = 7;
                        info.P_M = false;
                        info.Targethits = 5;
                        info.Tdistance = 24;
                        break;
                    #endregion
                    #endregion

                    #region Cold
                    #region Snow Storm Series
                    case "SKILL_CH_COLD_GIGONGSUL_A":
                        info.Instant = 2;
                        info.Distance = 5;
                        info.P_M = true;

                        break;
                    case "SKILL_CH_COLD_GIGONGSUL_B":
                        info.Instant = 2;
                        info.Distance = 5;
                        info.P_M = true;
                        info.Targethits = 5;
                        info.Tdistance = 6;
                        break;
                    case "SKILL_CH_COLD_GIGONGSUL_C":
                        info.Instant = 2;
                        info.Distance = 5;
                        info.P_M = true;
                        break;
                    case "SKILL_CH_COLD_GIGONGSUL_D":
                        info.Instant = 2;
                        info.Distance = 5;
                        info.P_M = true;
                        info.Targethits = 5;
                        info.Tdistance = 7;
                        break;
                    #endregion
                    #endregion

                    #region Light
                    #region Lion Shout Series
                    case "SKILL_CH_LIGHTNING_CHUNDUNG_A":
                    case "SKILL_CH_LIGHTNING_CHUNDUNG_B":
                    case "SKILL_CH_LIGHTNING_CHUNDUNG_C":
                    case "SKILL_CH_LIGHTNING_CHUNDUNG_D":
                    case "SKILL_CH_LIGHTNING_CHUNDUNG_E":
                        info.Instant = 0;
                        info.Distance = 6;
                        info.P_M = true;
                        info.Targethits = 3;
                        info.Tdistance = 2;
                        break;
                    #endregion
                    #region Thunderbolt Force Series
                    case "SKILL_CH_LIGHTNING_STORM_A":
                    case "SKILL_CH_LIGHTNING_STORM_B":
                    case "SKILL_CH_LIGHTNING_STORM_C":
                    case "SKILL_CH_LIGHTNING_STORM_D":
                        info.Instant = 2;
                        info.Distance = 6;
                        info.P_M = true;
                        info.Targethits = 3;
                        info.Tdistance = 10;
                        break;
                    #endregion
                    #endregion

                    #region Fire
                    #region Flame Wave Series
                    case "SKILL_CH_FIRE_GIGONGSUL_A":
                    case "SKILL_CH_FIRE_GIGONGSUL_B":
                    case "SKILL_CH_FIRE_GIGONGSUL_D":
                    case "SKILL_CH_FIRE_GIGONGSUL_E":
                        info.Instant = 2;
                        info.Distance = 6;
                        info.P_M = true;
                        break;
                    case "SKILL_CH_FIRE_GIGONGSUL_F":
                    case "SKILL_CH_FIRE_GIGONGSUL_C":
                        info.Instant = 2;
                        info.Distance = 6;
                        info.P_M = true;
                        info.Targethits = 3;
                        info.Tdistance = 6;
                        break;
                    #endregion
                    #endregion

                    #region Force
                    case "SKILL_CH_WATER_CURE_A":
                    case "SKILL_CH_WATER_CURE_B":
                    case "SKILL_CH_WATER_CURE_C":
                    case "SKILL_CH_WATER_CURE_D":
                    case "SKILL_CH_WATER_CURE_E":
                    case "SKILL_CH_WATER_CURE_F":
                    case "SKILL_CH_WATER_HEAL_A":
                    case "SKILL_CH_WATER_HEAL_B":
                    case "SKILL_CH_WATER_HEAL_C":
                    case "SKILL_CH_WATER_HEAL_D":
                    case "SKILL_CH_WATER_HEAL_E":
                    case "SKILL_CH_WATER_HEAL_F":
                        if (Character.Action.Object != null || Character.Action.Object.GetType().ToString() == "CLGameServer.PlayerMgr") info.canUse = false;

                        break;
                    case "SKILL_CH_WATER_CANCEL_A":
                    case "SKILL_CH_WATER_CANCEL_B":
                    case "SKILL_CH_WATER_CANCEL_C":
                    case "SKILL_CH_WATER_CANCEL_D":
                    case "SKILL_CH_WATER_CANCEL_E":
                    case "SKILL_CH_WATER_CANCEL_F":
                    case "SKILL_CH_WATER_CANCEL_G":
                    case "SKILL_CH_WATER_CANCEL_H":
                        if (Character.Action.Object != null || Character.Action.Object.GetType().ToString() == "CLGameServer.PlayerMgr") info.canUse = false;

                        break;
                    case "SKILL_CH_WATER_RESURRECTION_A":
                    case "SKILL_CH_WATER_RESURRECTION_B":
                    case "SKILL_CH_WATER_RESURRECTION_C":
                    case "SKILL_CH_WATER_RESURRECTION_D":
                    case "SKILL_CH_WATER_RESURRECTION_E":
                        if (Character.Action.Object != null || Character.Action.Object.GetType().ToString() == "CLGameServer.PlayerMgr") info.canUse = false;

                        break;
                    #endregion

                    #region Europe
                    #region Europe Wizard
                    #region Earth
                    case "SKILL_EU_WIZARD_EARTHA_POINT_A":
                        info.Instant = 1;
                        info.Distance = 5;
                        info.P_M = true;
                        info.Targethits = 5;
                        info.Tdistance = 10;
                        break;
                    case "SKILL_EU_WIZARD_EARTHA_POINT_B":
                        info.Instant = 1;
                        info.Distance = 5;
                        info.P_M = true;
                        info.Targethits = 5;
                        info.Tdistance = 10;
                        break;
                    case "SKILL_EU_WIZARD_EARTHA_AREA_A":
                        info.Instant = 1;
                        info.Distance = 5;
                        info.P_M = true;
                        info.Targethits = 5;
                        info.Tdistance = 10;
                        break;
                    case "SKILL_EU_WIZARD_EARTHA_AREA_B":
                        info.Instant = 1;
                        info.Distance = 5;
                        info.P_M = true;
                        info.Targethits = 5;
                        info.Tdistance = 10;
                        break;
                    #endregion
                    #region Cold
                    case "SKILL_EU_WIZARD_COLDA_POINT_A":
                        info.Instant = 1;
                        info.Distance = 5;
                        info.P_M = true;
                        break;
                    case "SKILL_EU_WIZARD_COLDA_POINT_B":
                        info.NumberOfAttack = 3;
                        info.SkillID[1] = SkillID;
                        info.SkillID[2] = SkillID;
                        info.SkillID[3] = SkillID;
                        info.Instant = 1;
                        info.Distance = 5;
                        info.P_M = true;
                        break;
                    case "SKILL_EU_WIZARD_COLDA_AREA_A":
                        info.Instant = 1;
                        info.Distance = 15;
                        info.P_M = true;
                        info.Targethits = 5;
                        info.Tdistance = 10;
                        break;
                    case "SKILL_EU_WIZARD_COLDA_AREA_B":
                        info.Instant = 1;
                        info.Distance = 5;
                        info.P_M = true;
                        info.Targethits = 5;
                        info.Tdistance = 10;
                        break;
                    #endregion
                    #region Fire
                    case "SKILL_EU_WIZARD_FIREA_POINT_A":
                        info.Instant = 1;
                        info.Distance = 15;
                        info.P_M = true;
                        break;
                    case "SKILL_EU_WIZARD_FIREA_SPRAY_A":
                        info.NumberOfAttack = 7;
                        info.SkillID[1] = SkillID;
                        info.SkillID[2] = SkillID;
                        info.SkillID[3] = SkillID;
                        info.SkillID[4] = SkillID;
                        info.SkillID[5] = SkillID;
                        info.SkillID[6] = SkillID;
                        info.SkillID[7] = SkillID;
                        info.Instant = 1;
                        info.Distance = 15;
                        info.P_M = true;
                        info.Targethits = 3;
                        info.Tdistance = 10;
                        break;
                    case "SKILL_EU_WIZARD_FIREA_POINT_B":
                        info.Instant = 1;
                        info.Distance = 15;
                        info.P_M = true;
                        info.Targethits = 3;
                        info.Tdistance = 10;
                        break;
                    case "SKILL_EU_WIZARD_FIREA_SPRAY_B":
                        info.NumberOfAttack = 7;
                        info.SkillID[1] = SkillID;
                        info.SkillID[2] = SkillID;
                        info.SkillID[3] = SkillID;
                        info.SkillID[4] = SkillID;
                        info.SkillID[5] = SkillID;
                        info.SkillID[6] = SkillID;
                        info.SkillID[7] = SkillID;
                        info.Instant = 1;
                        info.Distance = 15;
                        info.P_M = true;
                        info.Targethits = 3;
                        info.Tdistance = 10;
                        break;
                    #endregion
                    #region Light
                    case "SKILL_EU_WIZARD_PSYCHICA_LIGHT_A":
                        info.Instant = 1;
                        info.Distance = 15;
                        info.P_M = true;
                        info.Targethits = 2;
                        info.Tdistance = 10;
                        break;
                    case "SKILL_EU_WIZARD_PSYCHICA_AREA_A":
                        info.NumberOfAttack = 6;
                        info.SkillID[1] = SkillID;
                        info.SkillID[2] = SkillID;
                        info.SkillID[3] = SkillID;
                        info.SkillID[4] = SkillID;
                        info.SkillID[5] = SkillID;
                        info.SkillID[6] = SkillID;
                        info.Instant = 1;
                        info.Distance = 15;
                        info.P_M = true;
                        info.Targethits = 5;
                        info.Tdistance = 10;
                        break;
                    case "SKILL_EU_WIZARD_PSYCHICA_LIGHT_B":
                        info.Instant = 1;
                        info.Distance = 15;
                        info.P_M = true;
                        info.Targethits = 3;
                        info.Tdistance = 10;
                        break;
                    case "SKILL_EU_WIZARD_PSYCHICA_AREA_B":
                        info.NumberOfAttack = 6;
                        info.SkillID[1] = SkillID;
                        info.SkillID[2] = SkillID;
                        info.SkillID[3] = SkillID;
                        info.SkillID[4] = SkillID;
                        info.SkillID[5] = SkillID;
                        info.SkillID[6] = SkillID;
                        info.Instant = 1;
                        info.Distance = 15;
                        info.P_M = true;
                        info.Targethits = 5;
                        info.Tdistance = 10;
                        break;
                    #endregion
                    #endregion
                    #region Europe Warrior
                    #region Axe
                    case "SKILL_EU_WARRIOR_DUALA_CROSS_A":
                        info.Instant = 0;
                        info.P_M = false;
                        break;
                    case "SKILL_EU_WARRIOR_DUALA_TWIST_A":
                        info.NumberOfAttack = 2;
                        info.SkillID[1] = SkillID;
                        info.SkillID[2] = SkillID;
                        info.Instant = 0;
                        info.P_M = false;
                        break;
                    case "SKILL_EU_WARRIOR_DUALA_STUN_A":
                        info.Instant = 0;
                        info.Targethits = 3;
                        info.P_M = false;
                        break;
                    case "SKILL_EU_WARRIOR_DUALA_COUNTER_A":
                        info.NumberOfAttack = 3;
                        info.SkillID[1] = SkillID;
                        info.SkillID[2] = SkillID;
                        info.SkillID[3] = SkillID;
                        info.Instant = 0;
                        info.Targethits = 3;
                        info.P_M = false;
                        break;
                    case "SKILL_EU_WARRIOR_DUALA_WHIRLWIND_A":
                        info.NumberOfAttack = 4;
                        info.SkillID[1] = SkillID;
                        info.SkillID[2] = SkillID;
                        info.SkillID[3] = SkillID;
                        info.SkillID[4] = SkillID;
                        info.Instant = 0;
                        info.Targethits = 3;
                        info.P_M = false;
                        break;
                    case "SKILL_EU_WARRIOR_DUALA_TWIST_B":
                        info.NumberOfAttack = 3;
                        info.SkillID[1] = SkillID;
                        info.SkillID[2] = SkillID;
                        info.SkillID[3] = SkillID;
                        info.Instant = 0;
                        info.P_M = false;
                        break;
                    case "SKILL_EU_WARRIOR_DUALA_COUNTER_B":
                        info.NumberOfAttack = 4;
                        info.SkillID[1] = SkillID;
                        info.SkillID[2] = SkillID;
                        info.SkillID[3] = SkillID;
                        info.SkillID[4] = SkillID;
                        info.Instant = 0;
                        info.Targethits = 3;
                        info.P_M = false;
                        break;
                    case "SKILL_EU_WARRIOR_DUALA_WHIRLWIND_B":
                        info.NumberOfAttack = 5;
                        info.SkillID[1] = SkillID;
                        info.SkillID[2] = SkillID;
                        info.SkillID[3] = SkillID;
                        info.SkillID[4] = SkillID;
                        info.SkillID[5] = SkillID;
                        info.Instant = 0;
                        info.Targethits = 3;
                        info.P_M = false;
                        break;
                    #endregion
                    #region Two-Handed
                    case "SKILL_EU_WARRIOR_TWOHANDA_DASH_A":
                        info.Instant = 0;
                        info.Targethits = 3;
                        info.P_M = false;
                        break;
                    case "SKILL_EU_WARRIOR_TWOHANDA_RISING_A":
                        info.Instant = 0;
                        info.P_M = false;
                        break;
                    case "SKILL_EU_WARRIOR_TWOHANDA_CHARGE_A":
                        info.NumberOfAttack = 2;
                        info.SkillID[1] = SkillID;
                        info.SkillID[2] = SkillID;
                        info.Instant = 0;
                        info.P_M = false;
                        break;
                    case "SKILL_EU_WARRIOR_TWOHANDA_CRY_A":
                        info.Targethits = 3;
                        info.Instant = 0;
                        info.P_M = false;
                        break;
                    case "SKILL_EU_WARRIOR_TWOHANDA_CHARGE_B":
                        info.NumberOfAttack = 3;
                        info.SkillID[1] = SkillID;
                        info.SkillID[2] = SkillID;
                        info.SkillID[3] = SkillID;
                        info.Instant = 0;
                        info.P_M = false;
                        break;
                    case "SKILL_EU_WARRIOR_TWOHANDA_CRY_B":
                        info.NumberOfAttack = 2;
                        info.SkillID[1] = SkillID;
                        info.SkillID[2] = SkillID;
                        info.Instant = 0;
                        info.P_M = false;
                        break;
                    #endregion
                    #region One-Handed
                    case "SKILL_EU_WARRIOR_ONEHANDA_STRIKE_A":
                        info.Instant = 0;
                        info.P_M = false;
                        break;
                    case "SKILL_EU_WARRIOR_ONEHANDA_SHIELD_A":
                        info.Instant = 0;
                        info.Targethits = 3;
                        info.P_M = false;
                        break;
                    case "SKILL_EU_WARRIOR_ONEHANDA_PIERCE_A":
                        info.NumberOfAttack = 2;
                        info.SkillID[1] = SkillID;
                        info.SkillID[2] = SkillID;
                        info.Instant = 0;
                        info.P_M = false;
                        break;
                    case "SKILL_EU_WARRIOR_ONEHANDA_CRITICAL_A":
                        info.Instant = 0;
                        info.NumberOfAttack = 2;
                        info.SkillID[1] = SkillID;
                        info.SkillID[2] = SkillID;
                        info.P_M = false;
                        break;
                    case "SKILL_EU_WARRIOR_ONEHANDA_SHIELD_B":
                        info.NumberOfAttack = 2;
                        info.SkillID[1] = SkillID;
                        info.SkillID[2] = SkillID;
                        info.Targethits = 3;
                        info.Instant = 0;
                        info.P_M = false;
                        break;
                    case "SKILL_EU_WARRIOR_ONEHANDA_PIERCE_B":
                        info.NumberOfAttack = 4;
                        info.SkillID[1] = SkillID;
                        info.SkillID[2] = SkillID;
                        info.SkillID[3] = SkillID;
                        info.SkillID[4] = SkillID;
                        info.Instant = 0;
                        info.P_M = false;
                        break;
                    case "SKILL_EU_WARRIOR_ONEHANDA_CRITICAL_B":
                        info.NumberOfAttack = 4;
                        info.SkillID[1] = SkillID;
                        info.SkillID[2] = SkillID;
                        info.SkillID[3] = SkillID;
                        info.SkillID[4] = SkillID;
                        info.Instant = 0;
                        info.P_M = false;
                        break;
                    #endregion
                    #region Warrior Others
                    case "SKILL_EU_WARRIOR_FRENZYA_TOUNT_A":
                        info.Instant = 0;
                        info.P_M = false;
                        info.Distance = 15;
                        info.Targethits = 3;
                        break;
                    case "SKILL_EU_WARRIOR_FRENZYA_TOUNT_SPRINT_A":
                        info.Instant = 0;
                        info.P_M = false;
                        info.Distance = 15;
                        break;
                    #endregion
                    #endregion
                    #region Europe Rogue
                    #region Rogue
                    case "SKILL_EU_ROG_BOWA_FAST_A":
                        info.Instant = 0;
                        break;
                    case "SKILL_EU_ROG_BOWA_FAST_B":
                        info.Instant = 0;
                        break;
                    case "SKILL_EU_ROG_BOWA_POWER_A":
                    case "SKILL_EU_ROG_BOWA_POWER_B":
                    case "SKILL_EU_ROG_BOWA_RANGE_A":
                    case "SKILL_EU_ROG_BOWA_RANGE_B":
                    case "SKILL_EU_ROG_BOWA_KNOCK_A":
                    case "SKILL_EU_ROG_BOWA_KNOCK_B":
                        info.Instant = 1;
                        break;
                    #endregion
                    #region Dagger
                    case "SKILL_EU_ROG_DAGGERA_CHAIN_A":
                        info.NumberOfAttack = 2;
                        info.SkillID[1] = SkillID;
                        info.SkillID[2] = SkillID;
                        info.Instant = 0;
                        info.P_M = false;
                        break;
                    case "SKILL_EU_ROG_DAGGERA_WOUND_A":
                        info.NumberOfAttack = 2;
                        info.SkillID[1] = SkillID;
                        info.SkillID[2] = SkillID;
                        info.Instant = 0;
                        info.P_M = false;
                        break;
                    case "SKILL_EU_ROG_DAGGERA_SCREW_A":
                        info.Instant = 0;
                        info.P_M = false;
                        break;
                    case "SKILL_EU_ROG_DAGGERA_SLASH_A":
                        info.NumberOfAttack = 3;
                        info.SkillID[1] = SkillID;
                        info.SkillID[2] = SkillID;
                        info.SkillID[3] = SkillID;
                        info.Instant = 0;
                        info.P_M = false;
                        break;
                    case "SKILL_EU_ROG_STEALTHA_ATTACK_A":
                        info.Instant = 0;
                        info.P_M = false;
                        break;
                    case "SKILL_EU_ROG_DAGGERA_WOUND_B":
                        info.NumberOfAttack = 3;
                        info.SkillID[1] = SkillID;
                        info.SkillID[2] = SkillID;
                        info.SkillID[3] = SkillID;
                        info.Instant = 0;
                        info.P_M = false;
                        break;
                    case "SKILL_EU_ROG_DAGGERA_SLASH_B":
                        info.NumberOfAttack = 5;
                        info.SkillID[1] = SkillID;
                        info.SkillID[2] = SkillID;
                        info.SkillID[3] = SkillID;
                        info.SkillID[4] = SkillID;
                        info.SkillID[5] = SkillID;
                        info.Instant = 0;
                        info.P_M = false;
                        break;
                    #endregion
                    #endregion
                    #endregion
                    default:
                        //Set default for skills that havent been added
                        info.Targethits = info.NumberOfAttack;
                        info.Tdistance = 0;
                        info.Instant = 2;
                        info.P_M = false;
                        info.canUse = true;
                        //Write info if skill not added
                        Log.Exception("Skill System Not Found Number of attacks : " + info.NumberOfAttack + " Skillname: " + ObjData.Manager.SkillBase[SkillID].Series);
                        break;
                }
                //Return information
                return info;
            }
            catch (Exception ex)
            {
                Log.Exception(ex);
            }
            return info;
        }
Exemplo n.º 46
0
        public bool HandleCommand(TankMarryLogicProcessor process, GamePlayer player, GSPacketIn packet)
        {
            bool result;

            if (player.CurrentMarryRoom == null)
            {
                result = false;
            }
            else
            {
                if (player.PlayerCharacter.ID != player.CurrentMarryRoom.Info.GroomID && player.PlayerCharacter.ID != player.CurrentMarryRoom.Info.BrideID)
                {
                    result = false;
                }
                else
                {
                    int      hour  = packet.ReadInt();
                    string[] money = "2000,2700,3400".Split(new char[]
                    {
                        ','
                    });
                    if (money.Length < 3)
                    {
                        ContinuationCommand.log.Error("MarryRoomCreateMoney node in configuration file is wrong");

                        result = false;
                    }
                    else
                    {
                        int needMoney;
                        switch (hour)
                        {
                        case 2:
                            needMoney = int.Parse(money[0]);
                            break;

                        case 3:
                            needMoney = int.Parse(money[1]);
                            break;

                        case 4:
                            needMoney = int.Parse(money[2]);
                            break;

                        default:
                            needMoney = int.Parse(money[2]);
                            hour      = 4;
                            break;
                        }
                        if (player.PlayerCharacter.Money < needMoney)
                        {
                            player.Out.SendMessage(eMessageType.ChatNormal, LanguageMgr.GetTranslation("MarryApplyHandler.Msg1", new object[0]));
                            result = false;
                        }
                        else
                        {
                            player.RemoveMoney(needMoney, LogMoneyType.Marry, LogMoneyType.Marry_RoomAdd);
                            CountBussiness.InsertSystemPayCount(player.PlayerCharacter.ID, needMoney, 0, 0, 0);
                            player.CurrentMarryRoom.RoomContinuation(hour);
                            GSPacketIn pkg = player.Out.SendContinuation(player, player.CurrentMarryRoom.Info);
                            int        spouseID;
                            if (player.PlayerCharacter.ID == player.CurrentMarryRoom.Info.GroomID)
                            {
                                spouseID = player.CurrentMarryRoom.Info.BrideID;
                            }
                            else
                            {
                                spouseID = player.CurrentMarryRoom.Info.GroomID;
                            }
                            GamePlayer spouse = WorldMgr.GetPlayerById(spouseID);
                            if (spouse != null)
                            {
                                spouse.Out.SendTCP(pkg);
                            }
                            player.Out.SendMessage(eMessageType.Normal, LanguageMgr.GetTranslation("ContinuationCommand.Successed", new object[0]));
                            result = true;
                        }
                    }
                }
            }
            return(result);
        }
 public static byte[] PlayerStat(WorldMgr.character c)
 {
     PacketWriter Writer = new PacketWriter();
     Writer.Create(OperationCode.SERVER_PLAYERSTAT);
     Writer.DWord((int)c.Stat.MinPhyAttack);
     Writer.DWord((int)c.Stat.MaxPhyAttack);
     Writer.DWord((int)c.Stat.MinMagAttack);
     Writer.DWord((int)c.Stat.MaxMagAttack);
     Writer.Word((ushort)c.Stat.PhyDef);
     Writer.Word((ushort)c.Stat.MagDef);
     Writer.Word((ushort)c.Stat.Hit);
     Writer.Word((ushort)c.Stat.Parry);
     Writer.DWord((int)c.Stat.Hp);
     Writer.DWord((int)c.Stat.Mp);
     Writer.Word((ushort)c.Stat.Strength);
     Writer.Word((ushort)c.Stat.Intelligence);
     return Writer.GetBytes();
 }
 public static byte GetAmmoSlot(WorldMgr.character ch)
 {
     DB ms = new DB("SELECT * FROM char_items WHERE owner='" + ch.Information.CharacterID + "' AND (itemid='62' OR itemid='3655' OR itemid='10376' OR itemid='10727')");
     byte ammo = 0;
     using (System.Data.SqlClient.SqlDataReader reader = ms.Read())
     {
         while (reader.Read())
         {
             ammo = reader.GetByte(5);
         }
         ms.Close();
         return Convert.ToByte(ammo);
     }
 }
 public void Pet_PickupItem(WorldMgr.Items item)
 {
 }
Exemplo n.º 50
0
 public static void HandleReadyForAccountDataTimes(ref PacketReader packet, WorldClass session)
 {
     WorldMgr.WriteAccountDataTimes(AccountDataMasks.GlobalCacheMask, ref session);
 }
 //When player logs off
 public void RemoveMeFromGuildDisconnect(WorldMgr.guild g, WorldMgr.character c)
 {
     //Repeat for each client in members of guild
     foreach (SRClient member in g.MembersClient)
     {
         //Make sure the client is not null
         if (member != null)
         {
             //Make sure the client is not the one of the player that logs off
             if (member != client)
             {
                 //Send packet to client
                 member.Send(Packet.GuildUpdate(c, 6, 0, 0, 0));
             }
         }
     }
 }
Exemplo n.º 52
0
        protected virtual bool GetTeleportLocation(GamePlayer player, string text)
        {
            // Battlegrounds are specials, as the teleport location depends on
            // the level of the player, so let's deal with that first.
            if (text.ToLower() == "battlegrounds")
            {
                if (!ServerProperties.Properties.BG_ZONES_OPENED && player.Client.Account.PrivLevel == (uint)ePrivLevel.Player)
                {
                    SayTo(player, ServerProperties.Properties.BG_ZONES_CLOSED_MESSAGE);
                }
                else
                {
                    AbstractGameKeep portalKeep = GameServer.KeepManager.GetBGPK(player);
                    if (portalKeep != null)
                    {
                        Teleport teleport = new Teleport();
                        teleport.TeleportID = "battlegrounds";
                        teleport.Realm      = (byte)portalKeep.Realm;
                        teleport.RegionID   = portalKeep.Region;
                        teleport.X          = portalKeep.X;
                        teleport.Y          = portalKeep.Y;
                        teleport.Z          = portalKeep.Z;
                        teleport.Heading    = 0;
                        OnDestinationPicked(player, teleport);
                        return(true);
                    }
                    else
                    {
                        if (player.Client.Account.PrivLevel > (uint)ePrivLevel.Player)
                        {
                            player.Out.SendMessage("No portal keep found.", eChatType.CT_Skill, eChatLoc.CL_SystemWindow);
                        }

                        return(true);
                    }
                }
            }

            // Another special case is personal house, as there is no location
            // that will work for every player.
            if (text.ToLower() == "personal")
            {
                House house = HouseMgr.GetHouseByPlayer(player);

                if (house == null)
                {
                    text = "entrance";  // Fall through, port to housing entrance.
                }
                else
                {
                    IGameLocation location = house.OutdoorJumpPoint;
                    Teleport      teleport = new Teleport();
                    teleport.TeleportID = "personal";
                    teleport.Realm      = (int)DestinationRealm;
                    teleport.RegionID   = location.RegionID;
                    teleport.X          = location.X;
                    teleport.Y          = location.Y;
                    teleport.Z          = location.Z;
                    teleport.Heading    = location.Heading;
                    OnDestinationPicked(player, teleport);
                    return(true);
                }
            }

            // Yet another special case the port to the 'hearth' what means
            // that the player will be ported to the defined house bindstone
            if (text.ToLower() == "hearth")
            {
                // Check if player has set a house bind
                if (!(player.BindHouseRegion > 0))
                {
                    SayTo(player, "Sorry, you haven't set any house bind point yet.");
                    return(false);
                }

                // Check if the house at the player's house bind location still exists
                ArrayList houses = (ArrayList)HouseMgr.GetHousesCloseToSpot(
                    (ushort)player.
                    BindHouseRegion, player.BindHouseXpos, player.
                    BindHouseYpos, 700);
                if (houses.Count == 0)
                {
                    SayTo(player, "I'm afraid I can't teleport you to your hearth since the house at your " +
                          "house bind location has been torn down.");
                    return(false);
                }

                // Check if the house at the player's house bind location contains a bind stone
                House targetHouse = (House)houses[0];
                IDictionary <uint, DBHouseHookpointItem> hookpointItems = targetHouse.HousepointItems;
                bool hasBindstone = false;

                foreach (KeyValuePair <uint, DBHouseHookpointItem> targetHouseItem in hookpointItems)
                {
                    if (((GameObject)targetHouseItem.Value.GameObject).GetName(0, false).ToLower().EndsWith("bindstone"))
                    {
                        hasBindstone = true;
                        break;
                    }
                }

                if (!hasBindstone)
                {
                    SayTo(player, "I'm sorry to tell that the bindstone of your current house bind location " +
                          "has been removed, so I'm not able to teleport you there.");
                    return(false);
                }

                // Check if the player has the permission to bind at the house bind stone
                if (!targetHouse.CanBindInHouse(player))
                {
                    SayTo(player, "You're no longer allowed to bind at the house bindstone you've previously " +
                          "chosen, hence I'm not allowed to teleport you there.");
                    return(false);
                }

                Teleport teleport = new Teleport();
                teleport.TeleportID = "hearth";
                teleport.Realm      = (int)DestinationRealm;
                teleport.RegionID   = player.BindHouseRegion;
                teleport.X          = player.BindHouseXpos;
                teleport.Y          = player.BindHouseYpos;
                teleport.Z          = player.BindHouseZpos;
                teleport.Heading    = player.BindHouseHeading;
                OnDestinationPicked(player, teleport);
                return(true);
            }

            if (text.ToLower() == "guild")
            {
                House house = HouseMgr.GetGuildHouseByPlayer(player);

                if (house == null)
                {
                    return(false);  // no teleport when guild house not found
                }
                else
                {
                    IGameLocation location = house.OutdoorJumpPoint;
                    Teleport      teleport = new Teleport();
                    teleport.TeleportID = "guild house";
                    teleport.Realm      = (int)DestinationRealm;
                    teleport.RegionID   = location.RegionID;
                    teleport.X          = location.X;
                    teleport.Y          = location.Y;
                    teleport.Z          = location.Z;
                    teleport.Heading    = location.Heading;
                    OnDestinationPicked(player, teleport);
                    return(true);
                }
            }

            // Find the teleport location in the database.
            Teleport port = WorldMgr.GetTeleportLocation(DestinationRealm, string.Format("{0}:{1}", Type, text));

            if (port != null)
            {
                if (port.RegionID == 0 && port.X == 0 && port.Y == 0 && port.Z == 0)
                {
                    OnSubSelectionPicked(player, port);
                }
                else
                {
                    OnDestinationPicked(player, port);
                }

                return(false);
            }

            return(true);    // Needs further processing.
        }
 /////////////////////////////////////////////////////////////////////////////////
 // Get player inventory items (We will use this for stacking and checking).
 // So herer's the simple one ive made we can use to check player inventory
 /////////////////////////////////////////////////////////////////////////////////
 public static List<byte> GetPlayerItems(WorldMgr.character c)
 {
     List<byte> items = new List<byte>();
     DB ms = new DB("SELECT * FROM char_items WHERE owner='" + c.Information.CharacterID + "'");
     using (System.Data.SqlClient.SqlDataReader reader = ms.Read())
     {
         while (reader.Read())
         {
             items.Add(reader.GetByte(5));
         }
     }
     ms.Close();
     return items;
 }
Exemplo n.º 54
0
        public static void ScriptLoaded(DOLEvent e, object sender, EventArgs args)
        {
            if (!ServerProperties.Properties.LOAD_QUESTS)
            {
                return;
            }
            if (log.IsInfoEnabled)
            {
                log.Info("Quest \"" + questTitle + "\" initializing ...");
            }

            /* First thing we do in here is to search for the NPCs inside
             * the world who comes from the certain Realm. If we find a the players,
             * this means we don't have to create a new one.
             *
             * NOTE: You can do anything you want in this method, you don't have
             * to search for NPC's ... you could create a custom item, place it
             * on the ground and if a player picks it up, he will get the quest!
             * Just examples, do anything you like and feel comfortable with :)
             */

            #region defineNPCs

            GameNPC[] npcs = WorldMgr.GetNPCsByName("Argus Bowman", eRealm.Albion);

            /* Whops, if the npcs array length is 0 then no Sir Quait exists in
             * this users Mob Database, so we simply create one ;-)
             * else we take the existing one. And if more than one exist, we take
             * the first ...
             */
            if (npcs.Length == 0)
            {
                argusBowman       = new GameNPC();
                argusBowman.Model = 40;
                argusBowman.Name  = "Argus Bowman";
                if (log.IsWarnEnabled)
                {
                    log.Warn("Could not find " + argusBowman.Name + ", creating him ...");
                }
                argusBowman.GuildName       = "Weapon Merchant";
                argusBowman.Realm           = eRealm.Albion;
                argusBowman.CurrentRegionID = 1;
                argusBowman.Size            = 50;
                argusBowman.Level           = 18;
                argusBowman.X       = 530594;
                argusBowman.Y       = 480120;
                argusBowman.Z       = 2251;
                argusBowman.Heading = 1627;

                //You don't have to store the created mob in the db if you don't want,
                //it will be recreated each time it is not found, just comment the following
                //line if you rather not modify your database
                if (SAVE_INTO_DATABASE)
                {
                    argusBowman.SaveIntoDatabase();
                }


                argusBowman.AddToWorld();
            }
            else
            {
                argusBowman = npcs[0];
            }


            #endregion

            #region defineItems



            magicalWood = GameServer.Database.FindObjectByKey <ItemTemplate>("ludlow_magical_wood");
            if (magicalWood == null)
            {
                if (log.IsWarnEnabled)
                {
                    log.Warn("Could not find Ludlow Magical Wood, creating it ...");
                }
                magicalWood             = new ItemTemplate();
                magicalWood.Object_Type = 0;
                magicalWood.Id_nb       = "ludlow_magical_wood";
                magicalWood.Name        = "Ludlow Magical Wood";
                magicalWood.Level       = 1;
                magicalWood.Model       = 520;
                magicalWood.IsDropable  = false;
                magicalWood.IsPickable  = false;
                magicalWood.Weight      = 5;
                GameServer.Database.AddObject(magicalWood);
            }

            dullBlackGem = GameServer.Database.FindObjectByKey <ItemTemplate>("dull_black_gem");
            if (dullBlackGem == null)
            {
                dullBlackGem      = new ItemTemplate();
                dullBlackGem.Name = "Dull Black Gem";
                if (log.IsWarnEnabled)
                {
                    log.Warn("Could not find " + dullBlackGem.Name + ", creating it ...");
                }
                dullBlackGem.Level = 6;

                dullBlackGem.Weight = 3;
                dullBlackGem.Model  = 118;

                dullBlackGem.Object_Type = (int)eObjectType.Magical;
                dullBlackGem.Item_Type   = (int)eEquipmentItems.JEWEL;
                dullBlackGem.Id_nb       = "dull_black_gem";
                dullBlackGem.Price       = 0;
                dullBlackGem.IsPickable  = true;
                dullBlackGem.IsDropable  = true;

                dullBlackGem.Bonus = 5; // default bonus

                dullBlackGem.Bonus1     = 6;
                dullBlackGem.Bonus1Type = (int)eStat.DEX;

                dullBlackGem.Bonus2     = 1;
                dullBlackGem.Bonus2Type = (int)eResist.Spirit;

                dullBlackGem.Quality       = 100;
                dullBlackGem.Condition     = 1000;
                dullBlackGem.MaxCondition  = 1000;
                dullBlackGem.Durability    = 1000;
                dullBlackGem.MaxDurability = 1000;
                GameServer.Database.AddObject(dullBlackGem);
            }

            #endregion

            /* Now we add some hooks to the Sir Quait we found.
             * Actually, we want to know when a player interacts with him.
             * So, we hook the right-click (interact) and the whisper method
             * of Sir Quait and set the callback method to the "TalkToXXX"
             * method. This means, the "TalkToXXX" method is called whenever
             * a player right clicks on him or when he whispers to him.
             */
            GameEventMgr.AddHandler(GamePlayerEvent.AcceptQuest, new DOLEventHandler(SubscribeQuest));
            GameEventMgr.AddHandler(GamePlayerEvent.DeclineQuest, new DOLEventHandler(SubscribeQuest));

            GameEventMgr.AddHandler(argusBowman, GameLivingEvent.Interact, new DOLEventHandler(TalkToArgusBowman));
            GameEventMgr.AddHandler(argusBowman, GameLivingEvent.WhisperReceive, new DOLEventHandler(TalkToArgusBowman));

            /* Now we bring to argusBowman the possibility to give this quest to players */
            argusBowman.AddQuestToGive(typeof(ArgussArrows));

            if (log.IsInfoEnabled)
            {
                log.Info("Quest \"" + questTitle + "\" initialized");
            }
        }
Exemplo n.º 55
0
        public static bool Start(GameClient client = null)
        {
            // load hookpoint offsets
            House.LoadHookpointOffsets();

            // initialize the house template manager
            HouseTemplateMgr.Initialize();

            _houseList = new Dictionary <ushort, Dictionary <int, House> >();
            _idList    = new Dictionary <ushort, int>();

            int regions = 0;

            foreach (RegionEntry entry in WorldMgr.GetRegionList())
            {
                Region reg = WorldMgr.GetRegion(entry.id);
                if (reg != null && reg.UseHousingManager)
                {
                    if (!_houseList.ContainsKey(reg.ID))
                    {
                        _houseList.Add(reg.ID, new Dictionary <int, House>());
                    }

                    if (!_idList.ContainsKey(reg.ID))
                    {
                        _idList.Add(reg.ID, 0);
                    }

                    regions++;
                }
            }

            int houses     = 0;
            int lotmarkers = 0;

            foreach (DBHouse house in GameServer.Database.SelectAllObjects <DBHouse>())
            {
                Dictionary <int, House> housesForRegion;

                _houseList.TryGetValue(house.RegionID, out housesForRegion);

                // if we don't have the given region loaded as a housing zone, skip this house
                if (housesForRegion == null)
                {
                    continue;
                }

                // if we already loaded this house, that's no bueno, but just skip
                if (housesForRegion.ContainsKey(house.HouseNumber))
                {
                    continue;
                }

                if (SpawnLot(house, housesForRegion) == eLotSpawnType.House)
                {
                    houses++;
                }
                else
                {
                    lotmarkers++;
                }
            }

            if (log.IsInfoEnabled)
            {
                log.Info("[Housing] Loaded " + houses + " houses and " + lotmarkers + " lotmarkers in " + regions + " regions!");
            }

            if (client != null)
            {
                client.Out.SendMessage("Loaded " + houses + " houses and " + lotmarkers + " lotmarkers in " + regions + " regions!", eChatType.CT_System, eChatLoc.CL_SystemWindow);
            }

            if (CheckRentTimer != null)
            {
                CheckRentTimer.Change(Properties.RENT_CHECK_INTERVAL * 60 * 1000, Properties.RENT_CHECK_INTERVAL * 60 * 1000);
            }
            else
            {
                CheckRentTimer = new Timer(CheckRents, null, Properties.RENT_CHECK_INTERVAL * 60 * 1000, Properties.RENT_CHECK_INTERVAL * 60 * 1000);
            }

            return(true);
        }
Exemplo n.º 56
0
        public static void ScriptLoaded(DOLEvent e, object sender, EventArgs args)
        {
            if (!ServerProperties.Properties.LOAD_QUESTS)
            {
                return;
            }
            if (log.IsInfoEnabled)
            {
                log.Info("Quest \"" + questTitle + "\" initializing ...");
            }

            /* First thing we do in here is to search for the NPCs inside
             * the world who comes from the certain Realm. If we find a the players,
             * this means we don't have to create a new one.
             *
             * NOTE: You can do anything you want in this method, you don't have
             * to search for NPC's ... you could create a custom item, place it
             * on the ground and if a player picks it up, he will get the quest!
             * Just examples, do anything you like and feel comfortable with :)
             */

            #region defineNPCs

            GameNPC[] npcs = WorldMgr.GetNPCsByName("Atheleys Sy'Lian", eRealm.Albion);

            /* Whops, if the npcs array length is 0 then no Sir Quait exists in
             * this users Mob Database, so we simply create one ;-)
             * else we take the existing one. And if more than one exist, we take
             * the first ...
             */
            if (npcs.Length == 0)
            {
                atheleys       = new GameNPC();
                atheleys.Model = 87;
                atheleys.Name  = "Atheleys Sy'Lian";
                if (log.IsWarnEnabled)
                {
                    log.Warn("Could not find " + atheleys.Name + ", creating him ...");
                }
                atheleys.Realm           = eRealm.Albion;
                atheleys.CurrentRegionID = 1;
                atheleys.Size            = 50;
                atheleys.Level           = 30;
                atheleys.X       = 574375;
                atheleys.Y       = 530243;
                atheleys.Z       = 2906;
                atheleys.Heading = 1922;

                //You don't have to store the created mob in the db if you don't want,
                //it will be recreated each time it is not found, just comment the following
                //line if you rather not modify your database
                if (SAVE_INTO_DATABASE)
                {
                    atheleys.SaveIntoDatabase();
                }


                atheleys.AddToWorld();
            }
            else
            {
                atheleys = npcs[0];
            }

            npcs = WorldMgr.GetNPCsByName("Mostram", eRealm.None);


            if (npcs.Length == 0)
            {
                //TODO insert proper attributes
                mostram       = new GameNPC();
                mostram.Model = 18;
                mostram.Name  = "Mostram";
                if (log.IsWarnEnabled)
                {
                    log.Warn("Could not find Mostram, creating him ...");
                }
                mostram.GuildName       = "";
                mostram.Realm           = eRealm.None;
                mostram.CurrentRegionID = 1;
                mostram.Size            = 52;
                mostram.Level           = 9;
                mostram.X       = 574338;
                mostram.Y       = 536865;
                mostram.Z       = 2361;
                mostram.Heading = 57;

                StandardMobBrain brain = new StandardMobBrain();
                brain.AggroLevel = 0;
                brain.AggroRange = 500;
                mostram.SetOwnBrain(brain);

                //You don't have to store the created mob in the db if you don't want,
                //it will be recreated each time it is not found, just comment the following
                //line if you rather not modify your database
                if (SAVE_INTO_DATABASE)
                {
                    mostram.SaveIntoDatabase();
                }


                mostram.AddToWorld();
            }
            else
            {
                mostram = npcs[0];
            }


            #endregion

            /* Now we add some hooks to the Sir Quait we found.
             * Actually, we want to know when a player interacts with him.
             * So, we hook the right-click (interact) and the whisper method
             * of Sir Quait and set the callback method to the "TalkToXXX"
             * method. This means, the "TalkToXXX" method is called whenever
             * a player right clicks on him or when he whispers to him.
             */

            GameEventMgr.AddHandler(GamePlayerEvent.AcceptQuest, new DOLEventHandler(SubscribeQuest));
            GameEventMgr.AddHandler(GamePlayerEvent.DeclineQuest, new DOLEventHandler(SubscribeQuest));

            GameEventMgr.AddHandler(atheleys, GameLivingEvent.Interact, new DOLEventHandler(TalkToAtheleys));
            GameEventMgr.AddHandler(atheleys, GameLivingEvent.WhisperReceive, new DOLEventHandler(TalkToAtheleys));

            /* Now we bring to atheleys the possibility to give this quest to players */
            atheleys.AddQuestToGive(typeof(BreakingTheBandits));

            if (log.IsInfoEnabled)
            {
                log.Info("Quest \"" + questTitle + "\" initialized");
            }
        }
 void PetSkill(int skillid, WorldMgr.pet_obj o)
 {
     PacketWriter writer = new PacketWriter();
     writer.Create(OperationCode.SERVER_ACTION_DATA);
     /* Will add this later
      * Packet sniff:
      * [S -> C][B070]
      * 01                                                ................
      * 02 30                                             .0..............
      * 47 0F 00 00                                       G...............
      * AF FD 1A 03                                       ................
      * 1F 51 03 00                                       .Q..............
      * 93 AA 1A 00                                       ................
      * 01                                                ................
      * 01                                                ................
      * 01                                                ................
      * 93 AA 1A 00                                       ................
      * 00                                                ................
      * 01 0F 00 00                                       ................
      * 00 00 00 00                                       ................
      */
 }
Exemplo n.º 58
0
        /// <summary>
        /// 1125 char overview
        /// </summary>
        public override void SendCharacterOverview(eRealm realm)
        {
            if (realm < eRealm._FirstPlayerRealm || realm > eRealm._LastPlayerRealm)
            {
                throw new Exception("CharacterOverview requested for unknown realm " + realm);
            }

            int firstSlot = (byte)realm * 100;

            using (GSTCPPacketOut pak = new GSTCPPacketOut(GetPacketCode(eServerPackets.CharacterOverview)))
            {
                //pak.Fillstring(GameClient.Account.Name, 24);
                pak.Fill(0, 8);
                if (GameClient.Account.Characters == null)
                {
                    pak.Fill(0x0, 10);
                }
                else
                {
                    Dictionary <int, DOLCharacters> charsBySlot = new Dictionary <int, DOLCharacters>();
                    foreach (DOLCharacters c in GameClient.Account.Characters)
                    {
                        try
                        {
                            charsBySlot.Add(c.AccountSlot, c);
                        }
                        catch (Exception ex)
                        {
                            log.Error("SendCharacterOverview - Duplicate char in slot? Slot: " + c.AccountSlot + ", Account: " + c.AccountName, ex);
                        }
                    }
                    var itemsByOwnerID = new Dictionary <string, Dictionary <eInventorySlot, InventoryItem> >();

                    if (charsBySlot.Any())
                    {
                        var allItems = GameServer.Database.SelectObjects <InventoryItem>("`OwnerID` = @OwnerID AND `SlotPosition` >= @MinEquipable AND `SlotPosition` <= @MaxEquipable",
                                                                                         charsBySlot.Select(kv => new[] { new QueryParameter("@OwnerID", kv.Value.ObjectId), new QueryParameter("@MinEquipable", (int)eInventorySlot.MinEquipable), new QueryParameter("@MaxEquipable", (int)eInventorySlot.MaxEquipable) }))
                                       .SelectMany(objs => objs);

                        foreach (InventoryItem item in allItems)
                        {
                            try
                            {
                                if (!itemsByOwnerID.ContainsKey(item.OwnerID))
                                {
                                    itemsByOwnerID.Add(item.OwnerID, new Dictionary <eInventorySlot, InventoryItem>());
                                }

                                itemsByOwnerID[item.OwnerID].Add((eInventorySlot)item.SlotPosition, item);
                            }
                            catch (Exception ex)
                            {
                                log.Error("SendCharacterOverview - Duplicate item on character? OwnerID: " + item.OwnerID + ", SlotPosition: " + item.SlotPosition + ", Account: " + GameClient.Account.Name, ex);
                            }
                        }
                    }

                    for (int i = firstSlot; i < (firstSlot + 10); i++)
                    {
                        if (!charsBySlot.TryGetValue(i, out DOLCharacters c))
                        {
                            pak.WriteByte(0);
                        }
                        else
                        {
                            if (!itemsByOwnerID.TryGetValue(c.ObjectId, out Dictionary <eInventorySlot, InventoryItem> charItems))
                            {
                                charItems = new Dictionary <eInventorySlot, InventoryItem>();
                            }

                            byte extensionTorso  = 0;
                            byte extensionGloves = 0;
                            byte extensionBoots  = 0;


                            if (charItems.TryGetValue(eInventorySlot.TorsoArmor, out InventoryItem item))
                            {
                                extensionTorso = item.Extension;
                            }

                            if (charItems.TryGetValue(eInventorySlot.HandsArmor, out item))
                            {
                                extensionGloves = item.Extension;
                            }

                            if (charItems.TryGetValue(eInventorySlot.FeetArmor, out item))
                            {
                                extensionBoots = item.Extension;
                            }

                            pak.WriteByte((byte)c.Level); // moved
                            pak.WritePascalStringIntLowEndian(c.Name);
                            pak.WriteByte(0x18);          // no idea
                            pak.WriteInt(1);              // no idea
                            pak.WriteByte((byte)c.EyeSize);
                            pak.WriteByte((byte)c.LipSize);
                            pak.WriteByte((byte)c.EyeColor);
                            pak.WriteByte((byte)c.HairColor);
                            pak.WriteByte((byte)c.FaceType);
                            pak.WriteByte((byte)c.HairStyle);
                            pak.WriteByte((byte)((extensionBoots << 4) | extensionGloves));
                            pak.WriteByte((byte)((extensionTorso << 4) | (c.IsCloakHoodUp ? 0x1 : 0x0)));
                            pak.WriteByte((byte)c.CustomisationStep); //1 = auto generate config, 2= config ended by player, 3= enable config to player
                            pak.WriteByte((byte)c.MoodType);
                            pak.Fill(0x0, 13);                        //0 string

                            string locationDescription = string.Empty;
                            Region region = WorldMgr.GetRegion((ushort)c.Region);
                            if (region != null)
                            {
                                locationDescription = region.GetTranslatedSpotDescription(GameClient, c.Xpos, c.Ypos, c.Zpos);
                            }
                            if (locationDescription.Length > 23)                             // location name over 23 chars has to be truncated eg. "The Great Pyramid of Stygia"
                            {
                                locationDescription = (locationDescription.Substring(0, 20)) + "...";
                            }
                            pak.WritePascalStringIntLowEndian(locationDescription);

                            string classname = "";
                            if (c.Class != 0)
                            {
                                classname = ((eCharacterClass)c.Class).ToString();
                            }
                            pak.WritePascalStringIntLowEndian(classname);

                            string racename = GameClient.RaceToTranslatedName(c.Race, c.Gender);

                            pak.WritePascalStringIntLowEndian(racename);
                            pak.WriteShortLowEndian((ushort)c.CurrentModel); // moved
                            // something here
                            pak.WriteByte((byte)c.Region);

                            if (region == null || (int)GameClient.ClientType > region.Expansion)
                            {
                                pak.WriteByte(0x00);
                            }
                            else
                            {
                                pak.WriteByte((byte)(region.Expansion + 1)); //0x04-Cata zone, 0x05 - DR zone
                            }

                            charItems.TryGetValue(eInventorySlot.RightHandWeapon, out InventoryItem rightHandWeapon);
                            charItems.TryGetValue(eInventorySlot.LeftHandWeapon, out InventoryItem leftHandWeapon);
                            charItems.TryGetValue(eInventorySlot.TwoHandWeapon, out InventoryItem twoHandWeapon);
                            charItems.TryGetValue(eInventorySlot.DistanceWeapon, out InventoryItem distanceWeapon);
                            charItems.TryGetValue(eInventorySlot.HeadArmor, out InventoryItem helmet);
                            charItems.TryGetValue(eInventorySlot.HandsArmor, out InventoryItem gloves);
                            charItems.TryGetValue(eInventorySlot.FeetArmor, out InventoryItem boots);
                            charItems.TryGetValue(eInventorySlot.TorsoArmor, out InventoryItem torso);
                            charItems.TryGetValue(eInventorySlot.Cloak, out InventoryItem cloak);
                            charItems.TryGetValue(eInventorySlot.LegsArmor, out InventoryItem legs);
                            charItems.TryGetValue(eInventorySlot.ArmsArmor, out InventoryItem arms);

                            pak.WriteShortLowEndian((ushort)(helmet != null ? helmet.Model : 0));
                            pak.WriteShortLowEndian((ushort)(gloves != null ? gloves.Model : 0));
                            pak.WriteShortLowEndian((ushort)(boots != null ? boots.Model : 0));

                            ushort rightHandColor = 0;
                            if (rightHandWeapon != null)
                            {
                                rightHandColor = (ushort)(rightHandWeapon.Emblem != 0 ? rightHandWeapon.Emblem : rightHandWeapon.Color);
                            }
                            pak.WriteShortLowEndian(rightHandColor);

                            pak.WriteShortLowEndian((ushort)(torso != null ? torso.Model : 0));
                            pak.WriteShortLowEndian((ushort)(cloak != null ? cloak.Model : 0));
                            pak.WriteShortLowEndian((ushort)(legs != null ? legs.Model : 0));
                            pak.WriteShortLowEndian((ushort)(arms != null ? arms.Model : 0));

                            ushort helmetColor = 0;
                            if (helmet != null)
                            {
                                helmetColor = (ushort)(helmet.Emblem != 0 ? helmet.Emblem : helmet.Color);
                            }
                            pak.WriteShortLowEndian(helmetColor);

                            ushort glovesColor = 0;
                            if (gloves != null)
                            {
                                glovesColor = (ushort)(gloves.Emblem != 0 ? gloves.Emblem : gloves.Color);
                            }
                            pak.WriteShortLowEndian(glovesColor);

                            ushort bootsColor = 0;
                            if (boots != null)
                            {
                                bootsColor = (ushort)(boots.Emblem != 0 ? boots.Emblem : boots.Color);
                            }
                            pak.WriteShortLowEndian(bootsColor);

                            ushort leftHandWeaponColor = 0;
                            if (leftHandWeapon != null)
                            {
                                leftHandWeaponColor = (ushort)(leftHandWeapon.Emblem != 0 ? leftHandWeapon.Emblem : leftHandWeapon.Color);
                            }
                            pak.WriteShortLowEndian(leftHandWeaponColor);

                            ushort torsoColor = 0;
                            if (torso != null)
                            {
                                torsoColor = (ushort)(torso.Emblem != 0 ? torso.Emblem : torso.Color);
                            }
                            pak.WriteShortLowEndian(torsoColor);

                            ushort cloakColor = 0;
                            if (cloak != null)
                            {
                                cloakColor = (ushort)(cloak.Emblem != 0 ? cloak.Emblem : cloak.Color);
                            }
                            pak.WriteShortLowEndian(cloakColor);

                            ushort legsColor = 0;
                            if (legs != null)
                            {
                                legsColor = (ushort)(legs.Emblem != 0 ? legs.Emblem : legs.Color);
                            }
                            pak.WriteShortLowEndian(legsColor);

                            ushort armsColor = 0;
                            if (arms != null)
                            {
                                armsColor = (ushort)(arms.Emblem != 0 ? arms.Emblem : arms.Color);
                            }
                            pak.WriteShortLowEndian(armsColor);

                            //weapon models

                            pak.WriteShortLowEndian((ushort)(rightHandWeapon != null ? rightHandWeapon.Model : 0));
                            pak.WriteShortLowEndian((ushort)(leftHandWeapon != null ? leftHandWeapon.Model : 0));
                            pak.WriteShortLowEndian((ushort)(twoHandWeapon != null ? twoHandWeapon.Model : 0));
                            pak.WriteShortLowEndian((ushort)(distanceWeapon != null ? distanceWeapon.Model : 0));

                            //pak.WriteInt(0x0); // Internal database ID
                            pak.WriteByte((byte)c.Strength);
                            pak.WriteByte((byte)c.Dexterity);
                            pak.WriteByte((byte)c.Constitution);
                            pak.WriteByte((byte)c.Quickness);
                            pak.WriteByte((byte)c.Intelligence);
                            pak.WriteByte((byte)c.Piety);
                            pak.WriteByte((byte)c.Empathy);
                            pak.WriteByte((byte)c.Charisma);
                            pak.WriteByte((byte)c.Class); // moved
                            pak.WriteByte((byte)c.Realm); // moved
                            pak.WriteByte((byte)((((c.Race & 0x10) << 2) + (c.Race & 0x0F)) | (c.Gender << 4)));

                            if (c.ActiveWeaponSlot == (byte)GameLiving.eActiveWeaponSlot.TwoHanded)
                            {
                                pak.WriteByte(0x02);
                                pak.WriteByte(0x02);
                            }
                            else if (c.ActiveWeaponSlot == (byte)GameLiving.eActiveWeaponSlot.Distance)
                            {
                                pak.WriteByte(0x03);
                                pak.WriteByte(0x03);
                            }
                            else
                            {
                                byte righthand = 0xFF;
                                byte lefthand  = 0xFF;

                                if (rightHandWeapon != null)
                                {
                                    righthand = 0x00;
                                }

                                if (leftHandWeapon != null)
                                {
                                    lefthand = 0x01;
                                }

                                pak.WriteByte(righthand);
                                pak.WriteByte(lefthand);
                            }

                            if (region == null || region.Expansion != 1)
                            {
                                pak.WriteByte(0x00);
                            }
                            else
                            {
                                pak.WriteByte(0x01); //0x01=char in SI zone, classic client can't "play"
                            }

                            pak.WriteByte((byte)c.Constitution);
                        }
                    }
                }

                SendTCP(pak);
            }
        }
Exemplo n.º 59
0
        /// <summary>
        /// Reads in the template and generates the appropriate html
        /// </summary>
        public static void Generate()
        {
            try
            {
                var db = ObjectDatabase.GetObjectDatabase(ConnectionType.DATABASE_XML, "." + Path.DirectorySeparatorChar + "webui" + Path.DirectorySeparatorChar + "generated");

                // Obsolete with GSS Table Registering in SVN : 3337
                // db.RegisterDataObject(typeof (ServerInfo));
                // Obsolete with GSS Table Registering in SVN : 3337
                // db.RegisterDataObject(typeof (PlayerInfo));
                ServerInfo si = new ServerInfo();

                si.Time              = DateTime.Now.ToString();
                si.ServerName        = GameServer.Instance.Configuration.ServerName;
                si.NumClients        = GameServer.Instance.ClientCount;
                si.NumAccounts       = GameServer.Database.GetObjectCount <Account>();
                si.NumMobs           = GameServer.Database.GetObjectCount <Mob>();
                si.NumInventoryItems = GameServer.Database.GetObjectCount <InventoryItem>();
                si.NumPlayerChars    = GameServer.Database.GetObjectCount <DOLCharacters>();
                si.NumMerchantItems  = GameServer.Database.GetObjectCount <MerchantItem>();
                si.NumItemTemplates  = GameServer.Database.GetObjectCount <ItemTemplate>();
                si.NumWorldObjects   = GameServer.Database.GetObjectCount <WorldObject>();
                si.ServerType        = GameServer.Instance.Configuration.ServerType.ToString();
                si.ServerStatus      = GameServer.Instance.ServerStatus.ToString();
                si.AAC = GameServer.Instance.Configuration.AutoAccountCreation ? "enabled" : "disabled";

                db.AddObject(si);

                PlayerInfo pi = new PlayerInfo();

                foreach (GameClient client in WorldMgr.GetAllPlayingClients())
                {
                    GamePlayer plr = client.Player;

                    pi.Name     = plr.Name;
                    pi.LastName = plr.LastName;
                    pi.Class    = plr.CharacterClass.Name;
                    pi.Race     = plr.RaceName;
                    pi.Guild    = plr.GuildName;
                    pi.Level    = plr.Level;
                    pi.Alive    = plr.IsAlive ? "yes" : "no";
                    pi.Realm    = ((eRealm)plr.Realm).ToString();
                    pi.Region   = plr.CurrentRegion.Name;
                    pi.X        = plr.X;
                    pi.Y        = plr.Y;
                }

                // 2008-01-29 Kakuri - Obsolete
                // db.WriteDatabaseTables();
                db = null;

                if (log.IsInfoEnabled)
                {
                    log.Info("WebUI Generation initialized");
                }
            }
            catch (Exception e)
            {
                if (log.IsErrorEnabled)
                {
                    log.Error("WebUI Generation: ", e);
                }
            }
        }
Exemplo n.º 60
0
        public static void ScriptLoaded(DOLEvent e, object sender, EventArgs args)
        {
            if (!ServerProperties.Properties.LOAD_QUESTS)
            {
                return;
            }
            if (log.IsInfoEnabled)
            {
                log.Info("Quest \"" + questTitle + "\" initializing ...");
            }

            #region defineNPCs

            GameNPC[] npcs = WorldMgr.GetNPCsByName("Inaksha", eRealm.Midgard);

            if (npcs.Length == 0)
            {
                if (log.IsWarnEnabled)
                {
                    log.Warn("Could not find Inaksha , creating it ...");
                }
                Inaksha                 = new GameNPC();
                Inaksha.Model           = 193;
                Inaksha.Name            = "Inaksha";
                Inaksha.GuildName       = "";
                Inaksha.Realm           = eRealm.Midgard;
                Inaksha.CurrentRegionID = 100;
                Inaksha.Size            = 50;
                Inaksha.Level           = 41;
                Inaksha.X               = 805929;
                Inaksha.Y               = 702449;
                Inaksha.Z               = 4960;
                Inaksha.Heading         = 2116;
                Inaksha.AddToWorld();
                if (SAVE_INTO_DATABASE)
                {
                    Inaksha.SaveIntoDatabase();
                }
            }
            else
            {
                Inaksha = npcs[0];
            }
            // end npc

            npcs = WorldMgr.GetNPCsByName("Loken", eRealm.None);

            if (npcs.Length == 0)
            {
                if (log.IsWarnEnabled)
                {
                    log.Warn("Could not find Loken , creating it ...");
                }
                Loken                 = new GameNPC();
                Loken.Model           = 212;
                Loken.Name            = "Loken";
                Loken.GuildName       = "";
                Loken.Realm           = eRealm.None;
                Loken.CurrentRegionID = 100;
                Loken.Size            = 50;
                Loken.Level           = 65;
                Loken.X               = 636784;
                Loken.Y               = 762433;
                Loken.Z               = 4596;
                Loken.Heading         = 3777;
                Loken.AddToWorld();
                if (SAVE_INTO_DATABASE)
                {
                    Loken.SaveIntoDatabase();
                }
            }
            else
            {
                Loken = npcs[0];
            }
            // end npc

            npcs = WorldMgr.GetNPCsByName("Miri", eRealm.Midgard);

            if (npcs.Length == 0)
            {
                if (log.IsWarnEnabled)
                {
                    log.Warn("Could not find Miri , creating it ...");
                }
                Miri                 = new GameNPC();
                Miri.Model           = 220;
                Miri.Name            = "Miri";
                Miri.GuildName       = "";
                Miri.Realm           = eRealm.Midgard;
                Miri.CurrentRegionID = 101;
                Miri.Size            = 50;
                Miri.Level           = 43;
                Miri.X               = 30641;
                Miri.Y               = 32093;
                Miri.Z               = 8305;
                Miri.Heading         = 3037;
                Miri.AddToWorld();
                if (SAVE_INTO_DATABASE)
                {
                    Miri.SaveIntoDatabase();
                }
            }
            else
            {
                Miri = npcs[0];
            }
            // end npc

            #endregion

            #region defineItems

            ball_of_flame = GameServer.Database.FindObjectByKey <ItemTemplate>("ball_of_flame");
            if (ball_of_flame == null)
            {
                if (log.IsWarnEnabled)
                {
                    log.Warn("Could not find ball_of_flame , creating it ...");
                }
                ball_of_flame             = new ItemTemplate();
                ball_of_flame.Id_nb       = "ball_of_flame";
                ball_of_flame.Name        = "Ball of Flame";
                ball_of_flame.Level       = 8;
                ball_of_flame.Item_Type   = 29;
                ball_of_flame.Model       = 601;
                ball_of_flame.IsDropable  = false;
                ball_of_flame.IsPickable  = false;
                ball_of_flame.DPS_AF      = 0;
                ball_of_flame.SPD_ABS     = 0;
                ball_of_flame.Object_Type = 41;
                ball_of_flame.Hand        = 0;
                ball_of_flame.Type_Damage = 0;
                ball_of_flame.Quality     = 100;
                ball_of_flame.Weight      = 12;
                if (SAVE_INTO_DATABASE)
                {
                    GameServer.Database.AddObject(ball_of_flame);
                }
            }

// end item
            sealed_pouch = GameServer.Database.FindObjectByKey <ItemTemplate>("sealed_pouch");
            if (sealed_pouch == null)
            {
                if (log.IsWarnEnabled)
                {
                    log.Warn("Could not find Sealed Pouch , creating it ...");
                }
                sealed_pouch             = new ItemTemplate();
                sealed_pouch.Id_nb       = "sealed_pouch";
                sealed_pouch.Name        = "Sealed Pouch";
                sealed_pouch.Level       = 8;
                sealed_pouch.Item_Type   = 29;
                sealed_pouch.Model       = 488;
                sealed_pouch.IsDropable  = false;
                sealed_pouch.IsPickable  = false;
                sealed_pouch.DPS_AF      = 0;
                sealed_pouch.SPD_ABS     = 0;
                sealed_pouch.Object_Type = 41;
                sealed_pouch.Hand        = 0;
                sealed_pouch.Type_Damage = 0;
                sealed_pouch.Quality     = 100;
                sealed_pouch.Weight      = 12;
                if (SAVE_INTO_DATABASE)
                {
                    GameServer.Database.AddObject(sealed_pouch);
                }
            }
// end item

            //Valhalla Touched Boots
            HealerEpicBoots = GameServer.Database.FindObjectByKey <ItemTemplate>("HealerEpicBoots");
            if (HealerEpicBoots == null)
            {
                if (log.IsWarnEnabled)
                {
                    log.Warn("Could not find Healers Epic Boots , creating it ...");
                }
                HealerEpicBoots               = new ItemTemplate();
                HealerEpicBoots.Id_nb         = "HealerEpicBoots";
                HealerEpicBoots.Name          = "Valhalla Touched Boots";
                HealerEpicBoots.Level         = 50;
                HealerEpicBoots.Item_Type     = 23;
                HealerEpicBoots.Model         = 702;
                HealerEpicBoots.IsDropable    = true;
                HealerEpicBoots.IsPickable    = true;
                HealerEpicBoots.DPS_AF        = 100;
                HealerEpicBoots.SPD_ABS       = 27;
                HealerEpicBoots.Object_Type   = 35;
                HealerEpicBoots.Quality       = 100;
                HealerEpicBoots.Weight        = 22;
                HealerEpicBoots.Bonus         = 35;
                HealerEpicBoots.MaxCondition  = 50000;
                HealerEpicBoots.MaxDurability = 50000;
                HealerEpicBoots.Condition     = 50000;
                HealerEpicBoots.Durability    = 50000;

                HealerEpicBoots.Bonus1     = 12;
                HealerEpicBoots.Bonus1Type = (int)eStat.CON;

                HealerEpicBoots.Bonus2     = 12;
                HealerEpicBoots.Bonus2Type = (int)eStat.DEX;

                HealerEpicBoots.Bonus3     = 12;
                HealerEpicBoots.Bonus3Type = (int)eStat.QUI;

                HealerEpicBoots.Bonus4     = 21;
                HealerEpicBoots.Bonus4Type = (int)eProperty.MaxHealth;

                if (SAVE_INTO_DATABASE)
                {
                    GameServer.Database.AddObject(HealerEpicBoots);
                }
            }
//end item
            //Valhalla Touched Coif
            HealerEpicHelm = GameServer.Database.FindObjectByKey <ItemTemplate>("HealerEpicHelm");
            if (HealerEpicHelm == null)
            {
                if (log.IsWarnEnabled)
                {
                    log.Warn("Could not find Healers Epic Helm , creating it ...");
                }
                HealerEpicHelm               = new ItemTemplate();
                HealerEpicHelm.Id_nb         = "HealerEpicHelm";
                HealerEpicHelm.Name          = "Valhalla Touched Coif";
                HealerEpicHelm.Level         = 50;
                HealerEpicHelm.Item_Type     = 21;
                HealerEpicHelm.Model         = 1291;         //NEED TO WORK ON..
                HealerEpicHelm.IsDropable    = true;
                HealerEpicHelm.IsPickable    = true;
                HealerEpicHelm.DPS_AF        = 100;
                HealerEpicHelm.SPD_ABS       = 27;
                HealerEpicHelm.Object_Type   = 35;
                HealerEpicHelm.Quality       = 100;
                HealerEpicHelm.Weight        = 22;
                HealerEpicHelm.Bonus         = 35;
                HealerEpicHelm.MaxCondition  = 50000;
                HealerEpicHelm.MaxDurability = 50000;
                HealerEpicHelm.Condition     = 50000;
                HealerEpicHelm.Durability    = 50000;

                HealerEpicHelm.Bonus1     = 4;
                HealerEpicHelm.Bonus1Type = (int)eProperty.Skill_Augmentation;

                HealerEpicHelm.Bonus2     = 18;
                HealerEpicHelm.Bonus2Type = (int)eStat.PIE;

                HealerEpicHelm.Bonus3     = 4;
                HealerEpicHelm.Bonus3Type = (int)eResist.Slash;

                HealerEpicHelm.Bonus4     = 6;
                HealerEpicHelm.Bonus4Type = (int)eProperty.PowerRegenerationRate;

                if (SAVE_INTO_DATABASE)
                {
                    GameServer.Database.AddObject(HealerEpicHelm);
                }
            }
//end item
            //Valhalla Touched Gloves
            HealerEpicGloves = GameServer.Database.FindObjectByKey <ItemTemplate>("HealerEpicGloves");
            if (HealerEpicGloves == null)
            {
                if (log.IsWarnEnabled)
                {
                    log.Warn("Could not find Healers Epic Gloves , creating it ...");
                }
                HealerEpicGloves               = new ItemTemplate();
                HealerEpicGloves.Id_nb         = "HealerEpicGloves";
                HealerEpicGloves.Name          = "Valhalla Touched Gloves ";
                HealerEpicGloves.Level         = 50;
                HealerEpicGloves.Item_Type     = 22;
                HealerEpicGloves.Model         = 701;
                HealerEpicGloves.IsDropable    = true;
                HealerEpicGloves.IsPickable    = true;
                HealerEpicGloves.DPS_AF        = 100;
                HealerEpicGloves.SPD_ABS       = 27;
                HealerEpicGloves.Object_Type   = 35;
                HealerEpicGloves.Quality       = 100;
                HealerEpicGloves.Weight        = 22;
                HealerEpicGloves.Bonus         = 35;
                HealerEpicGloves.MaxCondition  = 50000;
                HealerEpicGloves.MaxDurability = 50000;
                HealerEpicGloves.Condition     = 50000;
                HealerEpicGloves.Durability    = 50000;

                HealerEpicGloves.Bonus1     = 4;
                HealerEpicGloves.Bonus1Type = (int)eProperty.Skill_Mending;

                HealerEpicGloves.Bonus2     = 16;
                HealerEpicGloves.Bonus2Type = (int)eStat.PIE;

                HealerEpicGloves.Bonus3     = 4;
                HealerEpicGloves.Bonus3Type = (int)eResist.Crush;

                HealerEpicGloves.Bonus4     = 6;
                HealerEpicGloves.Bonus4Type = (int)eProperty.PowerRegenerationRate;

                if (SAVE_INTO_DATABASE)
                {
                    GameServer.Database.AddObject(HealerEpicGloves);
                }
            }
            //Valhalla Touched Hauberk
            HealerEpicVest = GameServer.Database.FindObjectByKey <ItemTemplate>("HealerEpicVest");
            if (HealerEpicVest == null)
            {
                if (log.IsWarnEnabled)
                {
                    log.Warn("Could not find Healers Epic Vest , creating it ...");
                }
                HealerEpicVest               = new ItemTemplate();
                HealerEpicVest.Id_nb         = "HealerEpicVest";
                HealerEpicVest.Name          = "Valhalla Touched Haukberk";
                HealerEpicVest.Level         = 50;
                HealerEpicVest.Item_Type     = 25;
                HealerEpicVest.Model         = 698;
                HealerEpicVest.IsDropable    = true;
                HealerEpicVest.IsPickable    = true;
                HealerEpicVest.DPS_AF        = 100;
                HealerEpicVest.SPD_ABS       = 27;
                HealerEpicVest.Object_Type   = 35;
                HealerEpicVest.Quality       = 100;
                HealerEpicVest.Weight        = 22;
                HealerEpicVest.Bonus         = 35;
                HealerEpicVest.MaxCondition  = 50000;
                HealerEpicVest.MaxDurability = 50000;
                HealerEpicVest.Condition     = 50000;
                HealerEpicVest.Durability    = 50000;

                HealerEpicVest.Bonus1     = 16;
                HealerEpicVest.Bonus1Type = (int)eStat.CON;

                HealerEpicVest.Bonus2     = 16;
                HealerEpicVest.Bonus2Type = (int)eStat.PIE;

                HealerEpicVest.Bonus3     = 8;
                HealerEpicVest.Bonus3Type = (int)eResist.Cold;

                HealerEpicVest.Bonus4     = 10;
                HealerEpicVest.Bonus4Type = (int)eResist.Heat;

                if (SAVE_INTO_DATABASE)
                {
                    GameServer.Database.AddObject(HealerEpicVest);
                }
            }
            //Valhalla Touched Legs
            HealerEpicLegs = GameServer.Database.FindObjectByKey <ItemTemplate>("HealerEpicLegs");
            if (HealerEpicLegs == null)
            {
                if (log.IsWarnEnabled)
                {
                    log.Warn("Could not find Healers Epic Legs , creating it ...");
                }
                HealerEpicLegs               = new ItemTemplate();
                HealerEpicLegs.Id_nb         = "HealerEpicLegs";
                HealerEpicLegs.Name          = "Valhalla Touched Legs";
                HealerEpicLegs.Level         = 50;
                HealerEpicLegs.Item_Type     = 27;
                HealerEpicLegs.Model         = 699;
                HealerEpicLegs.IsDropable    = true;
                HealerEpicLegs.IsPickable    = true;
                HealerEpicLegs.DPS_AF        = 100;
                HealerEpicLegs.SPD_ABS       = 27;
                HealerEpicLegs.Object_Type   = 35;
                HealerEpicLegs.Quality       = 100;
                HealerEpicLegs.Weight        = 22;
                HealerEpicLegs.Bonus         = 35;
                HealerEpicLegs.MaxCondition  = 50000;
                HealerEpicLegs.MaxDurability = 50000;
                HealerEpicLegs.Condition     = 50000;
                HealerEpicLegs.Durability    = 50000;

                HealerEpicLegs.Bonus1     = 15;
                HealerEpicLegs.Bonus1Type = (int)eStat.STR;

                HealerEpicLegs.Bonus2     = 16;
                HealerEpicLegs.Bonus2Type = (int)eStat.CON;

                HealerEpicLegs.Bonus3     = 10;
                HealerEpicLegs.Bonus3Type = (int)eResist.Spirit;

                HealerEpicLegs.Bonus4     = 10;
                HealerEpicLegs.Bonus4Type = (int)eResist.Energy;

                if (SAVE_INTO_DATABASE)
                {
                    GameServer.Database.AddObject(HealerEpicLegs);
                }
            }
            //Valhalla Touched Sleeves
            HealerEpicArms = GameServer.Database.FindObjectByKey <ItemTemplate>("HealerEpicArms");
            if (HealerEpicArms == null)
            {
                if (log.IsWarnEnabled)
                {
                    log.Warn("Could not find Healer Epic Arms , creating it ...");
                }
                HealerEpicArms               = new ItemTemplate();
                HealerEpicArms.Id_nb         = "HealerEpicArms";
                HealerEpicArms.Name          = "Valhalla Touched Sleeves";
                HealerEpicArms.Level         = 50;
                HealerEpicArms.Item_Type     = 28;
                HealerEpicArms.Model         = 700;
                HealerEpicArms.IsDropable    = true;
                HealerEpicArms.IsPickable    = true;
                HealerEpicArms.DPS_AF        = 100;
                HealerEpicArms.SPD_ABS       = 27;
                HealerEpicArms.Object_Type   = 35;
                HealerEpicArms.Quality       = 100;
                HealerEpicArms.Weight        = 22;
                HealerEpicArms.Bonus         = 35;
                HealerEpicArms.MaxCondition  = 50000;
                HealerEpicArms.MaxDurability = 50000;
                HealerEpicArms.Condition     = 50000;
                HealerEpicArms.Durability    = 50000;

                HealerEpicArms.Bonus1     = 4;
                HealerEpicArms.Bonus1Type = (int)eProperty.Skill_Mending;

                HealerEpicArms.Bonus2     = 13;
                HealerEpicArms.Bonus2Type = (int)eStat.STR;

                HealerEpicArms.Bonus3     = 15;
                HealerEpicArms.Bonus3Type = (int)eStat.PIE;

                HealerEpicArms.Bonus4     = 6;
                HealerEpicArms.Bonus4Type = (int)eResist.Matter;

                if (SAVE_INTO_DATABASE)
                {
                    GameServer.Database.AddObject(HealerEpicArms);
                }
            }
            //Subterranean Boots
            ShamanEpicBoots = GameServer.Database.FindObjectByKey <ItemTemplate>("ShamanEpicBoots");
            if (ShamanEpicBoots == null)
            {
                if (log.IsWarnEnabled)
                {
                    log.Warn("Could not find Shaman Epic Boots , creating it ...");
                }
                ShamanEpicBoots               = new ItemTemplate();
                ShamanEpicBoots.Id_nb         = "ShamanEpicBoots";
                ShamanEpicBoots.Name          = "Subterranean Boots";
                ShamanEpicBoots.Level         = 50;
                ShamanEpicBoots.Item_Type     = 23;
                ShamanEpicBoots.Model         = 770;
                ShamanEpicBoots.IsDropable    = true;
                ShamanEpicBoots.IsPickable    = true;
                ShamanEpicBoots.DPS_AF        = 100;
                ShamanEpicBoots.SPD_ABS       = 27;
                ShamanEpicBoots.Object_Type   = 35;
                ShamanEpicBoots.Quality       = 100;
                ShamanEpicBoots.Weight        = 22;
                ShamanEpicBoots.Bonus         = 35;
                ShamanEpicBoots.MaxCondition  = 50000;
                ShamanEpicBoots.MaxDurability = 50000;
                ShamanEpicBoots.Condition     = 50000;
                ShamanEpicBoots.Durability    = 50000;

                ShamanEpicBoots.Bonus1     = 13;
                ShamanEpicBoots.Bonus1Type = (int)eStat.DEX;

                ShamanEpicBoots.Bonus2     = 13;
                ShamanEpicBoots.Bonus2Type = (int)eStat.QUI;

                ShamanEpicBoots.Bonus3     = 39;
                ShamanEpicBoots.Bonus3Type = (int)eProperty.MaxHealth;

                if (SAVE_INTO_DATABASE)
                {
                    GameServer.Database.AddObject(ShamanEpicBoots);
                }
            }
            //Subterranean Coif
            ShamanEpicHelm = GameServer.Database.FindObjectByKey <ItemTemplate>("ShamanEpicHelm");
            if (ShamanEpicHelm == null)
            {
                if (log.IsWarnEnabled)
                {
                    log.Warn("Could not find Shaman Epic Helm , creating it ...");
                }
                ShamanEpicHelm               = new ItemTemplate();
                ShamanEpicHelm.Id_nb         = "ShamanEpicHelm";
                ShamanEpicHelm.Name          = "Subterranean Coif";
                ShamanEpicHelm.Level         = 50;
                ShamanEpicHelm.Item_Type     = 21;
                ShamanEpicHelm.Model         = 63;         //NEED TO WORK ON..
                ShamanEpicHelm.IsDropable    = true;
                ShamanEpicHelm.IsPickable    = true;
                ShamanEpicHelm.DPS_AF        = 100;
                ShamanEpicHelm.SPD_ABS       = 27;
                ShamanEpicHelm.Object_Type   = 35;
                ShamanEpicHelm.Quality       = 100;
                ShamanEpicHelm.Weight        = 22;
                ShamanEpicHelm.Bonus         = 35;
                ShamanEpicHelm.MaxCondition  = 50000;
                ShamanEpicHelm.MaxDurability = 50000;
                ShamanEpicHelm.Condition     = 50000;
                ShamanEpicHelm.Durability    = 50000;

                ShamanEpicHelm.Bonus1     = 4;
                ShamanEpicHelm.Bonus1Type = (int)eProperty.Skill_Mending;

                ShamanEpicHelm.Bonus2     = 18;
                ShamanEpicHelm.Bonus2Type = (int)eStat.PIE;

                ShamanEpicHelm.Bonus3     = 4;
                ShamanEpicHelm.Bonus3Type = (int)eResist.Thrust;

                ShamanEpicHelm.Bonus4     = 6;
                ShamanEpicHelm.Bonus4Type = (int)eProperty.PowerRegenerationRate;

                if (SAVE_INTO_DATABASE)
                {
                    GameServer.Database.AddObject(ShamanEpicHelm);
                }
            }
            //Subterranean Gloves
            ShamanEpicGloves = GameServer.Database.FindObjectByKey <ItemTemplate>("ShamanEpicGloves");
            if (ShamanEpicGloves == null)
            {
                if (log.IsWarnEnabled)
                {
                    log.Warn("Could not find Shaman Epic Gloves , creating it ...");
                }
                ShamanEpicGloves               = new ItemTemplate();
                ShamanEpicGloves.Id_nb         = "ShamanEpicGloves";
                ShamanEpicGloves.Name          = "Subterranean Gloves";
                ShamanEpicGloves.Level         = 50;
                ShamanEpicGloves.Item_Type     = 22;
                ShamanEpicGloves.Model         = 769;
                ShamanEpicGloves.IsDropable    = true;
                ShamanEpicGloves.IsPickable    = true;
                ShamanEpicGloves.DPS_AF        = 100;
                ShamanEpicGloves.SPD_ABS       = 27;
                ShamanEpicGloves.Object_Type   = 35;
                ShamanEpicGloves.Quality       = 100;
                ShamanEpicGloves.Weight        = 22;
                ShamanEpicGloves.Bonus         = 35;
                ShamanEpicGloves.MaxCondition  = 50000;
                ShamanEpicGloves.MaxDurability = 50000;
                ShamanEpicGloves.Condition     = 50000;
                ShamanEpicGloves.Durability    = 50000;

                ShamanEpicGloves.Bonus1     = 4;
                ShamanEpicGloves.Bonus1Type = (int)eProperty.Skill_Subterranean;

                ShamanEpicGloves.Bonus2     = 18;
                ShamanEpicGloves.Bonus2Type = (int)eStat.PIE;

                ShamanEpicGloves.Bonus3     = 4;
                ShamanEpicGloves.Bonus3Type = (int)eResist.Crush;

                ShamanEpicGloves.Bonus4     = 6;
                ShamanEpicGloves.Bonus4Type = (int)eProperty.PowerRegenerationRate;

                if (SAVE_INTO_DATABASE)
                {
                    GameServer.Database.AddObject(ShamanEpicGloves);
                }
            }
            //Subterranean Hauberk
            ShamanEpicVest = GameServer.Database.FindObjectByKey <ItemTemplate>("ShamanEpicVest");
            if (ShamanEpicVest == null)
            {
                if (log.IsWarnEnabled)
                {
                    log.Warn("Could not find Shaman Epic Vest , creating it ...");
                }
                ShamanEpicVest               = new ItemTemplate();
                ShamanEpicVest.Id_nb         = "ShamanEpicVest";
                ShamanEpicVest.Name          = "Subterranean Hauberk";
                ShamanEpicVest.Level         = 50;
                ShamanEpicVest.Item_Type     = 25;
                ShamanEpicVest.Model         = 766;
                ShamanEpicVest.IsDropable    = true;
                ShamanEpicVest.IsPickable    = true;
                ShamanEpicVest.DPS_AF        = 100;
                ShamanEpicVest.SPD_ABS       = 27;
                ShamanEpicVest.Object_Type   = 35;
                ShamanEpicVest.Quality       = 100;
                ShamanEpicVest.Weight        = 22;
                ShamanEpicVest.Bonus         = 35;
                ShamanEpicVest.MaxCondition  = 50000;
                ShamanEpicVest.MaxDurability = 50000;
                ShamanEpicVest.Condition     = 50000;
                ShamanEpicVest.Durability    = 50000;

                ShamanEpicVest.Bonus1     = 16;
                ShamanEpicVest.Bonus1Type = (int)eStat.CON;

                ShamanEpicVest.Bonus2     = 16;
                ShamanEpicVest.Bonus2Type = (int)eStat.PIE;

                ShamanEpicVest.Bonus3     = 10;
                ShamanEpicVest.Bonus3Type = (int)eResist.Matter;

                ShamanEpicVest.Bonus4     = 8;
                ShamanEpicVest.Bonus4Type = (int)eResist.Heat;

                if (SAVE_INTO_DATABASE)
                {
                    GameServer.Database.AddObject(ShamanEpicVest);
                }
            }
            //Subterranean Legs
            ShamanEpicLegs = GameServer.Database.FindObjectByKey <ItemTemplate>("ShamanEpicLegs");
            if (ShamanEpicLegs == null)
            {
                if (log.IsWarnEnabled)
                {
                    log.Warn("Could not find Shaman Epic Legs , creating it ...");
                }
                ShamanEpicLegs               = new ItemTemplate();
                ShamanEpicLegs.Id_nb         = "ShamanEpicLegs";
                ShamanEpicLegs.Name          = "Subterranean Legs";
                ShamanEpicLegs.Level         = 50;
                ShamanEpicLegs.Item_Type     = 27;
                ShamanEpicLegs.Model         = 767;
                ShamanEpicLegs.IsDropable    = true;
                ShamanEpicLegs.IsPickable    = true;
                ShamanEpicLegs.DPS_AF        = 100;
                ShamanEpicLegs.SPD_ABS       = 27;
                ShamanEpicLegs.Object_Type   = 35;
                ShamanEpicLegs.Quality       = 100;
                ShamanEpicLegs.Weight        = 22;
                ShamanEpicLegs.Bonus         = 35;
                ShamanEpicLegs.MaxCondition  = 50000;
                ShamanEpicLegs.MaxDurability = 50000;
                ShamanEpicLegs.Condition     = 50000;
                ShamanEpicLegs.Durability    = 50000;

                ShamanEpicLegs.Bonus1     = 16;
                ShamanEpicLegs.Bonus1Type = (int)eStat.CON;

                ShamanEpicLegs.Bonus2     = 16;
                ShamanEpicLegs.Bonus2Type = (int)eStat.DEX;

                ShamanEpicLegs.Bonus3     = 8;
                ShamanEpicLegs.Bonus3Type = (int)eResist.Cold;

                ShamanEpicLegs.Bonus4     = 10;
                ShamanEpicLegs.Bonus4Type = (int)eResist.Spirit;

                if (SAVE_INTO_DATABASE)
                {
                    GameServer.Database.AddObject(ShamanEpicLegs);
                }
            }
            //Subterranean Sleeves
            ShamanEpicArms = GameServer.Database.FindObjectByKey <ItemTemplate>("ShamanEpicArms");
            if (ShamanEpicArms == null)
            {
                if (log.IsWarnEnabled)
                {
                    log.Warn("Could not find Shaman Epic Arms , creating it ...");
                }
                ShamanEpicArms               = new ItemTemplate();
                ShamanEpicArms.Id_nb         = "ShamanEpicArms";
                ShamanEpicArms.Name          = "Subterranean Sleeves";
                ShamanEpicArms.Level         = 50;
                ShamanEpicArms.Item_Type     = 28;
                ShamanEpicArms.Model         = 768;
                ShamanEpicArms.IsDropable    = true;
                ShamanEpicArms.IsPickable    = true;
                ShamanEpicArms.DPS_AF        = 100;
                ShamanEpicArms.SPD_ABS       = 27;
                ShamanEpicArms.Object_Type   = 35;
                ShamanEpicArms.Quality       = 100;
                ShamanEpicArms.Weight        = 22;
                ShamanEpicArms.Bonus         = 35;
                ShamanEpicArms.MaxCondition  = 50000;
                ShamanEpicArms.MaxDurability = 50000;
                ShamanEpicArms.Condition     = 50000;
                ShamanEpicArms.Durability    = 50000;

                ShamanEpicArms.Bonus1     = 4;
                ShamanEpicArms.Bonus1Type = (int)eProperty.Skill_Augmentation;

                ShamanEpicArms.Bonus2     = 12;
                ShamanEpicArms.Bonus2Type = (int)eStat.STR;

                ShamanEpicArms.Bonus3     = 18;
                ShamanEpicArms.Bonus3Type = (int)eStat.PIE;

                ShamanEpicArms.Bonus4     = 6;
                ShamanEpicArms.Bonus4Type = (int)eResist.Energy;


                if (SAVE_INTO_DATABASE)
                {
                    GameServer.Database.AddObject(ShamanEpicArms);
                }
            }
//Shaman Epic Sleeves End
//Item Descriptions End

            #endregion

            GameEventMgr.AddHandler(GamePlayerEvent.AcceptQuest, new DOLEventHandler(SubscribeQuest));
            GameEventMgr.AddHandler(GamePlayerEvent.DeclineQuest, new DOLEventHandler(SubscribeQuest));

            GameEventMgr.AddHandler(Inaksha, GameObjectEvent.Interact, new DOLEventHandler(TalkToInaksha));
            GameEventMgr.AddHandler(Inaksha, GameLivingEvent.WhisperReceive, new DOLEventHandler(TalkToInaksha));
            GameEventMgr.AddHandler(Miri, GameObjectEvent.Interact, new DOLEventHandler(TalkToMiri));
            GameEventMgr.AddHandler(Miri, GameLivingEvent.WhisperReceive, new DOLEventHandler(TalkToMiri));

            /* Now we bring to Inaksha the possibility to give this quest to players */
            Inaksha.AddQuestToGive(typeof(Seer_50));

            if (log.IsInfoEnabled)
            {
                log.Info("Quest \"" + questTitle + "\" initialized");
            }
        }