Interpreting JASS

General talk about editing, cheating, and deprotecting maps.

Moderator: Cheaters

Lightbrand
Newcomer
Posts: 7
Joined: April 3rd, 2007, 8:09 pm

Post by Lightbrand »

Once again, I mention I'm not a "inventor" type. I'm going through all this is trying to figure out how those codes interact with each other.

It's more of a "decoding" manner.

I will edit the first post once I upload the war3map.j a bit later.

[EDIT]
Uploaded the file.
The map is called Naruto Wars.
All this problem starts at Line 1337 (not joking) if opened in JASSCraft.
Thanks guys, I feel like I can learn a lot here.
Image
User avatar
Aero
Forum Staff
Posts: 829
Joined: January 28th, 2007, 8:10 pm
Title: JASS Programmer
Location: Canada

Post by Aero »

You picked a quite advanced function to start with if you're just beginning with JASS

function Trig_Secret_Conditions takes nothing returns boolean
if(not(CountUnitsInGroup(GetUnitsOfPlayerAndTypeId(GetTriggerPlayer(),'hero1'))==1))then
return false
endif
return hashstringa(GetEventPlayerChatString())
endfunction

function hashstringa takes string s returns boolean
local integer istring=0
local integer n=0
local integer len=StringLength(s)
local location oHash=MakePair_II(0,0)
loop
exitwhen n>=len
set istring=Char2Int(SubString(s,n,n+1))
call hashblock(oHash,istring)
set n=n+1
endloop
if(First_I(oHash)==-955425320)then
if(Rest_I(oHash)==-451731975)then
call DeletePair(oHash)
set oHash=null
return true
endif
endif
call DeletePair(oHash)
set oHash=null
return false
endfunction

I can tell you what this does but I need a few more functions

function MakePair_II
function Char2Int
function hashblock
function First_I
function Rest_I
function DeletePair

I've played Naruto Wars before, this sounds like to me the code you enter to unlock your "secret" form
Lightbrand
Newcomer
Posts: 7
Joined: April 3rd, 2007, 8:09 pm

Post by Lightbrand »

What I'm guessing is that everything comes down to

Code: Select all

if(First_I(oHash)==-955425320)then
if(Rest_I(oHash)==-451731975)then 
Those number meant something.
Image
User avatar
Aero
Forum Staff
Posts: 829
Joined: January 28th, 2007, 8:10 pm
Title: JASS Programmer
Location: Canada

Post by Aero »

Yes, they are an integer comparison...except you need to know what the functions do to get those numbers
Lightbrand
Newcomer
Posts: 7
Joined: April 3rd, 2007, 8:09 pm

Post by Lightbrand »

Well
MakePair_II

Code: Select all

 function MakePair_II takes integer x,integer y returns location
return Location(ItoR(x),ItoR(y))
endfunction
DeletePair

Code: Select all

function DeletePair takes location oPair returns nothing
call RemoveLocation(oPair)
endfunction
Char2int

Code: Select all

function Char2Int takes string c returns integer
local string cset="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789"
local integer i=0
local integer len=StringLength(cset)
loop
exitwhen(c==SubString(cset,i,i+1))or(i>=len)
set i=i+1
endloop
return i
endfunction
First_I, Rest_I

Code: Select all

function First_I takes location oPair returns integer
return RtoI(GetLocationX(oPair))
endfunction
function Rest_I takes location oPair returns integer
return RtoI(GetLocationY(oPair))
endfunction
Hashblock

Code: Select all

function hashblock takes location oHash,integer c returns nothing
local integer n=1
local integer delta=11742
local integer sum=0
local integer k1=5168478+c
local integer k2=2763741+c
local integer h1=First_I(oHash)
local integer h2=Rest_I(oHash)
loop
exitwhen n>32
set h1=h1+((h2*16)+(h2/32))+h2+sum+k1
set sum=sum+delta
set h2=h2+((h1*16)+(h1/32))+h1+sum+k2
set n=n+1
endloop
call SetPair_II(oHash,h1,h2)
endfunction
I have no idea what the function for MakePair, DeletePair, and the First_I End_I do. The Char2int function displayed all the alphabets and numbers which at the end will go through various convertions.

But for 1 reference.

Code: Select all

function hashstring takes string s returns boolean
local integer istring=0
local integer n=0
local integer len=StringLength(s)
local location oHash=MakePair_II(0,0)
loop
exitwhen n>=len
set istring=Char2Int(SubString(s,n,n+1))
call hashblock(oHash,istring)
set n=n+1
endloop
if(First_I(oHash)==0x51D3AA57)then
if(Rest_I(oHash)==-683500700)then
call DeletePair(oHash)
set oHash=null
return true
endif
endif
call DeletePair(oHash)
set oHash=null
return false
endfunction
The convertion for that code turns out to be "-secret past". Which I have no idea how it get to that number/unit wise.
Image