Rev Whatever --- It's the last version we used at RoseZA

Welcome in the osRose emulator Project.

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

Re: KTRose Source code release

Postby PurpleYouko on Thu Jan 12, 2017 7:10 pm

I would define MSG_QUESTDEBUG myself if I knew how. :-S

Soooo I tried a mix of your code and the one I had in there, but of course it then does more errors.


OOPSY Sorry about that
The MSG_QUESTDEBUG option is something I just added.
If you would like to add it for yourself you can do it very easily. Here is how
first go to Log.h and find this code
  1.  
  2. // Error Types
  3. enum msg_type {
  4.     MSG_NONE,
  5.     MSG_STATUS,
  6.     MSG_SQL,
  7.     MSG_INFO,
  8.     MSG_NOTICE,
  9.     MSG_WARNING,
  10.     MSG_DEBUG,
  11.     MSG_ERROR,
  12.     MSG_FATALERROR,
  13.     MSG_HACK,
  14.     MSG_LOAD,
  15.     MSG_SDEBUG,
  16.     MSG_GMACTION,
  17.     MSG_START,
  18.     MSG_QUERY,
  19.     MSG_CONSOLE,
  20.     MSG_QUESTDEBUG
  21. };

Of course you won't have MSG_QUESTDEBUG at the bottom of your list so add it
Then you need to go into Log.cpp and find some code that looks like this
  1.  
  2. case MSG_LOAD:
  3.                         textcolor(BROWN);
  4.                         sprintf(msgtype,"%s","[LOADING]: ");
  5.                         printf("%s",msgtype);
  6.                         break;
  7.                 case MSG_GMACTION:
  8.                         textcolor(MAGENTA);
  9.                         sprintf(msgtype,"%s","[GM ACTION]: ");
  10.                         printf("%s",msgtype);
  11.                         break;
  12.                 case MSG_QUESTDEBUG:
  13.                         textcolor(LIGHTBLUE);
  14.                         sprintf(msgtype,"%s","[QUEST DEBUG]: ");
  15.                         printf("%s",msgtype);
  16.                         break;

It's just a long list of case statements. I've only shown the last few here, including the one I added to the bottom to output log messages for MSG_QUESTDEBUG
I just wanted my quest debugging to stand out from the rest of the messages in the console

Yes, I see the quest window do not show the proof of exterminations.
Still investigating things.

When I logged off, then back in, I got the reward (it seems) for the 10 Flanae quest, and the quest is gone from my list, while this didn't happen while I was killing the Flanae in the first place.

The thing is that the server is crediting you with the proof of extermination but the client is never receiving instructions to display it as it happens. Basically, the correct packet is not being sent. When you log back in, the data that the server already has is sent to the client and it's all good again.
In order to fix it we have to first understand the way that quests are handled (which is all kinds of messed up TBH)
Basically it goes like this

  1. first you kill a monster and then it runs function GiveExp() in WorldProcesses.cpp. In this function it scans your quest array and compares each of them to the "dies_quest" value of the monster you just killed. If it finds a match it means that one of your quests was asking for that particular monster so it goes on to give your reward. Up to this point no problem it all works great
  2. The server sends an 0x0731 packet to the client containing the Monster ID of the monster that you killed.
  3. The Client takes that value and returns a hash value of it in a 0x0730 packet
  4. The server receives this packet and runs pakGiveQuest() which runs the local QSD code to determine if you get a reward or not. Often the chance of getting it is not 100% so yo won't always get one.
  5. This is where it starts to go wrong. there is a whole lot of Lmame's code in there at this point that has a nasty tendency to reject perfectly good quests. I had to completely re-write pakGiveQuest() to make it work properly. Additionally there is a logical flaw in the way it handles incoming 0x0730 packets but I won't go into that in detail.
  6. At this point (assuming it has got through the stupid rejection code) it gives your quest reward and [i]should[/] send a 0x0730 packet back to the client before calling function SendQuestUpdate() which sends another packet that actually makes the client display the quest items. Except that for pretty much all monster extermination quests it never gets this far

