Custom drops code (prequel to custom events)

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

Custom drops code (prequel to custom events)

Postby PurpleYouko on Fri Dec 21, 2007 5:17 pm

I am going to attempt to walk you through the addition of a completely new drop system that can be used to add and edit drops from the mobs in your game.
disclaimer
Parts of this code is experimental but the heart of it has been working for almost a year now.
Also the drops table in the database is incomplete and you will most likely want to configure it your own way. If someone uses this code and sets up their own drop table in the database then maybe they could share it with us all. Switching drops lists is SOOOO easy in this system.
The code includes some changes to a few of the basic structures in the server, including the config files, startup and GM commands.

It has been a long time since i initially developed this mod so I am attempting to get every single internal change. I will try my best to get them all and I appologize if I miss some. Just let me know if something doesn't work and i will revise it.

Here goes.......
open Datatypes.h
find
  1.  
  2. struct CMDrops
  3. {
  4.     UINT id;
  5.     UINT zuly;
  6.     UINT zulyprob;
  7.     vector<CDropInfo*> Drops;
  8.     UINT level_min;//for map drops
  9.     UINT level_max;//for map drops
  10.     UINT level_boss;//for map drops
  11.     UINT probmax;
  12.  

After, add

Still in datatypes.h, find
  1.  
  2. struct CMDrops
  3. {
  4.     UINT id;
  5.     UINT zuly;
  6.     UINT zulyprob;
  7.     vector<CDropInfo*> Drops;
  8.     UINT level_min;//for map drops
  9.     UINT level_max;//for map drops
  10.     UINT level_boss;//for map drops
  11.     UINT probmax;
  12.  

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


open WorldServer.h
find
  1.  
  2. vector<CMDrops*>        MDropList;              // Drops List
  3.  

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


still in WorldServer.h
find
  1.  
  2. bool LoadDropsData( );
  3.  

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


still in WorldServer.h
find
  1.  
  2. CDrop* GetDrop( CMonster* thismon );
  3.  

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


open WorldServer.cpp
find

replace with
  1.  
  2. // LoadDropsData( );
  3.     // new drops routine load
  4.     LoadPYDropsData( );
  5.     LoadSkillBookDropsData( );
  6.     // end of new drops data
  7.  

This disables but does not remove the old drop system so that it is easy to switch back

still in Worldserver.cpp
find
  1.  
  2. Config.PlayerDmg            = ConfigGetInt    ( file, "playerdmg", 120);
  3.  

After, add
  1.  
  2.     Config.BlueChance           = ConfigGetInt    ( file, "bluechance", 5);
  3.     Config.StatChance           = ConfigGetInt    ( file, "statchance", 5);
  4.     Config.SlotChance           = ConfigGetInt    ( file, "slotchance", 5);
  5.     Config.RefineChance         = ConfigGetInt    ( file, "refinechance", 5);
  6.  


open Sockets.h
find

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

Sets up the variables to control the various config chances




open Startup.cpp
find (end of existing drops load code)
  1.  
  2. MDropList.push_back( newdrop );
  3.     }
  4.     fclose(fh);
  5.     return true;    
  6. }

