Cheat Engine Forum Index Cheat Engine
The Official Site of Cheat Engine
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 


Need some help with some AS3 code...

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> General Gamehacking
View previous topic :: View next topic  
Author Message
LtO
Advanced Cheater
Reputation: 0

Joined: 09 Mar 2015
Posts: 71

PostPosted: Sun Jun 03, 2018 1:39 am    Post subject: Need some help with some AS3 code... Reply with quote

Using JPEXS free flash decompiler, a great tool that helped me a lot already... I got stuck a bit with some parts that were obfuscated, and the pcode wasn't clear to me, and now I can also see that obfuscated code in as3, which is much easier to read and suddenly makes sense to me Smile. However I'm still struggling with some codes, that I can't manage to modify, while I've cearly changed things. But I might not fully understand yet how this works...

Code:
private function MatchSlotToReward(param1:int, param2:String, param3:int, param4:int, param5:String, param6:String) : void
      {
         var msg:String = null;
         var desc:String = null;
         var prizeMC:MovieClip = null;
         var target:MovieClip = null;
         var itemName:String = null;
         var itemFuncInv:ItemServiceInventory = null;
         var inIndex:int = param1;
         var inType:String = param2;
         var inAmount:int = param3;
         var inID:int = param4;
         var inMsg:String = param5;
         var inDesc:String = param6;
         var setCoinText:Function = function(param1:MovieClip):MovieClip
         {
            var _loc3_:Array = null;
            var _loc4_:int = 0;
            var _loc2_:MovieClip = param1.prize_mc;
            if(_loc2_)
            {
               _loc3_ = [10,25,50,100,200,500,1000];
               _loc4_ = 0;
               _loc2_.coin1_1.amount_txt.text = _loc3_[_loc4_++ % _loc3_.length];
               _loc2_.coin1_2.amount_txt.text = _loc3_[_loc4_++ % _loc3_.length];
               _loc2_.coin1_3.amount_txt.text = _loc3_[_loc4_++ % _loc3_.length];
               _loc2_.coin1_4.amount_txt.text = _loc3_[_loc4_++ % _loc3_.length];
               _loc2_.coin1_5.amount_txt.text = _loc3_[_loc4_++ % _loc3_.length];
               _loc2_.coin2_1.amount_txt.text = _loc3_[_loc4_++ % _loc3_.length];
               _loc2_.coin2_2.amount_txt.text = _loc3_[_loc4_++ % _loc3_.length];
               if(_loc2_.coin2_3)
               {
                  _loc2_.coin2_3.amount_txt.text = _loc3_[_loc4_++ % _loc3_.length];
               }
               if(_loc2_.coin2_4)
               {
                  _loc2_.coin2_4.amount_txt.text = _loc3_[_loc4_++ % _loc3_.length];
               }
               if(_loc2_.coin2_5)
               {
                  _loc2_.coin2_5.amount_txt.text = _loc3_[_loc4_++ % _loc3_.length];
               }
            }
            return param1;
         };
         var prizeFrame:Object = 1;
         var inventoryUpdateList:Array = [inID];
         var netMan:NetworkManager = NetworkManager.Instance;

   else if(inType == "coins")
         {
            switch(Math.floor(Math.random() * 3))
            {
               case 0:
                  prizeMC = new mc_stopCoin1();
                  target = prizeMC.prize_mc.coin2_3;
                  break;
               case 1:
                  prizeMC = new mc_stopCoin2();
                  target = prizeMC.prize_mc.coin2_4;
                  break;
               case 2:
                  prizeMC = new mc_stopCoin3();
                  target = prizeMC.prize_mc.coin2_1;
            }
            if(prizeMC)
            {
               setCoinText(prizeMC);
               if(target != null)
               {
                  target.amount_txt.text = inAmount;
               }
            }
            this.mSlotList[inIndex].SetPrizeMC(prizeMC);
            prizeFrame = "_cash";
            msg = inAmount.toString() + " " + inMsg;
            desc = inDesc;
            User.myInfo.setCoinsCurrent(User.myInfo.getCoinsCurrent() + inAmount);
         }


That array with 10, 50, 100 etc should be the coin prizes you can win, however if I change those (and remove some ifs), it seems to avoid those amounts I set and just gives me few small coin prizes... So even with this clear flashcode now I don't get grip on it, any advice with this?
Thanks
Back to top
View user's profile Send private message
ParkourPenguin
I post too much
Reputation: 138

Joined: 06 Jul 2014
Posts: 4275

PostPosted: Sun Jun 03, 2018 8:58 am    Post subject: Reply with quote

That array is only used to set text. The last line probably sets your current money.
_________________
I don't know where I'm going, but I'll figure it out when I get there.
Back to top
View user's profile Send private message
LtO
Advanced Cheater
Reputation: 0

Joined: 09 Mar 2015
Posts: 71

PostPosted: Sun Jun 03, 2018 10:41 am    Post subject: Reply with quote

ParkourPenguin wrote:
That array is only used to set text. The last line probably sets your current money.


So it would seem, however those 50-25-100 and so on prizes are actually the coin prizes you can win in that "lottery". What I'd like to do is that each time it gives a coin prize it picks the highest amount being 1000... I managed to change the amount before but some protection makes it take that away from me again... It's like I can't find how and where the exact amounts are stored/found in the code then? Thanks
Back to top
View user's profile Send private message
LtO
Advanced Cheater
Reputation: 0

Joined: 09 Mar 2015
Posts: 71

PostPosted: Sun Jun 03, 2018 8:37 pm    Post subject: Reply with quote

Also I don't really understand what that Modulo divide function does... (%), any experts here? I do use avm2 handbook but still don't get this...
Back to top
View user's profile Send private message
ParkourPenguin
I post too much
Reputation: 138

Joined: 06 Jul 2014
Posts: 4275

PostPosted: Sun Jun 03, 2018 9:10 pm    Post subject: Reply with quote

That's just a standard modulus operation. A remainder in long division is similar (but negative numbers can be weird). In this case, the code is iterating through the elements of the array with each access and wrapping around after the index is at the end of the array.

Regardless, you shouldn't be focusing on that. As I said, that's only for displaying text- it's useless for actually changing the value. The variable inAmount seems to get its value from parameter3, so look at what calls to the function MatchSlotToReward are doing (specifically where they're getting the third argument from).

_________________
I don't know where I'm going, but I'll figure it out when I get there.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Cheat Engine Forum Index -> General Gamehacking All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group

CE Wiki   IRC (#CEF)   Twitter
Third party websites