More updates to scripts (still wont build)
This commit is contained in:
@@ -1,31 +1,42 @@
|
||||
// Copyright (c) CypherCore <http://github.com/CypherCore> All rights reserved.
|
||||
// Copyright (c) CypherCore <http://github.com/CypherCore> All rights reserved.
|
||||
// Licensed under the GNU GENERAL PUBLIC LICENSE. See LICENSE file in the project root for full license information.
|
||||
|
||||
using Framework.Configuration;
|
||||
using Framework.Constants;
|
||||
using Game;
|
||||
using Framework.Database;
|
||||
using Framework.Networking;
|
||||
using Game.Entities;
|
||||
using System.Collections.Generic;
|
||||
using Game.AI;
|
||||
using Game.Scripting;
|
||||
using Game.Spells;
|
||||
using Game;
|
||||
using System;
|
||||
|
||||
namespace Scripts.World
|
||||
namespace Scripts.World.Achievements
|
||||
{
|
||||
[Script]
|
||||
class xp_boost_PlayerScript : PlayerScript
|
||||
{
|
||||
public xp_boost_PlayerScript() : base("xp_boost_PlayerScript") { }
|
||||
|
||||
void OnGiveXP(Player player, ref uint amount, Unit unit)
|
||||
public override uint OnGiveXP(Player player, uint amount, Unit unit)
|
||||
{
|
||||
if (IsXPBoostActive())
|
||||
amount *= (uint)WorldConfig.GetFloatValue(WorldCfg.RateXpBoost);
|
||||
|
||||
return amount;
|
||||
}
|
||||
|
||||
bool IsXPBoostActive()
|
||||
{
|
||||
long time = GameTime.GetGameTime();
|
||||
var localTm = Time.UnixTimeToDateTime(time);
|
||||
DateTime localTm = Time.UnixTimeToDateTime(time);
|
||||
uint weekdayMaskBoosted = WorldConfig.GetUIntValue(WorldCfg.XpBoostDaymask);
|
||||
uint weekdayMask = 1u << localTm.Day;
|
||||
uint weekdayMask = (1u << (int)localTm.DayOfWeek);
|
||||
bool currentDayBoosted = (weekdayMask & weekdayMaskBoosted) != 0;
|
||||
return currentDayBoosted;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user