Welcome!

Join our community of MMO enthusiasts and game developers! By registering, you'll gain access to discussions on the latest developments in MMO server files and collaborate with like-minded individuals. Join us today and unlock the potential of MMO server development!

Join Today!

Sandbox mode for v83?

Initiate Mage
Joined
May 24, 2017
Messages
57
Reaction score
1
Hey everyone,

I was wondering how I'd be able to code such a feature? If anyone's not aware of what I mean, it's basically a way to allow players to test items before purchasing them but not actually giving them the item permanently but temporary until they leave the map which then it would disappear from their inventory.

If anyone has any ideas on how I might do that I appreciate it.
 
Moderator
Staff member
Moderator
Joined
Jul 30, 2012
Messages
1,102
Reaction score
432
Something that the internet cafe in MSEA did? Basically, if you were connected to internet cafe you had temp 'internet cafe' items which would disappear once you log out.
 
Upvote 0
Initiate Mage
Joined
May 24, 2017
Messages
57
Reaction score
1
Something that the internet cafe in MSEA did? Basically, if you were connected to internet cafe you had temp 'internet cafe' items which would disappear once you log out.

Yes, it basically allows the player to have an equip to try it out before actually buying it.
 
Upvote 0
Moderator
Staff member
Moderator
Joined
Jul 30, 2012
Messages
1,102
Reaction score
432
Pretty sure there's a node in the .wz files for specific items that removes an item upon logging out. I guess you can use this if people try log out with the item. Of course you would have to code the function.

For leaving the map I guess you could create a scripted portal that removes any item a user has with a specific node or property. Never did something like this before, but pretty sure your idea is do-able.
 
Upvote 0
Joined
Mar 5, 2011
Messages
1,086
Reaction score
212
Yeah. I coded something quite similar to this, using a item flag was never used for anything, this was in v117 though. So, basically all you need to do is make a npc that gives an item with a certain flag, add one from the normal ones or code one, then once they leave, prefer doing it though a NPC, and it possible to only leave through that NPC, it will delete all items that have that flag in your inventory, and/or equipped. If you want to do a safety check, add a check in to see if they have any equipped while logging in, deleting them, of course.

poop, I sort of want to code this myself now, haha.
 
Upvote 0
Initiate Mage
Joined
Mar 25, 2016
Messages
86
Reaction score
26
oh yeah and make sure they can't escape the map by using a telerock or some sort (exploiting it).
Easier to do if you just don't actually give the item to the player and it's only a visual.
Ignore some checks while in xx map, ezpz no item gen/dupe exploits.

How you properly remove it once they leave is up to you. Can do some extra checks or something, resend SetField, etc
 
Upvote 0
Initiate Mage
Joined
May 24, 2017
Messages
57
Reaction score
1
Yeah. I coded something quite similar to this, using a item flag was never used for anything, this was in v117 though. So, basically all you need to do is make a npc that gives an item with a certain flag, add one from the normal ones or code one, then once they leave, prefer doing it though a NPC, and it possible to only leave through that NPC, it will delete all items that have that flag in your inventory, and/or equipped. If you want to do a safety check, add a check in to see if they have any equipped while logging in, deleting them, of course.

poop, I sort of want to code this myself now, haha.

Do you mean like make it so every equip gained from that NPC has a custom name tag and just remove every item gained with that name tag when they leave the map?


Easier to do if you just don't actually give the item to the player and it's only a visual.
Ignore some checks while in xx map, ezpz no item gen/dupe exploits.

How you properly remove it once they leave is up to you. Can do some extra checks or something, resend SetField, etc
I'm not sure I understand what you mean by giving them a visual and not actually the item.
 
Upvote 0
Junior Spellweaver
Joined
Sep 16, 2017
Messages
156
Reaction score
36
Do you mean like make it so every equip gained from that NPC has a custom name tag and just remove every item gained with that name tag when they leave the map?
This is the simplest solution, in my opinion.

