public static void DrawAreas(CLRScriptBase script, User currentUser)
 {
     script.ClearListBox(currentUser.Id, "SCREEN_DMC_CHOOSER", "LISTBOX_ACR_CHOOSER_AREAS");
     if (ALFA.Shared.Modules.InfoStore.ActiveAreas.Keys.Contains(script.GetArea(currentUser.Id)))
     {
         ALFA.Shared.ActiveArea currentArea = ALFA.Shared.Modules.InfoStore.ActiveAreas[script.GetArea(currentUser.Id)];
         string currentName = "<Color=DarkOrange>" + currentArea.DisplayName + "________";
         DisplayString.ShortenStringToWidth(currentName, 250);
         currentName = currentName.Trim('_') + "</color>";
         script.AddListBoxRow(currentUser.Id, "SCREEN_DMC_CHOOSER", "LISTBOX_ACR_CHOOSER_AREAS", currentArea.Id.ToString(), "LISTBOX_ITEM_TEXT=  "+currentName, "", "5="+currentArea.Id.ToString(), "");
         List<ALFA.Shared.ActiveArea> adjAreas = new List<ALFA.Shared.ActiveArea>();
         foreach (ALFA.Shared.ActiveArea adjacentArea in currentArea.ExitTransitions.Values)
         {
             if (!adjAreas.Contains(adjacentArea))
             {
                 string adjName = "<Color=DarkGoldenRod>" + adjacentArea.DisplayName + "________";
                 DisplayString.ShortenStringToWidth(adjName, 250);
                 adjName = adjName.Trim('_') + "</color>";
                 script.AddListBoxRow(currentUser.Id, "SCREEN_DMC_CHOOSER", "LISTBOX_ACR_CHOOSER_AREAS", adjacentArea.Id.ToString(), "LISTBOX_ITEM_TEXT=  " + adjName, "", "5=" + adjacentArea.Id.ToString(), "");
                 adjAreas.Add(adjacentArea);
             }
         }
     }
     foreach (ALFA.Shared.ActiveArea area in AreaList)
     {
         script.AddListBoxRow(currentUser.Id, "SCREEN_DMC_CHOOSER", "LISTBOX_ACR_CHOOSER_AREAS", area.Id.ToString(), "LISTBOX_ITEM_TEXT=  " + area.DisplayName, "", "5=" + area.Id.ToString(), "");
     }
     currentUser.LastSeenArea = script.GetArea(currentUser.Id);
 }
        public static void JumpToArea(CLRScriptBase script, User currentUser)
        {
            uint currentArea = script.GetArea(currentUser.Id);
            if (!ALFA.Shared.Modules.InfoStore.ActiveAreas.Keys.Contains(currentUser.Id))
            {

            }

            // If this is an adjacent area, jump the DM to one of the ATs connecting the areas.
            foreach (ALFA.Shared.ActiveTransition exitTranstion in ALFA.Shared.Modules.InfoStore.ActiveAreas[currentArea].ExitTransitions.Keys)
            {
                if (exitTranstion.AreaTarget.Id == currentUser.FocusedArea)
                {
                    script.JumpToLocation(script.GetLocation(exitTranstion.Target));
                    return;
                }
            }

            // If these aren't adjacent areas, grab an AT if we can find one.
            if (ALFA.Shared.Modules.InfoStore.ActiveAreas[currentUser.FocusedArea].ExitTransitions.Count > 0)
            {
                foreach(ALFA.Shared.ActiveTransition enterTransition in ALFA.Shared.Modules.InfoStore.ActiveAreas[currentUser.FocusedArea].ExitTransitions.Keys)
                {
                    script.JumpToLocation(script.GetLocation(enterTransition.Id));
                    return;
                }
            }

            // If we can't find one, just try the middle of the area.
            float x = script.GetAreaSize(AREA_WIDTH, currentUser.FocusedArea) / 2;
            float y = script.GetAreaSize(AREA_HEIGHT, currentUser.FocusedArea) / 2;
            float z = 0.0f;
            NWLocation loc = script.Location(currentUser.FocusedArea, script.Vector(x, y, z), 0.0f);
            script.JumpToLocation(loc);
        }
