static bool HandleModifyPhaseCommand(StringArguments args, CommandHandler handler) { if (args.Empty()) { return(false); } uint phaseId = args.NextUInt32(); uint visibleMapId = args.NextUInt32(); if (phaseId != 0 && !CliDB.PhaseStorage.ContainsKey(phaseId)) { handler.SendSysMessage(CypherStrings.PhaseNotfound); return(false); } Unit target = handler.GetSelectedUnit(); if (visibleMapId != 0) { MapRecord visibleMap = CliDB.MapStorage.LookupByKey(visibleMapId); if (visibleMap == null || visibleMap.ParentMapID != target.GetMapId()) { handler.SendSysMessage(CypherStrings.PhaseNotfound); return(false); } if (!target.GetPhaseShift().HasVisibleMapId(visibleMapId)) { PhasingHandler.AddVisibleMapId(target, visibleMapId); } else { PhasingHandler.RemoveVisibleMapId(target, visibleMapId); } } if (phaseId != 0) { if (!target.GetPhaseShift().HasPhase(phaseId)) { PhasingHandler.AddPhase(target, phaseId, true); } else { PhasingHandler.RemovePhase(target, phaseId, true); } } return(true); }