Drops code (this could potentially get messy)

Submit code for osProse project.

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

Drops code (this could potentially get messy)

Postby PurpleYouko on Mon May 12, 2008 9:53 pm

Mods to add my custom drop system

for the moment we will leave the old drops code in place until we are sure it is all working properly

The main function
in serverfunctions .cpp
find function
  1. CDrop* CWorldServer::GetDrop( CMonster* thismon )

After entire function add
  1.  
  2. // Build Drop the PY way
  3. CDrop* CWorldServer::GetPYDrop( CMonster* thismon, UINT droptype )
  4. {   //if droptype = 1 then it is a normal drop. if it is 2 then it is a potential side drop.
  5.     Log( MSG_INFO, "PYDrops function selected" );
  6.     Log( MSG_INFO, "monster is %i", thismon->montype );
  7.     if(droptype == 2) // monster is still alive
  8.     {
  9.         // this part of the function reserved for the later addition of side drops
  10.         //return NULL;  //temporary bypass for the side drop function
  11.         // kicks it straight back if the monster is not dead
  12.         if(thismon->thisnpc->side != 0) //perhaps we get a side drop??
  13.         {
  14.             if(GServer->RandNumber(0,100) < thismon->thisnpc->sidechance)
  15.             {
  16.                 droptype = thismon->thisnpc->side;
  17.             }
  18.             else
  19.             {
  20.                 return NULL;  //No drop this time
  21.             }          
  22.         }
  23.         else
  24.         {
  25.             return NULL;  //No drop this time
  26.         }
  27.     }
  28.     CDrop* newdrop = new (nothrow) CDrop;
  29.     if(newdrop==NULL)
  30.     {
  31.         Log(MSG_WARNING, "Error allocing memory [getdrop]" );
  32.         return NULL;
  33.     }    
  34.     newdrop->clientid = GetNewClientID( );
  35.     newdrop->posMap = thismon->Position->Map;
  36.     newdrop->pos = RandInCircle( thismon->Position->current, 3 );
  37.     newdrop->droptime = time(NULL);
  38.     newdrop->owner = thismon->MonsterDrop->firsthit;
  39.     newdrop->thisparty = thismon->thisparty;
  40.     ClearItem(newdrop->item);
  41.    
  42.     CPlayer* thisclient = GServer->GetClientByCID(thismon->MonsterDrop->firsthit);
  43.    
  44.     // code to modify drop chance for different levels
  45.     //float charm = 0;
  46.     //float droprate = thismon->thisnpc->dropchance;
  47.     float droprate = Config.DROP_RATE;
  48.     float leveldif = (float)thismon->thisnpc->level - (float)thisclient->Stats->Level;
  49.     float dropchance = (droprate + (droprate * 0.01 * leveldif));
  50.     if(dropchance < 10) dropchance = 10; //always a small chance of a drop even when the mob is more than 20 levels beneath your own
  51.     if(thismon->thisnpc->level == 1)
  52.         dropchance = 80;
  53.     if (GServer->RandNumber(0, 100)> dropchance)  
  54.         return NULL; // no drop here. not this time anyway.
  55.      
  56.     CItemType prob[MDropList.size()];
  57.     bool isdrop = false;
  58.     int n = 0;
  59.     int test = 0;
  60.     long int probmax = 0;
  61.     int itemnumber[MDropList.size()];
  62.     int itemtype[MDropList.size()];
  63.     int probability[MDropList.size()];
  64.     int alternate[MDropList.size()][8];
  65.    
  66.     if( thismon->IsGhost())
  67.     {
  68.         // Stuff to do if the mob is a ghost of any type  
  69.         int selection = 1 + rand()%10;
  70.         if( selection <= 5 )
  71.         {
  72.             newdrop->type = 1; //Drop Zuly.
  73.             newdrop->amount = thismon->thisnpc->level * 5 * Config.ZULY_RATE + RandNumber( 1, 10 );
  74.             return  newdrop;
  75.         }
  76.         else
  77.         {
  78.             for(int i=0; i<SkillbookList.size( ); i++)
  79.             {
  80.                 newdrop->type = 2;
  81.                 CMDrops* thisdrop = GServer->SkillbookList.at(i);
  82.                 if(thisdrop->level_min <= thismon->thisnpc->level &&  thisdrop->level_max >= thismon->thisnpc->level)
  83.                 {
  84.                     itemnumber[n] = thisdrop->itemnum;
  85.                     itemtype[n] = thisdrop->itemtype;
  86.                     probability[n] = thisdrop->prob;
  87.                     probmax += thisdrop->prob;
  88.                     n++;
  89.                 }    
  90.             }
  91.         }
  92.     }
  93.     else // Stuff to do if the mob isn't a ghost
  94.     {
  95.         int dropmode = 0;
  96.         int randv = RandNumber( 1, 100);
  97.         // Each monster has its own rates for zuly and item drops defined in the database
  98.         if(randv > thismon->thisnpc->item) return NULL; // did not qualify to drop anything this time
  99.         if(randv <= thismon->thisnpc->money) // zuly drop instead of item drop
  100.         {
  101.             newdrop->type = 1; //Drop Zuly. Now changes for individual characters if they have items with Zuly Rate stats
  102.             newdrop->amount = thismon->thisnpc->level * 5 * Config.ZULY_RATE + RandNumber( 1, 10 );
  103.             return  newdrop;
  104.         }
  105.         // this means it is an item drop
  106.         randv = RandNumber( 1, 100);
  107.         if(randv > 70) // 30% map drop
  108.         {
  109.             dropmode = 1; // map drop selected
  110.         }
  111.         else if(randv > 30) // 40% mob drop
  112.         {
  113.             dropmode = 2; //mob drop selected
  114.         }
  115.         else // 30% level drop
  116.         {
  117.             dropmode = 3; //leveldrop selected
  118.         }
  119.        
  120.         int randomdrop = GServer->RandNumber(1, 100);
  121.         //Log(MSG_INFO, "Mob type %i. Map = %i. Level = %i", thismon->montype, thismon->Position->Map,thismon->thisnpc->level);
  122.        
  123.        
  124.         for(int i=0; i<MDropList.size( ); i++)
  125.         {
  126.            
  127.             isdrop=false;
  128.             CMDrops* thisdrop = GServer->MDropList.at(i);
  129.            
  130.             if(thisdrop->mob == thismon->montype && dropmode == 2) // monster drop
  131.             {
  132.                 test = GServer->RandNumber(1, 1000);
  133.                 if(test < thisdrop->prob)
  134.                 {
  135.                     isdrop = true;
  136.                 }
  137.             }
  138.             if(thisdrop->map == thismon->Position->Map && dropmode == 1) // map drop
  139.             {
  140.                
  141.                 test = GServer->RandNumber(1, 1000);
  142.                 if(thismon->thisnpc->level == 1)
  143.                    test = GServer->RandNumber(1, 10000); // make it less likely to get map drops from event mobs
  144.                 if(test < thisdrop->prob)
  145.                 {
  146.                     isdrop = true;
  147.                 }
  148.             }
  149.             if(thismon->thisnpc->level >= thisdrop->level_min && thismon->thisnpc->level <= thisdrop->level_max && dropmode == 3)
  150.             {
  151.                 //Log(MSG_INFO, "Level drop selected. type %i number %i", thisdrop->itemtype, thisdrop->itemnum );
  152.                 test = GServer->RandNumber(1, 1000);
  153.                 if(test < thisdrop->prob)
  154.                 {
  155.                     isdrop = true;
  156.                 }
  157.                 //else
  158.             }
  159.             if(isdrop == true)
  160.             {
  161.                 if(droptype != 1) //side drops only. Skip if the item is not a match for side type
  162.                 {
  163.                     if(itemtype[n] != droptype)continue;          
  164.                 }
  165.                 //droptype 1 is a regular drop
  166.                 itemnumber[n] = thisdrop->itemnum;
  167.                 itemtype[n] = thisdrop->itemtype;
  168.                 //probability[n] = thisdrop->prob;
  169.                 alternate[n][0] = 0;
  170.                 for(int i=1;i<8;i++)
  171.                 {
  172.                     alternate[n][i] = thisdrop->alt[i];        
  173.                 }
  174.                 n++;      
  175.             }
  176.         }
  177.     }
  178.     int newn = n;
  179.     if(n == 0)
  180.         return NULL;
  181.     int maxitems = n;
  182.     // randomize the item from the list
  183.     n = GServer->RandNumber(0, maxitems);
  184.     newdrop->item.itemnum = itemnumber[n];
  185.     newdrop->item.itemtype = itemtype[n];
  186.     newdrop->type = 2;  
  187.      
  188.     newdrop->item.lifespan = 10 + rand()%80;
  189.     float dmod = 0; //random number from 0 to 100 made up of 4 sub numbers to keep
  190.     //the average value near to 50
  191.     for(int i=0; i<4; i++)
  192.     {
  193.         float r1 = rand()%20;
  194.         dmod += r1;        
  195.     }
  196.     newdrop->item.durability = 10 + (int)dmod;
  197.     if( newdrop->item.itemtype == 8 || newdrop->item.itemtype == 9 )
  198.     {
  199.         //This probability is now configurable from WorldServer.conf
  200.         int psocked = rand()%101; //Probability of finding a socketed item
  201.         if( psocked < Config.SlotChance) //default should be around 5% needs to be rare
  202.         {
  203.             newdrop->item.socketed = true;
  204.         }
  205.         else
  206.         {    
  207.              newdrop->item.socketed = false;
  208.         }
  209.     }
  210.     else
  211.     {
  212.         newdrop->item.socketed = false;
  213.     }
  214.     //Log( MSG_INFO, "Socket are OK");
  215.     newdrop->item.appraised = false;
  216.     newdrop->item.stats = 0;
  217.     newdrop->item.count = 1;
  218.    
  219.     //int chamod = 0;
  220.     int chamod = (int)floor(thisclient->Attr->Cha / 30);
  221.     if(chamod <0) chamod = 0;
  222.     int basedrop = 6 + chamod; //Base number of items to be dropped. add CHA to increase this.
  223.     if( newdrop->item.itemtype == 10 || newdrop->item.itemtype == 12 )
  224.     {
  225.         newdrop->item.count = RandNumber(0, basedrop);
  226.         if(thismon->thisnpc->level == 1 && newdrop->item.count > 6) newdrop->item.count = 6; //limit the drop rate of items from level 1 event mobs
  227.         if(newdrop->item.count==0)
  228.             newdrop->item.count = 1;
  229.         if(newdrop->item.itemtype == 10)
  230.         {
  231.             if(newdrop->item.itemnum >=441 && newdrop->item.itemnum <= 888)// skillbooks
  232.                 newdrop->item.count = 1;                        
  233.         }
  234.         if(newdrop->item.itemtype == 11) //gems only get 1
  235.             newdrop->item.count = 1;
  236.         if(newdrop->item.itemtype == 12)
  237.         {
  238.             if(newdrop->item.itemnum > 300 && newdrop->item.itemnum < 360) //bullets get a lot higher count.
  239.             {
  240.                 newdrop->item.count *= 10;
  241.                 newdrop->item.count += 10;                    
  242.             }
  243.         }
  244.     }
  245.     else if( newdrop->item.itemtype >1 && newdrop->item.itemtype !=7 && newdrop->item.itemtype < 10)
  246.     {
  247.         // check to see if the item will be refined
  248.         int prefine = rand()%100; //Probability of finding a refined item
  249.         int refinechance = Config.RefineChance;
  250.         if(prefine < refinechance) // default = 5%
  251.         {
  252.             int refinelevel = rand()%101;  //which level of refine do we actually get
  253.             if( refinelevel < 5)        //default 5%
  254.                 newdrop->item.refine = 4 * 16;
  255.             else if( refinelevel < 15 )   //10%
  256.                 newdrop->item.refine = 3 * 16;
  257.             else if(refinelevel < 35 )   // 20%
  258.                 newdrop->item.refine = 2 * 16;
  259.             else                          // 65%
  260.                 newdrop->item.refine = 16;
  261.         }
  262.         else //99%
  263.             newdrop->item.refine = 0;
  264.        
  265.         // will the item be a blue?
  266.         bool blue = false;
  267.         int bluechance1 = RandNumber( 1, 100);
  268.         int bluechance2 = Config.BlueChance + chamod;
  269.         Log( MSG_INFO, "Blue chance = %i", bluechance2);
  270.         //This probability is now configurable from WorldServer.conf. CHA also has an effect
  271.         if(bluechance1 < bluechance2) // some percentage of drops will be specials or blues whenever one is available.
  272.         {
  273.             Log( MSG_INFO, "Selected a blue item");
  274.             int p = 1;
  275.             while(alternate[n][p] != 0 && p < 8)
  276.             {
  277.                 p++;
  278.             }
  279.             if(p > 1) // blues available for this item
  280.             {
  281.                 //Log( MSG_INFO, "blue item available");
  282.                 p--;
  283.                 int bluenum = RandNumber( 1, p);
  284.                 newdrop->item.itemnum = alternate[n][bluenum];
  285.                 blue=true;
  286.             }
  287.         }
  288.         // will the items get stats? All blue items will. Uniques count as blues.
  289.         int pstats = rand()%101; //Probability of the item having stats. default = 5%
  290.         if(blue == true)
  291.         {
  292.             pstats = 1;
  293.         }
  294.         int StatChance = Config.StatChance;
  295.         if( pstats < StatChance)        // default 5%
  296.             newdrop->item.stats = RandNumber( 1, 300);        
  297.     }
  298.     newdrop->item.gem = 0;
  299.     return newdrop;
  300. }
  301.  


