Page 1 of 1

dev rev-4 rose

PostPosted: Fri Aug 07, 2015 11:08 am
by harem
online for 3 mounts..
please give me info if there is a bug in my server..
and who need client for dev-rev4, can download at http://rosehero.com/do-mode-client.html

Re: dev rev-4 rose

PostPosted: Sun Aug 09, 2015 9:24 pm
by PurpleYouko
Are your timed quests working?
During development of DR4 we never solved that problem for the client version we were using. The code still does it the old way so if you are using a client from before the timer format change then it would still work.

Re: dev rev-4 rose

PostPosted: Mon Aug 10, 2015 3:06 am
by harem
quest test at npc Lampa, for "quest Jelly bean Roundup", timed runs, although not 100% as it should be.
I have to change some code in playerfunction.cpp the function "SendQuestUpdate ()";
  1.  
  2.     long int waktu2=time(NULL)-131076;
  3.     long int waktu3=time(NULL)-waktu2;
  4.  
  5.     BEGINPACKET (pak, 0x723);
  6.     for(dword i = 0; i < 5; i++) ADDWORD( pak, quest.EpisodeVar[i]);
  7.     for(dword i = 0; i < 3; i++) ADDWORD( pak, quest.JobVar[i]);
  8.     for(dword i = 0; i < 7; i++) ADDWORD( pak, quest.PlanetVar[i]);
  9.     for(dword i = 0; i < 10; i++) ADDWORD( pak, quest.UnionVar[i]);
  10.  
  11.     for( unsigned i = 0; i < 10; i++ )
  12.     {
  13.         ADDWORD( pak,  quest.quests[i].QuestID );
  14.         long int Time = 0;
  15.         //Log( MSG_DEBUG, "Initialized Time");
  16.         //Log( MSG_DEBUG, "This Quest quest id = %i",quest.quests[i].QuestID);
  17.         //Log( MSG_DEBUG, "This Quest timer = %i",GServer->STB_QUEST.rows[quest.quests[i].QuestID][1]);
  18.         if (quest.quests[i].QuestID > 0 && GServer->STB_QUEST.rows[quest.quests[i].QuestID][1] > 0)
  19.         {
  20.             //Log( MSG_DEBUG, "This Quest timer = %i",GServer->STB_QUEST.rows[quest.quests[i].QuestID][1]);
  21.             Time += quest.quests[i].StartTime; // Start time
  22.             //Log( MSG_DEBUG, "start time = %i",quest.quests[i].StartTime);
  23.             //Time += GServer->STB_QUEST.rows[quest.quests[i].QuestID][1] * 1000; // Time to finish
  24.             Time+= GServer->STB_QUEST.rows[quest.quests[i].QuestID][1]*10;
  25.             //Log( MSG_DEBUG, "time at finish = %i",Time);
  26.             Time -= time(NULL); // Current time
  27.             //Log( MSG_DEBUG, "current time = %i",time(NULL));
  28.             if (Time < 0) Time = 0; // Time is up
  29.             else
  30.             {
  31.                 Time /= 10;
  32.                 Time += waktu3;
  33.             }
  34.             //Time+= GServer->STB_QUEST.rows[quest.quests[i].QuestID][1];
  35.  
  36.             //Time /= 10; // Divide to get 10's of seconds
  37.  
  38.             //1374230282
  39.             //long int timeawal = 1374230282-GServer->Config.hitungan;
  40.             //Time = time(NULL)-timeawal;
  41.             //nol /nol 131086
  42.             //Time = 131086;
  43.             //Time+= GServer->STB_QUEST.rows[quest.quests[i].QuestID][1];
  44.             //Time = ((GServer->STB_QUEST.rows[quest.quests[i].QuestID][1]/60)*GServer->Config.hitungan);
  45.  
  46.             //Log( MSG_DEBUG, "This Quest time remaining = %i",Time-waktu3);
  47.         }
  48. ............................................................
  49.  

I hope there is a coder who can provide input to further make this "quest timer" a more perfect.

Re: dev rev-4 rose

PostPosted: Tue Aug 11, 2015 2:22 pm
by PurpleYouko
The problem that we encountered is that they changed the way that timers worked.
They used to be simple. Just a value for remaining seconds.
Then they decided to take a leaf out of Microsoft's date recognition system. All dates and times in microsoft are stored as seconds since 0:00 (midnight) on jan 1st 1900
Rose decided to use a similar system but instead of Jan 1 1900 they used the date on which they opened their doors. I think it was September 1st 2006 but I could be remembering that wrong. it has been a couple of years since i worked on this. They also modified the packet structure to make this timer value a DWORD rather than a WORD (if i remember correctly) so all the rest of the stuff in the packet is pushed back 2 bytes.

So now when you start a timed quest it adds the duration of the quest to the number of seconds since opening day and stores that in it's system. The opening day will always be a constant so recoding it it shouldn't be all that hard.
I don't have the time to do it myself.

Looks like your code is doing something along these lines already

Re: dev rev-4 rose

PostPosted: Fri Aug 14, 2015 6:32 am
by harem
After check and do some test, i think we must mark time every player do event at :pakdoid();
then get time amount from pakdoid to start new quest;
and add it to time formula that send to client.
this is my change and time send to client more better then above code;
  1.  
  2.     long int lastdoid_times = 0;
  3.     long int databatasquest = 1310720;
  4.  
  5.     BEGINPACKET (pak, 0x723);
  6.     for(dword i = 0; i < 5; i++) ADDWORD( pak, quest.EpisodeVar[i]);
  7.     for(dword i = 0; i < 3; i++) ADDWORD( pak, quest.JobVar[i]);
  8.     for(dword i = 0; i < 7; i++) ADDWORD( pak, quest.PlanetVar[i]);
  9.     for(dword i = 0; i < 10; i++) ADDWORD( pak, quest.UnionVar[i]);
  10.  
  11.     for( unsigned i = 0; i < 10; i++ )
  12.     {
  13.         ADDWORD( pak,  quest.quests[i].QuestID );
  14.         long int Time = 0;
  15.  
  16.         if (quest.quests[i].QuestID > 0 && GServer->STB_QUEST.rows[quest.quests[i].QuestID][1] > 0)
  17.         {
  18.             Time += quest.quests[i].StartTime; // Start time
  19.             Time += GServer->STB_QUEST.rows[quest.quests[i].QuestID][1]*10;
  20.             Time -= time(NULL); // Current time
  21.             if (Time < 0) Time = 0; // Time is up
  22.  
  23.             lastdoid_times = (time(NULL)-Status->awalstartquest); //awalstartquest = time when player do pakdoid.
  24.             Time += databatasquest+lastdoid_times;
  25.             Time = Time/10;
  26.         }
  27.         ADDDWORD( pak, Time ); // Time Left
  28.  


note: this code test on local server and single player.