[FIXED] Can't trade on realms with '-' in the name

Page 1 of 2 1, 2  Next

View previous topic View next topic Go down

[FIXED] Can't trade on realms with '-' in the name

Post  arekku on Fri May 16, 2014 4:35 pm

Long story short, TRP2_ExchangeMonTab["Cible"] at line 997 in totalrp2_invaintaire_main contains the name with a '-' ie player-serverfirst-serverlast, whereas sender in the arguement contains player-serverfirstserverlast

arekku

Posts : 14
Join date : 2014-02-17

View user profile

Back to top Go down

Re: [FIXED] Can't trade on realms with '-' in the name

Post  Ellypse on Sat May 17, 2014 5:24 am

Thank you for reporting this (in great details !), I will add it my list of things to fix for version 1.026 Smile

_________________
Ellypse, Culte de la Rive Noire, FR
Moedra, Kirin Tor, FR
Maison Celwë'Belore, Officer
avatar
Ellypse
Admin

Posts : 215
Join date : 2013-09-26
Age : 26
Location : Paris, France

View user profile http://renaudparize.fr

Back to top Go down

Re: [FIXED] Can't trade on realms with '-' in the name

Post  kerryoco on Wed May 21, 2014 3:03 am

is this still the case? made some items, can't trade them to players on my own realm (Emerald Dream).

we're set to max trust level, but saying scripts blocked.

kerryoco

Posts : 4
Join date : 2014-05-21

View user profile

Back to top Go down

Re: [FIXED] Can't trade on realms with '-' in the name

Post  Ellypse on Wed May 21, 2014 3:26 am

I thought I've fixed it Mad I will have to take a deeper look into that issue. It's hard to test those kind of features by myself but I will try to fix this correctly before release version 1.026.

_________________
Ellypse, Culte de la Rive Noire, FR
Moedra, Kirin Tor, FR
Maison Celwë'Belore, Officer
avatar
Ellypse
Admin

Posts : 215
Join date : 2013-09-26
Age : 26
Location : Paris, France

View user profile http://renaudparize.fr

Back to top Go down

Re: [FIXED] Can't trade on realms with '-' in the name

Post  kerryoco on Wed May 21, 2014 3:58 am

I understand; 2 person issue really. Let me know if I can help, make a trade-toon Smile

It looks like you changed the structure from what arekku referenced already, to just 'sender' ?

kerryoco

Posts : 4
Join date : 2014-05-21

View user profile

Back to top Go down

Re: [FIXED] Can't trade on realms with '-' in the name

Post  Ellypse on Wed May 21, 2014 4:48 am

I've tried to use a function I've added to Total RP 2's API during the transition to connected realm that is supposed to return the name of a unit in a standardized way "PlayerName-ServeurNameWithoutWhateverSpecialCharactersInIt". This format is the format used for the sender name by the chat functions when sending messages.
When trading, several addon messages are sent using the chat functions and the sender is identified using this format. When Total RP 2 sees a trading message, it checks if the name of the sender correspond to the name of the person used when initiating the exchange. When a player is initiating a trade, the addon puts the name of his target in the exchange data. The issue is that the function to get the target name is a mess... Basically, if your target is from a realm connected to yours it will return his name+realmWithNoSpecialCharacters, but if that person is from your realm, it will return only its name. I've created a function in the API that tries to get the full name of a unit using the standard function and if the realm is not given then it takes the realm of the player, which is in the format "The realm name with everything in it" and tries to remove invalid characters. The issue here, I think, is that the character - is tricky as it is both the separator for the player name and its realm and a invalid character that should be remove from the realm's name.

I will investigate more on this issue in the next couple of days. Hopefully I can fix it for the release of version 1.026. I've seen people using an other function for getting unit names, but it seemed to have an even more obscure behavior at the time. Maybe now there is more information on addon development forum.

_________________
Ellypse, Culte de la Rive Noire, FR
Moedra, Kirin Tor, FR
Maison Celwë'Belore, Officer
avatar
Ellypse
Admin

Posts : 215
Join date : 2013-09-26
Age : 26
Location : Paris, France

View user profile http://renaudparize.fr

Back to top Go down

Re: [FIXED] Can't trade on realms with '-' in the name

Post  arekku on Wed May 21, 2014 5:37 am

May I suggest something like
Code:

local name, realm = string.match(s, ".+?%-.+") -- split the string
if not realm then
realm = GetRealmName()
end
realm = string.gsub(realm,"%-","")

NB, haven't tested this because I don't have access to a LUA console ATM

arekku

Posts : 14
Join date : 2014-02-17

