- newnpc->money = STB_NPC.rows[i][19];
- newnpc->item = STB_NPC.rows[i][20];
By the way. I think this could interest someone (thx again, Purple):
PurpleYouko wrote:there are 3 new tables
item_drops
this one lists all of the drops you will will get in the game from regular monsters. Ghosts are handled separately
the fields in the database
each entry in the database represents a specific item which can be dropped in several ways.
ref = primary key. auto increment numerical value that we don't use in the server at all. Useful to keep track of how many fields and stuff for database queries
id = item number of the item in this drop
type = the item type
min_level = used for "level drops". min_level and max_level form the bounds of a set of monsters which could potentially drop this item. Set min_level to 1 and max_level to 10 and this item will drop from ALL monsters that fall into that level range.
max_level = see min_level for explanation
prob = the probability of this item being selected. A random number from 1 to 1000 is generated and if that number is lower than the 'prob' value then the item is passed onto the next step of the selection process. more on that later.
a value of 1000 here is the equivalent of a 100% chance of the item being 'short listed'
map = this item will be dropped by ALL mobs in the specified map
mob = this item will be dropped by this specific mob
alt = this is a list of alternate items to which the basic drop can be converted. Example: the base item is soldier armor. The alt list will contain the 'id' of all possible versions of soldier armor such as Dark Soldier armor, Grand Soldier armor or whatever is available
description = a text value that you can put in to make it easier to see what you have in your drop. not used by the server.
list_config
This is simply a database version of your worldserver.conf file. It is far from complete as yet. i have been using it to hold new configurable values as i add them. Way easier than adding them to the messy conf text files. Also allows for potential permanent modification in game from GM commands
the values related to drops code are as follows
'bluechance' = the % chance of an item being selected from the 'alt' list rather than the base item. this could result in a player getting a basic 'Soldier Armor' converted to a 'Demon Soldier Armor' for example.
'slotchance' = the % chance of an item having a slot. Set to zero to make it impossible
'statchance' = the % chance of an item getting extra stats. It it gets them then it will be set to require appraisal
'refinechance' = the % chance of the item being refined already.
'rarerefine' refers to the probability of a successful refine of this item. If it is a rare item (blue or purple name) it will have it's basic refine chance increased by this amount
list_skillbooks
This is basically a drops list specifically for ghosts.
It was designed this way so that ghosts could be made to drop skillbooks and a few other items. Currently the list also contains some lower grade gems too. You can really add anything you like here and the ghosts will drop it
the fields are very similar to the main item_drops table.
'id' and 'itemtype' are the type and item number of the item
'name' is the name of the item (for reference)
'charlevel' is a reference to the level a char needs to be in order to use a skill. not used by the server.
'min' and 'max' are the level range of ghosts that can drop the item
'prob' is the probability value from 1 to 1000 (0.1% to 100%)
What happens in the drops code?
when a monster dies, the entire drops list is parsed for any item that could possibly be dropped by this monster.
Is the monster in the designated level range of the drop?
Does the current map match the 'map' value of the drop?
does the montype match the 'mob' value of the drop?
If any of these conditions are true (note they can all be true in some cases) then we figure out if the drop will be included in the 'short list' by making a random number (1 to 1000) and comparing it to the 'prob' value of the drop.
If it is lower then the drop is successful and is added to the 'short list'
What is the 'short list'
this is a dynamic array in which any item that passes any of the first set of tests, is placed
Once the entire drops list has been parsed and the 'short list' populated we need to choose an item from this list.
If the list is empty then nothing drops.
If the list contains at least one item then an item from the list is randomly selected (equal chance of any item in it) and this item is returned as the drop.
the specific chance of any monster dropping anything is controlled by it's 'item' and 'money' values in the CNPC structure
these values were already there but never used.
This means that each monster has a different chance of generating an item or zuly drop so it really removes the 'droprate' function from the conf files entirely
I think that is about it. let me know if there are any parts you would like me to explain further.
Also feel free to post this message on the forums for general view if you think it would be helpful.