Go command

What features would you like to see in future releases?

Go command

Postby rl2171 on Thu Aug 25, 2016 6:23 pm

I see the GO command in the code, but are you able to add the one that uses the SQL database instead that I placed into some of the other osRose versions?

Also, unless I missed it, the CG_Cart command is in the GM Commands, but I don't see the SQL file for it.
Image
rl2171
Admin
Admin
 
Posts: 1706
Joined: Mon Aug 06, 2007 5:17 pm
Location: Sacramento, CA USA - GMT-8

Re: Go command

Postby PurpleYouko on Thu Aug 25, 2016 8:15 pm

There was an sql file named something along those lines that was for loading in the entire LIST_PAT.STB file in sql format.

I don't remember ever seeing a GM command like that.

Just found one by the name of /cart and it does appear to be calling for an sql file

Added the sql into the repo

It should be possible to modify the GO command to use the sql table. However i don't have any code for loading it or using it. Or the table itself for that matter.
What rev server was that used in?
This is a very old (about rev 81) server combined with my KTRose pre-evo code and then custom built from there up. It doesn't have a whole lot in common with later revisions at all.
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: 4719
Joined: Fri Aug 10, 2007 2:05 pm

Re: Go command

Postby rl2171 on Thu Aug 25, 2016 9:35 pm

I know I added it before in versions.

Here is the info on it

viewtopic.php?f=21&t=4867

It was easier to add go locations into the sql file than to make changes and recompile in the code is why it was added.

Hopefully I will attach the Go sql file I used in KTRose on my server

list_golist.zip
go sql file
(1.15 KiB) Downloaded 301 times


Hope this helps.

Rob
Image
rl2171
Admin
Admin
 
Posts: 1706
Joined: Mon Aug 06, 2007 5:17 pm
Location: Sacramento, CA USA - GMT-8

Re: Go command

Postby rl2171 on Fri Aug 26, 2016 8:20 pm

Here is what I was attempting to replace from the original code to use SQL for the GO.

  1.      
  2.     if (strcmp(command, "go")==0) // Use SQL by Likol
  3.     {
  4.         if(Config.Command_Go > thisclient->Session->accesslevel) return true;
  5.         {
  6.         DB->QFree( );
  7.         return true;
  8.         }
  9.         if ((tmp = strtok(NULL, " ")) == NULL) tmp = 0;
  10.         int loc = atoi(tmp);
  11.         int x = 0;
  12.         int y = 0;
  13.         int map = 0;
  14.         MYSQL_ROW row;
  15.         MYSQL_RES *result = NULL;
  16.         result = DB->QStore("SELECT lvlmin,map,locx,locy,mapname,lvlmax FROM list_golist WHERE isactive=1 AND loc=%i",loc);
  17.         row = mysql_fetch_row(result);
  18.         if (row==NULL)
  19.         {
  20.             SendPM(thisclient, "Please input a number after the go command, below is a list of places and their appropriate number");
  21.             DB->QFree( );
  22.             result = DB->QStore("SELECT loc,mapname FROM list_golist WHERE isactive=1");
  23.             while(row = mysql_fetch_row(result)) SendPM(thisclient, "%i = %s",atoi(row[0]),row[1]);
  24.             SendPM(thisclient, "Example; /go 1");
  25.             DB->QFree( );
  26.             return true;
  27.         }
  28.         else
  29.         {
  30.             if (thisclient->Stats->Level<atoi(row[0]))
  31.             {
  32.                 SendPM(thisclient, "You need to be a least Level %i to visit %s!",atoi(row[0]),row[4]);
  33.                 DB->QFree( );
  34.                 return true;
  35.             }
  36.             if (thisclient->Stats->Level>atoi(row[5]))
  37.             {
  38.                 SendPM(thisclient, "You need to be between Level %i and %i to visit %s !",atoi(row[0]),atoi(row[5]),row[4]);
  39.                 DB->QFree( );
  40.                 return true;
  41.             }
  42.             if ( thisclient->Stats->HP < (thisclient->Stats->MaxHP / 2) || thisclient->Stats->HP < 1 || thisclient->Session->inGame == false )
  43.             {
  44.                     SendPM(thisclient, "You need at least 50% HP in order to warp");
  45.                     DB->QFree( );
  46.                     return true;
  47.             }
  48.            fPoint coord;
  49.             int map = atoi(row[1]);
  50.             coord.x = atoi(row[2]);
  51.             coord.y = atoi(row[3]);
  52.             SendPM(thisclient, "teleport to map: %i",map);
  53.             MapList.Index[map]->TeleportPlayer( thisclient, coord, false );
  54.             Log( MSG_GMACTION, " %s : /go %i" , thisclient->CharInfo->charname, loc);
  55.             DB->QFree( );
  56.             return true;      
  57.         }
  58.     }
  59.  
  60.  


Found the issue, now going to test the code :)

Update, either I have VS2010 setup wrong, or did something wrong, the worldserver is crashing.
Image
rl2171
Admin
Admin
 
Posts: 1706
Joined: Mon Aug 06, 2007 5:17 pm
Location: Sacramento, CA USA - GMT-8

Re: Go command

Postby PurpleYouko on Fri Aug 26, 2016 9:26 pm

It will be something in your settings.
Up until now I think only one other person has managed to compile and run my servers successfully.
I have no idea why it's so difficult. It worked first time when I took the code home and compiled it there.

Also wouldn't it be more efficient to load the list at the serer start up rather than reloading it each time somebody types /go?
It would be pretty easy to set up a struct and then load it all into a vector at startup.

Maybe I'll take a look at it and code something up next week. ;)
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: 4719
Joined: Fri Aug 10, 2007 2:05 pm

Re: Go command

Postby rl2171 on Fri Aug 26, 2016 9:34 pm

I am not sure why it loads right off hand when someone types go.

Maybe so you can change the SQL at anytime while the server is running and it will be there right away? Just a guess.

I only added many more locations to the SQL file was about all I did, besides adding it to the server files.

I will try installing VS2010 on my home computer when I get home, I think there was something during the install that I said no to, so this time I will say yes and then see what happens :) I'll let you know the end result then.
Image
rl2171
Admin
Admin
 
Posts: 1706
Joined: Mon Aug 06, 2007 5:17 pm
Location: Sacramento, CA USA - GMT-8


Return to Wish List

Who is online

Users browsing this forum: No registered users and 1 guest

cron