• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!

Help with Locker/Sending Parcel/Market

dkangel83

Member
Joined
Mar 31, 2010
Messages
148
Reaction score
18
Location
Brazil
Hiho..

I want to create a depot place for no vocation players, but the problem is, anyone would be able to send to them a parcel from mainland, and even the char could buy from market..

is there anyway to block no vocation char from buying items in market also a player to send a parcel to a no vocation player? if yes, could explain detailed how?

i tried to take a look in many places and nothing..

Thanks in Advance

is there anyone able to help?
 
Last edited by a moderator:
Please don't bump your posts unless 24 hours has passed since your last message. Only thing I could recommend is since market and inbox are technically items, do an onUse script with those ids and if the player has no vocation, return false and prevent them from using the item.
 
Sorry about bump to early.. isnt the case at all, i want them to use depot .. i dont want another one to send them a parcel.. and market i really dont know too how..
 
well, I believe all the mail and market is handled in the source. For the mail, you could maybe do an onAddItem and if the item is a parcel landing on a mailbox, check the label inside to see if the name is a player with no vocation. If so, put the parcel back to its origin. A bit tedious but I think it might work. for the market, I don't think there's anything you can do in lua to allow them to view without buying. You'd have to simply block it for them.
 
i got what @RazorBlade told but since i dont know functions/params i dont know how to.. i tried by myself.. tried to get some help out there but is really hard to find some :/ since i tried to get how to but i really dont know where to start..

Well.. anyone to help with blocking a player from opening mail and market?

i rly would like to know if is there anyone to at least tell me which param/function or (most helpful) gimme the base, some starting lines..

by now i just need to block market/mail from player that i can set 0 (no vocation)
Locker that hold 3 boxes
16:38 You see a locker (Vol:3).
Item ID: 2589

16:38 You see a depot chest (Vol:30).
Item ID: 2594
[i want to block]
16:38 You see your inbox (Vol:30).
Item ID: 14404
16:38 You see the market.
Item ID: 14405
[/]

Thanks in advance
 
Done by changing source. adding the verification thanks to luan who gave me the tip about where and what use

if (vocation->getId() != VOCATION_NONE) {}

Code:
DepotLocker* Player::getDepotLocker(uint32_t depotId)
{
    auto it = depotLockerMap.find(depotId);
    if (it != depotLockerMap.end()) {
        inbox->setParent(it->second);
        return it->second;
    }

    DepotLocker* depotLocker = new DepotLocker(ITEM_LOCKER1);
    depotLocker->setDepotId(depotId);
    if (vocation->getId() != VOCATION_NONE) {
        depotLocker->internalAddThing(Item::CreateItem(ITEM_MARKET));
        depotLocker->internalAddThing(inbox);
    }
    depotLocker->internalAddThing(getDepotChest(depotId, true));
    depotLockerMap[depotId] = depotLocker;
    return depotLocker;
}

This part of the problem.. Solved
jLxoG6O.gif

Im trying to make the parcel verification thing to make it return to sender, as @RazorBlade told..
 
It can't really be done that way. The below code should do exactly what you want, but unfortunately, it will not. If the name on the label matches a player, it sends and ignores the rest of the script after like line 2 or 3. I used a bunch of prints and it went through everything and worked up until a correct name was entered. If an incorrect name is entered, it did run through everything correctly. Unfortunately, mail is handled in the source, and the sending does not take into account the sender, only the receiver. I think there may be a C++ workaround. I'll give it a try.
http://pastebin.com/vKQ5EeZY
 
Done by changing source. adding the verification thanks to luan who gave me the tip about where and what use

if (vocation->getId() != VOCATION_NONE) {}

Code:
DepotLocker* Player::getDepotLocker(uint32_t depotId)
{
    auto it = depotLockerMap.find(depotId);
    if (it != depotLockerMap.end()) {
        inbox->setParent(it->second);
        return it->second;
    }

    DepotLocker* depotLocker = new DepotLocker(ITEM_LOCKER1);
    depotLocker->setDepotId(depotId);
    if (vocation->getId() != VOCATION_NONE) {
        depotLocker->internalAddThing(Item::CreateItem(ITEM_MARKET));
        depotLocker->internalAddThing(inbox);
    }
    depotLocker->internalAddThing(getDepotChest(depotId, true));
    depotLockerMap[depotId] = depotLocker;
    return depotLocker;
}

This part of the problem.. Solved
jLxoG6O.gif

Im trying to make the parcel verification thing to make it return to sender, as @RazorBlade told..
Try this. In mailbox.cpp replace your sendItem function with this one

http://pastebin.com/xVLdDs2y

It's a bit of a hacky workaround, but it'll grab the player who wrote the label and send the parcel to them instead if the receiver has no vocation.
 
Hiho i was kinda busy just saw your post right now.. Thanks for the support..
I tried to handle the inbox/market thing by lua code by myself but nothing.. since i dont know how to work with functions and params like a pro i just tried using simple commands... total unsuccessful.. then a brazilian member's forum told me to try that change in player.cpp .. what became useful in its way.. no vocation player has no access and its normal to players with vocations..

