DEV V Fixes

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

DEV V Fixes

Postby AnimalCrackerz on Fri May 16, 2014 2:55 pm

Ok so great work Vetyst! Made a few fixes they do work on my server but my coding skills are beginner so it might be messy

so this in World Packets
  1. // Observe: Buy Spins
  2. bool CWorldServer::pakLuckySpinBuy ( CPlayer* thisclient, CPacket* P )
  3. {
  4.     DWORD spins = GETDWORD((*P), 0);
  5.  
  6.     if(thisclient->CharInfo->Itemmall < spins*10 )
  7.     {
  8.         BEGINPACKET ( pak, 0x7f0 );
  9.         ADDBYTE     ( pak, 2 );
  10.         ADDDWORD    ( pak, thisclient->CharInfo->LuckySpins );
  11.         thisclient->client->SendPacket( &pak );
  12.         Log(MSG_WARNING,"%s tried buying spins with %i Points", thisclient->CharInfo->charname, thisclient->CharInfo->Itemmall);
  13.     } else {
  14.         thisclient->CharInfo->Itemmall   -= spins*10;
  15.         thisclient->CharInfo->LuckySpins += spins;
  16.         BEGINPACKET ( pak, 0x7f0 );
  17.         ADDBYTE     ( pak, 1 );
  18.         ADDDWORD    ( pak, thisclient->CharInfo->LuckySpins );
  19.         ADDDWORD    ( pak, thisclient->CharInfo->Itemmall );
  20.         thisclient->client->SendPacket( &pak );
  21.  
  22.         {
  23.     GServer->DB->QStore("SELECT itemmall_points FROM accounts WHERE lastchar='%s'", thisclient->CharInfo->charname);
  24.     Log(MSG_INFO,"%s's iPoints: %i", thisclient->CharInfo->charname, thisclient->CharInfo->Itemmall);
  25.     GServer->DB->FreeResult( );
  26.  
  27.         RESETPACKET( pak, 0x7c9 ); // Send Itemmall Points to client
  28.         ADDBYTE    ( pak, 0 );
  29.         ADDQWORD   ( pak, thisclient->CharInfo->Itemmall );
  30.         thisclient->client->SendPacket( &pak);
  31.         }
  32.  
  33.     }
  34.     return true;
  35. }
  36.  


and in World Server
  1. // Incoming packet
  2. bool CWorldServer::OnReceivePacket( CClientSocket* thisclient, CPacket *P )

we enter this packet
  1.        case 0x7c9: return pakLuckySpinBuy     ( (CPlayer*)thisclient->player, P );//we activate this packet


this should now deduct itemmall points properly and update the amount so when you log back in the points dont return
Last edited by AnimalCrackerz on Sun May 18, 2014 4:11 pm, edited 1 time in total.
AnimalCrackerz
Pomic
Pomic
 
Posts: 102
Joined: Tue Apr 20, 2010 1:58 pm

Re: DEV V Fixes

Postby AnimalCrackerz on Fri May 16, 2014 3:09 pm

World server gives gate hacking error when going thru a gate on a mount..to another map..client freezes.

