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] Swift Emulator - Fixes / Edits

Status
Not open for further replies.
Experienced Elementalist
Joined
Feb 21, 2012
Messages
207
Reaction score
24
Can you fix this bugs:
- HC Doesn't save
- Room event doesnt work
 
Divine Celestial
Member
Joined
Jun 26, 2011
Messages
819
Reaction score
338
Can you fix this bugs:
- HC Doesn't save
- Room event doesnt work
HC saves for me on localhost. Plus, I used several pieces of code from this Emulator for my own project; haven't come across any errors as of yet.
 
Initiate Mage
Joined
Jan 20, 2013
Messages
1
Reaction score
0
The emulator use 95% of CPU on my VPS , how fix this ?

Sorry for my english i'm french !
 
Initiate Mage
Joined
Jan 19, 2012
Messages
47
Reaction score
1
You could add a query log of all processed by the server that we could find sql infections
 
Skilled Illusionist
Joined
Aug 16, 2007
Messages
343
Reaction score
263
You could add a query log of all processed by the server that we could find sql infections

I estimate 1 query per second for each user in normal conditions ( not furni spawning) . Its not a good idea.


About that CPU leak, I didn't ever get it in my live server. I need more information such How many users you do have online. Anyway,I have a guessonwhat could cause that And I'm already working on it.

Also, I've started ripping PlusEmu Encryption so I can update my revision for the latest swf release
 
Initiate Mage
Joined
Jan 19, 2012
Messages
47
Reaction score
1
I estimate 1 query per second for each user in normal conditions ( not furni spawning) . Its not a good idea.


About that CPU leak, I didn't ever get it in my live server. I need more information such How many users you do have online. Anyway,I have a guessonwhat could cause that And I'm already working on it.

Also, I've started ripping PlusEmu Encryption so I can update my revision for the latest swf release

nice that such a system identifying sql injection
 
Skilled Illusionist
Joined
Aug 16, 2007
Messages
343
Reaction score
263
This should fix any CPU consume thing if my guess was right
 
Last edited:
Initiate Mage
Joined
Jun 8, 2013
Messages
15
Reaction score
0
I did some fixes to make this BCStorm rename usable. However, to make this emulator stable it would be needed a fully rewrite on 2 core systems : Groups and Gifts. Both of them are either bad coded or leaky. However, my goal was to code something new just for knowledgement. If I get enough resources on some retail server I might code a new group system from scratch, as It doesn't worth to go on further development on anything based on BCStorm

