示例#1
0
 public int Level()
 {
     using (db.Database dbx = new db.Database())
     {
         int id = dbx.GetGuildId(this.Guild);
         return(dbx.GetGuildLevel(id));
     }
 }
示例#2
0
 public int Level()
 {
     using (db.Database dbx = new db.Database())
     {
         int id = dbx.GetGuildId(this.Guild);
         return dbx.GetGuildLevel(id);
     }
 }
示例#3
0
        public void HandleRequest(HttpListenerContext context) //struct: ignore             guid    password
                                                               //values: int                string  string
                                                               //        prollycurrentacc   email   passwordnocrypt
        {
            NameValueCollection query;

            using (StreamReader rdr = new StreamReader(context.Request.InputStream))
                query = HttpUtility.ParseQueryString(rdr.ReadToEnd());
            //down here goes the code to identify the guild by the account
            string guid = query["guid"];
            int    guildid;

            using (db.Database dbx = new db.Database())
            {
                var cmd = dbx.CreateQuery();
                cmd.CommandText = "SELECT guild FROM accounts WHERE uuid=@guid";
                cmd.Parameters.AddWithValue("@guid", guid);
                guildid = int.Parse(cmd.ExecuteScalar().ToString());
            }
            //down here goes the code to retrieve the board text by guild
            string[] lines;
            try
            {
                using (db.Database dbz = new db.Database())
                {
                    var cmd = dbz.CreateQuery();
                    cmd.CommandText = "SELECT board FROM guilds WHERE id=@id";
                    cmd.Parameters.AddWithValue("@id", guildid);
                    object scalar = cmd.ExecuteScalar();
                    lines = scalar.ToString().Split(new string[] { "\n", "\r\n" }, StringSplitOptions.None);
                }
            }
            catch
            {
                lines = new string[]
                {
                    "Couldn't retrieve guild board"
                };
            }
            string boardtext = null;

            foreach (var i in lines)
            {
                if (boardtext != null)
                {
                    boardtext = boardtext + i.ToString() + "\n\r";
                }
                else
                {
                    boardtext = i.ToString() + "\n\r";
                }
            }
            //down here goes the code to eventually check the formatting
            byte[] guildboardtext = Encoding.ASCII.GetBytes(boardtext);
            context.Response.OutputStream.Write(guildboardtext, 0, guildboardtext.Length);
        }
示例#4
0
 public void HandleRequest(HttpListenerContext context) //struct: ignore             guid    password
                                                        //values: int                string  string
                                                        //        prollycurrentacc   email   passwordnocrypt
 {
     NameValueCollection query;
     using (StreamReader rdr = new StreamReader(context.Request.InputStream))
         query = HttpUtility.ParseQueryString(rdr.ReadToEnd());
     //down here goes the code to identify the guild by the account
     string guid = query["guid"];
     int guildid;
     using (db.Database dbx = new db.Database())
     {
         var cmd = dbx.CreateQuery();
         cmd.CommandText = "SELECT guild FROM accounts WHERE uuid=@guid";
         cmd.Parameters.AddWithValue("@guid", guid);
         guildid = int.Parse(cmd.ExecuteScalar().ToString());
     }
     //down here goes the code to retrieve the board text by guild
     string[] lines;
     try
     {
         using (db.Database dbz = new db.Database())
         {
             var cmd = dbz.CreateQuery();
             cmd.CommandText = "SELECT board FROM guilds WHERE id=@id";
             cmd.Parameters.AddWithValue("@id", guildid);
             object scalar = cmd.ExecuteScalar();
             lines = scalar.ToString().Split(new string[] { "\n", "\r\n" }, StringSplitOptions.None);
         }
     }
     catch
     {
         lines = new string[]
         {
           "Couldn't retrieve guild board"  
         };
     }
     string boardtext = null;
     foreach (var i in lines)
     {
         if (boardtext != null)
         {
             boardtext = boardtext + i.ToString() + "\n\r";
         }
         else
         {
             boardtext = i.ToString() + "\n\r";
         }
     }
     //down here goes the code to eventually check the formatting
     byte[] guildboardtext = Encoding.ASCII.GetBytes(boardtext);
     context.Response.OutputStream.Write(guildboardtext, 0, guildboardtext.Length);
 }