So one of the ridiculous things about this whole deal is that it is completely pointless to send the 0x0731 packet to the client in the first place. We already know the hash value that it will send back :?
The reason it was designed that way was most likely to minimize the amount of QSD code that is run in the main loop so it does serve a small purpose in that way by shifting the QSD execution into a function that is called externally to the main loop. It's still really pointless though because it adds unnecessary packets and it's really easy to get rid of it just by modifying the code in GiveEXP()

This is the code that will make it send the quest update properly
WorldProcesses.cpp
  1. if( thismon->MonsterDrop->firsthit == thisclient->CharInfo->charid )
  2.             {
  3.                 for( int q=0;q<10;q++)
  4.                 {
  5.                     // Give Quest Item
  6.                     if( thisclient->quest.quests[q].QuestID!=0 )
  7.                     {
  8.                         //PY why not just run the QSD?? That's what it's there for. die_quest is already a hash
  9.                         if(thisclient->questdebug)
  10.                             Log(MSG_QUESTDEBUG,"Recieving exp. now run die quest %i",thismon->die_quest);
  11.                         int success = thisclient->ExecuteQuestTrigger(thismon->die_quest,true);
  12.  
  13.                         // 0x0731 sends the monster id to the client
  14.                         //BEGINPACKET( pak, 0x731 )
  15.                         //ADDWORD    ( pak, thismon->montype );
  16.                         //thisclient->client->SendPacket( &pak );
  17.                         //bypassing the 731 altogether to see what happens
  18.                         if (success == QUEST_SUCCESS)
  19.                         {
  20.                             if(thisclient->questdebug)
  21.                                 Log(MSG_QUESTDEBUG,"QSD Success now sending the 0x0730 packet");
  22.                             BEGINPACKET ( pak, 0x730);
  23.                             ADDBYTE ( pak, success);
  24.                             ADDBYTE ( pak, q);
  25.                             ADDDWORD( pak, thismon->die_quest);
  26.                             thisclient->client->SendPacket(&pak);
  27.                             //updating client side quest data (hopefully)
  28.                             thisclient->SendQuestUpdate();
  29.                         }
  30.                         break;
  31.                     }
  32.                 }
  33.             }

Just find that section of the GiveEXP() function and modify it. It's pretty easy to find. The original code is still there in my code snippet, just commented out

If you JUST do this one thing you might well find that you start to get TWO messages saying that you exterminated the monster rather than NONE :D
So there is one more thing you will need to do
Go to PlayerFunctions.cpp and find a function called int CPlayer::ExecuteQuestTrigger(dword hash,bool send_packet, UINT index)
then find this bit of code
  1. if(send_packet&&success == QUEST_SUCCESS)
  2.     {
  3.         if( GServer->questdebug )
  4.         Log(MSG_QUESTDEBUG, "ExecuteQuestTrigger:: QSD returned success. Sending 0x730 for questid %u for slot %i",hash, index);
  5.         BEGINPACKET ( pak, 0x730);
  6.         ADDBYTE ( pak, success);
  7.         ADDBYTE ( pak, index);
  8.         ADDDWORD( pak, hash);
  9.         client->SendPacket(&pak);
  10.     }
and comment it completely out
It's absolutely not necessary for that packet to ever be sent from that location in the code.

The way I fixed it all for myself is a little more complicated than this but what I have posted here should get the job done. :D
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
User avatar
PurpleYouko
Rose Guru
Rose Guru
 
Posts: 4550
Joined: Fri Aug 10, 2007 2:05 pm

Re: KTRose Source code release

Postby NewMilenium on Thu Jan 12, 2017 7:29 pm

