[Request] 5165 Class Ban

01/22/2015 07:38 mujake#16
Try != at the first if (Job ==50) , if you say the others are banned and ninja isn't.
01/22/2015 14:15 stormy547#17
Alright, so putting != fixed the ban on the ninja, but we still have that slight error of spamming characters into the database, yet not being able to play any.

I'm not sure if at this point that the CharacterMaking.cs will matter, but it doesn't look like it. Here it is anyways:

Code:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace NewestCOServer.PacketHandling
{
    class CharacterMaking
    {
        public static void Handle(Main.GameClient GC, byte[] Data)
        {            
            string CharName = "";
            for (int i = 0; i < 16; i++)
                if (Data[20 + i] != 0)
                    CharName += Convert.ToChar(Data[20 + i]);

            ushort Body = BitConverter.ToUInt16(Data, 52);
            byte Job = Data[54];
            if (GC.ValidName(CharName))
            {
                GC.AddSend(Packets.PopUpMessage(GC.MessageID, Database.CreateCharacter(GC.AuthInfo.Account, CharName, Body, Job)));
            }
            else
                GC.AddSend(Packets.PopUpMessage(GC.MessageID, "Invalid character name!"));
        }
    }
}
01/22/2015 14:23 mujake#18
You suppose to put the ninja check before allowing the character file to be created.Come on not that hard to figure out where it should be placed...
01/22/2015 17:06 pintinho12#19
He couldn't figure out how to use the logic operators == and !=
What do you expect?
01/23/2015 00:53 stormy547#20
Alright then, I have probably led you on. When I claimed I'm not a "rookie", I was not talking about coding, I was speaking of in general. I can't be tricked, as I formerly thought someone was trying to.
Need to know a bit? Look under my name. It says "Learning" for a reason. I have told you my skill level, creating NPCs and Commands by copy and pasting existing code for most of it, and a bit I create, but very little.
I have never claimed to be an experienced coder, and I am simply asking for help. I am tired of you people insulting my lack of skill.

As for the code, it is placed in the database.cs, where there is character creation. I just found out about this CharacterMaking.cs, since when I searched for the character creation code, it took me to database.cs. I am simply asking for help, and I am very sorry that you expect more from me.
01/23/2015 03:31 Freszone#21
I wouldn't call it learning if you're copy & pasting some (rather bad) code made by someone else without at least trying to understand what's going on there.
If you really wanted to learn, you would start by reading and learning the basic syntax and operations of given language and then trying to understand the code you're copy & pasting instead of just mindlessly trying to place it in different places and crying for help.

Regarding your issue, there's an exception being thrown somewhere in the try-block.
If you knew how to use your basic tools like breakpoints, you would probably find the issue pretty easily.
01/23/2015 04:05 stormy547#22
Actually, I am attempting to understand what is going on. Currently I am learning how NPCs work, and until I have a basic understanding of that, I will not go for other stuff. I am taking it on step at a time, and it is not my fault that it is the wrong step.
01/23/2015 06:53 mujake#23
OMG....Dude you make the check for right before the client sends the OK message for character, you don't need to programming guru to create this line of code.
All you will have to use is "if" and "else".I managed to pull that few years ago on LOTF, and I have no basics in programming, it's about thinking where to place and how it would look like.
Try pasting the check in different positions inside the character creation, but right before writing the file.
01/23/2015 14:20 stormy547#24
If you were paying attention, you would know that the check is working, but it seems to of messed up the other classes creation code, seeing as when the character makes, in an unusual way, it simply makes the character, and doesn't even relate it to the account.
01/23/2015 16:24 mujake#25
I did, that's mainly because you have placed the code in the wrong position, and if you have ninja it would let some part of the code process but if you have other character it won't process the whole code so this way you end up with corrupted characters...
01/23/2015 22:01 pintinho12#26
Do you ever heard of programming logic? Or even logic?

I am not saying you're dumb or shaming you, we just got a bunch of peoples who claim they're trying to learn, but they can't even build an algorithm on the paper. It's most likely they don't even read any article about programming, they just come to the forum with their questions.

There are alot of programming logic pdf's on the internet, you could read about them first, they have the basic that will be used on all programming languages, that's my tip for you. You need to see each if {} else {}, see what needs to be inside them, what can be processed outside so you don't need to write the code twice and alot of other things.

Quote:
it simply makes the character, and doesn't even relate it to the account.
Why? What's causing this problem? There is any method related to this? Did you press F12 to find the source and read if there is anything wrong? What else could cause this?

Good luck on that.
01/31/2015 05:45 stormy547#27
Alright, so I would like to apologize to every single one of you, and it would be lovely if we can call this off, because I found out that the codes I had were indeed correct the first time, the only thing that was wrong was that since I removed every ninja item from the itemtype, apparently it has VERY strict regulations that fucked up the creation somehow. Thank you all for your help, and each post will get a thanks.

#Request Closed, Reason: Resolved
02/01/2015 11:04 InsomniacPro#28
This thread was a fucking joy to read.
Rookie.