[Release] Met/db bank using input fields

01/01/2010 22:51 pro4never#1
So I was bored and re-wrote my met/db bank that I made for my 1.0 server and converted it for use with CoEmu. I ended up changing some stuff around so that it works with met/db scrolls also.


As far as I know there is no better, more complete system released publicly. It may not be perfect but it's close. I don't actually run a server so there could be some bugs that I didn't run into while testing it for a few minutes so keep your eyes open.

Main Npc text (using lady luck simply because I don't want lottery on my server but simple enough to change the npc number)

Place in handlers>NpcTalk.cs

You will also be needing some functions so I may as well post some of them (if I miss some, that's your own damn problem to fix them.)

Note: the base source I was messing around with doesn't have composition or anything like that so you will need to modify the codes accordingly.

Place in Database>Database.cs


place in the bottom of Handlers>Npctalk.cs



Note: If you don't have Data you will need to modify the top npctalk void to include it by using this line of code

Code:
public static void NpcTalk(ClientSocket CSocket, int ID, int LinkBack, byte[] Data)
and under character.cs

Code:
public int DbPoints = 0;
        public int MetPoints = 0;

Obviously you will need to modify the character database to have a field for MetPoints and DbPoints (int, not nul, 0 decimals, default 0 etc)

Now modify your database so that it loads the points with the character (if not you will lose them on logoff even though they ARE being saved to the database properly)

Search Client.ID = Convert.ToInt32(DR["CharID"]);

and place
Client.MetPoints = Convert.ToInt32(DR["MetPoints"]);
Client.DbPoints = Convert.ToInt32(DR["DbPoints"]);

somewhere below it

Should be simple enough to setup by simply following other met/db storage scripts. Only difference is this one uses input fields. Storage will store scrolls first and extra mets second, removal should work perfectly with inventory space calculating scrolls and loose met/db's separately.


Anyways, should be easily converted to use in any source but figured seeing as I finished it and have no real use for it I'd release. Hopefully it will help ppl be able to learn from it.

<edit>

Cleaned up some stuff, had two copies of the database voids. Added spoilers so it's not quite as massive a post, grouped some stuff together. Nothing big changed.

<edit 2>

Re-wrote alot of the depositing code so you can't get free db/mets.. WHOOPS!
01/02/2010 01:03 -Shunsui-#2
Nice release : )
01/02/2010 05:56 shadow8994#3
Nice Release
01/12/2010 07:47 pro4never#4
Glad you enjoyed it.

Really is shocking after having come back how few people care about CoEmu anymore. 10 bux said if I or someone else converted it for the new lotf source this thread would be buzzing ^^
01/12/2010 09:06 Korvacs#5
Agreed, its a nice system to have instead of hundreds of met scrolls (or even just mets if your on 1.0), its a shame these things just get ignored.
01/14/2010 02:56 ktamer#6
Good work, despite CoEmu's "dying" popularity. It's good to see a public system that many people are going to try and implement into their PS'. Can't wait 'till my level of coding is as decent, so many ideas so many steps ^_^
01/14/2010 05:06 pro4never#7
Quote:
Originally Posted by ktamer View Post
Good work, despite CoEmu's "dying" popularity. It's good to see a public system that many people are going to try and implement into their PS'. Can't wait 'till my level of coding is as decent, so many ideas so many steps ^_^
Glad you find it useful. There isn't anything super complex with this script (although as you mentioned there is alot of it lol) except getting a hang of input fields and making sure I handled counting properly. If you have any questions about how to use some of the stuff out of it for a different script (or even have a request for a system/npc you would like to see made), lemme know.

When I get bored I tend to put together lil scripts just for fun so having a direction to them would be kinda nice.
01/16/2010 16:29 ktamer#8
Quote:
Originally Posted by pro4never View Post
Glad you find it useful. There isn't anything super complex with this script (although as you mentioned there is alot of it lol) except getting a hang of input fields and making sure I handled counting properly. If you have any questions about how to use some of the stuff out of it for a different script (or even have a request for a system/npc you would like to see made), lemme know.

When I get bored I tend to put together lil scripts just for fun so having a direction to them would be kinda nice.
Cool, I really appreciate it. And all the help everyone's been. It's hard to find a community with patience.
01/16/2010 17:11 ImmuneOne#9
Quote:
Originally Posted by pro4never View Post
Glad you enjoyed it.

Really is shocking after having come back how few people care about CoEmu anymore. 10 bux said if I or someone else converted it for the new lotf source this thread would be buzzing ^^
I have converted it, anyway conqueremu have died just because ninety percent of the forum only cares about highest patch and not about the quantity nor quality.
01/16/2010 19:20 Basser#10
Quote:
Originally Posted by ImmuneOne View Post
I have converted it, anyway conqueremu have died just because ninety percent of the forum only cares about highest patch and not about the quantity nor quality.
Yeah, I noticed that today.
Shit, some things never change.
01/16/2010 19:26 .Ryu#11
Damn chris your on a roll goodjob =P
01/16/2010 19:52 Basser#12
Pro4Never, just sayin gratz.
You have a lot more experience from the first time I saw one of your releases.
This script is proving you know the very basics now. Gratz on that.
01/20/2010 01:54 pro4never#13
Ahaha thanks, I wrote this ages ago though so not sure what codes you are referring to unless you mean the ones I did like 6+ months ago.

Anyways, hopefully people can find this useful.
02/03/2010 13:12 pro4never#14
Ok so I was using this script again and when I grabbed if off here and actually tested what I posted I realized just how messed up my checks were. I re-wrote them and updated the npc.

The way it was before, it would check inventory met/db's and account for scroll but it wouldn't actually check while removing stuff.. so lets say you have 21 db's in your inventory (2 scrolls 1 loose) and you try to deposit 19 dbs. It would pass the check cause you DO have enough but instead it would only remove 11 db's and give you the 19 points giving you 8 free dbs.

Not a good thing so I re-wrote it using some more checks. They may not be the prettiest things ever but they work. Also re-added some missing stuff that was organized wrong, mislabeled or just missing from the post.


Enjoy!
02/12/2010 13:36 renetjuuh#15
good job new i learn more about it:) realy nice