after, add
  1.  
  2. bool CWorldServer::LoadPYDropsData( )
  3. {
  4.     MDropList.clear();
  5.     MYSQL_ROW row;
  6.     MYSQL_RES *result = DB->QStore("SELECT id,type,min_level,max_level,prob,mob,map,alt FROM item_drops");
  7.     if(result==NULL)
  8.     {
  9.         DB->QFree( );
  10.         return false;
  11.     }
  12.     while(row = mysql_fetch_row(result))
  13.     {      
  14.         CMDrops* newdrop = new (nothrow) CMDrops;  
  15.         assert(newdrop);
  16.         newdrop->itemnum = atoi(row[0]);
  17.         newdrop->itemtype = atoi(row[1]);              
  18.         newdrop->level_min = atoi(row[2]);
  19.         newdrop->level_max = atoi(row[3]);
  20.         newdrop->prob = atoi(row[4]);
  21.         newdrop->mob = atoi(row[5]);
  22.         newdrop->map = atoi(row[6]);
  23.         char *tmp;
  24.         if((tmp = strtok( row[7] , "|"))==NULL)
  25.             newdrop->alt[0]=0;
  26.         else
  27.             newdrop->alt[0]=atoi(tmp);            
  28.         for(unsigned int i=1;i<8; i++)
  29.         {
  30.             if((tmp = strtok( NULL , "|"))==NULL)
  31.                 newdrop->alt[i]=0;            
  32.             else
  33.                 newdrop->alt[i]=atoi(tmp);            
  34.         }  
  35.         MDropList.push_back( newdrop );  
  36.     }
  37.     DB->QFree( );
  38.     Log( MSG_INFO, "PYDrops loaded" );    
  39.     return true;    
  40. }
  41. bool CWorldServer::LoadSkillBookDropsData( )
  42. {
  43.     //LogSkillbook data load
  44.     MYSQL_ROW row;
  45.     MYSQL_RES *result = DB->QStore("SELECT id,min,max,prob FROM list_skillbooks");
  46.     if(result==NULL)
  47.     {
  48.         DB->QFree( );
  49.         return false;
  50.     }
  51.     int c = 0;
  52.     while(row = mysql_fetch_row(result))
  53.     {  
  54.        
  55.         c++;
  56.         CMDrops* newdrop = new (nothrow) CMDrops;
  57.         assert(newdrop);
  58.         newdrop->itemnum = atoi(row[0]);
  59.         newdrop->itemtype = 10;            
  60.         newdrop->level_min = atoi(row[1]);
  61.         newdrop->level_max = atoi(row[2]);
  62.         newdrop->prob = atoi(row[3]);  
  63.         SkillbookList.push_back( newdrop );    
  64.     }
  65.     DB->QFree( );
  66.     Log( MSG_INFO, "Skillbook Drops loaded" );
  67.     return true;
  68. }


open Monsterfunctions.cpp
find
  1.  
  2. CDrop* CMonster::GetDrop( )
  3. {
  4.     GServer->GetDrop( this );
  5. }

replace with
  1.  
  2. CDrop* CMonster::GetDrop( )
  3. {
  4.     //added a new functionality to PYGetDrop.
  5.     //now requires an input value for droptype. A droptype of 1 is a normal drop while a droptype of 2 can be sent to generate a drop while the monster is still alive
  6.     //Code for these 'side drops' is still under development and will follow soon
  7.     GServer->PYGetDrop( this, 1 );
  8. }
  9.  


and finally the drop code itself.
open ServerFunctions.cpp
find
  1.  
  2. }
  3.     newdrop->item.gem = 0;
  4.     return newdrop;
  5. }
  6.  

The end of the existing drops code.

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


Thanks to Lmame who spotted that i did not include this main code the first time. :)


I'm pretty sure these are all the actual code changes. If you have any issues with this then please let me know. The most likely thing i may have possibly left out is registering a variable or structure so if you get a compile error saying that a structure has no such datatype or something like that then this is what has happened.

Now for the other stuff :)

Open worldserver.conf in a suitable text editor.
find

After add
  1.  
  2. bluechance=5
  3. statchance=5
  4. slotchance=5
  5. refinechance=5
  6.  

Note: the values here are percentage chances of the dropped item being a 'blue', having refines, stats etc. added to it. 5% may be too low for some of you so feel free to configure them however you like.

Databases.
item_drops.zip
(6.5 KiB) Downloaded 931 times

This drops database has the correct structure but the values are out of date. Specifically, some of the drop chances in the 'prob' field are greater than 1000. This will not cause any problems. It is just that any value greater than 1000 is treated as being 1000 by the drops code.
For example if you have an item with a 'prob' of 1000 and another with 150,000 they will both be read as 1000 by the server and therefore will both have a 100% chance of being added to the item drop shortlist. (more explanation of operation of this mod will follow)

list_skillbooks.zip
(3.45 KiB) Downloaded 909 times