in Startup.cpp
find function
  1. bool CWorldServer::LoadDropsData( )

after function, add
  1.  
  2. bool CWorldServer::LoadPYDropsData( )
  3. {
  4.     Log( MSG_INFO, "Loading PYDrops Data" );  
  5.     MDropList.clear();
  6.     MYSQL_ROW row;
  7.     MYSQL_RES *result = DB->QStore("SELECT id,type,min_level,max_level,prob,mob,map,alt FROM item_drops");
  8.     if(result==NULL)
  9.     {
  10.         DB->QFree( );
  11.         return false;
  12.     }
  13.     while(row = mysql_fetch_row(result))
  14.     {      
  15.         CMDrops* newdrop = new (nothrow) CMDrops;  
  16.         assert(newdrop);
  17.         newdrop->itemnum = atoi(row[0]);
  18.         newdrop->itemtype = atoi(row[1]);              
  19.         newdrop->level_min = atoi(row[2]);
  20.         newdrop->level_max = atoi(row[3]);
  21.         newdrop->prob = atoi(row[4]);
  22.         newdrop->mob = atoi(row[5]);
  23.         newdrop->map = atoi(row[6]);
  24.         char *tmp;
  25.         if((tmp = strtok( row[7] , "|"))==NULL)
  26.             newdrop->alt[0]=0;
  27.         else
  28.             newdrop->alt[0]=atoi(tmp);            
  29.         for(unsigned int i=1;i<8; i++)
  30.         {
  31.             if((tmp = strtok( NULL , "|"))==NULL)
  32.                 newdrop->alt[i]=0;            
  33.             else
  34.                 newdrop->alt[i]=atoi(tmp);            
  35.         }
  36.         //if(newdrop->mob != 0)
  37.             //Log( MSG_INFO, "found a non zero mob value %i",newdrop->mob );  
  38.         MDropList.push_back( newdrop );  
  39.     }
  40.     DB->QFree( );
  41.     Log( MSG_INFO, "PYDrops loaded" );    
  42.     return true;    
  43. }
  44.  
  45. bool CWorldServer::LoadSkillBookDropsData( )
  46. {
  47.     Log( MSG_INFO, "Loading Skillbook data" );
  48.     MYSQL_ROW row;
  49.     MYSQL_RES *result = DB->QStore("SELECT id,itemtype,min,max,prob FROM list_skillbooks");
  50.     if(result==NULL)
  51.     {
  52.         DB->QFree( );
  53.         return false;
  54.     }
  55.     int c = 0;
  56.     while(row = mysql_fetch_row(result))
  57.     {  
  58.        
  59.         c++;
  60.         CMDrops* newdrop = new (nothrow) CMDrops;
  61.         assert(newdrop);
  62.         newdrop->itemnum = atoi(row[0]);
  63.         newdrop->itemtype = atoi(row[1]);              
  64.         newdrop->level_min = atoi(row[2]);
  65.         newdrop->level_max = atoi(row[3]);
  66.         newdrop->prob = atoi(row[4]);  
  67.         SkillbookList.push_back( newdrop );    
  68.     }
  69.     DB->QFree( );
  70.     Log( MSG_INFO, "Skillbook Data loaded" );
  71.     return true;
  72. }
  73.  
  74. bool CWorldServer::LoadConfig( )
  75. {
  76.     Log( MSG_INFO, "Loading database config files" );
  77.     MYSQL_ROW row;    
  78.     MYSQL_RES *result = DB->QStore("SELECT exp_rate, drop_rate, zuly_rate, blue_chance, stat_chance, slot_chance, \
  79.         refine_chance FROM list_config");
  80.     if(result==NULL)
  81.     {
  82.         DB->QFree( );
  83.         return false;
  84.     }
  85.     while( row = mysql_fetch_row(result) )
  86.     {
  87.        GServer->Config.EXP_RATE = atoi(row[0]);
  88.        GServer->Config.DROP_RATE = atoi(row[1]);
  89.        GServer->Config.ZULY_RATE = atoi(row[2]);
  90.        GServer->Config.BlueChance = atoi(row[3]);
  91.        GServer->Config.StatChance = atoi(row[4]);
  92.        GServer->Config.SlotChance = atoi(row[5]);
  93.        GServer->Config.RefineChance = atoi(row[6]);
  94.     }
  95.     DB->QFree( );
  96.     Log( MSG_INFO, "Config Data Loaded" );  
  97.     return true;
  98. }
  99.  


