mirror of
				https://bitbucket.org/Ioncannon/project-meteor-server.git
				synced 2025-05-20 08:26:59 -04:00 
			
		
		
		
	Compare commits
	
		
			125 Commits
		
	
	
		
			develop
			...
			ioncannon/
		
	
	| Author | SHA1 | Date | |
|---|---|---|---|
|  | 63f0b024ac | ||
|  | 67db1035ed | ||
|  | c865975df7 | ||
|  | aef0f2b400 | ||
|  | 16c62a08d8 | ||
|  | 6cb107870f | ||
|  | 9a2f8ef89a | ||
|  | 524f415b44 | ||
|  | 5c0d2c1d7f | ||
|  | a7b1b79461 | ||
|  | c3b4735cc5 | ||
|  | ac22637b4f | ||
|  | 01d05b5cee | ||
|  | d50bfef2e5 | ||
|  | a5a039ce3d | ||
|  | 514610f006 | ||
|  | 159242068d | ||
|  | a6ee42094c | ||
|  | 6bbe272d48 | ||
|  | 938cca0298 | ||
|  | e53e54b4bf | ||
|  | f6ff56299f | ||
|  | a1bb84e80d | ||
|  | 4d2c80a8ee | ||
|  | c2169576c2 | ||
|  | 4d424e57f9 | ||
|  | 4494b30285 | ||
|  | 74713f3dd6 | ||
|  | b08827568c | ||
|  | b34f214e67 | ||
|  | e94c037fb5 | ||
|  | 65ee91e49c | ||
|  | 01ec313ffb | ||
|  | ebba56602c | ||
|  | 49c6fdbd51 | ||
|  | 08557f41fb | ||
|  | a618e69dbd | ||
|  | 02fe9e070d | ||
|  | bf20993e58 | ||
|  | 2817560217 | ||
|  | 765cf194c5 | ||
|  | b57f91470a | ||
|  | 2cb6a9f6bd | ||
|  | b773098abf | ||
|  | f491c63b98 | ||
|  | 023527efa3 | ||
|  | 96f9119cca | ||
|  | f84899ff2e | ||
|  | a87244d13b | ||
|  | c5198783a1 | ||
|  | b9ab842fdd | ||
|  | e8ee907477 | ||
|  | b4227cdc44 | ||
|  | 59f4e4bbd5 | ||
|  | c9f18f5415 | ||
|  | 495bdf4ba6 | ||
|  | b46160763c | ||
|  | 3393eb4c9d | ||
|  | 7de153dde1 | ||
|  | 0faa056589 | ||
|  | 90115f7c83 | ||
|  | 682ddd9cae | ||
|  | 8c70d0ddb6 | ||
|  | 5c49563790 | ||
|  | c6a372ad83 | ||
|  | d2e814b4ee | ||
|  | 0cdeb5d9ac | ||
|  | fac8f269e7 | ||
|  | d06152be07 | ||
|  | 0b67f8e436 | ||
|  | 7fea45e1f8 | ||
|  | 696d355ae9 | ||
|  | bbbab356af | ||
|  | 594e08f990 | ||
|  | 89287844f7 | ||
|  | c240096eb8 | ||
|  | 08e7a9cfd4 | ||
|  | 25f1b0fd95 | ||
|  | c677479a03 | ||
|  | 306f4ef346 | ||
|  | a2c4d077e9 | ||
|  | 7e5ca6e013 | ||
|  | 02cb0a3f43 | ||
|  | dc1458c52d | ||
|  | 1523ae200b | ||
|  | aae051d73f | ||
|  | 9097e557ed | ||
|  | cfe6ef2e5e | ||
|  | d26aaed953 | ||
|  | 8d5f4465e3 | ||
|  | 214d730a58 | ||
|  | b6c9825b2d | ||
|  | acf953e909 | ||
|  | 4fe8f77887 | ||
|  | 96cb8070be | ||
|  | 9f077190a3 | ||
|  | 0465bf6b8d | ||
|  | 0ac53e23ad | ||
|  | e6d5d5a530 | ||
|  | 335efcc81e | ||
|  | fb9d4026a5 | ||
|  | 68a2685cf1 | ||
|  | 8b3431e557 | ||
|  | b11007b263 | ||
|  | 2cbb48621b | ||
|  | f574f5b103 | ||
|  | 8d647ae6b0 | ||
|  | f374ee3be9 | ||
|  | 37d04344ae | ||
|  | 68e55a1c76 | ||
|  | 4e0cf36552 | ||
|  | 4e5a07afa4 | ||
|  | 563118372a | ||
|  | 4fc5762d41 | ||
|  | 56ba641e2a | ||
|  | 3ad30460d8 | ||
|  | ff074c8394 | ||
|  | bad51717c2 | ||
|  | 26fd79bea5 | ||
|  | 6e869af4fb | ||
|  | 93c90df797 | ||
|  | c38caffaf1 | ||
|  | 958a87edf2 | ||
|  | 2279ee7017 | ||
|  | df49eefadb | 
							
								
								
									
										204
									
								
								Common Class Lib/Bitstream.cs
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										204
									
								
								Common Class Lib/Bitstream.cs
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,204 @@ | |||||||
|  | using System; | ||||||
|  | using System.Collections.Generic; | ||||||
|  | using System.Diagnostics; | ||||||
|  | using System.Linq; | ||||||
|  | using System.Text; | ||||||
|  | using System.Threading.Tasks; | ||||||
|  |  | ||||||
|  | namespace Meteor.Common | ||||||
|  | { | ||||||
|  |     public class Bitstream | ||||||
|  |     { | ||||||
|  |         private byte[] Data; | ||||||
|  |  | ||||||
|  |         public Bitstream(uint numBits, bool setAllTrue = false) | ||||||
|  |         { | ||||||
|  |             Debug.Assert(numBits % 8 == 0); | ||||||
|  |             Debug.Assert(numBits % 4 == 0); | ||||||
|  |             Data = new byte[numBits / 8]; | ||||||
|  |  | ||||||
|  |             if (setAllTrue) | ||||||
|  |                 SetAll(true); | ||||||
|  |         } | ||||||
|  |  | ||||||
|  |         public Bitstream(bool[] boolArray) | ||||||
|  |         { | ||||||
|  |             Data = Utils.ConvertBoolArrayToBinaryStream(boolArray); | ||||||
|  |         } | ||||||
|  |  | ||||||
|  |         private Bitstream(byte[] byteArray) | ||||||
|  |         { | ||||||
|  |             Data = byteArray; | ||||||
|  |         } | ||||||
|  |  | ||||||
|  |         public void SetAll(bool to) | ||||||
|  |         { | ||||||
|  |             for (int i = 0; i < Data.Length; i += 4) | ||||||
|  |             { | ||||||
|  |                 Data[i] = Data[i + 1] = Data[i + 2] = Data[i + 3] = (byte)(to ? 0xFF : 0x00); | ||||||
|  |             } | ||||||
|  |         } | ||||||
|  |  | ||||||
|  |         public void SetTo(Bitstream result) | ||||||
|  |         { | ||||||
|  |             Debug.Assert(Data.Length == result.Data.Length); | ||||||
|  |             for (int i = 0; i < result.Data.Length; i += 4) | ||||||
|  |             { | ||||||
|  |                 Data[i] = result.Data[i]; | ||||||
|  |                 Data[i + 1] = result.Data[i + 1]; | ||||||
|  |                 Data[i + 2] = result.Data[i + 2]; | ||||||
|  |                 Data[i + 3] = result.Data[i + 3]; | ||||||
|  |             } | ||||||
|  |         } | ||||||
|  |  | ||||||
|  |         public void SetTo(bool[] result) | ||||||
|  |         { | ||||||
|  |             Debug.Assert(Data.Length == result.Length / 8); | ||||||
|  |             Data = Utils.ConvertBoolArrayToBinaryStream(result); | ||||||
|  |         } | ||||||
|  |  | ||||||
|  |         public bool Get(uint at) | ||||||
|  |         { | ||||||
|  |             return Get((int)at); | ||||||
|  |         } | ||||||
|  |  | ||||||
|  |         public bool Get(int at) | ||||||
|  |         { | ||||||
|  |             int bytePos = at / 8; | ||||||
|  |             int bitPos = at % 8; | ||||||
|  |  | ||||||
|  |             return (Data[bytePos] & (1 << bitPos)) != 0; | ||||||
|  |         } | ||||||
|  |  | ||||||
|  |         public void Set(uint at) | ||||||
|  |         { | ||||||
|  |             Set((int)at); | ||||||
|  |         } | ||||||
|  |  | ||||||
|  |         public void Set(int at) | ||||||
|  |         { | ||||||
|  |             int bytePos = at / 8; | ||||||
|  |             int bitPos = at % 8; | ||||||
|  |             Data[bytePos] |= (byte)(1 << bitPos); | ||||||
|  |         } | ||||||
|  |  | ||||||
|  |         public void Clear(uint at) | ||||||
|  |         { | ||||||
|  |             Clear((int)at); | ||||||
|  |         } | ||||||
|  |  | ||||||
|  |         public void Clear(int at) | ||||||
|  |         { | ||||||
|  |             int bytePos = at / 8; | ||||||
|  |             int bitPos = at % 8; | ||||||
|  |             Data[bytePos] &= (byte)~(1 << bitPos); | ||||||
|  |         } | ||||||
|  |  | ||||||
|  |         public void NOT() | ||||||
|  |         { | ||||||
|  |             for (int i = 0; i < Data.Length; i += 4) | ||||||
|  |             { | ||||||
|  |                 Data[i] = (byte)~Data[i]; | ||||||
|  |                 Data[i + 1] = (byte)~Data[i + 1]; | ||||||
|  |                 Data[i + 2] = (byte)~Data[i + 2]; | ||||||
|  |                 Data[i + 3] = (byte)~Data[i + 3]; | ||||||
|  |             } | ||||||
|  |         } | ||||||
|  |  | ||||||
|  |         public void OR(Bitstream other) | ||||||
|  |         { | ||||||
|  |             Debug.Assert(Data.Length == other.Data.Length); | ||||||
|  |             for (int i = 0; i < Data.Length; i += 4) | ||||||
|  |             { | ||||||
|  |                 Data[i] |= other.Data[i]; | ||||||
|  |                 Data[i + 1] |= other.Data[i + 1]; | ||||||
|  |                 Data[i + 2] |= other.Data[i + 2]; | ||||||
|  |                 Data[i + 3] |= other.Data[i + 3]; | ||||||
|  |             } | ||||||
|  |         } | ||||||
|  |  | ||||||
|  |         public void AND(Bitstream other) | ||||||
|  |         { | ||||||
|  |             Debug.Assert(Data.Length == other.Data.Length); | ||||||
|  |             for (int i = 0; i < Data.Length; i += 4) | ||||||
|  |             { | ||||||
|  |                 Data[i] &= other.Data[i]; | ||||||
|  |                 Data[i + 1] &= other.Data[i + 1]; | ||||||
|  |                 Data[i + 2] &= other.Data[i + 2]; | ||||||
|  |                 Data[i + 3] &= other.Data[i + 3]; | ||||||
|  |             } | ||||||
|  |         } | ||||||
|  |  | ||||||
|  |         public void XOR(Bitstream other) | ||||||
|  |         { | ||||||
|  |             Debug.Assert(Data.Length == other.Data.Length); | ||||||
|  |             for (int i = 0; i < Data.Length; i += 4) | ||||||
|  |             { | ||||||
|  |                 Data[i] ^= other.Data[i]; | ||||||
|  |                 Data[i + 1] ^= other.Data[i + 1]; | ||||||
|  |                 Data[i + 2] ^= other.Data[i + 2]; | ||||||
|  |                 Data[i + 3] ^= other.Data[i + 3]; | ||||||
|  |             } | ||||||
|  |         } | ||||||
|  |  | ||||||
|  |         public Bitstream Copy() | ||||||
|  |         { | ||||||
|  |             byte[] copy = new byte[Data.Length]; | ||||||
|  |             Array.Copy(Data, copy, Data.Length); | ||||||
|  |             return new Bitstream(copy); | ||||||
|  |         } | ||||||
|  |  | ||||||
|  |         public byte[] GetBytes() | ||||||
|  |         { | ||||||
|  |             return Data; | ||||||
|  |         } | ||||||
|  |  | ||||||
|  |         public byte[] GetSlice(ushort from, ushort to) | ||||||
|  |         { | ||||||
|  |             int remainder = ((to - from) % 8 != 0) ? 1 : 0; | ||||||
|  |             byte[] toReturn = new byte[((to - from) / 8) + remainder + 1]; | ||||||
|  |             toReturn[toReturn.Length - 1] = 0x3; | ||||||
|  |  | ||||||
|  |  | ||||||
|  |             byte curByte = 0; | ||||||
|  |  | ||||||
|  |             int destByteIndx = 0; | ||||||
|  |             int destShiftIndx = 0; | ||||||
|  |             int srcByteIndx = from / 8; | ||||||
|  |             int srcShiftIndx = from % 8; | ||||||
|  |  | ||||||
|  |             for (int i = from; i <= to; i++) | ||||||
|  |             { | ||||||
|  |                 // Skip Zeros | ||||||
|  |                 if (Data[srcByteIndx] == 0) | ||||||
|  |                 { | ||||||
|  |                     srcByteIndx++; | ||||||
|  |                     srcShiftIndx = 0; | ||||||
|  |                     destByteIndx++; | ||||||
|  |                     i += 8; | ||||||
|  |                     continue; | ||||||
|  |                 } | ||||||
|  |  | ||||||
|  |                 bool val = (Data[srcByteIndx] & (1 << srcShiftIndx++)) != 0; | ||||||
|  |  | ||||||
|  |                 curByte |= (byte)((val ? 1 : 0) << destShiftIndx++); | ||||||
|  |                 if (srcShiftIndx == 8) | ||||||
|  |                 { | ||||||
|  |                     srcShiftIndx = 0; | ||||||
|  |                     srcByteIndx++; | ||||||
|  |                 } | ||||||
|  |                 if (destShiftIndx == 8) | ||||||
|  |                 { | ||||||
|  |                     toReturn[destByteIndx++] = curByte; | ||||||
|  |                     destShiftIndx = 0; | ||||||
|  |                     curByte = 0; | ||||||
|  |                 } | ||||||
|  |             } | ||||||
|  |  | ||||||
|  |             if (destByteIndx == toReturn.Length - 2) | ||||||
|  |                 toReturn[destByteIndx] = curByte; | ||||||
|  |  | ||||||
|  |             return toReturn; | ||||||
|  |         } | ||||||
|  |     } | ||||||
|  | } | ||||||
| @@ -10,7 +10,7 @@ | |||||||
|     <AppDesignerFolder>Properties</AppDesignerFolder> |     <AppDesignerFolder>Properties</AppDesignerFolder> | ||||||
|     <RootNamespace>Meteor.Common</RootNamespace> |     <RootNamespace>Meteor.Common</RootNamespace> | ||||||
|     <AssemblyName>Meteor.Common</AssemblyName> |     <AssemblyName>Meteor.Common</AssemblyName> | ||||||
|     <TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion> |     <TargetFrameworkVersion>v4.5.1</TargetFrameworkVersion> | ||||||
|     <FileAlignment>512</FileAlignment> |     <FileAlignment>512</FileAlignment> | ||||||
|     <TargetFrameworkProfile> |     <TargetFrameworkProfile> | ||||||
|     </TargetFrameworkProfile> |     </TargetFrameworkProfile> | ||||||
| @@ -59,49 +59,21 @@ | |||||||
|     <CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet> |     <CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet> | ||||||
|   </PropertyGroup> |   </PropertyGroup> | ||||||
|   <ItemGroup> |   <ItemGroup> | ||||||
|     <Reference Include="BouncyCastle.Crypto, Version=1.9.0.0, Culture=neutral, PublicKeyToken=0e99375e54769942, processorArchitecture=MSIL"> |  | ||||||
|       <HintPath>..\packages\Portable.BouncyCastle.1.9.0\lib\net40\BouncyCastle.Crypto.dll</HintPath> |  | ||||||
|     </Reference> |  | ||||||
|     <Reference Include="DotNetZip"> |     <Reference Include="DotNetZip"> | ||||||
|       <HintPath>..\packages\DotNetZip.1.10.1\lib\net20\DotNetZip.dll</HintPath> |       <HintPath>..\packages\DotNetZip.1.10.1\lib\net20\DotNetZip.dll</HintPath> | ||||||
|     </Reference> |     </Reference> | ||||||
|     <Reference Include="Google.Protobuf, Version=3.19.4.0, Culture=neutral, PublicKeyToken=a7d26565bac4d604, processorArchitecture=MSIL"> |     <Reference Include="MySql.Data, Version=6.9.8.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d, processorArchitecture=MSIL"> | ||||||
|       <HintPath>..\packages\Google.Protobuf.3.19.4\lib\net45\Google.Protobuf.dll</HintPath> |       <HintPath>..\packages\MySql.Data.6.9.8\lib\net45\MySql.Data.dll</HintPath> | ||||||
|     </Reference> |       <Private>True</Private> | ||||||
|     <Reference Include="K4os.Compression.LZ4, Version=1.2.6.0, Culture=neutral, PublicKeyToken=2186fa9121ef231d, processorArchitecture=MSIL"> |  | ||||||
|       <HintPath>..\packages\K4os.Compression.LZ4.1.2.6\lib\net46\K4os.Compression.LZ4.dll</HintPath> |  | ||||||
|     </Reference> |  | ||||||
|     <Reference Include="K4os.Compression.LZ4.Streams, Version=1.2.6.0, Culture=neutral, PublicKeyToken=2186fa9121ef231d, processorArchitecture=MSIL"> |  | ||||||
|       <HintPath>..\packages\K4os.Compression.LZ4.Streams.1.2.6\lib\net46\K4os.Compression.LZ4.Streams.dll</HintPath> |  | ||||||
|     </Reference> |  | ||||||
|     <Reference Include="K4os.Hash.xxHash, Version=1.0.6.0, Culture=neutral, PublicKeyToken=32cd54395057cec3, processorArchitecture=MSIL"> |  | ||||||
|       <HintPath>..\packages\K4os.Hash.xxHash.1.0.6\lib\net46\K4os.Hash.xxHash.dll</HintPath> |  | ||||||
|     </Reference> |  | ||||||
|     <Reference Include="MySql.Data, Version=8.0.31.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d, processorArchitecture=MSIL"> |  | ||||||
|       <HintPath>..\packages\MySql.Data.8.0.31\lib\net452\MySql.Data.dll</HintPath> |  | ||||||
|     </Reference> |     </Reference> | ||||||
|     <Reference Include="NLog, Version=4.0.0.0, Culture=neutral, PublicKeyToken=5120e14c03d0593c, processorArchitecture=MSIL"> |     <Reference Include="NLog, Version=4.0.0.0, Culture=neutral, PublicKeyToken=5120e14c03d0593c, processorArchitecture=MSIL"> | ||||||
|       <HintPath>..\packages\NLog.4.5.0\lib\net45\NLog.dll</HintPath> |       <HintPath>..\packages\NLog.4.5.0\lib\net45\NLog.dll</HintPath> | ||||||
|     </Reference> |     </Reference> | ||||||
|     <Reference Include="System" /> |     <Reference Include="System" /> | ||||||
|     <Reference Include="System.Buffers, Version=4.0.3.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL"> |  | ||||||
|       <HintPath>..\packages\System.Buffers.4.5.1\lib\net461\System.Buffers.dll</HintPath> |  | ||||||
|     </Reference> |  | ||||||
|     <Reference Include="System.Configuration" /> |     <Reference Include="System.Configuration" /> | ||||||
|     <Reference Include="System.Configuration.Install" /> |  | ||||||
|     <Reference Include="System.Core" /> |     <Reference Include="System.Core" /> | ||||||
|     <Reference Include="System.IO.Compression" /> |     <Reference Include="System.IO.Compression" /> | ||||||
|     <Reference Include="System.Management" /> |  | ||||||
|     <Reference Include="System.Memory, Version=4.0.1.1, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL"> |  | ||||||
|       <HintPath>..\packages\System.Memory.4.5.4\lib\net461\System.Memory.dll</HintPath> |  | ||||||
|     </Reference> |  | ||||||
|     <Reference Include="System.Numerics" /> |     <Reference Include="System.Numerics" /> | ||||||
|     <Reference Include="System.Numerics.Vectors, Version=4.1.4.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL"> |  | ||||||
|       <HintPath>..\packages\System.Numerics.Vectors.4.5.0\lib\net46\System.Numerics.Vectors.dll</HintPath> |  | ||||||
|     </Reference> |  | ||||||
|     <Reference Include="System.Runtime.CompilerServices.Unsafe, Version=5.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL"> |  | ||||||
|       <HintPath>..\packages\System.Runtime.CompilerServices.Unsafe.5.0.0\lib\net45\System.Runtime.CompilerServices.Unsafe.dll</HintPath> |  | ||||||
|     </Reference> |  | ||||||
|     <Reference Include="System.Runtime.Serialization" /> |     <Reference Include="System.Runtime.Serialization" /> | ||||||
|     <Reference Include="System.ServiceModel" /> |     <Reference Include="System.ServiceModel" /> | ||||||
|     <Reference Include="System.Transactions" /> |     <Reference Include="System.Transactions" /> | ||||||
| @@ -111,13 +83,11 @@ | |||||||
|     <Reference Include="System.Data" /> |     <Reference Include="System.Data" /> | ||||||
|     <Reference Include="System.Net.Http" /> |     <Reference Include="System.Net.Http" /> | ||||||
|     <Reference Include="System.Xml" /> |     <Reference Include="System.Xml" /> | ||||||
|     <Reference Include="ZstdNet, Version=1.4.5.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d, processorArchitecture=MSIL"> |  | ||||||
|       <HintPath>..\packages\MySql.Data.8.0.31\lib\net452\ZstdNet.dll</HintPath> |  | ||||||
|     </Reference> |  | ||||||
|   </ItemGroup> |   </ItemGroup> | ||||||
|   <ItemGroup> |   <ItemGroup> | ||||||
|     <Compile Include="BasePacket.cs" /> |     <Compile Include="BasePacket.cs" /> | ||||||
|     <Compile Include="Bitfield.cs" /> |     <Compile Include="Bitfield.cs" /> | ||||||
|  |     <Compile Include="Bitstream.cs" /> | ||||||
|     <Compile Include="Blowfish.cs" /> |     <Compile Include="Blowfish.cs" /> | ||||||
|     <Compile Include="EfficientHashTables.cs" /> |     <Compile Include="EfficientHashTables.cs" /> | ||||||
|     <Compile Include="Properties\AssemblyInfo.cs" /> |     <Compile Include="Properties\AssemblyInfo.cs" /> | ||||||
|   | |||||||
| @@ -245,7 +245,7 @@ namespace Meteor.Common | |||||||
|             { |             { | ||||||
|                 for (var bitCount = 0; bitCount < 8; bitCount++) |                 for (var bitCount = 0; bitCount < 8; bitCount++) | ||||||
|                 { |                 { | ||||||
|                     if (i + bitCount >= array.Length) |                     if (i + bitCount >= array.Length - 1) | ||||||
|                         break; |                         break; | ||||||
|                     data[dataCounter] = (byte)(((array[i + bitCount] ? 1 : 0) << 7 - bitCount) | data[dataCounter]); |                     data[dataCounter] = (byte)(((array[i + bitCount] ? 1 : 0) << 7 - bitCount) | data[dataCounter]); | ||||||
|                 } |                 } | ||||||
| @@ -255,6 +255,26 @@ namespace Meteor.Common | |||||||
|             return data; |             return data; | ||||||
|         } |         } | ||||||
|  |  | ||||||
|  |         public static bool[] ConvertBinaryStreamToBoolArray(byte[] bytes) | ||||||
|  |         { | ||||||
|  |             bool[] data = new bool[bytes.Length * 8]; | ||||||
|  |  | ||||||
|  |             int boolCounter = 0; | ||||||
|  |             for (int i = 0; i < bytes.Length; i ++) | ||||||
|  |             { | ||||||
|  |                 if (bytes[i] == 0) | ||||||
|  |                 { | ||||||
|  |                     boolCounter += 8; | ||||||
|  |                     continue; | ||||||
|  |                 } | ||||||
|  |  | ||||||
|  |                 for (int bitCount = 0; bitCount < 8; bitCount++) | ||||||
|  |                     data[boolCounter++] = (bytes[i] >> bitCount & 1) == 1;                 | ||||||
|  |             } | ||||||
|  |  | ||||||
|  |             return data; | ||||||
|  |         } | ||||||
|  |  | ||||||
|         public static string ToStringBase63(int number) |         public static string ToStringBase63(int number) | ||||||
|         { |         { | ||||||
|             var lookup = "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"; |             var lookup = "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"; | ||||||
| @@ -267,7 +287,20 @@ namespace Meteor.Common | |||||||
|  |  | ||||||
|         public static string ReadNullTermString(BinaryReader reader, int maxSize = 0x20) |         public static string ReadNullTermString(BinaryReader reader, int maxSize = 0x20) | ||||||
|         { |         { | ||||||
|             return Encoding.ASCII.GetString(reader.ReadBytes(maxSize)).Trim(new[] { '\0' }); |             long pos = reader.BaseStream.Position; | ||||||
|  |             int size = 0; | ||||||
|  |             for (int i = 0; i < maxSize; i++) | ||||||
|  |             { | ||||||
|  |                 if (reader.ReadByte() == 0) | ||||||
|  |                 { | ||||||
|  |                     size = i; | ||||||
|  |                     break; | ||||||
|  |                 } | ||||||
|  |             } | ||||||
|  |             reader.BaseStream.Seek(pos, SeekOrigin.Begin); | ||||||
|  |             string result =  Encoding.ASCII.GetString(reader.ReadBytes(size)); | ||||||
|  |             reader.BaseStream.Seek(pos + maxSize, SeekOrigin.Begin); | ||||||
|  |             return result; | ||||||
|         } |         } | ||||||
|  |  | ||||||
|         public static void WriteNullTermString(BinaryWriter writer, string value, int maxSize = 0x20) |         public static void WriteNullTermString(BinaryWriter writer, string value, int maxSize = 0x20) | ||||||
|   | |||||||
| @@ -1,13 +1,9 @@ | |||||||
| <?xml version="1.0" encoding="utf-8"?> | <?xml version="1.0" encoding="utf-8"?> | ||||||
| <configuration> | <configuration> | ||||||
|    |   <system.data> | ||||||
| <startup><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.7.2" /></startup> |     <DbProviderFactories> | ||||||
|   <runtime> |       <remove invariant="MySql.Data.MySqlClient"/> | ||||||
|     <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1"> |       <add name="MySQL Data Provider" invariant="MySql.Data.MySqlClient" description=".Net Framework Data Provider for MySQL" type="MySql.Data.MySqlClient.MySqlClientFactory, MySql.Data, Version=6.9.8.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d"/> | ||||||
|       <dependentAssembly> |     </DbProviderFactories> | ||||||
|         <assemblyIdentity name="System.Runtime.CompilerServices.Unsafe" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" /> |   </system.data> | ||||||
|         <bindingRedirect oldVersion="0.0.0.0-5.0.0.0" newVersion="5.0.0.0" /> | <startup><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5.1"/></startup></configuration> | ||||||
|       </dependentAssembly> |  | ||||||
|     </assemblyBinding> |  | ||||||
|   </runtime> |  | ||||||
| </configuration> |  | ||||||
|   | |||||||
| @@ -1,15 +1,6 @@ | |||||||
| <?xml version="1.0" encoding="utf-8"?> | <?xml version="1.0" encoding="utf-8"?> | ||||||
| <packages> | <packages> | ||||||
|   <package id="DotNetZip" version="1.10.1" targetFramework="net45" /> |   <package id="DotNetZip" version="1.10.1" targetFramework="net45" /> | ||||||
|   <package id="Google.Protobuf" version="3.19.4" targetFramework="net472" /> |   <package id="MySql.Data" version="6.9.8" targetFramework="net45" /> | ||||||
|   <package id="K4os.Compression.LZ4" version="1.2.6" targetFramework="net472" /> |  | ||||||
|   <package id="K4os.Compression.LZ4.Streams" version="1.2.6" targetFramework="net472" /> |  | ||||||
|   <package id="K4os.Hash.xxHash" version="1.0.6" targetFramework="net472" /> |  | ||||||
|   <package id="MySql.Data" version="8.0.31" targetFramework="net472" /> |  | ||||||
|   <package id="NLog" version="4.5.0" targetFramework="net451" /> |   <package id="NLog" version="4.5.0" targetFramework="net451" /> | ||||||
|   <package id="Portable.BouncyCastle" version="1.9.0" targetFramework="net472" /> |  | ||||||
|   <package id="System.Buffers" version="4.5.1" targetFramework="net472" /> |  | ||||||
|   <package id="System.Memory" version="4.5.4" targetFramework="net472" /> |  | ||||||
|   <package id="System.Numerics.Vectors" version="4.5.0" targetFramework="net472" /> |  | ||||||
|   <package id="System.Runtime.CompilerServices.Unsafe" version="5.0.0" targetFramework="net472" /> |  | ||||||
| </packages> | </packages> | ||||||
| @@ -1,110 +0,0 @@ | |||||||
| @ECHO OFF |  | ||||||
| REM SETLOCAL |  | ||||||
| SET CWD = %~dp0 |  | ||||||
|  |  | ||||||
| REM Echo Launch dir: "%~dp0" |  | ||||||
| REM Echo Current dir: "%CD%" |  | ||||||
|  |  | ||||||
| REM ============= |  | ||||||
| REM COPY LOBBY CONFIG |  | ||||||
| REM ============= |  | ||||||
| REM Required files: lobby_config.ini |  | ||||||
|  |  | ||||||
| SET /a foundlfolders = 0 |  | ||||||
|  |  | ||||||
| if exist "%~dp0\..\Lobby Server\bin\Debug" ( |  | ||||||
| SET /a foundlfolders = %foundlfolders% + 1 |  | ||||||
| echo Found Lobby Debug build folder.  |  | ||||||
|  |  | ||||||
| echo Copying lobby_config.ini if needed... |  | ||||||
| xcopy lobby_config.ini "%~dp0\..\Lobby Server\bin\Debug\" /d /y /q |  | ||||||
| )  |  | ||||||
|  |  | ||||||
| if exist "%~dp0\..\Lobby Server\bin\Release" ( |  | ||||||
| SET /a foundlfolders = %foundlfolders% + 1 |  | ||||||
| echo Found Lobby Release build folder.  |  | ||||||
|  |  | ||||||
| echo Copying lobby_config.ini if needed... |  | ||||||
| xcopy lobby_config.ini "%~dp0\..\Lobby Server\bin\Release\" /d /y /q |  | ||||||
| )  |  | ||||||
|  |  | ||||||
| if %foundlfolders% LSS 1 ( |  | ||||||
| echo Could not find debug or release folder for the Lobby server. Please compile the project first! |  | ||||||
| ) |  | ||||||
|  |  | ||||||
| REM ============= |  | ||||||
| REM COPY WORLD CONFIG |  | ||||||
| REM ============= |  | ||||||
| REM Required files: world_config.ini |  | ||||||
|  |  | ||||||
| SET /a foundwfolders = 0 |  | ||||||
|  |  | ||||||
| if exist "%~dp0\..\World Server\bin\Debug" ( |  | ||||||
| SET /a foundwfolders = %foundwfolders% + 1 |  | ||||||
| echo Found World Debug build folder.  |  | ||||||
|  |  | ||||||
| echo Copying world_config.ini if needed... |  | ||||||
| xcopy world_config.ini "%~dp0\..\World Server\bin\Debug\" /d /y /q |  | ||||||
| )  |  | ||||||
|  |  | ||||||
| if exist "%~dp0\..\World Server\bin\Release" ( |  | ||||||
| SET /a foundwfolders = %foundwfolders% + 1 |  | ||||||
| echo Found World Release build folder.  |  | ||||||
|  |  | ||||||
| echo Copying world_config.ini if needed... |  | ||||||
| xcopy world_config.ini "%~dp0\..\World Server\bin\Release\" /d /y /q |  | ||||||
| )  |  | ||||||
|  |  | ||||||
| if %foundwfolders% LSS 1 ( |  | ||||||
| echo Could not find debug or release folder for the World server. Please compile the project first! |  | ||||||
| ) |  | ||||||
|  |  | ||||||
| REM ============= |  | ||||||
| REM COPY MAP CONFIG |  | ||||||
| REM ============= |  | ||||||
| REM Required files: map_config.ini staticactors.bin scripts/ |  | ||||||
|  |  | ||||||
| SET /a foundmfolders = 0 |  | ||||||
|  |  | ||||||
| if exist "%~dp0\..\Map Server\bin\Debug" ( |  | ||||||
| SET /a foundmfolders = %foundmfolders% + 1 |  | ||||||
| echo Found Map Debug build folder.  |  | ||||||
|  |  | ||||||
| echo Copying map_config.ini if needed... |  | ||||||
| xcopy map_config.ini "%~dp0\..\Map Server\bin\Debug\" /d /y /q |  | ||||||
|  |  | ||||||
| if exist staticactors.bin ( |  | ||||||
| echo Copying staticactors.bin if needed... |  | ||||||
| xcopy staticactors.bin "%~dp0\..\Map Server\bin\Debug\" /d /y /q |  | ||||||
| ) else ( |  | ||||||
| echo Cannot copy the staticactors.bin file because it doesn't exist in data\ |  | ||||||
| ) |  | ||||||
|  |  | ||||||
|  |  | ||||||
| echo Copying scripts folder if needed... |  | ||||||
| xcopy scripts "%~dp0\..\Map Server\bin\Debug\scripts\" /e /d /y /s /q |  | ||||||
| )  |  | ||||||
|  |  | ||||||
| if exist "%~dp0\..\Map Server\bin\Release" ( |  | ||||||
| SET /a foundmfolders = %foundmfolders% + 1 |  | ||||||
| echo Found Map Release build folder.  |  | ||||||
|  |  | ||||||
| echo Copying map_config.ini if needed... |  | ||||||
| xcopy map_config.ini "%~dp0\..\Map Server\bin\Release\" /d /y /q |  | ||||||
|  |  | ||||||
| if exist staticactors.bin ( |  | ||||||
| echo Copying staticactors.bin if needed... |  | ||||||
| xcopy staticactors.bin "%~dp0\..\Map Server\bin\Release\" /d /y /q |  | ||||||
| ) else ( |  | ||||||
| echo Cannot copy the staticactors.bin file because it doesn't exist in data\ |  | ||||||
| ) |  | ||||||
|  |  | ||||||
| echo Copying scripts folder if needed... |  | ||||||
| xcopy scripts "%~dp0\..\Map Server\bin\Release\scripts\" /e /d /y /s /q |  | ||||||
| )  |  | ||||||
|  |  | ||||||
| if %foundmfolders% LSS 1 ( |  | ||||||
| echo Could not find debug or release folder for the Map server. Please compile the project first! |  | ||||||
| ) |  | ||||||
|  |  | ||||||
| Pause |  | ||||||
							
								
								
									
										19
									
								
								Data/scripts/base/chara/npc/debug/PopulaceMenuMan.lua
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										19
									
								
								Data/scripts/base/chara/npc/debug/PopulaceMenuMan.lua
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,19 @@ | |||||||
|  | --[[ | ||||||
|  |  | ||||||
|  | PopulaceMenuMan Script | ||||||
|  |  | ||||||
|  | Functions: | ||||||
|  |  | ||||||
|  | --]] | ||||||
|  |  | ||||||
|  | require ("global") | ||||||
|  |  | ||||||
|  | function init(npc) | ||||||
|  |     return false, false, 0, 0;   | ||||||
|  | end | ||||||
|  |  | ||||||
|  | function onEventStarted(player, npc, triggerName)     | ||||||
|  |     callClientFunction(player, "debugMenuEvent", player);  | ||||||
|  |     player:endEvent(); | ||||||
|  | end | ||||||
|  |  | ||||||
| @@ -0,0 +1,3 @@ | |||||||
|  | function init(npc) | ||||||
|  | 	return false, false, 0, 0, 0, 0;	 | ||||||
|  | end | ||||||
							
								
								
									
										9
									
								
								Data/scripts/base/chara/npc/mapobj/MapObjShipPort.lua
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										9
									
								
								Data/scripts/base/chara/npc/mapobj/MapObjShipPort.lua
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,9 @@ | |||||||
|  | require("global"); | ||||||
|  |  | ||||||
|  | function init(npc) | ||||||
|  | 	return false, false, 0, 0;	 | ||||||
|  | end | ||||||
|  |  | ||||||
|  | function onEventStarted(player, npc, eventType, eventName)     | ||||||
|  | 	player:EndEvent(); | ||||||
|  | end | ||||||
| @@ -1,5 +1,5 @@ | |||||||
| require ("global") | require ("global") | ||||||
| 
 | 
 | ||||||
| function init(npc) | function init(npc) | ||||||
| 	return false, false, 0, 0, 5143, 326; | 	return false, false, 0, 0, 0, 0;	 | ||||||
| end | end | ||||||
| @@ -1,5 +1,19 @@ | |||||||
| require ("global") | require ("global") | ||||||
|  |  | ||||||
|  | --[[ | ||||||
|  |  | ||||||
|  | BgKeepout Script | ||||||
|  |  | ||||||
|  | Used to send a msg to the player that they cannot proceed passed this point. Invisible walls are | ||||||
|  | linked to this object. | ||||||
|  |  | ||||||
|  | ]] | ||||||
|  |  | ||||||
| function init(npc) | function init(npc) | ||||||
| 	return false, false, 0, 0;	 | 	return false, false, 0, 0;	 | ||||||
| end | end | ||||||
|  |  | ||||||
|  | function onEventStarted(player, npc, triggerName) | ||||||
|  | 	player:SendGameMessage(player, GetWorldMaster(), 60001, 0x20); | ||||||
|  | 	player:EndEvent(); | ||||||
|  | end | ||||||
|   | |||||||
| @@ -1,5 +1,95 @@ | |||||||
| require ("global") | require ("global") | ||||||
|  |  | ||||||
| function init(npc) | --[[ | ||||||
| 	return false, false, 0, 0;	 |  | ||||||
|  | Elevator Standard Script | ||||||
|  |  | ||||||
|  | Functions:  | ||||||
|  |  | ||||||
|  | elevatorAskLimsa001(eventNum) - Shows the ask dialog, and plays the event cutscenes for the Crow's Head Lift Lvl 1. | ||||||
|  | elevatorAskLimsa002(eventNum) - Shows the ask dialog, and plays the event cutscenes for the Crow's Head Lift Lvl 2. | ||||||
|  | elevatorAskLimsa003(eventNum) - Shows the ask dialog, and plays the event cutscenes for the Crow's Head Lift Lvl 3. | ||||||
|  | elevatorAskUldah001(eventNum) - Shows the ask dialog, and plays the event cutscenes for the Wellhead Lift Lvl 1. | ||||||
|  | elevatorAskUldah002(eventNum) - Shows the ask dialog, and plays the event cutscenes for the Wellhead Lift Lvl 2. | ||||||
|  | elevatorAskUldah003(eventNum) - Shows the ask dialog, and plays the event cutscenes for the Wellhead Lift Lvl 3. | ||||||
|  | elevatorQuestAskEvent(questId) - Special quest related elevator dialog. | ||||||
|  |  | ||||||
|  | Notes: | ||||||
|  |  | ||||||
|  | Script to control the elevators in Limsa Lominsa and Ul'dah. Each elevator entrance has a specific event for it's floor. | ||||||
|  | The only param is used to either show the ask dialog to the player or player the appropriate cutscene given the choice  | ||||||
|  | made. | ||||||
|  |  | ||||||
|  | --]] | ||||||
|  |  | ||||||
|  | function onEventStarted(player, npc, eventType, eventName) | ||||||
|  | 	local actorClassId = npc.GetActorClassId(); | ||||||
|  | 	 | ||||||
|  | 	-- Limsa; Crow's Lift Level 1 | ||||||
|  | 	if (actorClassId == 1290007) then | ||||||
|  | 		local floorChoice = callClientFunction(player, "elevatorAskLimsa001", 0);	 | ||||||
|  | 		if (floorChoice == 1) then | ||||||
|  | 			callClientFunction(player, "elevatorAskLimsa001", 1); | ||||||
|  | 			endEventAndWarp(player, 133, -447, 40, 220, -1.574);	 | ||||||
|  | 		elseif (floorChoice == 2) then | ||||||
|  | 			callClientFunction(player, "elevatorAskLimsa001", 2);	 | ||||||
|  | 			endEventAndWarp(player, 133, -458, 92, 175, -0.383);	 | ||||||
|  | 		end | ||||||
|  | 	-- Limsa; Crow's Lift Level 2 | ||||||
|  | 	elseif (actorClassId == 1290008) then | ||||||
|  | 		local floorChoice = callClientFunction(player, "elevatorAskLimsa002", 0);	 | ||||||
|  | 		if (floorChoice == 1) then | ||||||
|  | 			callClientFunction(player, "elevatorAskLimsa002", 1);		 | ||||||
|  | 			endEventAndWarp(player, 133, -447, 19, 220, -1.574); | ||||||
|  | 		elseif (floorChoice == 2) then | ||||||
|  | 			callClientFunction(player, "elevatorAskLimsa002", 2);			 | ||||||
|  | 			endEventAndWarp(player, 133, -458, 92, 175, -0.383);	 | ||||||
|  | 		end | ||||||
|  | 	-- Limsa; Crow's Lift Level 3 | ||||||
|  | 	elseif (actorClassId == 1290009) then | ||||||
|  | 		local floorChoice = callClientFunction(player, "elevatorAskLimsa003", 0);	 | ||||||
|  | 		if (floorChoice == 1) then | ||||||
|  | 			callClientFunction(player, "elevatorAskLimsa003", 1); | ||||||
|  | 			endEventAndWarp(player, 133, -447, 19, 220, -1.574); | ||||||
|  | 		elseif (floorChoice == 2) then | ||||||
|  | 			callClientFunction(player, "elevatorAskLimsa003", 2); | ||||||
|  | 			endEventAndWarp(player, 133, -447, 40, 220, -1.574); | ||||||
|  | 		end | ||||||
|  | 	-- Ul'dah; Wellhead Lift Level 1 | ||||||
|  | 	elseif (actorClassId == 1090460) then | ||||||
|  | 		local floorChoice = callClientFunction(player, "elevatorAskUldah001", 0); | ||||||
|  | 		if (floorChoice == 1) then | ||||||
|  | 			callClientFunction(player, "elevatorAskUldah001", 1); | ||||||
|  | 			endEventAndWarp(player, 209, -116.78, 222, 115.7, 2.85); | ||||||
|  | 		elseif (floorChoice == 2) then | ||||||
|  | 			callClientFunction(player, "elevatorAskUldah001", 2); | ||||||
|  | 			endEventAndWarp(player, 209, -121.60, 269.8, 135.28, -0.268); | ||||||
|  | 		end | ||||||
|  | 	-- Ul'dah; Wellhead Lift Level 2 | ||||||
|  | 	elseif (actorClassId == 1090461) then | ||||||
|  | 		local floorChoice = callClientFunction(player, "elevatorAskUldah002", 0);	 | ||||||
|  | 		if (floorChoice == 1) then | ||||||
|  | 			callClientFunction(player, "elevatorAskUldah002", 1); | ||||||
|  | 			endEventAndWarp(player, 175, -116.78, 198, 115.7, -2.8911); | ||||||
|  | 		elseif (floorChoice == 2) then | ||||||
|  | 			callClientFunction(player, "elevatorAskUldah002", 2); | ||||||
|  | 			endEventAndWarp(player, 209, -121.60, 269.8, 135.28, -0.268); | ||||||
|  | 		end | ||||||
|  | 	-- Ul'dah; Wellhead Lift Level 3 | ||||||
|  | 	elseif (actorClassId == 1090462) then | ||||||
|  | 		local floorChoice = callClientFunction(player, "elevatorAskUldah003", 0);	 | ||||||
|  | 		if (floorChoice == 1) then | ||||||
|  | 			callClientFunction(player, "elevatorAskUldah003", 1);		 | ||||||
|  | 			endEventAndWarp(player, 175, -116.78, 198, 115.7, -2.8911); | ||||||
|  | 		elseif (floorChoice == 2) then | ||||||
|  | 			callClientFunction(player, "elevatorAskUldah003", 2); | ||||||
|  | 			endEventAndWarp(player, 209, -116.78, 222, 115.7, 2.85); | ||||||
|  | 		end | ||||||
|  | 	end | ||||||
|  | 	 | ||||||
|  | end | ||||||
|  |  | ||||||
|  | function endEventAndWarp(player, zoneId, x, y, z, rotation) | ||||||
|  | 	player:EndEvent(); | ||||||
|  | 	GetWorldManager():DoZoneChange(player, zoneId, nil, 0, 15, x, y, z, rotation); | ||||||
| end | end | ||||||
| @@ -82,15 +82,12 @@ city = { | |||||||
|     [1500394] = 3, -- Ul'dah    : Edine |     [1500394] = 3, -- Ul'dah    : Edine | ||||||
| } | } | ||||||
|  |  | ||||||
|  | function onEventStarted(player, npc, eventType, eventName)	 | ||||||
|  |  | ||||||
| function onEventStarted(player, npc, triggerName)	 |  | ||||||
|  |  | ||||||
|     local npcCity = city[npc:GetActorClassId()] or 1; |     local npcCity = city[npc:GetActorClassId()] or 1; | ||||||
|     local wardPlaceName = CITY_INFO[npcCity][1];        -- Market Wards category name. Identical in all languages except Japanese |     local marketPlaceName = CITY_INFO[npcCity][1];        -- Market Wards category name. Identical in all languages except Japanese | ||||||
|     local exitPlaceName = CITY_INFO[npcCity][2];        -- Central Limsa Lominsa / Heartstream / The Fronds |     local exitPlaceName = CITY_INFO[npcCity][2];        -- Central Limsa Lominsa / Heartstream / The Fronds | ||||||
|     local gcHQPlaceName = CITY_INFO[npcCity][3];        -- Maelstrom Command / Adders' Nest / Hall of Flames |     local gcHQPlaceName = CITY_INFO[npcCity][3];        -- Maelstrom Command / Adders' Nest / Hall of Flames | ||||||
|     local questAreaName = 0; --CITY_INFO[npcCity][4];   -- Sailors Ward / Peasants Ward / Merchants Ward |     local questPlaceName = CITY_INFO[npcCity][4];   		-- Sailors Ward / Peasants Ward / Merchants Ward | ||||||
|     local wardListStart = CITY_INFO[npcCity][5];        -- Starting id for the market wards |     local wardListStart = CITY_INFO[npcCity][5];        -- Starting id for the market wards | ||||||
|     local wardListCount = CITY_INFO[npcCity][6];        -- Amount of wards in the list |     local wardListCount = CITY_INFO[npcCity][6];        -- Amount of wards in the list | ||||||
|     local showItemSearchCounter = false; |     local showItemSearchCounter = false; | ||||||
| @@ -98,19 +95,30 @@ function onEventStarted(player, npc, triggerName) | |||||||
|      |      | ||||||
|     local worldMaster = GetWorldMaster();  |     local worldMaster = GetWorldMaster();  | ||||||
|     local pos = player:GetPos(); |     local pos = player:GetPos(); | ||||||
|     local currZone = pos[4]; |     local currZone = pos[5]; | ||||||
|  | 	local currRegion = player.CurrentArea.RegionId;	 | ||||||
|  | 	local quests = player:GetQuestsForNpc(npc); | ||||||
|      |      | ||||||
|     if (currZone == 133 or currZone == 230 or currZone == 155 or currZone == 206 or currZone == 175 or currZone == 209) then  | 	-- City entrance specific stuff | ||||||
|  |     if (currRegion == 101 or currRegion == 103 or currRegion == 104) then  | ||||||
|         exitPlaceName = 0;  -- If in city, hide city menu option |         exitPlaceName = 0;  -- If in city, hide city menu option | ||||||
|     elseif (currZone == 232 or currZone == 234 or currZone == 233) then  | 		 | ||||||
|         gcHQPlaceName = 0;  -- If in GC Office, hide office menu option | 		-- If no quests attached to this entrence, don't show quest area | ||||||
|  | 		if (#quests == 0) then | ||||||
|  | 			questPlaceName = 0; | ||||||
|  | 		end | ||||||
|     end |     end | ||||||
| 	 | 	 | ||||||
|     choice = callClientFunction(player, "eventPushChoiceAreaOrQuest", exitPlaceName, wardPlaceName, gcHQPlaceName, questAreaName, showItemSearchCounter, itemSearchId); | 	-- If in GC Office, hide office menu option | ||||||
|  | 	if (currZone == 232 or currZone == 234 or currZone == 233) then  | ||||||
|  |         gcHQPlaceName = 0;   | ||||||
|  |     end | ||||||
|  |  | ||||||
|  |     choice = callClientFunction(player, "eventPushChoiceAreaOrQuest", exitPlaceName, marketPlaceName, gcHQPlaceName, questPlaceName, showItemSearchCounter, itemSearchId); | ||||||
|          |          | ||||||
|     while (true) do |     while (true) do | ||||||
|          |          | ||||||
|         if choice == wardPlaceName then -- Market Wards |         if choice == marketPlaceName then -- Market Wards | ||||||
|             wardSelect = callClientFunction(player, "eventPushStepPrvMarket", wardListStart, wardListCount, 0); |             wardSelect = callClientFunction(player, "eventPushStepPrvMarket", wardListStart, wardListCount, 0); | ||||||
|              |              | ||||||
|             if wardSelect and (wardSelect >= wardListStart and wardSelect <= (wardListStart+wardListCount)) then |             if wardSelect and (wardSelect >= wardListStart and wardSelect <= (wardListStart+wardListCount)) then | ||||||
| @@ -139,11 +147,14 @@ function onEventStarted(player, npc, triggerName) | |||||||
|                 wait(1); |                 wait(1); | ||||||
|                 GetWorldManager():DoZoneChange(player, warp[1], nil, 0, 0x02, warp[2], warp[3], warp[4], warp[5]);           |                 GetWorldManager():DoZoneChange(player, warp[1], nil, 0, 0x02, warp[2], warp[3], warp[4], warp[5]);           | ||||||
|                 break; |                 break; | ||||||
|  | 		elseif (choice == 2095 or choice == 3095) then -- Quest | ||||||
|  | 			quests[1]:OnPush(player, npc, eventName); | ||||||
|  | 			return; | ||||||
|         elseif (choice == 0 or choice == -3) then -- Menu Closed |         elseif (choice == 0 or choice == -3) then -- Menu Closed | ||||||
|             break;   |             break;   | ||||||
|         end  |         end  | ||||||
|          |          | ||||||
|         choice = callClientFunction(player, "eventPushChoiceAreaOrQuest", exitPlaceName, wardPlaceName, gcHQPlaceName, questAreaName, showItemSearchCounter, itemSearchId); |         choice = callClientFunction(player, "eventPushChoiceAreaOrQuest", exitPlaceName, marketPlaceName, gcHQPlaceName, questAreaName, showItemSearchCounter, itemSearchId); | ||||||
|            |            | ||||||
|     end |     end | ||||||
|      |      | ||||||
|   | |||||||
| @@ -1,23 +1,63 @@ | |||||||
| require ("global") | require ("global") | ||||||
|  |  | ||||||
|  | DREAM_ITEM = { | ||||||
|  | 	{[1] = 3010419, [2] = 3010420, [3] = 3010421}, -- Mizzenmast/Roost/Hourglass Biscuit | ||||||
|  | 	3010003, -- Boiled Egg | ||||||
|  | 	3010101, -- Grilled Carp | ||||||
|  | 	3010001, -- Meat Miq'abob | ||||||
|  | 	3010402, -- Ginger Cookie | ||||||
|  | 	3020001, -- Potion | ||||||
|  | 	3020101, -- Ether | ||||||
|  | 	1000003, -- 5x Crystal Shards (Fire) | ||||||
|  | 	1000004, -- 5x Crystal Shards (Ice) | ||||||
|  | 	1000005, -- 5x Crystal Shards (Wind) | ||||||
|  | 	1000006, -- 5x Crystal Shards (Earth) | ||||||
|  | 	1000007, -- 5x Crystal Shards (Lightning) | ||||||
|  | 	1000008  -- 5x Crystal Shards (Water) | ||||||
|  | } | ||||||
|  |  | ||||||
| function init(npc) | function init(npc) | ||||||
| 	return false, false, 0, 0;	 | 	return false, false, 0, 0;	 | ||||||
| end | end | ||||||
|  |  | ||||||
| function onEventStarted(player, npc, triggerName) | function onEventStarted(player, npc, triggerName) | ||||||
|  | 	local choice = callClientFunction(player, "askLogout", player); | ||||||
| 	 | 	 | ||||||
| 	choice = callClientFunction(player, "askLogout", player); | 	-- Quit | ||||||
| 	 |  | ||||||
| 	if (choice == 2) then | 	if (choice == 2) then | ||||||
| 		player:SetSleeping(); | 		player:SetSleeping(); | ||||||
| 		player:QuitGame(); | 		player:QuitGame(); | ||||||
|  | 	-- Logout | ||||||
| 	elseif (choice == 3) then | 	elseif (choice == 3) then | ||||||
| 		player:SetSleeping(); | 		player:SetSleeping(); | ||||||
| 		player:Logout(); | 		player:Logout(); | ||||||
|  | 	-- Heck the bed | ||||||
| 	elseif (choice == 4) then | 	elseif (choice == 4) then | ||||||
| 		player:SendMessage(33, "", "Heck the bed"); | 		-- Give items based on dream | ||||||
|  | 		local dreamCode = player:GetLoginDreamCode();		 | ||||||
|  | 		if (dreamCode >= 21 and dreamCode <= 33) then | ||||||
|  | 			local innCode = player:GetInnCode(); | ||||||
|  | 			local itemCode = DREAM_ITEM[dreamCode - 20]; | ||||||
|  | 			 | ||||||
|  | 			-- Get biscuit for inn | ||||||
|  | 			if (dreamCode == 21) then | ||||||
|  | 				itemCode = itemCode[innCode]; | ||||||
|  | 			end | ||||||
|  | 			 | ||||||
|  | 			-- If crystals you get x5 otherwise x1. | ||||||
|  | 			if (dreamCode > = 28 and dreamCode <= 33) then | ||||||
|  | 				player:AddItem(itemCode, 5); | ||||||
|  | 			else | ||||||
|  | 				player:AddItem(itemCode, 1); | ||||||
|  | 			end | ||||||
|  | 			 | ||||||
|  | 			-- Clear the code so they player doesn't keep getting things | ||||||
|  | 			player:SetLoginDreamCode(0); | ||||||
|  | 		else | ||||||
|  | 			-- Otherwise show standard message | ||||||
|  | 			player:SendGameMessage(player, npc, 7, 0x20); | ||||||
|  | 		end | ||||||
| 	end | 	end | ||||||
| 	 | 	 | ||||||
| 	player:EndEvent(); | 	player:EndEvent(); | ||||||
| 	 |  | ||||||
| end | end | ||||||
| @@ -15,10 +15,37 @@ function init(npc) | |||||||
| end | end | ||||||
|  |  | ||||||
| function onEventStarted(player, npc, triggerName)	 | function onEventStarted(player, npc, triggerName)	 | ||||||
| 	choice = callClientFunction(player, "eventDoorMoveAsk"); | 	local choice = callClientFunction(player, "eventDoorMoveAsk"); | ||||||
| 	 | 	 | ||||||
| 	if (choice == 1) then | 	if (choice == 1) then | ||||||
|  | 		local activeQuests = player:GetQuestsForNpc(npc); | ||||||
|  | 		-- Either let the player choose the quest or start it if it's the only one. | ||||||
|  | 		local chosenQuest; | ||||||
|  | 		if (#activeQuests > 1) then | ||||||
|  | 			local currentPage = 0; | ||||||
|  | 			local numPages = math.floor((#activeQuests-1)/4) + 1; | ||||||
| 			 | 			 | ||||||
|  | 			while (true) do | ||||||
|  | 				local page, index = callClientFunction(player, "switchEvent", activeQuests[currentPage * 4 + 1], activeQuests[currentPage * 4 + 2], possibleQuests[currentPage * 4 + 3], possibleQuests[currentPage * 4 + 4], currentPage + 1, numPages, 0x3F1); | ||||||
|  | 				 | ||||||
|  | 				if (page == 0) then | ||||||
|  | 					chosenQuest = activeQuests[(currentPage * 4) + index]; | ||||||
|  | 					break; | ||||||
|  | 				elseif (page > 0) then | ||||||
|  | 					currentPage = page - 1; | ||||||
|  | 				else | ||||||
|  | 					player:EndEvent(); | ||||||
|  | 					return; | ||||||
|  | 				end | ||||||
|  | 			end			 | ||||||
|  | 		elseif (#activeQuests == 1) then | ||||||
|  | 			chosenQuest = activeQuests[1]; | ||||||
|  | 		end | ||||||
|  | 		 | ||||||
|  | 		if (chosenQuest ~= nil) then | ||||||
|  | 			chosenQuest:OnPush(player, npc, eventName);		 | ||||||
|  | 			return; | ||||||
|  | 		end | ||||||
| 	end | 	end | ||||||
| 	 | 	 | ||||||
| 	player:EndEvent();	 | 	player:EndEvent();	 | ||||||
|   | |||||||
| @@ -4,7 +4,7 @@ function init(npc) | |||||||
| 	return false, false, 0, 0;	 | 	return false, false, 0, 0;	 | ||||||
| end | end | ||||||
|  |  | ||||||
| function onEventStarted(player, npc, triggerName) | function onEventStarted(player, npc, eventType, eventName) | ||||||
| 	defaultFst = GetStaticActor("DftFst"); | 	defaultFst = GetStaticActor("DftFst"); | ||||||
| 	choice = callClientFunction(player, "delegateEvent", player, defaultFst, "defaultTalkWithInn_ExitDoor", nil, nil, nil); | 	choice = callClientFunction(player, "delegateEvent", player, defaultFst, "defaultTalkWithInn_ExitDoor", nil, nil, nil); | ||||||
| 	 | 	 | ||||||
|   | |||||||
| @@ -1,3 +1,5 @@ | |||||||
|  | require("global"); | ||||||
|  |  | ||||||
| function init(npc) | function init(npc) | ||||||
| 	return false, false, 0, 0;	 | 	return false, false, 0, 0;	 | ||||||
| end | end | ||||||
| @@ -7,7 +9,7 @@ function onEventStarted(player, npc, triggerName) | |||||||
| 		worldMaster = GetWorldMaster(); | 		worldMaster = GetWorldMaster(); | ||||||
| 		player:SendGameMessage(player, worldMaster, 34109, 0x20); | 		player:SendGameMessage(player, worldMaster, 34109, 0x20); | ||||||
| 	elseif (triggerName == "exit") then | 	elseif (triggerName == "exit") then | ||||||
| 		GetWorldManager():DoPlayerMoveInZone(player, 5); | 		GetWorldManager():DoPlayerMoveInZone(player, 356.09, 3.74, -701.62, -1.4); | ||||||
| 	end | 	end | ||||||
| 	player:EndEvent(); | 	player:EndEvent(); | ||||||
| end | end | ||||||
							
								
								
									
										18
									
								
								Data/scripts/base/chara/npc/object/OpeningStoperW0B1.lua
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										18
									
								
								Data/scripts/base/chara/npc/object/OpeningStoperW0B1.lua
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,18 @@ | |||||||
|  | require("global"); | ||||||
|  |  | ||||||
|  | function init(npc) | ||||||
|  | 	return false, false, 0, 0;	 | ||||||
|  | end | ||||||
|  |  | ||||||
|  | function onEventStarted(player, npc, eventType, eventName) | ||||||
|  |  | ||||||
|  |     if (eventType == ETYPE_PUSH) then | ||||||
|  |         if (eventName == "caution") then | ||||||
|  |             worldMaster = GetWorldMaster(); | ||||||
|  |             player:SendGameMessage(player, worldMaster, 34109, 0x20); | ||||||
|  |         elseif (eventName == "exit") then | ||||||
|  |             GetWorldManager():DoPlayerMoveInZone(player, 5.36433, 196, 133.656, -2.84938); | ||||||
|  |         end | ||||||
|  |     end | ||||||
|  | 	player:EndEvent(); | ||||||
|  | end | ||||||
							
								
								
									
										9
									
								
								Data/scripts/base/chara/npc/object/OpeningTown.lua
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										9
									
								
								Data/scripts/base/chara/npc/object/OpeningTown.lua
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,9 @@ | |||||||
|  | require("global"); | ||||||
|  |  | ||||||
|  | function init(npc) | ||||||
|  | 	return false, false, 0, 0;	 | ||||||
|  | end | ||||||
|  |  | ||||||
|  | function onEventStarted(player, npc, eventType, eventName)     | ||||||
|  | 	player:EndEvent(); | ||||||
|  | end | ||||||
| @@ -0,0 +1,9 @@ | |||||||
|  | require("global"); | ||||||
|  |  | ||||||
|  | function init(npc) | ||||||
|  | 	return false, false, 0, 0;	 | ||||||
|  | end | ||||||
|  |  | ||||||
|  | function onEventStarted(player, npc, eventType, eventName) | ||||||
|  | 	player:EndEvent(); | ||||||
|  | end | ||||||
| @@ -1,12 +1,37 @@ | |||||||
| function init(npc) | require("global"); | ||||||
|  |  | ||||||
|  | --[[ | ||||||
|  |  | ||||||
|  | PrivateAreaPastExit | ||||||
|  |  | ||||||
|  | This object contains the player inside a PrivateAreaPast, stopping them from escaping it's bounds. It is the | ||||||
|  | object that generates the circle graphic on the minimap. This object always has two push triggers, an inner | ||||||
|  | and outer inverted circle. The inner one is named "caution" and the outer one is named "exit". When the player | ||||||
|  | leaves the inner circle a warning is shown and when they leave the outer circle they either leave the instance | ||||||
|  | or get warped back to the center. | ||||||
|  |  | ||||||
|  | ]] | ||||||
|  |  | ||||||
|  | function init(privAreaExit) | ||||||
| 	return false, false, 0, 0;	 | 	return false, false, 0, 0;	 | ||||||
| end | end | ||||||
|  |  | ||||||
| function onEventStarted(player, npc, triggerName) | function onEventStarted(player, privAreaExit, eventType, eventName) | ||||||
| 	if (triggerName == "caution") then |  | ||||||
| 		worldMaster = GetWorldMaster(); |  | ||||||
| 		player:SendGameMessage(player, worldMaster, 34109, 0x20); |  | ||||||
| 	elseif (triggerName == "exit") then		 |  | ||||||
| 	end |  | ||||||
| 	player:EndEvent(); | 	player:EndEvent(); | ||||||
|  | 	 | ||||||
|  | 	if (eventName == "caution") then | ||||||
|  | 		player:SendGameMessage(player, GetWorldMaster(), 34109, MESSAGE_TYPE_SYSTEM); -- You are about to leave the instance. | ||||||
|  | 	elseif (eventName == "exit") then | ||||||
|  | 		local area = privAreaExit.CurrentArea; | ||||||
|  | 		if (area.IsPrivate()) then | ||||||
|  | 			-- If you can leave, warp to public zone and show message. | ||||||
|  | 			if (area.CanExitPrivateArea()) then | ||||||
|  | 				player:SendGameMessage(player, GetWorldMaster(), 34110, MESSAGE_TYPE_SYSTEM); -- You have left the instance. | ||||||
|  | 				--GetWorldManager():WarpToPublicArea(player); | ||||||
|  | 			-- Otherwise warp back to the center of the zone. | ||||||
|  | 			else | ||||||
|  | 				--GetWorldManager():WarpToCharaPosition(player, privAreaExit); | ||||||
|  | 			end | ||||||
|  | 		end | ||||||
|  | 	end | ||||||
| end | end | ||||||
| @@ -1,18 +1,107 @@ | |||||||
|  | --[[ | ||||||
|  |  | ||||||
|  | TaskBoard | ||||||
|  |  | ||||||
|  | Operates the Task Board actor located in each of the Adventurers' Guilds. | ||||||
|  | Calls from the Noc000 static actor, which also applies to specific guild NPCs involved in that as well. | ||||||
|  |  | ||||||
|  | Functions:  (only including those from Noc000 which apply to the Task Board) | ||||||
|  |  | ||||||
|  | pETaskBoardAskLimsa() | ||||||
|  |     Desc: Show guild menu with valid options for Limsa Lominsa. | ||||||
|  |     Params: None | ||||||
|  |     Returns: Value dictating which item on the list was selected. | ||||||
|  |  | ||||||
|  | pETaskBoardAskUldah() | ||||||
|  |     Desc: Show guild menu with valid options for Ul'dah. | ||||||
|  |     Params: None | ||||||
|  |     Returns: Value dictating which item on the list was selected. | ||||||
|  |  | ||||||
|  | pETaskBoardAskGridania() | ||||||
|  |     Desc: Show guild menu with valid options for Gridania. | ||||||
|  |     Params: None | ||||||
|  |     Returns: Value dictating which item on the list was selected. | ||||||
|  |  | ||||||
|  | pETaskBoardGuild(guildId) | ||||||
|  |     Desc: Plays back a message "The following tasks are available:". | ||||||
|  |     Params: * guildId 			- Class Id from xtx_text_jobName.  EN doesn't make use of it, but JP/DE/FR do.  Thanks Koji. | ||||||
|  |      | ||||||
|  | pETaskBoardOrder(recommendedLvl itemId, hq, amount) | ||||||
|  |     Desc: Takes the params and tells the player what the guild still needs turned in. | ||||||
|  |     Params: * recommendedLvl 	- Recommended level the player be at | ||||||
|  |             * itemId  			- Id of the item from xtx_itemName | ||||||
|  |             * hq     			- Quality of item (1 = NQ, 2 = +1, 3 = +2 4 = +3) | ||||||
|  |             * amount 			- Amount needed (The amount the player needs to turn-in, not the amount guild needs overall) | ||||||
|  |  | ||||||
|  | --]] | ||||||
|  |  | ||||||
| require ("global") | require ("global") | ||||||
|  |  | ||||||
|  | local guildItem = {  | ||||||
|  |     -- [guildId] = { (recommendedLvl itemId, hq, amount, 2nd-recommendedLvl 2nd-itemId, 2nd-hq, 2nd-amount) } | ||||||
|  |     [29] = {1, 4100604, 1, 1, 10, 4030706, 1, 1}, -- Carpenters' | ||||||
|  |     [30] = {1, 4040004, 1, 1, 10, 4030004, 1, 1}, -- Blacksmiths' | ||||||
|  |     [31] = {1, 6080009, 1, 1, 10, 8070606, 1, 1}, -- Armorers' | ||||||
|  |     [32] = {1, 5020007, 1, 1, 10,10004103, 1, 1}, -- Goldsmiths' | ||||||
|  |     [33] = {1, 4020107, 1, 1, 10, 8031514, 1, 1}, -- Leatherworkers' | ||||||
|  |     [34] = {1, 8030819, 1, 1, 10, 8030821, 1, 1}, -- Weavers' | ||||||
|  |     [35] = {1, 3011530, 1,12, 10, 3020527, 1, 4}, -- Alchemists' | ||||||
|  |     [36] = {1, 3010103, 1, 6, 10, 3011503, 1, 6}, -- Culinarians' | ||||||
|  |     [39] = {1,10009101, 1,10, 10,10001116, 1,10}, -- Miners' | ||||||
|  |     [40] = {1,10005403, 1,10, 10,10008106, 1,10}, -- Botanists' | ||||||
|  |     [41] = {1, 3011106, 1,10, 10, 3011113, 1,10}  -- Fishermans'  | ||||||
|  | } | ||||||
|  |  | ||||||
|  | local menuToGuild = {          -- Get a guild id from a given task board's Return result | ||||||
|  |     [1] = {0, 30, 31, 36, 41}, -- Limsa | ||||||
|  |     [2] = {0, 29, 33, 40,  0}, -- Gridania | ||||||
|  |     [3] = {0, 32, 34, 35, 39}  -- Ul'dah | ||||||
|  | } | ||||||
|  |  | ||||||
| function init(npc) | function init(npc) | ||||||
|     return false, false, 0, 0;   |     return false, false, 0, 0;   | ||||||
| end | end | ||||||
|  |  | ||||||
| function onEventStarted(player, npc, triggerName) | function onEventStarted(player, npc, triggerName) | ||||||
| 	questNOC = GetStaticActor("Noc000"); |  | ||||||
|      |      | ||||||
| 	if (npc:GetActorClassId() == 1200193) then |     local questNOC = GetStaticActor("Noc000"); | ||||||
| 		callClientFunction(player, "delegateEvent", player, questNOC, "pETaskBoardAskLimsa", nil, nil, nil); |     local npcId = npc:GetActorClassId(); | ||||||
| 	elseif (npc:GetActorClassId() == 1200194) then |      | ||||||
| 		callClientFunction(player, "delegateEvent", player, questNOC, "pETaskBoardAskUldah", nil, nil, nil); |     while (true) do	 | ||||||
|  | 		local guildId = 0; | ||||||
|  | 	 | ||||||
|  |         if (npcId == 1200193) then -- Limsa | ||||||
|  |             local choice = callClientFunction(player, "delegateEvent", player, questNOC, "pETaskBoardAskLimsa"); | ||||||
|  |              | ||||||
|  |             if (choice == 1 or choice == nil) then | ||||||
|  |                 break; -- Exited menu | ||||||
|             else |             else | ||||||
| 		callClientFunction(player, "delegateEvent", player, questNOC, "pETaskBoardAskGridania", nil, nil, nil); |                 guildId = menuToGuild[1][choice]; | ||||||
|  |             end             | ||||||
|  |         elseif (npcId == 1200194) then -- Ul'dah    | ||||||
|  |             local choice = callClientFunction(player, "delegateEvent", player, questNOC, "pETaskBoardAskUldah"); | ||||||
|  |              | ||||||
|  |             if (choice == 1 or choice == nil) then | ||||||
|  |                 break; -- Exited menu | ||||||
|  |             else | ||||||
|  |                 guildId = menuToGuild[3][choice];  | ||||||
|  |             end         | ||||||
|  |         else -- Gridania | ||||||
|  |             local choice = callClientFunction(player, "delegateEvent", player, questNOC, "pETaskBoardAskGridania"); | ||||||
|  |                      | ||||||
|  |             if (choice == 1 or choice == nil) then | ||||||
|  |                 break; -- Exited menu | ||||||
|  |             else | ||||||
|  |                 guildId = menuToGuild[2][choice];  | ||||||
|  |             end    | ||||||
|  |         end  | ||||||
|  |                  | ||||||
|  |         if (guildId > 0) then | ||||||
|  |             callClientFunction(player, "delegateEvent", player, questNOC, "pETaskBoardGuild", guildId); | ||||||
|  |             local gItem = guildItem[guildId] | ||||||
|  |             callClientFunction(player, "delegateEvent", player, questNOC, "pETaskBoardOrder", unpack(gItem, 1, 4)); | ||||||
|  |             callClientFunction(player, "delegateEvent", player, questNOC, "pETaskBoardOrder", unpack(gItem, 5, 8));    | ||||||
|  |         end | ||||||
|     end |     end | ||||||
|      |      | ||||||
|     player:EndEvent();   |     player:EndEvent();   | ||||||
|   | |||||||
| @@ -107,7 +107,7 @@ function doLevequestInit(player, aetheryte) | |||||||
| 			 | 			 | ||||||
| 				player:SendGameMessage(worldMaster, 50036, 0x20, glId, player); | 				player:SendGameMessage(worldMaster, 50036, 0x20, glId, player); | ||||||
| 				player:PlayAnimation(getGLStartAnimationFromSheet(guildleveData.borderId, guildleveData.plateId, true));				 | 				player:PlayAnimation(getGLStartAnimationFromSheet(guildleveData.borderId, guildleveData.plateId, true));				 | ||||||
| 				director = player:GetZone():CreateGuildleveDirector(glId, difficulty, player); | 				director = player.CurrentArea:CreateGuildleveDirector(glId, difficulty, player); | ||||||
| 				player:AddDirector(director); | 				player:AddDirector(director); | ||||||
| 				director:StartDirector(true, glId) | 				director:StartDirector(true, glId) | ||||||
| 			 | 			 | ||||||
|   | |||||||
| @@ -33,6 +33,30 @@ end | |||||||
|  |  | ||||||
| function onEventStarted(player, aetheryte, triggerName) | function onEventStarted(player, aetheryte, triggerName) | ||||||
| 	 | 	 | ||||||
|  | 	-- Main Scenario Intro Quests | ||||||
|  | 	if (player:HasQuest(110002) == true) then | ||||||
|  | 		require ("quests/man/man0l1"); | ||||||
|  | 		local quest = player:GetQuest("Man0l1"); | ||||||
|  | 		if (quest:GetSequence() == SEQ_003) then			 | ||||||
|  | 			callClientFunction(player, "delegateEvent", player, quest, "processEvent025"); | ||||||
|  | 			quest:StartSequence(SEQ_005); | ||||||
|  | 		end | ||||||
|  | 	elseif (player:HasQuest(110006) == true) then | ||||||
|  | 		require ("quests/man/man0g1"); | ||||||
|  | 		local quest = player:GetQuest("Man0g1"); | ||||||
|  | 		if (quest:GetSequence() == SEQ_005) then			 | ||||||
|  | 			callClientFunction(player, "delegateEvent", player, quest, "processEvent013"); | ||||||
|  | 			--quest:StartSequence(???); | ||||||
|  | 		end | ||||||
|  | 	elseif (player:HasQuest(110010) == true) then | ||||||
|  | 		require ("quests/man/man0u1"); | ||||||
|  | 		local quest = player:GetQuest("Man0u1"); | ||||||
|  | 		if (quest:GetSequence() == SEQ_005) then			 | ||||||
|  | 			callClientFunction(player, "delegateEvent", player, quest, "processEvent013"); | ||||||
|  | 			quest:StartSequence(SEQ_010); | ||||||
|  | 		end | ||||||
|  | 	end | ||||||
|  | 	 | ||||||
| 	if (player:GetGuildleveDirector() ~= nil) then | 	if (player:GetGuildleveDirector() ~= nil) then | ||||||
| 		doGuildleveMenu(player, aetheryte); | 		doGuildleveMenu(player, aetheryte); | ||||||
| 	else | 	else | ||||||
| @@ -142,7 +166,7 @@ function doLevequestInit(player, aetheryte) | |||||||
| 							 | 							 | ||||||
| 				player:SendGameMessage(worldMaster, 50036, 0x20, glId, player); | 				player:SendGameMessage(worldMaster, 50036, 0x20, glId, player); | ||||||
| 				player:PlayAnimation(getGLStartAnimationFromSheet(guildleveData.borderId, guildleveData.plateId, true));				 | 				player:PlayAnimation(getGLStartAnimationFromSheet(guildleveData.borderId, guildleveData.plateId, true));				 | ||||||
| 				director = player:GetZone():CreateGuildleveDirector(glId, difficulty, player); | 				director = player.CurrentArea:CreateGuildleveDirector(glId, difficulty, player); | ||||||
| 				player:AddDirector(director); | 				player:AddDirector(director); | ||||||
| 				director:StartDirector(true, glId); | 				director:StartDirector(true, glId); | ||||||
| 				 | 				 | ||||||
|   | |||||||
| @@ -61,7 +61,7 @@ function onEventStarted(player, npc, triggerName) | |||||||
|     local killCount = 50; |     local killCount = 50; | ||||||
|     callClientFunction(player, "caravanGuardOffer", areaName, areaName2, playerGC); |     callClientFunction(player, "caravanGuardOffer", areaName, areaName2, playerGC); | ||||||
|     --callClientFunction(player, "caravanGuardReward", cargo, nil, areaName, playerGC, killCount, areaName2);    |     --callClientFunction(player, "caravanGuardReward", cargo, nil, areaName, playerGC, killCount, areaName2);    | ||||||
|     --player:SendGameMessageDisplayIDSender(npc, 6, MESSAGE_TYPE_SAY, npc.displayNameId); |     --player:SendGameMessageLocalizedDisplayName(npc, 6, MESSAGE_TYPE_SAY, npc.displayNameId); | ||||||
|      |      | ||||||
|      |      | ||||||
| 	player:EndEvent(); | 	player:EndEvent(); | ||||||
|   | |||||||
| @@ -28,7 +28,8 @@ local rentalTime = 10; | |||||||
| local gcIssuances = { | local gcIssuances = { | ||||||
| 	[1500006] = 2001004, | 	[1500006] = 2001004, | ||||||
| 	[1500061] = 2001005, | 	[1500061] = 2001005, | ||||||
| 	[1000840] = 2001006 | 	[1000840] = 2001006, | ||||||
|  | 	[1500059] = 0 | ||||||
| }; | }; | ||||||
|  |  | ||||||
| local startAppearances = { | local startAppearances = { | ||||||
| @@ -40,7 +41,8 @@ local startAppearances = { | |||||||
| local cityExits = { | local cityExits = { | ||||||
| 	[1500006] = {133, -6.032, 46.356, 132.572, 3.034}, | 	[1500006] = {133, -6.032, 46.356, 132.572, 3.034}, | ||||||
| 	[1500061] = {150, 333.271, 5.889, -943.275, 0.794}, | 	[1500061] = {150, 333.271, 5.889, -943.275, 0.794}, | ||||||
| 	[1000840] = {170, -26.088, 181.846, -79.438, 2.579} | 	[1000840] = {170, -26.088, 181.846, -79.438, 2.579}, | ||||||
|  |     [1500059] = {172, -2133.028, 15.476, -421.471, 1.5} | ||||||
| }; | }; | ||||||
|  |  | ||||||
| function init(npc) | function init(npc) | ||||||
| @@ -48,8 +50,9 @@ function init(npc) | |||||||
| end | end | ||||||
|  |  | ||||||
| function onEventStarted(player, npc, triggerName)	 | function onEventStarted(player, npc, triggerName)	 | ||||||
|  |     local classId = npc:GetActorClassId(); | ||||||
| 	local curLevel = 20; -- TODO: pull from character | 	local curLevel = 20; -- TODO: pull from character | ||||||
| 	local hasIssuance = player:GetItemPackage(INVENTORY_KEYITEMS):HasItem(gcIssuances[npc:GetActorClassId()]); | 	local hasIssuance = player:GetItemPackage(INVENTORY_KEYITEMS):HasItem(gcIssuances[classId]); | ||||||
| 	local hasChocobo = player.hasChocobo; | 	local hasChocobo = player.hasChocobo; | ||||||
| 	 | 	 | ||||||
| 	if (hasChocobo == false) then -- Let GMs auto have the issuance for debugging  | 	if (hasChocobo == false) then -- Let GMs auto have the issuance for debugging  | ||||||
| @@ -58,6 +61,19 @@ function onEventStarted(player, npc, triggerName) | |||||||
|  |  | ||||||
| 	local hasFunds = (player:GetCurrentGil() >= rentalPrice); | 	local hasFunds = (player:GetCurrentGil() >= rentalPrice); | ||||||
|      |      | ||||||
|  |      | ||||||
|  |      | ||||||
|  |     if ((classId == 1000840) and (player:HasQuest(110009))) then -- Cross-script Man0u0 dialog | ||||||
|  |         local sequence = player:GetQuest(110009):getSequence(); | ||||||
|  |          | ||||||
|  |         if (sequence == 0) then | ||||||
|  |             callClientFunction(player, "delegateEvent", player, GetStaticActor("Man0u0"), "processEvent000_13");  | ||||||
|  |         elseif (sequence == 10) then | ||||||
|  |             callClientFunction(player, "delegateEvent", player, GetStaticActor("Man0u0"), "processEvent020_7");  | ||||||
|  |         else | ||||||
|  |             player:EndEvent(); | ||||||
|  |         end | ||||||
|  |     else | ||||||
|         callClientFunction(player, "eventTalkWelcome", player); |         callClientFunction(player, "eventTalkWelcome", player); | ||||||
|          |          | ||||||
|         local menuChoice = callClientFunction(player, "eventAskMainMenu", player, curLevel, hasFunds, hasIssuance, hasChocobo, hasChocobo, 0); |         local menuChoice = callClientFunction(player, "eventAskMainMenu", player, curLevel, hasFunds, hasIssuance, hasChocobo, hasChocobo, 0); | ||||||
| @@ -73,7 +89,7 @@ function onEventStarted(player, npc, triggerName) | |||||||
|                 player:EndEvent(); |                 player:EndEvent(); | ||||||
|                 return; |                 return; | ||||||
|             else		 |             else		 | ||||||
| 			local appearance = startAppearances[npc:GetActorClassId()];			 |                 local appearance = startAppearances[classId];			 | ||||||
|                 player:IssueChocobo(appearance, nameResponse); |                 player:IssueChocobo(appearance, nameResponse); | ||||||
|                  |                  | ||||||
|                 callClientFunction(player, "eventAfterChocoboName", player);			 |                 callClientFunction(player, "eventAfterChocoboName", player);			 | ||||||
| @@ -82,24 +98,25 @@ function onEventStarted(player, npc, triggerName) | |||||||
|                 if (player:GetItemPackage(INVENTORY_KEYITEMS):HasItem(2001007) == false) then |                 if (player:GetItemPackage(INVENTORY_KEYITEMS):HasItem(2001007) == false) then | ||||||
|                     player:GetItemPackage(INVENTORY_KEYITEMS):AddItem(2001007); |                     player:GetItemPackage(INVENTORY_KEYITEMS):AddItem(2001007); | ||||||
|                 end |                 end | ||||||
| 			player:GetItemPackage(INVENTORY_KEYITEMS):RemoveItem(gcIssuances[npc:GetActorClassId()], 1); |                 player:GetItemPackage(INVENTORY_KEYITEMS):RemoveItem(gcIssuances[classId], 1); | ||||||
|                  |                  | ||||||
|                 --Warp with the special chocobo warp mode. |                 --Warp with the special chocobo warp mode. | ||||||
|                 mountChocobo(player);			 |                 mountChocobo(player);			 | ||||||
| 			GetWorldManager():DoZoneChange(player, cityExits[npc:GetActorClassId()][1], nil, 0, SPAWN_CHOCOBO_GET, cityExits[npc:GetActorClassId()][2], cityExits[npc:GetActorClassId()][3], cityExits[npc:GetActorClassId()][4], cityExits[npc:GetActorClassId()][5]);		 |                 GetWorldManager():DoZoneChange(player, cityExits[classId][1], nil, 0, SPAWN_CHOCOBO_GET, cityExits[classId][2], cityExits[classId][3], cityExits[classId][4], cityExits[classId][5]);		 | ||||||
|             end |             end | ||||||
|                      |                      | ||||||
|         elseif(menuChoice == 2) then -- Summon Bird |         elseif(menuChoice == 2) then -- Summon Bird | ||||||
|             mountChocobo(player); |             mountChocobo(player); | ||||||
| 		GetWorldManager():DoZoneChange(player, cityExits[npc:GetActorClassId()][1], nil, 0, SPAWN_NO_ANIM, cityExits[npc:GetActorClassId()][2], cityExits[npc:GetActorClassId()][3], cityExits[npc:GetActorClassId()][4], cityExits[npc:GetActorClassId()][5]);		 |             GetWorldManager():DoZoneChange(player, cityExits[classId][1], nil, 0, SPAWN_NO_ANIM, cityExits[classId][2], cityExits[classId][3], cityExits[classId][4], cityExits[classId][5]);		 | ||||||
|         elseif(menuChoice == 3) then -- Change Barding |         elseif(menuChoice == 3) then -- Change Barding | ||||||
|             callClientFunction(player, "eventTalkStepBreak", player); |             callClientFunction(player, "eventTalkStepBreak", player); | ||||||
|         elseif(menuChoice == 5) then -- Rent Bird |         elseif(menuChoice == 5) then -- Rent Bird | ||||||
| 		mountChocobo(player, true, 1); |             mountChocobo(player, true, 10); | ||||||
| 		GetWorldManager():DoZoneChange(player, cityExits[npc:GetActorClassId()][1], nil, 0, SPAWN_CHOCOBO_RENTAL, cityExits[npc:GetActorClassId()][2], cityExits[npc:GetActorClassId()][3], cityExits[npc:GetActorClassId()][4], cityExits[npc:GetActorClassId()][5]); |             GetWorldManager():DoZoneChange(player, cityExits[classId][1], nil, 0, SPAWN_CHOCOBO_RENTAL, cityExits[classId][2], cityExits[classId][3], cityExits[classId][4], cityExits[classId][5]); | ||||||
|         else |         else | ||||||
|             callClientFunction(player, "eventTalkStepBreak", player); |             callClientFunction(player, "eventTalkStepBreak", player); | ||||||
|         end |         end | ||||||
|  |     end | ||||||
|      |      | ||||||
| 	player:EndEvent(); | 	player:EndEvent(); | ||||||
| end | end | ||||||
| @@ -114,6 +131,6 @@ function mountChocobo(player, isRental, rentalMinutes) | |||||||
| 	 | 	 | ||||||
| 	player:SendMountAppearance(); | 	player:SendMountAppearance(); | ||||||
| 	player:SetMountState(1); | 	player:SetMountState(1); | ||||||
| 	player:ChangeSpeed(0.0, 5.0, 10.0, 10.0); | 	player:ChangeSpeed(0.0, 3.6, 9.0, 9.0); | ||||||
| 	player:ChangeState(15);	 | 	player:ChangeState(15);	 | ||||||
| end | end | ||||||
| @@ -7,7 +7,7 @@ Functions: | |||||||
| eventTalkWelcome(player)        - Start Text | eventTalkWelcome(player)        - Start Text | ||||||
| eventAskMainMenu(player, index) - Shows teleport menu, hides the teleport location at index value to prevent warping to the spot you're at | eventAskMainMenu(player, index) - Shows teleport menu, hides the teleport location at index value to prevent warping to the spot you're at | ||||||
| eventAfterWarpOtherZone(player) - Fades out for warp | eventAfterWarpOtherZone(player) - Fades out for warp | ||||||
| eventTalkStepBreak() - Ends talk | eventTalkStepBreak()            - Holds the client up for whatever reason? | ||||||
| --]] | --]] | ||||||
|  |  | ||||||
| require ("global") | require ("global") | ||||||
| @@ -82,39 +82,50 @@ function onEventStarted(player, npc, triggerName) | |||||||
|     npcId = npc:GetActorClassId(); |     npcId = npc:GetActorClassId(); | ||||||
|     city = warpNpc[npcId][2]; |     city = warpNpc[npcId][2]; | ||||||
|      |      | ||||||
|      |     if (city == 1) then | ||||||
|     if city == 1 then |  | ||||||
|         if player:GetItemPackage(INVENTORY_KEYITEMS):HasItem(passLimsa) then |         if player:GetItemPackage(INVENTORY_KEYITEMS):HasItem(passLimsa) then | ||||||
|             passCheck = 1; |             passCheck = 1; | ||||||
|         else |         else | ||||||
|             if passCheck == 0 then callClientFunction(player, "eventTalkWelcome", player); end |             if (passCheck == 0) then callClientFunction(player, "eventTalkWelcome", player); end | ||||||
|         end; |         end; | ||||||
|     elseif city == 2 then |     elseif (city == 2) then | ||||||
|         if player:GetItemPackage(INVENTORY_KEYITEMS):HasItem(passGrid) then |       --  if player:GetItemPackage(INVENTORY_KEYITEMS):HasItem(passGrid) then | ||||||
|  |             passCheck = 1; | ||||||
|  |        -- else | ||||||
|  |          --  if passCheck == 0 then callClientFunction(player, "eventTalkWelcome", player); end | ||||||
|  |         --end; | ||||||
|  |     elseif (city == 3) then | ||||||
|  |         if (player:GetItemPackage(INVENTORY_KEYITEMS):HasItem(passUldah)) then | ||||||
|             passCheck = 1; |             passCheck = 1; | ||||||
|         else |         else | ||||||
|            if passCheck == 0 then callClientFunction(player, "eventTalkWelcome", player); end |             if (passCheck == 0) then callClientFunction(player, "eventTalkWelcome", player); end | ||||||
|         end; |  | ||||||
|     elseif city == 3 then |  | ||||||
|         if player:GetItemPackage(INVENTORY_KEYITEMS):HasItem(passUldah) then |  | ||||||
|             passCheck = 1; |  | ||||||
|         else |  | ||||||
|             if passCheck == 0 then callClientFunction(player, "eventTalkWelcome", player); end |  | ||||||
|         end |         end | ||||||
|     end |     end | ||||||
|      |      | ||||||
|     if passCheck == 1 then |      | ||||||
|  |     if (passCheck == 1) then | ||||||
|         choice = callClientFunction(player, "eventAskMainMenu", player, warpNpc[npcId][1]); |         choice = callClientFunction(player, "eventAskMainMenu", player, warpNpc[npcId][1]); | ||||||
|      |      | ||||||
|         if choice == 0 then |          | ||||||
|             --callClientFunction(player, "playereventTalkStepBreak"); |         if (choice ~= 0) then | ||||||
|  |              | ||||||
|  |              | ||||||
|  |             | ||||||
|  |            callClientFunction(player, "eventAfterWarpOtherZone", player); | ||||||
|  |            wait(1); | ||||||
|            player:EndEvent(); |            player:EndEvent(); | ||||||
|  |             local player_zone = player:GetPos()[5]; | ||||||
|  |             spawnType = 0x0A; | ||||||
|  |             if (player_zone == aethernet[city][choice].zone) then | ||||||
|  |                  | ||||||
|  |                 GetWorldManager():DoPlayerMoveInZone(player, aethernet[city][choice].x, aethernet[city][choice].y, aethernet[city][choice].z, aethernet[city][choice].r, spawnType);     | ||||||
|  |             else | ||||||
|  |                 GetWorldManager():DoZoneChange(player, aethernet[city][choice].zone, nil, 0, spawnType, aethernet[city][choice].x, aethernet[city][choice].y, aethernet[city][choice].z, aethernet[city][choice].r);     | ||||||
|  |             end; | ||||||
|         else |         else | ||||||
|          --   callClientFunction(player, "eventAfterWarpOtherZone", player);   -- Commented out for now to prevent double fade-to-black for warp |  | ||||||
|             player:EndEvent(); |             player:EndEvent(); | ||||||
|            GetWorldManager():DoZoneChange(player, aethernet[city][choice].zone, nil, 0, 15, aethernet[city][choice].x, aethernet[city][choice].y, aethernet[city][choice].z, aethernet[city][choice].r);     |  | ||||||
|         end |         end | ||||||
|     end |     end | ||||||
|      |      | ||||||
|     player:EndEvent(); |      | ||||||
| end | end | ||||||
|   | |||||||
| @@ -18,7 +18,51 @@ end | |||||||
|  |  | ||||||
| function onEventStarted(player, npc, triggerName) | function onEventStarted(player, npc, triggerName) | ||||||
| 	 | 	 | ||||||
|  | 	-- Special case for A Slippery Stone and Cutthroat Prices | ||||||
|  | 	if (player:HasQuest(110737) == true) then | ||||||
|  | 		require ("quests/etc/etc3g3"); | ||||||
|  | 		local quest = player:GetQuest("Etc3g3"); | ||||||
|  | 		if (quest:GetSequence() == SEQ_000) then			 | ||||||
|  | 			local choice = callClientFunction(player, "delegateEvent", player, quest, "processEvent_005"); | ||||||
|  | 			if (choice == 1) then | ||||||
|  | 				quest:StartSequence(SEQ_001); | ||||||
|  | 				addPlayerToAirship(player, 2); | ||||||
|  | 			end						 | ||||||
|  | 			player:EndEvent(); | ||||||
|  | 			return; | ||||||
|  | 		end | ||||||
|  | 	elseif (player:HasQuest(110728) == true) then | ||||||
|  | 		require ("quests/etc/etc3u3"); | ||||||
|  | 		local quest = player:GetQuest("Etc3u3"); | ||||||
|  | 		if (quest:GetSequence() == SEQ_000) then			 | ||||||
|  | 			local choice = callClientFunction(player, "delegateEvent", player, quest, "processEvent_005"); | ||||||
|  | 			if (choice == 1) then | ||||||
|  | 				quest:StartSequence(SEQ_001); | ||||||
|  | 				addPlayerToAirship(player, 3); | ||||||
|  | 			end						 | ||||||
|  | 			player:EndEvent(); | ||||||
|  | 			return; | ||||||
|  | 		end | ||||||
|  | 	end | ||||||
|  | 	 | ||||||
|  | 	-- Otherwise normal operation | ||||||
| 	callClientFunction(player, "eventIn", player, false, nil, 5); | 	callClientFunction(player, "eventIn", player, false, nil, 5); | ||||||
| 	 | 	 | ||||||
| 	player:EndEvent(); | 	player:EndEvent(); | ||||||
| end | end | ||||||
|  |  | ||||||
|  | function addPlayerToAirship(player, city) | ||||||
|  | 	if (city == 1) then | ||||||
|  | 		-- Limsa Airship | ||||||
|  | 		GetWorldManager():WarpToPosition(player, -764.519, -3.146, 384.154, 1.575); | ||||||
|  | 		--GetWorldManager():AddPlayerToShipList(player, 2); | ||||||
|  | 	elseif (city == 2) then | ||||||
|  | 		-- Gridania Airship | ||||||
|  | 		GetWorldManager():WarpToPosition(player, 54.47, -7, -1198.54, -0.02); | ||||||
|  | 		--GetWorldManager():AddPlayerToShipList(player, 3); | ||||||
|  | 	elseif (city == 3) then | ||||||
|  | 		-- Ul'dah Airship | ||||||
|  | 		GetWorldManager():WarpToPosition(player, -126.580, 271.2, 156.435, -1.35); | ||||||
|  | 		--GetWorldManager():AddPlayerToShipList(player, 4); | ||||||
|  | 	end | ||||||
|  | end | ||||||
| @@ -1,38 +1,381 @@ | |||||||
| --[[ | --[[ | ||||||
|  |  | ||||||
| PopulacePassiveGLPublisher Script | PopulacePassiveGLPublisher | ||||||
|  |  | ||||||
|  | Operates the Local Levequest selection menus. | ||||||
|  |  | ||||||
| Functions: | Functions: | ||||||
|  |  | ||||||
| askOfferPack() - Show Classes | askOfferPack(player)  | ||||||
| askOfferRank() - Show Ranks |     Desc: Show class selection menu. | ||||||
| askOfferQuest(player) |     Params: * player		- The player actor. | ||||||
| confirmOffer(nil, questId) |     Returns: Value dictating which item on the list was selected (1-8 for class, nil if exited/canceled) | ||||||
| confirmMaxOffer() |  | ||||||
| talkOfferWelcome(actor, leveAllowances) | askOfferRank(player) | ||||||
|  |     Desc: Show Level selection menu. | ||||||
|  |     Params: * player		- The player actor. | ||||||
|  |     Returns: Value dictating which item on the list was selected (1 = Lv01, 2 = Lv20, 3 = Lv40, nil if exited/canceled) | ||||||
|  |  | ||||||
|  | askOfferQuest(player, ?, questId1, questId2, questId3, questId4, questId5, questId6, questId7, questId8) | ||||||
|  |     Desc: Show Leve quest selection menu with up to 8 questId entries | ||||||
|  |     Params: * player		- The player actor. | ||||||
|  | 			* ?				- Unused param. Capture has a 2. | ||||||
|  | 			* questId 1-8	- The local levequests available up to 8 quests. | ||||||
|  |     Returns: 1 through 8 for an accepted leve in the order sent, -1 for hitting "Return", and Nil for "Cancel" | ||||||
|  |      | ||||||
|  | confirmOffer(player, questId) | ||||||
|  |     Desc: Opens prompt asking whether to activate the leve and begin it. | ||||||
|  |     Params: * player		- The player actor. | ||||||
|  | 			* questId		- The quest being confirmed. | ||||||
|  |     Returns: Boolean - True on Yes, false on No or hitting escape. | ||||||
|  |  | ||||||
|  | confirmMaxOffer(player) | ||||||
|  |     Desc: Opens ask widget stating you'll be capped on leves after accepting. | ||||||
|  |     Params: * player		- The player actor. Unused. | ||||||
|  |     Returns: Boolean - True on Accept, false on "Quit" or hitting escape. | ||||||
|  |      | ||||||
|  | talkOfferWelcome(player, numAllowance) | ||||||
|  |     Desc: NPC intro dialog as well as stating your available leve allowances. | ||||||
|  |     Params: * player		- The player actor. | ||||||
|  | 			* numAllowance	- The number of leve allowances the player still has. | ||||||
|  |  | ||||||
| talkOfferDecide() | talkOfferDecide() | ||||||
|  |     Desc: Makes the NPC say dialog following the acceptance of a leve. | ||||||
|  |     Params: None | ||||||
|  |   | ||||||
| talkOfferMaxOver() | talkOfferMaxOver() | ||||||
| selectDiscardGuildleve(player) |     Desc: Makes the NPC say dialog stating the player is carrying too many leves currently. | ||||||
| confirmJournal() |     Params: None | ||||||
| askDiscardGuildleve() | 	     | ||||||
| confirmDiscardGuildleve(nil, questId) |  | ||||||
| askRetryRegionalleve(questId, leveAllowances) |  | ||||||
| finishTalkTurn() | finishTalkTurn() | ||||||
|  | 	Desc: Ends the npc actor's turn towards you. Call this at the end of the script or the  | ||||||
|  | 		  npc will be stuck "facing" the player. | ||||||
|  | 	Params: None | ||||||
|  |      | ||||||
|  | selectDiscardGuildleve() | ||||||
|  |     Desc: Opens the Journal widget to select a leve to discard. This is a follow-up to askDiscardGuildleve(). | ||||||
|  |     Params: None | ||||||
|  |     Returns: Quest Actor | ||||||
|  |      | ||||||
|  | confirmJournal(questId, difficulty, unused, itemsCompleted, remainingMats, hasMaterials, unused) | ||||||
|  |     Desc: Opens askJournalDetailWidget displaying current status of the leve. | ||||||
|  |     Params: * questId		- The current quest being confirmed. | ||||||
|  | 			* difficulty	- The difficulty of the quest. | ||||||
|  | 			* unused		- Unused param. | ||||||
|  | 			* itemsComplete	- Sets the number of items crafted. | ||||||
|  | 			* remainingMats	- Sets the remaining materials. | ||||||
|  | 			* hasMaterials	- If set to 1, shows the progress section. | ||||||
|  | 			* unused		- While loaded into widget, it doesn't do anything with this journalType (13). | ||||||
|  |     Returns: True on "Exchange", Nil on "Return" or hitting Escape key   | ||||||
|  |  | ||||||
|  | askDiscardGuildleve() | ||||||
|  |     Desc: Opens an ask widget, stating the player cannot accept any more guildleves and if they'd want to return one to make room. | ||||||
|  |     Params: None | ||||||
|  |     Returns: Boolean | ||||||
|  |  | ||||||
|  | confirmDiscardGuildleve(?, questId, guildleveId) | ||||||
|  |     Desc: Opens an ask widget, confirming the returning of the selected guildleve. | ||||||
|  |     Params: * ?				- Most likely a player actor, but unused. | ||||||
|  | 			* questId		- The dialog is "Returning <quest>. Are you certain?". This is the questId being returned. | ||||||
|  | 			* guildleveId	- This is mostly unused, Japanese localization has a weird switch to use this. Can be nil. | ||||||
|  |     Returns: Boolean | ||||||
|  |      | ||||||
|  | askRetryRegionalleve(questId, numAllowance)  | ||||||
|  |     Desc: Opens an ask widget to re-attempt leve questId while showing leveAllowances.  If no is selected, a second widget appears to confirm abandoning it.  | ||||||
|  |     Params: * questId		- The questId being retried. | ||||||
|  | 			* numAllowance	- The number of leve allowances the player still has. | ||||||
|  |     Returns: Menu1 -  Is 1 if yes is selected, 2 if no.  Nil if Escape is hit (resend function in this case?) | ||||||
|  |              Menu2 -  Is 1 if yes is selected (leve abandoned), 2 if no.  Nil if Menu1 isn't set to 2 | ||||||
|  | 			  | ||||||
|  | Notes: | ||||||
|  |  | ||||||
|  | 50141 - You have <num> leve allowances remaining. | ||||||
|  | 50142 - You have run out of leve allowances. You cannot accept any more levequests at this time. | ||||||
|  | 50143 - You cannot accept any more levequests at this time. | ||||||
|  |  | ||||||
|  | Local Leves: | ||||||
|  |  | ||||||
|  | ~~Limsa~~ | ||||||
|  |  | ||||||
|  | CRP: Baderon's New Counter (120007) | ||||||
|  | 	 The Mad Fisher (120017) | ||||||
|  | 	 Building Bridges (120039) | ||||||
|  | 	 High Stakes (120047) | ||||||
|  | 	 Training and Trees (120061) | ||||||
|  |  | ||||||
|  | BSM: Baderon's New Sword (120005) | ||||||
|  | 	 Got Ingots (120013) | ||||||
|  | 	 Ship Shape (120014) | ||||||
|  | 	 A Want of Weapons (120015) | ||||||
|  | 	 Skull Valley Delivery (120035) | ||||||
|  | 	 Fruit's of a Vintner's Whinings (120043) | ||||||
|  | 	 Premiums Paid (120051) | ||||||
|  | 	 Training and Trading (120059) | ||||||
|  | 	 Waiting on Weapons (120067) | ||||||
|  | 	  | ||||||
|  | ARM: Baderon's New Barbuts (120009) | ||||||
|  | 	 Seeing Sallets to the See (120019) | ||||||
|  | 	 A Step Ahead (120020) | ||||||
|  | 	 Mailed Sailors (120021) | ||||||
|  | 	 Running Rings (120036) | ||||||
|  | 	 Watching the Shore (120044) | ||||||
|  | 	 Watching the Knoll (120052) | ||||||
|  | 	 Rings Around the Rock (120063) | ||||||
|  | 	 Dead Ringers (120068) | ||||||
|  | 	  | ||||||
|  | GSM: Baderon's New Bands (120010) | ||||||
|  | 	 2 x 2 Eyes (120022) | ||||||
|  | 	 Going Brandanas (120041) | ||||||
|  | 	 Brand New Brands (120049) | ||||||
|  | 	 Staves to Fashion (120064) | ||||||
|  | 	  | ||||||
|  | LTW: Baderon's New Shoes (120008) | ||||||
|  | 	 The Mad Tanner (120018) | ||||||
|  | 	 Under Foot (120040) | ||||||
|  | 	 Shoeing the Shore (120048) | ||||||
|  | 	 Training and Tanning (120062) | ||||||
|  | 	  | ||||||
|  |  | ||||||
|  | WVR: Baderon's New Clothes (120006) | ||||||
|  | 	 The Mad Hatter (120016) | ||||||
|  | 	 Wear and Tear (120038) | ||||||
|  | 	 Outfitting the Shore (120046) | ||||||
|  | 	 Training and Tailoring (120060) | ||||||
|  | 	  | ||||||
|  | ALC: Baderon's New Soles (120011) | ||||||
|  | 	 A Sticky Situation (120023) | ||||||
|  | 	 Feeding Trainees (120042) | ||||||
|  | 	 Suffering Soldiers (120050) | ||||||
|  | 	 Training and Eating (120065) | ||||||
|  |  | ||||||
|  |  | ||||||
|  | CUL: Baderon's New Breakfast (120012) | ||||||
|  | 	 Tall, Cool One (120024) | ||||||
|  | 	 The Captain's Cravings (120025) | ||||||
|  | 	 A Feast Fit for an Admiral (120026) | ||||||
|  | 	 Supper at the Skull (120037) | ||||||
|  | 	 The Last Supper (120045) | ||||||
|  | 	 A Meal to Remember (120053) | ||||||
|  | 	 Just Desserts (120066) | ||||||
|  | 	 A Job Well Done (120069) | ||||||
|  |  | ||||||
|  | ~~Gridania~~ | ||||||
|  |  | ||||||
|  | CRP: A Mother's Carpentry (120203) | ||||||
|  | 	 Shields for the Masses (120211) | ||||||
|  | 	 Canes for the Citizens (120212) | ||||||
|  | 	 High Tension (120213) | ||||||
|  | 	 Bowing to Pressure (120223) | ||||||
|  | 	 Pole Positioning (120229) | ||||||
|  | 	 Driving up the Wall (120237) | ||||||
|  | 	 Restocking the Stockade (120245) | ||||||
|  | 	 Plinks Aplenty (120247) | ||||||
|  | 	  | ||||||
|  | BSM: A Mother's Metallurgy (120201) | ||||||
|  | 	 It's All in the File (120209) | ||||||
|  | 	 Training in Bentbranch (120221) | ||||||
|  | 	 Re-crating the Scene (120231) | ||||||
|  | 	 Training in Emerald Moss (120239) | ||||||
|  | 	  | ||||||
|  | ARM: A Mother's Foundry (120205) | ||||||
|  | 	 Tending to Tendons (120217) | ||||||
|  | 	 A Little Rusty (120225) | ||||||
|  | 	 Springripple Rising (120233) | ||||||
|  | 	 In Sod We Rust (120241) | ||||||
|  | 	  | ||||||
|  | GSM: A Mother's Jewelry (120206) | ||||||
|  | 	 The Band's Bands (120218) | ||||||
|  | 	 Dusting the Knuckles (120226) | ||||||
|  | 	 In Arm's Reach (120234) | ||||||
|  | 	 Knuckling Down (120242) | ||||||
|  | 	  | ||||||
|  | LTW: A Mother's Booties (120204) | ||||||
|  | 	 Strapped for Straps (120214) | ||||||
|  | 	 Fire and Hide (120215) | ||||||
|  | 	 Choke Hold (120216) | ||||||
|  | 	 Work of Friction (120224) | ||||||
|  | 	 Hungry Like the Wolves (120230) | ||||||
|  | 	 Back in the Harness (120238) | ||||||
|  | 	 Morbol Measures (120246) | ||||||
|  | 	 Harnessing Help (120248) | ||||||
|  |  | ||||||
|  | WVR: A Mother's Frippery (120202) | ||||||
|  | 	 Quelling Bloody Rumors (120210) | ||||||
|  | 	 Clearing Bentbranch (120222) | ||||||
|  |  	 Clearing Nine Ivies (120232) | ||||||
|  |  	 Clearing Emerald Moss (120240) | ||||||
|  |  | ||||||
|  | ALC: A Mother's Delicacies (120207) | ||||||
|  | 	 Mixing It Up (120219) | ||||||
|  | 	 Keeping It Green (120227) | ||||||
|  | 	 Arboreal Alchemy (120235) | ||||||
|  | 	 Growing Strains (120243) | ||||||
|  |  | ||||||
|  | CUL: A Mother's Muselix (120208) | ||||||
|  | 	 Better Baker's Bounty (120220) | ||||||
|  | 	 On a Full Belly (120228) | ||||||
|  | 	 A Well-Deserved Dinner (120236) | ||||||
|  | 	 Seafood Smorgasbord (120244) | ||||||
|  |  | ||||||
|  | ~~Uldah~~ | ||||||
|  |  | ||||||
|  | CRP: Momodi's Sturdy Supports (120403) | ||||||
|  | 	 The Walk of Death (120413) | ||||||
|  | 	 Pointed Ambitions (120425) | ||||||
|  | 	 Off With Their Heads (120435) | ||||||
|  | 	 Act of Pure Weevil (120443) | ||||||
|  |  | ||||||
|  | BSM: Momodi's Dancing Daggers (120401) | ||||||
|  | 	 Pointy Props (120409) | ||||||
|  | 	 Hammering the Point (120423) | ||||||
|  | 	 Molten Metal (120434) | ||||||
|  | 	 Looking to Horizon (120442) | ||||||
|  |  | ||||||
|  | ARM: Momodi's Sturdy Suits (120405) | ||||||
|  | 	 Battered and Bent (120415) | ||||||
|  | 	 Arming the Unarmed (120427) | ||||||
|  | 	 Provisioning Drybone (120437) | ||||||
|  | 	 Buckling Under (120445) | ||||||
|  |  | ||||||
|  | GSM: Momodi's Radiant Rings (120406) | ||||||
|  | 	 A Scarcity of Scepters (120416) | ||||||
|  | 	 Pleasure and Pain (120417) | ||||||
|  | 	 In the Sultana's Wake (120418) | ||||||
|  | 	 A Shining Example (120428) | ||||||
|  | 	 A Drybone Induction (120432) | ||||||
|  | 	 A Horizon Promotion (120440) | ||||||
|  | 	 A Bluefog Induction (120448) | ||||||
|  | 	 A Broken Water Promotion (120451) | ||||||
|  |  | ||||||
|  | LTW: Momodi's Sashed Shoes (120404) | ||||||
|  | 	 Showing Some Leg (120414) | ||||||
|  | 	 World-weary Souls (120426) | ||||||
|  | 	 Camp Drybone Cares (120436) | ||||||
|  | 	 I Would Walk 500 Malms (120444) | ||||||
|  |  | ||||||
|  | WVR: Momodi's Budget Breeches (120402) | ||||||
|  | 	 Just for Kecks (120410) | ||||||
|  | 	 Pants Make the Man (120411) | ||||||
|  | 	 Holes in Their Defense (120412) | ||||||
|  | 	 Hanging by a Thread (120424) | ||||||
|  | 	 Exposed to the Elements (120433) | ||||||
|  | 	 Busier Than the Blades (120441) | ||||||
|  | 	 A Spot in the Shade (120449) | ||||||
|  | 	 Fire on the Water (120452) | ||||||
|  |  | ||||||
|  | ALC: Momodi's Condiment Conundrum (120407) | ||||||
|  | 	 Exports of Import (120419) | ||||||
|  | 	 Fertile Lies (120420) | ||||||
|  | 	 A Blind Fool (120421) | ||||||
|  | 	 Saint Allene's Fire (120429) | ||||||
|  | 	 Treating Steel (120431) | ||||||
|  | 	 Blue in the Eye (120439) | ||||||
|  | 	 Preserving the Region (120447) | ||||||
|  | 	 Provisioning Broken Water (120450) | ||||||
|  |  | ||||||
|  | CUL: Momodi's Breakfast Bread (120408) | ||||||
|  | 	 Finger Food (120422) | ||||||
|  | 	 Irrational Behavior (120430) | ||||||
|  | 	 Tender Victuals (120438) | ||||||
|  | 	 Some Like It Wet (120446) | ||||||
|  |  | ||||||
| --]] | --]] | ||||||
|  |  | ||||||
| require ("global") | require ("global") | ||||||
| 	  | 	  | ||||||
|  | local limsaLocalLeves = { | ||||||
|  | 	{120007, 120017, 120039, 120047, 120061},									--CRP | ||||||
|  | 	{120005, 120013, 120014, 120015, 120035, 120043, 120051, 120059, 120067},	--BSM | ||||||
|  | 	{120009, 120019, 120020, 120021, 120036, 120044, 120052, 120063, 120068},	--ARM | ||||||
|  | 	{120010, 120022, 120041, 120049, 120064},									--GSM | ||||||
|  | 	{120008, 120018, 120040, 120048, 120062},									--LTW | ||||||
|  | 	{120006, 120016, 120038, 120046, 120060},									--WVR | ||||||
|  | 	{120011, 120023, 120042, 120050, 120065},									--ALC | ||||||
|  | 	{120012, 120024, 120025, 120026, 120037, 120045, 120053, 120066, 120069}	--CUL | ||||||
|  | }; | ||||||
|  |  | ||||||
|  | local gridaniaLocalLeves = { | ||||||
|  | 	{120203, 120211, 120212, 120213, 120223, 120229, 120237, 120245, 120247},	--CRP | ||||||
|  | 	{120201, 120209, 120221, 120231, 120239},									--BSM | ||||||
|  | 	{120205, 120217, 120225, 120233, 120241},									--ARM | ||||||
|  | 	{120206, 120218, 120226, 120234, 120242},									--GSM | ||||||
|  | 	{120204, 120214, 120215, 120216, 120224, 120230, 120238, 120246, 120248},	--LTW | ||||||
|  | 	{120202, 120210, 120222, 120232, 120240},									--WVR | ||||||
|  | 	{120207, 120219, 120227, 120235, 120243},									--ALC | ||||||
|  | 	{120208, 120220, 120228, 120236, 120244}									--CUL | ||||||
|  | }; | ||||||
|  |  | ||||||
|  | local uldahLocalLeves = { | ||||||
|  | 	{120403, 120413, 120425, 120435, 120443},									--CRP | ||||||
|  | 	{120401, 120409, 120423, 120434, 120442},									--BSM | ||||||
|  | 	{120405, 120415, 120427, 120437, 120445},									--ARM | ||||||
|  | 	{120406, 120416, 120417, 120418, 120428, 120432, 120440, 120448, 120451},	--GSM | ||||||
|  | 	{120404, 120414, 120426, 120436, 120444},									--LTW | ||||||
|  | 	{120402, 120410, 120411, 120412, 120424, 120433, 120441, 120449, 120452},	--WVR | ||||||
|  | 	{120407, 120419, 120420, 120421, 120429, 120431, 120439, 120447, 120450},	--ALC | ||||||
|  | 	{120408, 120422, 120430, 120438, 120446}									--CUL | ||||||
|  | }; | ||||||
|  |  | ||||||
| function init(npc) | function init(npc) | ||||||
| 	return false, false, 0, 0;	 | 	return false, false, 0, 0;	 | ||||||
| end | end | ||||||
|  |  | ||||||
| function onEventStarted(player, npc) | function onEventStarted(player, npc, triggerName) | ||||||
| 	callClientFunction(player, "talkOfferWelcome", player, 1); |  | ||||||
|  |     local leveAllowances = 16; | ||||||
|  |     local quest = 120438; | ||||||
|  | 	 | ||||||
|  |     callClientFunction(player, "confirmJournal", quest, 1); | ||||||
|  | 	callClientFunction(player, "confirmJournal", quest, 2); | ||||||
|  | 	callClientFunction(player, "confirmJournal", quest, 3); | ||||||
|  | 	callClientFunction(player, "confirmJournal", quest, 4); | ||||||
|  | 	--[[callClientFunction(player, "talkOfferWelcome", player, leveAllowances); | ||||||
|  |      | ||||||
|  |     while (true) do         | ||||||
|  |         -- Class Menu | ||||||
|  |         local classChoice = callClientFunction(player, "askOfferPack"); | ||||||
|  |       | ||||||
|  |         if (classChoice != nil) then             | ||||||
|  |             while (true) do | ||||||
|  |                 -- Level Difficulty Menu | ||||||
|  |                 local levelChoice = callClientFunction(player, "askOfferRank"); | ||||||
|  |                  | ||||||
|  |                 if levelChoice != nil then | ||||||
|  |                     if levelChoice == 1 then | ||||||
|  |                         local levequest = callClientFunction(player, "askOfferQuest", player, 1, 120438, 120025); | ||||||
|  |                         if (levequest != nil and levequest > 0) then | ||||||
|  |                             player:SendMessage(0x20, "", "[DEBUG] Leve : " .. tostring(pickedLeve)); | ||||||
|  |                             player:SendGameMessage(GetWorldMaster(), 50141, 0x20, leveAllowances); | ||||||
|  |                         end | ||||||
|  |                          | ||||||
|  |                     elseif levelChoice == 2 then | ||||||
|  |                         pickedLeve = callClientFunction(player, "askOfferQuest", player, 1, 120026, 120027); | ||||||
|  |                         if (pickedLeve != nil) or (pickedLeve != -1) then | ||||||
|  |                             player:SendMessage(0x20, "", "[DEBUG] Leve : " .. tostring(pickedLeve)); | ||||||
|  |                             player:SendGameMessage(GetWorldMaster(), 50141, 0x20, leveAllowances); | ||||||
|  |                         end | ||||||
|  |                          | ||||||
|  |                     elseif levelChoice == 3 then | ||||||
|  |                         pickedLeve = callClientFunction(player, "askOfferQuest", player, 1, 120028, 120029); | ||||||
|  |                         if (pickedLeve != nil) or (pickedLeve != -1) then | ||||||
|  |                             player:SendMessage(0x20, "", "[DEBUG] Leve : " .. tostring(pickedLeve)); | ||||||
|  |                             player:SendGameMessage(GetWorldMaster(), 50141, 0x20, leveAllowances) | ||||||
|  |                         end | ||||||
|  |                          | ||||||
|  |                     end | ||||||
|  |                 else     | ||||||
|  |                     break | ||||||
|  |                 end | ||||||
|  |             end             | ||||||
|  |         else | ||||||
|  |             break; | ||||||
|  |         end | ||||||
|  |     end]]-- | ||||||
|  |      | ||||||
|  |     callClientFunction(player, "finishTalkTurn"); | ||||||
| 	player:EndEvent(); | 	player:EndEvent(); | ||||||
| end | end | ||||||
|  |  | ||||||
| function onEventUpdate(player, npc, step, menuOptionSelected, lsName, lsCrest) | function getAvailableLeves(class, rank) | ||||||
| 	--callClientFunction(player, "askOfferQuest", player, 1000); |  | ||||||
| 	 | 	 | ||||||
| end | end | ||||||
| @@ -46,7 +46,6 @@ function onEventStarted(player, npc, triggerName) | |||||||
|     local cluster = 3020413; |     local cluster = 3020413; | ||||||
|     local eventMode = 2012; |     local eventMode = 2012; | ||||||
|      |      | ||||||
|      |  | ||||||
|     if eventMode == 2011 then |     if eventMode == 2011 then | ||||||
|         if playerGC == 0 then |         if playerGC == 0 then | ||||||
|             callClientFunction(player, "eventTalkStep0", 0); |             callClientFunction(player, "eventTalkStep0", 0); | ||||||
|   | |||||||
| @@ -1,13 +1,97 @@ | |||||||
|  | require("global"); | ||||||
|  |  | ||||||
|  | --[[ | ||||||
|  |  | ||||||
|  | Populace Standard Script | ||||||
|  |  | ||||||
|  | Functions:  | ||||||
|  |  | ||||||
|  | eventSwitch(questId1, questId2, questId3, questId4, currentPage, maxPages, titleId)	- Shows a dialog box with which quest to trigger  | ||||||
|  | 																					  when more than one quest is active for this npc. | ||||||
|  |  | ||||||
|  | Notes: | ||||||
|  |  | ||||||
|  | This scripts fires for all normal standard ENpcs in the world. Because of how the FFXIV dialog system works, everything is technically | ||||||
|  | a quest; including the DefaultTalk responses. This script checks both static default quests and any relevant ones for that actor class | ||||||
|  | id. If only one exists; it is automatically triggered otherwise a dialog box will appear for the player to choose what quest to do. | ||||||
|  |  | ||||||
|  | --]] | ||||||
|  |  | ||||||
| function init(npc) | function init(npc) | ||||||
| 	return false, false, 0, 0;	 | 	return false, false, 0, 0;	 | ||||||
| end | end | ||||||
|  |  | ||||||
| function onEventStarted(player, npc) | function onEventStarted(player, npc, eventType, eventName) | ||||||
| 	player:SendMessage(0x20, "", "This PopulaceStandard actor has no event set. Actor Class Id: " .. tostring(npc:GetActorClassId())); | 	local chosenQuest = nil; | ||||||
|  |  | ||||||
|  | 	if (eventType == 1) then | ||||||
|  | 		local defaultTalk = player:GetDefaultTalkQuest(npc); | ||||||
|  | 		local tutorialTalk = player:GetTutorialQuest(npc); | ||||||
|  | 		local activeQuests = player:GetQuestsForNpc(npc); | ||||||
|  | 		local possibleQuests = {}; | ||||||
|  | 		 | ||||||
|  | 		-- Create the switch table for this npc | ||||||
|  | 		if (defaultTalk ~= nil and eventType == ETYPE_TALK) then | ||||||
|  | 			table.insert(possibleQuests, defaultTalk); | ||||||
|  | 		end | ||||||
|  | 		if (tutorialTalk ~= nil and eventType == ETYPE_TALK) then | ||||||
|  | 			table.insert(possibleQuests, tutorialTalk); | ||||||
|  | 		end | ||||||
|  | 		if (activeQuests ~= nil) then | ||||||
|  | 			for i=1,#activeQuests do | ||||||
|  | 				table.insert(possibleQuests, activeQuests[i]); | ||||||
|  | 			end | ||||||
|  | 		end | ||||||
|  | 		 | ||||||
|  | 		-- Either let the player choose the quest or start it if it's the only one. | ||||||
|  | 		if (#possibleQuests > 1) then | ||||||
|  | 			local currentPage = 0; | ||||||
|  | 			local numPages = math.floor((#possibleQuests-1)/4) + 1; | ||||||
|  | 			 | ||||||
|  | 			while (true) do | ||||||
|  | 				local page, index = callClientFunction(player, "switchEvent", possibleQuests[currentPage * 4 + 1], possibleQuests[currentPage * 4 + 2], possibleQuests[currentPage * 4 + 3], possibleQuests[currentPage * 4 + 4], currentPage + 1, numPages, 0x3F1); | ||||||
|  | 				 | ||||||
|  | 				if (page == 0) then | ||||||
|  | 					chosenQuest = possibleQuests[(currentPage * 4) + index]; | ||||||
|  | 					break; | ||||||
|  | 				elseif (page > 0) then | ||||||
|  | 					currentPage = page - 1; | ||||||
|  | 				else | ||||||
| 					player:EndEvent(); | 					player:EndEvent(); | ||||||
|  | 					return; | ||||||
|  | 				end | ||||||
|  | 			end			 | ||||||
|  | 		elseif (#possibleQuests == 1) then | ||||||
|  | 			chosenQuest = possibleQuests[1]; | ||||||
|  | 		end | ||||||
|  | 	else | ||||||
|  | 		local activeQuests = player:GetQuestsForNpc(npc); | ||||||
|  | 		if (#activeQuests != 0) then | ||||||
|  | 			chosenQuest = activeQuests[1]; | ||||||
|  | 		end | ||||||
|  | 	end | ||||||
|  | 	 | ||||||
|  | 	-- Run the quest event or tell the devs it's missing. | ||||||
|  | 	if (chosenQuest ~= nil) then | ||||||
|  | 		doQuestEvent(player, npc, chosenQuest, eventType, eventName); | ||||||
|  | 	else | ||||||
|  | 		local msg = string.format("ERROR: This PopulaceStandard actor has no defaultTalk or quest set. \nActor Class Id: %s\nEvent Name: %s", tostring(npc:GetActorClassId()), eventName); | ||||||
|  | 		printf(msg); | ||||||
|  | 		player:SendMessage(0x20, "", msg); | ||||||
|  | 		player:EndEvent(); | ||||||
|  | 	end | ||||||
| end | end | ||||||
|  |  | ||||||
| function onEventUpdate(player, npc, blah, menuSelect) | function doQuestEvent(player, npc, quest, eventType, eventName) | ||||||
| 	player:EndEvent(); | 	if (eventType == 0) then | ||||||
|  | 		quest:OnCommand(player, npc, eventName); | ||||||
|  | 	elseif (eventType == 1) then | ||||||
|  | 		quest:OnTalk(player, npc); | ||||||
|  | 	elseif (eventType == 2) then | ||||||
|  | 		quest:OnPush(player, npc, eventName); | ||||||
|  | 	elseif (eventType == 3) then | ||||||
|  | 		quest:OnEmote(player, npc, eventName); | ||||||
|  | 	elseif (eventType == 5) then | ||||||
|  | 		quest:OnNotice(player, npc, eventName); | ||||||
|  | 	end | ||||||
| end | end | ||||||
| @@ -0,0 +1,56 @@ | |||||||
|  | --[[ | ||||||
|  |  | ||||||
|  | InstanceRaidGuide Script | ||||||
|  |  | ||||||
|  | Functions; | ||||||
|  | askEnterInstanceRaid(arg1)   -- Opens a widget asking to enter the given Raid id. | ||||||
|  |  | ||||||
|  | --]] | ||||||
|  |  | ||||||
|  | require ("global") | ||||||
|  |  | ||||||
|  | function init(npc) | ||||||
|  |      | ||||||
|  |     if ((npc == 1002090) or (npc == 1002091))  then | ||||||
|  |         -- This won't work due to how init() works, but old scripts had it, keeping it here for now | ||||||
|  |         return false, false, 0, 0, 491, 2;	 | ||||||
|  |     else | ||||||
|  |         return false, false, 0, 0; | ||||||
|  |     end | ||||||
|  | end | ||||||
|  |  | ||||||
|  | function onEventStarted(player, npc, eventType, eventName) | ||||||
|  |  | ||||||
|  |     npcId = npc:GetActorClassId() | ||||||
|  |      | ||||||
|  |     if (npcId == 1002090) then -- Serpent Private Hodder (Stewart) : Gcl107 | ||||||
|  |      | ||||||
|  |         callClientFunction(player, "delegateEvent", player, GetStaticActor("DftFst"), "defaultTalkWithStewart_001"); -- "defaultTalkWithStewart_002" -- Post-Raid dialog? | ||||||
|  |          | ||||||
|  |         --[[ | ||||||
|  |         choice = callClientFunction(player, "delegateEvent", player, GetStaticActor("Gcl107"), "processEventStewart", 15); | ||||||
|  |          | ||||||
|  |         if (choice == 1) then | ||||||
|  |             callClientFunction(player, "askEnterInstanceRaid", 15); -- Rivenroad | ||||||
|  |         end | ||||||
|  |         --]] | ||||||
|  |     elseif (npcId == 1002091) then -- Serpent Private Dauremant (Trisselle) : Sum6w0 | ||||||
|  |          | ||||||
|  |         callClientFunction(player, "delegateEvent", player, GetStaticActor("DftFst"), "defaultTalkWithTrisselle_001"); -- "defaultTalkWithTrisselle_002" -- No idea for context. | ||||||
|  |          | ||||||
|  |         --[[ | ||||||
|  |         choice = callClientFunction(player, "delegateEvent", player, GetStaticActor("Sum6w0"), "processEventTrisselle", 16) | ||||||
|  |          | ||||||
|  |         if (choice == 1) then | ||||||
|  |             callClientFunction(player, "askEnterInstanceRaid", 16);  -- Rivenroad (Hard) | ||||||
|  |         end | ||||||
|  |         --]] | ||||||
|  |     elseif (npcId == 1060022) then -- Louisoix  | ||||||
|  |         callClientFunction(player, "delegateEvent", player, GetStaticActor("DftFst"), "defaultTalkLouisoix_001"); | ||||||
|  |     end | ||||||
|  |          | ||||||
|  |  | ||||||
|  |          | ||||||
|  |          | ||||||
|  | 	player:EndEvent(); | ||||||
|  | end | ||||||
| @@ -19,7 +19,7 @@ function onBeginLogin(player) | |||||||
| 	end | 	end | ||||||
| 			 | 			 | ||||||
| 	--For Opening. Set Director and reset position incase d/c | 	--For Opening. Set Director and reset position incase d/c | ||||||
| 	if (player:HasQuest(110001) == true and player:GetZoneID() == 193) then | 	if (player:HasQuest(110001) == true and player.CurrentArea.ZoneId == 193) then | ||||||
| 		director = player:GetZone():CreateDirector("OpeningDirector", false);		 | 		director = player:GetZone():CreateDirector("OpeningDirector", false);		 | ||||||
| 		player:AddDirector(director); | 		player:AddDirector(director); | ||||||
| 		director:StartDirector(true); | 		director:StartDirector(true); | ||||||
| @@ -32,7 +32,7 @@ function onBeginLogin(player) | |||||||
| 		player.rotation = 0.025; | 		player.rotation = 0.025; | ||||||
| 		player:GetQuest(110001):ClearQuestData(); | 		player:GetQuest(110001):ClearQuestData(); | ||||||
| 		player:GetQuest(110001):ClearQuestFlags(); | 		player:GetQuest(110001):ClearQuestFlags(); | ||||||
| 	elseif (player:HasQuest(110005) == true and player:GetZoneID() == 166) then  | 	elseif (player:HasQuest(110005) == true and player.CurrentArea.ZoneId == 166) then  | ||||||
| 		director = player:GetZone():CreateDirector("OpeningDirector", false);		 | 		director = player:GetZone():CreateDirector("OpeningDirector", false);		 | ||||||
| 		player:AddDirector(director); | 		player:AddDirector(director); | ||||||
| 		director:StartDirector(false);		 | 		director:StartDirector(false);		 | ||||||
| @@ -45,7 +45,7 @@ function onBeginLogin(player) | |||||||
| 		player.rotation = -1.26721; | 		player.rotation = -1.26721; | ||||||
| 		player:GetQuest(110005):ClearQuestData(); | 		player:GetQuest(110005):ClearQuestData(); | ||||||
| 		player:GetQuest(110005):ClearQuestFlags(); | 		player:GetQuest(110005):ClearQuestFlags(); | ||||||
| 	elseif (player:HasQuest(110009) == true and player:GetZoneID() == 184) then | 	elseif (player:HasQuest(110009) == true and player.CurrentArea.ZoneId == 184) then | ||||||
| 		--director = player:GetZone():CreateDirector("OpeningDirector", false);		 | 		--director = player:GetZone():CreateDirector("OpeningDirector", false);		 | ||||||
| 		--player:AddDirector(director); | 		--player:AddDirector(director); | ||||||
| 		--director:StartDirector(false);		 | 		--director:StartDirector(false);		 | ||||||
|   | |||||||
| @@ -13,7 +13,7 @@ local attackMagicHandlers = { | |||||||
|      |      | ||||||
| } | } | ||||||
|  |  | ||||||
| function onEventStarted(player, command, triggerName, arg1, arg2, arg3, arg4, targetActor, arg5, arg6, arg7, arg8) | function onEventStarted(player, command, eventType, eventName, arg1, arg2, arg3, arg4, targetActor, arg5, arg6, arg7, arg8) | ||||||
| 	player.Ability(command.actorId, targetActor); | 	player.Ability(command.Id, targetActor); | ||||||
| 	player:endEvent(); | 	player:endEvent(); | ||||||
| end | end | ||||||
| @@ -1,5 +1,5 @@ | |||||||
| require("global") | require("global") | ||||||
|  |  | ||||||
| function onEventStarted(player, command, triggerName, arg1, arg2, arg3, arg4, targetActor, arg5, arg6, arg7, arg8) | function onEventStarted(player, command, eventType, eventName, arg1, arg2, arg3, arg4, targetActor, arg5, arg6, arg7, arg8) | ||||||
| 	 | 	 | ||||||
| end | end | ||||||
| @@ -8,7 +8,7 @@ Switches between active and passive mode states | |||||||
|  |  | ||||||
| --]] | --]] | ||||||
|  |  | ||||||
| function onEventStarted(player, command, triggerName) | function onEventStarted(player, command, eventType, eventName) | ||||||
|      |      | ||||||
| 	if (player.currentMainState == 0x0000) then | 	if (player.currentMainState == 0x0000) then | ||||||
| 		player.Engage(0, 0x0002); | 		player.Engage(0, 0x0002); | ||||||
|   | |||||||
| @@ -13,8 +13,8 @@ local attackMagicHandlers = { | |||||||
|      |      | ||||||
| } | } | ||||||
|  |  | ||||||
| function onEventStarted(player, command, triggerName, arg1, arg2, arg3, arg4, targetActor, arg5, arg6, arg7, arg8) | function onEventStarted(player, command, eventType, eventName, arg1, arg2, arg3, arg4, targetActor, arg5, arg6, arg7, arg8) | ||||||
| 	player.Ability(command.actorId, targetActor); | 	player.Ability(command.Id, targetActor); | ||||||
| 	player:endEvent(); | 	player:endEvent(); | ||||||
| 	 | 	 | ||||||
| end | end | ||||||
| @@ -13,7 +13,7 @@ local attackMagicHandlers = { | |||||||
|      |      | ||||||
| } | } | ||||||
|  |  | ||||||
| function onEventStarted(player, command, triggerName, arg1, arg2, arg3, arg4, targetActor, arg5, arg6, arg7, arg8) | function onEventStarted(player, command, eventType, eventName, arg1, arg2, arg3, arg4, targetActor, arg5, arg6, arg7, arg8) | ||||||
| 	player.Cast(command.actorId, targetActor); | 	player.Cast(command.Id, targetActor); | ||||||
| 	player:endEvent(); | 	player:endEvent(); | ||||||
| end; | end; | ||||||
| @@ -9,7 +9,7 @@ Finds the correct weaponskill subscript to fire when a weaponskill actor is acti | |||||||
|  |  | ||||||
| --]] | --]] | ||||||
|  |  | ||||||
| function onEventStarted(player, command, triggerName, arg1, arg2, arg3, arg4, targetActor, arg5, arg6, arg7, arg8) | function onEventStarted(player, command, eventType, eventName, arg1, arg2, arg3, arg4, targetActor, arg5, arg6, arg7, arg8) | ||||||
| 	 | 	 | ||||||
| 	--Are they in active mode? | 	--Are they in active mode? | ||||||
| 	if (player:GetState() != 2) then | 	if (player:GetState() != 2) then | ||||||
| @@ -21,6 +21,6 @@ function onEventStarted(player, command, triggerName, arg1, arg2, arg3, arg4, ta | |||||||
|     if not player.aiContainer.IsEngaged() then |     if not player.aiContainer.IsEngaged() then | ||||||
|         player.Engage(targetActor); |         player.Engage(targetActor); | ||||||
|     end; |     end; | ||||||
|     player.WeaponSkill(command.actorId, targetActor); |     player.WeaponSkill(command.Id, targetActor); | ||||||
| 	player:endEvent(); | 	player:endEvent(); | ||||||
| end; | end; | ||||||
| @@ -8,14 +8,14 @@ Handles what happens when you examine a player's bazaar | |||||||
|  |  | ||||||
| require ("global") | require ("global") | ||||||
|  |  | ||||||
| function onEventStarted(player, actor, triggerName, name, arg1, arg2, arg3, bazaarActorId)	 | function onEventStarted(player, actor, eventType, eventName, name, arg1, arg2, arg3, bazaarActorId)	 | ||||||
|  |  | ||||||
| 	local bazaarActor = nil; | 	local bazaarActor = nil; | ||||||
|  |  | ||||||
| 	if (name ~= nil) then | 	if (name ~= nil) then | ||||||
| 		bazaarActor = player:GetZone():FindPCInZone(name); | 		bazaarActor = player.CurrentArea:FindPCInZone(name); | ||||||
| 	elseif (bazaarActorId ~= nil) then | 	elseif (bazaarActorId ~= nil) then | ||||||
| 		bazaarActor = player:GetZone():FindActorInArea(bazaarActorId); | 		bazaarActor = player.CurrentArea:FindActorInArea(bazaarActorId); | ||||||
| 	end | 	end | ||||||
| 	 | 	 | ||||||
| 	if (bazaarActor ~= nil) then | 	if (bazaarActor ~= nil) then | ||||||
|   | |||||||
| @@ -20,7 +20,7 @@ seekAmount: The amount of seekItem we want. | |||||||
|  |  | ||||||
| require ("global") | require ("global") | ||||||
|  |  | ||||||
| function onEventStarted(player, actor, triggerName, rewardItem, seekItem, bazaarMode, arg1, bazaarActor, rewardAmount, seekAmount, arg2, arg3, type9ItemIds) | function onEventStarted(player, actor, eventType, eventName, rewardItem, seekItem, bazaarMode, arg1, bazaarActor, rewardAmount, seekAmount, arg2, arg3, type9ItemIds) | ||||||
|  |  | ||||||
| 	local rewarding = nil; | 	local rewarding = nil; | ||||||
| 	local seeking = nil; | 	local seeking = nil; | ||||||
|   | |||||||
| @@ -10,7 +10,7 @@ All bazaar args have a Reward (The item the person who fufills the request gets) | |||||||
|  |  | ||||||
| --TODO REFACTOR | --TODO REFACTOR | ||||||
|  |  | ||||||
| function onEventStarted(player, actor, triggerName, rewardItem, seekItemOrCost, seekAmount, arg1, bazaarActorId, rewardAmount, rewardItemId, nameIndex, arg2, type9ItemIds) | function onEventStarted(player, actor, eventType, eventName, rewardItem, seekItemOrCost, seekAmount, arg1, bazaarActorId, rewardAmount, rewardItemId, nameIndex, arg2, type9ItemIds) | ||||||
|  |  | ||||||
| 	local originalReward = nil; | 	local originalReward = nil; | ||||||
| 	local originalSeek = nil; | 	local originalSeek = nil; | ||||||
| @@ -18,7 +18,7 @@ function onEventStarted(player, actor, triggerName, rewardItem, seekItemOrCost, | |||||||
| 	 | 	 | ||||||
| 	--Get the bazaar actor | 	--Get the bazaar actor | ||||||
| 	if (bazaarActorId ~= nil) then | 	if (bazaarActorId ~= nil) then | ||||||
| 		bazaarActor = player:GetZone():FindActorInArea(bazaarActorId);		 | 		bazaarActor = player.CurrentArea:FindActorInArea(bazaarActorId);		 | ||||||
| 	end | 	end | ||||||
| 	 | 	 | ||||||
| 	--Abort if no actor | 	--Abort if no actor | ||||||
|   | |||||||
| @@ -13,7 +13,7 @@ Handles canceling bazaar items | |||||||
|  |  | ||||||
| --]] | --]] | ||||||
|  |  | ||||||
| function onEventStarted(player, actor, triggerName, rewardItem, seekItem, bazaarType, narg, bazaarActor, rewardAmount, seekAmount, narg, narg, type9ItemIds) | function onEventStarted(player, actor, eventType, eventName, rewardItem, seekItem, bazaarType, narg, bazaarActor, rewardAmount, seekAmount, narg, narg, type9ItemIds) | ||||||
| 	 | 	 | ||||||
| 	GetWorldManager():RemoveFromBazaar(player, player:GetItem(rewardItem)); | 	GetWorldManager():RemoveFromBazaar(player, player:GetItem(rewardItem)); | ||||||
| 		 | 		 | ||||||
|   | |||||||
| @@ -10,7 +10,7 @@ operateUI(pointsAvailable, pointsLimit, str, vit, dex, int, min, pie) | |||||||
|  |  | ||||||
| require ("global") | require ("global") | ||||||
|  |  | ||||||
| function onEventStarted(player, actor, triggerName) | function onEventStarted(player, actor, eventType, eventName) | ||||||
| 	--local points = player:GetAttributePoints(); | 	--local points = player:GetAttributePoints(); | ||||||
| 	--player:RunEventFunction("delegateCommand", actor, "operateUI", points.available, points.limit, points.inSTR, points.inVIT, points.inDEX, points.inINT, points.inMIN, points.inPIT); | 	--player:RunEventFunction("delegateCommand", actor, "operateUI", points.available, points.limit, points.inSTR, points.inVIT, points.inDEX, points.inINT, points.inMIN, points.inPIT); | ||||||
| 	result = callClientFunction(player, "delegateCommand", actor, "operateUI", 100, 100, 10, 10, 10, 10, 10, 10); | 	result = callClientFunction(player, "delegateCommand", actor, "operateUI", 100, 100, 10, 10, 10, 10, 10, 10); | ||||||
|   | |||||||
| @@ -1,6 +1,90 @@ | |||||||
| function onEventStarted(player, caller, commandRequest, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8) | require("global"); | ||||||
|  | --[[ | ||||||
|  |  | ||||||
|     player:SetCurrentJob(17); | ChangeJobCommand Script | ||||||
|  |  | ||||||
|  | Called when the player equips/unequips a job stone or uses the /job command. | ||||||
|  |  | ||||||
|  | --]] | ||||||
|  |  | ||||||
|  |  | ||||||
|  | local classToJob = { -- [classId] = {jobId, jobAnim, jobKeyItem} | ||||||
|  |     [2] = {15, 0x4000028, 2000202},  -- PGL -> MNK | ||||||
|  |     [3] = {16, 0x4000029, 2000201},  -- GLD -> PLD | ||||||
|  |     [4] = {17, 0x4000027, 2000203},  -- MRD -> WAR | ||||||
|  |     [7] = {18, 0x400002D, 2000205},  -- ARC -> BRD | ||||||
|  |     [8] = {19, 0x400002C, 2000204},  -- LNC -> DRG | ||||||
|  |     [22] = {26, 0x400002B, 2000207}, -- THM -> BLM | ||||||
|  |     [23] = {27, 0x400002A, 2000206}, -- CNJ -> WHM | ||||||
|  | } | ||||||
|  |     | ||||||
|  | local jobToClass = { -- [jobId] = classId | ||||||
|  |     [15] = 2,  -- MNK -> PGL | ||||||
|  |     [16] = 3,  -- PLD -> GLD | ||||||
|  |     [17] = 4,  -- WAR -> MRD | ||||||
|  |     [18] = 7,  -- BRD -> ARC | ||||||
|  |     [19] = 8,  -- DRG -> LNC | ||||||
|  |     [26] = 22, -- BLM -> THM | ||||||
|  |     [27] = 23  -- WHM -> CNJ | ||||||
|  | } | ||||||
|  |  | ||||||
|  |  | ||||||
|  | function onEventStarted(player, command, eventType, eventName, jobState) | ||||||
|  |  | ||||||
|  |     local currentClass = player:GetCurrentClassOrJob(); | ||||||
|  |     local jobCheck = isJob(currentClass); | ||||||
|  |     local hasKeyItem = false; | ||||||
|  |      | ||||||
|  |     if (jobCheck == false) then | ||||||
|  |         hasKeyItem = player:GetItemPackage(INVENTORY_KEYITEMS):HasItem(classToJob[currentClass][3]); | ||||||
|  |     end | ||||||
|  |      | ||||||
|  |     if (jobCheck ~= nil) then -- Valid Class/Job ids only | ||||||
|  |         if (jobState == 0) then -- Toggle current class/job state | ||||||
|  |             if ((jobCheck == false) and (hasKeyItem == true)) then | ||||||
|  |                 setPlayerJob(player, classToJob[currentClass][1], classToJob[currentClass][2]); | ||||||
|  |             elseif (jobCheck == true) then | ||||||
|  |                 setPlayerClass(player, jobToClass[currentClass]) | ||||||
|  |             end | ||||||
|  |              | ||||||
|  |         elseif (jobState == 1 and (jobCheck == false) and (hasKeyItem == true)) then -- Equipping Job stone | ||||||
|  |             setPlayerJob(player, classToJob[currentClass][1], classToJob[currentClass][2]); | ||||||
|  |         elseif (jobState == 2 and (jobCheck == true)) then -- Removing Job stone | ||||||
|  |             setPlayerClass(player, jobToClass[currentClass]); | ||||||
|  |         end | ||||||
|  |     end | ||||||
|      |      | ||||||
|     player:EndEvent(); |     player:EndEvent(); | ||||||
| end | end | ||||||
|  |  | ||||||
|  |  | ||||||
|  | function setPlayerClass(player, id) | ||||||
|  |     player:SetCurrentJob(0); | ||||||
|  |     player:PrepareClassChange(id); | ||||||
|  |     player:DoClassChange(id); | ||||||
|  |     player:PlayAnimation(0x4001030); | ||||||
|  |     player:SendGameMessage(player, GetWorldMaster(), 30103, 0x20, 0, 0, player, id);      | ||||||
|  | end | ||||||
|  |  | ||||||
|  | function setPlayerJob(player, id, anim) | ||||||
|  |     player:SetCurrentJob(id); | ||||||
|  |     player:PrepareClassChange(id); | ||||||
|  |     player:DoClassChange(jobToClass[id]); | ||||||
|  |     player:PlayAnimation(anim); | ||||||
|  |     player:SendGameMessage(player, GetWorldMaster(), 30103, 0x20, 0, 0, player, id);  | ||||||
|  | end | ||||||
|  |  | ||||||
|  | function isJob(id) | ||||||
|  |     local validId = { | ||||||
|  |         [2] = 0, [3] = 0, [4] = 0, [7] = 0, [8] = 0, [22] = 0, [23] = 0, | ||||||
|  |         [15] = 1, [16] = 1, [17] = 1, [18] = 1, [19] = 1, [26] = 1, [27] = 1 | ||||||
|  |     } | ||||||
|  |      | ||||||
|  |     if (validId[id] == 0) then | ||||||
|  |         return false; | ||||||
|  |     elseif (validId[id] == 1) then | ||||||
|  |         return true; | ||||||
|  |     else | ||||||
|  |         return nil; | ||||||
|  |     end | ||||||
|  | end | ||||||
| @@ -6,7 +6,7 @@ Handles player examining someone | |||||||
|  |  | ||||||
| --]] | --]] | ||||||
|  |  | ||||||
| function onEventStarted(player, commandactor, triggerName, arg1, arg2, arg3, arg4, checkedActorId) | function onEventStarted(player, commandactor, eventType, eventName, arg1, arg2, arg3, arg4, checkedActorId) | ||||||
|  |  | ||||||
| 	actor = player:GetActorInInstance(checkedActorId); | 	actor = player:GetActorInInstance(checkedActorId); | ||||||
| 	 | 	 | ||||||
|   | |||||||
| @@ -6,26 +6,27 @@ Handles mounting and dismounting the Chocobo and Goobbue | |||||||
|  |  | ||||||
| --]] | --]] | ||||||
|  |  | ||||||
| function onEventStarted(player, actor, triggerName, isGoobbue) | require ("global") | ||||||
|  |  | ||||||
|  | function onEventStarted(player, actor, eventType, eventName, isGoobbue) | ||||||
|     if (player:GetState() == 0) then         |     if (player:GetState() == 0) then         | ||||||
|                  |                  | ||||||
|         worldMaster = GetWorldMaster();      |         worldMaster = GetWorldMaster();      | ||||||
|          |          | ||||||
|         if (isGoobbue ~= true) then |         if (isGoobbue ~= true) then | ||||||
| 			player:ChangeMusic(83); |             player:ChangeMusic(83, MUSIC_FADEIN); | ||||||
|             player:SendGameMessage(player, worldMaster, 26001, 0x20); |             player:SendGameMessage(player, worldMaster, 26001, 0x20); | ||||||
|             player:SetMountState(1); |             player:SetMountState(1); | ||||||
|         else |         else | ||||||
| 			player:ChangeMusic(98); |             player:ChangeMusic(98, MUSIC_FADEIN); | ||||||
|             player:SendGameMessage(player, worldMaster, 26019, 0x20); |             player:SendGameMessage(player, worldMaster, 26019, 0x20); | ||||||
|             player:SetMountState(2); |             player:SetMountState(2); | ||||||
|         end |         end | ||||||
|          |          | ||||||
| 		player:ChangeSpeed(0.0, 5.0, 10.0, 10.0); |         player:ChangeSpeed(0.0, 3.6, 9.0, 9.0); | ||||||
|         player:ChangeState(15); |         player:ChangeState(15); | ||||||
|     else |     else | ||||||
| 		player:ChangeMusic(player:GetZone().bgmDay); |         player:ChangeMusic(player.currentArea.bgmDay, MUSIC_FADEIN); | ||||||
|          |          | ||||||
|         worldMaster = GetWorldMaster(); |         worldMaster = GetWorldMaster(); | ||||||
|          |          | ||||||
| @@ -43,7 +44,5 @@ function onEventStarted(player, actor, triggerName, isGoobbue) | |||||||
|         player:ChangeSpeed(0.0, 2.0, 5.0, 5.0) |         player:ChangeSpeed(0.0, 2.0, 5.0, 5.0) | ||||||
|         player:ChangeState(0);  |         player:ChangeState(0);  | ||||||
|     end     |     end     | ||||||
| 	 |  | ||||||
|     player:EndEvent(); |     player:EndEvent(); | ||||||
| 	 |  | ||||||
| end | end | ||||||
| @@ -124,7 +124,7 @@ local weaponskillHandlers = { | |||||||
| 	[0xA0F070EA] = nil | 	[0xA0F070EA] = nil | ||||||
| } | } | ||||||
|  |  | ||||||
| function onEventStarted(player, command, triggerName)			 | function onEventStarted(player, command, eventType, eventName)			 | ||||||
| 	 | 	 | ||||||
| 	--Are they in active mode? | 	--Are they in active mode? | ||||||
| 	if (player:GetState() != 2) then | 	if (player:GetState() != 2) then | ||||||
| @@ -133,8 +133,8 @@ function onEventStarted(player, command, triggerName) | |||||||
| 		return; | 		return; | ||||||
| 	end | 	end | ||||||
| 	 | 	 | ||||||
| 	if (weaponskillHandlers[command.actorId] ~= nil) then | 	if (weaponskillHandlers[command.Id] ~= nil) then | ||||||
| 		weaponskillHandlers[command.actorId](player); | 		weaponskillHandlers[command.Id](player); | ||||||
| 	else | 	else | ||||||
| 		player:SendMessage(0x20, "", "That weaponskill is not implemented yet."); | 		player:SendMessage(0x20, "", "That weaponskill is not implemented yet."); | ||||||
| 	end	 | 	end	 | ||||||
|   | |||||||
| @@ -6,7 +6,7 @@ Handles what happens when you resolve an invite to a group | |||||||
|  |  | ||||||
| --]] | --]] | ||||||
|  |  | ||||||
| function onEventStarted(player, actor, triggerName, groupType, result) | function onEventStarted(player, actor, eventType, eventName, groupType, result) | ||||||
|  |  | ||||||
| 	--Accept/Refuse happened, else just close the window | 	--Accept/Refuse happened, else just close the window | ||||||
| 	if (result == 1 or result == 2) then | 	if (result == 1 or result == 2) then | ||||||
|   | |||||||
| @@ -6,7 +6,7 @@ Handles what happens when you accept/refuse a trade | |||||||
|  |  | ||||||
| --]] | --]] | ||||||
|  |  | ||||||
| function onEventStarted(player, actor, triggerName, groupType, result) | function onEventStarted(player, actor, eventType, eventName, groupType, result) | ||||||
|  |  | ||||||
| 	--Accept | 	--Accept | ||||||
| 	if (result == 1) then | 	if (result == 1) then | ||||||
|   | |||||||
| @@ -13,8 +13,7 @@ loadTextData() | |||||||
| start(facility, requestsMode, material1, material2, material3, material4, material5, material6, material7, material8) | start(facility, requestsMode, material1, material2, material3, material4, material5, material6, material7, material8) | ||||||
| 	Desc: Opens the Craft Start widget, with any preloaded materials. Widget has two modes; one for normal synthesis and another | 	Desc: Opens the Craft Start widget, with any preloaded materials. Widget has two modes; one for normal synthesis and another | ||||||
| 		  for local leve "requested items" mode. | 		  for local leve "requested items" mode. | ||||||
|     Params: * facility/widgetMode   - The current facility id buff the player may have. After opening a recipe tab, start() has to be called with this | 	Params:	* facility		- The current facility id buff the player may have. | ||||||
|                                       set to -1. After the player chooses a recipe, start() has to be called with this set to -2. |  | ||||||
| 			* requestMode 	- If true, switches the UI to Requested Items mode otherwise it opens Normal Synthesis mode. | 			* requestMode 	- If true, switches the UI to Requested Items mode otherwise it opens Normal Synthesis mode. | ||||||
| 			* material1-8	- ItemID for each of the 8 material slots. If empty, they must be set to 0 or the client will crash. | 			* material1-8	- ItemID for each of the 8 material slots. If empty, they must be set to 0 or the client will crash. | ||||||
| 		 | 		 | ||||||
| @@ -22,9 +21,10 @@ closeCraftStartWidget() | |||||||
| 	Desc: Closes the Craft Start widget. | 	Desc: Closes the Craft Start widget. | ||||||
| 	Params: None | 	Params: None | ||||||
|  |  | ||||||
| selectRcp(item1, item2, item3, item4, item5, item6, item7, item8) | selectRcp(itemId) | ||||||
|     Desc:     Opens a recipe selection window. If one recipe is provided, automatically selects that recipe. | 	Desc: 	Selects the recipe to be crafted. May be a legacy function but still required to properly initialize the UI. Requires start() to have | ||||||
|     Params:    * itemId1-8                - The itemIDs to show in the list. If only one provided, select it. | 			been called. | ||||||
|  | 	Params:	* itemId 		- The itemID of the item to be crafted. | ||||||
| 	 | 	 | ||||||
| confirmRcp(craftedItem, quantity, crystalItem1, crystalQuantity1, crystalQuantity1, crystalItem2, crystalQuantity2, recommendedSkill, recommendedFacility) | confirmRcp(craftedItem, quantity, crystalItem1, crystalQuantity1, crystalQuantity1, crystalItem2, crystalQuantity2, recommendedSkill, recommendedFacility) | ||||||
| 	Desc: Opens the confirmation window, detailing what is needed and the item that will be created. Requires a selectRcp() call first. | 	Desc: Opens the confirmation window, detailing what is needed and the item that will be created. Requires a selectRcp() call first. | ||||||
| @@ -41,17 +41,6 @@ selectCraftQuest() | |||||||
| 	Desc: Opens the journal to select the local leve that the player would like to do. | 	Desc: Opens the journal to select the local leve that the player would like to do. | ||||||
| 	Params: None | 	Params: None | ||||||
|  |  | ||||||
| confirmLeve() |  | ||||||
| 	Desc: Opens the summery page for the local leve. |  | ||||||
| 	Params: * localLeveID			- |  | ||||||
| 			* craftedItem			- |  | ||||||
| 			* ? |  | ||||||
| 			* ? |  | ||||||
| 			* itemsCompleted		- |  | ||||||
| 			* remainingMaterials	- |  | ||||||
| 			* ? |  | ||||||
| 			* ? |  | ||||||
|  |  | ||||||
| askContinueLocalLeve(localLeveID, craftedItem, itemsCompleted, craftTotal, attempts) | askContinueLocalLeve(localLeveID, craftedItem, itemsCompleted, craftTotal, attempts) | ||||||
| 	Desc: Opens the dialog to continue crafting for a local leve after an item was completed. | 	Desc: Opens the dialog to continue crafting for a local leve after an item was completed. | ||||||
| 	Params: * localLeveID			- The id of the current leve in progress. | 	Params: * localLeveID			- The id of the current leve in progress. | ||||||
| @@ -79,7 +68,7 @@ craftCommandUI(classID, hasWait, command1, command2, command3, command4, command | |||||||
| 			* command1-5			- Five possible crafting commands (crafting skills). | 			* command1-5			- Five possible crafting commands (crafting skills). | ||||||
|  |  | ||||||
| craftTuningUI(command1, command2, command3, command4, command5, command6, command7, command8) | craftTuningUI(command1, command2, command3, command4, command5, command6, command7, command8) | ||||||
| 	Desc: Displays only the provided  commands for the "Double Down" phase that happens after crafting. | 	Desc: Displays a full list of commands for the legacy "Tuning" phase that happens after crafting. Deprecated in 1.23b. | ||||||
| 	Params: * command1-8			- The list of commands available. | 	Params: * command1-8			- The list of commands available. | ||||||
|  |  | ||||||
| updateInfo(progress, durability, quality, tuningItem, tuningItemQuality, tuningItemQuantity, hqChance) | updateInfo(progress, durability, quality, tuningItem, tuningItemQuality, tuningItemQuantity, hqChance) | ||||||
| @@ -100,6 +89,17 @@ cfmQst() | |||||||
| 	Desc: Quest confirmation window for when starting a crafting quest from the journal. | 	Desc: Quest confirmation window for when starting a crafting quest from the journal. | ||||||
| 	Params: | 	Params: | ||||||
|  |  | ||||||
|  | confirmLeve() | ||||||
|  | 	Desc: Opens the summery page for the local leve. | ||||||
|  | 	Params: * localLeveID			- The quest id of the leve you are confirming. | ||||||
|  | 			* difficulty			- Changes the objective. | ||||||
|  | 			* craftedItem?			- | ||||||
|  | 			* ?						- | ||||||
|  | 			* numSuccess			- The number of successful crafts you did. | ||||||
|  | 			* remainingMaterials	- The number of materials you have left. | ||||||
|  | 			* hasMaterials			- Shows the in-progress panel of successes and attempts left. | ||||||
|  | 			* ?						- | ||||||
|  |  | ||||||
| startRepair(craftMode, item, quality, durability, hasMateria, spiritbind) | startRepair(craftMode, item, quality, durability, hasMateria, spiritbind) | ||||||
| 	Desc: Opens the repair item widget. | 	Desc: Opens the repair item widget. | ||||||
| 	Params: * craftMode				- Either 0 or 1. Anything else crashes. | 	Params: * craftMode				- Either 0 or 1. Anything else crashes. | ||||||
| @@ -133,214 +133,289 @@ Class ID + Starting skill | |||||||
|  35 ALC = 22586 |  35 ALC = 22586 | ||||||
|  36 CUL = 22592 |  36 CUL = 22592 | ||||||
|  |  | ||||||
|  | Leve objectives/rewards are in passiveGL_craft. | ||||||
|  |  | ||||||
|  | * Index 1:  | ||||||
|  | * Index 2: Recommended Class | ||||||
|  | * Index 3: Issuing Authority | ||||||
|  | * Index 7: Levequest Location | ||||||
|  | * Index 8: Deliver Display Name | ||||||
|  | * Starts at index 14. Four sections for the four difficulties. | ||||||
|  | * Required Item, Amount, ?, Recommended Level, , Reward Item, Reward Amount, | | ||||||
|  |  | ||||||
| --]] | --]] | ||||||
|  |  | ||||||
| require ("global") | require ("global") | ||||||
|  |  | ||||||
|  | local skillAnim = { | ||||||
| skillAnim = { |  | ||||||
|     [22553] = 0x10002000; |     [22553] = 0x10002000; | ||||||
|     [22554] = 0x10001000; |     [22554] = 0x10001000; | ||||||
|     [22555] = 0x10003000; |     [22555] = 0x10003000; | ||||||
|     [29531] = 0x10009002; |     [29531] = 0x10009002; | ||||||
| } | } | ||||||
|  |  | ||||||
|  | local craftStartWidgetOpen = false; | ||||||
|  |  | ||||||
| materialSlots = {0,0,0,0,0,0,0,0};   -- The 8 slots | function onEventStarted(player, commandactor, eventType, eventName, arg1, arg2, arg3, arg4, checkedActorId) | ||||||
| recentRecipe = {10008205, 4030706, 4070009} -- Recent Recipe list |     local MENU_CANCEL, MENU_MAINHAND, MENU_OFFHAND, MENU_REQUEST = 0, 1, 2, 3; | ||||||
| awardedRecipe = {7020105, 7030011}          -- Awarded Recipe list |     local MENU_RECENT, MENU_AWARDED, MENU_RECENT_DETAILED, MENU_AWARDED_DETAILED = 7, 8, 9, 10; | ||||||
|      |      | ||||||
| materialRecipe = { -- Always 8 params because we can't have any nils here for "start" command |     local debugMessage = true; | ||||||
|     [6071007] = {4070402, 4070309,0,0,0,0,0,0}, |  | ||||||
|     [10008205] = {10008005,10008005,0,0,0,0,0,0}, |  | ||||||
|     [10009617] = {4040009, 4040010, 4040011,0,0,0,0,0}, |  | ||||||
|     [4070009] = {4070006, 10005401, 10008203,0,0,0,0,0}, |  | ||||||
|     [4070010] = {10008204,10008106,10005302,0,0,0,0,0} |  | ||||||
| } |  | ||||||
|  |  | ||||||
| materialQuest = { -- What a quest or leve will preload slots with, in addition to any extras the player does manual |     local isRecipeRecentSent = false; | ||||||
|     [0] = {0,0,0,0,0,0,0,0}, |     local isRecipeAwardSent = false; | ||||||
|     [1] = {0,0,0,0,0,0,0,0}, |  | ||||||
|     [110442] = {11000075, 11000074, 0, 0, 0, 0, 0, 0} |  | ||||||
| } |  | ||||||
| 	 | 	 | ||||||
|  | 	local craftJudge = GetStaticActor("CraftJudge"); | ||||||
|  |     local recipeResolver = GetRecipeResolver();	 | ||||||
|  |  | ||||||
| function onEventStarted(player, commandactor, triggerName, arg1, arg2, arg3, arg4, checkedActorId) | 	local operationResult; | ||||||
|  | 	local operationMode = -1; | ||||||
|  | 	local recipeMode = -1; | ||||||
|  | 	local chosenMaterials; | ||||||
| 	 | 	 | ||||||
|     MENU_CANCEL, MENU_MAINHAND, MENU_OFFHAND, MENU_REQUEST = 0, 1, 2, 3; | 	local facilityId = 0; | ||||||
|     MENU_RECIPE, MENU_AWARDED, MENU_RECIPE_DETAILED, MENU_AWARDED_DETAILED = 7, 8, 9, 10; |     local isRequestedItemsMode = false;  -- False = The default state.  True = User picked a quest recipe/local leve | ||||||
|  | 	local recentRecipes; | ||||||
|  | 	local awardedRecipes; | ||||||
| 	 | 	 | ||||||
|     debugMessage = false; |     local currentCraftQuest = nil;  -- Use this to store any chosen craft quest | ||||||
|  | 	local currentCraftQuestGuildleve = nil;  -- Use this to store any chosen local leve | ||||||
|     	 |     	 | ||||||
|     isRecipeRecentSent = false; |  | ||||||
|     isRecipeAwardSent = false; |  | ||||||
|     detailWindow = true; |  | ||||||
|     isRequested = false;  -- False = The default state.  True = User picked a quest recipe/local leve |  | ||||||
|     facilityId = 0; |  | ||||||
|     chosenQuest = 0;  -- Use this to store any chosen recipe/local leve |  | ||||||
|     recipeDetail = 0; |  | ||||||
|     detailWindowState = 0; |  | ||||||
|      |  | ||||||
| 	craftJudge = GetStaticActor("CraftJudge"); |  | ||||||
| 	callClientFunction(player, "delegateCommand", craftJudge, "loadTextData", commandactor);       | 	callClientFunction(player, "delegateCommand", craftJudge, "loadTextData", commandactor);       | ||||||
|  |  | ||||||
|     chosenOperation = -1; |  | ||||||
|     |  | ||||||
|  |  | ||||||
|     while chosenOperation ~= 0 do |  | ||||||
|          |  | ||||||
| 	player:ChangeState(30);  | 	player:ChangeState(30);  | ||||||
| 	 | 	 | ||||||
|         if debugMessage then player:SendMessage(0x20, "", "[DEBUG] Menu ID: "..tostring(chosenOperation).."   Recipe : "..tostring(recipeMode).."   Quest : "..chosenQuest); end | 	while operationMode ~= 0 do		 | ||||||
|          | 		-- Figure out the prepped materials. | ||||||
|          | 		local prepedMaterials = {0,0,0,0,0,0,0,0};		 | ||||||
|         if materialQuest[chosenQuest] then | 		-- Quest requested mode materials | ||||||
|             if debugMessage then player:SendMessage(0x20, "", "Key is valid: "..chosenQuest); end | 		if (isRequestedItemsMode == true) then | ||||||
|             materialSlots = materialQuest[chosenQuest]; | 			prepedMaterials = recipeResolver.RecipeToMatIdTable(currentCraftQuestGuildleve.getRecipe()); | ||||||
|  | 		-- Recent Recipes/Awarded recipes materials | ||||||
|  | 		elseif ((operationMode == MENU_RECENT or operationMode == MENU_AWARDED) and recipeMode != 0) then | ||||||
|  | 			if (operationMode == MENU_RECENT) then | ||||||
|  | 				prepedMaterials = recipeResolver.RecipeToMatIdTable(recentRecipes[recipeMode]); | ||||||
| 			else 			 | 			else 			 | ||||||
|             if debugMessage then player:SendMessage(0x20, "", "Key is not valid: "..chosenQuest); end | 				prepedMaterials = recipeResolver.RecipeToMatIdTable(awardedRecipes[recipeMode]); | ||||||
|  | 			end | ||||||
|         end		 |         end		 | ||||||
| 		 | 		 | ||||||
|  | 		-- Set this param correctly | ||||||
|  | 		local facilityIdParam = facilityId; | ||||||
|  | 		if ((operationMode == MENU_RECENT or operationMode == MENU_AWARDED) and recipeMode != 0) then | ||||||
|  | 			facilityIdParam = -2; | ||||||
|  | 		elseif (craftStartWidgetOpen == true) then | ||||||
|  | 			craftStartWidgetOpen = true; | ||||||
|  | 			facilityIdParam = -1; | ||||||
|  | 		end | ||||||
| 		 | 		 | ||||||
|         if isRecipeRecentSent == false then  -- If Recipe button not hit, aka default state. | 		-- Run start and grab the result operation/recipeMode/prepped | ||||||
|             chosenOperation, recipeMode = callClientFunction(player, "delegateCommand", craftJudge, "start", commandactor, facilityId, isRequested, unpack(materialSlots));  -- Initial window | 		operationResult = {callClientFunction(player, "delegateCommand", craftJudge, "start", commandactor, facilityIdParam, isRequestedItemsMode, unpack(prepedMaterials))};		 | ||||||
|  | 		operationMode = operationResult[1]; | ||||||
|  | 		recipeMode = operationResult[2]; | ||||||
| 				 | 				 | ||||||
|         elseif isRecipeRecentSent == true and recipeMode == 0 then -- If recipe window/award tab was hit |         if debugMessage then player:SendMessage(0x20, "", "[DEBUG] Menu ID: " .. tostring(operationMode) .. ", RecipeMode : " .. recipeMode); end       | ||||||
|             chosenOperation, recipeMode = callClientFunction(player, "delegateCommand", craftJudge, "start", commandactor, -1, isRequested, unpack(materialSlots));  -- Keep window going |  | ||||||
| 		 | 		 | ||||||
|         elseif isRecipeRecentSent == true and recipeMode > 0 then  -- If recipe item picked | 		-- Operation  | ||||||
|             if recipeDetail then  |         if operationMode == MENU_CANCEL then  | ||||||
|                 chosenOperation, recipeMode = callClientFunction(player, "delegateCommand", craftJudge, "start", commandactor, -2, isRequested, unpack(recipeDetail)); -- Item mat(s) for picked item. |             closeCraftStartWidget(player, craftJudge, commandactor); | ||||||
|  |         elseif (operationMode == MENU_MAINHAND or operationMode == MENU_OFFHAND) then  | ||||||
|  |             -- Recipe choosing loop | ||||||
|  | 			while (true) do			 | ||||||
|  | 				-- Figure out the number of preloaded mats | ||||||
|  | 				local materials = {}; | ||||||
|  | 				 | ||||||
|  | 				-- Handle the possible args returned: Either 0 player items, 1 player item, 2+ palyer items. The rest is always the remaining prepped items. | ||||||
|  | 				if (type(operationResult[3]) == "number") then | ||||||
|  | 					materials = {unpack(operationResult, 3)}; | ||||||
|  | 				elseif (type(operationResult[3]) ~= "number") then | ||||||
|  | 					for i=1,8 do | ||||||
|  | 						if (i - 1 <  operationResult[3].numItems) then | ||||||
|  | 							materials[i] = player:GetItemPackage(operationResult[3].itemPackages[i-1]):GetItemAtSlot(operationResult[3].itemSlots[i-1]).itemId; | ||||||
|  | 							player:SendMessage(0x20, "", "[DEBUG] " .. tostring(materials[i])); | ||||||
| 						else | 						else | ||||||
|                 chosenOperation, recipeMode = callClientFunction(player, "delegateCommand", craftJudge, "start", commandactor, -2, isRequested, 10009617,0,0,0,0,0,0,0); -- Show dummy info for unfilled item | 							materials[i] = operationResult[3 + (i - operationResult[3].numItems)]; | ||||||
|  | 							player:SendMessage(0x20, "", "[DEBUG] " .. tostring(materials[i])); | ||||||
|  | 						end								 | ||||||
| 					end | 					end | ||||||
| 				end				 | 				end				 | ||||||
| 				 | 				 | ||||||
|  | 				-- Choosing a recipe from the given materials | ||||||
|  | 				local recipes = recipeResolver.GetRecipeFromMats(unpack(materials));				 | ||||||
|  | 				local itemIds = recipeResolver.RecipesToItemIdTable(recipes); | ||||||
| 				 | 				 | ||||||
|         if chosenOperation == MENU_CANCEL then  | 				-- No recipes found | ||||||
|             callClientFunction(player, "delegateCommand", craftJudge, "closeCraftStartWidget", commandactor); | 				if (#itemIds == 0) then | ||||||
|              | 					player:SendGameMessage(GetWorldMaster(), 40201, 0x20); -- You cannot synthesize with those materials. | ||||||
|              | 					break; | ||||||
|         elseif (chosenOperation == MENU_MAINHAND or chosenOperation == MENU_OFFHAND) then  |  | ||||||
|              |  | ||||||
|             if isRequested == true then |  | ||||||
|                 recipeResult = callClientFunction(player, "delegateCommand", craftJudge, "selectRcp", commandactor, 10009617); |  | ||||||
|             else |  | ||||||
|                 recipeResult = callClientFunction(player, "delegateCommand", craftJudge, "selectRcp", commandactor, 10009617,6071007,5030112,5030007,10009617,6071007,5030112,5030007);   |  | ||||||
| 				end | 				end | ||||||
| 				 | 				 | ||||||
|             if recipeResult == 0 then -- Closed/Return hit. | 				local chosenRecipeIndex = callClientFunction(player, "delegateCommand", craftJudge, "selectRcp", commandactor, unpack(itemIds)); | ||||||
|                 callClientFunction(player, "delegateCommand", craftJudge, "closeCraftStartWidget", commandactor); |  | ||||||
|                 currentlyCrafting = -1; |  | ||||||
| 				 | 				 | ||||||
|             elseif (recipeResult >= 1 or recipeResult <= 8) then | 				-- Hit back on recipe list | ||||||
|                                                                                                 --item  yld, xstal1, qty,   xstal2, qty | 				if (chosenRecipeIndex <= 0) then break end; | ||||||
|                 recipeConfirmed = callClientFunction(player, "delegateCommand", craftJudge, "confirmRcp", commandactor, 10009617, 1, 0xF4247, 1, 0xf4245, 1, 0, 0);  | 					 | ||||||
|  | 				chosenRecipe = recipes[chosenRecipeIndex-1]; | ||||||
|  | 				 | ||||||
|  | 				if (chosenRecipe ~= nil) then                           | ||||||
|  | 					-- Player confirms recipe | ||||||
|  | 					local recipeConfirmed = callClientFunction(player, "delegateCommand", craftJudge, "confirmRcp", commandactor,  | ||||||
|  | 						chosenRecipe.resultItemID,  | ||||||
|  | 						chosenRecipe.resultQuantity,  | ||||||
|  | 						chosenRecipe.crystalId1,  | ||||||
|  | 						chosenRecipe.crystalQuantity1,  | ||||||
|  | 						chosenRecipe.crystalId2,  | ||||||
|  | 						chosenRecipe.crystalQuantity2,  | ||||||
|  | 						0,  | ||||||
|  | 						0);  | ||||||
|  |  | ||||||
| 					if recipeConfirmed then | 					if recipeConfirmed then | ||||||
|                     callClientFunction(player, "delegateCommand", craftJudge, "closeCraftStartWidget", commandactor); | 						closeCraftStartWidget(player, craftJudge, commandactor); | ||||||
|                     isRecipeRecentSent = false; |  | ||||||
|                     isRecipeAwardSent = false; |  | ||||||
|                     currentlyCrafting = startCrafting(player, chosenOperation, isRequested, 80, 100, 50);  |  | ||||||
|                 end |  | ||||||
|             end |  | ||||||
|  |  | ||||||
|         elseif chosenOperation == MENU_REQUEST then -- Conditional button label based on isRequested                  |  | ||||||
|             if isRequested == false then    -- "Request Items" hit, close Start and open up the Quest select |  | ||||||
|                 callClientFunction(player, "delegateCommand", craftJudge, "closeCraftStartWidget", commandactor); |  | ||||||
| 						isRecipeRecentSent = false; | 						isRecipeRecentSent = false; | ||||||
| 						isRecipeAwardSent = false; | 						isRecipeAwardSent = false; | ||||||
| 						 | 						 | ||||||
|                 local questConfirmed, returnedQuest = GetCraftQuest(player, craftjudge, commandactor); | 						-- CRAFTING STARTED | ||||||
|                 chosenQuest = tonumber(returnedQuest); | 						currentlyCrafting = startCrafting(player, commandactor, craftJudge, operationMode, chosenRecipe, currentCraftQuestGuildleve, 80, 100, 50);  | ||||||
| 						 | 						 | ||||||
|                 if debugMessage then player:SendMessage(0x20, "", "[DEBUG] Chosen Quest: "..tostring(chosenQuest)); end | 						--Once crafting is over, return to the original non-quest state. | ||||||
|  | 						isRequestedItemsMode = false; | ||||||
|  | 						currentCraftQuestGuildleve = nil;   | ||||||
|  | 						currentCraftQuest = nil;            | ||||||
| 						 | 						 | ||||||
|                 if questConfirmed then | 						break; | ||||||
|                     isRequested = true;    |  | ||||||
| 					end | 					end | ||||||
|              |  | ||||||
|                  |  | ||||||
|             elseif isRequested == true then -- "Normal Synthesis" button hit    |  | ||||||
|                 isRequested = false; |  | ||||||
|                 chosenQuest = 0; |  | ||||||
|                 callClientFunction(player, "delegateCommand", craftJudge, "closeCraftStartWidget", commandactor); |  | ||||||
|              |  | ||||||
| 				end | 				end | ||||||
|  | 			end | ||||||
|  | 			-- End of Recipe choosing loops | ||||||
|  |         elseif operationMode == MENU_REQUEST then -- Conditional button label based on isRequestedItemsMode  | ||||||
|  | 			closeCraftStartWidget(player, craftJudge, commandactor); | ||||||
| 				 | 				 | ||||||
|         elseif chosenOperation == MENU_RECIPE then -- "Recipes" button hit |             if isRequestedItemsMode == false then    -- "Request Items" hit, close Start and open up the Quest select                 | ||||||
|  |                 isRecipeRecentSent = false; | ||||||
|  |                 isRecipeAwardSent = false;                     | ||||||
|  |                  | ||||||
|  |                 local quest = getCraftQuest(player, craftJudge, commandactor); | ||||||
|  | 				if (quest ~= nil) then | ||||||
|  | 					isRequestedItemsMode = true; | ||||||
|  | 					if (quest.isCraftPassiveGuildleve()) then | ||||||
|  | 						currentCraftQuestGuildleve = quest; | ||||||
|  | 					else | ||||||
|  | 						currentCraftQuest = quest; | ||||||
|  | 					end | ||||||
|  | 				end | ||||||
|  |             elseif isRequestedItemsMode == true then -- "Normal Synthesis" button hit    | ||||||
|  |                 isRequestedItemsMode = false; | ||||||
|  |                 currentCraftQuestGuildleve = nil;   | ||||||
|  |                 currentCraftQuest = nil; | ||||||
|  |             end         | ||||||
|  |         elseif operationMode == MENU_RECENT then -- "Recipes" button hit | ||||||
|             if isRecipeRecentSent == false then |             if isRecipeRecentSent == false then | ||||||
|                 callClientFunction(player, "delegateCommand", craftJudge, "selectRcp", commandactor, unpack(recentRecipe)); -- Load up recipe list | 				recentRecipes = player.GetRecentRecipes(); | ||||||
|  | 				local itemIds = recipeResolver.RecipesToItemIdTable(recentRecipes); | ||||||
|  |                 callClientFunction(player, "delegateCommand", craftJudge, "selectRcp", commandactor, unpack(itemIds)); -- Load up recipe list | ||||||
|                 isRecipeRecentSent = true; |                 isRecipeRecentSent = true; | ||||||
|             end |             end | ||||||
|  |         elseif operationMode == MENU_AWARDED then -- "Awarded Recipes" tab hit   | ||||||
|             recipeDetail = materialRecipe[recentRecipe[recipeMode]]; |  | ||||||
|  |  | ||||||
|         elseif chosenOperation == MENU_AWARDED then -- "Awarded Recipes" tab hit   |  | ||||||
|             if isRecipeAwardSent == false then |             if isRecipeAwardSent == false then | ||||||
|                 callClientFunction(player, "delegateCommand", craftJudge, "selectRcp", commandactor, unpack(awardedRecipe)); -- Load up Award list | 				awardedRecipes = player.GetAwardedRecipes(); | ||||||
|  | 				local itemIds = recipeResolver.RecipesToItemIdTable(awardedRecipes); | ||||||
|  |                 callClientFunction(player, "delegateCommand", craftJudge, "selectRcp", commandactor, unpack(itemIds)); -- Load up Award list | ||||||
|                 isRecipeAwardSent = true; |                 isRecipeAwardSent = true; | ||||||
|             end |             end | ||||||
|  |         elseif ((operationMode == MENU_RECENT_DETAILED or operationMode == MENU_AWARDED_DETAILED) and recipeMode > 0) then -- Pop-up for an item's stats/craft mats on a recent recipe			 | ||||||
|  | 			local chosenRecipe = operationMode == MENU_RECENT_DETAILED and recentRecipes[recipeMode-1] or recentRecipes[awardedMode-1]; | ||||||
|  | 			local recipeConfirmed = callClientFunction(player, "delegateCommand", craftJudge, "confirmRcp", commandactor,  | ||||||
|  | 				chosenRecipe.resultItemID,  | ||||||
|  | 				chosenRecipe.resultQuantity,  | ||||||
|  | 				chosenRecipe.crystalId1,  | ||||||
|  | 				chosenRecipe.crystalQuantity1,  | ||||||
|  | 				chosenRecipe.crystalId2,  | ||||||
|  | 				chosenRecipe.crystalQuantity2,  | ||||||
|  | 				0,  | ||||||
|  | 				0); | ||||||
| 				 | 				 | ||||||
|             recipeDetail = materialRecipe[awardedRecipe[recipeMode]]; | 			-- This should never call? The window with this button only appears when you select a recent recipe with not enough materials. Otherwise it just auto-fills your "table". | ||||||
|            | 			if (recipeConfirmed) then | ||||||
|         elseif (chosenOperation == MENU_RECIPE_DETAILED or chosenOperation == MENU_AWARDED_DETAILED) and recipeMode > 0 then -- Pop-up for an item's stats/craft mats | 				closeCraftStartWidget(player, craftJudge, commandactor); | ||||||
|             detailWindowState = callClientFunction(player, "delegateCommand", craftJudge, "confirmRcp", commandactor, 10009617, 1, 0xF4247, 1, 0xf4245, 1, 0, 0); | 				isRecipeRecentSent = false; | ||||||
|  | 				isRecipeAwardSent = false; | ||||||
|  | 				currentlyCrafting = startCrafting(player, commandactor, craftJudge, operationMode, chosenRecipe, isRequestedItemsMode, 80, 100, 50); | ||||||
|  | 			end | ||||||
|         else |         else | ||||||
|             break; |             break; | ||||||
|         end |         end | ||||||
|     end	 |     end	 | ||||||
| 	 | 	 | ||||||
|     player:ChangeMusic(7); -- Need way to reset music back to the zone's default |     player:ResetMusic(); | ||||||
|     player:ChangeState(0); |     player:ChangeState(0); | ||||||
|     player:EndEvent();	 |     player:EndEvent();	 | ||||||
| 	 |  | ||||||
| end | end | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
| -- Handles the menus to pick a crafter quest or local leve quest that run separate widgets from the Start command. | -- Handles the menus to pick a crafter quest or local leve quest that run separate widgets from the Start command. | ||||||
| -- Returns whether a quest was selected, and what id the quest is. | -- Returns whether a quest was selected, and what id the quest is. | ||||||
| function GetCraftQuest(player, craftjudge, commandactor); | function getCraftQuest(player, craftJudge, commandactor); | ||||||
|  |     local questId = nil;	 | ||||||
| 	 | 	 | ||||||
|     local questOffset = 0xA0F00000; | 	while (true) do | ||||||
|     local questId = 0; | 		local questCommandId = callClientFunction(player, "delegateCommand", craftJudge, "selectCraftQuest", commandactor); | ||||||
|     local requestState = false;                   |  | ||||||
|     local requestedMenuChoice = callClientFunction(player, "delegateCommand", craftJudge, "selectCraftQuest", commandactor); |  | ||||||
| 		 | 		 | ||||||
|     if requestedMenuChoice then | 		if questCommandId then | ||||||
|         questId = requestedMenuChoice - questOffset; | 			questId = questCommandId - 0xA0F00000; | ||||||
| 			 | 			 | ||||||
|  | 			-- Craft Quest Chosen | ||||||
| 			if isCraftQuest(questId) then | 			if isCraftQuest(questId) then | ||||||
|             confirm = callClientFunction(player, "delegateCommand", craftJudge, "cfmQst", commandactor, questId, 20, 1, 1, 1, 0, 0, "<Path Companion>"); | 				local quest = player.GetQuest(questId);			 | ||||||
|              | 				local confirm = callClientFunction(player, "delegateCommand", craftJudge, "cfmQst", commandactor, quest.getQuestId(), 20, 1, 1, 1, 0, 0, "<Path Companion>");				 | ||||||
| 				if confirm == true then | 				if confirm == true then | ||||||
|                 requestState = true; |  | ||||||
| 					player:SendGameMessage(craftJudge, 21, 0x20); | 					player:SendGameMessage(craftJudge, 21, 0x20); | ||||||
|  | 					return quest; | ||||||
| 				end | 				end | ||||||
|              | 			-- PassiveGL Quest Chosen | ||||||
| 			elseif isLocalLeve(questId) then | 			elseif isLocalLeve(questId) then | ||||||
|             confirm = callClientFunction(player, "delegateCommand", craftJudge, "confirmLeve", commandactor, questId, 0, 8030421, 5, 50, 0, 0); | 				local difficulty = 0; | ||||||
|  | 				local hasMaterials = 1; | ||||||
| 				 | 				 | ||||||
|             if confirm == true then | 				local quest = player:getQuestGuildleve(questId); | ||||||
|                 requestState = true; | 				 | ||||||
|                 itemSlots = { unpack(materialRecipe[4070010])}; | 				if (quest ~= nil) then | ||||||
|  | 					-- Did they pickup the materials? | ||||||
|  | 					if (quest:hasMaterials() == false) then | ||||||
|  | 						player:SendGameMessage(GetWorldMaster(), 40210, 0x20); -- You have not obtained the proper materials from the client.						 | ||||||
|  | 					-- Did they use em all up? | ||||||
|  | 					elseif (quest:getRemainingMaterials() == 0) then | ||||||
|  | 						player:SendGameMessage(GetWorldMaster(), 40211, 0x20); -- You have used up all of the provided materials.			 | ||||||
|  | 					-- Confirm dialog | ||||||
|  | 					else | ||||||
|  | 						local confirm = callClientFunction(player, "delegateCommand", craftJudge, "confirmLeve", commandactor,  | ||||||
|  | 							quest:getQuestId(), | ||||||
|  | 							quest:getCurrentDifficulty() + 1, -- Lua, 1-indexed | ||||||
|  | 							0,  | ||||||
|  | 							quest:getCurrentCrafted(), | ||||||
|  | 							quest:getRemainingMaterials(), | ||||||
|  | 							quest:hasMaterials() and 1 or 0, -- Fucked up way of doing terneries on Lua  | ||||||
|  | 							0 | ||||||
|  | 						); | ||||||
|  |  | ||||||
|  | 						-- Quest confirmed | ||||||
|  | 						if (confirm == true) then | ||||||
|  | 							return quest; | ||||||
| 						end	 | 						end	 | ||||||
|  | 					end | ||||||
|         elseif isScenarioQuest(questId) == true then | 				else | ||||||
|  | 					return nil; -- Shouldn't happen unless db fucked with | ||||||
|  | 				end | ||||||
|  | 			-- Scenario Quest Chosen | ||||||
|  | 			else | ||||||
| 				-- TEMP for now. Cannot find source for what happens if you confirm a non-craft quest. | 				-- TEMP for now. Cannot find source for what happens if you confirm a non-craft quest. | ||||||
|            player:SendGameMessage(GetWorldMaster(), 40209, 0x20);  | 			   player:SendGameMessage(GetWorldMaster(), 40209, 0x20); -- You cannot undertake that endeavor. | ||||||
|  | 			end | ||||||
|  | 		else | ||||||
|  | 			return nil; | ||||||
| 		end | 		end | ||||||
| 	end | 	end | ||||||
|  |  | ||||||
|     return requestState, questId; |  | ||||||
| end | end | ||||||
|  |  | ||||||
|  |  | ||||||
| function isScenarioQuest(id) | function isScenarioQuest(id) | ||||||
|  |  | ||||||
|     if (id >= 110001 and id <= 120026) then |     if (id >= 110001 and id <= 120026) then | ||||||
|         return true; |         return true; | ||||||
|     else |     else | ||||||
| @@ -359,7 +434,6 @@ end | |||||||
|  |  | ||||||
|  |  | ||||||
| function isLocalLeve(id) | function isLocalLeve(id) | ||||||
|  |  | ||||||
|     if (id >= 120001 and id <= 120452) then |     if (id >= 120001 and id <= 120452) then | ||||||
|         return true; |         return true; | ||||||
|     else |     else | ||||||
| @@ -367,43 +441,54 @@ function isLocalLeve(id) | |||||||
|     end |     end | ||||||
| end | end | ||||||
|  |  | ||||||
|  | function closeCraftStartWidget(player, craftJudge, commandactor) | ||||||
|  | 	callClientFunction(player, "delegateCommand", craftJudge, "closeCraftStartWidget", commandactor); | ||||||
|  | 	craftStartWidgetOpen = false; | ||||||
|  | end | ||||||
|  |  | ||||||
| -- No real logic in this function.  Just smoke and mirrors to 'see' the minigame in action at the minimum level. | -- No real logic in this function.  Just smoke and mirrors to 'see' the minigame in action at the minimum level. | ||||||
| function startCrafting(player, hand, quest, startDur, startQly, startHQ) | function startCrafting(player, commandactor, craftJudge, hand, recipe, quest, startDur, startQly, startHQ) | ||||||
|      |      | ||||||
|     local worldMaster = GetWorldMaster(); |     local worldMaster = GetWorldMaster(); | ||||||
|     local craftProg = 0; |     local progress = 0; | ||||||
|     local attempts = 5; |     local attempts = 5; | ||||||
|     local craftedCount = 0; |     local craftedCount = 0; | ||||||
|     local craftTotal = 2; |     local craftTotal = 2; | ||||||
|     local itemId = 10009617; |  | ||||||
|      |      | ||||||
|     player:ChangeState(30+hand);  -- Craft kneeling w/ appropriate tool out |     player:ChangeState(30+hand);  -- Craft kneeling w/ appropriate tool out | ||||||
|     player:ChangeMusic(73); |     player:ChangeMusic(73); | ||||||
|     callClientFunction(player, "delegateCommand", craftJudge, "openCraftProgressWidget", commandactor, startDur, startQly, startHQ);  |     callClientFunction(player, "delegateCommand", craftJudge, "openCraftProgressWidget", commandactor, startDur, startQly, startHQ);  | ||||||
|  |  | ||||||
|     while true do  |     while (true) do      | ||||||
|      |         local progDiff = math.random(30,50); | ||||||
|         local progDiff = math.random(25,25); |  | ||||||
|         local duraDiff = math.random(1,3); |         local duraDiff = math.random(1,3); | ||||||
|         local qltyDiff = math.random(0,2); |         local qltyDiff = math.random(0,2); | ||||||
|  |  | ||||||
|         if craftProg >= 100 then |         if (progress >= 100) then             | ||||||
|          |  | ||||||
|             testChoice2 = callClientFunction(player, "delegateCommand", craftJudge, "updateInfo", commandactor,  100, 10, 20, 5020111, 69, 70, 75); |  | ||||||
|              |  | ||||||
|             -- From Lodestone: If the HQ odds are 1% or better, players will have the option of selecting either Finish or Double Down.  |  | ||||||
|             -- By electing to double down, the player takes a chance on creating an HQ item at the risk of losing the completed item if the attempt fails |  | ||||||
|             testChoice = callClientFunction(player, "delegateCommand", craftJudge, "craftTuningUI", commandactor, 22503, 22504); |  | ||||||
|              |  | ||||||
|             player:SendGameMessage(GetWorldMaster(), 40111, 0x20, player, itemId, 3, 8);  -- "You create <#3 quantity> <#1 item> <#2 quality>." |  | ||||||
|             callClientFunction(player, "delegateCommand", craftJudge, "closeCraftProgressWidget", commandactor); |             callClientFunction(player, "delegateCommand", craftJudge, "closeCraftProgressWidget", commandactor); | ||||||
|              |              | ||||||
|  | 			-- Handle local levequest craft success | ||||||
|             if quest then	 |             if quest then	 | ||||||
|                 continueLeve = callClientFunction(player, "delegateCommand", craftJudge, "askContinueLocalLeve", 120001, itemId, craftedCount, craftTotal, attempts); | 				quest:craftSuccess(); | ||||||
| 				 | 				 | ||||||
|                 if continueLeve == true then | 				if (quest:getCurrentCrafted() >= quest:getObjectiveQuantity()) then | ||||||
|                     craftProg = 0; | 					attentionMessage(player, 40121, quest:getQuestId(), quest:getCurrentCrafted(), quest:getObjectiveQuantity()); -- "All items for <QuestId> complete!" | ||||||
|  | 				else | ||||||
|  | 					attentionMessage(player, 40119, quest:getQuestId(), quest:getCurrentCrafted(), quest:getObjectiveQuantity()); -- "<QuestId> Successfull. (<crafted> of <attempts>)" | ||||||
|  | 				end | ||||||
|  | 			 | ||||||
|  | 				-- Continue local levequest  (should this be in here??) | ||||||
|  | 				if (quest:getRemainingMaterials() ~= 0) then | ||||||
|  | 					continueLeve = callClientFunction(player, "delegateCommand", craftJudge, "askContinueLocalleve", commandactor, | ||||||
|  | 						quest:getQuestId(), | ||||||
|  | 						quest:getRecipe().resultItemID,  | ||||||
|  | 						quest:getCurrentCrafted(), | ||||||
|  | 						quest:getObjectiveQuantity(),  | ||||||
|  | 						quest:getRemainingMaterials() | ||||||
|  | 					); | ||||||
|  |  | ||||||
|  | 					if (continueLeve == 1) then | ||||||
|  | 						progress = 0; | ||||||
| 						callClientFunction(player, "delegateCommand", craftJudge, "openCraftProgressWidget", commandactor, startDur, startQly, startHQ); | 						callClientFunction(player, "delegateCommand", craftJudge, "openCraftProgressWidget", commandactor, startDur, startQly, startHQ); | ||||||
| 					else | 					else | ||||||
| 						break; | 						break; | ||||||
| @@ -411,14 +496,18 @@ function startCrafting(player, hand, quest, startDur, startQly, startHQ) | |||||||
| 				else | 				else | ||||||
| 					break; | 					break; | ||||||
| 				end				 | 				end				 | ||||||
|  | 			-- Normal synth craft success | ||||||
|  |             else                 | ||||||
|  | 				player:SendGameMessage(GetWorldMaster(), 40111, 0x20, player, recipe.resultItemID, 1, recipe.resultQuantity);  -- "You create <#3 quantity> <#1 item> <#2 quality>."				 | ||||||
|  | 				player:getItemPackage(location):addItem(recipe.resultItemID, recipe.resultQuantity, 1); | ||||||
|  | 				break; | ||||||
|  |             end | ||||||
|         end		 |         end		 | ||||||
|          |          | ||||||
|         choice = callClientFunction(player, "delegateCommand", craftJudge, "craftCommandUI", commandactor, 29, 2, 29530,29531,29532,29533,29534); |         choice = callClientFunction(player, "delegateCommand", craftJudge, "craftCommandUI", commandactor, 29, 2, 29530,29531,29532,29533,29534); | ||||||
|         --player:SendMessage(0x20, "", "[DEBUG] Command id selected: "..choice); |         --player:SendMessage(0x20, "", "[DEBUG] Command id selected: "..choice); | ||||||
|                  |                  | ||||||
|  |         if (choice) then | ||||||
|          |  | ||||||
|         if choice then |  | ||||||
|              |              | ||||||
|             if skillAnim[choice] then |             if skillAnim[choice] then | ||||||
|                 player:PlayAnimation(skillAnim[choice]); |                 player:PlayAnimation(skillAnim[choice]); | ||||||
| @@ -428,11 +517,11 @@ function startCrafting(player, hand, quest, startDur, startQly, startHQ) | |||||||
|  |  | ||||||
|             player:SendGameMessage(worldMaster, 40108, 0x20, choice,2); |             player:SendGameMessage(worldMaster, 40108, 0x20, choice,2); | ||||||
|              |              | ||||||
|             if choice ~= 29531 then |             if (choice ~= 29531) then | ||||||
|                 craftProg = craftProg + progDiff; |                 progress = progress + progDiff; | ||||||
|                  |                  | ||||||
|                 if craftProg >= 100 then  |                 if (progress >= 100) then  | ||||||
|                     craftProg = 100; |                     progress = 100; | ||||||
|                 end |                 end | ||||||
|                  |                  | ||||||
|                 startDur = startDur - duraDiff; |                 startDur = startDur - duraDiff; | ||||||
| @@ -443,12 +532,9 @@ function startCrafting(player, hand, quest, startDur, startQly, startHQ) | |||||||
|                 player:SendGameMessage(worldMaster, 40104, 0x20, qltyDiff); |                 player:SendGameMessage(worldMaster, 40104, 0x20, qltyDiff); | ||||||
|             end |             end | ||||||
|                                                                                                           --prg  dur  qly, ???, ???, ???,   HQ |                                                                                                           --prg  dur  qly, ???, ???, ???,   HQ | ||||||
|             callClientFunction(player, "delegateCommand", craftJudge, "updateInfo", commandactor, craftProg, startDur, startQly, nil, nil, nil, nil, nil); |             callClientFunction(player, "delegateCommand", craftJudge, "updateInfo", commandactor, progress, startDur, startQly, nil, nil, nil, nil, nil); | ||||||
|              |              | ||||||
|  |             --testChoice = callClientFunction(player, "delegateCommand", craftJudge, "craftTuningUI", commandactor, 29501, 24233, 29501,29501, 24223, 29501,12008,12004); | ||||||
|         end |         end | ||||||
|     end |     end | ||||||
|  |  | ||||||
|     return -1;  |  | ||||||
| end | end | ||||||
|  |  | ||||||
|  |  | ||||||
|   | |||||||
| @@ -1,5 +1,5 @@ | |||||||
| function onEventStarted(player, command, triggerName, arg1, arg2, arg3, arg4, targetActor, arg5, arg6, arg7, arg8) | function onEventStarted(player, command, eventType, eventName, arg1, arg2, arg3, arg4, targetActor, arg5, arg6, arg7, arg8) | ||||||
| 	player.Cast(command.actorId, targetActor); | 	player.Cast(command.Id, targetActor); | ||||||
|      |      | ||||||
| 	player:endEvent(); | 	player:endEvent(); | ||||||
| end | end | ||||||
| @@ -1,5 +1,5 @@ | |||||||
| function onEventStarted(player, command, triggerName, arg1, arg2, arg3, arg4, targetActor, arg5, arg6, arg7, arg8) | function onEventStarted(player, command, eventType, eventName, arg1, arg2, arg3, arg4, targetActor, arg5, arg6, arg7, arg8) | ||||||
| 	player.Cast(command.actorId, targetActor); | 	player.Cast(command.Id, targetActor); | ||||||
|      |      | ||||||
| 	player:endEvent(); | 	player:endEvent(); | ||||||
| end | end | ||||||
| @@ -9,7 +9,7 @@ Finds the correct weaponskill subscript to fire when a weaponskill actor is acti | |||||||
|  |  | ||||||
| --]] | --]] | ||||||
|  |  | ||||||
| function onEventStarted(player, command, triggerName, arg1, arg2, arg3, arg4, targetActor, arg5, arg6, arg7, arg8) | function onEventStarted(player, command, eventType, eventName, arg1, arg2, arg3, arg4, targetActor, arg5, arg6, arg7, arg8) | ||||||
| 	 | 	 | ||||||
| 	--Are they in active mode? | 	--Are they in active mode? | ||||||
| 	if (player:GetState() != 2) then | 	if (player:GetState() != 2) then | ||||||
| @@ -21,6 +21,6 @@ function onEventStarted(player, command, triggerName, arg1, arg2, arg3, arg4, ta | |||||||
|     if not player.aiContainer.IsEngaged() then |     if not player.aiContainer.IsEngaged() then | ||||||
|         player.Engage(targetActor); |         player.Engage(targetActor); | ||||||
|     end; |     end; | ||||||
|     player.WeaponSkill(command.actorId, targetActor); |     player.WeaponSkill(command.Id, targetActor); | ||||||
| 	player:endEvent(); | 	player:endEvent(); | ||||||
| end; | end; | ||||||
| @@ -4,7 +4,7 @@ DiceCommand Script | |||||||
|  |  | ||||||
| --]] | --]] | ||||||
|  |  | ||||||
| function onEventStarted(player, actor, triggerName, maxNumber)	 | function onEventStarted(player, actor, eventType, eventName, maxNumber)	 | ||||||
| 	 | 	 | ||||||
| 	if (maxNumber == nil or maxNumber > 1000 or maxNumber < 1) then | 	if (maxNumber == nil or maxNumber > 1000 or maxNumber < 1) then | ||||||
| 		maxNumber = 100; | 		maxNumber = 100; | ||||||
|   | |||||||
| @@ -63,66 +63,58 @@ rangeInputWidget() | |||||||
|             * goodMax |             * goodMax | ||||||
|             * bool  |             * bool  | ||||||
|  |  | ||||||
|              |  | ||||||
| Notes: |  | ||||||
|             * Aim = Where on the aim gauge the player chose. |  | ||||||
|             * Remainder = How many attempts you get on the section portion of the minigame |  | ||||||
|             * Sweetspot = Where you hit on the second portion of the minigame |  | ||||||
| --]] | --]] | ||||||
|  |  | ||||||
| minerAnim = {0x14001000, 0x14002000, 0x14003000}; | minerAnim = {0x14001000, 0x14002000, 0x14003000}; | ||||||
|  |  | ||||||
| --[[ Mooglebox - Aim | --[[Mooglebox - Aim | ||||||
| +5  +4  +3  +2  +1   0  -1  -2  -3  -4   -5 | +5 = 0 | ||||||
|  0  10  20  30  40  50  60  70  80  90  100 | +4 = 10 | ||||||
|  | +3 = 20 | ||||||
|  | +2 = 30 | ||||||
|  | +1 = 40 | ||||||
|  |  0 = 50 | ||||||
|  | -1 = 60 | ||||||
|  | -2 = 70  | ||||||
|  | -3 = 80 | ||||||
|  | -4 = 90 | ||||||
|  | -5 = 100   | ||||||
|  |  | ||||||
| Sweetspots   1=10  2=30  3=70  4=100 for Mining | Sweetspots   1=10  2=30  3=70  4=100 for Mining | ||||||
| Remainder    A=40  B=60  C=70  D=80 | remainder    A=40  B=60  C=70  D=80 | ||||||
| --]] | --]] | ||||||
|  |  | ||||||
|  |  | ||||||
| harvestNodeContainer = { -- nodeGrade, harvestAttempts, #ofItemsBecauseICantIntoIpairs, Item1, Item2, etc | nodeContainer = { -- harvestAttempts, #ofItemsBecauseLuaIsShitAtTableLength, Item1, Item2, etc | ||||||
|     [1001] = {2, 2, 3, 1, 2, 3}, |     [1] = {4, 3, 1, 2, 3} | ||||||
|     [1002] = {2, 4, 5, 3005, 3003, 3002, 3001, 3004} |  | ||||||
| } | } | ||||||
|  |  | ||||||
| harvestNodeItems = {  | nodeItems = {  | ||||||
|         --itemId, remainder, aim, sweetspot, max yield |         --itemId, remainder, aim, sweetspot, max yield | ||||||
|    [1] = {10009104, 70, 30, 30, 4}, -- Rock Salt |    [1] = {10009104, 70, 30, 30, 4}, -- Rock Salt | ||||||
|    [2] = {10006001, 80, 10, 30, 4}, -- Bone Chip |    [2] = {10006001, 80, 10, 30, 4}, -- Bone Chip | ||||||
|     [3] = {10001006, 80, 20, 30, 3},  -- Copper Ore |    [3] = {10001006, 80, 20, 30, 3}  -- Copper Ore | ||||||
|     [3001] = {10001003, 80, 50, 30, 3}, |  | ||||||
|     [3002] = {10001006, 70, 70, 10, 4}, |  | ||||||
|     [3003] = {10001005, 80, 90, 70, 1}, |  | ||||||
|     [3004] = {10009104, 40, 10, 100, 2}, |  | ||||||
|     [3005] = {10001007, 40,  0, 30, 1} |  | ||||||
|     |  | ||||||
| } | } | ||||||
|  |  | ||||||
|  |  | ||||||
| require ("global") | require ("global") | ||||||
|  |  | ||||||
| function onEventStarted(player, commandActor, triggerName, arg1, arg2, arg3, arg4, checkedActorId) | function onEventStarted(player, commandActor, eventType, eventName, arg1, arg2, arg3, arg4, checkedActorId) | ||||||
|  |  | ||||||
|     debugMsg = false; |     debugMsg = false; | ||||||
|      |      | ||||||
|     powerCurrent = 0; |  | ||||||
|     powerLast = 0; |  | ||||||
|     powerRange = 10;    -- 'Feels' look a good amount compared to vids/ARR's minigame. |  | ||||||
|      |  | ||||||
|     showTutorial = 0; |  | ||||||
|      |  | ||||||
|     commandMine = 22002; |     commandMine = 22002; | ||||||
|     commandLog = 22003; |     commandLog = 22003; | ||||||
|     commandFish = 22004; |     commandFish = 22004; | ||||||
|  |     remainderA, remainderB, remainderC, remainderD = 40, 60, 70, 80; | ||||||
|     harvestNodeId = 1001; -- What the server should send eventually |  | ||||||
|     harvestNode = BuildHarvestNode(player, harvestNodeId);  -- [1-11] = {itemId, remainder, sweetspot, maxYield} |  | ||||||
|     harvestGrade = harvestNodeContainer[harvestNodeId][1] or 0; |  | ||||||
|     harvestAttempts = harvestNodeContainer[harvestNodeId][2] or 0; |  | ||||||
|     nodeRemainder = 0; |  | ||||||
|  |  | ||||||
|      |      | ||||||
|  |     currentPower = 0; | ||||||
|  |     nodeGrade = 3; | ||||||
|  |     showTutorial = 0; | ||||||
|  |     harvestAttempts = 2; | ||||||
|  |     nodeRemainder = remainderC; | ||||||
|  |     item = 10001006; | ||||||
|      |      | ||||||
|     harvestType = commandMine; |     harvestType = commandMine; | ||||||
|      |      | ||||||
| @@ -137,9 +129,9 @@ function onEventStarted(player, commandActor, triggerName, arg1, arg2, arg3, arg | |||||||
|      |      | ||||||
|      |      | ||||||
|     if harvestType == commandMine then |     if harvestType == commandMine then | ||||||
|         player:SendGameMessage(harvestJudge, 26, MESSAGE_TYPE_SYSTEM, 1, harvestGrade); |         player:SendGameMessage(harvestJudge, 26, MESSAGE_TYPE_SYSTEM, 1, nodeGrade); | ||||||
|          |          | ||||||
|         callClientFunction(player, "delegateCommand", harvestJudge, "openInputWidget", commandActor, harvestType, harvestGrade); |         callClientFunction(player, "delegateCommand", harvestJudge, "openInputWidget", commandActor, harvestType, nodeGrade); | ||||||
|         callClientFunction(player, "delegateCommand", harvestJudge, "orderInputWidget", commandActor, nodeRemainder, nil, harvestType); |         callClientFunction(player, "delegateCommand", harvestJudge, "orderInputWidget", commandActor, nodeRemainder, nil, harvestType); | ||||||
|         callClientFunction(player, "delegateCommand", harvestJudge, "textInputWidget", commandActor, harvestType, harvestJudge, nil, 0, 0, 0, 0); |         callClientFunction(player, "delegateCommand", harvestJudge, "textInputWidget", commandActor, harvestType, harvestJudge, nil, 0, 0, 0, 0); | ||||||
|  |  | ||||||
| @@ -147,42 +139,22 @@ function onEventStarted(player, commandActor, triggerName, arg1, arg2, arg3, arg | |||||||
|          |          | ||||||
|         while harvestAttempts > 0 do |         while harvestAttempts > 0 do | ||||||
|          |          | ||||||
|             -- "Aim", 0 = Top of bar, 100 = Bottom. |             -- "Aim", 0 = Top of bar, 100 = Bottom.     Mooglebox conversion is +5 = 0, 0 = 50, -5 = 100 | ||||||
|             menuResult, sliderPhase, unk3 = callClientFunction(player, "delegateCommand", harvestJudge, "askInputWidget", commandActor, harvestType, 1, showTutorial, false, false, nil, false);  |             menuResult, sliderPhase, ret3 = callClientFunction(player, "delegateCommand", harvestJudge, "askInputWidget", commandActor, harvestType, 1, showTutorial, false, false, nil, false);  | ||||||
|             if debugMsg then player:SendMessage(0x20, "", "menuResult: "..tostring(menuResult).." sliderPhase: "..tostring(sliderPhase).." Unk: "..tostring(unk3)); end |  | ||||||
|  |             if debugMsg then player:SendMessage(0x20, "", tostring(menuResult).." unk: "..tostring(sliderPhase).." unk: "..tostring(ret3)); end | ||||||
|          |          | ||||||
|             if menuResult == 22701 then     -- Begin. |             if menuResult == 22701 then     -- Begin. | ||||||
|  |                 player:SendGameMessage(harvestJudge, 36, MESSAGE_TYPE_SYSTEM); | ||||||
|                 local aimSlot = (sliderPhase/10)+1; -- Thanks LUA index = 1 |                 nodeRemainder = remainderC; | ||||||
|                  |  | ||||||
|                 local nodeDetails = harvestNode[aimSlot]; |  | ||||||
|                 local nodeItem = nodeDetails[1]; |  | ||||||
|                 local nodeRemainder = nodeDetails[2]; |  | ||||||
|                 local nodeSweetspot = nodeDetails[3]; |  | ||||||
|                 local nodeYield = nodeDetails[4]; |  | ||||||
|                 local isFirstSwing = true; |  | ||||||
|                  |  | ||||||
|                 local sweetspotDifference; |  | ||||||
|                 local sweetspotDifferencePrevious; |  | ||||||
|                  |  | ||||||
|                 if debugMsg then  |  | ||||||
|                     player:SendMessage(0x20, "", "aimSlot: "..(aimSlot).."   itemId:"..tostring(nodeDetails[1]).." remainder: "..tostring(nodeDetails[2])); |  | ||||||
|                 end |  | ||||||
|          |  | ||||||
|                  |  | ||||||
|                 player:SendGameMessage(harvestJudge, 36, MESSAGE_TYPE_SYSTEM); -- "You set your sights on an area." |  | ||||||
|  |  | ||||||
|  |  | ||||||
|                  |  | ||||||
|                 callClientFunction(player, "delegateCommand", harvestJudge, "orderInputWidget", commandActor, nodeRemainder, nil, harvestType); |                 callClientFunction(player, "delegateCommand", harvestJudge, "orderInputWidget", commandActor, nodeRemainder, nil, harvestType); | ||||||
|                  |                  | ||||||
|                 while true do |                 while true do | ||||||
|                     callClientFunction(player, "delegateCommand", harvestJudge, "textInputWidget", commandActor, harvestType, harvestJudge, nil, 0, 0, 0, 0); |  | ||||||
|                      |                      | ||||||
|                     -- "Strike" 0 = Empty, 100 = Filled.   Mooglebox sweespots are 1=10, 2=30, 3=70, 4=100 for Mining |                     -- "Strike" 0 = Empty, 100 = Filled.   Mooglebox sweespots are 1=10, 2=30, 3=70, 4=100 for Mining | ||||||
|                     chosenCommand, powerCurrent = callClientFunction(player, "delegateCommand", harvestJudge, "askInputWidget", commandActor, harvestType, 2, showTutorial, false, false, nil, false); -- Strike |                     chosenCommand, currentPower = callClientFunction(player, "delegateCommand", harvestJudge, "askInputWidget", commandActor, harvestType, 2, showTutorial, false, false, nil, false); -- Strike | ||||||
|      |      | ||||||
|                     if debugMsg then player:SendMessage(0x20, "", tostring(chosenCommand).." Power: "..tostring(powerCurrent)); end |                     if debugMsg then player:SendMessage(0x20, "", tostring(chosenCommand).." Power: "..tostring(currentPower)); end | ||||||
|                      |                      | ||||||
|                      |                      | ||||||
|                     if chosenCommand == 22702 then      -- Cancel. |                     if chosenCommand == 22702 then      -- Cancel. | ||||||
| @@ -196,63 +168,22 @@ function onEventStarted(player, commandActor, triggerName, arg1, arg2, arg3, arg | |||||||
|                             player:SendGameMessage(player, worldMaster, 40339, 0x20, harvestAttempts); |                             player:SendGameMessage(player, worldMaster, 40339, 0x20, harvestAttempts); | ||||||
|                         end |                         end | ||||||
|                         break; |                         break; | ||||||
|                          |  | ||||||
|                     elseif chosenCommand == 22703 then  -- Strike. |                     elseif chosenCommand == 22703 then  -- Strike. | ||||||
|                      |                      | ||||||
|  |                         player:PlayAnimation(minerAnim[math.random(1,3)]); | ||||||
|                      |                      | ||||||
|                         nodeRemainder = nodeRemainder - 20; |                         nodeRemainder = nodeRemainder - 20; | ||||||
|                         if nodeRemainder < 0 then  |                         if nodeRemainder < 0 then  | ||||||
|                             nodeRemainder = 0;   |                             nodeRemainder = 0;   | ||||||
|                         end |                         end | ||||||
|                          |                          | ||||||
|                         callClientFunction(player, "delegateCommand", harvestJudge, "textInputWidget", commandActor, harvestType, harvestJudge, nil, 0, 0, 0, 0); |  | ||||||
|                          |  | ||||||
|                         player:PlayAnimation(minerAnim[math.random(1,3)]); |  | ||||||
|                         wait(2); |  | ||||||
|                         sweetspotDifference = math.abs(powerCurrent - nodeSweetspot); |  | ||||||
|                         |                         | ||||||
|  |  | ||||||
|                         if powerRange >= sweetspotDifference then |                         --player:SendGameMessage(harvestJudge, 25, MESSAGE_TYPE_SYSTEM, item, 4, 1); | ||||||
|                         callClientFunction(player, "delegateCommand", harvestJudge, "orderInputWidget", commandActor, nodeRemainder, false, harvestType); |                         callClientFunction(player, "delegateCommand", harvestJudge, "orderInputWidget", commandActor, nodeRemainder, false, harvestType); | ||||||
|                          |                          | ||||||
|                             -- "You obtain <yield> <item> <quality>" |  | ||||||
|                             callClientFunction(player, "delegateCommand", harvestJudge, "textInputWidget", commandActor, harvestType, harvestJudge, 25, nodeItem, 0, nodeYield, 0); |  | ||||||
|                              |  | ||||||
|                             player:SendGameMessage(player, worldMaster, 40301, MESSAGE_TYPE_SYSTEM, player, nodeItem, nodeYield); -- TODO: Refer to caps to see wtf is going on here |  | ||||||
|                              |  | ||||||
|                              |  | ||||||
|                             HarvestReward(player, nodeItem, nodeYield); |  | ||||||
|                             nodeRemainder = 0; |  | ||||||
|                         else |  | ||||||
|                             if isFirstSwing then |  | ||||||
|                                 if sweetspotDifference < 19 then  -- TODO: TWEAK THESE, likely need to be larger |  | ||||||
|                                     callClientFunction(player, "delegateCommand", harvestJudge, "textInputWidget", commandActor, harvestType, harvestJudge, 45); |  | ||||||
|                                     player:SendGameMessage(harvestJudge, 45, MESSAGE_TYPE_SYSTEM); -- "You feel something promising." |  | ||||||
|                                 elseif sweetspotDifference > 20 then |  | ||||||
|                                     callClientFunction(player, "delegateCommand", harvestJudge, "textInputWidget", commandActor, harvestType, harvestJudge, 42); |  | ||||||
|                                     player:SendGameMessage(harvestJudge, 42, MESSAGE_TYPE_SYSTEM); -- "You feel nothing promising." |  | ||||||
|                                 end |  | ||||||
|                             else |  | ||||||
|                                 if sweetspotDifference > sweetspotDifferencePrevious then |  | ||||||
|                                     callClientFunction(player, "delegateCommand", harvestJudge, "textInputWidget", commandActor, harvestType, harvestJudge, 43); |  | ||||||
|                                     player:SendGameMessage(harvestJudge, 43, MESSAGE_TYPE_SYSTEM); -- "You are getting farther from the mark." |  | ||||||
|                           |  | ||||||
|                                 elseif  sweetspotDifference < sweetspotDifferencePrevious then |  | ||||||
|                                     callClientFunction(player, "delegateCommand", harvestJudge, "textInputWidget", commandActor, harvestType, harvestJudge, 44); |  | ||||||
|                                     player:SendGameMessage(harvestJudge, 44, MESSAGE_TYPE_SYSTEM); -- "You are getting closer to the mark."    |  | ||||||
|                                 else |  | ||||||
|                                     callClientFunction(player, "delegateCommand", harvestJudge, "textInputWidget", commandActor, harvestType, harvestJudge, 42); |  | ||||||
|                                     player:SendGameMessage(harvestJudge, 42, MESSAGE_TYPE_SYSTEM); -- "You feel nothing promising."   |  | ||||||
|                                 end |  | ||||||
|                             end        |  | ||||||
|                         end |  | ||||||
|                          |  | ||||||
|                         if not isFirstSwing then |  | ||||||
|                             powerLast = powerCurrent; |  | ||||||
|                         end; |  | ||||||
|  |  | ||||||
|                         callClientFunction(player, "delegateCommand", harvestJudge, "orderInputWidget", commandActor, nodeRemainder, false, harvestType); |  | ||||||
|                          |                          | ||||||
|  |                         callClientFunction(player, "delegateCommand", harvestJudge, "textInputWidget", commandActor, harvestType, harvestJudge, 25, item, 4, 1, 0); | ||||||
|                      |                      | ||||||
|                         if nodeRemainder == 0 then |                         if nodeRemainder == 0 then | ||||||
|                             harvestAttempts = harvestAttempts - 1; |                             harvestAttempts = harvestAttempts - 1; | ||||||
| @@ -262,7 +193,6 @@ function onEventStarted(player, commandActor, triggerName, arg1, arg2, arg3, arg | |||||||
|                                 player:SendGameMessage(player, worldMaster, 40344, 0x20, harvestAttempts); |                                 player:SendGameMessage(player, worldMaster, 40344, 0x20, harvestAttempts); | ||||||
|                             else |                             else | ||||||
|                                 -- There is nothing left to gather at this location. |                                 -- There is nothing left to gather at this location. | ||||||
|                                 player:ChangeMusic(101); |  | ||||||
|                                 player:SendGameMessage(player, worldMaster, 40339, 0x20, harvestAttempts); |                                 player:SendGameMessage(player, worldMaster, 40339, 0x20, harvestAttempts); | ||||||
|                             end   |                             end   | ||||||
|                          |                          | ||||||
| @@ -270,12 +200,6 @@ function onEventStarted(player, commandActor, triggerName, arg1, arg2, arg3, arg | |||||||
|                             break; |                             break; | ||||||
|                         end |                         end | ||||||
|                      |                      | ||||||
|                          |  | ||||||
|                         if isFirstSwing and debugMsg then player:SendMessage(0x20, "", "First swing"); end |  | ||||||
|                          |  | ||||||
|                         isFirstSwing = false; |  | ||||||
|                         sweetspotDifferencePrevious = sweetspotDifference;  |  | ||||||
|                          |  | ||||||
|                     elseif chosenCommand == 22710 then -- "Strike" Tutorial.                     |                     elseif chosenCommand == 22710 then -- "Strike" Tutorial.                     | ||||||
|                         SendTutorial(player, harvestJudge, 2); |                         SendTutorial(player, harvestJudge, 2); | ||||||
|                     end |                     end | ||||||
| @@ -295,12 +219,8 @@ function onEventStarted(player, commandActor, triggerName, arg1, arg2, arg3, arg | |||||||
|      |      | ||||||
|     end |     end | ||||||
|      |      | ||||||
|     player:SendGameMessage(harvestJudge, 31, MESSAGE_TYPE_SYSTEM); |  | ||||||
|      |  | ||||||
|      |  | ||||||
|     if harvestAttempts == 0 then |     if harvestAttempts == 0 then | ||||||
|         player:SendGameMessage(player, worldMaster, 40310, 0x20); -- "The deposit has been exhausted." |         player:SendGameMessage(harvestJudge, 31, MESSAGE_TYPE_SYSTEM); | ||||||
|         --TO:DO Despawn node + whatever logic to respawn an exsiting expired node in the area. |  | ||||||
|     end |     end | ||||||
|       |       | ||||||
| 	callClientFunction(player, "delegateCommand", harvestJudge, "closeInputWidget", commandActor, harvestType); | 	callClientFunction(player, "delegateCommand", harvestJudge, "closeInputWidget", commandActor, harvestType); | ||||||
| @@ -311,67 +231,6 @@ function onEventStarted(player, commandActor, triggerName, arg1, arg2, arg3, arg | |||||||
| 	 | 	 | ||||||
| end | end | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
| -- Returns a table in the following format:  nodeTable = { [1-11] = {itemId, remainder, sweetspot, maxYield} } |  | ||||||
| function BuildHarvestNode(player, sentNode) |  | ||||||
|  |  | ||||||
|     if harvestNodeContainer[sentNode] then |  | ||||||
|         local node = harvestNodeContainer[sentNode]; |  | ||||||
|         local nodeTable = {}; |  | ||||||
|         local nodeItems = {}; |  | ||||||
|         local nodeItemCount = node[3]; |  | ||||||
|          |  | ||||||
|         local grade = node[1]; |  | ||||||
|         local attempts = node[2]; |  | ||||||
|          |  | ||||||
|     |  | ||||||
|         -- Load up nodeItems[] with the harvestNodeItems{} key and Aim point |  | ||||||
|         for i=1, nodeItemCount do |  | ||||||
|             local nodeItemKey = node[3+i]; |  | ||||||
|             local item = harvestNodeItems[ node[3+i] ] |  | ||||||
|              |  | ||||||
|             nodeItems[i] = { nodeItemKey, ((item[3] / 10)+1) }; |  | ||||||
|              |  | ||||||
|             if debugMsg then  player:SendMessage(0x20, "", "nodeItems: "..nodeItems[i][1].." "..nodeItems[i][2]); end |  | ||||||
|         end |  | ||||||
|      |  | ||||||
|         -- Iterate through the 11 Aim spots |  | ||||||
|         for i=1,11,1 do  |  | ||||||
|             local hasItem = false; |  | ||||||
|              |  | ||||||
|             -- See if there's a nodeItems[] that has an Aim spot that matches the current loop |  | ||||||
|             -- TODO: Just set nodeItems[] keys to the actual slots to skip this loop inside a loop |  | ||||||
|             for j=1, nodeItemCount do |  | ||||||
|                 if nodeItems[j][2] == i then |  | ||||||
|                     hasItem = j; |  | ||||||
|                     break; |  | ||||||
|                 end |  | ||||||
|             end |  | ||||||
|           |  | ||||||
|             if hasItem then |  | ||||||
|                 local item = harvestNodeItems[ nodeItems[hasItem][1] ]; |  | ||||||
|                  |  | ||||||
|                 -- Assign itemId, remainder, sweetspot, yield to this slot |  | ||||||
|                 nodeTable[i] = {item[1], item[2], item[4], item[5] }; |  | ||||||
|                  |  | ||||||
|                 if debugMsg then  |  | ||||||
|                     player:SendMessage(0x20, "", "nodeTable: "..i.." "..nodeTable[i][1].." "..nodeTable[i][2].." "..nodeTable[i][3].." "..nodeTable[i][3]);  |  | ||||||
|                 end |  | ||||||
|                  |  | ||||||
|             else |  | ||||||
|                 nodeTable[i] = {0,0,0,0}; |  | ||||||
|                 if debugMsg then player:SendMessage(0x20, "", "nodeTable: "..i); end |  | ||||||
|             end                         |  | ||||||
|         end |  | ||||||
|          |  | ||||||
|         return nodeTable |  | ||||||
|     end |  | ||||||
|      |  | ||||||
| end |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
| function SendTutorial(player, harvestJudge, id) | function SendTutorial(player, harvestJudge, id) | ||||||
|      |      | ||||||
|     if id == 1 then |     if id == 1 then | ||||||
| @@ -389,23 +248,3 @@ function SendTutorial(player, harvestJudge, id) | |||||||
|     end |     end | ||||||
|  |  | ||||||
| end | end | ||||||
|  |  | ||||||
| function HarvestReward(player, item, qty)  -- Really should get a helper function for this |  | ||||||
|  |  | ||||||
|     local worldMaster = GetWorldMaster(); |  | ||||||
|     local location = INVENTORY_NORMAL; |  | ||||||
|     local invCheck = player:getItemPackage(location):addItem(item, qty, 1);        |  | ||||||
|      |  | ||||||
|     if (invCheck == INV_ERROR_FULL) then |  | ||||||
|         -- Your inventory is full. |  | ||||||
|         player:SendGameMessage(player, worldMaster, 60022, MESSAGE_TYPE_SYSTEM_ERROR); |  | ||||||
|     elseif (invCheck == INV_ERROR_ALREADY_HAS_UNIQUE) then |  | ||||||
|         -- You cannot have more than one <itemId> <quality> in your possession at any given time. |  | ||||||
|         player:SendGameMessage(player, worldMaster, 40279, MESSAGE_TYPE_SYSTEM_ERROR, item, 1); |  | ||||||
|     elseif (invCheck == INV_ERROR_SYSTEM_ERROR) then |  | ||||||
|         player:SendMessage(MESSAGE_TYPE_SYSTEM_ERROR, "", "[DEBUG] Server Error on adding item."); |  | ||||||
|     elseif (invCheck == INV_ERROR_SUCCESS) then |  | ||||||
|         --player:SendMessage(MESSAGE_TYPE_SYSTEM, "", message); |  | ||||||
|         player:SendGameMessage(player, worldMaster, 25246, MESSAGE_TYPE_SYSTEM, item, qty); |  | ||||||
|     end |  | ||||||
| end |  | ||||||
| @@ -1,5 +1,5 @@ | |||||||
| function onEventStarted(player, command, triggerName, arg1, arg2, arg3, arg4, targetActor, arg5, arg6, arg7, arg8) | function onEventStarted(player, command, eventType, eventName, arg1, arg2, arg3, arg4, targetActor, arg5, arg6, arg7, arg8) | ||||||
| 	player.Cast(command.actorId, targetActor); | 	player.Cast(command.Id, targetActor); | ||||||
|      |      | ||||||
| 	player:endEvent(); | 	player:endEvent(); | ||||||
| end | end | ||||||
| @@ -4,7 +4,7 @@ EmoteSitCommand Script | |||||||
|  |  | ||||||
| --]] | --]] | ||||||
|  |  | ||||||
| function onEventStarted(player, actor, triggerName, emoteId) | function onEventStarted(player, actor, eventType, eventName, emoteId) | ||||||
|  |  | ||||||
| 	if (player:GetState() == 0) then						 | 	if (player:GetState() == 0) then						 | ||||||
| 		if (emoteId == 0x2712) then | 		if (emoteId == 0x2712) then | ||||||
|   | |||||||
| @@ -66,7 +66,7 @@ emoteTable = { | |||||||
| }; | }; | ||||||
|  |  | ||||||
|  |  | ||||||
| function onEventStarted(player, actor, triggerName, emoteId, showText, arg2, arg3, targetId) | function onEventStarted(player, actor, eventType, triggerName, emoteId, showText, arg2, arg3, targetId) | ||||||
|  |  | ||||||
| 	if (targetId == nil) then | 	if (targetId == nil) then | ||||||
| 		targetId = 0; | 		targetId = 0; | ||||||
|   | |||||||
| @@ -6,7 +6,7 @@ require ("global") | |||||||
| --commandid: command being equipped | --commandid: command being equipped | ||||||
|  |  | ||||||
|  |  | ||||||
| function onEventStarted(player, equipAbilityWidget, triggername, slot, commandid, unkown, arg1, arg2, arg3, arg4, arg5, arg6) | function onEventStarted(player, equipAbilityWidget, eventType, eventName, slot, commandid, unkown, arg1, arg2, arg3, arg4, arg5, arg6) | ||||||
|     local worldManager = GetWorldManager(); |     local worldManager = GetWorldManager(); | ||||||
|     local ability = worldManager:GetBattleCommand(commandid); |     local ability = worldManager:GetBattleCommand(commandid); | ||||||
|      |      | ||||||
|   | |||||||
| @@ -53,7 +53,7 @@ GRAPHICSLOT_L_RINGFINGER	= 24; | |||||||
| GRAPHICSLOT_R_INDEXFINGER 	= 25; | GRAPHICSLOT_R_INDEXFINGER 	= 25; | ||||||
| GRAPHICSLOT_L_INDEXFINGER 	= 26; | GRAPHICSLOT_L_INDEXFINGER 	= 26; | ||||||
|  |  | ||||||
| function onEventStarted(player, actor, triggerName, equippedItem, param1, param2, param3, param4, param5, param6, param7, equipSlot, itemDBIds) | function onEventStarted(player, actor, eventType, eventName, equippedItem, param1, param2, param3, param4, param5, param6, param7, equipSlot, itemDBIds) | ||||||
| 	equipSlot = equipSlot-1; | 	equipSlot = equipSlot-1; | ||||||
| 	 | 	 | ||||||
| 	--Equip Item | 	--Equip Item | ||||||
|   | |||||||
| @@ -1,5 +1,5 @@ | |||||||
| function onEventStarted(player, command, triggerName, arg1, arg2, arg3, arg4, targetActor, arg5, arg6, arg7, arg8) | function onEventStarted(player, command, eventType, eventName, arg1, arg2, arg3, arg4, targetActor, arg5, arg6, arg7, arg8) | ||||||
| 	player.Cast(command.actorId, targetActor); | 	player.Cast(command.Id, targetActor); | ||||||
|      |      | ||||||
| 	player:endEvent(); | 	player:endEvent(); | ||||||
| end | end | ||||||
| @@ -6,7 +6,7 @@ Handles moving items across item packages (IE: Taking loot) | |||||||
|  |  | ||||||
| --]] | --]] | ||||||
|  |  | ||||||
| function onEventStarted(player, actor, triggerName, itemReference, targetPackage, sourcePackage, arg1, arg2, unknown, arg3, arg4, arg5, type9ItemIds) | function onEventStarted(player, actor, eventType, eventName, itemReference, targetPackage, sourcePackage, arg1, arg2, unknown, arg3, arg4, arg5, type9ItemIds) | ||||||
| 	 | 	 | ||||||
| 	player:EndEvent(); | 	player:EndEvent(); | ||||||
| 	 | 	 | ||||||
|   | |||||||
| @@ -6,7 +6,7 @@ Handles giving an item to another party member. | |||||||
|  |  | ||||||
| --]] | --]] | ||||||
|  |  | ||||||
| function onEventStarted(player, actor, triggerName, itemReference, targetPackage, sourcePackage, arg1, targetPlayer, arg2, arg3, arg4, arg5, type9ItemIds) | function onEventStarted(player, actor, eventType, eventName, itemReference, targetPackage, sourcePackage, arg1, targetPlayer, arg2, arg3, arg4, arg5, type9ItemIds) | ||||||
| 	 | 	 | ||||||
| 	player:EndEvent(); | 	player:EndEvent(); | ||||||
| 	 | 	 | ||||||
|   | |||||||
| @@ -9,7 +9,7 @@ The param "itemDBIds" has the vars: item1 and item2. | |||||||
|  |  | ||||||
| --]] | --]] | ||||||
|  |  | ||||||
| function onEventStarted(player, actor, triggerName, itemReference, targetPackage, sourcePackage, arg1, arg2, unknown, arg3, arg4, arg5, type9ItemIds) | function onEventStarted(player, actor, eventType, eventName, itemReference, targetPackage, sourcePackage, arg1, arg2, unknown, arg3, arg4, arg5, type9ItemIds) | ||||||
| 	player:GetItemPackage(itemReference.itemPackage):RemoveItemAtSlot(itemReference.slot); | 	player:GetItemPackage(itemReference.itemPackage):RemoveItemAtSlot(itemReference.slot); | ||||||
| 	player:EndEvent();	 | 	player:EndEvent();	 | ||||||
| end | end | ||||||
|   | |||||||
| @@ -8,7 +8,7 @@ Fired when you try to abandon a quest | |||||||
|  |  | ||||||
| --]] | --]] | ||||||
|  |  | ||||||
| function onEventStarted(player, command, triggerName, questId)		 | function onEventStarted(player, command, eventType, eventName, questId)		 | ||||||
| 	 | 	 | ||||||
| 	player:AbandonQuest(questId); | 	player:AbandonQuest(questId); | ||||||
| 	player:EndEvent(); | 	player:EndEvent(); | ||||||
|   | |||||||
| @@ -4,7 +4,7 @@ LinkshellAppointCommand Script | |||||||
|  |  | ||||||
| --]] | --]] | ||||||
|  |  | ||||||
| function onEventStarted(player, actor, triggerName, linkshellName, memberName, rank) | function onEventStarted(player, actor, eventType, eventName, linkshellName, memberName, rank) | ||||||
|  |  | ||||||
| 	GetWorldManager():RequestWorldLinkshellRankChange(player, linkshellName, memberName, rank);	 | 	GetWorldManager():RequestWorldLinkshellRankChange(player, linkshellName, memberName, rank);	 | ||||||
| 	player:EndEvent(); | 	player:EndEvent(); | ||||||
|   | |||||||
| @@ -4,7 +4,7 @@ LinkshellChangeCommand Script | |||||||
|  |  | ||||||
| --]] | --]] | ||||||
|  |  | ||||||
| function onEventStarted(player, actor, triggerName, linkshellName, arg1, arg2) | function onEventStarted(player, actor, eventType, eventName, linkshellName, arg1, arg2) | ||||||
|  |  | ||||||
| 	if (linkshellName == nil) then | 	if (linkshellName == nil) then | ||||||
| 		linkshellName = ""; | 		linkshellName = ""; | ||||||
|   | |||||||
| @@ -6,7 +6,7 @@ Handles what happens when you cancel an invite to a linkshell | |||||||
|  |  | ||||||
| --]] | --]] | ||||||
|  |  | ||||||
| function onEventStarted(player, actor, triggerName, arg1, arg2, arg3, arg4, actorId) | function onEventStarted(player, actor, eventType, eventName, arg1, arg2, arg3, arg4, actorId) | ||||||
|  |  | ||||||
| 	GetWorldManager():RequestWorldLinkshellCancelInvite(player);	 | 	GetWorldManager():RequestWorldLinkshellCancelInvite(player);	 | ||||||
| 	player:EndEvent(); | 	player:EndEvent(); | ||||||
|   | |||||||
| @@ -6,7 +6,7 @@ Handles what happens when you invite a player to a linkshell | |||||||
|  |  | ||||||
| --]] | --]] | ||||||
|  |  | ||||||
| function onEventStarted(player, actor, triggerName, linkshellName, arg1, arg2, arg3, actorId) | function onEventStarted(player, actor, eventType, eventName, linkshellName, arg1, arg2, arg3, actorId) | ||||||
|  |  | ||||||
| 	GetWorldManager():RequestWorldLinkshellInviteMember(player, linkshellName, actorId);	 | 	GetWorldManager():RequestWorldLinkshellInviteMember(player, linkshellName, actorId);	 | ||||||
| 	player:EndEvent(); | 	player:EndEvent(); | ||||||
|   | |||||||
| @@ -4,7 +4,7 @@ LinkshellKickCommand Script | |||||||
|  |  | ||||||
| --]] | --]] | ||||||
|  |  | ||||||
| function onEventStarted(player, actor, triggerName, linkshellName, kickedName) | function onEventStarted(player, actor, eventType, eventName, linkshellName, kickedName) | ||||||
|  |  | ||||||
| 	GetWorldManager():RequestWorldLinkshellKick(player, linkshellName, kickedName);	 | 	GetWorldManager():RequestWorldLinkshellKick(player, linkshellName, kickedName);	 | ||||||
| 	player:EndEvent(); | 	player:EndEvent(); | ||||||
|   | |||||||
| @@ -4,7 +4,7 @@ LinkshellLeaveCommand Script | |||||||
|  |  | ||||||
| --]] | --]] | ||||||
|  |  | ||||||
| function onEventStarted(player, actor, triggerName, linkshellName) | function onEventStarted(player, actor, eventType, eventName, linkshellName) | ||||||
|  |  | ||||||
| 	GetWorldManager():RequestWorldLinkshellLeave(player, linkshellName);	 | 	GetWorldManager():RequestWorldLinkshellLeave(player, linkshellName);	 | ||||||
| 	player:EndEvent(); | 	player:EndEvent(); | ||||||
|   | |||||||
| @@ -8,7 +8,7 @@ Handles post-dream events. | |||||||
|  |  | ||||||
| require ("global") | require ("global") | ||||||
|  |  | ||||||
| function onEventStarted(player, actor, triggerName, dreamCode, innCode, narg1, narg2, bedActor) | function onEventStarted(player, actor, eventType, eventName, dreamCode, innCode, narg1, narg2, bedActor) | ||||||
| 	 | 	 | ||||||
| 	--In Plain Sight | 	--In Plain Sight | ||||||
| 	if (dreamCode == 1) then | 	if (dreamCode == 1) then | ||||||
|   | |||||||
| @@ -12,7 +12,7 @@ eventLogoutFade() | |||||||
|  |  | ||||||
| require ("global") | require ("global") | ||||||
|  |  | ||||||
| function onEventStarted(player, command, triggerName) | function onEventStarted(player, command, eventType, eventName) | ||||||
|  |  | ||||||
| 	choice = callClientFunction(player, "delegateCommand", command, "eventConfirm");	 | 	choice = callClientFunction(player, "delegateCommand", command, "eventConfirm");	 | ||||||
|  |  | ||||||
|   | |||||||
| @@ -40,7 +40,7 @@ updateNegotiationWidget(player, gridIndex, key, itemIconId, pointValue, ?, ?) - | |||||||
|  |  | ||||||
| require ("global") | require ("global") | ||||||
|  |  | ||||||
| function onEventStarted(player, commandactor, triggerName, arg1, arg2, arg3, arg4, arg5) | function onEventStarted(player, commandactor, eventType, eventName, arg1, arg2, arg3, arg4, arg5) | ||||||
| 	 | 	 | ||||||
| 	negotiationJudge = GetStaticActor("NegotiationJudge"); | 	negotiationJudge = GetStaticActor("NegotiationJudge"); | ||||||
|  |  | ||||||
|   | |||||||
| @@ -4,42 +4,14 @@ require ("global") | |||||||
|  |  | ||||||
| NpcLinkshellChatCommand Script | NpcLinkshellChatCommand Script | ||||||
|  |  | ||||||
| Handler for when a player clicks a npc ls to talk to. If adding new linkshells to the handle, make sure to add | Player class will go through all quests and see if there are active msgs for one. If there was, it will | ||||||
| it to the handler table (with correct offset), and that your function is above the handler. If padding is needed | return true and that quest must end the event (if needed). Otherwise if nothing caught the event, the | ||||||
| to hit some ID, add "nils". | event is ended here. | ||||||
|  |  | ||||||
| --]] | --]] | ||||||
|  |  | ||||||
|  | function onEventStarted(player, command, eventType, eventName, npcLsId) | ||||||
| local function handleAdventurersGuild(player) | 	if (player:HandleNpcLs(npcLsId) == false) then | ||||||
| 	if (player:HasQuest(110006) == true) then | 		player:EndEvent(); | ||||||
| 		local man0g1Quest = player:GetQuest("Man0g1");		 |  | ||||||
| 		player:SendGameMessage(man0g1Quest, 330, 39, 1300018, nil); |  | ||||||
| 	end | 	end | ||||||
| end | end | ||||||
|  |  | ||||||
| local function handlePathOfTheTwelve(player) |  | ||||||
| 	player:SendMessage(0x20, "", "Test"); |  | ||||||
| end |  | ||||||
|  |  | ||||||
| local npcLsHandlers = { |  | ||||||
| 	handleAdventurersGuild, |  | ||||||
| 	nil, |  | ||||||
| 	nil, |  | ||||||
| 	nil, |  | ||||||
| 	nil, |  | ||||||
| 	handlePathOfTheTwelve	 |  | ||||||
| } |  | ||||||
|  |  | ||||||
| function onEventStarted(player, command, triggerName, npcLsId)		 |  | ||||||
| 	 |  | ||||||
| 	if (npcLsHandlers[npcLsId] ~= nil) then |  | ||||||
| 		npcLsHandlers[npcLsId](player); |  | ||||||
| 		player:SetNpcLS(npcLsId-1, NPCLS_ACTIVE); |  | ||||||
| 	else |  | ||||||
| 		player:SendMessage(0x20, "", "That Npc Linkshell is not implemented yet."); |  | ||||||
| 	end	 |  | ||||||
| 	 |  | ||||||
| 	player:endEvent();	 |  | ||||||
| 	 |  | ||||||
| end |  | ||||||
|   | |||||||
| @@ -6,7 +6,7 @@ Handles disbanding the party. | |||||||
|  |  | ||||||
| --]] | --]] | ||||||
|  |  | ||||||
| function onEventStarted(player, actor, triggerName) | function onEventStarted(player, actor, eventType, eventName) | ||||||
| 	worldMaster = GetWorldMaster();		 | 	worldMaster = GetWorldMaster();		 | ||||||
| 	 | 	 | ||||||
| 	if (player:IsPartyLeader()) then | 	if (player:IsPartyLeader()) then | ||||||
|   | |||||||
| @@ -15,7 +15,7 @@ TextIds: | |||||||
|  |  | ||||||
| --]] | --]] | ||||||
|  |  | ||||||
| function onEventStarted(player, actor, name) | function onEventStarted(player, actor, eventType, eventName, name) | ||||||
| 	worldMaster = GetWorldMaster();		 | 	worldMaster = GetWorldMaster();		 | ||||||
| 	 | 	 | ||||||
| 	if (player:IsPartyLeader()) then | 	if (player:IsPartyLeader()) then | ||||||
|   | |||||||
| @@ -6,7 +6,7 @@ Handles what happens when you invite | |||||||
|  |  | ||||||
| --]] | --]] | ||||||
|  |  | ||||||
| function onEventStarted(player, actor, triggerName, name, arg1, arg2, arg3, actorId) | function onEventStarted(player, actor, eventType, eventName, name, arg1, arg2, arg3, actorId) | ||||||
|  |  | ||||||
| 	if (name ~= nil) then | 	if (name ~= nil) then | ||||||
| 		GetWorldManager():CreateInvitePartyGroup(player, name); | 		GetWorldManager():CreateInvitePartyGroup(player, name); | ||||||
|   | |||||||
| @@ -15,7 +15,7 @@ TextIds: | |||||||
|  |  | ||||||
| --]] | --]] | ||||||
|  |  | ||||||
| function onEventStarted(player, actor, triggerName, name, arg2, arg3, arg4, actorId) | function onEventStarted(player, actor, eventType, eventName, name, arg2, arg3, arg4, actorId) | ||||||
| 	worldMaster = GetWorldMaster();		 | 	worldMaster = GetWorldMaster();		 | ||||||
| 	 | 	 | ||||||
| 	if (player:IsPartyLeader()) then | 	if (player:IsPartyLeader()) then | ||||||
|   | |||||||
| @@ -6,7 +6,7 @@ Handles requesting to change party leader and various errors. | |||||||
|  |  | ||||||
| --]] | --]] | ||||||
|  |  | ||||||
| function onEventStarted(player, actor, triggerName, name, arg2, arg3, arg4, actorId) | function onEventStarted(player, actor, eventType, eventName, name, arg2, arg3, arg4, actorId) | ||||||
| 	worldMaster = GetWorldMaster();		 | 	worldMaster = GetWorldMaster();		 | ||||||
| 	 | 	 | ||||||
| 	if (player:IsPartyLeader()) then | 	if (player:IsPartyLeader()) then | ||||||
|   | |||||||
| @@ -6,7 +6,7 @@ Handles leaving a party | |||||||
|  |  | ||||||
| --]] | --]] | ||||||
|  |  | ||||||
| function onEventStarted(player, actor, triggerName) | function onEventStarted(player, actor, eventType, eventName) | ||||||
| 	player:PartyLeave(name);	 | 	player:PartyLeave(name);	 | ||||||
| 	player:EndEvent(); | 	player:EndEvent(); | ||||||
| end | end | ||||||
| @@ -27,7 +27,7 @@ markers = {         -- [id] = {overheadIcon, textIcon} | |||||||
| } | } | ||||||
|  |  | ||||||
|  |  | ||||||
| function onEventStarted(player, actor, triggerName, commandValue, category, unk1, unk2, targetActor, unk3, unk4, unk5, unk6) | function onEventStarted(player, actor, eventType, eventName, commandValue, category, unk1, unk2, targetActor, unk3, unk4, unk5, unk6) | ||||||
| 	 | 	 | ||||||
|     workName = "charaWork.parameterTemp.targetInformation"; |     workName = "charaWork.parameterTemp.targetInformation"; | ||||||
|     uiFunc = "charaWork/stateForAll"; |     uiFunc = "charaWork/stateForAll"; | ||||||
|   | |||||||
| @@ -8,16 +8,16 @@ Notes: | |||||||
| --]] | --]] | ||||||
| require("global") | require("global") | ||||||
|  |  | ||||||
| function onEventStarted(player, actor, triggerName, pushCommand, unk1, unk2, unk3, ownerActorId, unk4, unk5, unk6, unk7) | function onEventStarted(player, actor, eventType, eventName, pushCommand, unk1, unk2, unk3, ownerActorId, unk4, unk5, unk6, unk7) | ||||||
| 	 | 	 | ||||||
| 	actor = player:GetActorInInstance(ownerActorId); | 	actor = player:GetActorInInstance(ownerActorId); | ||||||
| 	 | 	print("TESSSSSSSSSSSSSST"); | ||||||
|  | 	harvestCommand = GetStaticActorById(0xA0F055F7); | ||||||
| 	if (actor != nil) then | 	if (actor != nil) then | ||||||
| 		if (actor:GetActorClassId() == 1200052) then | 		if (actor:GetActorClassId() == 1200052) then | ||||||
| 			player:kickEvent(actor, "commandJudgeMode", "commandJudgeMode"); | 			player:KickEventSpecial(harvestCommand, 0, "commandJudgeMode", 0, 0, 0, 0, 0x4E26, 0, nil, 0xF, actor, nil, nil, nil, nil); | ||||||
| 		else | 		else | ||||||
| 			printf("TEST"); | 			player:kickEvent(actor, "pushCommand", false); | ||||||
| 			player:kickEvent(actor, "pushCommand", "pushCommand"); |  | ||||||
| 		end | 		end | ||||||
| 	else | 	else | ||||||
| 		player:endEvent(); | 		player:endEvent(); | ||||||
|   | |||||||
| @@ -1,7 +1,7 @@ | |||||||
|  |  | ||||||
| function onEventStarted(player, command, triggerName, arg1, arg2, arg3, arg4, targetActor, arg5, arg6, arg7, arg8) | function onEventStarted(player, command, eventType, eventName, arg1, arg2, arg3, arg4, targetActor, arg5, arg6, arg7, arg8) | ||||||
| 	 | 	 | ||||||
|  |  | ||||||
| 	player.Cast(command.actorId, targetActor); | 	player.Cast(command.Id, targetActor); | ||||||
| 	player:endEvent(); | 	player:endEvent(); | ||||||
| end | end | ||||||
| @@ -1,5 +1,5 @@ | |||||||
| function onEventStarted(player, command, triggerName, arg1, arg2, arg3, arg4, targetActor, arg5, arg6, arg7, arg8) | function onEventStarted(player, command, eventType, eventName, arg1, arg2, arg3, arg4, targetActor, arg5, arg6, arg7, arg8) | ||||||
| 	player.Cast(command.actorId, targetActor); | 	player.Cast(command.Id, targetActor); | ||||||
|      |      | ||||||
| 	player:endEvent(); | 	player:endEvent(); | ||||||
| end | end | ||||||
| @@ -3,7 +3,7 @@ | |||||||
|  |  | ||||||
| --]] | --]] | ||||||
|  |  | ||||||
| function onEventStarted(player, actor, questId) | function onEventStarted(player, actor, eventType, eventName, questId) | ||||||
| 	player:SendDataPacket("requestedData", "activegl", 7, nil, nil, nil, nil, nil, nil, nil); | 	player:SendDataPacket("requestedData", "activegl", 7, nil, nil, nil, nil, nil, nil, nil); | ||||||
| --	player:SendRequestedInfo("requestedData", "glHist", 10, 0x1D4F2, 1009, 12464, 11727, 12485, 12526); | --	player:SendRequestedInfo("requestedData", "glHist", 10, 0x1D4F2, 1009, 12464, 11727, 12485, 12526); | ||||||
| end | end | ||||||
|   | |||||||
| @@ -1,23 +1,30 @@ | |||||||
| --[[ | --[[ | ||||||
|  |  | ||||||
|  | RequestQuestJournalCommand Script | ||||||
|  |  | ||||||
|  | Functions: None | ||||||
|  |  | ||||||
|  | Notes: | ||||||
|  |  | ||||||
|  | Fires when the player looks at a quest's journal entry and the map section. Check the quest sheet and quest_marker sheet | ||||||
|  | for valid entries for your quest. | ||||||
|  |  | ||||||
| --]] | --]] | ||||||
|  |  | ||||||
| function onEventStarted(player, actor, trigger, questId, mapCode) | function onEventStarted(player, command, eventType, eventName, questId, mapCode) | ||||||
|  | 	local quest = player:GetQuest(questId); | ||||||
| 	quest = player:GetQuest(questId); |  | ||||||
| 	 |  | ||||||
| 	if (quest == nil) then	 |  | ||||||
| 		player:EndEvent(); |  | ||||||
| 		return; |  | ||||||
| 	end |  | ||||||
| 	 | 	 | ||||||
|  | 	if (quest ~= nil) then	 | ||||||
| 		if (mapCode == nil) then | 		if (mapCode == nil) then | ||||||
| 		player:SendDataPacket("requestedData", "qtdata", quest:GetQuestId(), quest:GetPhase()); | 			-- Get Quest Journal Data | ||||||
| 		player:EndEvent(); | 			local journalInfo = quest:GetJournalInformation(); | ||||||
|  | 			player:SendDataPacket("requestedData", "qtdata", quest:GetQuestId(), quest:GetSequence(), unpack(journalInfo)); | ||||||
| 		else | 		else | ||||||
| 		player:SendDataPacket("requestedData", "qtmap", quest:GetQuestId()); | 			-- Get Quest Map Data | ||||||
| 		player:EndEvent(); | 			local mapMarkers = quest:GetJournalMapMarkerList(); | ||||||
|  | 			player:SendDataPacket("requestedData", "qtmap", quest:GetQuestId(), unpack(mapMarkers)); | ||||||
|  | 		end | ||||||
| 	end | 	end | ||||||
| 	 | 	 | ||||||
|  | 	player:EndEvent(); | ||||||
| end | end | ||||||
|   | |||||||
| @@ -9,7 +9,7 @@ Finds the correct weaponskill subscript to fire when a weaponskill actor is acti | |||||||
|  |  | ||||||
| --]] | --]] | ||||||
|  |  | ||||||
| function onEventStarted(player, command, triggerName, arg1, arg2, arg3, arg4, targetActor, arg5, arg6, arg7, arg8) | function onEventStarted(player, command, eventType, eventName, arg1, arg2, arg3, arg4, targetActor, arg5, arg6, arg7, arg8) | ||||||
| 	player.Ability(command.actorId, targetActor); | 	player.Ability(command.Id, targetActor); | ||||||
| 	player:endEvent(); | 	player:endEvent(); | ||||||
| end; | end; | ||||||
| @@ -13,7 +13,7 @@ local attackMagicHandlers = { | |||||||
|      |      | ||||||
| } | } | ||||||
|  |  | ||||||
| function onEventStarted(player, command, triggerName, arg1, arg2, arg3, arg4, targetActor, arg5, arg6, arg7, arg8) | function onEventStarted(player, command, eventType, eventName, arg1, arg2, arg3, arg4, targetActor, arg5, arg6, arg7, arg8) | ||||||
| 	player.Cast(command.actorId, targetActor); | 	player.Cast(command.Id, targetActor); | ||||||
| 	player:endEvent(); | 	player:endEvent(); | ||||||
| end; | end; | ||||||
| @@ -6,7 +6,7 @@ Functions: | |||||||
|  |  | ||||||
| eventRegion(numAnima) | eventRegion(numAnima) | ||||||
| eventAetheryte(region, animaCost1, animaCost2, animaCost3, animaCost4, animaCost5, animaCost6) | eventAetheryte(region, animaCost1, animaCost2, animaCost3, animaCost4, animaCost5, animaCost6) | ||||||
| eventConfirm(isReturn, isInBattle, cityReturnNum, 138821, forceAskReturnOnly) | eventConfirm(isReturn, isInBattle, HomePointInn, HomePoint, forceAskReturnOnly) | ||||||
|  |  | ||||||
| --]] | --]] | ||||||
|  |  | ||||||
| @@ -52,41 +52,112 @@ teleportMenuToAetheryte = { | |||||||
|     } |     } | ||||||
| } | } | ||||||
|  |  | ||||||
| function onEventStarted(player, actor, triggerName, isTeleport) | zoneIdToRegionChoice = | ||||||
|  | { | ||||||
|  |     [128] = 1, [129] = 1, [130] = 1, [131] = 1, [132] = 1, [133] = 1, [134] = 1, [135] = 1, [230] = 1, | ||||||
|  |     [143] = 2, [144] = 2, [145] = 2, [147] = 2, [148] = 2, | ||||||
|  |     [150] = 3, [151] = 3, [152] = 3, [153] = 3, [154] = 3, [155] = 3, [157] = 3, [158] = 3, [159] = 3, [160] = 3, [206] = 3, | ||||||
|  |     [170] = 4, [171] = 4, [172] = 4, [173] = 4, [174] = 4, [175] = 4, [176] = 4, [178] = 4, [180] = 4, [181] = 4, [209] = 4, | ||||||
|  |     [190] = 5 | ||||||
|  | } | ||||||
|  |  | ||||||
|  |  | ||||||
|  | function onEventStarted(player, actor, eventType, eventName, isTeleport) | ||||||
|  |  | ||||||
|     local worldMaster = GetWorldMaster(); |     local worldMaster = GetWorldMaster(); | ||||||
|  |     local playerState = player:GetState(); | ||||||
|  |     local currentAnima = 100; | ||||||
|  |     local baseAnimaCost = 6; | ||||||
|  |     local animaCost = 0; | ||||||
|  |     local favoredLocation = {1280003, 1280005, 1280062}; | ||||||
|  |     local currentRegion = zoneIdToRegionChoice[player:GetPos()[5]] or 0; | ||||||
|  |     local isCity = {[1280001] = true, [1280061] = true, [1280031] = true}; | ||||||
|  |     local isFavoredDesination = false; | ||||||
|  |     local destination = 0; | ||||||
|  |  | ||||||
| 	if (isTeleport == 0) then		 |  | ||||||
|  |     if (isTeleport == 0) then -- Teleport hit | ||||||
|         while (true) do |         while (true) do | ||||||
| 			regionChoice = callClientFunction(player, "delegateCommand", actor, "eventRegion", 100); |             regionChoice = callClientFunction(player, "delegateCommand", actor, "eventRegion", currentAnima); | ||||||
|              |              | ||||||
|             if (regionChoice == nil) then break end |             if (regionChoice == nil) then break end | ||||||
|          |          | ||||||
|             while (true) do |             while (true) do | ||||||
| 				aetheryteChoice = callClientFunction(player, "delegateCommand", actor, "eventAetheryte", regionChoice, 2, 2, 2, 4, 4, 4); |                 if (regionChoice > 0 and regionChoice < 6) then -- If Region selected | ||||||
|  |  | ||||||
|  |                     if (regionChoice == currentRegion) then -- Check if selected region matches player's region, reduce cost if so. | ||||||
|  |                         baseAnimaCost = baseAnimaCost - 2; | ||||||
|  |                     else | ||||||
|  |                         baseAnimaCost = 6; | ||||||
|  |                     end | ||||||
|  |                      | ||||||
|  |                     -- Assign anima cost to the six possible slots after factoring in same region or not. | ||||||
|  |                     animaCost = {baseAnimaCost, baseAnimaCost, baseAnimaCost, baseAnimaCost, baseAnimaCost, baseAnimaCost}; | ||||||
|  |      | ||||||
|  |                     if (isCity[teleportMenuToAetheryte[regionChoice][1]] == true) then | ||||||
|  |                         -- Halve the cost of applicable city aetheryte | ||||||
|  |                         animaCost[1] = animaCost[1] / 2; | ||||||
|  |                     end | ||||||
|  |  | ||||||
|  |                 elseif (regionChoice == 6) then -- Favored Destinations selected. | ||||||
|  |                     -- Dummy info.  Favored would be half price after factoring in same region cost or not. | ||||||
|  |                     animaCost = {2, 3, 3, favoredLocation[1], favoredLocation[2], favoredLocation[3]}; | ||||||
|  |                     isFavoredDesination = true; | ||||||
|  |                 end | ||||||
|  |  | ||||||
|  |  | ||||||
|  |                 aetheryteChoice = callClientFunction( | ||||||
|  |                                                 player,  | ||||||
|  |                                                 "delegateCommand",  | ||||||
|  |                                                 actor,  | ||||||
|  |                                                 "eventAetheryte",  | ||||||
|  |                                                 regionChoice,  | ||||||
|  |                                                 animaCost[1], | ||||||
|  |                                                 animaCost[2], | ||||||
|  |                                                 animaCost[3], | ||||||
|  |                                                 animaCost[4], | ||||||
|  |                                                 animaCost[5], | ||||||
|  |                                                 animaCost[6] | ||||||
|  |                                                 ); | ||||||
|  |                  | ||||||
|                  |                  | ||||||
|                 if (aetheryteChoice == nil) then break end |                 if (aetheryteChoice == nil) then break end | ||||||
|                  |                  | ||||||
|                 player:PlayAnimation(0x4000FFA); |                 player:PlayAnimation(0x4000FFA); | ||||||
| 				player:SendGameMessage(worldMaster, 34101, 0x20, 2, teleportMenuToAetheryte[regionChoice][aetheryteChoice], 100, 100);	 |                  | ||||||
|  |                 if (isFavoredDesination == true) then | ||||||
|  |                     destination = aetheryteTeleportPositions[favoredLocation[aetheryteChoice]]; | ||||||
|  |                     player:SendGameMessage(worldMaster, 34101, 0x20, 2, favoredLocation[aetheryteChoice], animaCost[aetheryteChoice], currentAnima);                 | ||||||
|  |                 else | ||||||
|  |                     destination = aetheryteTeleportPositions[teleportMenuToAetheryte[regionChoice][aetheryteChoice]]; | ||||||
|  |                     player:SendGameMessage(worldMaster, 34101, 0x20, 2, teleportMenuToAetheryte[regionChoice][aetheryteChoice], animaCost[aetheryteChoice], currentAnima);   | ||||||
|  |                 end | ||||||
|  |                  | ||||||
|                 confirmChoice = callClientFunction(player, "delegateCommand", actor, "eventConfirm", false, false, 1, 138824, false);                |                 confirmChoice = callClientFunction(player, "delegateCommand", actor, "eventConfirm", false, false, 1, 138824, false);                | ||||||
|  |                      | ||||||
|                 if (confirmChoice == 1) then |                 if (confirmChoice == 1) then | ||||||
|                     player:PlayAnimation(0x4000FFB); |                     player:PlayAnimation(0x4000FFB); | ||||||
|                     player:SendGameMessage(worldMaster, 34105, 0x20);            |                     player:SendGameMessage(worldMaster, 34105, 0x20);            | ||||||
| 					--Do teleport		 |  | ||||||
| 					destination = aetheryteTeleportPositions[teleportMenuToAetheryte[regionChoice][aetheryteChoice]];			 |                     if (destination ~= 0) then                         | ||||||
| 					if (destination ~= nil) then						 |  | ||||||
|                         randoPos = getRandomPointInBand(destination[2], destination[4], 3, 5); |                         randoPos = getRandomPointInBand(destination[2], destination[4], 3, 5); | ||||||
|                         rotation = getAngleFacing(randoPos.x, randoPos.y, destination[2], destination[4]); |                         rotation = getAngleFacing(randoPos.x, randoPos.y, destination[2], destination[4]); | ||||||
|  |                         if (playerState == ACTORSTATE_MOUNTED) then  | ||||||
|  |                             player:SetMountState(0); | ||||||
|  |                             player:ChangeSpeed(0.0, 2.0, 5.0, 5.0) | ||||||
|  |                             player:ChangeState(ACTORSTATE_PASSIVE); | ||||||
|  |                         end | ||||||
|  |                          | ||||||
|                         GetWorldManager():DoZoneChange(player, destination[1], nil, 0, 2, randoPos.x, destination[3], randoPos.y, rotation); |                         GetWorldManager():DoZoneChange(player, destination[1], nil, 0, 2, randoPos.x, destination[3], randoPos.y, rotation); | ||||||
|                     end |                     end | ||||||
|                 end |                 end | ||||||
|  |                      | ||||||
|             player:endEvent(); |             player:endEvent(); | ||||||
|             return; |             return; | ||||||
|             end |             end | ||||||
| 			 |  | ||||||
|         end |         end | ||||||
| 	else |          | ||||||
|  |     else -- Return hit | ||||||
|         player:PlayAnimation(0x4000FFA); |         player:PlayAnimation(0x4000FFA); | ||||||
|         local choice, isInn = callClientFunction(player, "delegateCommand", actor, "eventConfirm", true, false, player:GetHomePointInn(), player:GetHomePoint(), false);         |         local choice, isInn = callClientFunction(player, "delegateCommand", actor, "eventConfirm", true, false, player:GetHomePointInn(), player:GetHomePoint(), false);         | ||||||
|         if (choice == 1) then |         if (choice == 1) then | ||||||
| @@ -115,8 +186,13 @@ function onEventStarted(player, actor, triggerName, isTeleport) | |||||||
|                 if (destination ~= nil) then |                 if (destination ~= nil) then | ||||||
|                     randoPos = getRandomPointInBand(destination[2], destination[4], 3, 5); |                     randoPos = getRandomPointInBand(destination[2], destination[4], 3, 5); | ||||||
|                     rotation = getAngleFacing(randoPos.x, randoPos.y, destination[2], destination[4]); |                     rotation = getAngleFacing(randoPos.x, randoPos.y, destination[2], destination[4]); | ||||||
| 					GetWorldManager():DoZoneChange(player, destination[1], nil, 0, 2, randoPos.x, destination[3], randoPos.y, rotation); |                     if (playerState == ACTORSTATE_MOUNTED) then  | ||||||
|  |                         player:SetMountState(0); | ||||||
|  |                         player:ChangeSpeed(0.0, 2.0, 5.0, 5.0) | ||||||
|  |                         player:ChangeState(ACTORSTATE_PASSIVE); | ||||||
|  |                     end | ||||||
|                      |                      | ||||||
|  |                     GetWorldManager():DoZoneChange(player, destination[1], nil, 0, 2, randoPos.x, destination[3], randoPos.y, rotation); | ||||||
|                 end |                 end | ||||||
|             end |             end | ||||||
|         end |         end | ||||||
| @@ -124,3 +200,4 @@ function onEventStarted(player, actor, triggerName, isTeleport) | |||||||
|  |  | ||||||
|     player:endEvent(); |     player:endEvent(); | ||||||
| end | end | ||||||
|  |  | ||||||
|   | |||||||
| @@ -24,7 +24,7 @@ reedit: Target has canceled their accept. | |||||||
|  |  | ||||||
| require ("global") | require ("global") | ||||||
|  |  | ||||||
| function onEventStarted(player, actor, triggerName)	 | function onEventStarted(player, actor, eventType, eventName)	 | ||||||
| 	 | 	 | ||||||
| 	callClientFunction(player, "delegateCommand", GetStaticActor("TradeExecuteCommand"), "processTradeCommandOpenTray"); | 	callClientFunction(player, "delegateCommand", GetStaticActor("TradeExecuteCommand"), "processTradeCommandOpenTray"); | ||||||
| 	 | 	 | ||||||
|   | |||||||
| @@ -6,7 +6,7 @@ Handles what happens a player cancels a trade | |||||||
|  |  | ||||||
| --]] | --]] | ||||||
|  |  | ||||||
| function onEventStarted(player, actor, triggerName, commandId, result)	 | function onEventStarted(player, actor, eventType, eventName, commandId, result)	 | ||||||
|  |  | ||||||
| 	GetWorldManager():CancelTrade(player); | 	GetWorldManager():CancelTrade(player); | ||||||
| 	player:EndEvent(); | 	player:EndEvent(); | ||||||
|   | |||||||
| @@ -6,16 +6,16 @@ Handles what happens when you invite to trade | |||||||
|  |  | ||||||
| --]] | --]] | ||||||
|  |  | ||||||
| function onEventStarted(player, actor, triggerName, name, arg1, arg2, arg3, actorId)	 | function onEventStarted(player, actor, eventType, eventName, name, arg1, arg2, arg3, actorId)	 | ||||||
|  |  | ||||||
| 	local otherActor = nil; | 	local otherActor = nil; | ||||||
|  |  | ||||||
| 	--ActorID Search | 	--ActorID Search | ||||||
| 	if (actorId ~= nil) then | 	if (actorId ~= nil) then | ||||||
| 		otherActor = player:GetZone():FindActorInArea(actorId); | 		otherActor = player.CurrentArea):FindActorInArea(actorId); | ||||||
| 	--Name Search | 	--Name Search | ||||||
| 	elseif (name ~= nil) then | 	elseif (name ~= nil) then | ||||||
| 		otherActor = player:GetZone():FindPCInZone(name); | 		otherActor = player.CurrentArea:FindPCInZone(name); | ||||||
| 	end | 	end | ||||||
| 	 | 	 | ||||||
| 	if (otherActor ~= nil) then | 	if (otherActor ~= nil) then | ||||||
|   | |||||||
| @@ -24,7 +24,7 @@ function onSkillFinish(caster, target, skill, action, actionContainer) | |||||||
|         local amount = buff.GetExtra(); |         local amount = buff.GetExtra(); | ||||||
|         caster.AddMP(amount); |         caster.AddMP(amount); | ||||||
|  |  | ||||||
|         actionContainer.AddMPAction(caster.actorId, 33007, amount); |         actionContainer.AddMPAction(caster.Id, 33007, amount); | ||||||
|         caster.statusEffects.RemoveStatusEffect(buff, actionContainer, 30329); |         caster.statusEffects.RemoveStatusEffect(buff, actionContainer, 30329); | ||||||
|     else |     else | ||||||
|         --Blissful mind takes 25% of CURRENT HP and begins storing MP up to that point, at which point the buff changes to indicate its full |         --Blissful mind takes 25% of CURRENT HP and begins storing MP up to that point, at which point the buff changes to indicate its full | ||||||
|   | |||||||
							
								
								
									
										21
									
								
								Data/scripts/commands/gm/addquest.lua
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										21
									
								
								Data/scripts/commands/gm/addquest.lua
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,21 @@ | |||||||
|  | require("global"); | ||||||
|  |  | ||||||
|  | properties = { | ||||||
|  |     permissions = 0, | ||||||
|  |     parameters = "s", | ||||||
|  |     description = "Adds a quest by <id>.", | ||||||
|  | } | ||||||
|  |  | ||||||
|  | function onTrigger(player, argc, glId)     | ||||||
|  |     if player then | ||||||
|  | 		local glIdAsNumber = tonumber(glId); | ||||||
|  | 		 | ||||||
|  | 		if (glIdAsNumber == nil) then | ||||||
|  | 			player:AddQuest(glId); | ||||||
|  | 		else | ||||||
|  | 			player:AddQuest(glIdAsNumber); | ||||||
|  | 		end | ||||||
|  | 	else | ||||||
|  |         print(sender.."unable to add guildleve, ensure player name is valid."); | ||||||
|  |     end; | ||||||
|  | end; | ||||||
| @@ -15,7 +15,7 @@ function onTrigger(player, argc) | |||||||
|     if player then |     if player then | ||||||
|         if player.target then |         if player.target then | ||||||
|             print("hi") |             print("hi") | ||||||
|             local id = player.target.actorId |             local id = player.target.Id | ||||||
|             print("hi") |             print("hi") | ||||||
|             player.currentParty:AddMember(id); |             player.currentParty:AddMember(id); | ||||||
|             player.target.currentParty = player.currentParty; |             player.target.currentParty = player.currentParty; | ||||||
|   | |||||||
							
								
								
									
										95
									
								
								Data/scripts/commands/gm/anim.lua
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										95
									
								
								Data/scripts/commands/gm/anim.lua
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,95 @@ | |||||||
|  | require("global"); | ||||||
|  |  | ||||||
|  | properties = { | ||||||
|  |     permissions = 0, | ||||||
|  |     parameters = "dddd", | ||||||
|  |     description = | ||||||
|  | [[ | ||||||
|  | Sets anim id for current target | ||||||
|  | !anim <animID> | | ||||||
|  | !anim <category> <effect> <motion> | ||||||
|  | ]], | ||||||
|  |  | ||||||
|  | } | ||||||
|  |  | ||||||
|  | function onTrigger(player, argc, aType, a1, a2) | ||||||
|  |  | ||||||
|  |     local actor = player.CurrentArea.FindActorInArea(player.currentTarget) or nil; | ||||||
|  |      | ||||||
|  |     if (player and actor) then | ||||||
|  |         a1 = bit32.band(a1, 0xFFF); | ||||||
|  |         a2 = bit32.band(a2, 0xFFF); | ||||||
|  |         aType = bit32.band(aType, 0xFF); | ||||||
|  |              | ||||||
|  |         animId = bit32.bor(bit32.lshift(a2, 12), a1); | ||||||
|  |         animId = bit32.bor(bit32.lshift(aType, 24), animId); | ||||||
|  |         -- player:SendMessage(0x20, "[anim] ", tostring(animId)); | ||||||
|  |         actor:PlayAnimation(animId); | ||||||
|  |         local output = string.format("%x", animId)  | ||||||
|  |         player:SendMessage(0x20, "[anim] ", "0x"..tostring(output).. " Target:"..tostring(actor)); | ||||||
|  |     end | ||||||
|  | end | ||||||
|  |  | ||||||
|  |  | ||||||
|  | --[[ Categories: | ||||||
|  | 1 MGK: 01         - Magic | ||||||
|  | 2 SYS: 02         - System noises | ||||||
|  | 3 ETC: 03         - ??  - Item sound? | ||||||
|  | 4 LIB: 04         - Posing animations | ||||||
|  | 5-9 ITM: 05-09      - Items | ||||||
|  | 10 KAO: 0A         - KAO = Face emotes? | ||||||
|  | 11-12 GLI1/2/3: 0B/0C - Leve card things | ||||||
|  | 13 CBI: 0D      - Two small effects | ||||||
|  | 14 ABL: 0E      - Cooldown buffs | ||||||
|  | 15 POP: 0F      - Warp effects | ||||||
|  | 16 CFT: 10      - Crafting? | ||||||
|  | 17 BTL: 11      - More Crafting? | ||||||
|  | 18 WSC: 12      - Weapon Skills   Arg1 - Weapon Skill  Arg2 - Player Animation | ||||||
|  | 19 WSS: 13      - Mob animations | ||||||
|  | 20 PIC: 14      - Gathering weapons? | ||||||
|  | 21 LIU: 15      - Player Hand Emotes | ||||||
|  | 22 LIN: 16      - Doesn't exist? | ||||||
|  | 23 LIF: 17      - Doesn't exist? | ||||||
|  | 24 LIL: 18      - Mouth | ||||||
|  | 25 ATK: 19      - Autoattacks | ||||||
|  |  | ||||||
|  | 33 = ? | ||||||
|  | 34 = Crash | ||||||
|  | 120 = ??? | ||||||
|  |  | ||||||
|  |  | ||||||
|  | Notes: | ||||||
|  | ------ | ||||||
|  | CATEGORY | ||||||
|  | Shift 18 bits right | ||||||
|  | CMP 0xB | ||||||
|  |  | ||||||
|  | ANIMATION?????? | ||||||
|  | Shift 0xC bits right | ||||||
|  | AND 0x0FFF | ||||||
|  |  | ||||||
|  | PARTICLE EFFECT | ||||||
|  | AND 0x0FFF | ||||||
|  | This number is in the subfolder (wsc, abi, etc) | ||||||
|  |  | ||||||
|  |  | ||||||
|  | That 12 is: | ||||||
|  |  | ||||||
|  | CMP 7C | ||||||
|  | CMP 6f | ||||||
|  | CMP 70 | ||||||
|  | CMP 71 | ||||||
|  |  | ||||||
|  | 7C000062 | ||||||
|  | ec000000 | ||||||
|  | 00FFFFFF | ||||||
|  |  | ||||||
|  | 19: Auto Attack?     | ||||||
|  | 6F: Casting | ||||||
|  | 71: Seems to deal with signaling monster parts | ||||||
|  | 7C: Sheath/Unsheath | ||||||
|  | 7F: Cast failed | ||||||
|  |  | ||||||
|  | --]] | ||||||
|  |  | ||||||
|  |  | ||||||
							
								
								
									
										23
									
								
								Data/scripts/commands/gm/changetonpc.lua
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										23
									
								
								Data/scripts/commands/gm/changetonpc.lua
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,23 @@ | |||||||
|  | require("global"); | ||||||
|  |  | ||||||
|  | properties = { | ||||||
|  |     permissions = 0, | ||||||
|  |     parameters = "", | ||||||
|  |     description = | ||||||
|  | [[ | ||||||
|  | Changes appearance for equipment with given parameters. | ||||||
|  | !graphic <slot> <wID> <eID> <vID> <vID> | ||||||
|  | ]], | ||||||
|  | } | ||||||
|  |  | ||||||
|  | function onTrigger(player, argc) | ||||||
|  |     local messageID = MESSAGE_TYPE_SYSTEM_ERROR; | ||||||
|  |     local sender = "[changetonpc] "; | ||||||
|  |          | ||||||
|  | 	local npc = player.CurrentArea:FindActorInArea(player.currentTarget); | ||||||
|  | 	 | ||||||
|  |     if npc then | ||||||
|  |         player:ChangeIntoNpc(npc); | ||||||
|  |     end | ||||||
|  |             | ||||||
|  | end | ||||||
							
								
								
									
										58
									
								
								Data/scripts/commands/gm/completedQuest.lua
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										58
									
								
								Data/scripts/commands/gm/completedQuest.lua
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,58 @@ | |||||||
|  | require("global"); | ||||||
|  |  | ||||||
|  | properties = { | ||||||
|  |     permissions = 0, | ||||||
|  |     parameters = "dd", | ||||||
|  |     description = | ||||||
|  | [[ | ||||||
|  | Sets if a quest is completed. | ||||||
|  | !completedQuest <questId> true/false | ||||||
|  | ]], | ||||||
|  | } | ||||||
|  |  | ||||||
|  | function onTrigger(player, argc, questId, flag) | ||||||
|  |  | ||||||
|  | 		print("HEY"); | ||||||
|  |     local messageID = MESSAGE_TYPE_SYSTEM_ERROR; | ||||||
|  |     local sender = "[completedQuest] "; | ||||||
|  |     local message = "Error"; | ||||||
|  |      | ||||||
|  | 	if (argc < 1) then | ||||||
|  | 		return; | ||||||
|  | 	end | ||||||
|  | 		 | ||||||
|  | 	local questId = tonumber(questId); | ||||||
|  | 	local flag = flag or nil; | ||||||
|  | 	 | ||||||
|  | 	-- Fail if not valid questId | ||||||
|  | 	if (questId < 110001 or questId > 110001 + 2048) then | ||||||
|  | 		player:SendMessage(messageID, sender, "Invalid questId entered"); | ||||||
|  | 		return; | ||||||
|  | 	end | ||||||
|  | 	 | ||||||
|  | 	-- Getting	 | ||||||
|  | 	if (arc == 1) then | ||||||
|  | 		player:SendMessage(messageID, sender, string.format("Quest %d completion is set to: %s", questId, tostring(player:IsQuestCompleted(questId)))); | ||||||
|  | 		return; | ||||||
|  | 	-- Setting | ||||||
|  | 	else | ||||||
|  | 		-- Fail if not valid flag | ||||||
|  | 		if (not flag == nil) then | ||||||
|  | 			player:SendMessage(messageID, sender, "Invalid flag entered"); | ||||||
|  | 		else | ||||||
|  | 			local boolFlag = false; | ||||||
|  | 			 | ||||||
|  | 			if (flag == "true" or flag == "1" or flag == "on" or flag == "O") then | ||||||
|  | 				boolFlag = true; | ||||||
|  | 			elseif (flag == "false" or flag == "0" or flag == "off" or flag == "X") then | ||||||
|  | 				boolFlag = false; | ||||||
|  | 			elseif flag == "flip" or flag == "toggle" then | ||||||
|  | 				boolFlag = not player:IsQuestCompleted(questId); | ||||||
|  | 			end | ||||||
|  | 			 | ||||||
|  | 			player:SetQuestComplete(questId, boolFlag);			 | ||||||
|  | 			player:SendMessage(messageID, sender, string.format("Quest %d completion set to: %s", questId, tostring(player:IsQuestCompleted(questId)))); | ||||||
|  | 			return; | ||||||
|  | 		end | ||||||
|  | 	end | ||||||
|  | end | ||||||
Some files were not shown because too many files have changed in this diff Show More
		Reference in New Issue
	
	Block a user