So in World Packets replace pak gate with this;

  1. //Drakia's telegate hacker fix - needs testing.  Comment above and uncomment below for test
  2. // Goto next map through gate
  3. bool CWorldServer::pakGate( CPlayer* thisclient, CPacket* P )
  4. {
  5.     thisclient->Session->inGame = false;
  6.     word GateID = GETWORD((*P), 0x00);
  7.  
  8.     //LMA: new way.
  9.     bool is_hack=true;
  10.     fPoint position;
  11.     UINT map = 0;
  12.     CTeleGate* thisgate=NULL;
  13.     CTeleGate* lastgate=NULL;
  14.  
  15.     for (int k=0;k<6;k++)
  16.     {
  17.         thisgate = GetTeleGateByID( GateID,k);
  18.  
  19.             if (thisclient->Status->Stance==MOUNTED);
  20.             {
  21.             BEGINPACKET ( pak, 0x858 );
  22.             ADDWORD     ( pak, thisclient->clientid );
  23.             ADDDWORD    ( pak, 0 );
  24.             ADDBYTE     ( pak, 0 );
  25.             ADDDWORD    ( pak, thisclient->Stats->Base_Speed );
  26.             SendToVisible( &pak, thisclient );
  27.             thisclient->Status->Stance = RUNNING;
  28.             thisclient->Stats->Move_Speed = thisclient->GetMoveSpeed( );
  29.             Log(MSG_DEBUG,"%s Dismounted", thisclient->CharInfo->charname);
  30.         }
  31.  
  32.         if (thisgate==NULL)
  33.         {
  34.             if(k==0)
  35.             {
  36.                 Log( MSG_HACK, "Player %s[Map: %i X: %f Y: %f] - Gate Hacking[ID: %i], Gates doesn't exist!",
  37.                          thisclient->CharInfo->charname, thisclient->Position->Map,
  38.                          thisclient->Position->current.x, thisclient->Position->current.y, GateID);
  39.             }
  40.             else
  41.             {
  42.                 //Hack.
  43.                 Log( MSG_HACK, "Player %s[Map: %i X: %f Y: %f] - Gate Hacking[ID: %i, offset %i], distance %.2f",
  44.                              thisclient->CharInfo->charname, thisclient->Position->Map,
  45.                              thisclient->Position->current.x, thisclient->Position->current.y, GateID,lastgate->offset,distance(thisclient->Position->current, lastgate->src) );
  46.             }
  47.  
  48.             return true;
  49.         }
  50.  
  51.         if(thisclient->Position->Map != thisgate->srcMap ||distance(thisclient->Position->current, thisgate->src) > 200)
  52.         {
  53.             //hack or wrong gate?
  54.             lastgate=thisgate;
  55.             continue;
  56.         }
  57.  
  58.         //good gate :)
  59.         is_hack=false;
  60.         Log(MSG_INFO,"Gate %i found, offset %i",thisgate->id,k);
  61.         break;
  62.     }
  63.     //LMA: end new way.
  64.  
  65.     if(is_hack)
  66.     {
  67.         Log( MSG_HACK, "Player %s[Map: %i X: %f Y: %f] - Gate Hacking[ID: %i, offset %i], distance %.2f",
  68.                      thisclient->CharInfo->charname, thisclient->Position->Map,
  69.                      thisclient->Position->current.x, thisclient->Position->current.y, GateID,lastgate->offset,distance(thisclient->Position->current, lastgate->src) );
  70.         return true;
  71.     }
  72.  
  73.     map = thisgate->destMap;
  74.     position = thisgate->dest;
  75.     MapList.Index[map]->TeleportPlayer( thisclient, position );
  76.     thisclient->Status->Stance = RUNNING;
  77.     thisclient->Stats->Move_Speed = thisclient->GetMoveSpeed( );
  78.     return true;
  79. }
  80.  
  81.  


the player now dismounts at gate temporarily then remounts on other side
AnimalCrackerz
Pomic
Pomic
 
Posts: 102
Joined: Tue Apr 20, 2010 1:58 pm

Re: DEV V Fixes

Postby AnimalCrackerz on Fri May 16, 2014 3:18 pm

Lucky Spin ...added a lucky choice...previously was unable to find luckyid in table..this is the fix i came up with..now delivers item to mileage storage

So first at top of WorldPackets.cpp add this line

  1. // Observe: Dirty way of loading LuckySpin Items
  2.     int luckyArray[109];
  3.     int luckychoice[109];


