[Untested]/go2 1-37

If you want to help us or give some corrections / codes, put it here ;)

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

[Untested]/go2 1-37

Postby CursedYew on Sat Mar 22, 2008 8:05 pm

Made cause people want to keep /go 1-10 so I decided I just make /go2 1-37. No level requirments and teleports van be done from 25%+ NOT 50%+. But it's still untested cause I can't compile :(
Lets get started! Note that this is my first actually code I dunno if I did it right.

In worldserver.cpp find:
  1.    Config.Command_Go = ConfigGetInt    ( "commands.ini", "go", 299 ); //change to 99 to give access for all players

Under it add:
  1.    Config.Command_Go2 = ConfigGetInt    ( "commands.ini", "go2", 299 ); //change to 99 to give access for all players


In sockets.h find:

Under it add:


In gmcmds.cpp find:
  1.            Log( MSG_GMACTION, " %s : /go %i" , thisclient->CharInfo->charname, loc);
  2.         }
  3.         return true;
  4.     }

Under it add:
  1.    else if (strcmp(command, "go2")==0) // AtCommandGo2
  2.     {
  3.         if(Config.Command_go2 > thisclient->Session->accesslevel)
  4.            return true;
  5.         if ((tmp = strtok(NULL, " ")) == NULL) tmp = 0; int loc=atoi(tmp);
  6.         if(Config.Command_Go2 > thisclient->Session->accesslevel)
  7.             return true;
  8.         int x = 0;
  9.         int y = 0;
  10.         int map = 0;
  11.         if(loc == 1)
  12.         {
  13.             map = 1;
  14.             x = 5242;
  15.             y = 5193;
  16.         }
  17.         else if(loc == 2)
  18.         {
  19.             map = 2;
  20.             x = 5655;
  21.             y = 5228;
  22.         }
  23.         else if (loc == 3)
  24.         {
  25.             map = 3;
  26.             x = 5198;
  27.             y = 5010;
  28.         }
  29.         else if (loc == 4)
  30.         {
  31.             map = 5;
  32.             x = 5201;
  33.             y = 5277;
  34.         }
  35.         else if (loc == 5)
  36.         {
  37.             map = 6;
  38.             x = 5201;
  39.             y = 5277;
  40.         }
  41.         else if (loc == 6)
  42.         {
  43.             map = 8;
  44.             x = 5160;
  45.             y = 5080;
  46.         }
  47.         else if (loc == 7)
  48.         {
  49.             map = 11;
  50.             x = 5160;
  51.             y = 5132;
  52.         }
  53.         else if (loc == 8)
  54.         {
  55.             map = 12;
  56.             x = 5160;
  57.             y = 5132;
  58.         }
  59.         else if (loc == 9)
  60.         {
  61.             map = 13;
  62.             x = 5160;
  63.             y = 5132;
  64.         }
  65.     else if (loc == 10)
  66.         {
  67.             map = 21;
  68.             x = 5158;
  69.             y = 5352;
  70.         }
  71.     else if (loc == 11)
  72.         {
  73.             map = 22;
  74.             x = 5112;
  75.             y = 5350;
  76.         }
  77.     else if (loc == 12)
  78.         {
  79.             map = 23;
  80.             x = 5351;
  81.             y = 5056;
  82.         }
  83.     else if (loc == 13)
  84.         {
  85.             map = 24;
  86.             x = 5379;
  87.             y = 5329;
  88.         }
  89.     else if (loc == 14)
  90.         {
  91.             map = 25;
  92.             x = 5377;
  93.             y = 5185;
  94.         }
  95.     else if (loc == 15)
  96.         {
  97.             map = 26;
  98.             x = 5278;
  99.             y = 5158;
  100.         }
  101.     else if (loc == 16)
  102.         {
  103.             map = 27;
  104.             x = 5479;
  105.             y = 4976;
  106.         }
  107.     else if (loc == 17)
  108.         {
  109.             map = 28;
  110.             x = 5205;
  111.             y = 4911;
  112.         }
  113.     else if (loc == 18)
  114.         {
  115.             map = 29;
  116.             x = 5093;
  117.             y = 5144;
  118.         }
  119.     else if (loc == 19)
  120.         {
  121.             map = 31;
  122.             x = 5516;
  123.             y = 5437;
  124.         }
  125.     else if (loc == 20)
  126.         {
  127.             map = 32;
  128.             x = 5435;
  129.             y = 5259;
  130.         }
  131.     else if (loc == 21)
  132.         {
  133.             map = 33;
  134.             x = 5605;
  135.             y = 5488;
  136.         }
  137.     else if (loc == 22)
  138.         {
  139.             map = 37;
  140.             x = 5184;
  141.             y = 5256;
  142.         }
  143.     else if (loc == 23)
  144.         {
  145.             map = 38;
  146.             x = 5074;
  147.             y = 5342;
  148.         }
  149.     else if (loc == 24)
  150.         {
  151.             map = 51;
  152.             x = 5362;
  153.             y = 5094;
  154.         }
  155.     else if (loc == 25)
  156.         {
  157.             map = 52;
  158.             x = 6079;
  159.             y = 5269;
  160.         }
  161.     else if (loc == 26)
  162.         {
  163.             map = 53;
  164.             x = 6229;
  165.             y = 5313;
  166.         }
  167.     else if (loc == 27)
  168.         {
  169.             map = 54;
  170.             x = 5094;
  171.             y = 4254;
  172.         }
  173.     else if (loc == 28)
  174.         {
  175.             map = 55;
  176.             x = 5789;
  177.             y = 4619;
  178.         }
  179.     else if (loc == 29)
  180.         {
  181.             map = 56;
  182.             x = 5035;
  183.             y = 5200;
  184.         }
  185.     else if (loc == 30)
  186.         {
  187.             map = 57;
  188.             x = 5540;
  189.             y = 5145;
  190.         }
  191.     else if (loc == 31)
  192.         {
  193.             map = 58;
  194.             x = 5680;
  195.             y = 4287;
  196.         }
  197.     else if (loc == 32)
  198.         {
  199.             map = 59;
  200.             x = 5102;
  201.             y = 5132;
  202.         }
  203.     else if (loc == 33)
  204.         {
  205.             map = 61;
  206.             x = 5431;
  207.             y = 4603;
  208.         }
  209.     else if (loc == 34)
  210.         {
  211.             map = 62;
  212.             x = 5666;
  213.             y = 5139;
  214.         }
  215.     else if (loc == 35)
  216.         {
  217.             map = 63;
  218.             x = 5407;
  219.             y = 4491;
  220.         }
  221.     else if (loc == 36)
  222.         {
  223.             map = 64;
  224.             x = 5197;
  225.             y = 5157;
  226.         }
  227.     else if (loc == 37)
  228.         {
  229.             map = 65;
  230.             x = 5395;
  231.             y = 5205;
  232.         }
  233.         else
  234.         {
  235.             SendPM(thisclient, "Please input a number after the go command, below is a list of places and their appropriate number");
  236.             SendPM(thisclient, "1 = Canyon City of Zant");
  237.             SendPM(thisclient, "2 = City of Junon Polis");
  238.             SendPM(thisclient, "3 = Dolphin Island");
  239.             SendPM(thisclient, "4 = Junon Cartel");
  240.             SendPM(thisclient, "5 = Crusader Training Camp");
  241.             SendPM(thisclient, "6 = Lion's Plains");
  242.             SendPM(thisclient, "7 = Junon Clan Field (30-49)");
  243.             SendPM(thisclient, "8 = Junon Clan Field (50-59)");
  244.             SendPM(thisclient, "9 = Junon Clan Field (69-89)");
  245.             SendPM(thisclient, "10 = Valley of Luxem Tower");
  246.             SendPM(thisclient, "11 = Adventurer's Plains");
  247.             SendPM(thisclient, "12 = Breezy Hills");
  248.             SendPM(thisclient, "13 = El Verloon Desert");
  249.             SendPM(thisclient, "14 = Anima Lake");
  250.             SendPM(thisclient, "15 = Forest of Wisdom");
  251.             SendPM(thisclient, "16 = Kenji Beach");
  252.             SendPM(thisclient, "17 = Gorge of Silence");
  253.             SendPM(thisclient, "18 = Desert of the Dead");
  254.             SendPM(thisclient, "19 = Goblin Cave (B1)");
  255.             SendPM(thisclient, "20 = Goblin Cave (B2)");
  256.             SendPM(thisclient, "21 = Goblin Cave (B3)");
  257.             SendPM(thisclient, "22 = Sunshine Coast");
  258.             SendPM(thisclient, "23 = Santa Planetoid");
  259.             SendPM(thisclient, "24 = Magic City of the Eucar");
  260.             SendPM(thisclient, "25 = Mana Snowfields");
  261.             SendPM(thisclient, "26 = Arumic Valley");
  262.             SendPM(thisclient, "27 = Crystal Snowfields");
  263.             SendPM(thisclient, "28 = Freezing Plateau");
  264.             SendPM(thisclient, "29 = Forgotten Temple (B1)");
  265.             SendPM(thisclient, "30 = Forgotten Temple (B2)");
  266.             SendPM(thisclient, "31 = Mount Eruca");
  267.             SendPM(thisclient, "32 = Luna Clan Field");
  268.             SendPM(thisclient, "33 = Refuge Xita");
  269.             SendPM(thisclient, "34 = Shady Jungle");
  270.             SendPM(thisclient, "35 = Forest of Wandering");
  271.             SendPM(thisclient, "36 = Marsh of Ghosts");
  272.             SendPM(thisclient, "37 = Sikuku Underground Prison");
  273.             SendPM(thisclient, "Example; /go2 13");
  274.         }
  275.         if ( thisclient->Stats->HP < (thisclient->Stats->MaxHP / 4) || thisclient->Stats->HP < 1 || thisclient->Session->inGame == false )
  276.         {
  277.              SendPM(thisclient, "You need at least 25% HP in order to warp");
  278.              return true;
  279.         }
  280.  
  281.         if( (x != 0) && (y != 0) && (map != 0) )
  282.         {
  283.             fPoint coord;
  284.             coord.x = x;
  285.             coord.y = y;
  286.             MapList.Index[map]->TeleportPlayer( thisclient, coord, false );
  287.             Log( MSG_GMACTION, " %s : /go2 %i" , thisclient->CharInfo->charname, loc);
  288.         }
  289.         return true;
  290.     }


