버프, 농장, 상점, 농장 상점 등 시간을 초로 하지 말고 DateTime으로 해야 함 (서버 때문…)
This commit is contained in:
parent
32d7b78185
commit
f22811bcff
|
|
@ -550,7 +550,17 @@ handlers.Save_Init = function(args)
|
|||
isInit = true;
|
||||
|
||||
urod.Common[3] = dayofyear;
|
||||
add_farmshop = urod.Farm.Shop = Get_UniqueFarmShopList(Get_FarmShopTable(), 8);
|
||||
add_farmshop = Get_UniqueFarmShopList(Get_FarmShopTable(), 8);
|
||||
urod.Farm.Shop = {};
|
||||
for (var i = 0; i < add_farmshop.length; ++i)
|
||||
{
|
||||
var index = add_farmshop[i][0];
|
||||
if (!urod.Farm.Shop[index])
|
||||
urod.Farm.Shop[index] = {};
|
||||
|
||||
urod.Farm.Shop[index].Buy = 0;
|
||||
urod.Farm.Shop[index].Time = Get_CurKoreaTime();
|
||||
}
|
||||
Init_DungeonTicket(table, itemtable, urod);
|
||||
Init_Mission(table, urod, 1);
|
||||
Init_Shop(urod, 1);
|
||||
|
|
@ -635,7 +645,7 @@ function Init_Shop(urod, type)
|
|||
{
|
||||
const key = lst[i].n_ShopItemID;
|
||||
if (urod.Shop[key])
|
||||
urod.Shop[key][1] = 0;
|
||||
urod.Shop[key].Buy = 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -2388,11 +2398,13 @@ handlers.Save_Buff = function(args)
|
|||
if (error < 0) return Get_Return(error);
|
||||
|
||||
var urod = Get_JsonUserData(readonlydata);
|
||||
var now = Get_CurKoreaTime();
|
||||
var buffTime = new Date(urod.Buff.Time[args.Index]);
|
||||
|
||||
if (urod.Buff.Infinity > 0 || urod.Buff.Time[args.Index] <= 0)
|
||||
if (urod.Buff.Infinity > 0 || buffTime <= now)
|
||||
{
|
||||
if (urod.Buff.Infinity <= 0)
|
||||
urod.Buff.Time[args.Index] = 600;
|
||||
urod.Buff.Time[args.Index] = Get_TimeAddSec(600);
|
||||
|
||||
var table = Get_MissionTable();
|
||||
Add_MissionCount(table, urod, "WATCH_AD_ALL", 0, 1);
|
||||
|
|
@ -2401,6 +2413,7 @@ handlers.Save_Buff = function(args)
|
|||
Set_JsonUserData(urod);
|
||||
return Get_Return(0);
|
||||
}
|
||||
|
||||
return Get_Return(1);
|
||||
}
|
||||
|
||||
|
|
@ -2410,6 +2423,42 @@ handlers.Save_Farm_PlantSeed = function(args)
|
|||
var error = Get_Error(readonlydata, args.Token);
|
||||
if (error < 0) return Get_Return(error);
|
||||
|
||||
var urod = Get_JsonUserData(readonlydata);
|
||||
var curSlot = urod.Farm.Slot.find(f=>f.Slot == args.Slot);
|
||||
if (curSlot.Slot > urod.Farm.MaxSlot) return Get_Return(2);
|
||||
var slotTime = new Date(curSlot.Time);
|
||||
if (slotTime - Get_CurKoreaTime() > 0 || curSlot.Grade > 0 || curSlot.EnchantID > 0) return Get_Return(1);
|
||||
|
||||
var seedid = Get_GlobalValue_nValue("n_FarmSeedID");
|
||||
var needseed = Get_GlobalValue_nValue("n_FarmPlantingSeedAmount");
|
||||
if (Check_ItemAmount(urod, seedid, needseed) && Check_ItemAmount(urod, args.EnchantID, 1))
|
||||
{
|
||||
var table = Get_MissionTable();
|
||||
Use_Item(table, urod, seedid, needseed);
|
||||
Use_Item(table, urod, args.EnchantID, 1);
|
||||
|
||||
var harvestdata = Get_RandomHarvestData();
|
||||
var farmerval = Get_FarmerValue(urod, "ReduceHarvestTime");
|
||||
var harvestTime = harvestdata.n_HarvestTime - harvestdata.n_HarvestTime * farmerval;
|
||||
|
||||
curSlot.Grade = Number(harvestdata.n_Grade);
|
||||
curSlot.Time = Get_TimeAddSec(harvestTime);
|
||||
curSlot.EnchantID = args.EnchantID;
|
||||
|
||||
Add_MissionCount(table, urod, "PLANTING_CROPS_GRADE_ALL", 0, 1);
|
||||
Add_MissionCount(table, urod, "PLANTING_CROPS_GRADE_ACC", curSlot.Grade, 1);
|
||||
|
||||
Set_JsonUserData(urod);
|
||||
return Get_Return(0, { harvestTime : curSlot.Time, grade : curSlot.Grade });
|
||||
}
|
||||
return Get_Return(3);
|
||||
}
|
||||
handlers.Save_Farm_Harvest = function(args)
|
||||
{
|
||||
var readonlydata = Get_UserReadOnlyData();
|
||||
var error = Get_Error(readonlydata, args.Token);
|
||||
if (error < 0) return Get_Return(error);
|
||||
|
||||
var urod = Get_JsonUserData(readonlydata);
|
||||
var curSlot = urod.Farm.Slot.find(f=>f.Slot == args.Slot);
|
||||
if (curSlot.Slot > urod.Farm.MaxSlot) return Get_Return(2);
|
||||
|
|
@ -24555,7 +24604,12 @@ function Add_Amount(...args) {
|
|||
function Get_CurKoreaTime()
|
||||
{
|
||||
var curServerTime = new Date();
|
||||
return new Date(curServerTime.setHours(curServerTime.getHours() + 9));
|
||||
return new Date(curServerTime.getTime() + 9 * 60 * 60 * 1000);
|
||||
}
|
||||
|
||||
function Get_TimeAddSec(sec)
|
||||
{
|
||||
return new Date(Get_CurKoreaTime().getTime() + sec * 1000);
|
||||
}
|
||||
function Get_DayOfYear()
|
||||
{
|
||||
|
|
|
|||
|
|
@ -95,7 +95,7 @@ public partial class ServerData
|
|||
/// <summary>
|
||||
/// { 상품ID, 0 총 구매횟수, 1 이번 구매횟수, 2 광고 남은 시간 }
|
||||
/// </summary>
|
||||
public Dictionary<string, List<ObscuredInt>> Shop = new Dictionary<string, List<ObscuredInt>>();
|
||||
public Dictionary<string, SD_Shop> Shop = new Dictionary<string, SD_Shop>();
|
||||
|
||||
|
||||
public List<ServerData_Book> Book;
|
||||
|
|
@ -225,9 +225,8 @@ public partial class ServerData
|
|||
temp.Dungeon = DSUtil.Get_T_Dic(Dungeon);
|
||||
temp.Mission = DSUtil.Get_T_Dic(Mission);
|
||||
temp.Gacha = DSUtil.Get_T_Dic(Gacha);
|
||||
|
||||
|
||||
temp.Common = DSUtil.Get_T_List(Common);
|
||||
foreach (var item in Shop) temp.Shop.Add(item.Key, item.Value.Get());
|
||||
|
||||
temp.Book = new List<ServerData_Book_Read>();
|
||||
for (int i = 0; i < Book.Count; i++)
|
||||
|
|
@ -243,7 +242,6 @@ public partial class ServerData
|
|||
foreach (var item in Inven)
|
||||
temp.Inven.Add(item.Key, item.Value);
|
||||
|
||||
temp.Shop = DSUtil.Get_T_Dic(Shop);
|
||||
temp.Potion = DSUtil.Get_T_Dic(Potion);
|
||||
if (Event != null) temp.Event = DSUtil.Get_T_Dic(Event);
|
||||
|
||||
|
|
@ -273,6 +271,7 @@ public class ServerData_Read
|
|||
public Dictionary<string, double> MobKill;
|
||||
public SD_Farm_Read Farm;
|
||||
public Dictionary<string, Dictionary<string, List<int>>> Mission = new Dictionary<string, Dictionary<string, List<int>>>();
|
||||
public Dictionary<string, SD_Shop_Read> Shop = new Dictionary<string, SD_Shop_Read>();
|
||||
|
||||
public List<ServerData_Book_Read> Book;
|
||||
public List<ServerData_ChapterQuest_Read> ChapterQuest;
|
||||
|
|
@ -280,7 +279,7 @@ public class ServerData_Read
|
|||
public List<double> Money;
|
||||
public List<List<int>> Title, Pass;
|
||||
public Dictionary<string, int> Inven = new Dictionary<string, int>();
|
||||
public Dictionary<string, List<int>> Shop, Potion;
|
||||
public Dictionary<string, List<int>> Potion;
|
||||
public Dictionary<string, int> Event;
|
||||
|
||||
public Dictionary<string, List<List<double>>> TotalAdd = new Dictionary<string, List<List<double>>>(); // 아이템, 0 ID, 1 획득개수
|
||||
|
|
@ -327,9 +326,8 @@ public class ServerData_Read
|
|||
temp.Dungeon = DSUtil.Get_T_Dic(Dungeon);
|
||||
temp.Mission = DSUtil.Get_T_Dic(Mission);
|
||||
temp.Gacha = DSUtil.Get_T_Dic(Gacha);
|
||||
|
||||
|
||||
temp.Common = DSUtil.Get_T_List(Common);
|
||||
foreach (var item in Shop) temp.Shop.Add(item.Key, item.Value.Get());
|
||||
|
||||
temp.Book = new List<ServerData_Book>();
|
||||
for (int i = 0; i < Book.Count; i++)
|
||||
|
|
@ -345,7 +343,6 @@ public class ServerData_Read
|
|||
foreach (var item in Inven)
|
||||
temp.Inven.Add(item.Key, item.Value);
|
||||
|
||||
temp.Shop = DSUtil.Get_T_Dic(Shop);
|
||||
temp.Potion = DSUtil.Get_T_Dic(Potion);
|
||||
if (Event != null) temp.Event = DSUtil.Get_T_Dic(Event);
|
||||
|
||||
|
|
@ -893,30 +890,17 @@ public partial class ServerData
|
|||
Farm.MaxSlot.RandomizeCryptoKey();
|
||||
}
|
||||
public int Get_FarmMaxSlot() { return Farm.MaxSlot; }
|
||||
public void Set_FarmSlot(int slot, int grade, double time, int enchantid)
|
||||
public void Set_FarmSlot(int slot, int grade, DateTime time, int enchantid)
|
||||
{
|
||||
var sSlot = Farm.Slot.Find(f => f.Slot == slot);
|
||||
sSlot.Grade = grade;
|
||||
sSlot.Grade.RandomizeCryptoKey();
|
||||
|
||||
sSlot.Time = Math.Round(time, 3); // 소수점 셋째 자리에서 반올림
|
||||
sSlot.Time.RandomizeCryptoKey();
|
||||
sSlot.Time = time;
|
||||
|
||||
sSlot.EnchantID = enchantid;
|
||||
sSlot.EnchantID.RandomizeCryptoKey();
|
||||
}
|
||||
public void Sub_AllFarmSlotTime(int sec = 1)
|
||||
{
|
||||
for (int i = 0; i < Farm.Slot.Count; i++)
|
||||
{
|
||||
if (Farm.Slot[i].Time > 0)
|
||||
{
|
||||
Farm.Slot[i].Time -= sec;
|
||||
if (Farm.Slot[i].Time < 0) Farm.Slot[i].Time = 0;
|
||||
Farm.Slot[i].Time.RandomizeCryptoKey();
|
||||
}
|
||||
}
|
||||
}
|
||||
public int Get_EatFruitCount(int fruitid)
|
||||
{
|
||||
var key = Get_Key(fruitid);
|
||||
|
|
@ -939,28 +923,8 @@ public partial class ServerData
|
|||
Farm.Eat[key] += amount;
|
||||
Farm.Eat[key].RandomizeCryptoKey();
|
||||
}
|
||||
public void Buy_FarmShopItem(int shopid, int time)
|
||||
{
|
||||
var data = Get_FarmShopData(shopid);
|
||||
++data[1]; data[1].RandomizeCryptoKey(); // 구매 횟수 증가
|
||||
data[2] = time; data[2].RandomizeCryptoKey(); // 구매 딜레이 시간
|
||||
}
|
||||
public List<ObscuredInt> Get_FarmShopData(int shopid)
|
||||
{
|
||||
return Farm.Shop.Find(f => f[0] == shopid);
|
||||
}
|
||||
public void Sub_AllFarmShopTime(int sec = 1)
|
||||
{
|
||||
for (int i = 0; i < Farm.Shop.Count; i++)
|
||||
{
|
||||
if (Farm.Shop[i][2] > 0)
|
||||
{
|
||||
Farm.Shop[i][2] -= sec;
|
||||
if (Farm.Shop[i][2] < 0) Farm.Shop[i][2] = 0;
|
||||
Farm.Shop[i][2].RandomizeCryptoKey();
|
||||
}
|
||||
}
|
||||
}
|
||||
public void Buy_FarmShopItem(int shopid, int time) { Get_FarmShopData(shopid).Add_Buy(time); }
|
||||
public SD_FarmShop Get_FarmShopData(int shopid) { return Farm.Shop[Get_Key(shopid)]; }
|
||||
#endregion
|
||||
#region 던전
|
||||
Dictionary<eDungeon, string> dic_dungeonkey = new Dictionary<eDungeon, string>
|
||||
|
|
@ -1287,7 +1251,7 @@ public partial class ServerData
|
|||
{
|
||||
var key = Get_Key(_id);
|
||||
if (!Shop.ContainsKey(key))
|
||||
Shop.Add(key, new List<ObscuredInt> { 0, 0, 0 });
|
||||
Shop.Add(key, new SD_Shop());
|
||||
}
|
||||
void Init_Shop()
|
||||
{
|
||||
|
|
@ -1297,8 +1261,8 @@ public partial class ServerData
|
|||
var key = Get_Key(lst_day[i].n_ShopItemID);
|
||||
if (Shop.ContainsKey(key))
|
||||
{
|
||||
Shop[key][1] = 0;
|
||||
Shop[key][1].RandomizeCryptoKey();
|
||||
Shop[key].Buy = 0;
|
||||
Shop[key].Buy.RandomizeCryptoKey();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1310,8 +1274,8 @@ public partial class ServerData
|
|||
var key = Get_Key(lst_week[i].n_ShopItemID);
|
||||
if (Shop.ContainsKey(key))
|
||||
{
|
||||
Shop[key][1] = 0;
|
||||
Shop[key][1].RandomizeCryptoKey();
|
||||
Shop[key].Buy = 0;
|
||||
Shop[key].Buy.RandomizeCryptoKey();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1323,8 +1287,8 @@ public partial class ServerData
|
|||
var key = Get_Key(lst_month[i].n_ShopItemID);
|
||||
if (Shop.ContainsKey(key))
|
||||
{
|
||||
Shop[key][1] = 0;
|
||||
Shop[key][1].RandomizeCryptoKey();
|
||||
Shop[key].Buy = 0;
|
||||
Shop[key].Buy.RandomizeCryptoKey();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1344,7 +1308,7 @@ public partial class ServerData
|
|||
public void Buy_ShopItem(ShopItemListTableData data, Action afterbuy)
|
||||
{
|
||||
if (isShopItemSoldOut(data)) return;
|
||||
if (Get_ShopADTime(data.n_ShopItemID) > 0) return;
|
||||
if (Get_ShopADRemainTime(data.n_ShopItemID) > 0) return;
|
||||
|
||||
switch (data.n_PriceItemID)
|
||||
{
|
||||
|
|
@ -1397,14 +1361,14 @@ public partial class ServerData
|
|||
public int Get_ShopBuyCount(int _id)
|
||||
{
|
||||
var key = Get_Key(_id);
|
||||
return Shop.ContainsKey(key) ? Shop[key][1] : 0;
|
||||
return Shop.ContainsKey(key) ? Shop[key].Buy : 0;
|
||||
}
|
||||
public void Add_ShopBuyCount(int _id)
|
||||
{
|
||||
Check_ShopData(_id);
|
||||
var key = Get_Key(_id);
|
||||
++Shop[key][0]; Shop[key][0].RandomizeCryptoKey();
|
||||
++Shop[key][1]; Shop[key][1].RandomizeCryptoKey();
|
||||
++Shop[key].Buy_Total; Shop[key].Buy_Total.RandomizeCryptoKey();
|
||||
++Shop[key].Buy; Shop[key].Buy.RandomizeCryptoKey();
|
||||
}
|
||||
|
||||
// 상점 UI 관련
|
||||
|
|
@ -1431,47 +1395,26 @@ public partial class ServerData
|
|||
}
|
||||
|
||||
// 상점 광고 관련
|
||||
public int Get_ShopADTime(int _id)
|
||||
public int Get_ShopADRemainTime(int _id)
|
||||
{
|
||||
var key = Get_Key(_id);
|
||||
return Shop.ContainsKey(key) ? Shop[key][2] : 0;
|
||||
return Shop.ContainsKey(key) ? (int)(Shop[key].Time - ServerInfo.ServerTime).TotalSeconds : 0;
|
||||
}
|
||||
public void Add_ShopADTime(int _id, int _sec = 1)
|
||||
{
|
||||
Check_ShopData(_id);
|
||||
var key = Get_Key(_id);
|
||||
Shop[key][2] = _sec;
|
||||
Shop[key][2].RandomizeCryptoKey();
|
||||
}
|
||||
public void Sub_ShopADTime(int _id, int _sec = 1)
|
||||
{
|
||||
int index = 2;
|
||||
if (_id == -1)
|
||||
{
|
||||
foreach (var item in Shop)
|
||||
{
|
||||
Shop[item.Key][index] -= _sec;
|
||||
if (Shop[item.Key][index] < 0) Shop[item.Key][index] = 0;
|
||||
Shop[item.Key][index].RandomizeCryptoKey();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
var key = Get_Key(_id);
|
||||
if (Shop.ContainsKey(key) && Shop[key][index] > 0)
|
||||
{
|
||||
Shop[key][index] -= _sec;
|
||||
Shop[key][index].RandomizeCryptoKey();
|
||||
}
|
||||
}
|
||||
Shop[key].Time = ServerInfo.ServerTime.AddSeconds(_sec);
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region Common
|
||||
public void Init_Daily(List<List<ObscuredInt>> farmshop)
|
||||
public void Init_Daily(List<List<int>> farmshop)
|
||||
{
|
||||
Set_Common(eCommon.DOY_Day, ServerInfo.ServerTime.DayOfYear);
|
||||
Farm.Shop = farmshop;
|
||||
Farm.Shop.Clear();
|
||||
for (int i = 0; i < farmshop.Count; i++)
|
||||
Farm.Shop.Add(Get_Key(farmshop[i][0]), new SD_FarmShop());
|
||||
Init_DungeonTicket();
|
||||
Init_Mission(1);
|
||||
Init_Shop();
|
||||
|
|
@ -2605,53 +2548,39 @@ public class SD_MapData_Read
|
|||
public class SD_Buff
|
||||
{
|
||||
public ObscuredInt Infinity; // 1 이상이면 무한 버프
|
||||
public List<ObscuredInt> Time; // 버프 남은 시간들
|
||||
public List<DateTime> Time; // 버프 off 시간
|
||||
|
||||
public SD_Buff()
|
||||
{
|
||||
Infinity = 0;
|
||||
Infinity.RandomizeCryptoKey();
|
||||
Time = new List<ObscuredInt> { 0, 0, 0 };
|
||||
Time.ForEach(f => f.RandomizeCryptoKey());
|
||||
Time = new List<DateTime> { new DateTime(), new DateTime(), new DateTime() };
|
||||
}
|
||||
|
||||
public SD_Buff_Read Get()
|
||||
{
|
||||
var rtn = new SD_Buff_Read();
|
||||
rtn.Infinity = Infinity;
|
||||
rtn.Time = DSUtil.Get_T_List(Time);
|
||||
rtn.Time = Time;
|
||||
return rtn;
|
||||
}
|
||||
|
||||
public bool ApplyBuff(int index) { return isInfinity() || Get_RemainTime(index) > 0; }
|
||||
public bool ApplyBuff(int index) { return isInfinity() || Get_RemainTime(index).TotalSeconds > 0; }
|
||||
public bool isInfinity() { return Infinity > 0; }
|
||||
public int Get_RemainTime(int index) { return isInfinity() ? 1 : Time[index]; }
|
||||
public void Set_Time(int index, int time) { Time[index] = time; Time[index].RandomizeCryptoKey(); }
|
||||
public void Sub_Time()
|
||||
{
|
||||
if (isInfinity()) return;
|
||||
|
||||
for (int i = 0; i < Time.Count; i++)
|
||||
{
|
||||
if (Time[i] > 0)
|
||||
{
|
||||
--Time[i];
|
||||
Time[i].RandomizeCryptoKey();
|
||||
}
|
||||
}
|
||||
}
|
||||
public TimeSpan Get_RemainTime(int index) { return Time[index] - ServerInfo.ServerTime; }
|
||||
public void Set_Time(int index, int time) { Time[index] = ServerInfo.ServerTime.AddSeconds(time); }
|
||||
}
|
||||
public class SD_Buff_Read
|
||||
{
|
||||
public int Infinity;
|
||||
public List<int> Time;
|
||||
public List<DateTime> Time;
|
||||
|
||||
public SD_Buff Get()
|
||||
{
|
||||
var rtn = new SD_Buff();
|
||||
rtn.Infinity = Infinity;
|
||||
rtn.Infinity.RandomizeCryptoKey();
|
||||
rtn.Time = DSUtil.Get_T_List(Time);
|
||||
rtn.Time = Time;
|
||||
|
||||
return rtn;
|
||||
}
|
||||
|
|
@ -2934,7 +2863,7 @@ public class SD_Farm
|
|||
public ObscuredInt MaxSlot;
|
||||
public List<SD_FarmSlot> Slot;
|
||||
public Dictionary<string, ObscuredInt> Eat = new Dictionary<string, ObscuredInt>(); // 먹은 갯수
|
||||
public List<List<ObscuredInt>> Shop; // 0 FarmShop ID, 1 구매 횟수, 2 남은 시간
|
||||
public Dictionary<string, SD_FarmShop> Shop = new Dictionary<string, SD_FarmShop>(); // FarmShop ID, 구매 횟수, 남은 시간
|
||||
|
||||
public SD_Farm()
|
||||
{
|
||||
|
|
@ -2943,7 +2872,6 @@ public class SD_Farm
|
|||
Slot = new List<SD_FarmSlot>();
|
||||
for (int i = 0; i < 8; i++)
|
||||
Slot.Add(new SD_FarmSlot(i));
|
||||
Shop = table_farmshoplist.Ins.Get_ShopInit();
|
||||
}
|
||||
|
||||
public SD_Farm_Read Get()
|
||||
|
|
@ -2957,7 +2885,7 @@ public class SD_Farm
|
|||
for (int i = 0; i < Slot.Count; i++)
|
||||
temp.Slot.Add(Slot[i].Get());
|
||||
foreach (var item in Eat) temp.Eat.Add(item.Key, item.Value);
|
||||
temp.Shop = DSUtil.Get_T_List(Shop);
|
||||
foreach (var item in Shop) temp.Shop.Add(item.Key, item.Value.Get());
|
||||
|
||||
return temp;
|
||||
}
|
||||
|
|
@ -2967,7 +2895,7 @@ public class SD_Farm_Read
|
|||
public int MaxSlot;
|
||||
public List<SD_FarmSlot_Read> Slot;
|
||||
public Dictionary<string, int> Eat = new Dictionary<string, int>(); // 먹은 갯수
|
||||
public List<List<int>> Shop; // 0 FarmShop ID, 1 구매 횟수, 2 남은 시간
|
||||
public Dictionary<string, SD_FarmShop_Read> Shop = new Dictionary<string, SD_FarmShop_Read>(); // FarmShop ID, 구매 횟수, 남은 시간
|
||||
|
||||
public SD_Farm Get()
|
||||
{
|
||||
|
|
@ -2981,7 +2909,7 @@ public class SD_Farm_Read
|
|||
for (int i = 0; i < Slot.Count; i++)
|
||||
temp.Slot.Add(Slot[i].Get());
|
||||
foreach (var item in Eat) temp.Eat.Add(item.Key, item.Value);
|
||||
temp.Shop = DSUtil.Get_T_List(Shop);
|
||||
foreach (var item in Shop) temp.Shop.Add(item.Key, item.Value.Get());
|
||||
|
||||
return temp;
|
||||
}
|
||||
|
|
@ -2989,7 +2917,7 @@ public class SD_Farm_Read
|
|||
public class SD_FarmSlot
|
||||
{
|
||||
public ObscuredInt Slot, Grade, EnchantID;
|
||||
public ObscuredDouble Time;
|
||||
public DateTime Time;
|
||||
|
||||
public SD_FarmSlot() { }
|
||||
|
||||
|
|
@ -2998,24 +2926,70 @@ public class SD_FarmSlot
|
|||
Slot = slot; Slot.RandomizeCryptoKey();
|
||||
Grade = 0; Grade.RandomizeCryptoKey();
|
||||
EnchantID = 0; EnchantID.RandomizeCryptoKey();
|
||||
Time = 0; Time.RandomizeCryptoKey();
|
||||
Time = new DateTime();
|
||||
}
|
||||
|
||||
public SD_FarmSlot_Read Get()
|
||||
{
|
||||
return new SD_FarmSlot_Read { Slot = Slot, Grade = Grade, EnchantID = EnchantID, Time = Time };
|
||||
}
|
||||
|
||||
public int Get_RemainSec()
|
||||
{
|
||||
return (int)(Time - ServerInfo.ServerTime).TotalSeconds;
|
||||
}
|
||||
}
|
||||
public class SD_FarmSlot_Read
|
||||
{
|
||||
public int Slot, Grade, EnchantID;
|
||||
public double Time;
|
||||
public DateTime Time;
|
||||
|
||||
public SD_FarmSlot Get()
|
||||
{
|
||||
return new SD_FarmSlot { Slot = Slot, Grade = Grade, EnchantID = EnchantID, Time = Time };
|
||||
}
|
||||
}
|
||||
public class SD_FarmShop
|
||||
{
|
||||
public ObscuredInt Buy;
|
||||
public DateTime Time;
|
||||
|
||||
public SD_FarmShop_Read Get() { return new SD_FarmShop_Read { Buy = Buy, Time = Time }; }
|
||||
public void Add_Buy(int time)
|
||||
{
|
||||
++Buy; Buy.RandomizeCryptoKey();
|
||||
Time = ServerInfo.ServerTime.AddSeconds(time);
|
||||
}
|
||||
public int Get_RemainTime() { return (int)(Time - ServerInfo.ServerTime).TotalSeconds; }
|
||||
}
|
||||
public class SD_FarmShop_Read
|
||||
{
|
||||
public int Buy;
|
||||
public DateTime Time;
|
||||
|
||||
public SD_FarmShop Get() { return new SD_FarmShop { Buy = Buy, Time = Time }; }
|
||||
}
|
||||
public class SD_Shop
|
||||
{
|
||||
// 총 구매횟수, 이번 구매횟수, 광고 남은 시간
|
||||
public ObscuredInt Buy_Total, Buy;
|
||||
public DateTime Time;
|
||||
|
||||
public SD_Shop_Read Get()
|
||||
{
|
||||
return new SD_Shop_Read { Buy = Buy, Time = Time, Buy_Total = Buy_Total };
|
||||
}
|
||||
}
|
||||
public class SD_Shop_Read
|
||||
{
|
||||
public int Buy_Total, Buy;
|
||||
public DateTime Time;
|
||||
|
||||
public SD_Shop Get()
|
||||
{
|
||||
return new SD_Shop { Buy = Buy, Time = Time, Buy_Total = Buy_Total };
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region 서버 응답 클래스
|
||||
|
|
@ -3082,7 +3056,7 @@ public class SC_GachaResult
|
|||
}
|
||||
public class SC_FarmSlotPlantSeedResult
|
||||
{
|
||||
public double harvestTime;
|
||||
public DateTime harvestTime;
|
||||
public int grade;
|
||||
}
|
||||
#endregion
|
||||
|
|
@ -40,9 +40,9 @@ public class BuffADCard : CardBase
|
|||
}
|
||||
else
|
||||
{
|
||||
var time = ServerInfo.Ins.m_ServerData.Buff.Get_RemainTime(m_Index);
|
||||
texts[4].text = DSUtil.Get_TimeText_MS(time);
|
||||
if (time > 0)
|
||||
var ts = ServerInfo.Ins.m_ServerData.Buff.Get_RemainTime(m_Index);
|
||||
texts[4].text = DSUtil.Get_TimeText_MS(ts);
|
||||
if (ts.TotalSeconds > 0)
|
||||
{
|
||||
gos[0].SetActive(false);
|
||||
if (DSUtil.CheckNull(m_Co_for1Sec))
|
||||
|
|
@ -58,7 +58,7 @@ public class BuffADCard : CardBase
|
|||
public void OnClick_AD()
|
||||
{
|
||||
var sdata = ServerInfo.Ins.m_ServerData;
|
||||
if (sdata.Buff.Get_RemainTime(m_Index) > 0) return;
|
||||
if (sdata.Buff.Get_RemainTime(m_Index).TotalSeconds > 0) return;
|
||||
|
||||
ADInfo.Ins.Show_AD(() =>
|
||||
{
|
||||
|
|
|
|||
|
|
@ -33,9 +33,9 @@ public class BuffCard : CardBase
|
|||
}
|
||||
else
|
||||
{
|
||||
var time = ServerInfo.Ins.m_ServerData.Buff.Get_RemainTime(m_Index);
|
||||
label_time.text = DSUtil.Get_TimeText_MS(time);
|
||||
if (time > 0)
|
||||
var ts = ServerInfo.Ins.m_ServerData.Buff.Get_RemainTime(m_Index);
|
||||
label_time.text = DSUtil.Get_TimeText_MS(ts);
|
||||
if (ts.TotalSeconds > 0)
|
||||
{
|
||||
if (!go_on.activeInHierarchy) go_on.SetActive(true);
|
||||
if (DSUtil.CheckNull(m_Co_for1Sec))
|
||||
|
|
|
|||
|
|
@ -1,5 +1,3 @@
|
|||
using CodeStage.AntiCheat.ObscuredTypes;
|
||||
using System.Collections.Generic;
|
||||
using TMPro;
|
||||
using UnityEngine.UI;
|
||||
|
||||
|
|
@ -8,15 +6,16 @@ public class FarmShopCard : CardBase
|
|||
public Image[] images; // 0 등급(null), 1 아이템, 2 필요 재화
|
||||
public TextMeshProUGUI[] texts; // 0 아이템 이름, 1 일일 제한, 2 무료, 3 광고 or 가격, 4 지급양
|
||||
|
||||
List<ObscuredInt> m_Data; // 0 FarmShop ID, 1 구매 횟수, 2 남은 시간
|
||||
int m_FarmShopID;
|
||||
SD_FarmShop m_Data;
|
||||
FarmShopListTableData m_Tdata;
|
||||
|
||||
void Set_Time()
|
||||
{
|
||||
switch (m_Tdata.e_ShopType)
|
||||
{
|
||||
case eShopType.AD: texts[2].text = m_Data[2] > 0 ? DSUtil.Get_TimeText_MS(m_Data[2]) : table_localtext.Ins.Get_Text(387); break;
|
||||
case eShopType.Free: texts[2].text = m_Data[2] > 0 ? DSUtil.Get_TimeText_MS(m_Data[2]) : table_localtext.Ins.Get_Text(433); break;
|
||||
case eShopType.AD: texts[2].text = m_Data.Get_RemainTime() > 0 ? DSUtil.Get_TimeText_MS(m_Data.Get_RemainTime()) : table_localtext.Ins.Get_Text(387); break;
|
||||
case eShopType.Free: texts[2].text = m_Data.Get_RemainTime() > 0 ? DSUtil.Get_TimeText_MS(m_Data.Get_RemainTime()) : table_localtext.Ins.Get_Text(433); break;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -24,14 +23,16 @@ public class FarmShopCard : CardBase
|
|||
{
|
||||
base.Set(_base);
|
||||
Set_Repeat_for1sec(Set_Time);
|
||||
m_Data = _base as List<ObscuredInt>;
|
||||
m_Tdata = table_farmshoplist.Ins.Get_Data(m_Data[0]);
|
||||
var sdata = ServerInfo.Ins.m_ServerData;
|
||||
m_FarmShopID = int.Parse(_base.ToString());
|
||||
m_Data = sdata.Get_FarmShopData(m_FarmShopID);
|
||||
m_Tdata = table_farmshoplist.Ins.Get_Data(m_FarmShopID);
|
||||
var itemData = table_itemlist.Ins.Get_Data(m_Tdata.n_ItemID);
|
||||
//images[0].sprite = itemData.Get_GradeSprite();
|
||||
images[1].sprite = itemData.Get_IconSprite();
|
||||
images[2].enabled = true;
|
||||
texts[0].text = table_itemlist.Ins.Get_ItemName(itemData.n_ItemID);
|
||||
texts[1].text = DSUtil.Format(392, m_Data[1], m_Tdata.n_DayLimit);
|
||||
texts[1].text = DSUtil.Format(392, m_Data.Buy, m_Tdata.n_DayLimit);
|
||||
texts[2].text = texts[3].text = "";
|
||||
texts[4].text = m_Tdata.n_ItemAmount.ToString();
|
||||
|
||||
|
|
@ -54,7 +55,7 @@ public class FarmShopCard : CardBase
|
|||
|
||||
public void OnClick_Buy()
|
||||
{
|
||||
if (m_Data[1] < m_Tdata.n_DayLimit && m_Data[2] <= 0)
|
||||
if (m_Data.Buy < m_Tdata.n_DayLimit && m_Data.Get_RemainTime() <= 0)
|
||||
{
|
||||
switch (m_Tdata.e_ShopType)
|
||||
{
|
||||
|
|
@ -76,7 +77,7 @@ public class FarmShopCard : CardBase
|
|||
{
|
||||
var sdata = ServerInfo.Ins.m_ServerData;
|
||||
sdata.Add_Item(m_Tdata.n_ItemID, m_Tdata.n_ItemAmount);
|
||||
sdata.Buy_FarmShopItem(m_Data[0], m_Tdata.n_GapTime);
|
||||
sdata.Buy_FarmShopItem(m_FarmShopID, m_Tdata.n_GapTime);
|
||||
ObtainItemUI.Ins.Set(new ItemSimpleData { itemid = m_Tdata.n_ItemID, amount = m_Tdata.n_ItemAmount });
|
||||
FarmShopUI.Ins.Set();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,3 +1,4 @@
|
|||
using System.Collections.Generic;
|
||||
using TMPro;
|
||||
|
||||
public class FarmShopUI : BotMenuBase
|
||||
|
|
@ -12,7 +13,10 @@ public class FarmShopUI : BotMenuBase
|
|||
{
|
||||
base.Set();
|
||||
Set_Repeat_for1sec(Set_NextTime);
|
||||
Set_ScrollView(ServerInfo.Ins.m_ServerData.Farm.Shop);
|
||||
var lst = new List<int>();
|
||||
foreach (var item in ServerInfo.Ins.m_ServerData.Farm.Shop)
|
||||
lst.Add(int.Parse(item.Key));
|
||||
Set_ScrollView(lst);
|
||||
Set_NextTime();
|
||||
Set_Money(1, 2);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -44,7 +44,7 @@ public class FarmSlotCard : CardBase
|
|||
if (!DSUtil.CheckNull(m_Data))
|
||||
{
|
||||
var sdata = ServerInfo.Ins.m_ServerData;
|
||||
var time = m_Data.Time;
|
||||
var time = m_Data.Get_RemainSec();
|
||||
if (time > 0)
|
||||
{ // 자라는 중
|
||||
texts[0].text = DSUtil.Format(128, DSUtil.Get_TimeText_HMS(false, time));
|
||||
|
|
@ -70,7 +70,7 @@ public class FarmSlotCard : CardBase
|
|||
int Get_ImmPrice()
|
||||
{
|
||||
var ainfo = MyValue.Get_ActorStatInfoorNull(eRole.PC);
|
||||
int price = (int)m_Data.Time * 10;
|
||||
int price = m_Data.Get_RemainSec() * 10;
|
||||
return price - (int)(price * ainfo.Get_Stat(eStat.Reduction_in_Immediate_Harvest_Cost));
|
||||
}
|
||||
|
||||
|
|
@ -149,7 +149,7 @@ public class FarmSlotCard : CardBase
|
|||
sdata.Add_MissionCount(ePurpose.HARVESTING_CROPS_ALL);
|
||||
|
||||
ObtainItemUI.Ins.Set(items);
|
||||
sdata.Set_FarmSlot(m_Data.Slot, 0, 0, 0);
|
||||
sdata.Set_FarmSlot(m_Data.Slot, 0, ServerInfo.ServerTime, 0);
|
||||
FarmSlotUI.Ins.Set();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -209,7 +209,7 @@ public class ShopCardBase : CardBase
|
|||
{
|
||||
var sdata = ServerInfo.Ins.m_ServerData;
|
||||
Add_BuyCount();
|
||||
sdata.Sub_ShopADTime(m_ShopTableData.ID, -m_ShopTableData.ADGapTime);
|
||||
//sdata.Sub_ShopADTime(m_ShopTableData.ID, -m_ShopTableData.ADGapTime);
|
||||
GetItemUI.Ins.Set(sdata.Add_Item(new ItemData(m_ShopTableData.Item, m_ShopTableData.ItemID, m_ShopTableData.Amount, "shop ad", eUICardType.GetItem)));
|
||||
GetItemUI.Ins.Show_Items();
|
||||
Set_ADTime();
|
||||
|
|
|
|||
|
|
@ -13,7 +13,7 @@ public class CardTimeUI : MyCoroutine
|
|||
m_ShopID = shopid;
|
||||
var sdata = ServerInfo.Ins.m_ServerData;
|
||||
|
||||
go_time.SetActive(!issoldout && sdata.Get_ShopADTime(m_ShopID) > 0);
|
||||
go_time.SetActive(!issoldout && sdata.Get_ShopADRemainTime(m_ShopID) > 0);
|
||||
if (go_time.activeSelf)
|
||||
{
|
||||
Set_Time();
|
||||
|
|
@ -26,6 +26,6 @@ public class CardTimeUI : MyCoroutine
|
|||
|
||||
void Set_Time()
|
||||
{
|
||||
t_time.text = DSUtil.Get_TimeText_MS(ServerInfo.Ins.m_ServerData.Get_ShopADTime(m_ShopID));
|
||||
t_time.text = DSUtil.Get_TimeText_MS(ServerInfo.Ins.m_ServerData.Get_ShopADRemainTime(m_ShopID));
|
||||
}
|
||||
}
|
||||
|
|
@ -68,7 +68,7 @@ public class DataCheckMgr : MyCoroutine
|
|||
switch (result.error)
|
||||
{
|
||||
case 0:
|
||||
sdata.Init_Daily(DSUtil.Get_T_List(result.farmshop));
|
||||
sdata.Init_Daily(result.farmshop);
|
||||
break;
|
||||
case 1:
|
||||
sdata.Init_Week(SamplesCalendar.Get_WeekOfYear(ServerInfo.ServerTime));
|
||||
|
|
@ -83,16 +83,11 @@ public class DataCheckMgr : MyCoroutine
|
|||
yield return new WaitForSeconds(1f);
|
||||
|
||||
// 실제 사용 데이터
|
||||
sdata.Sub_AllFarmSlotTime();
|
||||
sdata.Sub_AllFarmShopTime();
|
||||
sdata.Add_Common(eCommon.PlayTime);
|
||||
///////////////////
|
||||
|
||||
sdata.Sub_ShopADTime(-1);
|
||||
sdata.Sub_AllPotionTime();
|
||||
sdata.Sub_Common(eCommon.CloverShopResetTime);
|
||||
|
||||
sdata.Buff.Sub_Time();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue