Register for your free account! | Forgot your password?

You last visited: Today at 21:17

  • Please register to post and access all features, it's quick, easy and FREE!


[Release] Warehouse Password Setup

Closed Thread
 
Old   #1
 
elite*gold: 20
Join Date: Apr 2008
Posts: 2,281
Received Thanks: 908
[Release] Warehouse Password Setup

This is everything you need to Code Warehouse Passwords in LOTF source.

Why Release it?
- It is fairly easy to figure out, and if you have decent knowledge of C# and of the source you use, then you can figure it out.
- Also, I believe that open source coding for servers is a lot more efficient, and produces better/more advanced results.

What does a Warehouse Password do?
- This makes it so when you go to your warehouse for the first time after you login, you have to put in a password to open it and view your warehouse possessions.

What will I need?
- Brain w/ common sense
- LOTF source [Link: ]



How to Code Warehouse Passwords

Database:

- To access the database:

- You need to create 2 new Tables in Characters:
WHPW


Definition of these tables:
WHPW: The password to your Warehouse.

Source:

Define our variables, etc
In Character.cs:
Code:
        public string WHPW = "";
In Client.cs:
Code:
        public byte WHOpen = 0;
- In Client.cs, search for if (CurrentNPC == 8), replace what is inside the brackets with:
Code:
                                if (WHOpen == 1)
                                {
                                    SendPacket(General.MyPackets.ETCPacket(MyChar, 4));
                                }
                                else
                                {
                                    if (MyChar.WHPW == "")
                                    {
                                        SendPacket(General.MyPackets.ETCPacket(MyChar, 4));
                                    }
                                    else
                                    {
                                        SendPacket(General.MyPackets.NPCSay("You have created a password for your warehouse. Please input the password to open it."));
                                        SendPacket(General.MyPackets.NPCLink2("Password.", 1));
                                        SendPacket(General.MyPackets.NPCLink("Let me see.", 255));
                                        SendPacket(General.MyPackets.NPCSetFace(30));
                                        SendPacket(General.MyPackets.NPCFinish());
                                    }
                                }
Do the same for 81 through 85.

- Now, under case 2032:, add this:
Code:
                            if (CurrentNPC == 8)
                            {
                                if (Control == 1)
                                {
                                    string WHPW1 = "";
                                    bool ValidPW1 = false;
                                    for (int i = 14; i < 14 + Data[13]; i++)
                                    {
                                        WHPW1 += Convert.ToChar(Data[i]);
                                    }

                                    if (WHPW1 == MyChar.WHPW)
                                    {
                                        ValidPW1 = true;
                                    }
                                    try
                                    {
                                        if (ValidPW1)
                                        {
                                            SendPacket(General.MyPackets.ETCPacket(MyChar, 4));
                                            WHOpen = 1;
                                        }
                                        else
                                        {
                                            SendPacket(General.MyPackets.NPCSay("Wrong Password. Try again."));
                                            SendPacket(General.MyPackets.NPCLink("Ok.", 0));
                                            SendPacket(General.MyPackets.NPCLink("Let me see.", 255));
                                            SendPacket(General.MyPackets.NPCSetFace(30));
                                            SendPacket(General.MyPackets.NPCFinish());
                                        }
                                    }
                                    catch (Exception Exc) { General.WriteLine(Exc.ToString()); }

                                    break;
                                }
                            }
Do the same for 81 through 85.

- Now we have the Warehousemen setup so that they see if you have a password. We now need the NPC to set the warehouse password.

In Client.cs:
Code:
                            if (CurrentNPC == 9543)
                            {
                                if (MyChar.WHPW == "")
                                {
                                    SendPacket(General.MyPackets.NPCSay("Thieves are only one step behind security. Even those who hoard their treasures"));
                                    SendPacket(General.MyPackets.NPCSay(" in their warehouse are at risk. So, I offer you the opportunity to set a special"));
                                    SendPacket(General.MyPackets.NPCSay(" password for your warehouse. What do you say?"));
                                    SendPacket(General.MyPackets.NPCLink("I want to set a password.", 1));
                                    SendPacket(General.MyPackets.NPCLink("Let me see.", 255));
                                    SendPacket(General.MyPackets.NPCSetFace(30));
                                    SendPacket(General.MyPackets.NPCFinish());
                                }
                                else
                                {
                                    SendPacket(General.MyPackets.NPCSay("You have created a password for your warehouse successfully. Do you want to change or delete the password?"));
                                    SendPacket(General.MyPackets.NPCLink("I wanna change it.", 4));
                                    SendPacket(General.MyPackets.NPCLink("Let me see.", 255));
                                    SendPacket(General.MyPackets.NPCSetFace(30));
                                    SendPacket(General.MyPackets.NPCFinish());
                                }
                            }
And:
Code:
                            if (CurrentNPC == 9543)
                            {
                                if (Control == 1)
                                {
                                    SendPacket(General.MyPackets.NPCSay("Passwords can be up to nine digits long, the first of which cannot be zero."));
                                    SendPacket(General.MyPackets.NPCSay(" Enter numbers only. If you make a mistake your warehouse will be locked."));
                                    SendPacket(General.MyPackets.NPCSay(" Please check carefully before you enter the password."));
                                    SendPacket(General.MyPackets.NPCLink2("Password.", 2));
                                    SendPacket(General.MyPackets.NPCLink("Let me think.", 255));
                                    SendPacket(General.MyPackets.NPCSetFace(30));
                                    SendPacket(General.MyPackets.NPCFinish());
                                }
                                if (Control == 2)
                                {
                                    string WHPW = "";
                                    bool ValidPW = true;
                                    for (int i = 14; i < 14 + Data[13]; i++)
                                    {
                                        WHPW += Convert.ToChar(Data[i]);
                                    }
                                    if (WHPW.IndexOfAny(new char[27] { ' ', 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z' }) > -1)
                                    {
                                        ValidPW = false;
                                    }

                                    try
                                    {
                                        if (ValidPW)
                                        {
                                            MyChar.WHPW = WHPW;
                                            SendPacket(General.MyPackets.SendMsg(MessageId, "SYSTEM", MyChar.Name, "Warehouse password set to " + MyChar.WHPW, 2005));
                                            MyChar.SaveWHPW();
                                        }
                                        else
                                        {
                                            SendPacket(General.MyPackets.NPCSay("That name is not valid!"));
                                            SendPacket(General.MyPackets.NPCLink("Try Again.", 1));
                                            SendPacket(General.MyPackets.NPCLink("I see.", 255));
                                            SendPacket(General.MyPackets.NPCSetFace(30));
                                            SendPacket(General.MyPackets.NPCFinish());
                                        }
                                    }
                                    catch (Exception Exc) { General.WriteLine(Exc.ToString()); }

                                    break;
                                }
                                if (Control == 4)
                                {
                                    SendPacket(General.MyPackets.NPCSay("Please enter your old password in order to change it."));
                                    SendPacket(General.MyPackets.NPCLink2("Password.", 5));
                                    SendPacket(General.MyPackets.NPCLink("Let me think.", 255));
                                    SendPacket(General.MyPackets.NPCSetFace(30));
                                    SendPacket(General.MyPackets.NPCFinish());
                                }
                                if (Control == 5)
                                {
                                    string WHPW2 = "";
                                    bool ValidPW2 = false;
                                    for (int i = 14; i < 14 + Data[13]; i++)
                                    {
                                        WHPW2 += Convert.ToChar(Data[i]);
                                    }
                                    if (WHPW2 == MyChar.WHPW)
                                    {
                                        ValidPW2 = true;
                                    }

                                    try
                                    {
                                        if (ValidPW2)
                                        {
                                            SendPacket(General.MyPackets.NPCSay("Do you want to change the password, or delete it?"));
                                            SendPacket(General.MyPackets.NPCLink("Change it.", 6));
                                            SendPacket(General.MyPackets.NPCLink("Delete it.", 7));
                                            SendPacket(General.MyPackets.NPCSetFace(30));
                                            SendPacket(General.MyPackets.NPCFinish());
                                        }
                                        else
                                        {
                                            SendPacket(General.MyPackets.NPCSay("Wrong Password, Please enter again."));
                                            SendPacket(General.MyPackets.NPCLink("Okay.", 4));
                                            SendPacket(General.MyPackets.NPCLink("I see.", 255));
                                            SendPacket(General.MyPackets.NPCSetFace(30));
                                            SendPacket(General.MyPackets.NPCFinish());
                                        }
                                    }
                                    catch (Exception Exc) { General.WriteLine(Exc.ToString()); }

                                    break;
                                }
                                if (Control == 6)
                                {
                                    WHOpen = 0;
                                    SendPacket(General.MyPackets.NPCSay("Passwords can be up to nine digits long, the first of which cannot be zero."));
                                    SendPacket(General.MyPackets.NPCSay(" Enter numbers only. If you make a mistake your warehouse will be locked."));
                                    SendPacket(General.MyPackets.NPCSay(" Please check carefully before you enter the password."));
                                    SendPacket(General.MyPackets.NPCLink2("Password.", 2));
                                    SendPacket(General.MyPackets.NPCLink("Let me think.", 255));
                                    SendPacket(General.MyPackets.NPCSetFace(30));
                                    SendPacket(General.MyPackets.NPCFinish());
                                }
                                if (Control == 7)
                                {
                                    MyChar.WHPW = "";
                                    WHOpen = 0;
                                    SendPacket(General.MyPackets.NPCSay("Password deleted."));
                                    SendPacket(General.MyPackets.NPCLink("Thanks.", 255));
                                    SendPacket(General.MyPackets.NPCSetFace(30));
                                    SendPacket(General.MyPackets.NPCFinish());
                                }
                            }
- Now we can set the Warehouse Password! We need to save it now:

In Character.cs, search for public void SaveKO(), above that add:
Code:
        public void SaveWHPW()
        {
            if (MyClient.There)
                if (MyClient.Online)
                    DataBase.SaveWHPW(this);
        }
Now in Database.cs search for public static void SaveChar(Character Charr), above that add:
Code:
        public static void SaveWHPW(Character Charr)
        {
            try
            {
                MySqlCommand Command = new MySqlCommand("UPDATE `Characters` SET `WHPW` = '" + Charr.WHPW + "' WHERE `Account` = '" + Charr.MyClient.Account + "'", Connection);
                Command.ExecuteNonQuery();

            }
            catch (Exception Exc) { General.WriteLine(Convert.ToString(Exc)); }
        }
Then search for DataRow DR = DSet.Tables["Character"].Rows[0];, under that add:
Code:
                    Charr.WHPW = (string)DR["WHPW"];
- Now we have it so it saves!

I think thats everything! Enjoy your new Warehouse Password Script!


Press Thanks if this helped!



EDIT: Updated/Fixed

Thanks to Haydz for pointing out a very simple, yet effective way to make this script better



kinshi88 is offline  
Thanks
23 Users
Old 08/13/2008, 01:56   #2
 
elite*gold: 20
Join Date: Apr 2008
Posts: 2,281
Received Thanks: 908
Bump..
Common guys, this is useful =P


kinshi88 is offline  
Thanks
3 Users
Old 08/13/2008, 04:32   #3
 
elite*gold: 0
Join Date: Mar 2006
Posts: 105
Received Thanks: 18
great job, thank you
HunterKiller is offline  
Old 08/13/2008, 08:09   #4
 
elite*gold: 0
Join Date: Jun 2007
Posts: 387
Received Thanks: 64
nice coding, and very easy to follow, thanks kinshi


taguro is offline  
Old 08/13/2008, 08:16   #5
 
elite*gold: 20
Join Date: Apr 2008
Posts: 2,281
Received Thanks: 908
Quote:
Originally Posted by HunterKiller View Post
great job, thank you
Thanks, and NP

Quote:
Originally Posted by taguro View Post
nice coding, and very easy to follow, thanks kinshi
Thanks. Anytime
kinshi88 is offline  
Old 08/13/2008, 13:42   #6
 
elite*gold: 0
Join Date: Sep 2007
Posts: 42
Received Thanks: 1
ty i was need this
Danutzhaha is offline  
Old 08/13/2008, 14:02   #7
 
elite*gold: 20
Join Date: Apr 2008
Posts: 2,281
Received Thanks: 908
Your welcome
kinshi88 is offline  
Old 08/16/2008, 04:03   #8
 
elite*gold: 0
Join Date: Feb 2008
Posts: 240
Received Thanks: 10
DataRow DR = DSet.Tables["Character"].Rows[0]; okay for everything u code and post with that every one getz an error wtf how do u fix it
Bottingpunk is offline  
Old 08/16/2008, 07:42   #9
 
elite*gold: 20
Join Date: Apr 2008
Posts: 2,281
Received Thanks: 908
Use a different source, gosh.
kinshi88 is offline  
Thanks
2 Users
Old 08/21/2008, 20:47   #10
 
elite*gold: 0
Join Date: Dec 2007
Posts: 618
Received Thanks: 213
kinshi88 u forgot to add something at createchar in Database.cs
without that add u cannot create a new char
alexbigfoot is offline  
Old 08/21/2008, 21:13   #11
 
elite*gold: 20
Join Date: Jan 2008
Posts: 1,042
Received Thanks: 251
lol... why use whpwcheck?... its just adding unnecessary things... why not just do .. if (WHPW != "") ...
 Haydz is offline  
Old 08/21/2008, 23:23   #12
 
elite*gold: 0
Join Date: Dec 2007
Posts: 618
Received Thanks: 213
i think kinishi isnt going to change all codes with that...or idk...
alexbigfoot is offline  
Old 01/01/2009, 16:45   #13
 
elite*gold: 40
Join Date: Sep 2006
Posts: 1,892
Received Thanks: 804
Can you add cords and **** for your npc?
gerble93 is offline  
Old 08/23/2009, 06:42   #14
 
elite*gold: 0
Join Date: Aug 2009
Posts: 418
Received Thanks: 37
Quote:
Code:
                            if (CurrentNPC == 8)
                            {
                                if (Control == 1)
                                {
                                    string WHPW1 = "";
                                    bool ValidPW1 = false;
                                    for (int i = 14; i < 14 + Data[13]; i++)
                                    {
                                        WHPW1 += Convert.ToChar(Data[i]);
                                    }

                                    if (WHPW1 == MyChar.WHPW)
                                    {
                                        ValidPW1 = true;
                                    }
                                    try
                                    {
                                        if (ValidPW1)
                                        {
                                            SendPacket(General.MyPackets.ETCPacket(MyChar, 4));
                                            WHOpen = 1;
                                        }
                                        else
                                        {
                                            SendPacket(General.MyPackets.NPCSay("Wrong Password. Try again."));
                                            SendPacket(General.MyPackets.NPCLink("Ok.", 0));
                                            SendPacket(General.MyPackets.NPCLink("Let me see.", 255));
                                            SendPacket(General.MyPackets.NPCSetFace(30));
                                            SendPacket(General.MyPackets.NPCFinish());
                                        }
                                    }
                                    catch (Exception Exc) { General.WriteLine(Exc.ToString()); }

                                    break;
                                }
                            }
well you said do the same for 81-85 couldnt people just do this,
Code:
                            [B][U]if (CurrentNPC == 8 || CurrentNPC >= 81 || CurrentNPC <= 85)[/U][/B]
                            {
                                if (Control == 1)
                                {
                                    string WHPW1 = "";
                                    bool ValidPW1 = false;
                                    for (int i = 14; i < 14 + Data[13]; i++)
                                    {
                                        WHPW1 += Convert.ToChar(Data[i]);
                                    }

                                    if (WHPW1 == MyChar.WHPW)
                                    {
                                        ValidPW1 = true;
                                    }
                                    try
                                    {
                                        if (ValidPW1)
                                        {
                                            SendPacket(General.MyPackets.ETCPacket(MyChar, 4));
                                            WHOpen = 1;
                                        }
                                        else
                                        {
                                            SendPacket(General.MyPackets.NPCSay("Wrong Password. Try again."));
                                            SendPacket(General.MyPackets.NPCLink("Ok.", 0));
                                            SendPacket(General.MyPackets.NPCLink("Let me see.", 255));
                                            SendPacket(General.MyPackets.NPCSetFace(30));
                                            SendPacket(General.MyPackets.NPCFinish());
                                        }
                                    }
                                    catch (Exception Exc) { General.WriteLine(Exc.ToString()); }

                                    break;
                                }
                            }
Arco:) is offline  
Old 08/23/2009, 08:00   #15
 
elite*gold: 0
Join Date: May 2009
Posts: 579
Received Thanks: 70
nice one!!!


jvt619 is offline  
Closed Thread



« [Will Release NinjaArmor] | [Release] Conquer Source »

Similar Threads
warehouse password
04/09/2011 - EO PServer Hosting - 8 Replies
Where can i reset warehouse password?
Warehouse password?
12/24/2007 - CO2 Main - Discussions / Questions - 11 Replies
Hey, I'm just wondering if there is some sort of wh hack, the CoDLL one doesn't work for me anymore, so is there any other one working? I really need one cuz I have a big scam going on, thanks in advance :p
Warehouse Password
05/12/2007 - CO2 Main - Discussions / Questions - 18 Replies
Hey Does anyone knows how to get an warehouse password of an acount that u just scammed Thanx Davinski
Warehouse password
02/03/2007 - CO2 Main - Discussions / Questions - 7 Replies
Hey i was wondering if theres any way to get my warehouse password without the email address cuz im tryin to get back on an old account but i forgot all the stuff for it anyone kno a way i can get the warehouse pass back?



All times are GMT +1. The time now is 21:17.


Powered by vBulletin®
Copyright ©2000 - 2018, Jelsoft Enterprises Ltd.
SEO by vBSEO ©2011, Crawlability, Inc.

Support | Contact Us | FAQ | Advertising | Privacy Policy | Abuse
Copyright ©2018 elitepvpers All Rights Reserved.