Compiling [TFS 1.2] add sign (-) before number attack

Scrappy Coco

Member
Joined
Dec 27, 2014
Messages
95
Reaction score
13
hello anyone knows how to add this sign ( -) before the number of damage created by an attacker
i am use tfs 1.2
example:


Thanks for your time and sorry for my bad english
 

Mkalo

ボーカロイド
Joined
Jun 1, 2011
Messages
1,118
Reaction score
890
Location
Japan
I know that , so I make this post , for someone with more experience can help, thanks for the clarification
If you know its NOT POSSIBLE (aka impossible) experinece won't help unless you are using otc.
 

Codex NG

Recurrent Flamer
Joined
Jul 24, 2015
Messages
2,998
Reaction score
1,522
https://github.com/otland/forgottenserver/blob/master/src/protocolgame.cpp#L1303-L1334

Code:
msg.add<uint32_t>(message.primary.value);
It's uint32_t, you can't send negative values.
Its just a question, because C++ is not a strong point.

Isn't msg.add a template and it's size is based on its cast type, even if it is not doesn't both signed and unsigned use the same number of bytes?

If this is the case, in theory casting message.primary.value to int32_t while multiplying by -1 would allow the use of negative values, of course this would put a cap on the minimum values used due to the limited range of int32_t in comparison of the maximum range of uint32_t.
Code:
msg.add<int32_t>(message.primary.value * -1);
 
Last edited:

Summ

(\/)(;,,;)(\/) Y not?
Staff member
Global Moderator
Joined
Oct 15, 2008
Messages
4,168
Reaction score
1,009
Location
Germany :O
The client will parse whatever value you pass to the packet as an unsigned value. You cannot change the type through the network protocol.
Using int32_t instead of uint32_t will just result in some funky value or a debug.
 

Codex NG

Recurrent Flamer
Joined
Jul 24, 2015
Messages
2,998
Reaction score
1,522
The client will parse whatever value you pass to the packet as an unsigned value. You cannot change the type through the network protocol.
Using int32_t instead of uint32_t will just result in some funky value or a debug.
Thanks for the response and clarification.
 
OP
Scrappy Coco

Scrappy Coco

Member
Joined
Dec 27, 2014
Messages
95
Reaction score
13
Thanks for your answers and clarifications I thank you for that and if there any way to add the (- ) do not hesitate to post it or revive trhead
 
Top