View user profile

Back to top Go down

Re: [FIXED] Can't trade on realms with '-' in the name

Post  Ellypse on Wed May 21, 2014 5:46 am

Thank you, I will test your code I love you 
I have to admit I never understood regular expression/matching patterns Rolling Eyes 

_________________
Ellypse, Culte de la Rive Noire, FR
Moedra, Kirin Tor, FR
Maison Celwë'Belore, Officer
avatar
Ellypse
Admin

Posts : 215
Join date : 2013-09-26
Age : 26
Location : Paris, France

View user profile http://renaudparize.fr

Back to top Go down

Re: [FIXED] Can't trade on realms with '-' in the name

Post  arekku on Wed May 21, 2014 6:33 am

Well what that expression does is

.+ match everything
?%- until we encounter a "-"
.+ then match everything

. Any character
+ 1 or more repetitions
? try to match as few characters as possible
%- match the literal character "-" (% is an escape character because - is also used to define ranges, A-Z for instance)
. Any character
+ 1 or more repetitions

You might need to put (.+?) within parenthesis to export it, not very good at lua regexps myself

Actually looking at the lua specs I see they differ from the ones I'm familiar with (POSIX)

"* Match the previous character (or class) zero or more times, as many times as possible.
+ Match the previous character (or class) one or more times, as many times as possible.
- Match the previous character (or class) zero or more times, as few times as possible.
? Make the previous character (or class) optional."