then replace pak spinwheel with this

  1. // Observe: Luckspin spin the wheel!
  2. bool CWorldServer::pakSpinWheel ( CPlayer* thisclient, CPacket* P )
  3. {
  4.     BEGINPACKET ( pak, 0x7f1 );
  5.     if(thisclient->CharInfo->LuckySpins < 1){ // Not enough Spins
  6.         ADDBYTE  ( pak, 2 );
  7.         ADDDWORD ( pak, 0 );
  8.         ADDDWORD ( pak, 0 );
  9.         thisclient->client->SendPacket( &pak );
  10.     } else { // Let the wheel spin
  11.         int wonItem = RandNumber(1,12);
  12.  
  13.         Log(MSG_DEBUG,"%s won %i", thisclient->CharInfo->charname, luckychoice[wonItem]);
  14.         thisclient->CharInfo->LuckySpins -= 1;
  15.         thisclient->CharInfo->LuckyShuffles = 5;
  16.         ADDBYTE  ( pak, 1 );
  17.         ADDDWORD ( pak, 0 );
  18.         ADDDWORD ( pak, 1 );
  19.  
  20.         ADDDWORD ( pak, wonItem );
  21.         ADDDWORD ( pak, luckychoice[wonItem] );
  22.         ADDDWORD ( pak, 1 );
  23.         ADDDWORD ( pak, 1 );
  24.         thisclient->client->SendPacket( &pak );
  25.  
  26.         MYSQL_RES *winning = GServer->DB->QStore("SELECT itemid,itemtype FROM luckyspin WHERE id='%i'", luckychoice[wonItem]);
  27.         MYSQL_ROW row = mysql_fetch_row(winning);
  28.         int itemID   = atoi(row[0]);
  29.         int itemType = atoi(row[1]);
  30.         GServer->DB->FreeResult( );
  31.  
  32.         int slotNum = 0;
  33.         MYSQL_RES *result = GServer->DB->QStore("SELECT * FROM mileage WHERE owner='%i'", thisclient->Session->userid);
  34.         if(result==NULL){
  35.             slotNum = 0;
  36.         } else {
  37.             slotNum = mysql_num_rows(result)+1;
  38.         }
  39.         GServer->DB->FreeResult( );
  40.  
  41.         GServer->DB->Query("INSERT INTO mileage (`owner`,`itemnum`,`itemtype`,`count`,`slotnum`) VALUES ('%i','%i','%i','1','%i')",thisclient->Session->userid,itemID,itemType,slotNum);
  42.         thisclient->savedata( );
  43.  
  44.         luckychoice[0] = 0;
  45.     }
  46.  
  47.     return true;
  48. }

then replace pak luckyspin with this

  1.  
  2. // Observe: Luckyspin initial items
  3. bool CWorldServer::pakLuckySpin( CPlayer* thisclient, CPacket* P )
  4. {
  5.     MYSQL_RES *result = GServer->DB->QStore("SELECT itemid, itemtype, id FROM luckyspin WHERE active='1' ORDER BY rand() LIMIT 12");
  6.     if(result==NULL) return false;
  7.  
  8.     if(!luckyArray[0] || luckyArray[0] == 0){
  9.         int x = 0;
  10.  
  11.  
  12.         while(MYSQL_ROW row = mysql_fetch_row(result)){
  13.             int count = mysql_num_rows(result);
  14.  
  15.             if(x < count){
  16.                 luckyArray[x] = (atoi(row[1])*1000000) + atoi(row[0]);
  17.                 luckychoice[x] = (atoi (row[2]));
  18.                 Log(MSG_DEBUG,"luckyArray[%i] item: %i", x, luckyArray[x]);
  19.                 Log (MSG_DEBUG,"luckychoice[%i] item: %i",x, luckychoice[x]);
  20.                 x++;
  21.             }
  22.         }
  23.     }
  24.  
  25.     BEGINPACKET ( pak, 0x7f2 );
  26.     ADDDWORD    ( pak, mysql_num_rows(result) );
  27.     ADDDWORD    ( pak, thisclient->CharInfo->LuckySpins );
  28.     ADDDWORD    ( pak, thisclient->CharInfo->LuckyShuffles );
  29.     ADDDWORD    ( pak, 12 );
  30.  
  31.     for(int i=0; i<12; i++){
  32.         ADDDWORD ( pak, i );
  33.         ADDDWORD ( pak, luckyArray[i] );
  34.         ADDDWORD ( pak, luckychoice[i] );
  35.         ADDDWORD ( pak, 1 );
  36.         ADDDWORD ( pak, 1 );
  37.         ADDDWORD ( pak, i );
  38.     }
  39.  
  40.     thisclient->client->SendPacket( &pak);
  41.  
  42.     GServer->DB->FreeResult( );
  43.     return true;
  44. }
  45.  


