[devRev4] Status/Regeneration timers are broken.

Welcome in the osRose emulator Project.

Moderators: osRose dev team, ospRose dev team, osiRose dev team, Moderators

[devRev4] Status/Regeneration timers are broken.

Postby kismetbecomes on Thu Apr 11, 2013 7:09 pm

Hello again Osrose.

Been working a lot with my custom server now and have decided to do the EXP Medal bonuses.
And not surprised to encounter a bug.
The timers are way off from what it should really display.

Like this for instance:
Untitled-1.jpg

I have created an EXP booster that goes on up to five days and there appeared the status below the HP/MP tab the status (symbol) after using the item. As shown in the screenshot, the timer is way off from the 720 Requirement Value 2 I wrote in the STB that which is calculated 6*24*5 for the 5 days EXP buff. Just so you know this is also coded and timed in the server properly, (timervalue:+86400*5 ) the only problem is that how the client is handling the time it should expire because from what I can see from the screenshot the remaining time is 33 days before it wears off. :?

To sum it all up:

The EXP Medal works fine - the only problem is how the client DISPLAYS (is that the right word?) the status expiration.
Same goes for timed regeneration (e.g. new fruits, potion - the one with the plus sign effects - those potion/fruits that that regenerates by percentage over time.)
There's this STATUS CHANGE column in the useitem stb, I'm not sure but I believe its new? (this is where the timed statuses goes just like those in the fruit consumables)

I'm assuming the time calculation is different between the server and client?

I'm hoping you could again guide me how to fix another rev 4 problem.
Thanks OsRose. Cheers! :D
RoseZa v437 - HueRose Test Project -- http://hueroseonline.no-ip.biz
kismetbecomes
Rackie
Rackie
 
Posts: 299
Joined: Mon Feb 06, 2012 12:41 am

Re: [devRev4] Status/Regeneration timers are broken.

Postby PurpleYouko on Fri Apr 12, 2013 3:15 pm

LOL

I just looked through the server code for timed coupons.
Apparently it is hard coded for specific cases rather than directly using the value from the STB.
I thought all that crap had been updated a long time ago.

ExtraFunctions.cpp
CUseInfo* CWorldServer::GetUseItemInfo(CPlayer* thisclient, unsigned int slot )
Switch(type)
case 321:
CUseInfo* CWorldServer::GetUseItemInfo(CPlayer* thisclient, unsigned int slot )
Case 133:

It needs to be completely recoded or you need to add a specific case for your new item if you want the server to work with it at all.
Did you already add code to the server for this?

The STATUS EFFECT column has no real use for XP items. It isn't used for any of the pre-existing ones anyway.

The server code doesn't send any packets to the client with the timer value in them at all so we don't have a communication issue at least.
Not sure why the client is screwing up your value when you put in 720. Does it work for smaller numbers like 432 (3 days). It's possible that they are using a weird memory format that overflows if your number gets too big. Find out exactly what value it screws up on.
It's always possible that they completely changed their timer data like they did with timed quests
Need to lookup information on NARose items, skills, quests?
Now featuring a newly completed skill tree for all classes
Formatting fixed for different resolutions
Image

"A Gazelle is nothing but a giraffe plotted logarithmicaly"
User avatar
PurpleYouko
Rose Guru
Rose Guru
 
Posts: 4733
Joined: Fri Aug 10, 2007 2:05 pm

Re: [devRev4] Status/Regeneration timers are broken.

Postby Circa on Fri Apr 12, 2013 5:57 pm

So why is 720 = to 5 days lol?

6 * 24 * 5 ' what's the 6 for?
Circa
Clown
Clown
 
Posts: 404
Joined: Sun Aug 23, 2009 5:52 am
Location: CA

Re: [devRev4] Status/Regeneration timers are broken.

Postby kismetbecomes on Fri Apr 12, 2013 8:29 pm

Circa wrote:So why is 720 = to 5 days lol?

6 * 24 * 5 ' what's the 6 for?



duration of the item in blocks of 10 minutes (1 = 10 mins. 6 = 1 hour and so on)
RoseZa v437 - HueRose Test Project -- http://hueroseonline.no-ip.biz
kismetbecomes
Rackie
Rackie
 
Posts: 299
Joined: Mon Feb 06, 2012 12:41 am

Re: [devRev4] Status/Regeneration timers are broken.

Postby kismetbecomes on Fri Apr 12, 2013 8:40 pm

PurpleYouko wrote:Did you already add code to the server for this?

No I did not. I will look it up and just do what you instructed.


PurpleYouko wrote:Does it work for smaller numbers like 432 (3 days).

I even tried 1 but its still doesn't work.
RoseZa v437 - HueRose Test Project -- http://hueroseonline.no-ip.biz
kismetbecomes
Rackie
Rackie
 
Posts: 299
Joined: Mon Feb 06, 2012 12:41 am

Re: [devRev4] Status/Regeneration timers are broken.

