Welcome!

Join our community of MMO enthusiasts and game developers! By registering, you'll gain access to discussions on the latest developments in MMO server files and collaborate with like-minded individuals. Join us today and unlock the potential of MMO server development!

Join Today!

[Release] Fix CarePackage

Status
Not open for further replies.
Experienced Elementalist
Joined
Jan 31, 2014
Messages
228
Reaction score
25
Hello guys ! Today I decided to post one of my many fixes. The place because it is one of the most strange and simple server .

First we go to replace the entire code in HANDLE_CARE_PACKAGE_WIN

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


using GameServer.Networking.Packets;
using GameServer.Virtual_Objects.User;


namespace GameServer.Networking.Handlers
{
class HANDLE_CARE_PACKAGE_WIN : PacketHandler
{
public override void Handle(GameServer.Virtual_Objects.User.virtualUser User)
{
//Credits By FreeWar - Server [GM]Kryptonix
int ItemID = Convert.ToInt32(getBlock(0));
string[] rokys091 = DB.runReadRow("SELECT itemcode, price, method, itemdays, loseitem1, loseitemdays1, loseitem2, loseitemdays2, loseitem3, loseitemdays3, loseitem4, loseitemdays4 FROM carepackage WHERE id='" + ItemID + "'");
//string[] theItem = DB.runReadRow("SELECT itemcode, price, method, itemdays FROM carepackage WHERE id='" + ItemID + "'");
string ItemCode = rokys091[0];
int Days = Convert.ToInt32(rokys091[3]);
bool isDinar = (rokys091[2] == "0" ? true : false);


bool Win = false;


int Rand = new Random().Next(0, 4);
if (Rand == 0)
{
string[] datas = DB.runReadRow("SELECT itemcode, price, method, itemdays, loseitem1, loseitemdays1, loseitem2, loseitemdays2, loseitem3, loseitemdays3, loseitem4, loseitemdays4 FROM carepackage WHERE id='" + ItemID + "'");

ItemCode = datas[0];
Win = true;
}
else
{
string[] loseItem = DB.runReadRow("SELECT loseitem" + Rand.ToString() +", loseitemdays" + Rand.ToString() + " FROM carepackage WHERE id='" + ItemID +"'");
ItemCode = loseItem[0];
Days = Convert.ToInt32(loseItem[1]);
Win = false;
}


int Price = Convert.ToInt32(rokys091[1]);


if (isDinar == true)
{
User.Dinar -= Price;
DB.runQuery("UPDATE users SET dinar='" + User.Dinar + "' WHERE id='" + User.UserID + "'");
}
else
{
User.Cash -= Price;
DB.runQuery("UPDATE users SET cash='" + User.Cash + "' WHERE id='" + User.UserID + "'");
}


User.AddItem(ItemCode, Days);


User.send(new PACKET_CARE_PACKAGE_WIN(User, ItemCode, Days, isDinar, Win));
}
}
}


Rokys091 - [Release] Fix CarePackage - RaGEZONE Forums


Later we are going to change the ID of the 1st CarePackage in database in " 0 " . Look at the screen !

GamePlay good : D
 
Last edited by a moderator:
◝(⁰▿⁰)◜Smile◝ (⁰▿⁰)◜
Developer
Joined
May 29, 2007
Messages
2,167
Reaction score
898
Re: [RELASE]Fix CarePackage

This isn't a very well designed fix. I recommend not using it because it only allows you to use up to 4 items inside a package.
You can use some relationships between tables to accomplish a better system that supports unlimited items inside a package.

It's a nice attempt but it's a really BAD way of implementing packages.
 
Experienced Elementalist
Joined
Jan 31, 2014
Messages
228
Reaction score
25
Re: [RELASE]Fix CarePackage

Yeah! This use only 4 item, but if i want to add other item it's not hard :), but now this carepackage work fine for 4 item. I'm not agree with you, this not are a bad way of implementing packages, before you test it and after judges.
 
Newbie Spellweaver
Joined
Dec 4, 2014
Messages
22
Reaction score
9
Re: [RELASE]Fix CarePackage

I'm not agree with you, this not are a bad way of implementing packages, before you test it and after judges.

No. Your code is bad and you should feel bad.
 
◝(⁰▿⁰)◜Smile◝ (⁰▿⁰)◜
Developer
Joined
May 29, 2007
Messages
2,167
Reaction score
898
Re: [RELASE]Fix CarePackage

Yeah! This use only 4 item, but if i want to add other item it's not hard :), but now this carepackage work fine for 4 item. I'm not agree with you, this not are a bad way of implementing packages, before you test it and after judges.
I'm a software developer, I know what I'm talking about. I've years of programming experience. If you show this code to any decent developer they will tell you it's bad. It doesn't mean if it works that it's good code.. Good code is something you can build upon not get yourself limited or blocked like this code.
 
Last edited:
Experienced Elementalist
Joined
Jan 31, 2014
Messages
228
Reaction score
25
Re: [RELASE]Fix CarePackage

Ok CodeDragon . I'm not a developer like you , but at least I try in every way to fix these bugs . Forgive me if I doubted your word , but I think that instead of criticizing help is the best solution . For the rest, if the code is wrong provider and immediately delete it.
 
◝(⁰▿⁰)◜Smile◝ (⁰▿⁰)◜
Developer
Joined
May 29, 2007
Messages
2,167
Reaction score
898
Re: [RELASE]Fix CarePackage

Ok CodeDragon . I'm not a developer like you , but at least I try in every way to fix these bugs . Forgive me if I doubted your word , but I think that instead of criticizing help is the best solution . For the rest, if the code is wrong provider and immediately delete it.

You don't have to delete it.. You could just have closed the topic tough.. Anyways just keep trying and trust me one day you'll maybe be able to surpass me ;)
 
Status
Not open for further replies.
Back
Top