So the lua equivalent for what I usually write "+?" would be "-" (technically ..- but that won't make a difference in this particular case)

arekku

Posts : 14
Join date : 2014-02-17

View user profile

Back to top Go down

Re: [FIXED] Can't trade on realms with '-' in the name

Post  Ellypse on Wed May 21, 2014 6:39 am

Okay, thank you for explaining this.
I understand it better now. So the issue has to come from the expression currently use that seems to get only the last part of server name containing -, so for Emerald-dream it only gets the dream part. The way I currently get the realm is really bad and there surely is a better way.
I will try your expression when I get back home.

Thank you again for the lesson ^^

_________________
Ellypse, Culte de la Rive Noire, FR
Moedra, Kirin Tor, FR
Maison Celwë'Belore, Officer
avatar
Ellypse
Admin

Posts : 215
Join date : 2013-09-26
Age : 26
Location : Paris, France

View user profile http://renaudparize.fr

Back to top Go down

Re: [FIXED] Can't trade on realms with '-' in the name

Post  arekku on Wed May 21, 2014 10:00 am

Managed to find an online lua interpreter (http://www.lua.org/cgi-bin/demo)

Code:

var = "qwerty-uiuiu-trrtr"
v2,v3 = string.match(var,"([^%-]+)%-?(.*)")
print(v2)
print(v3)

Will store qwerty in v2, and uiuiu-trrtr in v3, but return "" if there is no "-" character

[^%-]+ grabs all characters that are not minus "-"
%-? grabs 1 or 0 minus "-"
(.*) grabs whatever is left

[ start set definition
^ complimentary set to
%- the character "-" (% is escape character)
] end set
+ grab as many characters as possible, but at least 1

Unfortunately v3 ends up containing "" if there is no "-", but the result is still usable.


Last edited by arekku on Wed May 21, 2014 11:13 am; edited 1 time in total

arekku

Posts : 14
Join date : 2014-02-17

View user profile

Back to top Go down

Re: [FIXED] Can't trade on realms with '-' in the name

Post  Ellypse on Wed May 21, 2014 10:07 am

Thank you, it is exactly the result I need.
If v3 (realm) is empty, then I will GetCurrentRealm() and do a gsub to remove any "-" so it's like the realm in the sender name.

_________________
Ellypse, Culte de la Rive Noire, FR
Moedra, Kirin Tor, FR
Maison Celwë'Belore, Officer
avatar
Ellypse
Admin

Posts : 215
Join date : 2013-09-26
Age : 26
Location : Paris, France

View user profile http://renaudparize.fr

Back to top Go down

Re: [FIXED] Can't trade on realms with '-' in the name

Post  Ellypse on Wed May 21, 2014 1:37 pm

Well, I've tested again with version 1.026 beta 4 as it is right now and I get it to work. I tried to trade an item with two characters from the same realm having a - in its name (the french server Arak-arahm), and from one character from that realm with one from a realm connected to it.

Can you please confirm that it's working for you too? Very Happy

_________________
Ellypse, Culte de la Rive Noire, FR
Moedra, Kirin Tor, FR
Maison Celwë'Belore, Officer
avatar
Ellypse
Admin

Posts : 215
Join date : 2013-09-26
Age : 26
Location : Paris, France

View user profile http://renaudparize.fr

Back to top Go down

Re: [FIXED] Can't trade on realms with '-' in the name

Post  kerryoco on Wed May 21, 2014 2:11 pm

I don't have anyone to trade with at the moment (both need to be on beta, right?)

But separate, related issue - I'm on beta now, but when I mouseover 'item preview' it still says 'scripts blocked()'

is the mechanism for preview similar to trade ?

*I should add - I'm not a very experienced beta-tester. To update to beta I just overwrote all my TRP files in Addons folder. Do I need to change SavedVariables too?

kerryoco

Posts : 4
Join date : 2014-05-21

View user profile

Back to top Go down

Re: [FIXED] Can't trade on realms with '-' in the name

Post  arekku on Wed May 21, 2014 2:22 pm

Works for me Smile

arekku

Posts : 14
Join date : 2014-02-17

View user profile

Back to top Go down

Re: [FIXED] Can't trade on realms with '-' in the name

Post  Ellypse on Wed May 21, 2014 5:56 pm

kerryoco wrote:(both need to be on beta, right?)
Yes, both players need to be on the latest version in order to benefit from the changes

kerryoco wrote:But separate, related issue - I'm on beta now, but when I mouseover 'item preview' it still says 'scripts blocked()'

is the mechanism for preview similar to trade ?
Thank you for reporting this. I will investigate Very Happy I'm not sure about the preview. The item informations are sent when the trade is initiated, maybe that's where there is still an issue.

kerryoco wrote:To update to beta I just overwrote all my TRP files in Addons folder.  Do I need to change SavedVariables too?
This is exactly the way to do it. I would advice to never touch the SavedVariables files unless told to do so. They are the files that hold every users informations for all your addons and deleting them means loosing your character's profile, your item's, your documents, everything. I actually encourage you to do a backup of this folder regularly, preferably on some cloud service, so if something bad happens (an issue with your computer, a corruption in your files) you have a previous version you can use. As those files are essentially informations, pure data, it should work from one version to another (at least looking forward, I would not recommend restoring files backed up with a version 1.n to use them in an older version 1.n-1)

_________________
Ellypse, Culte de la Rive Noire, FR
Moedra, Kirin Tor, FR
Maison Celwë'Belore, Officer
avatar
Ellypse
Admin

Posts : 215
Join date : 2013-09-26
Age : 26
Location : Paris, France

View user profile http://renaudparize.fr

Back to top Go down

Re: [FIXED] Can't trade on realms with '-' in the name

Post  kerryoco on Wed May 21, 2014 6:23 pm

To clarify maybe- this is the preview in item creation, not in trade window. I thought maybe it's referencing my name using same mechanism. But not a big deal. Do you expect 1.026 soon?

Tx for the quick responses!

kerryoco

Posts : 4
Join date : 2014-05-21

View user profile

Back to top Go down

Re: [FIXED] Can't trade on realms with '-' in the name

Post  Ellypse on Thu May 22, 2014 4:39 am

Thank you for the clarification.
Total RP 2 version 1.026 will be released today. I will submit it to Curse this evening (central european time) after I had a look at your issue.
It usually take a few hours for Curse to approve new versions so it should be out around midnight (central european time).

_________________
Ellypse, Culte de la Rive Noire, FR
Moedra, Kirin Tor, FR
Maison Celwë'Belore, Officer
avatar
Ellypse
Admin

Posts : 215
Join date : 2013-09-26
Age : 26
Location : Paris, France

View user profile http://renaudparize.fr

Back to top Go down

Re: [FIXED] Can't trade on realms with '-' in the name

Post  Ellypse on Thu May 22, 2014 1:35 pm

I've tried to reproduce your issue but I don't have any error.
Can you post a screenshot your issue? If you happen to have the .lua error (some addons report them) it's even better Very Happy

_________________
Ellypse, Culte de la Rive Noire, FR
Moedra, Kirin Tor, FR
Maison Celwë'Belore, Officer
avatar
Ellypse
Admin

Posts : 215
Join date : 2013-09-26
Age : 26
Location : Paris, France

View user profile http://renaudparize.fr

Back to top Go down

Re: [FIXED] Can't trade on realms with '-' in the name

Post  tesser on Thu May 22, 2014 1:56 pm

here's where I'm seeing 'scripts blocked()' :
http://imgur.com/IAyXqGh

I got buggrabber but it didn't show any lua errors.  This isn't affecting my gameplay at all, just thought it might be helpful.

hah, this is 'kerryoco' by the way. I changed my profile.
avatar
tesser

Posts : 6
Join date : 2014-05-21
Location : nyc

View user profile

Back to top Go down

Re: [FIXED] Can't trade on realms with '-' in the name

Post  Ellypse on Thu May 22, 2014 2:22 pm

Okay. Does this item have scripts on its use event? Maybe you are trying to call protected functions in a script?

_________________
Ellypse, Culte de la Rive Noire, FR
Moedra, Kirin Tor, FR
Maison Celwë'Belore, Officer
avatar
Ellypse
Admin

Posts : 215
Join date : 2013-09-26
Age : 26
Location : Paris, France

View user profile http://renaudparize.fr

Back to top Go down

Re: [FIXED] Can't trade on realms with '-' in the name

Post  tesser on Thu May 22, 2014 2:27 pm

basically the code creates a frame and listens to 'CHAT_MSG_CHANNEL' events.  It works for me, so I don't think anything is protected.  No one I trade it to can use it though.

pseudo-code:

bellFrame = CreateFrame("Frame")
bellFrame:RegisterEvent("CHAT_MSG_CHANNEL")

local bellFunc = function(self, event, ...)

local message, sender, language, channelString, target, flags, unknown, channelNumber, channelName, unknown, counter, guid = ...

if channelName == "WorldDefense" then
       *basic lua stuff*
PlaySoundFile(*soundfile*);
       end      
       if EvrFind ~= nil then
PlaySoundFile(*soundfile*);
       end
   end
end

bellFrame:SetScript("OnEvent", bellFunc);


Last edited by tesser on Thu May 22, 2014 2:36 pm; edited 1 time in total
avatar
tesser

Posts : 6
Join date : 2014-05-21
Location : nyc

View user profile

Back to top Go down

Re: [FIXED] Can't trade on realms with '-' in the name

Post  Ellypse on Thu May 22, 2014 2:33 pm

If it works it's just a display issue. I will ask Telkostrasz how this "script blocked" thing works. It might just be a warning and it does nothing at all.

_________________
Ellypse, Culte de la Rive Noire, FR
Moedra, Kirin Tor, FR
Maison Celwë'Belore, Officer
avatar
Ellypse
Admin

Posts : 215
Join date : 2013-09-26
Age : 26
Location : Paris, France

View user profile http://renaudparize.fr

Back to top Go down

Re: [FIXED] Can't trade on realms with '-' in the name

Post  tesser on Fri May 23, 2014 4:08 am

still the original problem after 1.026 update:

I can use the item, but the recipient sees 'scripts blocked()' on mouseover, and can't activate it.
Trust levels set maximum.
For this item script I just had:
print("item working")

I had debug mode on for a bit - I don't know what this message means:
RECU : GTVN Ultrasoft-EmeraldDream


avatar
tesser

Posts : 6
Join date : 2014-05-21
Location : nyc

View user profile

Back to top Go down

Re: [FIXED] Can't trade on realms with '-' in the name

Post  Ellypse on Fri May 23, 2014 5:02 am

Okay, now I fully understand your issue and I'm sorry to tell you I can't fix it for Total RP 2. Again it is an issue with comparing names, but this time it would require a lot of changes through the entire addon to make it work.

Short story : for creations, the author's name is registered as short name "Player". For trust levels, it's in the registry, which now uses full names "Player-Realm" to store informations. When the system encounter an item with scripts, it search for the author name "Player" in the registry to check the trust level but can't find it as it's now "Player-Realm".
Changing the format for the authors' names would means previously made items won't belong to their authors anymore.
The worst way to handle this would be to remove the trust level system completely, but that would mean that any script will be execute without any security. As I already hear story about trap items that send spam as soon as they are traded, adding scripts is not a valid option for security reasons (for example, players would be able to trade items that delete the entire inventory (the real one)).

As we are building Total RP 3 from scratch, we are making it around the recent changes and hopefully it won't have those issues.

_________________
Ellypse, Culte de la Rive Noire, FR
Moedra, Kirin Tor, FR
Maison Celwë'Belore, Officer
avatar
Ellypse
Admin

Posts : 215
Join date : 2013-09-26
Age : 26
Location : Paris, France

View user profile http://renaudparize.fr

Back to top Go down

Re: [FIXED] Can't trade on realms with '-' in the name

Post  Sponsored content


Sponsored content


Back to top Go down

Page 1 of 2 1, 2  Next

View previous topic View next topic Back to top

- Similar topics

 
Permissions in this forum:
You cannot reply to topics in this forum