Postby kismetbecomes on Mon Apr 15, 2013 2:33 pm

PurpleYouko wrote:LOL

I just looked through the server code for timed coupons.
Apparently it is hard coded for specific cases rather than directly using the value from the STB.
I thought all that crap had been updated a long time ago.

ExtraFunctions.cpp
CUseInfo* CWorldServer::GetUseItemInfo(CPlayer* thisclient, unsigned int slot )
Switch(type)
case 321:
CUseInfo* CWorldServer::GetUseItemInfo(CPlayer* thisclient, unsigned int slot )
Case 133:

It needs to be completely recoded or you need to add a specific case for your new item if you want the server to work with it at all.
Did you already add code to the server for this?

The STATUS EFFECT column has no real use for XP items. It isn't used for any of the pre-existing ones anyway.

The server code doesn't send any packets to the client with the timer value in them at all so we don't have a communication issue at least.
Not sure why the client is screwing up your value when you put in 720. Does it work for smaller numbers like 432 (3 days). It's possible that they are using a weird memory format that overflows if your number gets too big. Find out exactly what value it screws up on.
It's always possible that they completely changed their timer data like they did with timed quests



Hi PY, I have not coded it yet but all exp items seem to be working just the way it should. I have tested all my exp booster (esp those that effects last' after logging out and go on for a few days or so.) they work just fine. Can we assume I do not need to coded a specific case for the timed coupons? Or not? Honestly I have not looked into it yet, I tend to separate my source code from what I officially use to test the server and right now accessing that DevPC is not available, instead I'm asking if you think its a good idea to let go coding a special case.

On the side note, is there a way to make the server send a code to the client that the EXP item is still active? Because, if I use a 5-days exp booster, the first time I use it the icon is there, but, after logging out and coming back in, the status logo/icon is gone. Altho, as said, the exp booster is still in effect and is working fine. I hope I didn't get you confused about all that. :lol:
RoseZa v437 - HueRose Test Project -- http://hueroseonline.no-ip.biz
kismetbecomes
Rackie
Rackie
 
Posts: 299
Joined: Mon Feb 06, 2012 12:41 am

Re: [devRev4] Status/Regeneration timers are broken.

Postby PurpleYouko on Tue Apr 16, 2013 2:00 pm

Can we assume I do not need to coded a specific case for the timed coupons? Or not?

If you are adding a new item then you will definitely need a hard coded "exception" for it in the server.
The way the items are set up is a switch which is based on the item number in the STB. Any new items that you add are not going to be included in the existing code.
Ideally the whole thing should be rewritten so that it just takes the actual values from the STB no matter what they are but that's just not the way things are right now.

On the side note, is there a way to make the server send a code to the client that the EXP item is still active? Because, if I use a 5-days exp booster, the first time I use it the icon is there, but, after logging out and coming back in, the status logo/icon is gone. Altho, as said, the exp booster is still in effect and is working fine. I hope I didn't get you confused about all that. :lol:

Not confused at all ;)
It does make sense that the server would need to send a packet to the client to renew an existing item with a partly used timer. However I have no idea what packet it uses to do that. It would be possible to simulate it on the real NARose server and capture the packets that are sent. Assuming they haven't changed anything recently, this would give us some idea what is going on.
Need to lookup information on NARose items, skills, quests?
Now featuring a newly completed skill tree for all classes
Formatting fixed for different resolutions
Image

"A Gazelle is nothing but a giraffe plotted logarithmicaly"
User avatar
PurpleYouko
Rose Guru
Rose Guru
 
Posts: 4733
Joined: Fri Aug 10, 2007 2:05 pm

Re: [devRev4] Status/Regeneration timers are broken.

Postby kismetbecomes on Tue Apr 16, 2013 4:33 pm

PurpleYouko wrote:
It would be possible to simulate it on the real NARose server and capture the packets that are sent. Assuming they haven't changed anything recently, this would give us some idea what is going on.


So I would just need to use your packet sniffer, log into naRose, use an EXP coupon that stays after logging out and then log back in. Right? :)
RoseZa v437 - HueRose Test Project -- http://hueroseonline.no-ip.biz
kismetbecomes
Rackie
Rackie
 
Posts: 299
Joined: Mon Feb 06, 2012 12:41 am

Re: [devRev4] Status/Regeneration timers are broken.

Postby kismetbecomes on Tue Apr 16, 2013 6:07 pm