Done,
result :
[PATH]\RoseZA SVN\SVN\trunk\World Server\quest\Quests.cpp||In member function 'void CWorldServer::ExportQSDDataA(byte*, int, int)':|
[PATH]\RoseZA SVN\SVN\trunk\World Server\quest\Quests.cpp|1492|error: 'struct STR_REWD_029' has no member named 'unk1'|
[PATH]\RoseZA SVN\SVN\trunk\World Server\quest\Quests.cpp|1492|error: 'struct STR_REWD_029' has no member named 'unk2'|
||=== Build finished: 2 errors, 0 warnings (0 minutes, 38 seconds) ===|


code involved :

  1.    //LMA: Lua?
  2.     if(opcode==29)
  3.     {
  4.         STR_REWD_029 * data = (STR_REWD_029 *)dataorg;
  5.         char* tempName = reinterpret_cast<char*>(&data->LuaName)-2;
  6.         LogSp(MSG_INFO,"\t\t\t\t\t ACT %.3i: execute Lua %s (unk1=%u, unk2=%u) (NOT CODED, CLIENT SIDE ONLY?)",opcode,tempName,data->unk1,data->unk2);
  7.         return;
  8.     }




I'm gonna stop working on the other worldserver, because this one will be different anyway when we succeed into building it.
Thanks for your help Youko. I got it all understood. You know, on a personal note, I love those explanations because I understand then what's going on. But I still wouldn't be able to figure it all out by myself, or rather, it would take me days and days of works.


I noticed code involving your TD monster gen', but it's not the same as the one here, sooooo I'm not sure what to comment to have Zant working again (in the case it doesn't work like the other one when this WorldServer is built)...


Unrelated : something scary is, I had to add a column "item_drop_rate" in list_config, while "drop_rate" already existed. I wonder how this is going to work out.
NewMilenium
Jelly Bean
Jelly Bean
 
Posts: 32
Joined: Wed Jan 04, 2017 12:54 pm

part 3

Postby PurpleYouko on Thu Jan 12, 2017 8:33 pm

LogSp(MSG_INFO,"\t\t\t\t\t ACT %.3i: execute Lua %s (unk1=%u, unk2=%u) (NOT CODED, CLIENT SIDE ONLY?)",opcode,tempName,data->unk1,data->unk2);

You might as well just comment this line out completely. It doesn't really serve any useful purpose.
It's some kind of log that lmame added at some point. I don't even know where the file goes :D
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
User avatar
PurpleYouko
Rose Guru
Rose Guru
 
Posts: 4550
Joined: Fri Aug 10, 2007 2:05 pm

Re: KTRose Source code release

Postby NewMilenium on Thu Jan 12, 2017 9:03 pm

It compiled!
I connected, tried to attack : same issue than before.
Zant : crashing again.
NewMilenium
Jelly Bean
Jelly Bean
 
Posts: 32
Joined: Wed Jan 04, 2017 12:54 pm

Re: KTRose Source code release

Postby PurpleYouko on Thu Jan 12, 2017 9:15 pm

does it crash anywhere other than Zant? I've had reports of the /go 2 command crashing when you go to Zant and even sometimes crashing just when you run into the town
I will look into that at some point when I get the time

how about combat now?
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
User avatar
PurpleYouko
Rose Guru
Rose Guru
 
Posts: 4550
Joined: Fri Aug 10, 2007 2:05 pm

Re: KTRose Source code release

Postby NewMilenium on Thu Jan 12, 2017 9:21 pm

I'm investigating again actively now, 9:32 GMT (time of edit, not of post) and ~next couple hours.

edit : I don't know why I failed last time, but it WAS the same code than brokenshadows, so I managed to comment the same lines, and so far attack work again... trying Zant...
Zant working!! :)

The attack don't work again!!... it seems so random...

Current issues,
1) sometimes when starting the server, it won't allow any player attack nor skill.
2) no drop at all.
3) when I learn a skill, it doesn't show anywhere (and so, does not permit me to equip it nor to improve it) if I don't have the usually-required job (which, in my case, is NOT required, I removed requirements). About that third issue, I guess solving it is a bit complicated; it will require to change the code to allow the game to list all skills regardless of the jobs...


