• 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!

Change Name from store bugged

Joined
Mar 14, 2020
Messages
139
Solutions
3
Reaction score
11
My change name from store (ingame) is bugged.

What happens?
I buy the change name in store (image below):
1609197113458.png

When i press "YES" this happens:
1609197146238.png

The issue is: This window /\ only appear for 1 or 2 secs and them this window take place:
1609197202869.png

The player dosn't have time to type the new name and the offer complete (the coins are charged). I dont know where is this script, if u know where is it or know how to fix that putting a delay or something let me know please.
 
Nice, mine is not bugged though
I guess u didint get it, mine is bugged couse the "enter new character name" disappear without let the player put the name on it, the correct is the window "enter new character name" let the player chose the new name and them disappear right?
 
I guess u didint get it, mine is bugged couse the "enter new character name" disappear without let the player put the name on it, the correct is the window "enter new character name" let the player chose the new name and them disappear right?
okay
 
My change name from store (ingame) is bugged.

What happens?
I buy the change name in store (image below):
View attachment 53082

When i press "YES" this happens:
View attachment 53083

The issue is: This window /\ only appear for 1 or 2 secs and them this window take place:
View attachment 53084

The player dosn't have time to type the new name and the offer complete (the coins are charged). I dont know where is this script, if u know where is it or know how to fix that putting a delay or something let me know please.

When you don't know where some script is located, an easy way to check for it is to run a global search in your workspace for a string or data that only appears in relation to that script.

For example: "Enter New Character Name" or "Name Change" seem like suitable searches.
This can give you further clues where to look if you follow the flow of the code where you find them.
 
When you don't know where some script is located, an easy way to check for it is to run a global search in your workspace for a string or data that only appears in relation to that script.

For example: "Enter New Character Name" or "Name Change" seem like suitable searches.
This can give you further clues where to look if you follow the flow of the code where you find them.
this was the first thing that i did, dosn't worked :/ I didnt do the intire datapack so i dont know where some things are
 
this was the first thing that i did, not working?

Those strings must be coming out of somewhere, they don't appear out of thin air. Of course, it is important to keep in mind the various circumstances in which those strings might be generated, or concatenations used to generate those strings that might make a search query invalid, however, I have a feeling those strings are stored the way we see them there already.

I have no idea about this module, since I haven't developed for new versions of tibia for a long time, but if this is a new client-side feature and you are using cipsoft client, then you won't find it, true.

In that case, it gets more complicated, since you will need to find the code of the packet which is sent from the server to trigger that option opening in the client and see if there's anything wrong going on there and what you can do about it.

Still, there should be a mention of "name change" or "namechange" somewhere on the server side, even in that packet code itself.

Also make completely sure that your IDE is searching all the correct locations (best to include both the full data folder and src).
 
in case you are using a server based on otservbr:

Nice is this exaclty what i wanted.

Finded:

1609201044846.png


Those strings must be coming out of somewhere, they don't appear out of thin air. Of course, it is important to keep in mind the various circumstances in which those strings might be generated, or concatenations used to generate those strings that might make a search query invalid, however, I have a feeling those strings are stored the way we see them there already.

I have no idea about this module, since I haven't developed for new versions of tibia for a long time, but if this is a new client-side feature and you are using cipsoft client, then you won't find it, true.

In that case, it gets more complicated, since you will need to find the code of the packet which is sent from the server to trigger that option opening in the client and see if there's anything wrong going on there and what you can do about it.

Still, there should be a mention of "name change" or "namechange" somewhere on the server side, even in that packet code itself.

Also make completely sure that your IDE is searching all the correct locations (best to include both the full data folder and src).

Nice tip, i will do that in my IDE next time xD Didnt know
 

Attachments

in case you are using a server based on otservbr:
Nice is this exaclty what i wanted.

Finded:

View attachment 53089




Nice tip, i will do that in my IDE next time xD Didnt know

This code together with his problem would suggest the server is triggering following chain of calls prematurely:

onRecvbyte(player, msg, byte) when packet is received from the client with byte GameStore.RecivedPackets.C_BuyStoreOffer that calls parseBuyStoreOffer(playerId, msg) where msg contains is GameStore.OfferTypes.OFFER_TYPE_NAMECHANGE, so it executes

GameStore.processNameChangePurchase(player, offer.id, productType, newName, offer.name, offerPrice)

And leads to the purchase.

However, the client should send that packet only when the user enters a new name and presses 'Ok' in that dialogue window.
Why the server receives such a packet before manual input is given is beyond me atm.

I have a feeling that it could be that this part of code is executing on that 250 ms delay and sending further requests to client which results in a chain reaction before user can react.

Since we do not have the cipsoft client source code, bunch of information that would be useful is not available to us, but @VictorOtInfinit should debug the functions in question, and look for calls within the code that might be interfering, like the one which I pointed out.
 
This code together with his problem would suggest the server is triggering following chain of calls prematurely:

onRecvbyte(player, msg, byte) when packet is received from the client with byte GameStore.RecivedPackets.C_BuyStoreOffer that calls parseBuyStoreOffer(playerId, msg) where msg contains is GameStore.OfferTypes.OFFER_TYPE_NAMECHANGE, so it executes

GameStore.processNameChangePurchase(player, offer.id, productType, newName, offer.name, offerPrice)

And leads to the purchase.

However, the client should send that packet only when the user enters a new name and presses 'Ok' in that dialogue window.
Why the server receives such a packet before manual input is given is beyond me atm.

I have a feeling that it could be that this part of code is executing on that 250 ms delay and sending further requests to client which results in a chain reaction before user can react.

Since we do not have the cipsoft client source code, bunch of information that would be useful is not available to us, but @VictorOtInfinit should debug the functions in question, and look for calls within the code that might be interfering, like the one which I pointed out.
Now i printed everything and the offerId is always ~= GameStore.ClientOfferTypes.CLIENT_STORE_OFFER_NAMECHANGE , offerId = 0, namechange = 1

When i setted offerId to 1 crash the client.

code below:


Lua:
function GameStore.processNameChangePurchase(player, offerId, productType, newName)
  local playerId = player:getId()

  if productType == GameStore.ClientOfferTypes.CLIENT_STORE_OFFER_NAMECHANGE then
    local tile = Tile(player:getPosition())
    if (tile) then
      if (not tile:hasFlag(TILESTATE_PROTECTIONZONE)) then
        return error({code = 1, message = "You can change name only in Protection Zone."})
      end
    end

    local resultId = db.storeQuery("SELECT * FROM `players` WHERE `name` = " .. db.escapeString(newName) .. "")
    if resultId ~= false then
      return error({code = 1, message = "This name is already used, please try again!"})
    end

    local result = GameStore.canChangeToName(newName)
    if not result.ability then
      return error({code = 1, message = result.reason})
    end

    newName = newName:lower():gsub("(%l)(%w*)", function(a, b) return string.upper(a) .. b end)
    db.query("UPDATE `players` SET `name` = " .. db.escapeString(newName) .. " WHERE `id` = " .. player:getGuid())
    message = "You have successfully changed you name, relogin!"
    addEvent(function()
      local player = Player(playerId)
      if not player then
        return false
      end

      player:remove()
    end, 500)
    -- If not, we ask him to do!
  else
    return addPlayerEvent(sendRequestPurchaseData, 250, playerId, offerId, GameStore.ClientOfferTypes.CLIENT_STORE_OFFER_NAMECHANGE)
  end
end

He is always in the else with this return :/
 
Back
Top