[UnlockEntry] Added GetCourse, GetCode Lua bindings.

[UnlockManager] Added UnlockRequirement_NumUnlocked enum.
This commit is contained in:
AJ Kelly
2011-04-30 18:41:14 -05:00
parent f5976bd860
commit b053e931c2
4 changed files with 50 additions and 8 deletions
+2
View File
@@ -19,6 +19,8 @@ sm-ssc v1.2.5 | 20110???
LineHighlight P#", making it load per-player. [AJ] LineHighlight P#", making it load per-player. [AJ]
* [OptionRow] Added Text param to RefreshMessageCommand. [AJ] * [OptionRow] Added Text param to RefreshMessageCommand. [AJ]
* [ScreenOptions] Added SelectMultipleMessageCommand, ChangeValueMessageCommand. [AJ] * [ScreenOptions] Added SelectMultipleMessageCommand, ChangeValueMessageCommand. [AJ]
* [UnlockEntry] Added GetCourse, GetCode Lua bindings. [AJ]
* [UnlockManager] Added UnlockRequirement_NumUnlocked enum. [AJ]
20110428 20110428
-------- --------
+28 -2
View File
@@ -123,11 +123,37 @@ UnlockColor=color("1,0.5,0,1")
ExtraColor=color("#ff0000") -- red ExtraColor=color("#ff0000") -- red
[UnlockManager] [UnlockManager]
# Unlock specific things. we'll go in-depth with this one day, but it really # Unlock specific things.
# isnt what sm-ssc was designed for.
AutoLockChallengeSteps=false AutoLockChallengeSteps=false
UnlockNames="" UnlockNames=""
# useful commands:
# require,(UnlockRequirement),(value);
# where (UnlockRequirement) is one of the UnlockRequirement enums.
# song,(Song Name);
# sets a Song to be unlocked
# course,(Course Name);
# sets a Course to be unlocked
# roulette;
# Song shows up in roulette (useful with Song only)
# mod,(modifier);
# sets a modifier to be unlocked.
# code,(code);
# assigns a code to the unlock
# examples:
# 1) The song "Pledge" requires 500 AP.
# Unlock1Command=song,"Pledge";require,"UnlockRequirement_ArcadePoints",500
# 2) The song "ABC" can be unlocked via roulette; pick an arbitrary code
# to use to store the unlock.
# Unlock2Command=song,"ABC";code,"59183751";roulette
# 03 # # 03 #
[ArrowEffects] [ArrowEffects]
+16 -3
View File
@@ -33,7 +33,8 @@ static const char *UnlockRequirementNames[] =
"ExtraCleared", "ExtraCleared",
"ExtraFailed", "ExtraFailed",
"Toasties", "Toasties",
"StagesCleared" "StagesCleared",
"NumberUnlocked"
}; };
XToString( UnlockRequirement ); XToString( UnlockRequirement );
StringToX( UnlockRequirement ); StringToX( UnlockRequirement );
@@ -294,6 +295,7 @@ void UnlockManager::GetPoints( const Profile *pProfile, float fScores[NUM_Unlock
fScores[UnlockRequirement_SongPoints] = GetSongPoints( pProfile ); fScores[UnlockRequirement_SongPoints] = GetSongPoints( pProfile );
fScores[UnlockRequirement_DancePoints] = (float) pProfile->m_iTotalDancePoints; fScores[UnlockRequirement_DancePoints] = (float) pProfile->m_iTotalDancePoints;
fScores[UnlockRequirement_StagesCleared] = (float) pProfile->GetTotalNumSongsPassed(); fScores[UnlockRequirement_StagesCleared] = (float) pProfile->GetTotalNumSongsPassed();
fScores[UnlockRequirement_NumUnlocked] = (float) GetNumUnlocked();
} }
/* Return true if all songs and/or courses referenced by an unlock are available. */ /* Return true if all songs and/or courses referenced by an unlock are available. */
@@ -514,9 +516,7 @@ void UnlockManager::Load()
} }
} }
//
// Log unlocks // Log unlocks
//
FOREACH_CONST( UnlockEntry, m_UnlockEntries, e ) FOREACH_CONST( UnlockEntry, m_UnlockEntries, e )
{ {
RString str = ssprintf( "Unlock: %s; ", join("\n",e->m_cmd.m_vsArgs).c_str() ); RString str = ssprintf( "Unlock: %s; ", join("\n",e->m_cmd.m_vsArgs).c_str() );
@@ -673,6 +673,17 @@ public:
if( pSong ) { pSong->PushSelf(L); return 1; } if( pSong ) { pSong->PushSelf(L); return 1; }
return 0; return 0;
} }
static int GetCourse( T* p, lua_State *L )
{
Course *pCourse = p->m_Course.ToCourse();
if( pCourse ) { pCourse->PushSelf(L); return 1; }
return 0;
}
static int GetCode( T* p, lua_State *L )
{
lua_pushstring( L, p->m_sEntryID );
return 1;
}
static int GetArgs( T* p, lua_State *L ) static int GetArgs( T* p, lua_State *L )
{ {
@@ -701,11 +712,13 @@ public:
LunaUnlockEntry() LunaUnlockEntry()
{ {
ADD_METHOD( IsLocked ); ADD_METHOD( IsLocked );
ADD_METHOD( GetCode );
ADD_METHOD( GetDescription ); ADD_METHOD( GetDescription );
ADD_METHOD( GetUnlockRewardType ); ADD_METHOD( GetUnlockRewardType );
ADD_METHOD( GetRequirement ); ADD_METHOD( GetRequirement );
ADD_METHOD( GetRequirePassHardSteps ); ADD_METHOD( GetRequirePassHardSteps );
ADD_METHOD( GetSong ); ADD_METHOD( GetSong );
ADD_METHOD( GetCourse );
ADD_METHOD( song ); ADD_METHOD( song );
ADD_METHOD( steps ); ADD_METHOD( steps );
ADD_METHOD( course ); ADD_METHOD( course );
+1
View File
@@ -25,6 +25,7 @@ enum UnlockRequirement
UnlockRequirement_ExtraFailed, UnlockRequirement_ExtraFailed,
UnlockRequirement_Toasties, UnlockRequirement_Toasties,
UnlockRequirement_StagesCleared, UnlockRequirement_StagesCleared,
UnlockRequirement_NumUnlocked,
NUM_UnlockRequirement, NUM_UnlockRequirement,
UnlockRequirement_Invalid, UnlockRequirement_Invalid,
}; };