Setting the item owner to a specific tag, maybe something like "tmp" (so that you don't risk legit name tags to be mistaken by the server and accidentally deleted), and then having the server remove any player item with that very nametag, upon map change, disconnection, or channel change.
 
Upvote 0
Junior Spellweaver
Joined
Apr 30, 2012
Messages
100
Reaction score
40
This is the simplest solution, in my opinion.

Setting the item owner to a specific tag, maybe something like "tmp" (so that you don't risk legit name tags to be mistaken by the server and accidentally deleted), and then having the server remove any player item with that very nametag, upon map change, disconnection, or channel change.

This is the incorrect solution, Arnah's is better.
Pure visual is the way to go. You can craft packets that display the items you want without actually modifying their inventory objects. (This is what I did on ArcticMS)
 
Upvote 0
Initiate Mage
Joined
May 24, 2017
Messages
57
Reaction score
1
This is the simplest solution, in my opinion.

Setting the item owner to a specific tag, maybe something like "tmp" (so that you don't risk legit name tags to be mistaken by the server and accidentally deleted), and then having the server remove any player item with that very nametag, upon map change, disconnection, or channel change.

I actually think that would be abused since players could packet edit to travel to another map and skip the NPC that removes the item.


This is the incorrect solution, Arnah's is better.
Pure visual is the way to go. You can craft packets that display the items you want without actually modifying their inventory objects. (This is what I did on ArcticMS)
Is there a guide that would be helpful for this example?
 
Upvote 0
Junior Spellweaver
Joined
Apr 30, 2012
Messages
100
Reaction score
40
I actually think that would be abused since players could packet edit to travel to another map and skip the NPC that removes the item.



Is there a guide that would be helpful for this example?

No, but it's conceptually simple. I'll throw you a bone.
You'll need to create a separate inventory object (either a clone of their previous, or a blank slate if you don't want to display anything new.) This can be handled any way you like, probably in MapleInventoryManipualtor.
Add a few checks here and there to reference this new object for the related packets. This should be enough to get you started.
PHP:
    private static void addInventoryInfo(final OutPacket packet, User user) {
        for (byte i = 1; i <= 5; i++) {
            packet.encode1(user.getInventory(InventoryType.getByType(i)).getSlotLimit());
        }
        packet.encode8(getTime(-2));
        Inventory iv = user.hasFakeInventory() ? user.getFakeInventory() : user.getInventory(InventoryType.EQUIPPED);
PHP:
  private static void addCharEquips(final OutPacket packet, User user) {
        Inventory equip = !user.hasFakeInventory() ? user.getInventory(InventoryType.EQUIPPED) : user.getFakeInventory();
PHP:
public Inventory buildFakeEquipped(User base, int... items) {//maybe other stuff later..
        generateFakeInventoryObject(base);
        Inventory fake = getFakeInventory();
        ItemInformationProvider mi = ItemInformationProvider.getInstance();
        List<Pair<Equip, Short>> eq = new ArrayList<>();
        if(base != null) {//copy all eq from a user

When a user is removed from the map, you can clear the object
PHP:
public void checkFakeEquip(boolean keep, boolean silent) {
        if(!keep && hasFakeInventory()) {
              cleanFakeInventory(false);//just incase?
              styleCopy(this);//this is either genius or stupid
              if(!silent) dropMessage(5,"Your trial equipment has been reverted.");
              this.fakeInventory=null;//fkk
              map.broadcastMessage(this, ArcticPacket.updateCharLook(this), false);
         }
    }
 
Last edited:
Upvote 0
Junior Spellweaver
Joined
Sep 16, 2017
Messages
156
Reaction score
36
I actually think that would be abused since players could packet edit to travel to another map and skip the NPC that removes the item.
But you'd have no NPC to remove the item; simply remove, from the player inventory, any item with tag "tmp", upon player cc, relog, map change.
You'd add handling for that in the very functions that handle those events. There's no packet to skip or circumvent that.
 
Upvote 0
Initiate Mage
Joined
May 24, 2017
Messages
57
Reaction score
1
I'm willing to pay to anyone who has the full code to this feature, please PM me or reply here.
 
Upvote 0
Initiate Mage
Joined
May 24, 2017
Messages
57
Reaction score
1


It seems that Ronan added a command that can fit your exact needs. Haha. Was commited like a day ago.

Holy poop, you're a life saver! This is exactly what I needed and there's also many things I could learn from this.

Thank you!

EDIT: This made me so happy seeing this. I love this guy/girl.
 
Last edited:
Upvote 0
Back
Top