in WorldServe.h find
  1. CDrop* GetDrop( CMonster* thismon );

after, add
  1. CDrop* GetPYDrop( CMonster* thismon, UINT droptype );

find
  1.  
  2. bool LoadDropsData( );
  3.  

after, add
  1.  
  2.         bool LoadPYDropsData( );
  3.         bool LoadSkillBookDropsData( );
  4.         bool LoadConfig( );
  5.  

in WorldServer.cpp
find

REPLACE with
  1.  
  2.     //LoadDropsData( );
  3.     LoadPYDropsData( );
  4.     LoadSkillBookDropsData( );
  5.     LoadConfig( );
  6.  


New variables and structures
in Datatype.h find

after add
  1.  
  2.     UINT side;
  3.     UINT sidechance;
  4.     UINT zulydrop;
  5.     UINT mapdrop;
  6.     UINT mobdrop;
  7.     UINT leveldrop;
  8.     UINT dropchance;
  9.  

find

after, add
  1.  
  2.     UINT prob;
  3.     UINT map;
  4.     UINT mob;
  5.     UINT itemtype;
  6.     UINT itemnum;
  7.     UINT alt[8];
  8.  



The configuration setup
in Sockets.h find

after add
  1.  
  2.     int BlueChance;
  3.     int StatChance;
  4.     int SlotChance;
  5.     int RefineChance;
  6.  


