public void UpdateSystemVariables(SystemVariable vars) { string sqlCommand = "update systemVAR set [BuildingName] = @BuildingName, [OwnerAddress] = @OwnerAddress, " + "[TaxId] = @TaxId, [wUnit] = @WUnit, [EUnit] = @EUnit " + "where [ApartmentId] = @ApartmentId"; using (OleDbConnection con = new OleDbConnection(connectionString)) { using (OleDbCommand command = new OleDbCommand(sqlCommand, con)) { try { command.Parameters.AddWithValue("@BuildingName", vars.BuildingName); command.Parameters.AddWithValue("@OwnerAddress", vars.OwnerAddress); command.Parameters.AddWithValue("@TaxId", vars.TaxId); command.Parameters.AddWithValue("@wUnit", vars.WUnit); command.Parameters.AddWithValue("@EUnit", vars.EUnit); command.Parameters.AddWithValue("@ApartmentId", vars.ApartmentId); con.Open(); command.ExecuteNonQuery(); } catch (Exception ex) { throw ex; } } } }
public string GetSystemVariableValue(string VariableName) { using (var db = new EGULFEntities()) { SystemVariable VariableData = new SystemVariable(); VariableData = (from v in db.SystemVariable.ToList() where v.VariableName == VariableName select new SystemVariable { VariableId = v.VariableId, VariableName = v.VariableName, Value = v.Value, Entity = v.Entity, Description = v.Description }).FirstOrDefault(); if (VariableData.VariableName != null) { return(VariableData.Value); } else { return(null); } } }
/// <summary> /// Добавляем переменную /// </summary> /// <param name="name">Название переменной</param> /// <param name="owner">Название коллесции переменных</param> /// <param name="isEdit">Редактируемая переменная или нет</param> /// <param name="type">Тип переменной</param> /// <param name="expression">Строка выражения</param> /// <param name="value">Объект значения</param> /// <param name="min">Объект минимального значения</param> /// <param name="max">Объект максимального значения</param> /// <param name="step">Объект значения шага</param> private void AddVariable(string name, string owner, bool isEdit, Type type, string expression, object value, object min = null, object max = null, object step = null) { Variable item = null; if (_variables.TryGetValue(name, out item) == false) { item = new SystemVariable(name, !isEdit, (Value)Activator.CreateInstance(type, new object[] { value, expression })); if (min != null) { item.Min = (Value)Activator.CreateInstance(type, new object[] { min, null }); } if (max != null) { item.Max = (Value)Activator.CreateInstance(type, new object[] { max, null }); } if (step != null) { item.Step = (Value)Activator.CreateInstance(type, new object[] { step, null }); } _variables.Add(item.Name, item); item.IsLookExpression = true; } if (owner != null) { MasterCollectionVariable.FindCollectionVariable(owner).Add(item); } }
public static string getValue(SystemVariable sv) { // 첫번째 있는게 value string keyValue = sv.ToString(); return((SystemVariableManager.variables_[keyValue])[0]); }
public ApplicationController(ApplicationRepository applicationRepository, ProcessLauncher processLauncher, FileSystem fileSystem, SystemVariable systemVariable, TemplateProcessor templateProcessor) { _applicationRepository = applicationRepository ?? throw new ArgumentNullException(nameof(applicationRepository)); _systemVariable = systemVariable ?? throw new ArgumentNullException(nameof(systemVariable)); _processLauncher = processLauncher ?? throw new ArgumentNullException(nameof(processLauncher)); _templateProcessor = templateProcessor ?? throw new ArgumentNullException(nameof(templateProcessor)); }
protected void Page_Load(object sender, EventArgs e) { try { if (!IsPostBack) { Utilities.SetNoCache(Response); } HideErrorMessage(); Utilities.UpdatePageHeaderV2(Page.Master, true); if (!IsPostBack) { Session.Remove("suburb_sortExpression"); Session.Remove("suburb_data"); ddlState.Items.Add(new ListItem("All", "All")); DataTable states = DBBase.GetGenericDataTable_WithWhereOrderClause(null, "Suburb", "", "state", "distinct state"); foreach (DataRow row in states.Rows) { ddlState.Items.Add(new ListItem(row["state"].ToString(), row["state"].ToString())); } SystemVariable sysVariable = SystemVariableDB.GetByDescr("DefaultState"); if (sysVariable != null && sysVariable.Value.Trim() != "") { ddlState.SelectedValue = sysVariable.Value.Trim(); } FillSuburbGrid(); } this.GrdSuburb.EnableViewState = true; } catch (CustomMessageException ex) { if (IsPostBack) { SetErrorMessage(ex.Message); } else { HideTableAndSetErrorMessage(ex.Message); } } catch (Exception ex) { if (IsPostBack) { SetErrorMessage("", ex.ToString()); } else { HideTableAndSetErrorMessage("", ex.ToString()); } } }
public static View GetView(int position, SystemVariable systemVariable, View convertView) { var view = convertView ?? LayoutInflater.From(Application.Context).Inflate(Resource.Layout.SystemVariableItem, null); view.FindViewById <TextView>(Resource.Id.tvName).Text = systemVariable.Name; view.FindViewById <TextView>(Resource.Id.tvValue).Text = systemVariable.ValueString; return(view); }
public static bool getFlag(SystemVariable sv) { // 첫번째 있는게 value string keyValue = sv.ToString(); string tf = (SystemVariableManager.variables_[keyValue])[0]; return(Convert.ToBoolean(tf)); }
public static bool getFlag(SystemVariable sv) { // 첫번째 있는게 value string keyValue = sv.ToString(); string tf = (SystemVariableManager.variables_[keyValue])[0]; return Convert.ToBoolean(tf); }
public SystemVariable GetSystemVariable(long apartmentId) { SystemVariable systemVariable; string sqlCommand = @"select * from systemVAR where ApartmentId = @param1"; using (OleDbConnection con = new OleDbConnection(connectionString)) { OleDbCommand command = new OleDbCommand(sqlCommand, con); try { command.Parameters.AddWithValue("@param1", apartmentId); con.Open(); using (OleDbDataReader reader = command.ExecuteReader(CommandBehavior.SingleRow)) { if (reader.Read()) { systemVariable = new SystemVariable() { ApartmentId = long.Parse(reader["ApartmentId"].ToString()), OwnerName = reader["OwnerName"].ToString(), CardId = reader["CardId"].ToString(), BuildingName = reader["BuildingName"].ToString(), OwnerAddress = reader["OwnerAddress"].ToString(), WUnit = Single.Parse(reader["WUnit"].ToString()), EUnit = Single.Parse(reader["EUnit"].ToString()), IncWUnit = bool.Parse(reader["Inc_WUnit"].ToString()), IncEUnit = bool.Parse(reader["Inc_EUnit"].ToString()), IncTUnit = bool.Parse(reader["Inc_TUnit"].ToString()), IncImprove = bool.Parse(reader["Inc_Improve"].ToString()), StartInv = reader["StartInv"].ToString(), EndPay = reader["EndPay"].ToString(), InterestRate = Decimal.Parse(reader["InterestRate"].ToString()), IncInterest = bool.Parse(reader["Inc_Interest"].ToString()), VatAmount = Single.Parse(reader["VatAmount"].ToString()), TaxId = reader["TaxId"].ToString(), Paid = bool.Parse(reader["Paid"].ToString()), PaperSize = reader["PaperSize"].ToString(), HeadInvoice = reader["HeadInvoice"].ToString(), HeadReciept = reader["HeadReciept"].ToString(), IncFrame = bool.Parse(reader["Inc_Frame"].ToString()) }; return(systemVariable); } return(null); } } catch (Exception ex) { throw ex; } } }
public static SystemVariables GetAll(string DB = null) { string sql = "SELECT descr,value,editable_in_gui,viewable_in_gui FROM SystemVariable"; DataTable tbl = DBBase.ExecuteQuery(sql, DB).Tables[0]; SystemVariables systemVariables = new SystemVariables(); for (int i = 0; i < tbl.Rows.Count; i++) { SystemVariable var = Load(tbl.Rows[i]); systemVariables[var.Descr] = var; } return(systemVariables); }
/// <summary> /// get studyid from db /// </summary> /// <returns>string</returns> private string GetStudyIdFromDatabase() { string id = string.Empty; try { SystemVariable systemVariableTable = GetDBInstance().CreateSystemVariable(); systemVariableTable.Load(); id = systemVariableTable.MaxStudyID.ToString(); } catch (System.Exception ex) { GlobalDefinition.LoggerWrapper.LogException(ex); } GlobalDefinition.LoggerWrapper.LogTraceInfo("public string GetStudyIDFromDatabase() end"); return(id); }
public static void LoadSystemVariables() { XmlDocument xmlDoc = new XmlDocument(); xmlDoc.Load(Files.fileSystemVariables); XmlNode root = xmlDoc.FirstChild; int index = 0; foreach (XmlNode child in root.ChildNodes) { string name = child.Name; bool enabled = Convert.ToBoolean(Convert.ToInt32(child.Attributes["Enabled"].Value)); int valueInt = Convert.ToInt32(child.Attributes["ValueInt"].Value); float valueFloat = Convert.ToSingle(child.Attributes["ValueFloat"].Value); SystemVariable origSysVar = Collection.SystemVariables.Base.origList.List.FirstOrDefault(x => x.Name == name); if (origSysVar != null) { if (origSysVar.Enabled != enabled) { origSysVar.SetEnabled((byte)Convert.ToInt32(enabled)); } if (origSysVar.ValueInt != valueInt) { origSysVar.SetValue(valueInt); } if (!origSysVar.ValueFloat.Equals(valueFloat)) { origSysVar.SetValue(valueFloat); } } index++; } }
private void TriggerEvent(TriggeringEvent triggeringEvent, float deltaTime) { MapPlayer mapPlayer = triggeringEvent.GetMapPlayer(); EventData eventData = triggeringEvent.GetEventData(); if (triggeringEvent.MessageShowing) { if (!mapPlayer.MessageShowing || !mapPlayer.Connected) { triggeringEvent.MessageShowing = false; mapPlayer.MovementDisabled = false; } return; } else if (triggeringEvent.OptionsShowing) { if (!mapPlayer.MessageShowing || !mapPlayer.Connected) { triggeringEvent.OptionsShowing = false; mapPlayer.MovementDisabled = false; triggeringEvent.SelectedOption = mapPlayer.SelectedOption; mapPlayer.SelectedOption = -1; } return; } if (triggeringEvent.WaitTimer > 0) { triggeringEvent.WaitTimer -= deltaTime; return; } if (triggeringEvent.GetParent() != null) { if (triggeringEvent.GetParent().CommandID <= triggeringEvent.CommandID) { return; } } if (triggeringEvent.CommandID < eventData.EventCommands.Count - 1) { triggeringEvent.CommandID++; EventCommand eventCommand = eventData.EventCommands[triggeringEvent.CommandID]; int mapID; int eventID; int mapX; int mapY; MapEvent mapEvent; FacingDirection facingDirection; MovementDirection movementDirection; int spriteID; int itemID; int itemAmount; int added; int remainder; int variableID; VariableType variableType; object variableValue; int gold; int questID; switch (eventCommand.Type) { case EventCommand.CommandType.WaitTimer: if (mapPlayer != null) { break; } float timer = (float)eventCommand.GetParameter("Time"); triggeringEvent.WaitTimer = timer; break; case EventCommand.CommandType.TeleportPlayer: if (mapPlayer == null || !mapPlayer.Connected) { break; } mapID = (int)eventCommand.GetParameter("MapID"); mapX = (int)eventCommand.GetParameter("MapX"); mapY = (int)eventCommand.GetParameter("MapY"); mapPlayer.SetMapID(mapID); mapPlayer.SetMapPosition(mapX, mapY); break; case EventCommand.CommandType.MovePlayer: if (mapPlayer == null || !mapPlayer.Connected) { break; } movementDirection = (MovementDirection)eventCommand.GetParameter("Direction"); mapPlayer.Move(movementDirection, true); break; case EventCommand.CommandType.ChangePlayerDirection: if (mapPlayer == null || !mapPlayer.Connected) { break; } facingDirection = (FacingDirection)eventCommand.GetParameter("Direction"); mapPlayer.ChangeDirection(facingDirection); break; case EventCommand.CommandType.ChangeMapEvent: if (mapPlayer != null) { break; } mapID = (int)eventCommand.GetParameter("MapID"); eventID = (int)eventCommand.GetParameter("EventID"); if (!Server.Instance.GetServerMap(mapID).GetMapInstance().ChangeMapEvent(eventID, eventCommand)) { triggeringEvent.CommandID--; } break; case EventCommand.CommandType.ShowMessage: if (mapPlayer == null || !mapPlayer.Connected) { break; } triggeringEvent.MessageShowing = true; mapPlayer.ShowMessage((string)eventCommand.GetParameter("Message")); break; case EventCommand.CommandType.ShowOptions: if (mapPlayer == null || !mapPlayer.Connected) { break; } List <string> options = (List <string>)eventCommand.GetParameter("Options"); mapPlayer.SelectedOption = 0; int OptionsCount = options.Count; string optionStrings = ""; for (int i = 0; i < options.Count; i++) { optionStrings += options[i]; if (i < options.Count - 1) { optionStrings += ","; } } string message = (string)eventCommand.GetParameter("Message"); triggeringEvent.OptionsShowing = true; mapPlayer.ShowMessage(message, optionStrings); break; case EventCommand.CommandType.ChangeSystemVariable: if (mapPlayer != null) { break; } variableID = (int)eventCommand.GetParameter("VariableID"); variableType = (VariableType)eventCommand.GetParameter("VariableType"); variableValue = eventCommand.GetParameter("VariableValue"); bool randomInt = (bool)eventCommand.GetParameter("RandomInt"); bool randomFloat = (bool)eventCommand.GetParameter("RandomFloat"); if (randomInt) { int randomMin = (int)eventCommand.GetParameter("RandomMin"); int randomMax = (int)eventCommand.GetParameter("RandomMax"); int randomValue = new Random().Next(randomMin, randomMax); SystemVariable.GetSystemVariable(variableID).SetVariableType(variableType); SystemVariable.GetSystemVariable(variableID).SetValue(randomValue); } else if (randomFloat) { float randomMin = (float)eventCommand.GetParameter("RandomMin"); float randomMax = (float)eventCommand.GetParameter("RandomMax"); float randomValue = (float)new Random().NextDouble(); float difference = randomMax - randomMin; randomValue = randomMin + (difference * randomValue); SystemVariable.GetSystemVariable(variableID).SetVariableType(variableType); SystemVariable.GetSystemVariable(variableID).SetValue(randomValue); } else { SystemVariable.GetSystemVariable(variableID).SetVariableType(variableType); SystemVariable.GetSystemVariable(variableID).SetValue(variableValue); } break; case EventCommand.CommandType.ConditionalBranchStart: ConditionalBranchType type = (ConditionalBranchType)eventCommand.GetParameter("ConditionalBranchType"); bool conditionMet = false; bool result = (bool)eventCommand.GetParameter("Result"); switch (type) { case ConditionalBranchType.PlayerPosition: if (mapPlayer == null) { break; } mapID = (int)eventCommand.GetParameter("PlayerMapID"); if (mapID == -1) { break; } mapX = (int)eventCommand.GetParameter("PlayerMapX"); mapY = (int)eventCommand.GetParameter("PlayerMapY"); if (mapPlayer.GetPlayerPacket().MapID == mapID && mapPlayer.GetPlayerPacket().PositionX == mapX && mapPlayer.GetPlayerPacket().PositionY == mapY) { conditionMet = true; } break; case ConditionalBranchType.MapEventPosition: mapID = (int)eventCommand.GetParameter("MapEventMapID"); eventID = (int)eventCommand.GetParameter("MapEventID"); if (mapID == -1 || eventID == -1) { break; } mapX = (int)eventCommand.GetParameter("MapEventMapX"); mapY = (int)eventCommand.GetParameter("MapEventMapY"); mapEvent = Server.Instance.GetServerMap(mapID).GetMapInstance().GetMapData().GetMapEvent(eventID); if (mapEvent.MapX == mapX && mapEvent.MapY == mapY) { conditionMet = true; } break; case ConditionalBranchType.ItemEquipped: if (mapPlayer == null || !mapPlayer.Connected) { break; } itemID = (int)eventCommand.GetParameter("EquippedItemID"); if (itemID == -1) { break; } if (mapPlayer.GetPlayerPacket().Data.ItemEquipped(itemID)) { conditionMet = true; } break; case ConditionalBranchType.ItemInInventory: if (mapPlayer == null) { break; } itemID = (int)eventCommand.GetParameter("InventoryItemID"); itemAmount = (int)eventCommand.GetParameter("InventoryItemAmount"); if (itemID == -1) { break; } if (mapPlayer.GetPlayerPacket().Data.ItemInInventory(itemID, itemAmount)) { conditionMet = true; } break; case ConditionalBranchType.SystemVariable: variableID = (int)eventCommand.GetParameter("VariableID"); if (variableID == -1) { break; } variableType = (VariableType)eventCommand.GetParameter("VariableType"); if (SystemVariable.GetSystemVariable(variableID).Type == variableType) { ConditionValueCheck valueCheck = (ConditionValueCheck)eventCommand.GetParameter("ValueCondition"); ConditionalTextCheck textCheck = (ConditionalTextCheck)eventCommand.GetParameter("TextCondition"); switch (variableType) { case VariableType.Integer: variableValue = eventCommand.GetParameter("VariableIntegerValue"); int intVal = (int)SystemVariable.GetSystemVariable(variableID).Value; switch (valueCheck) { case ConditionValueCheck.Equal: if (intVal == (int)variableValue) { conditionMet = true; } break; case ConditionValueCheck.Greater: if (intVal > (int)variableValue) { conditionMet = true; } break; case ConditionValueCheck.GreaterOrEqual: if (intVal >= (int)variableValue) { conditionMet = true; } break; case ConditionValueCheck.Lower: if (intVal < (int)variableValue) { conditionMet = true; } break; case ConditionValueCheck.LowerOrEqual: if (intVal <= (int)variableValue) { conditionMet = true; } break; case ConditionValueCheck.NotEqual: if (intVal != (int)variableValue) { conditionMet = true; } break; } break; case VariableType.Float: variableValue = eventCommand.GetParameter("VariableFloatValue"); float floatVal = (float)SystemVariable.GetSystemVariable(variableID).Value; switch (valueCheck) { case ConditionValueCheck.Equal: if (floatVal == (float)variableValue) { conditionMet = true; } break; case ConditionValueCheck.Greater: if (floatVal > (float)variableValue) { conditionMet = true; } break; case ConditionValueCheck.GreaterOrEqual: if (floatVal >= (float)variableValue) { conditionMet = true; } break; case ConditionValueCheck.Lower: if (floatVal < (float)variableValue) { conditionMet = true; } break; case ConditionValueCheck.LowerOrEqual: if (floatVal <= (float)variableValue) { conditionMet = true; } break; case ConditionValueCheck.NotEqual: if (floatVal != (float)variableValue) { conditionMet = true; } break; } break; case VariableType.Bool: variableValue = eventCommand.GetParameter("VariableBoolValue"); bool boolVal = (bool)SystemVariable.GetSystemVariable(variableID).Value; if (boolVal == (bool)variableValue) { conditionMet = true; } break; case VariableType.Text: variableValue = eventCommand.GetParameter("VariableTextValue"); string textVal = (string)SystemVariable.GetSystemVariable(variableID).Value; switch (textCheck) { case ConditionalTextCheck.Equal: if (textVal == (string)variableValue) { conditionMet = true; } break; case ConditionalTextCheck.NotEqual: if (textVal != (string)variableValue) { conditionMet = true; } break; case ConditionalTextCheck.Includes: if (textVal.Contains((string)variableValue)) { conditionMet = true; } break; } break; } } break; case ConditionalBranchType.QuestStatus: if (mapPlayer == null || !mapPlayer.Connected) { break; } questID = (int)eventCommand.GetParameter("QuestID"); if (questID != -1) { QuestStatusCheck statusCheck = (QuestStatusCheck)eventCommand.GetParameter("QuestStatus"); switch (statusCheck) { case QuestStatusCheck.Started: if (mapPlayer.GetPlayerPacket().Data.QuestStarted(questID)) { conditionMet = true; } break; case QuestStatusCheck.Complete: if (mapPlayer.GetPlayerPacket().Data.QuestComplete(questID)) { conditionMet = true; } break; case QuestStatusCheck.Progression: int progression = (int)eventCommand.GetParameter("QuestProgression"); if (progression != -1) { int greaterCondition = (int)eventCommand.GetParameter("QuestProgressionCondition"); if (greaterCondition == 0) { if (mapPlayer.GetPlayerPacket().Data.GetQuestProgression(questID) == progression) { conditionMet = true; } } else { if (mapPlayer.GetPlayerPacket().Data.GetQuestProgression(questID) >= progression) { conditionMet = true; } } } break; } } // check quest status here break; case ConditionalBranchType.SelectedOption: int option = (int)eventCommand.GetParameter("SelectedOption"); if (option == triggeringEvent.SelectedOption) { conditionMet = true; } break; case ConditionalBranchType.TerrainTag: if (mapPlayer == null || !mapPlayer.Connected) { break; } int tag = (int)eventCommand.GetParameter("TerrainTag"); if (mapPlayer.TerrainTagCheck(tag)) { conditionMet = true; } break; case ConditionalBranchType.PlayerDirection: if (mapPlayer == null || !mapPlayer.Connected) { break; } FacingDirection dir = (FacingDirection)eventCommand.GetParameter("PlayerDirection"); if (mapPlayer.GetPlayerPacket().Direction == dir) { conditionMet = true; } break; case ConditionalBranchType.PlayerGold: if (mapPlayer == null || !mapPlayer.Connected) { break; } gold = (int)eventCommand.GetParameter("Gold"); if (mapPlayer.GetPlayerPacket().Data.Gold >= gold) { conditionMet = true; } break; } if (conditionMet != result) { int conditionDepth = triggeringEvent.ConditionDepth; for (int i = triggeringEvent.CommandID + 1; i < eventData.EventCommands.Count; i++) { triggeringEvent.CommandID++; if (eventData.EventCommands[i].Type == EventCommand.CommandType.ConditionalBranchStart) { conditionDepth++; } if (eventData.EventCommands[i].Type == EventCommand.CommandType.ConditionalBranchElse || eventData.EventCommands[i].Type == EventCommand.CommandType.ConditionalBranchEnd) { if (conditionDepth > triggeringEvent.ConditionDepth) { conditionDepth--; } else { break; } } } } else { triggeringEvent.ConditionDepth++; } break; case EventCommand.CommandType.ConditionalBranchElse: for (int i = triggeringEvent.CommandID + 1; i < eventData.EventCommands.Count; i++) { triggeringEvent.CommandID++; if (eventData.EventCommands[i].Type == EventCommand.CommandType.ConditionalBranchEnd) { break; } } break; case EventCommand.CommandType.ConditionalBranchEnd: if (triggeringEvent.ConditionDepth > 0) { triggeringEvent.ConditionDepth -= 1; } break; case EventCommand.CommandType.AddInventoryItem: if (mapPlayer == null || !mapPlayer.Connected) { break; } itemID = (int)eventCommand.GetParameter("ItemID"); itemAmount = (int)eventCommand.GetParameter("ItemAmount"); added = mapPlayer.GetPlayerPacket().Data.AddInventoryItem(itemID, itemAmount); remainder = itemAmount - added; if (remainder > 0) { mapX = mapPlayer.GetPlayerPacket().PositionX; mapY = mapPlayer.GetPlayerPacket().PositionY; MapItem mapItem = new MapItem(itemID, remainder, mapX, mapY, mapPlayer.GetPlayerPacket().PlayerID, mapPlayer.GetPlayerPacket().OnBridge); _serverMap.GetMapInstance().AddMapItem(mapItem); } break; case EventCommand.CommandType.RemoveInventoryItem: if (mapPlayer == null || !mapPlayer.Connected) { break; } itemID = (int)eventCommand.GetParameter("ItemID"); itemAmount = (int)eventCommand.GetParameter("ItemAmount"); mapPlayer.GetPlayerPacket().Data.RemoveInventoryItem(itemID, itemAmount); break; case EventCommand.CommandType.ChangePlayerSprite: if (mapPlayer == null || !mapPlayer.Connected) { break; } spriteID = (int)eventCommand.GetParameter("SpriteID"); mapPlayer.GetPlayerPacket().SpriteID = spriteID; break; case EventCommand.CommandType.WaitForMovementCompletion: if (mapPlayer == null || !mapPlayer.Connected) { break; } if (mapPlayer.Moving()) { triggeringEvent.CommandID--; } break; case EventCommand.CommandType.AddGold: if (mapPlayer == null || !mapPlayer.Connected) { break; } gold = (int)eventCommand.GetParameter("Gold"); mapPlayer.GetPlayerPacket().Data.Gold += gold; break; case EventCommand.CommandType.RemoveGold: if (mapPlayer == null || !mapPlayer.Connected) { break; } gold = (int)eventCommand.GetParameter("Gold"); mapPlayer.GetPlayerPacket().Data.Gold -= gold; if (mapPlayer.GetPlayerPacket().Data.Gold < 0) { mapPlayer.GetPlayerPacket().Data.Gold = 0; } break; case EventCommand.CommandType.SpawnEnemy: if (mapPlayer != null) { break; } int enemyID = (int)eventCommand.GetParameter("EnemyID"); if (enemyID == -1) { break; } int enemyCount = (int)eventCommand.GetParameter("Count"); float respawnTime = (float)eventCommand.GetParameter("RespawnTime"); int spawnRadius = (int)eventCommand.GetParameter("SpawnRadius"); mapEvent = triggeringEvent.GetMapEvent(); Dictionary <MapEnemy, float> enemyTracker = _serverMap.GetMapInstance().GetEnemyTracker(mapEvent); Random r = new Random(); while (enemyTracker.Count < enemyCount) { int minX = mapEvent.MapX - spawnRadius; int maxX = mapEvent.MapX + spawnRadius; int minY = mapEvent.MapY - spawnRadius; int maxY = mapEvent.MapY + spawnRadius; while (true) { int spawnX = r.Next(minX, maxX); int spawnY = r.Next(minY, maxY); bool onBridge = mapEvent.OnBridge && _serverMap.GetMapInstance().GetBridgeFlag(spawnX, spawnY); bool bridgeEntry = onBridge && _serverMap.GetMapInstance().MapTilesetPassable(spawnX, spawnY); if (_serverMap.GetMapInstance().MapTileCharacterPassable(spawnX, spawnY, false, onBridge, bridgeEntry, MovementDirection.Down)) { MapEnemy enemy = new MapEnemy(enemyID, spawnX, spawnY, onBridge); enemyTracker.Add(enemy, respawnTime); _serverMap.GetMapInstance().AddMapEnemy(enemy); break; } } } break; case EventCommand.CommandType.ProgressQuest: if (mapPlayer == null || !mapPlayer.Connected) { break; } questID = (int)eventCommand.GetParameter("QuestID"); if (questID != -1) { if (mapPlayer.GetPlayerPacket().Data.QuestStarted(questID)) { int progression = mapPlayer.GetPlayerPacket().Data.GetQuestProgression(questID); if (mapPlayer.GetPlayerPacket().Data.ProgressQuest(questID)) { QuestData data = QuestData.GetData(questID); QuestData.QuestObective objective = data.Objectives[progression]; for (int i = 0; i < objective.ItemRewards.Count; i++) { itemID = objective.ItemRewards[i].Item1; itemAmount = objective.ItemRewards[i].Item2; added = mapPlayer.GetPlayerPacket().Data.AddInventoryItem(itemID, itemAmount); remainder = itemAmount - added; if (remainder > 0) { mapX = mapPlayer.GetPlayerPacket().PositionX; mapY = mapPlayer.GetPlayerPacket().PositionY; MapItem mapItem = new MapItem(itemID, remainder, mapX, mapY, mapPlayer.GetPlayerPacket().PlayerID, mapPlayer.GetPlayerPacket().OnBridge); _serverMap.GetMapInstance().AddMapItem(mapItem); } } } } else { mapPlayer.GetPlayerPacket().Data.StartQuest(questID); } } break; case EventCommand.CommandType.ShowShop: if (mapPlayer == null || !mapPlayer.Connected) { break; } int shopID = (int)eventCommand.GetParameter("ShopID"); mapPlayer.ShowShop(shopID); break; case EventCommand.CommandType.StartBanking: if (mapPlayer == null || !mapPlayer.Connected) { break; } mapPlayer.StartBanking(); break; case EventCommand.CommandType.ShowWorkbench: if (mapPlayer == null || !mapPlayer.Connected) { break; } int workbenchID = (int)eventCommand.GetParameter("WorkbenchID"); mapPlayer.ShowWorkbench(workbenchID); break; } } else { triggeringEvent.FinishTriggering(); } }
public SessionContext(SystemVariable systemVariable, GlobalContext globalContext) { _systemVariable = systemVariable ?? throw new ArgumentNullException(nameof(systemVariable)); _globalContext = globalContext ?? throw new ArgumentNullException(nameof(globalContext)); }
public static SystemVariableViewModel ToModel(this SystemVariable variableViewModel) { return(Mapper.Map <SystemVariableViewModel>(variableViewModel)); }
public static string getValue(SystemVariable sv) { // 첫번째 있는게 value string keyValue = sv.ToString(); return (SystemVariableManager.variables_[keyValue])[0]; }
static void homegear_SystemVariableUpdated(Homegear sender, SystemVariable variable) { Console.WriteLine("System variable updated: Value: " + variable.ToString()); }
public TemplateProcessor(GlobalContext globalContext, SessionContext sessionContext, SystemVariable systemVariable) { _globalContext = globalContext ?? throw new ArgumentNullException(nameof(globalContext)); _sessionContext = sessionContext ?? throw new ArgumentNullException(nameof(sessionContext)); _systemVariable = systemVariable ?? throw new ArgumentNullException(nameof(systemVariable)); }
public GlobalContext(SystemVariable systemVariable) { _systemVariable = systemVariable ?? throw new ArgumentNullException(nameof(systemVariable)); }
public void UpdateSystemVariables(SystemVariable vars) { new SystemVariablesRepository().UpdateSystemVariables(vars); }