Jump to content

Release: AnyMapDrops


Hyroshima

Recommended Posts


  • Group:  Members
  • Topic Count:  35
  • Topics Per Day:  0.01
  • Content Count:  189
  • Reputation:   122
  • Joined:  07/11/14
  • Last Seen:  

AnyMapDrops


This mod made in map_drops.yml now allows you to add drops globally (without specifying a map), I also added a parameter where the added item can go directly to the player's inventory if there is space.

Example of use ( db\import\map_drops.yml )

Header:
  Type: MAP_DROP_DB
  Version: 2

Body:
 - Map: ANY
   GlobalDrops:
    - Index: 0
      Item: Union_Token
      Rate: 50000
      DirectInventory: true
    - Index: 1
      Item: Flower
      Rate: 100000
   SpecificDrops:
     - Monster: Fabre
       Drops:
         - Index: 0
           Item: White_Gold_Coin
           Rate: 50000
           DirectInventory: true
         - Index: 1
           Item: Izidor
           Rate: 50000
     - Monster: Poring
       Drops:
         - Index: 0
           Item: Crystal_Jewel__
           Rate: 50000

Note 1: To be valid across all maps, set the map name to ANY.

Note 2: The new parameter DirectInventory ( false | true ) allows the item to go directly to the inventory.

Note 3: I created 2 new mapflags (nomapdrops and mapdrops), the first is self-explanatory (does not drop any items from map_drops 😅), the second will be effective for instances, as now map_drops does not drop items in instances, so just apply the second mapflag on the instance (in the instance maps) to make it work again.
  Example of use:

OnInstanceInit:
	setmapflag instance_mapname("1@nyd"),mf_mapdrops;
	setmapflag instance_mapname("2@nyd"),mf_mapdrops;


Next updates I will add a parameter to mapdrops.yml if you want the item to be dropped in instances too instead of having to use the mapdrops mapflag.
 

Quote

Obs: i am making 2 diff files available:

  • _A = Closest to current revision.
  • _B = A little older compared to the current review

As there have been some changes to how some functions receive/send parameters, I will try to maintain this standard when sending diff files.


 

  • Upvote 1
  • Love 6
Link to comment
Share on other sites

  • 7 months later...

  • Group:  Members
  • Topic Count:  13
  • Topics Per Day:  0.00
  • Content Count:  97
  • Reputation:   2
  • Joined:  04/27/16
  • Last Seen:  

(gdb) bt full

#0  0x0000555555713475 in mob_dead (md=md@entry=0x5555793e3d74, src=src@entry=0x5555793e3d74, type=<optimized out>) at mob.cpp:3011
        item_tmp = {id = 0, nameid = 35077, amount = 0, equip = 0, identify = 1 '\001', refine = 0 '\000', attribute = 0 '\000', card = {0, 0, 0, 0}, 
          option = {{id = 0, value = 0, param = 0 '\000'}, {id = 0, value = 0, param = 0 '\000'}, {id = 0, value = 0, param = 0 '\000'}, {id = 0, 
              value = 0, param = 0 '\000'}, {id = 0, value = 0, param = 0 '\000'}}, expire_time = 0, favorite = 0 '\000', bound = 0 '\000', unique_id = 0, 
          equipSwitch = 0, enchantgrade = 0 '\000'}
        flag = <optimized out>
        it = {first = 0, second = std::shared_ptr<s_mob_drop> (use count 1, weak count 0) = {get() = 0x55555a10e310}}
        __for_range = <optimized out>
        __for_begin = <optimized out>
        __for_end = <optimized out>
        specific = <optimized out>
        ditem = <optimized out>
        drop_modifier = 100
        mapdrops = std::shared_ptr<s_map_drops> (use count 3, weak count 0) = {get() = 0x555559881e90}
        map_drop_run = 2
        on_instance = false
        dlist = 0x555563c72960
        drop_rate = <optimized out>
        anymapdrops = <optimized out>
        status = 0x5555793e41e8
        sd = <optimized out>
        tmpsd = {0x5555aed4f150, 0x0 <repeats 29 times>}
        mvp_sd = <optimized out>
        second_sd = <optimized out>
        third_sd = <optimized out>
        pt = {{p = 0x5555af5df394, id = 0, zeny = 0, base_exp = 0, job_exp = 0}, {p = 0x0, id = 0, zeny = 0, base_exp = 0, job_exp = 0} <repeats 29 times>}
        i = <optimized out>
        temp = <optimized out>
        count = <optimized out>
        m = 78
        dmgbltypes = <optimized out>
        mvp_damage = <optimized out>
        tick = 66734893
        rebirth = <optimized out>
        homkillonly = <optimized out>
        merckillonly = false