[s]Ghost drops list functions (skillbooks but can be expanded to others)[/b]
in worldserver.h
find
  1.  
  2. vector<CMDrops*>        MDropList;              // Drops List
  3.  

after, add
  1.  
  2. vector<CMDrops*>        SkillbookList;          // Skillbook drop list
  3.  

we already added the load function for this earlier so we should be good to go once we add the new database tables.

Connect to our new drops system
in Monsterfunctions.cpp
find
  1.  
  2. CDrop* CMonster::GetDrop( )
  3. {
  4.     return GServer->GetDrop( this );
  5. }
  6.  

replace with
  1.  
  2. CDrop* CMonster::GetDrop( )
  3. {
  4.     return GServer->GetPYDrop( this, 1 );
  5. }
  6.  

for the time being we will only send a droptype value of 1 to the new drop function. 2 is for sidedrops which are not yet complete.


General mopping up
Wtihout this we keep getting calls to all kinds of mob and map drops which cause a bunch of "drop not founded" errors
Since we don't ever need mapdrops or mobdrops again we can just remove the function that gives the errors. We won't actually remove it yet though.
Just bypass it ;)

in ExtraFunctions.cpp
find
  1.  
  2. // Get Monster Drop By ID
  3. CMDrops* CWorldServer::GetDropData( unsigned int id )
  4. {
  5.     unsigned int A=0,B=0,C=0;  
  6.  

replace with
  1.  
  2. // Get Monster Drop By ID
  3. CMDrops* CWorldServer::GetDropData( unsigned int id )
  4. {
  5.     return NULL;
  6.     unsigned int A=0,B=0,C=0;  
  7.  

or in other words, just add "return NULL;" where shown
This will prevent all those errors.


first the drops table
In this we now have a completely new system. Items can be set to drop in one of the following modes
Mob drops. The item only drops from the mob specified
Map drops. the item drops from any mob in the specofied map
level drops. The item drops from ANY mob on ANY map if the monster level is btween the values defined in min_level and max_level (inclusive)
example: You can set an apple to drop from any mob in the range 2 to 15 on any map with the following entry
id = 101
type = 10
min_level = 2
max_level = 15
prob = 1000 (range of 1 to 1000 here. 1000 = 100% chance of the item being added to a shortlist of possible drops. The actual item dropped will be selected from this list)
map = 0
mob = 0
alt = 0|0|0|0|0|0|0|0 (default value)
description = "Apple from level range 2 - 15" (this is an optional value that you can set to whatever you like to remind you what the entry means)

the sql
Here are 3 tables to add to your database.
One for item drops. This completely custom but is about as complete as i can make it. Please feel free to mod it as much as you like based on the information above. I also have an editor but after the fiasco of trying to get it to run on Rob's PC I'm a bit reluctant to upload it just yet. PM me if you want me to upload.
item_drops(3).zip
(12.27 KiB) Downloaded 286 times


The new Config table that i use for configuring the stuff related to the drops. It also contains some server data such as XP rate and Zuly rate which will overwrite data in the .conf file. I intend to use this config DB for all the config values eventually. the only thing i want to see in the ,conf files are the actual server connection stuff.
Once i have developed this a little further it will be possible to instantly change configurations to one of any number of stored sets. A simple admin/GM command will be able to switch them.
list_config.zip
(625 Bytes) Downloaded 261 times


The Skillbooks list. This is designed for ghosts to use so that their drops can be controlled seperately to normal mobs.
The reason for the name is because in evo where this was initially designed, ghosts dropped skillbooks almost exclusively (+ stuff like HP water and MP water)
This is an evo based list so it won't be correct at this time. I will fix it up better when i get the chance
We may even decide to lose this function. Not sure at this time. Either way you need this table right now.
list_skillbooks(2).zip
(3.7 KiB) Downloaded 238 times


This code has been tested as it stands and is running quite well on my test server at work.
I will be uploading it to my server at home in about an hour when I go home from work. :D

Enjoy
Last edited by PurpleYouko on Tue May 13, 2008 8:46 pm, edited 1 time in total.
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: 4595
Joined: Fri Aug 10, 2007 2:05 pm

Re: Drops code (this could potentially get messy)

Postby Blah4 on Mon May 12, 2008 10:06 pm

Nice job :O

By the way, it seems that level 170 cannons drop at moldies on your server :P
Blah4
ospRose dev team
ospRose dev team
 
Posts: 199
Joined: Sun Jan 06, 2008 12:05 pm
Location: The Netherlands

Re: Drops code (this could potentially get messy)

Postby pepu on Mon May 12, 2008 11:24 pm

INCREDIBLE...:P
The problem is, these drops are evo drops..but we can fix them np :P
pepu
ospRose dev team
ospRose dev team
 
Posts: 283
Joined: Mon Feb 04, 2008 10:12 pm
Location: ESPAÑA(Aranjuez)

Re: Drops code (this could potentially get messy)

Postby Blackdpd on Tue May 13, 2008 1:26 am

nice one i wil steal this too for my irose server :P
( if you dont mind... )

Blackdpd `
User avatar
Blackdpd
El Verloon Marshall
El Verloon Marshall
 
Posts: 900
Joined: Sun Jan 27, 2008 10:06 pm
Location: The Netherlands

Re: Drops code (this could potentially get messy)

Postby PurpleYouko on Tue May 13, 2008 1:52 pm

pepu wrote:INCREDIBLE...:P
The problem is, these drops are evo drops..but we can fix them np :P

Actually they are a kind of hybrid of the two.
The drops table was originally for evo and as such, contained hundreds of extra items which simply don't exist in the pre-evo STBs (yet)
I weeded out all the items that don't work and left the others as they were.

Even so, it isn't really an evo drop set. It is one that i built from scratch about a year ago. 100% custom but with a few similarities to the real server.
If you want to make it a lot more like the original, it is very easy to edit entries on your database.

nice one i wil steal this too for my irose server :P
( if you dont mind... )

Help yourself Blackdpd. this is general release so use it anywhere you like.

I will be making a few minor changes to it today since i discovered a couple of issues last night.
Mainly it isn't dropping zuly because we are not currently loading in the necessary values to the CNPC structure from the STB
Each mob has there own item drop and zuly drop rate defined in the STB (the two columns immediately after dropid) and we need them to be loaded for the function to work properly.
I will look into it later. Shouldn't be too hard to fix.
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: 4595
Joined: Fri Aug 10, 2007 2:05 pm

Re: Drops code (this could potentially get messy)

Postby wtfux on Tue May 13, 2008 1:58 pm

NICE!
I'll try it after you fixed your problem ;).
No.sig
wtfux
Pomic
Pomic
 
Posts: 130
Joined: Sun Apr 13, 2008 2:35 pm

Re: Drops code (this could potentially get messy)

Postby PurpleYouko on Tue May 13, 2008 2:01 pm

it probably won't require any changes to my code.
More than likely i will need to edit the function in startup.cpp that copies values out of the STB.
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: 4595
Joined: Fri Aug 10, 2007 2:05 pm

Re: Drops code (this could potentially get messy)

Postby pepu on Tue May 13, 2008 8:31 pm

It doesn´t compile for me :S

Image


And this code is different for me :S
  1.  
  2. if(monster->owner==0)
  3. // Get Monster Drop By ID
  4. CMDrops* CWorldServer::GetDropData( unsigned int id )
  5. {
  6.     unsigned int A=0,B=0,C=0;  
  7.  
pepu
ospRose dev team
ospRose dev team
 
Posts: 283
Joined: Mon Feb 04, 2008 10:12 pm
Location: ESPAÑA(Aranjuez)

Re: Drops code (this could potentially get messy)

Postby PurpleYouko on Tue May 13, 2008 8:44 pm

What line is the error on?
The highlighted bit is just the comment at the top of the function.

It looks like there is a missing ; somewhere in your code.
Click on the line that lists the error and see where it takes you

And this code is different for me :S
  1.    
  2.    if(monster->owner==0)
  3.     // Get Monster Drop By ID
  4.     CMDrops* CWorldServer::GetDropData( unsigned int id )
  5.     {
  6.         unsigned int A=0,B=0,C=0;  
  7.  

What do you have then?
The important thing is to stop it from processing the "GetDropData" function
this
  1.  
  2. if(monster->owner==0)
  3.  

actually looks like a typo.
It shouldn't be there at all.
is that really what i posted?
If so I had better go fix it. :D

OK that was definitely a typo. i have fixed it now.
I have also slightly modified the main GetPYDrops function so that it allows zuly to drop too.
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: 4595
Joined: Fri Aug 10, 2007 2:05 pm

Re: Drops code (this could potentially get messy)

Postby pepu on Tue May 13, 2008 8:56 pm

Can u please upload all ur "WorldServer" files with all fixes atm?...i am lost now :(
Thanks in advance
pepu
ospRose dev team
ospRose dev team
 
Posts: 283
Joined: Mon Feb 04, 2008 10:12 pm
Location: ESPAÑA(Aranjuez)

Next

Return to Submit Code

Who is online

Users browsing this forum: No registered users and 1 guest

cron