and lastly replace pak luckyshuffle with this

  1. // Observe: Shuffle Luckyspin items
  2. bool CWorldServer::pakLuckySpinShuffle ( CPlayer* thisclient, CPacket* P )
  3. {
  4.     if(thisclient->CharInfo->LuckyShuffles > 0){
  5.         int shufflesleft = thisclient->CharInfo->LuckyShuffles -= 1;
  6.         BEGINPACKET( pak, 0x7ef );
  7.         ADDBYTE    ( pak, 0x01 );                                   // Action
  8.         ADDDWORD   ( pak, shufflesleft );                           // Shuffles Left
  9.         ADDDWORD   ( pak, 12 );                                     // Amount of item (Always 12)
  10.  
  11.         MYSQL_RES *result = GServer->DB->QStore("SELECT itemid,itemtype,id FROM luckyspin WHERE active='1' ORDER BY rand() LIMIT 12");
  12.         if(result==NULL) return false;
  13.  
  14.         int x = 0;
  15.         while(MYSQL_ROW row = mysql_fetch_row(result)){
  16.             int count = mysql_num_rows(result);
  17.  
  18.             if(x < count){
  19.                 luckyArray[x] = (atoi(row[1])*1000000) + atoi(row[0]);
  20.                 luckychoice[x] = (atoi (row[2]));
  21.                 Log(MSG_DEBUG,"luckyArray[%i] item: %i", x, luckyArray[x]);
  22.                 Log(MSG_DEBUG,"luckychoice[%i] item: %i", x, luckychoice[x]);
  23.                 x++;
  24.             }
  25.         }
  26.  
  27.         for(byte i=0; i<12; i++)
  28.         {
  29.             ADDDWORD ( pak, i );
  30.             ADDDWORD ( pak, luckyArray[i] );
  31.             ADDDWORD ( pak, 1 );
  32.             ADDDWORD ( pak, RandNumber(1,4));
  33.         }
  34.  
  35.         GServer->DB->FreeResult( );
  36.         thisclient->client->SendPacket( &pak );
  37.         return true;
  38.     } else {
  39.         Log(MSG_WARNING,"%s tried to shuffle with %i shuffles!",thisclient->CharInfo->charname,thisclient->CharInfo->LuckyShuffles);
  40.         return true;
  41.     }
  42. }
  43.  

now the item should be placed in the mileage storage
Last edited by AnimalCrackerz on Sun May 18, 2014 3:56 pm, edited 1 time in total.
AnimalCrackerz
Pomic
Pomic
 
Posts: 102
Joined: Tue Apr 20, 2010 1:58 pm

Re: DEV V Fixes

Postby AnimalCrackerz on Fri May 16, 2014 3:20 pm

Will post anymore fixes I come up with.
AnimalCrackerz
Pomic
Pomic
 
Posts: 102
Joined: Tue Apr 20, 2010 1:58 pm

Re: DEV V Fixes

Postby Exordium on Tue May 20, 2014 9:18 pm

When i tried compiling the fix on the Warp gate mount this is what happened

  1. XXX\osrose_v5\osRose\World Server\worldpackets.cpp|1634|error: no 'bool CWorldServer::pakGate(CPlayer*, CPacket*)' member function declared in class 'CWorldServer'


How will i fix this?
Exordium
Smoulie
Smoulie
 
Posts: 67
Joined: Tue Sep 25, 2012 11:10 am

Re: DEV V Fixes

Postby rl2171 on Tue May 27, 2014 3:43 pm

Exordium wrote:When i tried compiling the fix on the Warp gate mount this is what happened

  1. XXX\osrose_v5\osRose\World Server\worldpackets.cpp|1634|error: no 'bool CWorldServer::pakGate(CPlayer*, CPacket*)' member function declared in class 'CWorldServer'


How will i fix this?



I got the same error too. What did I miss?
Image
rl2171
Admin
Admin
 
Posts: 1706
Joined: Mon Aug 06, 2007 5:17 pm
Location: Sacramento, CA USA - GMT-8

Re: DEV V Fixes

Postby Exordium on Tue May 27, 2014 3:57 pm

i really dunno
Exordium
Smoulie
Smoulie
 
Posts: 67
Joined: Tue Sep 25, 2012 11:10 am

Re: DEV V Fixes

Postby wolfwing on Thu May 29, 2014 1:22 am

The declaration is missing in the header.
Just add it to the header and it should be fine.
wolfwing
Clown
Clown
 
Posts: 502
Joined: Tue Mar 03, 2009 9:50 am


Return to Submit Code

Who is online

Users browsing this forum: No registered users and 5 guests