I got confused when you mentioned case 321, I thought its another case I have to code again or something. (So case 133 is inside 321 :D .. my bad.)
I have coded the case 133 already and having done this code below, so far, I didn't have problems.

  1. if (useitem->itemnum==198)
  2.                             {
  3.                                 thisclient->once=false;
  4.                                 thisclient->timerxp=time(NULL)+86400*3;
  5.                                 Log(MSG_INFO,"Bonus XP to %i",thisclient->bonusxp);
  6.                                 BEGINPACKET( pak, 0x702 );
  7.                                 ADDSTRING( pak, "Your 300% experience bonus will hold for three days." );
  8.                                 ADDBYTE( pak, 0 );
  9.                                 thisclient->client->SendPacket(&pak);
  10.                             }
  11.  
  12.                             else if(useitem->itemnum==199)
  13.                             {
  14.                                 thisclient->once=true;
  15.                                 thisclient->timerxp=time(NULL)+60*60;
  16.                                 Log(MSG_INFO,"Bonus XP to %i",thisclient->bonusxp);
  17.                                 BEGINPACKET( pak, 0x702 );
  18.                                 ADDSTRING( pak, "Your 200% experience bonus will hold for one hour or until you log out." );
  19.                                 ADDBYTE( pak, 0 );
  20.                                 thisclient->client->SendPacket(&pak);
  21.                             }
  22.  
  23.                             else if(useitem->itemnum==200)
  24.                             {
  25.                                 thisclient->once=true;
  26.                                 thisclient->timerxp=time(NULL)+60*60;
  27.                                 Log(MSG_INFO,"Bonus XP to %i",thisclient->bonusxp);
  28.                                 BEGINPACKET( pak, 0x702 );
  29.                                 ADDSTRING( pak, "Your 300% experience bonus will hold for one hour or until you log out." );
  30.                                 ADDBYTE( pak, 0 );
  31.                                 thisclient->client->SendPacket(&pak);
  32.                             }
  33.  
  34.                              else if(useitem->itemnum==201)
  35.                             {
  36.                                 thisclient->once=true;
  37.                                 thisclient->timerxp=time(NULL)+60*60;
  38.                                 Log(MSG_INFO,"Bonus XP to %i",thisclient->bonusxp);
  39.                                 BEGINPACKET( pak, 0x702 );
  40.                                 ADDSTRING( pak, "Your 500% experience bonus will hold for one hour or until you log out." );
  41.                                 ADDBYTE( pak, 0 );
  42.                                 thisclient->client->SendPacket(&pak);
  43.                             }
  44.  
  45.                              else if(useitem->itemnum==202)
  46.                             {
  47.                                 thisclient->once=true;
  48.                                 thisclient->timerxp=time(NULL)+3600*3;
  49.                                 Log(MSG_INFO,"Bonus XP to %i",thisclient->bonusxp);
  50.                                 BEGINPACKET( pak, 0x702 );
  51.                                 ADDSTRING( pak, "Your 300% experience bonus will hold for three hours or until you log out." );
  52.                                 ADDBYTE( pak, 0 );
  53.                                 thisclient->client->SendPacket(&pak);
  54.                             }
  55.  
  56.                              else if(useitem->itemnum==203)
  57.                             {
  58.                                 thisclient->once=true;
  59.                                 thisclient->timerxp=time(NULL)+3600*3;
  60.                                 Log(MSG_INFO,"Bonus XP to %i",thisclient->bonusxp);
  61.                                 BEGINPACKET( pak, 0x702 );
  62.                                 ADDSTRING( pak, "Your 500% experience bonus will hold for three hours or until you log out." );
  63.                                 ADDBYTE( pak, 0 );
  64.                                 thisclient->client->SendPacket(&pak);
  65.                             }
  66.  
  67.                             else if(useitem->itemnum==204)
  68.                             {
  69.                                 thisclient->once=false;
  70.                                 thisclient->timerxp=time(NULL)+86400*5;
  71.                                 Log(MSG_INFO,"Bonus XP to %i",thisclient->bonusxp);
  72.                                 BEGINPACKET( pak, 0x702 );
  73.                                 ADDSTRING( pak, "Your 500% experience bonus will hold for five days." );
  74.                                 ADDBYTE( pak, 0 );
  75.                                 thisclient->client->SendPacket(&pak);
  76.                             }
  77.  
  78.                         }
  79.                         else
  80.                         {
  81.                             //LMA: Player already has a medal exp.
  82.                             BEGINPACKET( pak, 0x702 );
  83.                             ADDSTRING( pak, "You already have an exp bonus." );
  84.                             ADDBYTE( pak, 0 );
  85.                             thisclient->client->SendPacket(&pak);
  86.                             return NULL;
  87.                         }
RoseZa v437 - HueRose Test Project -- http://hueroseonline.no-ip.biz
kismetbecomes
Rackie
Rackie
 
Posts: 299
Joined: Mon Feb 06, 2012 12:41 am

Re: [devRev4] Status/Regeneration timers are broken.

Postby observe on Wed Apr 17, 2013 1:15 am

Even when its added it will not show the correct time.
The timers are still off (check server time for example)

the server time should be around -32m hours ^^
observe
osRose dev
osRose dev
 
Posts: 194
Joined: Thu Sep 17, 2009 10:28 am
Location: The Netherlands

Next

Return to Support - OsRose Emulator

Who is online

Users browsing this forum: No registered users and 7 guests

cron