In commands.ini find:
  1. Go=299 //change to 99 to give access for all player

Under it add:
  1. Go2=299 //change to 99 to give access for all players


If someone could compile this into an unedited osRose v80 and upload for me that would be very nice :)
CursedYew
Little soul
Little soul
 
Posts: 2
Joined: Sat Mar 22, 2008 2:40 pm

Re: [Untested]/go2 1-37

Postby core on Sun Mar 23, 2008 4:44 am

I would suggest to use a switch instead of using else if here. If you want more information about the advantages, go to the following page: http://www.kevinboone.com/ctut_switch.html.

A small example on how it could be done:
  1. switch(loc)
  2. {
  3.     case 1:
  4.         map = 1;
  5.         x = 5242
  6.         y = 5193;
  7.     break;
  8.     case 2:
  9.         map = 3;
  10.         x = 5655;
  11.         y = 5010;
  12.     break;
  13.    // add more here
  14.   ///////////////
  15.   default:
  16.       SendPM(thisclient, "1 = Canyon City of Zant");
  17.       SendPM(thisclient, "2 = City of Junon Polis");
  18.   // add more here
  19.  ///////////////
  20. };
Image
User avatar
core
Pomic
Pomic
 
Posts: 126
Joined: Thu Aug 09, 2007 5:47 pm