Now i tried your change in mailbox.cpp but it gives me error when building (release mode x64)

Code:
1>------ Build started: Project: theforgottenserver, Configuration: Release x64 ------
1>  otpch.cpp
1>  actions.cpp
1>  ban.cpp
1>  baseevents.cpp
1>  bed.cpp
1>  chat.cpp
1>  combat.cpp
1>  commands.cpp
1>  condition.cpp
1>  configmanager.cpp
1>  connection.cpp
1>  container.cpp
1>  creature.cpp
1>  creatureevent.cpp
1>  cylinder.cpp
1>  database.cpp
1>  databasemanager.cpp
1>  databasetasks.cpp
1>  depotchest.cpp
1>  depotlocker.cpp
1>  events.cpp
1>  fileloader.cpp
1>  game.cpp
1>  globalevent.cpp
1>  groups.cpp
1>  guild.cpp
1>  house.cpp
1>  housetile.cpp
1>  inbox.cpp
1>  ioguild.cpp
1>  iologindata.cpp
1>  iomap.cpp
1>  iomapserialize.cpp
1>  iomarket.cpp
1>  item.cpp
1>  items.cpp
1>  luascript.cpp
1>  mailbox.cpp
1>  map.cpp
1>..\src\mailbox.cpp(106): error C2039: 'getItemList' : is not a member of 'Item'
1>          c:\testes\forgottenserver-master\src\item.h(301) : see declaration of 'Item'
1>..\src\mailbox.cpp(108): error C2039: 'capacity' : is not a member of 'Item'
1>          c:\testes\forgottenserver-master\src\item.h(301) : see declaration of 'Item'
1>..\src\mailbox.cpp(109): error C2039: 'getId' : is not a member of 'Item'
1>          c:\testes\forgottenserver-master\src\item.h(301) : see declaration of 'Item'
1>..\src\mailbox.cpp(114): error C2440: 'initializing' : cannot convert from 'const std::string' to 'Player *'
1>          No user-defined-conversion operator available that can perform this conversion, or the operator cannot be called
1>  monster.cpp
1>  monsters.cpp
1>  mounts.cpp
1>  movement.cpp
1>  networkmessage.cpp
1>  npc.cpp
1>  otserv.cpp
1>  outfit.cpp
1>  outputmessage.cpp
1>  party.cpp
1>  player.cpp
1>  position.cpp
1>  protocol.cpp
1>  protocolgame.cpp
1>  protocollogin.cpp
1>  protocolold.cpp
1>..\src\protocollogin.cpp(50): warning C4100: 'version' : unreferenced formal parameter
1>  protocolspectator.cpp
1>  quests.cpp
1>  raids.cpp
1>  rsa.cpp
1>  scheduler.cpp
1>  scriptmanager.cpp
1>  server.cpp
1>  spawn.cpp
1>  spells.cpp
1>  protocolstatus.cpp
1>  talkaction.cpp
1>  tasks.cpp
1>  teleport.cpp
1>  thing.cpp
1>  tile.cpp
1>  tools.cpp
1>  trashholder.cpp
1>  vocation.cpp
1>  waitlist.cpp
1>  weapons.cpp
1>  wildcardtree.cpp
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========

it may be useful

6de275b7fe424262936ce76cd8b5a8e4.png

0E3RDhs.png

2acbadac3de241d3853e092ee8348a47.png

O4ZgkPd.png

3a7f407ba9a947349f90b7c2bdc5ae8d.png

im using this one -- TFS 1.2 by Bruno Minervino
I was going to take a look in your lua script after compiling but :p

Thanks ocne again for your support
 
Try this. In mailbox.cpp replace your sendItem function with this one

http://pastebin.com/xVLdDs2y

It's a bit of a hacky workaround, but it'll grab the player who wrote the label and send the parcel to them instead if the receiver has no vocation.
Just hope they dont grab an old parcel label. xD
 
Just hope they dont grab an old parcel label. xD

Well right now it isnt a big problem cuz a no vocation player has no access to mail nor market, as you can see in the gif that i made in previous post.. the case is make parcel back to the sender.. if the guy use an old label.. he'll "lose" the parcel till the no vocation player be able to leave and open its mailbox having a vocation..

//
Im trying to understand what Razor meant with "It can't really be done that way." .. if its about the mail/market block or about the lua script.. what i figured out too ... but since he told it cant be done im 100% sure now.. cuz he's pro im just a newbie :)
 
Well right now it isnt a big problem cuz a no vocation player has no access to mail nor market, as you can see in the gif that i made in previous post.. the case is make parcel back to the sender.. if the guy use an old label.. he'll "lose" the parcel till the no vocation player be able to leave and open its mailbox having a vocation..

