미션 저장 관련
This commit is contained in:
parent
07764e3960
commit
5a5e9f60a9
|
|
@ -315,7 +315,7 @@ function Use_Item(urod, itemid, amount)
|
|||
}
|
||||
return false;
|
||||
}
|
||||
function Add_MissionCount(purpose, conditionvalue, count, setValue) {
|
||||
function Add_MissionCount(urod, purpose, conditionvalue, count, setValue) {
|
||||
if (count <= 0) return;
|
||||
|
||||
var table = Get_MissionTable(); // 전체 미션 테이블
|
||||
|
|
@ -335,17 +335,17 @@ function Add_MissionCount(purpose, conditionvalue, count, setValue) {
|
|||
var mission = matchingMissions[i];
|
||||
|
||||
// 조건 값 확인
|
||||
if (mission.n_MissionConditionValue === 0 || conditionvalue === mission.n_MissionConditionValue) {
|
||||
var key1 = Get_Key(mission.n_MissionGroupId);
|
||||
var key2 = Get_Key(mission.n_MissionIndex);
|
||||
//log.info("typeof n_MissionConditionValue: " + typeof mission.n_MissionConditionValue);
|
||||
//log.info("typeof conditionvalue: " + typeof conditionvalue);
|
||||
if (mission.n_MissionConditionValue == 0 || conditionvalue == mission.n_MissionConditionValue) {
|
||||
var key1 = mission.n_MissionGroupId;
|
||||
var key2 = mission.n_MissionIndex;
|
||||
|
||||
if (!Mission[key1]) Mission[key1] = {};
|
||||
if (!Mission[key1][key2]) Mission[key1][key2] = [0, 0]; // 예: [목표값, 현재값]
|
||||
|
||||
if (setValue)
|
||||
Mission[key1][key2][1] = count;
|
||||
else
|
||||
Mission[key1][key2][1] += count;
|
||||
if (!urod.Mission[key1]) urod.Mission[key1] = {};
|
||||
if (!urod.Mission[key1][key2]) urod.Mission[key1][key2] = [0, 0];
|
||||
|
||||
if (setValue) urod.Mission[key1][key2][1] = count;
|
||||
else urod.Mission[key1][key2][1] += count;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -419,7 +419,7 @@ handlers.Save_PC_Stat = function(args)
|
|||
for (var i = 0; i < 4; i++) {
|
||||
urod.PC.Stat[i] += args.UsePoint[i];
|
||||
}
|
||||
Add_MissionCount("HERO_STAT_UPGRADE_ACC", 0, curUsePoint, false);
|
||||
Add_MissionCount(urod, "HERO_STAT_UPGRADE_ACC", 0, curUsePoint, false);
|
||||
Set_JsonUserData(urod);
|
||||
return { error: 0 };
|
||||
} else {
|
||||
|
|
@ -455,6 +455,45 @@ handlers.Save_PC_StatInit = function(args)
|
|||
|
||||
return { error: rtnerror, gem: useGem };
|
||||
}
|
||||
|
||||
handlers.Save_PC_Ability = function(args)
|
||||
{
|
||||
var error = Get_Error(args.Token);
|
||||
if (error < 0) return { error: error };
|
||||
|
||||
var table = Get_AbilityConfigTable();
|
||||
var data = table.find(f => f.n_AbilityID == args.AbilityID);
|
||||
if (!data) return { error: 3 }; // 잘못된 특성 ID
|
||||
|
||||
var urod = Get_JsonUserData();
|
||||
|
||||
if (data.n_MaxUpgradeLevel <= (urod.Ability[args.AbilityID] || 0))
|
||||
return { error: 1 }; // 이미 최대 레벨
|
||||
|
||||
var global = Get_GlobalValueTable();
|
||||
var matdata = global.find(f => f.s_ID == "n_AbilityMaterialID");
|
||||
if (!matdata) return { error: 4 }; // 설정 누락
|
||||
|
||||
var materialId = matdata.n_Value;
|
||||
if (Use_Item(urod, materialId, 1))
|
||||
{
|
||||
// 특성 레벨업
|
||||
if (!urod.Ability[args.AbilityID])
|
||||
urod.Ability[args.AbilityID] = 0;
|
||||
++urod.Ability[args.AbilityID];
|
||||
|
||||
// 미션 카운트
|
||||
Add_MissionCount(urod, "HERO_ABILITY_UPGRADE_CLASS_LIMIT", args.nBattleType, 1, false);
|
||||
Add_MissionCount(urod, "HERO_ABILITY_UPGRADE_ALL", 0, 1, false);
|
||||
Add_MissionCount(urod, "HERO_ABILITY_UPGRADE_ACC", 0, 1, false);
|
||||
|
||||
Set_JsonUserData(urod);
|
||||
|
||||
return { error: 0 };
|
||||
}
|
||||
else
|
||||
return { error: 2 }; // 재료 없음
|
||||
}
|
||||
/////////////////////////////////// 서버 처리
|
||||
|
||||
handlers.Write_UnityInApp = function(args)
|
||||
|
|
@ -1088,6 +1127,16 @@ function Get_MissionTable()
|
|||
var titleData = server.GetTitleInternalData({ Keys: ["MissionTable"] });
|
||||
return JSON.parse(titleData.Data.MissionTable);
|
||||
}
|
||||
function Get_AbilityConfigTable()
|
||||
{
|
||||
var titleData = server.GetTitleInternalData({ Keys: ["AbilityConfigData"] });
|
||||
return JSON.parse(titleData.Data.AbilityConfigData);
|
||||
}
|
||||
function Get_GlobalValueTable()
|
||||
{
|
||||
var titleData = server.GetTitleInternalData({ Keys: ["GlobalValue"] });
|
||||
return JSON.parse(titleData.Data.GlobalValue);
|
||||
}
|
||||
function Get_PlayOCoupons()
|
||||
{
|
||||
var poc = JSON.parse(server.GetTitleInternalData("PlayO").Data.PlayO);
|
||||
|
|
|
|||
File diff suppressed because one or more lines are too long
Binary file not shown.
|
|
@ -891,6 +891,44 @@ public class ServerInfo : MyCoroutine
|
|||
Set_Coroutine(() => { Save_PC_StatInit(_act); }, 2f);
|
||||
});
|
||||
}
|
||||
|
||||
public void Save_PC_Ability(int abilityID, int nbattletype, Action _act)
|
||||
{
|
||||
NetWait.Ins.Set(true);
|
||||
PlayFabClientAPI.ExecuteCloudScript(new ExecuteCloudScriptRequest
|
||||
{
|
||||
FunctionName = "Save_PC_Ability",
|
||||
GeneratePlayStreamEvent = true,
|
||||
FunctionParameter = new
|
||||
{
|
||||
Token = m_LoginInfo.EntityToken.EntityToken,
|
||||
AbilityID = abilityID,
|
||||
nBattleType = nbattletype,
|
||||
}
|
||||
},
|
||||
result =>
|
||||
{
|
||||
if (result.Error == null)
|
||||
{
|
||||
NetWait.Ins.Set(false);
|
||||
var error = MyErrorCheck(result.FunctionResult.ToString());
|
||||
switch (error)
|
||||
{
|
||||
case 0: _act?.Invoke(); break;
|
||||
case 1: ToastUI.Ins.Set(999900003); break;
|
||||
case 2: ToastUI.Ins.Set(388); break;
|
||||
case 3: ToastUI.Ins.Set(999900004); break;
|
||||
case 4: ToastUI.Ins.Set(999900005); break;
|
||||
}
|
||||
}
|
||||
else
|
||||
Set_Coroutine(() => { Save_PC_Ability(abilityID, nbattletype, _act); }, 2f);
|
||||
},
|
||||
fail =>
|
||||
{
|
||||
Set_Coroutine(() => { Save_PC_Ability(abilityID, nbattletype, _act); }, 2f);
|
||||
});
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region 우편
|
||||
|
|
|
|||
|
|
@ -68,16 +68,18 @@ public class PCAbilityLvUpUI : BackKeyAdd
|
|||
var moneyid = table_GlobalValue.Ins.Get_Int("n_AbilityMaterialID");
|
||||
if (CanLvUp(true) && sdata.Check_ItemAmount(moneyid, 1))
|
||||
{
|
||||
sdata.Use_Item(moneyid, 1);
|
||||
sdata.Add_AbilityLv(m_Data.n_AbilityID);
|
||||
MyValue.Get_ActorStatInfoorNull(eRole.PC);
|
||||
Set_UI();
|
||||
PCAbilityUI.Ins.Set_UI();
|
||||
NewGameUI.Ins.m_PCUI.Refresh_Money();
|
||||
ServerInfo.Ins.Save_PC_Ability(m_Data.n_AbilityID, MyEnumToInt.Ins.Get_Int(m_Data.e_BattleType), () =>
|
||||
{
|
||||
sdata.Use_Item(moneyid, 1);
|
||||
sdata.Add_AbilityLv(m_Data.n_AbilityID);
|
||||
MyValue.Get_ActorStatInfoorNull(eRole.PC);
|
||||
Set_UI();
|
||||
PCAbilityUI.Ins.Set_UI();
|
||||
|
||||
sdata.Add_MissionCount(ePurpose.HERO_ABILITY_UPGRADE_CLASS_LIMIT, MyEnumToInt.Ins.Get_Int(m_Data.e_BattleType));
|
||||
sdata.Add_MissionCount(ePurpose.HERO_ABILITY_UPGRADE_ALL);
|
||||
sdata.Add_MissionCount(ePurpose.HERO_ABILITY_UPGRADE_ACC);
|
||||
sdata.Add_MissionCount(ePurpose.HERO_ABILITY_UPGRADE_CLASS_LIMIT, MyEnumToInt.Ins.Get_Int(m_Data.e_BattleType));
|
||||
sdata.Add_MissionCount(ePurpose.HERO_ABILITY_UPGRADE_ALL);
|
||||
sdata.Add_MissionCount(ePurpose.HERO_ABILITY_UPGRADE_ACC);
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Reference in New Issue