#1  0x00005555558eb57d in status_damage (src=src@entry=0x5555793e3d74, target=target@entry=0x5555793e3d74, dhp=<optimized out>, dsp=dsp@entry=0, 
    dap=dap@entry=0, walkdelay=walkdelay@entry=0, flag=<optimized out>, skill_id=173) at status.cpp:1577
        status = 0x5555793e41e8
        sc = 0x5555793e426c
        hp = <optimized out>
        sp = <optimized out>
        ap = <optimized out>
        __FUNCTION__ = "status_damage"
#2  0x0000555555892b18 in status_damage (skill_id=<optimized out>, flag=1, walkdelay=0, dsp=0, dhp=<optimized out>, target=0x5555793e3d74, 
    src=0x5555793e3d74) at /home/debian/rathena/src/map/status.hpp:3310
No locals.
#3  skill_castend_nodamage_id (src=0x5555793e3d74, bl=0x5555793e3d74, skill_id=<optimized out>, skill_lv=<optimized out>, tick=66734882, flag=0)
    at skill.cpp:8852
        sd = <optimized out>
        dstsd = <optimized out>
        md = <optimized out>
        dstmd = 0x5555793e3d74
        hd = <optimized out>
        mer = 0x0
        sstatus = <optimized out>
        tstatus = <optimized out>
        tsc = <optimized out>
        tsce = <optimized out>
        i = <optimized out>
        type = <optimized out>
        __FUNCTION__ = "skill_castend_nodamage_id"
        sc = <optimized out>
#4  0x00005555558baf76 in skill_castend_id (tid=<optimized out>, tick=66734882, id=<optimized out>, data=<optimized out>) at skill.cpp:13486
        fail = <optimized out>
        res = <optimized out>
        target = <optimized out>
        src = 0x5555793e3d74
        sd = <optimized out>
        md = 0x5555793e3d74
        ud = <optimized out>
        flag = 0
        sc = 0x5555793e426c
#5  0x0000555555916ea4 in do_timer (tick=<optimized out>) at timer.cpp:373
        tid = <optimized out>
        diff = <optimized out>
        __FUNCTION__ = "do_timer"
#6  0x00005555559129c8 in rathena::server_core::Core::start (this=this@entry=0x7fffffffe370, argc=1, argv=0x7fffffffe4a8) at core.cpp:389
        next = <optimized out>
#7  0x0000555555593fb9 in main_core<rathena::server_map::MapServer> (argv=<optimized out>, argc=<optimized out>) at ../common/core.hpp:102
        server = {<rathena::server_core::Core> = {_vptr.Core = 0x555555a9b170 <vtable for rathena::server_map::MapServer+16>, 
            m_status = rathena::server_core::e_core_status::RUNNING, m_type = rathena::server_core::e_core_type::MAP, m_run_once = false, 
            m_crashed = false}, <No data fields>}
        server = <optimized out>
--Type <RET> for more, q to quit, c to continue without paging--[Status]: Request for connection of icgamelo1 (ip: xx.xxx.xxx.xxx)
ret
#8  main (argc=<optimized out>, argv=<optimized out>) at map.cpp:5380
No locals.

I got this gdb logs after the crash,

looks like something is wrong for this line of code

+                        if(it.second->direct_inventory)
+                        {
+                            if(!pet_create_egg(sd,it.second->nameid))
+                            {
+                                struct item item_tmp = {};
+                                item_tmp.nameid=it.second->nameid;
+                                item_tmp.identify=1;
+
+                                if((flag=pc_additem(sd,&item_tmp,1,LOG_TYPE_SCRIPT))){
+                                    clif_additem(sd,0,0,flag);
+                                    map_addflooritem(&item_tmp,1,sd->bl.m,sd->bl.x,sd->bl.y,0,0,0,0,0);
+                                }
+                            }
+                        }
+                        else
+                        {
+                            // 'Cheat' for autoloot command: rate is changed from n/100000 to n/10000
+                            int32 map_drops_rate = max(1, (it.second->rate / 10));
+                            std::shared_ptr<s_item_drop> ditem = mob_setdropitem(*it.second, 1, md->mob_id);
+                            mob_item_drop( md, dlist, ditem, 0, map_drops_rate, homkillonly || merckillonly );
+                        }

 

 

Link to comment
Share on other sites

  • 1 month later...

  • Group:  Members
  • Topic Count:  1
  • Topics Per Day:  0.00
  • Content Count:  3
  • Reputation:   0
  • Joined:  03/14/24
  • Last Seen:  

image.png.8e4d7c380b772561cacfd78513cd1855.png

Got this crash when using @killmonster command

Edited by exequens
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...