//
Im trying to understand what Razor meant with "It can't really be done that way." .. if its about the mail/market block or about the lua script.. what i figured out too ... but since he told it cant be done im 100% sure now.. cuz he's pro im just a newbie :)
Updated. try now
http://pastebin.com/xVLdDs2y
As for the "It can't really be done that way"
It was in regards to my original suggestion. It can't use an addItem function to check the name because as soon as the mailbox realizes it's a valid parcel/label, it sends, and ignores the rest of the script. This is because all the mail is handled in the source and the mailbox function happens first. If mail was moved to lua (which it could be) then my lua script that I posted would work, it would just need to be modified slightly to include the normal mail functionality. but that's a real hassle. the updated c++ portion should do what you need.
 
Just hope they dont grab an old parcel label. xD
well, it'll only grab the writer if the receiver has no vocation, so they shouldn't have any issues since there shouldn't really be any others. I mean if you really wanted to play it safe, you could just record the info then destroy the label before sending.
 
Updated. try now
http://pastebin.com/xVLdDs2y
As for the "It can't really be done that way"
It was in regards to my original suggestion. It can't use an addItem function to check the name because as soon as the mailbox realizes it's a valid parcel/label, it sends, and ignores the rest of the script. This is because all the mail is handled in the source and the mailbox function happens first. If mail was moved to lua (which it could be) then my lua script that I posted would work, it would just need to be modified slightly to include the normal mail functionality. but that's a real hassle. the updated c++ portion should do what you need.

I imagine twas about the 1st idea but wasnt sure :p

mailbox.cpp updated but

Code:
1>------ Build started: Project: theforgottenserver, Configuration: Release x64 ------
1>  mailbox.cpp
1>..\src\mailbox.cpp(107): error C2440: 'initializing' : cannot convert from 'const ItemDeque' to 'Item *[]'
1>          No user-defined-conversion operator available that can perform this conversion, or the operator cannot be called
1>..\src\mailbox.cpp(109): error C2039: 'capacity' : is not a member of 'Item'
1>          c:\testes\forgottenserver-master\src\item.h(301) : see declaration of 'Item'
1>..\src\mailbox.cpp(110): error C2039: 'getId' : is not a member of 'Item'
1>          c:\testes\forgottenserver-master\src\item.h(301) : see declaration of 'Item'
1>..\src\mailbox.cpp(115): error C2440: 'initializing' : cannot convert from 'const std::string' to 'Player *'
1>          No user-defined-conversion operator available that can perform this conversion, or the operator cannot be called
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========

also

Am7sjdb.png
 
I'll have to make an iterator to pull the values from the deque and throw them in the table and I'll fix the other errors as well. But I have to sleep now, it's 7:22 am and I haven't been to bed yet.
 
I'll have to make an iterator to pull the values from the deque and throw them in the table and I'll fix the other errors as well. But I have to sleep now, it's 7:22 am and I haven't been to bed yet.

I know the feeling.. im awake for more than 14hrs now .. falling asleep .. but i need to be here for a little more.. but thanks.. i'll be waiting for some news.. i know that ure a busy person too so take your time :D

Thanks again :D
 
I was just commenting. :p
In the rare scenario that someone attempts to send a no vocation a parcel and they happen to grab an old parcel tag, which someone else had also tried sending to that no vocation, and did not edit it, the parcel would be sent back to the wrong person.
Extremely unlikely, very improbable, it's barely cause for concern, but still, a possibility. :rolleyes:
Was just a passing thought on the situation. :oops:
 
I was just commenting. :p
In the rare scenario that someone attempts to send a no vocation a parcel and they happen to grab an old parcel tag, which someone else had also tried sending to that no vocation, and did not edit it, the parcel would be sent back to the wrong person.
Extremely unlikely, very improbable, it's barely cause for concern, but still, a possibility. :rolleyes:
Was just a passing thought on the situation. :oops:
No hate here, I did think about it myself but as you said, it's so unlikely that I didn't bother altering the existing structure of the sending in order to remedy it. If he finds it actually happens, I can definitely just destroy the label if the receiver has no voc ;3

@dkangel83
updated. http://pastebin.com/xVLdDs2y
hopefully this one works
 
No hate here, I did think about it myself but as you said, it's so unlikely that I didn't bother altering the existing structure of the sending in order to remedy it. If he finds it actually happens, I can definitely just destroy the label if the receiver has no voc ;3

@dkangel83
updated. http://pastebin.com/xVLdDs2y
hopefully this one works

Hiho thanks for being comprehensive and patient in help :) but look

Code:
1>------ Build started: Project: theforgottenserver, Configuration: Release x64 ------
1>  mailbox.cpp
1>..\src\mailbox.cpp(108): error C2057: expected constant expression
1>..\src\mailbox.cpp(108): error C2466: cannot allocate an array of constant size 0
1>..\src\mailbox.cpp(108): error C2133: 'itemlist' : unknown size
1>..\src\mailbox.cpp(114): warning C4018: '<' : signed/unsigned mismatch
1>..\src\mailbox.cpp(120): error C2440: 'initializing' : cannot convert from 'const std::string' to 'Player *'
1>          No user-defined-conversion operator available that can perform this conversion, or the operator cannot be called
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========

im just doing the copy/paste one by another
 
Back
Top