The skillbooks database table contains ALL EVO skillbooks. they are segregated by player level at which they can be used. They will then be dropped by ghosts which are within a range of +/- 15 levels or so of that level. Some server owners may want to delete common skill books from this list and just leave the rare ones. It's your choice. For use with OsiRose the entire skill list will need to be recompiled as they are all completely different.

I also have a little utility built in Microsoft Excel which may help you to design and build your own custom drops table. (provided you have Excel that is)
drop calculator for test.zip
(134.06 KiB) Downloaded 961 times

This contains a lookup table that makes finding the item type and id really easy.
Using the 'hidden drops' tab, you can build a table of item drops that directly corresponds to the SQL drops list.
if you enter an item id and item type, the item name will be displayed automatically. The same works for the monster id and map id.
Once you have a suitable drops list, just copy columns a through i (excluding the header row) into a blank workbook and save it as a CSV. From there you can import it directly into your database.
Easy isn't it?

Just a few little notes on how to use the drops system to your best advantage.
When a monster is killed, the entire drops list is parsed inside the server. ANY item which could potentially be dropped from this mob is identified and a random number is generated (1 to 1000) If this number is smaller than the item's 'prob' value then the item is added to a shortlist of potential drops.
If you set the item's 'prob' to 1000 (or greater) then you absolutely guarantee that the item will be added to the short list.
Once all the drops have been parsed, the server then takes a look to see how many items exist inside the shortlist. Let's say for example 10 items made the grade and were included.
The server now generates a random number that corresponds to one of those 10 items. Each has an equal chance.
The final choice is returned to the program and will be dropped.

  • If you have an item that you want to always be added to short list (eg fruit) make its 'prob' value 1000
  • don't make too many items with high 'prob' values that are able to fall from any particular mob. The shortlist can handle any number of items but you will just end up diluting the chance of any particular item dropping if the shortlist contains too much stuff.
  • My item_drops database works largely by level range drops as it is currently set up. You might want to change this to make items drop by mob. Please feel free to experiment and configure it however you like. If you want a mini Jelly bean to drop a Turak Axe then that is your choice. It may suck but its still your choice.
  • You will note that in my drops code, your actual drop chance from any specific mob is largely dependent on the level difference between you and the mob. If the mob is exactly your level (Yellow name) then your chance of getting something will be 80%. If the thing is red or purple then it will be 100% but if it is lower than you then the chance rapidly drops away down to a minimum level of 10% at 20 levels below you. Yes this means that a level 200+ character will still get the occasional drop from a mini-jelly bean. If you think this is a crap idea just find this line in the new GetPYdrops function and comment it out
    1. if(dropchance < 10) dropchance = 10; //always a small chance of a drop even when the mob is more than 20 levels beneath your own
  • The number of items that drop in a useitem or mat drop is proportional to your CHA stat. More CHA = more drops (not drop chance, just drop amount). I could potentially alter the drop chance too if requested. just never got around to it. I like making character stats actually DO something in the game :)

Well that's about it. Let me know if you have problems or if you would like modifications added.
I will also be releasing a revised and more up to date drops database shortly but in the meantime please fell free to design your own custom drop list.

Enjoy

Code and design by PurpleYouko, Kuro-Tejina.com and SpiritFox Productions
Last edited by PurpleYouko on Fri Dec 21, 2007 8:08 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: 4733
Joined: Fri Aug 10, 2007 2:05 pm

Re: Custom drops code (prequel to custom events)

Postby lmame on Fri Dec 21, 2007 6:07 pm

Well, what to say but wah :D
The world is full of love and peace ^_^
Image
User avatar
lmame
Admin
Admin
 
Posts: 8997
Joined: Mon Aug 06, 2007 4:42 pm
Location: July City

Re: Custom drops code (prequel to custom events)

Postby rl2171 on Fri Dec 21, 2007 6:19 pm

Wow!

Great job.

One question for you, I like to keep the drops at this time close to what RoseNA has, then will add anything for things like events, etc in later.

Do you have a tool that would take the 2 stbs (not sure if you need both Drop STBs or not) and make it into the sql file?