Exemplo n.º 3
0
 public static void LoadAreas(CLRScriptBase s)
 {
     if (!ACR_Candlekeep.ArchivesInstance.WaitForResourcesLoaded(false))
     {
         s.DelayCommand(6.0f, delegate { LoadAreas(s); });
         return;
     }
     ALFA.Shared.Modules.InfoStore.ActiveAreas = new Dictionary<uint, ALFA.Shared.ActiveArea>();
     List<uint> areas = new List<uint>();
     foreach (uint area in s.GetAreas())
     {
         ALFA.Shared.ActiveArea activeArea = new ALFA.Shared.ActiveArea();
         activeArea.Id = area;
         activeArea.Name = s.GetName(area).Trim();
         activeArea.Tag = s.GetTag(area);
         activeArea.GlobalQuests.Add("Infestation", s.GetLocalInt(area, "ACR_QST_MAX_INFESTATION"));
         ALFA.Shared.Modules.InfoStore.ActiveAreas.Add(area, activeArea);
         areas.Add(area);
     }
     int count = 0;
     foreach(KeyValuePair<string, string> keyValue in ALFA.Shared.Modules.InfoStore.AreaNames)
     {
         ALFA.Shared.Modules.InfoStore.ActiveAreas[areas[count]].LocalizedName = keyValue.Value;
         ALFA.Shared.Modules.InfoStore.ActiveAreas[areas[count]].ConfigureDisplayName();
         s.SetLocalString(areas[count], "ACR_AREA_RESREF", keyValue.Key);
         count++;
     }
     foreach (ALFA.Shared.ActiveArea activeArea in ALFA.Shared.Modules.InfoStore.ActiveAreas.Values)
     {
         foreach (uint thing in s.GetObjectsInArea(activeArea.Id))
         {
             uint target = s.GetTransitionTarget(thing);
             if (s.GetIsObjectValid(target) != FALSE)
             {
                 ALFA.Shared.ActiveTransition activeTransition = new ALFA.Shared.ActiveTransition();
                 activeTransition.AreaTarget = ALFA.Shared.Modules.InfoStore.ActiveAreas[s.GetArea(target)];
                 activeTransition.Id = thing;
                 activeTransition.Target = target;
                 activeArea.ExitTransitions.Add(activeTransition, activeTransition.AreaTarget);
             }
         }
     }
 }
 private static void _doSoloVFX(CLRScriptBase s, ALFA.Shared.ActiveTrap trap, uint target)
 {
     if (trap.EffectSize < 2.0f)
     {
         if (s.GetArea(trap.TrapOrigin) == s.GetArea(s.GetObjectByTag(trap.Tag, 0)))
         {
             if ((trap.DamageType & DAMAGE_TYPE_ACID) == DAMAGE_TYPE_ACID)
             {
                 s.ApplyEffectToObject(DURATION_TYPE_TEMPORARY, s.EffectBeam(VFX_BEAM_ACID, trap.TrapOrigin, BODY_NODE_CHEST, FALSE), target, 1.0f);
             }
             if ((trap.DamageType & DAMAGE_TYPE_BLUDGEONING) == DAMAGE_TYPE_BLUDGEONING)
             {
                 s.SpawnItemProjectile(trap.TrapOrigin, target, s.GetLocation(trap.TrapOrigin), s.GetLocation(target), BASE_ITEM_SLING, PROJECTILE_PATH_TYPE_HOMING, OVERRIDE_ATTACK_RESULT_HIT_SUCCESSFUL, 0);
                 float fShotDelay = 0.1f;
                 int c = 1;
                 while (c < trap.DiceNumber)
                 {
                     s.DelayCommand(fShotDelay, delegate { s.SpawnItemProjectile(trap.TrapOrigin, target, s.GetLocation(trap.TrapOrigin), s.GetLocation(target), BASE_ITEM_SLING, PROJECTILE_PATH_TYPE_HOMING, OVERRIDE_ATTACK_RESULT_HIT_SUCCESSFUL, 0); });
                     fShotDelay += 0.1f;
                     c++;
                 }
             }
             if ((trap.DamageType & DAMAGE_TYPE_COLD) == DAMAGE_TYPE_COLD)
             {
                 s.ApplyEffectToObject(DURATION_TYPE_TEMPORARY, s.EffectBeam(VFX_BEAM_ICE, trap.TrapOrigin, BODY_NODE_CHEST, FALSE), target, 1.0f);
             }
             if ((trap.DamageType & DAMAGE_TYPE_DIVINE) == DAMAGE_TYPE_DIVINE)
             {
                 s.ApplyEffectToObject(DURATION_TYPE_TEMPORARY, s.EffectBeam(VFX_BEAM_HOLY, trap.TrapOrigin, BODY_NODE_CHEST, FALSE), target, 1.0f);
             }
             if ((trap.DamageType & DAMAGE_TYPE_ELECTRICAL) == DAMAGE_TYPE_ELECTRICAL)
             {
                 s.ApplyEffectToObject(DURATION_TYPE_TEMPORARY, s.EffectBeam(VFX_BEAM_LIGHTNING, trap.TrapOrigin, BODY_NODE_CHEST, FALSE), target, 1.0f);
             }
             if ((trap.DamageType & DAMAGE_TYPE_FIRE) == DAMAGE_TYPE_FIRE)
             {
                 s.ApplyEffectToObject(DURATION_TYPE_TEMPORARY, s.EffectBeam(VFX_BEAM_FIRE, trap.TrapOrigin, BODY_NODE_CHEST, FALSE), target, 1.0f);
             }
             if ((trap.DamageType & DAMAGE_TYPE_MAGICAL) == DAMAGE_TYPE_MAGICAL)
             {
                 s.ApplyEffectToObject(DURATION_TYPE_TEMPORARY, s.EffectBeam(VFX_BEAM_MAGIC, trap.TrapOrigin, BODY_NODE_CHEST, FALSE), target, 1.0f);
             }
             if ((trap.DamageType & DAMAGE_TYPE_NEGATIVE) == DAMAGE_TYPE_NEGATIVE)
             {
                 s.ApplyEffectToObject(DURATION_TYPE_TEMPORARY, s.EffectBeam(VFX_BEAM_EVIL, trap.TrapOrigin, BODY_NODE_CHEST, FALSE), target, 1.0f);
             }
             if ((trap.DamageType & DAMAGE_TYPE_PIERCING) == DAMAGE_TYPE_PIERCING)
             {
                 s.SpawnItemProjectile(trap.TrapOrigin, target, s.GetLocation(trap.TrapOrigin), s.GetLocation(target), BASE_ITEM_DART, PROJECTILE_PATH_TYPE_HOMING, OVERRIDE_ATTACK_RESULT_HIT_SUCCESSFUL, 0);
                 float fShotDelay = 0.1f;
                 int c = 1;
                 while (c < trap.DiceNumber)
                 {
                     s.SpawnItemProjectile(trap.TrapOrigin, target, s.GetLocation(trap.TrapOrigin), s.GetLocation(target), BASE_ITEM_DART, PROJECTILE_PATH_TYPE_HOMING, OVERRIDE_ATTACK_RESULT_HIT_SUCCESSFUL, 0);
                     fShotDelay += 0.1f;
                     c++;
                 }
             }
             if ((trap.DamageType & DAMAGE_TYPE_POSITIVE) == DAMAGE_TYPE_POSITIVE)
             {
                 s.ApplyEffectToObject(DURATION_TYPE_TEMPORARY, s.EffectBeam(VFX_BEAM_HOLY, trap.TrapOrigin, BODY_NODE_CHEST, FALSE), target, 1.0f);
             }
             if ((trap.DamageType & DAMAGE_TYPE_SLASHING) == DAMAGE_TYPE_SLASHING)
             {
                 s.SpawnItemProjectile(trap.TrapOrigin, target, s.GetLocation(trap.TrapOrigin), s.GetLocation(target), BASE_ITEM_THROWINGAXE, PROJECTILE_PATH_TYPE_HOMING, OVERRIDE_ATTACK_RESULT_HIT_SUCCESSFUL, 0);
                 float fShotDelay = 0.1f;
                 int c = 1;
                 while (c < trap.DiceNumber)
                 {
                     s.SpawnItemProjectile(trap.TrapOrigin, target, s.GetLocation(trap.TrapOrigin), s.GetLocation(target), BASE_ITEM_THROWINGAXE, PROJECTILE_PATH_TYPE_HOMING, OVERRIDE_ATTACK_RESULT_HIT_SUCCESSFUL, 0);
                     fShotDelay += 0.1f;
                     c++;
                 }
             }
             if ((trap.DamageType & DAMAGE_TYPE_SONIC) == DAMAGE_TYPE_SONIC)
             {
                 s.ApplyEffectToObject(DURATION_TYPE_TEMPORARY, s.EffectBeam(VFX_BEAM_SONIC, trap.TrapOrigin, BODY_NODE_CHEST, FALSE), target, 1.0f);
             }
         }
         else
         {
             // These are pretty much single-target effects.
             if ((trap.DamageType & DAMAGE_TYPE_ACID) == DAMAGE_TYPE_ACID)
             {
                 s.ApplyEffectToObject(DURATION_TYPE_INSTANT, s.EffectVisualEffect(VFX_IMP_ACID_S, FALSE), target, 0.0f);
             }
             if ((trap.DamageType & DAMAGE_TYPE_BLUDGEONING) == DAMAGE_TYPE_BLUDGEONING)
             {
                 s.ApplyEffectToObject(DURATION_TYPE_INSTANT, s.EffectVisualEffect(VFX_COM_BLOOD_CRT_RED, FALSE), target, 0.0f);
             }
             if ((trap.DamageType & DAMAGE_TYPE_COLD) == DAMAGE_TYPE_COLD)
             {
                 s.ApplyEffectToObject(DURATION_TYPE_INSTANT, s.EffectVisualEffect(VFX_IMP_FROST_L, FALSE), target, 0.0f);
             }
             if ((trap.DamageType & DAMAGE_TYPE_DIVINE) == DAMAGE_TYPE_DIVINE)
             {
                 s.ApplyEffectToObject(DURATION_TYPE_INSTANT, s.EffectVisualEffect(VFX_COM_HIT_DIVINE, FALSE), target, 0.0f);
             }
             if ((trap.DamageType & DAMAGE_TYPE_ELECTRICAL) == DAMAGE_TYPE_ELECTRICAL)
             {
                 s.ApplyEffectToObject(DURATION_TYPE_INSTANT, s.EffectVisualEffect(VFX_IMP_LIGHTNING_S, FALSE), target, 0.0f);
             }
             if ((trap.DamageType & DAMAGE_TYPE_FIRE) == DAMAGE_TYPE_FIRE)
             {
                 s.ApplyEffectToObject(DURATION_TYPE_INSTANT, s.EffectVisualEffect(VFX_IMP_FLAME_S, FALSE), target, 0.0f);
             }
             if ((trap.DamageType & DAMAGE_TYPE_MAGICAL) == DAMAGE_TYPE_MAGICAL)
             {
                 s.ApplyEffectToObject(DURATION_TYPE_INSTANT, s.EffectVisualEffect(VFX_IMP_MAGBLUE, FALSE), target, 0.0f);
             }
             if ((trap.DamageType & DAMAGE_TYPE_NEGATIVE) == DAMAGE_TYPE_NEGATIVE)
             {
                 s.ApplyEffectToObject(DURATION_TYPE_INSTANT, s.EffectVisualEffect(VFX_IMP_NEGATIVE_ENERGY, FALSE), target, 0.0f);
             }
             if ((trap.DamageType & DAMAGE_TYPE_PIERCING) == DAMAGE_TYPE_PIERCING)
             {
                 s.ApplyEffectToObject(DURATION_TYPE_INSTANT, s.EffectVisualEffect(VFX_IMP_SPIKE_TRAP, FALSE), target, 0.0f);
             }
             if ((trap.DamageType & DAMAGE_TYPE_POSITIVE) == DAMAGE_TYPE_POSITIVE)
             {
                 s.ApplyEffectToObject(DURATION_TYPE_INSTANT, s.EffectVisualEffect(VFX_IMP_SUNSTRIKE, FALSE), target, 0.0f);
             }
             if ((trap.DamageType & DAMAGE_TYPE_SLASHING) == DAMAGE_TYPE_SLASHING)
             {
                 s.ApplyEffectToObject(DURATION_TYPE_INSTANT, s.EffectVisualEffect(VFX_COM_BLOOD_CRT_RED, FALSE), target, 0.0f);
             }
             if ((trap.DamageType & DAMAGE_TYPE_SONIC) == DAMAGE_TYPE_SONIC)
             {
                 s.ApplyEffectToObject(DURATION_TYPE_INSTANT, s.EffectVisualEffect(VFX_IMP_SONIC, FALSE), target, 0.0f);
             }
         }
     }
     else { return; }
 }