示例#5
0
    {                                   //values: int       int     int                 string  string
                                        //        members   0       prollycurrentacc    email   passwordnocrypt
                                        //response:
                                        //<Guild name="STRING" id="INT">
                                        //<TotalFame>INT</TotalFame>
                                        //<CurrentFame>INT</Currentfame>
                                        //<HallType>Guild Hall INT</HallType>
                                        //<Member>
                                        //<Name>STRING</Name>
                                        //<Rank>INT</Rank>
                                        //<Fame>INT</Fame>
                                        //</Member>
                                        //</Guild>
        public void HandleRequest(HttpListenerContext context)
        {
            NameValueCollection query;

            using (StreamReader rdr = new StreamReader(context.Request.InputStream))
                query = HttpUtility.ParseQueryString(rdr.ReadToEnd());
            XDocument doc;
            XElement  guildd;

            using (db.Database dbx = new db.Database())
            {
                Account acc = dbx.Verify(query["guid"], query["password"]);
                guildd = new XElement("Guild", new XAttribute("name", acc.Guild.Name), new XAttribute("id", acc.Guild.Id));
                //get the hall level
                var cmd = dbx.CreateQuery();
                cmd.CommandText = "SELECT level FROM guilds WHERE id=@id";
                cmd.Parameters.AddWithValue("@id", acc.Guild.Id);
                guildd.Add(new XElement("HallType", "Guild Hall " + cmd.ExecuteScalar().ToString()));
                //get the current fame
                cmd             = dbx.CreateQuery();
                cmd.CommandText = "SELECT fame FROM guilds WHERE id=@id";
                cmd.Parameters.AddWithValue("@id", acc.Guild.Id);
                guildd.Add(new XElement("CurrentFame", cmd.ExecuteScalar().ToString()));
                //get the total fame
                cmd             = dbx.CreateQuery();
                cmd.CommandText = "SELECT totalFame FROM guilds WHERE id=@id";
                cmd.Parameters.AddWithValue("@id", acc.Guild.Id);
                guildd.Add(new XElement("TotalFame", cmd.ExecuteScalar().ToString()));
                //get the members list and data
                cmd             = dbx.CreateQuery();
                cmd.CommandText = "SELECT members FROM guilds WHERE id=@id";
                cmd.Parameters.AddWithValue("@id", acc.Guild.Id);
                string[] membersids = cmd.ExecuteScalar().ToString().Split(',');
                foreach (var memberid in membersids)
                {
                    var accc = dbx.GetAccount(int.Parse(memberid));
                    guildd.Add(new XElement("Member",
                                            new XElement("Name", accc.Name),
                                            new XElement("Rank", accc.Guild.Rank),
                                            new XElement("Fame", 0)));
                }
                doc = new XDocument(guildd);
            }
            byte[] bytes = Encoding.ASCII.GetBytes(doc.ToString());
            context.Response.OutputStream.Write(bytes, 0, bytes.Length);
            context.Response.Close();
        }
        public void doesLevel(string foodName)
        {
            using (var db = new db.Database())
            {
                var cooklevel = db.GetCookingLevel(Client.Account);
                var setXp     = caculateXp(cooklevel, foodName);

                var xpAmount = db.GetCookingXpLevel(Client.Account);

                db.UpdateXpLevel(Client.Account, setXp);
                SendInfo("Your current level is " + cooklevel);
                if (xpAmount >= 1.00M)
                {
                    db.resetXp(Client.Account);
                    CookingLevel = db.UpdateCookingLevel(Client.Account, 1);
                    UpdateCount++;
                    SendHelp("You have leveled up cooking!");
                }
            }
        }
示例#7
0
        public void HandleRequest(HttpListenerContext context)
        {
            NameValueCollection query;
            string board;

            using (StreamReader rdr = new StreamReader(context.Request.InputStream))
                query = HttpUtility.ParseQueryString(rdr.ReadToEnd());
            using (db.Database dbx = new db.Database())
            {
                var cmd = dbx.CreateQuery();
                cmd.CommandText = "UPDATE guilds SET board=@board WHERE id=@id";
                var acc = dbx.Verify(query["guid"], query["password"]);
                cmd.Parameters.AddWithValue("@id", acc.Guild.Id);
                board = HttpUtility.HtmlDecode(query["board"]);
                cmd.Parameters.AddWithValue("@board", board);
                cmd.ExecuteNonQuery();
            }
            board = null;
            using (db.Database dbz = new db.Database())
            {
                var cmd = dbz.CreateQuery();
                cmd.CommandText = "SELECT board FROM guilds WHERE id=@id";
                cmd.Parameters.AddWithValue("@id", dbz.Verify(query["guid"], query["password"]).Guild.Id);
                object   scalar = cmd.ExecuteScalar();
                string[] lines  = scalar.ToString().Split(new string[] { "\n", "\r\n" }, StringSplitOptions.None);
                foreach (var i in lines)
                {
                    if (board != null)
                    {
                        board = board + i.ToString() + "\n\r";
                    }
                    else
                    {
                        board = i.ToString() + "\n\r";
                    }
                }
            }
            //down here goes the code to eventually check the formatting
            byte[] guildboardtext = Encoding.ASCII.GetBytes(board);
            context.Response.OutputStream.Write(guildboardtext, 0, guildboardtext.Length);
        }
示例#8
0
 public void HandleRequest(HttpListenerContext context)
 {
     NameValueCollection query;
     string board;
     using (StreamReader rdr = new StreamReader(context.Request.InputStream))
         query = HttpUtility.ParseQueryString(rdr.ReadToEnd());
     using (db.Database dbx = new db.Database())
     {
         var cmd = dbx.CreateQuery();
         cmd.CommandText = "UPDATE guilds SET board=@board WHERE id=@id";
         var acc = dbx.Verify(query["guid"], query["password"]);
         cmd.Parameters.AddWithValue("@id", acc.Guild.Id);
         board = HttpUtility.HtmlDecode(query["board"]);
         cmd.Parameters.AddWithValue("@board", board);
         cmd.ExecuteNonQuery();
     }
     board = null;
     using (db.Database dbz = new db.Database())
     {
         var cmd = dbz.CreateQuery();
         cmd.CommandText = "SELECT board FROM guilds WHERE id=@id";
         cmd.Parameters.AddWithValue("@id", dbz.Verify(query["guid"], query["password"]).Guild.Id);
         object scalar = cmd.ExecuteScalar();
         string[] lines = scalar.ToString().Split(new string[] { "\n", "\r\n" }, StringSplitOptions.None);
         foreach (var i in lines)
         {
             if (board != null)
             {
                 board = board + i.ToString() + "\n\r";
             }
             else
             {
                 board = i.ToString() + "\n\r";
             }
         }
     }
     //down here goes the code to eventually check the formatting
     byte[] guildboardtext = Encoding.ASCII.GetBytes(board);
     context.Response.OutputStream.Write(guildboardtext, 0, guildboardtext.Length);
 }
示例#9
0
 public override void Buy(Player player)
 {
     using (db.Database dbx = new db.Database())
     {
         if (dbx.GetGuild(dbx.GetGuildId(player.Guild)).GuildFame >= this.Price)
         {
             dbx.DetractGuildFame(dbx.GetGuildId(player.Guild), this.Price);
             dbx.ChangeGuildLevel(dbx.GetGuildId(player.Guild), nextLevel);
             player.Client.SendPacket(new svrPackets.BuyResultPacket()
             {
                 Message = "Upgrade successful! Please leave the Guild Hall to have it upgraded",
                 Result = 0
             });
         }
         else
             player.Client.SendPacket(new wServer.svrPackets.BuyResultPacket()
             {
                 Message = "Not enough Guild Fame!",
                 Result = 9
             });
     }
 }
示例#10
0
        public void EditAccountList(RealmTime time, EditAccountListPacket pkt)
        {
            List<int> list;
            if (pkt.AccountListId == LOCKED_LIST_ID)
                list = Locked;
            else if (pkt.AccountListId == IGNORED_LIST_ID)
                list = Ignored;
            else return;
            if (list == null)
                list = new List<int>();
            Player player = Owner.GetEntity(pkt.ObjectId) as Player;
            if (player == null) return;
            int accId = player.psr.Account.AccountId;
            db.Database dbx = new db.Database();
            //if (pkt.Add && list.Count < 6)
            //    list.Add(accId);
            //else
            //    list.Remove(accId);

            if (pkt.Add)
            {
                list.Add(accId);
                if (pkt.AccountListId == LOCKED_LIST_ID)
                    dbx.AddLock(psr.Account.AccountId, accId);
                if (pkt.AccountListId == IGNORED_LIST_ID)
                    dbx.AddIgnore(psr.Account.AccountId, accId);
            }
            else
            {
                list.Remove(accId);
                if (pkt.AccountListId == LOCKED_LIST_ID)
                    dbx.RemoveLock(psr.Account.AccountId, accId);
                if (pkt.AccountListId == IGNORED_LIST_ID)
                    dbx.RemoveIgnore(psr.Account.AccountId, accId);
            }

            SendAccountList(list, pkt.AccountListId);
        }
示例#11
0
 public override void Buy(Player player)
 {
     using (db.Database dbx = new db.Database())
     {
         if (dbx.GetGuild(dbx.GetGuildId(player.Guild)).GuildFame >= this.Price)
         {
             dbx.DetractGuildFame(dbx.GetGuildId(player.Guild), this.Price);
             dbx.ChangeGuildLevel(dbx.GetGuildId(player.Guild), nextLevel);
             player.Client.SendPacket(new svrPackets.BuyResultPacket()
             {
                 Message = "Upgrade successful! Please leave the Guild Hall to have it upgraded",
                 Result  = 0
             });
         }
         else
         {
             player.Client.SendPacket(new wServer.svrPackets.BuyResultPacket()
             {
                 Message = "Not enough Guild Fame!",
                 Result  = 9
             });
         }
     }
 }
示例#12
0
 //values: int       int     int                 string  string
 //        members   0       prollycurrentacc    email   passwordnocrypt
 //response:
 //<Guild name="STRING" id="INT">
 //<TotalFame>INT</TotalFame>
 //<CurrentFame>INT</Currentfame>
 //<HallType>Guild Hall INT</HallType>
 //<Member>
 //<Name>STRING</Name>
 //<Rank>INT</Rank>
 //<Fame>INT</Fame>
 //</Member>
 //</Guild>
 public void HandleRequest(HttpListenerContext context)
 {
     NameValueCollection query;
     using (StreamReader rdr = new StreamReader(context.Request.InputStream))
         query = HttpUtility.ParseQueryString(rdr.ReadToEnd());
     XDocument doc;
     XElement guildd;
     using (db.Database dbx = new db.Database())
     {
         Account acc = dbx.Verify(query["guid"], query["password"]);
         guildd = new XElement("Guild", new XAttribute("name", acc.Guild.Name), new XAttribute("id", acc.Guild.Id));
         //get the hall level
         var cmd = dbx.CreateQuery();
         cmd.CommandText = "SELECT level FROM guilds WHERE id=@id";
         cmd.Parameters.AddWithValue("@id", acc.Guild.Id);
         guildd.Add(new XElement("HallType", "Guild Hall "+cmd.ExecuteScalar().ToString()));
         //get the current fame
         cmd = dbx.CreateQuery();
         cmd.CommandText = "SELECT fame FROM guilds WHERE id=@id";
         cmd.Parameters.AddWithValue("@id", acc.Guild.Id);
         guildd.Add(new XElement("CurrentFame", cmd.ExecuteScalar().ToString()));
         //get the total fame
         cmd = dbx.CreateQuery();
         cmd.CommandText = "SELECT totalFame FROM guilds WHERE id=@id";
         cmd.Parameters.AddWithValue("@id", acc.Guild.Id);
         guildd.Add(new XElement("TotalFame", cmd.ExecuteScalar().ToString()));
         //get the members list and data
         cmd = dbx.CreateQuery();
         cmd.CommandText = "SELECT members FROM guilds WHERE id=@id";
         cmd.Parameters.AddWithValue("@id", acc.Guild.Id);
         string[] membersids = cmd.ExecuteScalar().ToString().Split(',');
         foreach (var memberid in membersids)
         {
             var accc = dbx.GetAccount(int.Parse(memberid));
             guildd.Add(new XElement("Member",
                 new XElement("Name", accc.Name),
                 new XElement("Rank", accc.Guild.Rank),
                 new XElement("Fame", 0)));
         }
         doc = new XDocument(guildd);
     }
     byte[] bytes = Encoding.ASCII.GetBytes(doc.ToString());
     context.Response.OutputStream.Write(bytes, 0, bytes.Length);
 }
示例#13
0
        private bool Handle(Player player, RealmTime time, ObjectSlot Fuel, ObjectSlot Slot1, ObjectSlot Slot2,
                            ObjectSlot Slot3, ObjectSlot Slot4, ObjectSlot Slot5, ObjectSlot Slot6, ObjectSlot Slot7, ObjectSlot Slot8,
                            ObjectSlot Slot9)
        {
            //this stuff needs to be changed to XML format

            try
            {
                //bread
                if (Fuel.ObjectType == 21690)
                {
                    if (Slot4.ObjectType == 21691 && Slot5.ObjectType == 21691 && Slot6.ObjectType == 21691)
                    {
                        player.Inventory[Fuel.SlotId]  = player.Manager.GameData.Items[21692];
                        player.Inventory[Slot4.SlotId] = null;
                        player.Inventory[Slot5.SlotId] = null;
                        player.Inventory[Slot6.SlotId] = null;
                        player.UpdateCount++;
                        Client.SendPacket(new CookResultPacket
                        {
                            Success = true,
                            Message = "You have successfully cooked bread!"
                        });
                        levelCooking("Bread");
                        return(false);
                    }
                    //sliceofpizza
                    if (Slot1.ObjectType == 21692 && Slot4.ObjectType == 21694 && Slot7.ObjectType == 21693)
                    {
                        player.Inventory[Fuel.SlotId]  = player.Manager.GameData.Items[0x54bf];
                        player.Inventory[Slot1.SlotId] = null;
                        player.Inventory[Slot4.SlotId] = null;
                        player.Inventory[Slot7.SlotId] = null;
                        player.UpdateCount++;
                        Client.SendPacket(new CookResultPacket
                        {
                            Success = true,
                            Message = "You have successfully cooked a slice of pizza!"
                        });
                        levelCooking("Slice of Pizza");
                        return(false);
                    }
                    //full pizza
                    if (Slot1.ObjectType == 0x54bf && Slot2.ObjectType == 0x54bf && Slot4.ObjectType == 0x54bf &&
                        Slot5.ObjectType == 0x54bf)
                    {
                        player.Inventory[Fuel.SlotId]  = player.Manager.GameData.Items[0x54c1];
                        player.Inventory[Slot1.SlotId] = null;
                        player.Inventory[Slot2.SlotId] = null;
                        player.Inventory[Slot4.SlotId] = null;
                        player.Inventory[Slot5.SlotId] = null;
                        player.UpdateCount++;
                        Client.SendPacket(new CookResultPacket
                        {
                            Success = true,
                            Message = "You have successfully cooked a full pizza!"
                        });
                        levelCooking("Full Pizza");
                        return(false);
                    }
                    //bowl of soup
                    if (Slot1.ObjectType == 0x54ce && Slot4.ObjectType == 0x54cd)
                    {
                        player.Inventory[Fuel.SlotId]  = player.Manager.GameData.Items[0x54d4];
                        player.Inventory[Slot1.SlotId] = null;
                        player.Inventory[Slot4.SlotId] = null;
                        player.UpdateCount++;
                        Client.SendPacket(new CookResultPacket
                        {
                            Success = true,
                            Message = "You have successfully cooked a bowl of soup!"
                        });
                        levelCooking("Bowl of Soup");
                        return(false);
                    }
                    //grilled cheese sandwich
                    if (Slot1.ObjectType == 21692 && Slot4.ObjectType == 21694 && Slot7.ObjectType == 21692)
                    {
                        player.Inventory[Fuel.SlotId]  = player.Manager.GameData.Items[0x54cc];
                        player.Inventory[Slot1.SlotId] = null;
                        player.Inventory[Slot4.SlotId] = null;
                        player.Inventory[Slot7.SlotId] = null;
                        player.UpdateCount++;
                        Client.SendPacket(new CookResultPacket
                        {
                            Success = true,
                            Message = "You have successfully cooked a Grilled Cheese Sandwich!"
                        });
                        levelCooking("Grilled Cheese Sandwich");
                        return(false);
                    }
                    //chocolate cake
                    if (Slot1.ObjectType == 0x54c8 && Slot4.ObjectType == 0x54c9 && Slot7.ObjectType == 0x54ca)
                    {
                        player.Inventory[Fuel.SlotId]  = player.Manager.GameData.Items[0x54d2];
                        player.Inventory[Slot1.SlotId] = null;
                        player.Inventory[Slot4.SlotId] = null;
                        player.Inventory[Slot7.SlotId] = null;
                        player.UpdateCount++;
                        Client.SendPacket(new CookResultPacket
                        {
                            Success = true,
                            Message = "You have successfully baked a chocolate cake!"
                        });
                        levelCooking("Chocolate Cake");
                        return(false);
                    }
                    //
                    //spicy pizza
                    if (Slot1.ObjectType == 0x54bf && Slot4.ObjectType == 0x54d1)
                    {
                        player.Inventory[Fuel.SlotId]  = player.Manager.GameData.Items[0x54cf];
                        player.Inventory[Slot1.SlotId] = null;
                        player.Inventory[Slot4.SlotId] = null;
                        player.UpdateCount++;
                        Client.SendPacket(new CookResultPacket
                        {
                            Success = true,
                            Message = "You have successfully cooked a spicy slice of pizza!"
                        });
                        levelCooking("Spicy Slice of Pizza");
                        return(false);
                    }
                    //KARAMBWAN
                    if (Slot1.ObjectType == 0x54c5 && Slot4.ObjectType == 0x54c5 && Slot7.ObjectType == 0x54c5 &&
                        Slot5.ObjectType == 0x54c5 && Slot6.ObjectType == 0x54c5)
                    {
                        player.Inventory[Fuel.SlotId]  = player.Manager.GameData.Items[0x54c6];
                        player.Inventory[Slot1.SlotId] = null;
                        player.Inventory[Slot4.SlotId] = null;
                        player.Inventory[Slot7.SlotId] = null;
                        player.Inventory[Slot5.SlotId] = null;
                        player.Inventory[Slot6.SlotId] = null;
                        player.UpdateCount++;
                        Client.SendPacket(new CookResultPacket
                        {
                            Success = true,
                            Message = "You have successfully cooked a karambwan"
                        });
                        levelCooking("Karambwan");
                        return(false);
                    }
                    //spicy karambwan
                    if (Slot1.ObjectType == 0x54c6 && Slot4.ObjectType == 0x54d1)
                    {
                        player.Inventory[Fuel.SlotId]  = player.Manager.GameData.Items[0x54c7];
                        player.Inventory[Slot1.SlotId] = null;
                        player.Inventory[Slot4.SlotId] = null;
                        player.UpdateCount++;
                        Client.SendPacket(new CookResultPacket
                        {
                            Success = true,
                            Message = "You have successfully cooked a spicy karambwan"
                        });
                        levelCooking("Spicy Karambwan");
                        return(false);
                    }
                    //cookie
                    if (Slot1.ObjectType == 0x54c8 && Slot4.ObjectType == 0x54c8)
                    {
                        player.Inventory[Fuel.SlotId]  = player.Manager.GameData.Items[0x54cb];
                        player.Inventory[Slot1.SlotId] = null;
                        player.Inventory[Slot4.SlotId] = null;
                        player.UpdateCount++;
                        Client.SendPacket(new CookResultPacket
                        {
                            Success = true,
                            Message = "You have successfully baked a cookie"
                        });
                        levelCooking("Cookie");
                        return(false);
                    }
                    //spicy soup
                    if (Slot1.ObjectType == 0x54d4 && Slot4.ObjectType == 0x54d1)
                    {
                        player.Inventory[Fuel.SlotId]  = player.Manager.GameData.Items[0x54de];
                        player.Inventory[Slot1.SlotId] = null;
                        player.Inventory[Slot4.SlotId] = null;
                        player.UpdateCount++;
                        Client.SendPacket(new CookResultPacket
                        {
                            Success = true,
                            Message = "You have successfully cooked a Spicy Soup"
                        });
                        levelCooking("Spicy Soup");
                        return(false);
                    }
                    //salad
                    if (Slot1.ObjectType == 0x54ce && Slot4.ObjectType == 0x54d6 && Slot7.ObjectType == 0x54d5)
                    {
                        player.Inventory[Fuel.SlotId]  = player.Manager.GameData.Items[0x54da];
                        player.Inventory[Slot1.SlotId] = null;
                        player.Inventory[Slot4.SlotId] = null;
                        player.Inventory[Slot7.SlotId] = null;
                        player.UpdateCount++;
                        Client.SendPacket(new CookResultPacket
                        {
                            Success = true,
                            Message = "You have successfully made a Salad"
                        });
                        levelCooking("Salad");
                        return(false);
                    }
                    //super full pizza
                    if (Slot1.ObjectType == 0x54c1 && Slot4.ObjectType == 0x54d6)
                    {
                        player.Inventory[Fuel.SlotId]  = player.Manager.GameData.Items[0x54df];
                        player.Inventory[Slot1.SlotId] = null;
                        player.Inventory[Slot4.SlotId] = null;
                        player.UpdateCount++;
                        Client.SendPacket(new CookResultPacket
                        {
                            Success = true,
                            Message = "You have successfully cooked a Super Full Pizza"
                        });
                        levelCooking("Super Full Pizza");
                        return(false);
                    }
                    //cooked fish
                    if (Slot4.ObjectType == 0x54f7)
                    {
                        player.Inventory[Fuel.SlotId]  = player.Manager.GameData.Items[0x54f8];
                        player.Inventory[Slot4.SlotId] = null;
                        player.UpdateCount++;
                        Client.SendPacket(new CookResultPacket
                        {
                            Success = true,
                            Message = "You have successfully made a Cooked Fish"
                        });
                        levelCooking("Cooked Fish");
                        return(false);
                    }
                    //cooked chicken
                    if (Slot4.ObjectType == 0x55a1)
                    {
                        player.Inventory[Fuel.SlotId]  = player.Manager.GameData.Items[0x55a2];
                        player.Inventory[Slot4.SlotId] = null;
                        player.UpdateCount++;
                        Client.SendPacket(new CookResultPacket
                        {
                            Success = true,
                            Message = "You have successfully made a Cooked Chicken"
                        });
                        levelCooking("Cooked Chicken");
                        return(false);
                    }
                    //spicy cooked fish
                    if (Slot1.ObjectType == 0x54f8 && Slot4.ObjectType == 0x54d1)
                    {
                        player.Inventory[Fuel.SlotId]  = player.Manager.GameData.Items[0x54f9];
                        player.Inventory[Slot1.SlotId] = null;
                        player.Inventory[Slot4.SlotId] = null;
                        player.UpdateCount++;
                        Client.SendPacket(new CookResultPacket
                        {
                            Success = true,
                            Message = "You have successfully cooked a Spicy Cooked Fish"
                        });
                        levelCooking("Spicy Cooked Fish");
                        return(false);
                    }
                    //chicken burger
                    if (Slot1.ObjectType == 0x54bc && Slot4.ObjectType == 0x55a2 && Slot7.ObjectType == 0x54bc)
                    {
                        player.Inventory[Fuel.SlotId]  = player.Manager.GameData.Items[0x55a9];
                        player.Inventory[Slot1.SlotId] = null;
                        player.Inventory[Slot4.SlotId] = null;
                        player.Inventory[Slot7.SlotId] = null;
                        player.UpdateCount++;
                        Client.SendPacket(new CookResultPacket
                        {
                            Success = true,
                            Message = "You have successfully cooked a Chicken Burger"
                        });
                        levelCooking("Chicken Burger");
                        return(false);
                    }
                    //middle of burger
                    if (Slot1.ObjectType == 0x54d6 && Slot4.ObjectType == 0x54bd && Slot7.ObjectType == 0x54d5)
                    {
                        player.Inventory[Fuel.SlotId]  = player.Manager.GameData.Items[0x54f4];
                        player.Inventory[Slot1.SlotId] = null;
                        player.Inventory[Slot4.SlotId] = null;
                        player.Inventory[Slot7.SlotId] = null;
                        player.UpdateCount++;
                        Client.SendPacket(new CookResultPacket
                        {
                            Success = true,
                            Message = "You have successfully cooked the Middle of Burger"
                        });
                        levelCooking("Middle of Burger");
                        return(false);
                    }
                    //slappyburger
                    if (Slot1.ObjectType == 0x54bc && Slot4.ObjectType == 0x54f4 && Slot7.ObjectType == 0x54bc)
                    {
                        player.Inventory[Fuel.SlotId]  = player.Manager.GameData.Items[0x54d7];
                        player.Inventory[Slot1.SlotId] = null;
                        player.Inventory[Slot4.SlotId] = null;
                        player.Inventory[Slot7.SlotId] = null;
                        player.UpdateCount++;
                        Client.SendPacket(new CookResultPacket
                        {
                            Success = true,
                            Message = "You have successfully cooked a Slappy Burger"
                        });
                        levelCooking("Slappy Burger");
                        return(false);
                    }
                    //coconutmilk
                    if (Slot1.ObjectType == 0x54fa && Slot4.ObjectType == 0x55a3)
                    {
                        player.Inventory[Fuel.SlotId]  = player.Manager.GameData.Items[0x55a4];
                        player.Inventory[Slot1.SlotId] = null;
                        player.Inventory[Slot4.SlotId] = null;
                        player.UpdateCount++;
                        Client.SendPacket(new CookResultPacket
                        {
                            Success = true,
                            Message = "You have successfully cooked a Coconut Milk"
                        });
                        levelCooking("Coconut Milk");
                        return(false);
                    }
                    //ricebowl
                    if (Slot1.ObjectType == 0x54ce && Slot4.ObjectType == 0x55a5)
                    {
                        player.Inventory[Fuel.SlotId]  = player.Manager.GameData.Items[0x55a6];
                        player.Inventory[Slot1.SlotId] = null;
                        player.Inventory[Slot4.SlotId] = null;
                        player.UpdateCount++;
                        Client.SendPacket(new CookResultPacket
                        {
                            Success = true,
                            Message = "You have successfully cooked a Rice Bowl"
                        });
                        levelCooking("Rice Bowl");
                        return(false);
                    }
                    //sweetricebowl
                    if (Slot1.ObjectType == 0x55a6 && Slot4.ObjectType == 0x55a7)
                    {
                        player.Inventory[Fuel.SlotId]  = player.Manager.GameData.Items[0x55a8];
                        player.Inventory[Slot1.SlotId] = null;
                        player.Inventory[Slot4.SlotId] = null;
                        player.UpdateCount++;
                        Client.SendPacket(new CookResultPacket
                        {
                            Success = true,
                            Message = "You have successfully cooked a Sweet Rice Bowl"
                        });
                        levelCooking("Sweet Rice Bowl");
                        return(false);
                    }
                    //dragonspicykarambwan
                    if (Slot1.ObjectType == 0x54c7 && Slot4.ObjectType == 0x44d5)
                    {
                        using (var db = new db.Database())
                        {
                            var cooklevel = db.GetCookingLevel(Client.Account);
                            if (cooklevel >= 10)
                            {
                                player.Inventory[Fuel.SlotId]  = player.Manager.GameData.Items[0x55ab];
                                player.Inventory[Slot1.SlotId] = null;
                                player.Inventory[Slot4.SlotId] = null;
                                player.UpdateCount++;
                                Client.SendPacket(new CookResultPacket
                                {
                                    Success = true,
                                    Message = "You have successfully cooked a Drago Spicy Karambwan"
                                });

                                levelCooking("Drago Spicy Karambwan");
                                return(false);
                            }
                            else
                            {
                                player.SendError("Your cooking level must be at least 10!");

                                return(false);
                            }
                        }
                    }
                    //goldenchocolatebar
                    if (Slot1.ObjectType == 0x54f6 && Slot4.ObjectType == 0x53b9)
                    {
                        using (var db = new db.Database())
                        {
                            var cooklevel = db.GetCookingLevel(Client.Account);
                            if (cooklevel >= 15)
                            {
                                player.Inventory[Fuel.SlotId]  = player.Manager.GameData.Items[0x55b1];
                                player.Inventory[Slot1.SlotId] = null;
                                player.Inventory[Slot4.SlotId] = null;
                                player.UpdateCount++;
                                Client.SendPacket(new CookResultPacket
                                {
                                    Success = true,
                                    Message = "You have successfully cooked a Golden Chocolate Bar"
                                });

                                levelCooking("Golden Chocolate Bar");
                                return(false);
                            }
                            else
                            {
                                player.SendError("Your cooking level must be at least 15!");

                                return(false);
                            }
                        }
                    }
                    //strangefullpizza
                    if (Slot1.ObjectType == 0x54df && Slot4.ObjectType == 0x49a5)
                    {
                        using (var db = new db.Database())
                        {
                            var cooklevel = db.GetCookingLevel(Client.Account);
                            if (cooklevel >= 30)
                            {
                                player.Inventory[Fuel.SlotId]  = player.Manager.GameData.Items[0x55b2];
                                player.Inventory[Slot1.SlotId] = null;
                                player.Inventory[Slot4.SlotId] = null;
                                player.UpdateCount++;
                                Client.SendPacket(new CookResultPacket
                                {
                                    Success = true,
                                    Message = "You have successfully cooked a Strange Full Pizza"
                                });

                                levelCooking("Strange Full Pizza");
                                return(false);
                            }
                            else
                            {
                                player.SendError("Your cooking level must be at least 30!");

                                return(false);
                            }
                        }
                    }
                    //ghostpepper
                    if (Slot1.ObjectType == 0x54d1 && Slot4.ObjectType == 0x55ac)
                    {
                        using (var db = new db.Database())
                        {
                            var cooklevel = db.GetCookingLevel(Client.Account);
                            if (cooklevel >= 65)
                            {
                                player.Inventory[Fuel.SlotId]  = player.Manager.GameData.Items[0x55b7];
                                player.Inventory[Slot1.SlotId] = null;
                                player.Inventory[Slot4.SlotId] = null;
                                player.UpdateCount++;
                                Client.SendPacket(new CookResultPacket
                                {
                                    Success = true,
                                    Message = "You have successfully cooked a Ghost Pepper"
                                });

                                levelCooking("Ghost Pepper");
                                return(false);
                            }
                            else
                            {
                                player.SendError("Your cooking level must be at least 65!");

                                return(false);
                            }
                        }
                    }
                    //ghostburger
                    if (Slot1.ObjectType == 0x54d7 && Slot4.ObjectType == 0x55ac)
                    {
                        using (var db = new db.Database())
                        {
                            var cooklevel = db.GetCookingLevel(Client.Account);
                            if (cooklevel >= 20)
                            {
                                player.Inventory[Fuel.SlotId]  = player.Manager.GameData.Items[0x55ad];
                                player.Inventory[Slot1.SlotId] = null;
                                player.Inventory[Slot4.SlotId] = null;
                                player.UpdateCount++;
                                Client.SendPacket(new CookResultPacket
                                {
                                    Success = true,
                                    Message = "You have successfully cooked a Ghost Burger"
                                });

                                levelCooking("Ghost Burger");
                                return(false);
                            }
                            else
                            {
                                player.SendError("Your cooking level must be at least 20!");

                                return(false);
                            }
                        }
                    }
                    else
                    {
                        player.SendError("No recipe found!");
                        return(false);
                    }
                }
                else
                {
                    player.SendError("You need to add Fuel to the furnace!");
                    return(false);
                }
            }
            catch (Exception e)
            {
                player.SendError("You need to add Fuel!");
                Console.WriteLine("{0} Exception caught.", e);
                return(false);
            }
        }
示例#14
0
        public void EditAccountList(RealmTime time, EditAccountListPacket pkt)
        {
            List <int> list;

            if (pkt.AccountListId == LOCKED_LIST_ID)
            {
                list = Locked;
            }
            else if (pkt.AccountListId == IGNORED_LIST_ID)
            {
                list = Ignored;
            }
            else
            {
                return;
            }
            if (list == null)
            {
                list = new List <int>();
            }
            Player player = Owner.GetEntity(pkt.ObjectId) as Player;

            if (player == null)
            {
                return;
            }
            int accId = player.psr.Account.AccountId;

            db.Database dbx = new db.Database();
            //if (pkt.Add && list.Count < 6)
            //    list.Add(accId);
            //else
            //    list.Remove(accId);

            if (pkt.Add)
            {
                list.Add(accId);
                if (pkt.AccountListId == LOCKED_LIST_ID)
                {
                    dbx.AddLock(psr.Account.AccountId, accId);
                }
                if (pkt.AccountListId == IGNORED_LIST_ID)
                {
                    dbx.AddIgnore(psr.Account.AccountId, accId);
                }
            }
            else
            {
                list.Remove(accId);
                if (pkt.AccountListId == LOCKED_LIST_ID)
                {
                    dbx.RemoveLock(psr.Account.AccountId, accId);
                }
                if (pkt.AccountListId == IGNORED_LIST_ID)
                {
                    dbx.RemoveIgnore(psr.Account.AccountId, accId);
                }
            }

            SendAccountList(list, pkt.AccountListId);
        }