Thank again!

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

Re: Custom drops code (prequel to custom events)

Postby PurpleYouko on Fri Dec 21, 2007 6:54 pm

Do you have a tool that would take the 2 stbs (not sure if you need both Drop STBs or not) and make it into the sql file?

I could probably put something together that would do that.
I hadn't actually thought about doing that but it would make a lot of sense i suppose

It would just require a spreadsheet and a few lookup tables from the stbs and a nice little macro to parse all the data in the drops table.

I will check out how easy it would be to do and get back to you.
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: 4733
Joined: Fri Aug 10, 2007 2:05 pm

Re: Custom drops code (prequel to custom events)

Postby lmame on Fri Dec 21, 2007 8:46 pm

I guess we could do this in php too, or even a convertor csv to mysql in php for the existing csv drop files.
The world is full of love and peace ^_^
Image
User avatar
lmame
Admin
Admin
 
Posts: 8997
Joined: Mon Aug 06, 2007 4:42 pm
Location: July City

Re: Custom drops code (prequel to custom events)

Postby PurpleYouko on Fri Dec 21, 2007 9:41 pm

lmame wrote:I guess we could do this in php too, or even a convertor csv to mysql in php for the existing csv drop files.


it turned out to be pretty easy to make an excel macro to convert the entire drops list into my format.

here is the converted list in compatible SQL format
item_drops(2).zip
(49.83 KiB) Downloaded 966 times

it only came to 9515 unique entries. ;)

Oh and if anyone is interested they can have the excel utility too. just let me know.
Just plug in the drops list, click a button, wait about a minute and out pops the new table of data. Copy/paste it to a new spreadsheet and save it as CSV. then load it into the DB with phpmyadmin. :)

Obviously i haven't tested this yet but it should work just fine. I have kept the original aspect ratio of all the drops by dividing them by a constant that puts the highest value at just less than 1000.

enjoy

PS working on ab excel STB editor right now.
I can already read the STB directly into an excel spreadsheet. All i have to do now is write the code to save the modified data directly back into the STB.

I'm on a roll today hehe ;)
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: 4733
Joined: Fri Aug 10, 2007 2:05 pm

Re: Custom drops code (prequel to custom events)

Postby lmame on Fri Dec 21, 2007 9:52 pm

Nice work :D

Yeah it would be interesting (Excel file), long time since I did some macros :)
The world is full of love and peace ^_^
Image
User avatar
lmame
Admin
Admin
 
Posts: 8997
Joined: Mon Aug 06, 2007 4:42 pm
Location: July City

Re: Custom drops code (prequel to custom events)

Postby PurpleYouko on Fri Dec 21, 2007 10:23 pm

Quick note.

the last few items in the converted drops database don't make any sense. everything past item #9460 come in with a type 0 value. They should be deleted.

I have no idea what these last few items in the old drops list are used for.

It should also be noted that the ghosts have their individual drops set up in this table. If you use this with my code as it is, the ghost drops in the SQL will be ignored. In order to use the ghost drops from the SQL you will need to disable the part of my drops code that deals with ghost drops specifically.
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: 4733
Joined: Fri Aug 10, 2007 2:05 pm

Re: Custom drops code (prequel to custom events)

Postby lmame on Fri Dec 21, 2007 10:37 pm

I'll try to integrate the code tomorrow ^_^
The world is full of love and peace ^_^
Image
User avatar
lmame
Admin
Admin
 
Posts: 8997
Joined: Mon Aug 06, 2007 4:42 pm
Location: July City

Re: Custom drops code (prequel to custom events)

Postby lmame on Sat Dec 22, 2007 8:46 pm

Couldn't have done it, because I'm as good as dead :lol:, my head hurts, will do it tomorrow.
The world is full of love and peace ^_^
Image
User avatar
lmame
Admin
Admin
 
Posts: 8997
Joined: Mon Aug 06, 2007 4:42 pm
Location: July City

Next

Return to Submit Code

Who is online

Users browsing this forum: No registered users and 6 guests