Regarding the no-drop problem :
what does

do please? A random but how?
I found the drop action is in AiActions.cpp , line 800, "AIACT(017)"...

And I found this in battle.cpp :

  1. if(!Enemy->IsSummon( ) && !Enemy->IsPlayer( ))
  2.         {
  3.             //LMA: looping the drops (double drop medal for example).
  4.             int nb_drops = GServer->Config.ItemDropRate;
  5.             if (IsPlayer())
  6.             {
  7.                 CPlayer* plkiller=(CPlayer*) this;
  8.                 nb_drops += plkiller->bonusddrop + Stats->itemdroprate;
  9.                 if(GServer->ServerDebug)
  10.                     Log(MSG_INFO,"Drop time, there should be %i drops",nb_drops);  // should be 1 with default settings (no medals)
  11.             }
  12.  
  13.             //No drop if already dead and drop done.
  14.             if(Enemy->drop_dead)
  15.             {
  16.                 if(GServer->ServerDebug)
  17.                     Log(MSG_WARNING,"Trying to make a monster (CID %u, type %u) drop again but already did.",Enemy->clientid,Enemy->char_montype);
  18.                 nb_drops=0;
  19.             }
  20.  
  21.             for (int k=0;k<nb_drops;k++)
  22.             {
  23.                 thisdrop = Enemy->GetDrop( );
  24.                 if(thisdrop!=NULL)
  25.                 {
  26.                     if(GServer->ServerDebug)
  27.                         Log(MSG_INFO,"Dropping Nb %i",k);
  28.                     CMap* map = GServer->MapList.Index[thisdrop->posMap];
  29.                     map->AddDrop( thisdrop );
  30.                 }
  31.  
  32.             }


But I'm not sure how to check if it works as intended / if it's normal to have a condition "if(Enemy->drop_dead)"...
NewMilenium
Jelly Bean
Jelly Bean
 
Posts: 32
Joined: Wed Jan 04, 2017 12:54 pm

Rev Whatever --- It's the last version we used at RoseZA

Postby PurpleYouko on Thu Jan 12, 2017 9:25 pm

This stuff has been getting some notice lately and in all the wrong places too so I'm starting this thread to bring it together again
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
User avatar
PurpleYouko
Rose Guru
Rose Guru
 
Posts: 4550
Joined: Fri Aug 10, 2007 2:05 pm

Re: Rev Whatever --- It's the last version we used at RoseZA

Postby Exordium on Fri Jan 13, 2017 2:19 am

where is it purple?
Exordium
Smoulie
Smoulie
 
Posts: 67
Joined: Tue Sep 25, 2012 11:10 am

Re: Rev Whatever --- It's the last version we used at RoseZA

Postby PurpleYouko on Fri Jan 13, 2017 4:35 pm

The site crashed on me before I could split out the posts from the KTRose thread. lol

I've copied it all into this thread now
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
User avatar
PurpleYouko
Rose Guru
Rose Guru
 
Posts: 4550
Joined: Fri Aug 10, 2007 2:05 pm

Re: Rev Whatever --- It's the last version we used at RoseZA

Postby NewMilenium on Fri Jan 13, 2017 5:00 pm

Yep, makes sense.

I've spent a lot of time searching and trying things, but the attack problem seems very new, no thread talks about it.
About the drops, I think it should be find-able by adding some debugging messages...

If anyone has any answer to my last post (before this one), he's welcome!


edit : and right now attacks work again. And guess what, mobs drop nothing, and when they die :
"WARNING : TD monster died. Current TD Monster Count is 0"
NewMilenium
Jelly Bean
Jelly Bean
 
Posts: 32
Joined: Wed Jan 04, 2017 12:54 pm

PreviousNext

Return to Support - OsRose Emulator

Who is online

Users browsing this forum: No registered users and 1 guest

cron