Re: [Untested]/go2 1-37

Postby BlackLousky on Sat Apr 19, 2008 10:39 pm

Tested and modified on OsiRose rev.69 / client osiRose Dev Team 131 :

GMcommand go2 : 43 locations

Image
BlackLousky
Little soul
Little soul
 
Posts: 8
Joined: Sat Apr 19, 2008 8:50 pm

Re: [Untested]/go2 1-37

Postby Aceadam on Mon Apr 21, 2008 9:10 pm

BlackLousky u own a server? would love to try it out lol
Aceadam
Jelly Bean
Jelly Bean
 
Posts: 10
Joined: Thu Aug 09, 2007 5:39 pm

Re: [Untested]/go2 1-37

Postby BlackLousky on Wed Apr 23, 2008 9:45 pm

I only have a localhost server.

Fan of iRose, i want 1 for my own pleasure.

I have no intention to make an online Pserv'.

My goal is to have 1 without bugs - at less really playable.

I never used c++ before, so i begin with easy part (GMcommand) in server modification.
This week-end, i made my first try with this go2 code.

If i have time, i will try to do more important things in the code.


'coz it's easy, if someone want a personnalised GMcommand, you can ask.
BlackLousky
Little soul
Little soul
 
Posts: 8
Joined: Sat Apr 19, 2008 8:50 pm

Re: [Untested]/go2 1-37

Postby Sethanye on Wed Apr 23, 2008 9:48 pm

well editing a command isnt hard to be honest, but if you want to program one from scratch you need to know a bit more than just the basics, though i must admit i learned a lot just from rose, though i dont use c++ at all
~ Learning Flash ~ Anyone Know Any Good Tutorial DVDs? ~
Image
"Come Into My Dream, Let Me Show You Where I've Been.
Its You And Me I've Seen, Let Me Tell You What I Mean."
User avatar
Sethanye
Neko Chan
Neko Chan
 
Posts: 2603
Joined: Fri Jan 18, 2008 11:23 am
Location: ~ Resident Graphics Artist ~


Return to Submit Code

Who is online

Users browsing this forum: No registered users and 2 guests

cron