Exemplo n.º 5
0
        public static void Dismount(CLRScriptBase script, uint Character, uint Cloak, NWLocation Location)
        {
            string resRef = "";
            if (script.GetLocalInt(Cloak, ACR_IS_WARHORSE) == 1)
            {
                resRef = "abr_cr_an_horse_pal_";
                int nPalLevel = script.GetLevelByClass(CLRScriptBase.CLASS_TYPE_PALADIN, Character);
                if (nPalLevel >= 15) resRef += "15";
                else if (nPalLevel >= 11) resRef += "11";
                else if (nPalLevel >= 8) resRef += "8";
                else if (nPalLevel >= 5) resRef += "5";
                else resRef = "abr_cr_an_horse03";
            }
            else
            {
                switch (script.GetTag(Cloak))
                {
                    case "acr_ooc_horse01":
                        resRef = "abr_cr_an_horse01";
                        break;
                    case "acr_ooc_horse02":
                        resRef = "abr_cr_an_horse02";
                        break;
                    case "acr_ooc_horse03":
                        resRef = "abr_cr_an_horse03";
                        break;
                    default:
                        // Looks like we're not actually dismounting a horse.
                        return;
                }
            }
            
            uint Horse = script.CreateObject(CLRScriptBase.OBJECT_TYPE_CREATURE, resRef, Location, CLRScriptBase.FALSE, "");
            script.SetLocalInt(Horse, ACR_HORSE_OWNER, script.GetLocalInt(Character, ACR_CID));
            script.SetLocalInt(Horse, ACR_HORSE_ID, script.GetLocalInt(Cloak, ACR_HORSE_ID));
            int damage = script.GetCurrentHitPoints(Horse) - script.GetLocalInt(Cloak, ACR_HORSE_HP);
            if(damage > 0)
            {
                script.ApplyEffectToObject(CLRScriptBase.DURATION_TYPE_INSTANT, script.EffectDamage(damage, CLRScriptBase.DAMAGE_TYPE_MAGICAL, CLRScriptBase.DAMAGE_POWER_PLUS_TWENTY, CLRScriptBase.TRUE), Horse, 0.0f);
            }
            if (script.GetLocalInt(Cloak, ACR_IS_WARHORSE) == 1)
            {
                script.AddHenchman(Character, Horse);
                script.SetLocalInt(Horse, ACR_IS_WARHORSE, 1);
                script.SetLocalObject(Character, ACR_PAL_WARHORSE, Horse);
            }

            uint Item = GetOwnershipItemById(script, Character, script.GetLocalInt(Cloak, ACR_HORSE_ID));
            script.SetLocalObject(Item , ACR_HORSE_OBJECT, Horse);
            script.SetLocalObject(Horse, ACR_HORSE_OBJECT, Character);

            script.SetLocalString(Item, ACR_HORSE_PERS_LOC_AREA, script.GetTag(script.GetArea(Horse)));
            script.SetLocalFloat(Item, ACR_HORSE_PERS_LOC_X, script.GetPosition(Horse).x);
            script.SetLocalFloat(Item, ACR_HORSE_PERS_LOC_Y, script.GetPosition(Horse).y);
            script.SetLocalFloat(Item, ACR_HORSE_PERS_LOC_Z, script.GetPosition(Horse).z);

            script.SetPlotFlag(Cloak, CLRScriptBase.FALSE);
            script.DestroyObject(Cloak, 0.0f, CLRScriptBase.FALSE);
            isWarhorse.Remove(Character);
        }
 public RandomDungeonArea GetCurrentArea(CLRScriptBase script)
 {
     uint currentArea = script.GetArea(script.OBJECT_SELF);
     RandomDungeonArea currentAreaObject = null;
     foreach (RandomDungeonArea area in AreasOfDungeon)
     {
         if (area.AreaId == currentArea)
         {
             currentAreaObject = area;
             break;
         }
     }
     return currentAreaObject;
 }