First of all, you should want to replace your Incoming.cs and Outgoing.cs for the following. That should fix : Trade, Mount, Jukebox, RoomAds ( http://forum.ragezone.com/f353/bc-storm-ads_background-fix-903948/ ) , GiveRights, Delete friends.

Both Incoming.cs and Outgoing.cs are attached to the thread.

Now , the piece of write by me from stratch. This was also my first sample of server emulation C#. Hope You guys analyze It and tell me if where to improve my code.

Profile relationships:

MySql Query:
Code:
 SET FOREIGN_KEY_CHECKS=0;-- ----------------------------
-- Table structure for `user_relationships`
-- ----------------------------
DROP TABLE IF EXISTS `user_relationships`;
CREATE TABLE `user_relationships` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `requester_id` int(10) unsigned NOT NULL,
  `target_id` int(10) unsigned NOT NULL,
  `relationshipstatus` int(1) NOT NULL DEFAULT '0',
  PRIMARY KEY (`id`),
  KEY `requester_id` (`requester_id`) USING BTREE,
  KEY `target_id` (`target_id`) USING BTREE,
  KEY `rstatus` (`relationshipstatus`) USING BTREE
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=latin1;

SWFs:
@htdocs/swfs
Recommend you to use the vars released with revision 3 as I changed some stuff.


[SQL Injection exploit fix. Must apply if you are using any of following releases]
Code:
Search for:
Code:
[COLOR=#333333]dbClient.runFastQuery("UPDATE user_bots SET name = '" + Data + "' WHERE id = '" + BotId + "'");[/COLOR]

[COLOR=#333333]and Replace with[/COLOR]

[COLOR=#333333]dbClient.setQuery("UPDATE user_bots SET name = '@data' WHERE id = '" + BotId + "'");[/COLOR]
[COLOR=#333333]dbClient.addParameter("data",Data);
[/COLOR]dbClient.runQuery();


Current Revision Download [REVISION 4]

REVISION 4 Notes
REVISION 4:

Download:
(Clean database and english gamedata included)




  1. Fixed possible MySQL injection exploit;
  2. Fixed room rating;
  3. Quests are now working;
  4. Possibly fix for pets database management causing some critical errors since Butterfly;
  5. Added proper shutdown system for forced closure;
  6. Freeze is now working;
  7. Now you have the option to give an user a badge when he buys a furni. Place the badge code in catalog_pages_copy badge column;
  8. Furni-o-matic is now working (thanks to =dj.matias=). Make sure you edit your ecotron_rewards table;
  9. Fixed bots name change;
  10. Other stability stuff you don't care.

MySQL Querys for old databases:

Code:
[COLOR=#01557D]ALTER TABLE [/COLOR]catalog_items_copy[COLOR=#01557D] ADD badge VARCHAR(20) [/COLOR]NOT NULL DEFAULT ''[COLOR=#01557D];

[/COLOR]INSERT INTO catalog_pages VALUES ('1060', '9999', 'Rewards', '3', '983', '1', '1', '1', '0', '0', '2', 'recycler_prizes', 'catalog_header_furnimatic', '', '', '', '', '', '', '', '', '', '0', '', '');

Keep in mind that the following features works only with English furnidata for now (if you are using my items_base)
  • Jukebox
  • Battle Banzai Furni
They are fully coded and functional for English furnidata sprites id only.


Images:
REMOVED
REMOVED

REMOVED

Let me know if you find any bugs. I didn't remove the packetlogger for this release because I was really tired. I will do that in the next one.

REVISION 3 Notes
Revision 3:



Query:
SET FOREIGN_KEY_CHECKS=0;
-- ----------------------------
-- Table structure for `user_bots`
-- ----------------------------
DROP TABLE IF EXISTS `user_bots`;
CREATE TABLE `user_bots` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`room_id` int(10) unsigned NOT NULL DEFAULT '0',
`ai_type` enum('generic','guide','pet') NOT NULL DEFAULT 'generic',
`name` varchar(100) NOT NULL,
`motto` varchar(120) NOT NULL,
`look` text NOT NULL,
`x` int(11) NOT NULL DEFAULT '0',
`y` int(11) NOT NULL DEFAULT '0',
`z` int(11) NOT NULL DEFAULT '0',
`rotation` int(11) NOT NULL DEFAULT '0',
`walk_mode` enum('stand','freeroam','specified_range') NOT NULL DEFAULT 'stand',
`min_x` int(11) NOT NULL DEFAULT '0',
`min_y` int(11) NOT NULL DEFAULT '0',
`max_x` int(11) NOT NULL DEFAULT '0',
`max_y` int(11) NOT NULL DEFAULT '0',
`user_id` int(11) NOT NULL DEFAULT '0',
`template_id` int(11) NOT NULL DEFAULT '0',
`automatic_chat` enum('false','true') NOT NULL DEFAULT 'false',
`speaking_interval` int(11) NOT NULL DEFAULT '7',
PRIMARY KEY (`id`),
KEY `room_id` (`room_id`) USING BTREE
) ENGINE=MyISAM AUTO_INCREMENT=11 DEFAULT CHARSET=latin1;

  • Added support handle to not handled items in database. Should fix that random glitch of BCStorm where you placed an item in the room and couldn't enter anymore;
  • Fixed alert messages;
  • Fixed an error where furniture weren't send to the currect owner when picked up. It's now 100% safe to place your furni into others room. If the room gets deleted or if the owner pickup your furni, It will come back to you;
  • Fixed bots and pets serialize. Now It won't mess up anymore because of equals virtual ID;
  • Completed bot handler. Now the Automatic chat function and the bot actions are 100% functional. Also, bots shouldn't get stucked in corners anymore.
  • Improved a little bit groups composer perfomance. More to be done about this yet;
  • Send support ticket is now working again.

~ To be fixed yet:
  1. All can ride a horse;
  2. Quests tab opening;
  3. Jukebox handler sometimes stop working. Don't know what It is yet. I might go for a full rewrite for Jukeboxes. ( Could be something related to variables as Horse dyeing too, but I don't know what It is right now)
  4. Mannequin header update ? I guess I forgot that for this revision. Might do for the next one;
  5. Football look changer;
  6. One-way doors;
  7. Apply fixes for Ecotron/Furni-o-matic and get an emblem when buying a furniture. Already released here. Only requires headers update I guess.

After all this is completed, I will update this emulator to the same release as PlusEmulator or for the one I've got cracked from may.

If you have some problem regarding dyeing or mounting your horse you should use the variables inside this revision's .rar


Note: In-game profiles doesn't work for accounts created using Illumina CMS. It's a bad CMS anyway so you shouldn't use it. I don't know almost anything about php so I will not try to fix that. But It would be great if someone could fix this. ( In-game profiles work fine for UberCMS2)


At this point I must say that this Revision is more stable than any other BCStorm edit.
Also, I'm interested in any error you may log so we can fix this and make it better.
REVISION 2 Database: http://forum.ragezone.com/attachmen...-release-swift-emulator-fixes-edits-adma2.rar
REVISION 2 Notes
Thanks for the commentaries, I really enjoy deving Habbo for knowledment. I got some time today so I finished another core update that was bugging me alot. Since It's release the BCStorm group system was broken. It was leaky, not optimal and, as I got to know later, very ambiguous. For example, every time you request some group to load from your memory, the program used to perfomed that task twice. That is not efficient and can be taken as a bug. However I think that I figured out the whole memory consuming and low performance dilemma for this release and made I good and optimal system to dispose and handle groups objetcs. After hours of testing, I can show you this data:

For each group cached, there is a consume of 13,1 ~ 13,3 K + GroupMemberNumber*0,07K of memory. It means that if you have 5000 groups with average 100 members loaded, you should have a memory consume of ~ 100MBytes. As I don't have acess to any high-populated hotel to test It, I belive that there should be 5000groups loaded for every 500online users. That seemed a good performance. But It wasn't enough. So I also created a system to dispose unused groups (the ones that are loaded by loading a profile, for example). That system disposes about to 95% of the loaded guilds on every LowPriorityWork.Process cycle ( 30s ). It means that 95% of this 100MBytes used by 5000 loaded groups is free to be used again after 30 seconds.

With that result, I belive that I was able to fix this problem regarding BCStorm's Edits/Upgrates performance instability regarding groups, making it possible to use for high populated live servers. However, this is just a presupposition based on the data I gathered. It requires testing that aspect.

As I did too much edits, I didn't rip the code out like I did for Relationships(zzzzz') . But fell free to use It at your own build. That also fix the problem regarding not being able to Edit your group after buying it, where I did need to reload your emulator to take acess to this function.


Download AKllX's Swift Emulator Revision 2:


To be fixed yet:


Serialize placing bots/pets at the room(client-side speaking they are the same);
Handle owner rights at public furni for :pickall and room deleting. As It is now, all furni placed in a room by some user that doesn't own the room can be picked up by the room owner;
Handle some of these weird bugs that randomly(not really) happen. I'm interested in any bugs you may find. Just post it here.

Catalog fix tool. This should fix 99.9% of your catalog problems.
Code:
<?php

$db_host = "localhost";    // MySQL Host
$db_user = "root";        // MySQL User
$db_pass = "akllxistheebest";        // MySQL Passwort
$db_database = "adma1";    // MySQL Datenbank


$connect = mysql_connect($db_host, $db_user, $db_pass) or die("Konnte keine Verbindung zum MySQL-Server aufbauen, Fehler: ".mysql_error());
$db = mysql_select_db($db_database, $connect) or die("Konnte keine Verbindung mit der MySQL-Datenbank aufbauen, Fehler: ".mysql_error());


$data = file_get_contents("http://localhost/swfs/furnidata.txt");
$data = str_replace("\n", "", $data);
$data = str_replace("[[", "[", $data);
$data = str_replace("]]", "]", $data);
$data = str_replace("][", "],[", $data);




foreach (explode('],[', $data) as $val)
{
    $val = str_replace('[', '', $val);
    $val = str_replace(']', '', $val);


    $bits = explode(',', $val);
    $name = str_replace('"', '', $bits[2]);


    $stufftoupdate[] = '[' . $val . ']';
}


foreach ($stufftoupdate as $stuff)
    {


        #Start main stuff
        $stuff = str_replace('"s",', '', $stuff);
        $stuff = str_replace('"i",', '', $stuff);
        $furni = explode('[', $stuff);
        $furni = explode(']', $furni[1]);
        #End main stuff


        #Start select item_name
        $nome = explode('","', $furni[0]);
        $nome = explode('","', $nome[1]);
        $nome = $nome[0];
        #End select item_name


        #Start select sprite_id
        $id = explode('"', $furni[0]);
        $id = explode('","', $id[1]);
        $id = $id[0];
        #End select sprite_id


        #Start select width
        $width = explode('","', $furni[0]);
        $width = explode('","', $width[4]);
        $width = $width[0];
        #End select width


        #Start select length
        $length = explode('","', $furni[0]);
        $length = explode('","', $length[5]);
        $length = $length[0];
        #End select length


        #Start select name
        $name = explode('","', $furni[0]);
        $name = explode('","', $name[7]);
        $name = $name[0];
        #End select name


        $idfurni = mysql_query("SELECT * FROM items_base WHERE item_name = '$nome'");
        $furni = mysql_fetch_array($idfurni);
        $furniid = $furni['item_id'];
        $update = mysql_query("UPDATE items_base SET sprite_id='$id', public_name='$name', width='$width', length='$length' WHERE item_id='$furniid' LIMIT 1");
        if ($update==FALSE) echo("MySQL error in item ".$nome."<br/><br/>");
        else echo("Item ".$nome." updated<br/><br/>");
    }
?>

//Removed single update references. Text went too damn long.

When Fixed Please Put It In English Much Appreciated :) W2GO !!! Keep Up The Gud Work !!! Don't Stop Now !!!
 
Initiate Mage
Joined
Apr 27, 2009
Messages
54
Reaction score
2
I've inserted all fixes in my existing emulator, with own fixes/edits. Thanks AKllX! I used: WinMerge

And, AKllX if you read this please replace this in your thread:
Code:
dbClient.setQuery("UPDATE user_bots SET name = '@data' WHERE id = '" + BotId + "'");
dbClient.addParameter("data",Data);
dbClient.runQuery();
to
Code:
dbClient.setQuery("UPDATE user_bots SET name = @data WHERE id = '" + BotId + "'");
dbClient.addParameter("data",Data);
dbClient.runQuery();
:rolleyes:
 
Skilled Illusionist
Joined
Aug 16, 2007
Messages
343
Reaction score
263
Why do i get this:
Code:
TokenID: 0Invalid Dario bug duing user login: System.InvalidCastException: Specified cast is not valid.
   at Butterfly.HabboHotel.Users.Authenticator.HabboFactory.GenerateHabbo(DataRow dRow, DataRow group) in C:\inetpub\Swift - AKllX Edition\Butterfly\HabboHotel\Users\Authenticator\HabboFactory.cs:line 30
   at Butterfly.HabboHotel.Users.UserDataManagement.UserDataFactory.GetUserData(String sessionTicket, String ip, Byte& errorCode) in C:\inetpub\Swift - AKllX Edition\Butterfly\HabboHotel\Users\UserDataManagement\UserDataFactory.cs:line 369
   at Butterfly.HabboHotel.GameClients.GameClient.tryLogin(String AuthTicket) in C:\inetpub\Swift - AKllX Edition\Butterfly\HabboHotel\GameClients\GameClient.cs:line 242

At HabboFacrory.cs line 30 . Probably trying to cast something to (uint). Replace for Convert.ToUInt32()



About fastfood and snowstorm. Games are hard to code, specially SnowStorm. It was never correctly coded as far as remember and I run retros since 2007. I'm mad if I try to code that by myself. But I might do It on my next college vacancy.
 
Joined
Apr 20, 2007
Messages
40
Reaction score
9
For Crystal cost in catalogue just search this in CatalogItem.cs
Code:
 internal void Serialize(ServerMessage Message)
        {
            try
            {
                if (this.PageID != 5)
                {
                    Message.AppendInt32(this.Id);
                    Message.AppendString(this.Name);
                    Message.AppendInt32(this.CreditsCost);
                    Message.AppendInt32(this.PixelsCost);
                    Message.AppendInt32(0);

And change for this

Code:
internal void Serialize(ServerMessage Message)
        {
            try
            {
                if (this.PageID != 5)
                {
                    Message.AppendInt32(this.Id);
                    Message.AppendString(this.Name);
                    Message.AppendInt32(this.CreditsCost);
                    if (CrystalCost > 0)
                    {
                        Message.AppendInt32(this.CrystalCost);
                        Message.AppendInt32(105);
                    }
                    else 
                    {
                        Message.AppendInt32(this.PixelsCost);
                        Message.AppendInt32(0);
                    }


Can anyone give me the CrystalBalance Header? i never learn use the novo packetlogger in my own client T-T

Cheers :)
 
ส็็็็็็็
Member
Joined
Sep 21, 2009
Messages
2,005
Reaction score
594
I've experienced Ghosting of some objects when moved, I've written a fix and I'm just testing it to make sure it actually fixes the problem (its hard to replicate object-ghosting)

(This works for me, I've been unable to replicate the issue since I added this)

Find in GameClientMessageHandler.cs
Code:
room.GetRoomItemHandler().SetFloorItem(this.Session, item, newX, newY, newRot, false, false, true);

Replace it with:
Code:
                    if (!room.GetRoomItemHandler().SetFloorItem(this.Session, item, newX, newY, newRot, false, false, true))
                    {
                        Response.Init(Outgoing.UpdateItemOnRoom);
                        item.Serialize(Response, room.OwnerId);
                        SendResponse();
                    }

Tell me if it works for you or not, it does for me.

EDIT: This does fix catalog-drag ghosting.
 
Last edited:
Initiate Mage
Joined
Apr 27, 2009
Messages
54
Reaction score
2
I've experienced Ghosting of some objects when moved, I've written a fix and I'm just testing it to make sure it actually fixes the problem (its hard to replicate object-ghosting)

(This works for me, I've been unable to replicate the issue since I added this)

Find in GameClientMessageHandler.cs
Code:
room.GetRoomItemHandler().SetFloorItem(this.Session, item, newX, newY, newRot, false, false, true);

Replace it with:
Code:
                    if (!room.GetRoomItemHandler().SetFloorItem(this.Session, item, newX, newY, newRot, false, false, true))
                    {
                        Response.Init(Outgoing.UpdateItemOnRoom);
                        item.Serialize(Response, Room.OwnerId);
                        SendResponse();
                    }

Tell me if it works for you or not, it does for me.

Thanks, I added it, if it worked for me I'll get back to you :)
 
Divine Celestial
Member
Joined
Jun 26, 2011
Messages
819
Reaction score
338
I've experienced Ghosting of some objects when moved, I've written a fix and I'm just testing it to make sure it actually fixes the problem (its hard to replicate object-ghosting)

(This works for me, I've been unable to replicate the issue since I added this)

Find in GameClientMessageHandler.cs
Code:
room.GetRoomItemHandler().SetFloorItem(this.Session, item, newX, newY, newRot, false, false, true);

Replace it with:
Code:
                    if (!room.GetRoomItemHandler().SetFloorItem(this.Session, item, newX, newY, newRot, false, false, true))
                    {
                        Response.Init(Outgoing.UpdateItemOnRoom);
                        item.Serialize(Response, Room.OwnerId);
                        SendResponse();
                    }

Tell me if it works for you or not, it does for me.

Pyaa3O1 - [RELEASE] Swift Emulator - Fixes / Edits - RaGEZONE Forums


Got this error.
 

Attachments

You must be registered for see attachments list
Status
Not open for further replies.
Back
Top