Inital Commit
This commit is contained in:
+5
-3
@@ -1,10 +1,12 @@
|
||||
/Ultima.dll
|
||||
/Ultima.pdb
|
||||
/Ultima.dll.mdb
|
||||
/Ultima/bin
|
||||
/Ultima/obj
|
||||
|
||||
/Server.dll
|
||||
/Server/bin
|
||||
/Server/obj
|
||||
|
||||
/Scripts.dll
|
||||
/Scripts/bin
|
||||
/Scripts/obj
|
||||
/Scripts/Output
|
||||
@@ -29,7 +31,7 @@
|
||||
|
||||
*.pdb
|
||||
*.exe
|
||||
*.exe.mdb
|
||||
*.mdb
|
||||
*.sh
|
||||
*.suo
|
||||
*.idea
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
|
||||
# The displayed name of the shard
|
||||
Name=The Forging
|
||||
Name=Code Name: The Forging
|
||||
|
||||
# The default setting for Address, a value of 'null', will use your local IP address.
|
||||
# If all of your local IP addresses are private network addresses and AutoDetect is 'true'
|
||||
|
||||
@@ -159,7 +159,7 @@ Drawer 0x0A2C
|
||||
1493 1610 40
|
||||
1579 1584 20
|
||||
1579 1584 40
|
||||
1469 1704 0
|
||||
# 1469 1704 0
|
||||
1493 1620 40
|
||||
1386 1800 0
|
||||
1426 1752 10
|
||||
@@ -187,9 +187,9 @@ Drawer 0x0A34
|
||||
1460 1705 0
|
||||
1416 1555 30
|
||||
1184 1715 0
|
||||
1454 1705 0
|
||||
# 1454 1705 0
|
||||
1507 1595 10
|
||||
1448 1707 0
|
||||
# 1448 1707 0
|
||||
1624 1584 -20
|
||||
1537 1739 35
|
||||
1537 1744 35
|
||||
@@ -665,7 +665,7 @@ LampPost1 0x0B20
|
||||
1500 1701 20
|
||||
1472 1623 20
|
||||
1471 1676 0
|
||||
1472 1696 0
|
||||
# 1472 1696 0
|
||||
1472 1636 20
|
||||
1501 1543 28
|
||||
1432 1665 10
|
||||
@@ -702,7 +702,7 @@ LampPost3 0x0B24
|
||||
1439 1754 -3
|
||||
1694 1556 40
|
||||
1691 1578 11
|
||||
1484 1723 0
|
||||
# 1484 1723 0
|
||||
1665 1608 13
|
||||
1669 1557 30
|
||||
1670 1626 -5
|
||||
@@ -749,7 +749,7 @@ LampPost3 0x0B24
|
||||
1588 1685 10
|
||||
1498 1626 10
|
||||
1552 1751 15
|
||||
1472 1704 0
|
||||
# 1472 1704 0
|
||||
1552 1608 10
|
||||
1615 1672 19
|
||||
1567 1576 20
|
||||
@@ -1426,7 +1426,7 @@ PottedTree1 0x11C9
|
||||
1656 1606 20
|
||||
1678 1590 7
|
||||
1342 1657 50
|
||||
1452 1704 0
|
||||
# 1452 1704 0
|
||||
1450 1678 0
|
||||
1254 1696 0
|
||||
1576 1594 40
|
||||
@@ -1443,7 +1443,7 @@ PottedTree1 0x11C9
|
||||
1158 1622 0
|
||||
1390 1806 0
|
||||
1480 1580 20
|
||||
1470 1704 0
|
||||
# 1470 1704 0
|
||||
1486 1580 20
|
||||
1544 1736 15
|
||||
1542 1680 30
|
||||
@@ -1531,11 +1531,11 @@ PottedPlant 0x11CA
|
||||
|
||||
# flowerpot
|
||||
PottedPlant1 0x11CB
|
||||
1454 1709 9
|
||||
# 1454 1709 9
|
||||
1384 1804 5
|
||||
1603 1715 29
|
||||
1545 1709 30
|
||||
1460 1709 9
|
||||
# 1460 1709 9
|
||||
1452 1682 9
|
||||
1600 1524 47
|
||||
1452 1614 29
|
||||
@@ -1545,9 +1545,9 @@ PottedPlant2 0x11CC
|
||||
1446 1649 19
|
||||
1456 1725 16
|
||||
1605 1716 30
|
||||
1466 1709 9
|
||||
# 1466 1709 9
|
||||
1471 1580 29
|
||||
1452 1709 9
|
||||
# 1452 1709 9
|
||||
1594 1655 19
|
||||
1388 1816 5
|
||||
1550 1767 19
|
||||
@@ -1934,7 +1934,7 @@ Fork 0x09A3
|
||||
1331 1604 54
|
||||
1387 1817 2
|
||||
1403 1817 4
|
||||
1452 1708 6
|
||||
# 1452 1708 6
|
||||
1509 1599 14
|
||||
1547 1715 24
|
||||
1600 1515 44
|
||||
@@ -1977,7 +1977,7 @@ Knife 0x09A5
|
||||
1331 1604 54
|
||||
1387 1817 2
|
||||
1403 1817 4
|
||||
1452 1708 6
|
||||
# 1452 1708 6
|
||||
1509 1599 14
|
||||
1547 1715 24
|
||||
1600 1515 44
|
||||
@@ -2105,11 +2105,11 @@ Spoon 0x09C3
|
||||
|
||||
# bottle of wine
|
||||
BeverageBottle 0x09C7 (Content=Wine)
|
||||
1452 1707 6
|
||||
1454 1707 6
|
||||
# 1452 1707 6
|
||||
# 1454 1707 6
|
||||
1456 1723 12
|
||||
1460 1707 6
|
||||
1466 1707 6
|
||||
# 1460 1707 6
|
||||
# 1466 1707 6
|
||||
1468 1514 24
|
||||
1469 1515 24
|
||||
1509 1598 14
|
||||
@@ -2222,11 +2222,11 @@ Plate 0x09D7
|
||||
1342 1605 54
|
||||
1344 1603 54
|
||||
1344 1605 54
|
||||
1452 1708 6
|
||||
1454 1708 6
|
||||
# 1452 1708 6
|
||||
# 1454 1708 6
|
||||
1456 1724 12
|
||||
1460 1708 6
|
||||
1466 1708 6
|
||||
# 1460 1708 6
|
||||
# 1466 1708 6
|
||||
1467 1514 24
|
||||
1467 1515 24
|
||||
1470 1514 24
|
||||
@@ -2371,11 +2371,11 @@ Fork 0x09F5
|
||||
1261 1884 4
|
||||
1388 1817 2
|
||||
1404 1817 4
|
||||
1453 1708 20
|
||||
1454 1708 6
|
||||
# 1453 1708 20
|
||||
# 1454 1708 6
|
||||
1456 1724 12
|
||||
1460 1708 6
|
||||
1466 1708 6
|
||||
# 1460 1708 6
|
||||
# 1466 1708 6
|
||||
1510 1599 14
|
||||
1548 1715 24
|
||||
1601 1515 44
|
||||
@@ -2419,10 +2419,10 @@ Knife 0x09F7
|
||||
1261 1884 4
|
||||
1388 1817 2
|
||||
1404 1817 4
|
||||
1454 1708 6
|
||||
# 1454 1708 6
|
||||
1456 1724 12
|
||||
1460 1708 6
|
||||
1466 1708 6
|
||||
# 1460 1708 6
|
||||
# 1466 1708 6
|
||||
1510 1599 14
|
||||
1548 1715 24
|
||||
1601 1515 44
|
||||
@@ -2459,10 +2459,10 @@ Spoon 0x09F8
|
||||
|
||||
# spoon
|
||||
Spoon 0x09F9
|
||||
1454 1708 6
|
||||
# 1454 1708 6
|
||||
1456 1724 12
|
||||
1460 1708 6
|
||||
1466 1708 6
|
||||
# 1460 1708 6
|
||||
# 1466 1708 6
|
||||
1510 1599 14
|
||||
1548 1715 24
|
||||
1601 1515 44
|
||||
@@ -2524,13 +2524,13 @@ CandleLarge 0x0B1A
|
||||
1412 1617 34
|
||||
1412 1717 24
|
||||
1430 1752 16
|
||||
1448 1704 6
|
||||
# 1448 1704 6
|
||||
1452 1609 26
|
||||
1453 1682 6
|
||||
1454 1704 6
|
||||
# 1454 1704 6
|
||||
1456 1720 12
|
||||
1460 1704 6
|
||||
1466 1704 6
|
||||
# 1466 1704 6
|
||||
1471 1576 26
|
||||
1473 1609 26
|
||||
1482 1586 26
|
||||
@@ -2983,7 +2983,7 @@ BambooChair 0x0B5D
|
||||
1420 1580 30
|
||||
1455 1708 0
|
||||
1461 1708 0
|
||||
1467 1708 0
|
||||
# 1467 1708 0
|
||||
1472 1562 30
|
||||
1475 1738 0
|
||||
1475 1739 0
|
||||
@@ -3299,20 +3299,20 @@ Barrel 0x0E77
|
||||
1408 1806 5
|
||||
1408 1807 0
|
||||
1408 1807 5
|
||||
1472 1720 0
|
||||
1472 1721 0
|
||||
1472 1722 0
|
||||
1473 1720 0
|
||||
1473 1724 0
|
||||
1473 1725 0
|
||||
1474 1725 0
|
||||
1477 1721 0
|
||||
1477 1722 0
|
||||
1478 1721 0
|
||||
1478 1722 0
|
||||
1480 1725 0
|
||||
1481 1724 0
|
||||
1481 1725 0
|
||||
# 1472 1720 0
|
||||
# 1472 1721 0
|
||||
# 1472 1722 0
|
||||
# 1473 1720 0
|
||||
# 1473 1724 0
|
||||
# 1473 1725 0
|
||||
# 1474 1725 0
|
||||
# 1477 1721 0
|
||||
# 1477 1722 0
|
||||
# 1478 1721 0
|
||||
# 1478 1722 0
|
||||
# 1480 1725 0
|
||||
# 1481 1724 0
|
||||
# 1481 1725 0
|
||||
1560 1742 15
|
||||
1560 1743 15
|
||||
1560 1743 20
|
||||
@@ -4147,7 +4147,7 @@ PewterMug 0x0FFF
|
||||
1435 1713 24
|
||||
1435 1716 24
|
||||
1435 1721 24
|
||||
1452 1707 6
|
||||
# 1452 1707 6
|
||||
1468 1515 24
|
||||
1469 1515 24
|
||||
1497 1677 24
|
||||
@@ -4176,10 +4176,10 @@ PewterMug 0x1000
|
||||
1429 1713 26
|
||||
1429 1715 26
|
||||
1429 1717 26
|
||||
1454 1707 6
|
||||
# 1454 1707 6
|
||||
1456 1723 12
|
||||
1460 1707 6
|
||||
1466 1707 6
|
||||
# 1460 1707 6
|
||||
# 1466 1707 6
|
||||
1468 1514 24
|
||||
1489 1686 26
|
||||
1491 1686 26
|
||||
|
||||
+21
-51
@@ -1,5 +1,25 @@
|
||||
{
|
||||
"Featured": [
|
||||
{
|
||||
"Type": "Server.Items.OilOfRestoration",
|
||||
"NameLines": ["Oil of Restoration"],
|
||||
"Tooltip": 0,
|
||||
"TooltipText": "Use this item to allow your tempered equipment to be repaired again. This item will be consumed upon use.",
|
||||
"ItemID": 7192,
|
||||
"GumpID": 0,
|
||||
"Hue": 241,
|
||||
"Price": 5000
|
||||
},
|
||||
{
|
||||
"Type": "Server.Items.ForgedPardon",
|
||||
"NameLines": ["1116234"],
|
||||
"Tooltip": 1116235,
|
||||
"TooltipText": "",
|
||||
"ItemID": 10289,
|
||||
"GumpID": 0,
|
||||
"Hue": 1177,
|
||||
"Price": 2500
|
||||
},
|
||||
{
|
||||
"Type": "Server.Items.RoyalMintBox",
|
||||
"NameLines": ["Royal Mint Processing Box"],
|
||||
@@ -8,7 +28,7 @@
|
||||
"ItemID": 2472,
|
||||
"GumpID": 0,
|
||||
"Hue": 2713,
|
||||
"Price": 5000
|
||||
"Price": 1500
|
||||
},
|
||||
{
|
||||
"Type": "Server.Items.VirtueShield",
|
||||
@@ -294,56 +314,6 @@
|
||||
"Hue": 0,
|
||||
"Price": 1500
|
||||
},
|
||||
{
|
||||
"Type": "Server.Items.HoodedBritanniaRobe",
|
||||
"NameLines": ["1125155"],
|
||||
"Tooltip": 1158016,
|
||||
"TooltipText": "",
|
||||
"ItemID": 41131,
|
||||
"GumpID": 0,
|
||||
"Hue": 0,
|
||||
"Price": 1500
|
||||
},
|
||||
{
|
||||
"Type": "Server.Items.HoodedBritanniaRobe",
|
||||
"NameLines": ["1125155"],
|
||||
"Tooltip": 1158016,
|
||||
"TooltipText": "",
|
||||
"ItemID": 41132,
|
||||
"GumpID": 0,
|
||||
"Hue": 0,
|
||||
"Price": 1500
|
||||
},
|
||||
{
|
||||
"Type": "Server.Items.HoodedBritanniaRobe",
|
||||
"NameLines": ["1125155"],
|
||||
"Tooltip": 1158016,
|
||||
"TooltipText": "",
|
||||
"ItemID": 41133,
|
||||
"GumpID": 0,
|
||||
"Hue": 0,
|
||||
"Price": 1500
|
||||
},
|
||||
{
|
||||
"Type": "Server.Items.HoodedBritanniaRobe",
|
||||
"NameLines": ["1125155"],
|
||||
"Tooltip": 1158016,
|
||||
"TooltipText": "",
|
||||
"ItemID": 41134,
|
||||
"GumpID": 0,
|
||||
"Hue": 0,
|
||||
"Price": 1500
|
||||
},
|
||||
{
|
||||
"Type": "Server.Items.HoodedBritanniaRobe",
|
||||
"NameLines": ["1125155"],
|
||||
"Tooltip": 1158016,
|
||||
"TooltipText": "",
|
||||
"ItemID": 41135,
|
||||
"GumpID": 0,
|
||||
"Hue": 0,
|
||||
"Price": 1500
|
||||
},
|
||||
{
|
||||
"Type": "Server.Items.HaochisPigment",
|
||||
"NameLines": ["1071249", "1157275"],
|
||||
|
||||
@@ -302,7 +302,6 @@
|
||||
0 4762 1552 1728 37 #1016310
|
||||
0 4765 1552 1728 34 #1016310
|
||||
0 4765 1532 1705 33 #1016310
|
||||
0 4765 1485 1709 15 #1016310
|
||||
0 4761 1488 1731 15 #1016310
|
||||
0 4764 1468 1732 15 #1016310
|
||||
0 4764 1441 1732 19 #1016310
|
||||
|
||||
BIN
Binary file not shown.
@@ -1,41 +1,48 @@
|
||||
MCS=mcs
|
||||
CSC=dotnet csc
|
||||
EXENAME=ServUO
|
||||
CURPATH=`pwd`
|
||||
SRVPATH=${CURPATH}/Server
|
||||
SDKPATH=${CURPATH}/Ultima
|
||||
REFS=System.Drawing.dll
|
||||
CURPATH=$(shell pwd)
|
||||
SRVPATH=$(CURPATH)/Server
|
||||
SDKPATH=$(CURPATH)/Ultima
|
||||
REFS=/usr/lib/mono/4.8-api/System.Drawing.dll
|
||||
NOWARNS=0618,0219,0414,1635
|
||||
|
||||
PHONY : default build clean run
|
||||
PHONY: default build clean run
|
||||
|
||||
default: run
|
||||
|
||||
debug:
|
||||
${MCS} -target:library -out:${CURPATH}/Ultima.dll -r:${REFS} -nowarn:${NOWARNS} -d:DEBUG -d:MONO -d:ServUO -d:NEWTIMERS -nologo -debug -unsafe -recurse:${SDKPATH}/*.cs
|
||||
${MCS} -win32icon:${SRVPATH}/servuo.ico -r:${CURPATH}/Ultima.dll,${REFS} -nowarn:${NOWARNS} -target:exe -out:${CURPATH}/${EXENAME}.exe -d:DEBUG -d:MONO -d:ServUO -d:NEWTIMERS -nologo -debug -unsafe -recurse:${SRVPATH}/*.cs
|
||||
sed -i.bak -e 's/<!--//g; s/-->//g' ${EXENAME}.exe.config
|
||||
debug: Ultima.dll ServUO.exe
|
||||
<TAB>sed -i.bak -e 's/<!--//g; s/-->//g' $(EXENAME).exe.config
|
||||
|
||||
run: build
|
||||
${CURPATH}/${EXENAME}.sh
|
||||
<TAB>$(CURPATH)/$(EXENAME).sh
|
||||
|
||||
build: ${EXENAME}.sh
|
||||
build: ServUO.exe
|
||||
<TAB>echo "#!/bin/sh" > $(CURPATH)/$(EXENAME).sh
|
||||
<TAB>echo "dotnet $(CURPATH)/$(EXENAME).exe" >> $(CURPATH)/$(EXENAME).sh
|
||||
<TAB>chmod a+x $(CURPATH)/$(EXENAME).sh
|
||||
<TAB>sed -i.bak -e 's/<!--//g; s/-->//g' $(EXENAME).exe.config
|
||||
|
||||
clean:
|
||||
rm -f ${EXENAME}.sh
|
||||
rm -f ${EXENAME}.exe
|
||||
rm -f ${EXENAME}.exe.mdb
|
||||
rm -f Ultima.dll
|
||||
rm -f Ultima.dll.mdb
|
||||
rm -f *.bin
|
||||
<TAB>rm -f $(EXENAME).sh
|
||||
<TAB>rm -f $(EXENAME).exe
|
||||
<TAB>rm -f Ultima.dll
|
||||
<TAB>rm -rf obj bin
|
||||
<TAB>rm -f *.bin
|
||||
|
||||
Ultima.dll: Ultima/*.cs
|
||||
${MCS} -target:library -out:${CURPATH}/Ultima.dll -r:${REFS} -nowarn:${NOWARNS} -d:MONO -d:ServUO -d:NEWTIMERS -nologo -optimize -unsafe -recurse:${SDKPATH}/*.cs
|
||||
Ultima.dll:
|
||||
<TAB>$(CSC) -target:library -out:$(CURPATH)/Ultima.dll \
|
||||
-r:$(REFS) -nowarn:$(NOWARNS) \
|
||||
-d:ServUO -d:NEWTIMERS \
|
||||
-nologo -optimize -unsafe \
|
||||
-langversion:latest \
|
||||
-recurse:$(SDKPATH)/*.cs
|
||||
|
||||
${EXENAME}.exe: Ultima.dll Server/*.cs
|
||||
${MCS} -win32icon:${SRVPATH}/servuo.ico -r:${CURPATH}/Ultima.dll,${REFS} -nowarn:${NOWARNS} -target:exe -out:${CURPATH}/${EXENAME}.exe -d:MONO -d:ServUO -d:NEWTIMERS -nologo -optimize -unsafe -recurse:${SRVPATH}/*.cs
|
||||
|
||||
${EXENAME}.sh: ${EXENAME}.exe
|
||||
echo "#!/bin/sh" > ${CURPATH}/${EXENAME}.sh
|
||||
echo "mono ${CURPATH}/${EXENAME}.exe" >> ${CURPATH}/${EXENAME}.sh
|
||||
chmod a+x ${CURPATH}/${EXENAME}.sh
|
||||
sed -i.bak -e 's/<!--//g; s/-->//g' ${EXENAME}.exe.config
|
||||
ServUO.exe: Ultima.dll
|
||||
<TAB>$(CSC) -win32icon:$(SRVPATH)/servuo.ico \
|
||||
-r:$(CURPATH)/Ultima.dll -r:$(REFS) \
|
||||
-nowarn:$(NOWARNS) \
|
||||
-target:exe -out:$(CURPATH)/$(EXENAME).exe \
|
||||
-d:ServUO -d:NEWTIMERS \
|
||||
-nologo -optimize -unsafe \
|
||||
-langversion:latest \
|
||||
-recurse:$(SRVPATH)/*.cs
|
||||
|
||||
@@ -19,35 +19,26 @@ ServUO is a community driven Ultima Online Server Emulator written in C#.
|
||||
|
||||
#### Windows
|
||||
|
||||
Run `Compile.WIN - Debug.bat` for development, attaching a debugger and/or extended output.
|
||||
Run `_windebug.bat` for development, attaching a debugger and/or extended output.
|
||||
|
||||
Run `Compile.WIN - Release.bat` for production environment (-debug is still a supported parameter for script debugging).
|
||||
|
||||
After this you can run the server by executing `ServUO.exe`.
|
||||
Run `_winrelease.bat` for production environment.
|
||||
|
||||
|
||||
#### OSX
|
||||
```
|
||||
brew install mono
|
||||
make
|
||||
```
|
||||
#### Other Platforms
|
||||
|
||||
Run `_makedebug` for development, attaching a debugger and/or extended output.
|
||||
|
||||
#### Ubuntu
|
||||
```
|
||||
apt-get install mono-complete
|
||||
make
|
||||
```
|
||||
Run `_makerelease` for production environment.
|
||||
|
||||
|
||||
### Summary
|
||||
|
||||
1. Starting with the `/Config` directory, find and edit `Server.cfg` to set up the essentials.
|
||||
2. Go through the remaining `*.cfg` files to ensure they suit your needs.
|
||||
3. For Windows, run `Compile.WIN - Debug.bat` to produce `ServUO.exe`, Linux users may run `Makefile`.
|
||||
4. Run `ServUO.exe` to make sure everything boots up, if everything went well, you should see your IP adress being listened on the port you specified.
|
||||
5. Load up UO and login! - If you require instructions on setting up your particular client, visit the Discord and ask!
|
||||
|
||||
3. For Windows, run `_winrelease.bat` to produce `ServUO.exe`, OSX/Linux users may run `_makerelease`.
|
||||
4. Run `ServUO`
|
||||
5. ???
|
||||
6. Profit!
|
||||
|
||||
|
||||
[ServUO]: <https://www.servuo.com>
|
||||
|
||||
Executable → Regular
BIN
Binary file not shown.
@@ -32,7 +32,7 @@ namespace Server.Misc
|
||||
if (!Enabled || IsExempt(ourAddress))
|
||||
return true;
|
||||
|
||||
List<NetState> netStates = NetState.Instances;
|
||||
IList<NetState> netStates = NetState.Instances;
|
||||
|
||||
int count = 0;
|
||||
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
|
||||
using Server.Network;
|
||||
|
||||
namespace Server.Commands.Generic
|
||||
@@ -36,7 +38,7 @@ namespace Server.Commands.Generic
|
||||
ArrayList list = new ArrayList();
|
||||
ArrayList addresses = new ArrayList();
|
||||
|
||||
System.Collections.Generic.List<NetState> states = NetState.Instances;
|
||||
IList<NetState> states = NetState.Instances;
|
||||
|
||||
for (int i = 0; i < states.Count; ++i)
|
||||
{
|
||||
|
||||
@@ -36,7 +36,7 @@ namespace Server.Commands.Generic
|
||||
|
||||
ArrayList list = new ArrayList();
|
||||
|
||||
List<NetState> states = NetState.Instances;
|
||||
IList<NetState> states = NetState.Instances;
|
||||
|
||||
for (int i = 0; i < states.Count; ++i)
|
||||
{
|
||||
|
||||
@@ -164,6 +164,9 @@ namespace Server.Commands
|
||||
|
||||
while ((line = ip.ReadLine()) != null)
|
||||
{
|
||||
if (string.IsNullOrEmpty(line))
|
||||
continue;
|
||||
|
||||
string[] split = line.Split(' ');
|
||||
|
||||
SignEntry e = new SignEntry(
|
||||
|
||||
@@ -14,7 +14,7 @@ namespace Server.Commands
|
||||
public static void CheckTime_OnCommand(CommandEventArgs e)
|
||||
{
|
||||
Mobile m = e.Mobile;
|
||||
DateTime now = DateTime.Now;
|
||||
DateTime now = DateTime.UtcNow;
|
||||
m.SendMessage("The Current Date And Time Is " + now + "(EST)");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,48 @@
|
||||
using System;
|
||||
using Server;
|
||||
using Server.Items;
|
||||
using Server.Engines.XmlSpawner2;
|
||||
using Server.Custom;
|
||||
|
||||
namespace Server.Custom
|
||||
{
|
||||
public class DurabilityAttachment : XmlAttachment
|
||||
{
|
||||
public bool RepairLocked { get; set; }
|
||||
public int PoFUses { get; set; }
|
||||
public int MaxPoFUses { get; set; }
|
||||
|
||||
public DurabilityAttachment() : base()
|
||||
{
|
||||
}
|
||||
|
||||
public DurabilityAttachment(ASerial serial) : base(serial)
|
||||
{
|
||||
}
|
||||
|
||||
public override void Serialize(GenericWriter writer)
|
||||
{
|
||||
base.Serialize(writer);
|
||||
|
||||
writer.Write((int)0); // version
|
||||
|
||||
writer.Write(RepairLocked);
|
||||
writer.Write(PoFUses);
|
||||
writer.Write(MaxPoFUses);
|
||||
}
|
||||
|
||||
public override void Deserialize(GenericReader reader)
|
||||
{
|
||||
base.Deserialize(reader);
|
||||
|
||||
int version = reader.ReadInt();
|
||||
|
||||
if (version >= 0)
|
||||
{
|
||||
RepairLocked = reader.ReadBool();
|
||||
PoFUses = reader.ReadInt();
|
||||
MaxPoFUses = reader.ReadInt();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,52 @@
|
||||
using Server;
|
||||
using Server.Items;
|
||||
using Server.Engines.XmlSpawner2;
|
||||
|
||||
namespace Server.Custom
|
||||
{
|
||||
public static class DurabilityExtensions
|
||||
{
|
||||
private static DurabilityAttachment GetAttach(Item item)
|
||||
{
|
||||
var att = XmlAttach.FindAttachment(item, typeof(DurabilityAttachment)) as DurabilityAttachment;
|
||||
|
||||
if (att == null)
|
||||
{
|
||||
att = new DurabilityAttachment();
|
||||
XmlAttach.AttachTo(item, att);
|
||||
}
|
||||
|
||||
return att;
|
||||
}
|
||||
|
||||
public static bool GetRepairLocked(this Item item)
|
||||
{
|
||||
return GetAttach(item).RepairLocked;
|
||||
}
|
||||
|
||||
public static void SetRepairLocked(this Item item, bool value)
|
||||
{
|
||||
GetAttach(item).RepairLocked = value;
|
||||
}
|
||||
|
||||
public static int GetPoFUses(this Item item)
|
||||
{
|
||||
return GetAttach(item).PoFUses;
|
||||
}
|
||||
|
||||
public static void SetPoFUses(this Item item, int value)
|
||||
{
|
||||
GetAttach(item).PoFUses = value;
|
||||
}
|
||||
|
||||
public static int GetMaxPoFUses(this Item item)
|
||||
{
|
||||
return GetAttach(item).MaxPoFUses;
|
||||
}
|
||||
|
||||
public static void SetMaxPoFUses(this Item item, int value)
|
||||
{
|
||||
GetAttach(item).MaxPoFUses = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,88 @@
|
||||
using System;
|
||||
using Server.Items;
|
||||
|
||||
namespace Server.Items
|
||||
{
|
||||
|
||||
public class ArmsofApathy2 : PlateArms
|
||||
{
|
||||
public override bool IsArtifact { get { return true; } }
|
||||
|
||||
[Constructable]
|
||||
public ArmsofApathy2() : base()
|
||||
{
|
||||
Name = "Arms of Apathy";
|
||||
LootType = LootType.Blessed;
|
||||
Weight = 5.0;
|
||||
|
||||
this.SetHue = 1109;
|
||||
this.Attributes.RegenHits = 1;
|
||||
this.Attributes.AttackChance = 5;
|
||||
|
||||
this.SetAttributes.ReflectPhysical = 25;
|
||||
this.SetAttributes.NightSight = 1;
|
||||
|
||||
this.SetSkillBonuses.SetValues(0, SkillName.Swords, 10);
|
||||
|
||||
this.SetSelfRepair = 3;
|
||||
|
||||
this.SetPhysicalBonus = 2;
|
||||
this.SetFireBonus = 5;
|
||||
this.SetColdBonus = 5;
|
||||
this.SetPoisonBonus = 3;
|
||||
this.SetEnergyBonus = 5;
|
||||
}
|
||||
|
||||
public ArmsofApathy2( Serial serial ) : base( serial )
|
||||
{
|
||||
}
|
||||
public override int BasePhysicalResistance
|
||||
{
|
||||
get
|
||||
{
|
||||
return 8;
|
||||
}
|
||||
}
|
||||
public override int BaseFireResistance
|
||||
{
|
||||
get
|
||||
{
|
||||
return 5;
|
||||
}
|
||||
}
|
||||
public override int BaseColdResistance
|
||||
{
|
||||
get
|
||||
{
|
||||
return 5;
|
||||
}
|
||||
}
|
||||
public override int BasePoisonResistance
|
||||
{
|
||||
get
|
||||
{
|
||||
return 7;
|
||||
}
|
||||
}
|
||||
public override int BaseEnergyResistance
|
||||
{
|
||||
get
|
||||
{
|
||||
return 5;
|
||||
}
|
||||
}
|
||||
public override void Serialize(GenericWriter writer)
|
||||
{
|
||||
base.Serialize(writer);
|
||||
|
||||
writer.Write((int)0); // version
|
||||
}
|
||||
|
||||
public override void Deserialize(GenericReader reader)
|
||||
{
|
||||
base.Deserialize(reader);
|
||||
|
||||
int version = reader.ReadInt();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,88 @@
|
||||
using System;
|
||||
|
||||
namespace Server.Items
|
||||
{
|
||||
[FlipableAttribute(0x1450, 0x1455)]
|
||||
public class GlovesofInjustice2 : PlateGloves
|
||||
{
|
||||
public override bool IsArtifact { get { return true; } }
|
||||
[Constructable]
|
||||
public GlovesofInjustice2()
|
||||
: base()
|
||||
{
|
||||
this.Weight = 2.0;
|
||||
this.Name = "Goves of Injustice";
|
||||
LootType = LootType.Blessed;
|
||||
this.SetHue = 1109;
|
||||
|
||||
this.Attributes.RegenHits = 1;
|
||||
this.Attributes.AttackChance = 5;
|
||||
|
||||
this.SetAttributes.ReflectPhysical = 25;
|
||||
this.SetAttributes.NightSight = 1;
|
||||
|
||||
this.SetSkillBonuses.SetValues(0, SkillName.Swords, 10);
|
||||
|
||||
this.SetSelfRepair = 3;
|
||||
this.SetPhysicalBonus = 2;
|
||||
this.SetFireBonus = 5;
|
||||
this.SetColdBonus = 5;
|
||||
this.SetPoisonBonus = 3;
|
||||
this.SetEnergyBonus = 5;
|
||||
}
|
||||
|
||||
public GlovesofInjustice2(Serial serial)
|
||||
: base(serial)
|
||||
{
|
||||
}
|
||||
|
||||
public override int BasePhysicalResistance
|
||||
{
|
||||
get
|
||||
{
|
||||
return 8;
|
||||
}
|
||||
}
|
||||
public override int BaseFireResistance
|
||||
{
|
||||
get
|
||||
{
|
||||
return 5;
|
||||
}
|
||||
}
|
||||
public override int BaseColdResistance
|
||||
{
|
||||
get
|
||||
{
|
||||
return 5;
|
||||
}
|
||||
}
|
||||
public override int BasePoisonResistance
|
||||
{
|
||||
get
|
||||
{
|
||||
return 7;
|
||||
}
|
||||
}
|
||||
public override int BaseEnergyResistance
|
||||
{
|
||||
get
|
||||
{
|
||||
return 5;
|
||||
}
|
||||
}
|
||||
public override void Serialize(GenericWriter writer)
|
||||
{
|
||||
base.Serialize(writer);
|
||||
|
||||
writer.Write((int)0); // version
|
||||
}
|
||||
|
||||
public override void Deserialize(GenericReader reader)
|
||||
{
|
||||
base.Deserialize(reader);
|
||||
|
||||
int version = reader.ReadInt();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,86 @@
|
||||
using System;
|
||||
|
||||
namespace Server.Items
|
||||
{
|
||||
public class HeartofObsidian2 : PlateChest
|
||||
{
|
||||
public override bool IsArtifact { get { return true; } }
|
||||
[Constructable]
|
||||
public HeartofObsidian2()
|
||||
: base()
|
||||
{
|
||||
this.Name = "Heart of Obsidian";
|
||||
LootType = LootType.Blessed;
|
||||
this.SetHue = 1109;
|
||||
this.Attributes.RegenHits = 1;
|
||||
this.Attributes.AttackChance = 5;
|
||||
|
||||
this.SetAttributes.ReflectPhysical = 25;
|
||||
this.SetAttributes.NightSight = 1;
|
||||
|
||||
this.SetSkillBonuses.SetValues(0, SkillName.Swords, 10);
|
||||
|
||||
this.SetSelfRepair = 3;
|
||||
this.SetPhysicalBonus = 2;
|
||||
this.SetFireBonus = 5;
|
||||
this.SetColdBonus = 5;
|
||||
this.SetPoisonBonus = 3;
|
||||
this.SetEnergyBonus = 5;
|
||||
}
|
||||
|
||||
public HeartofObsidian2(Serial serial)
|
||||
: base(serial)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
public override int BasePhysicalResistance
|
||||
{
|
||||
get
|
||||
{
|
||||
return 8;
|
||||
}
|
||||
}
|
||||
public override int BaseFireResistance
|
||||
{
|
||||
get
|
||||
{
|
||||
return 5;
|
||||
}
|
||||
}
|
||||
public override int BaseColdResistance
|
||||
{
|
||||
get
|
||||
{
|
||||
return 5;
|
||||
}
|
||||
}
|
||||
public override int BasePoisonResistance
|
||||
{
|
||||
get
|
||||
{
|
||||
return 7;
|
||||
}
|
||||
}
|
||||
public override int BaseEnergyResistance
|
||||
{
|
||||
get
|
||||
{
|
||||
return 5;
|
||||
}
|
||||
}
|
||||
public override void Serialize(GenericWriter writer)
|
||||
{
|
||||
base.Serialize(writer);
|
||||
|
||||
writer.Write((int)0); // version
|
||||
}
|
||||
|
||||
public override void Deserialize(GenericReader reader)
|
||||
{
|
||||
base.Deserialize(reader);
|
||||
|
||||
int version = reader.ReadInt();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,89 @@
|
||||
using System;
|
||||
|
||||
namespace Server.Items
|
||||
{
|
||||
public class HelmofIgnorance2 : NorseHelm
|
||||
{
|
||||
public override bool IsArtifact { get { return true; } }
|
||||
[Constructable]
|
||||
public HelmofIgnorance2()
|
||||
: base()
|
||||
{
|
||||
|
||||
this.Name = "Helm of Ignorance";
|
||||
LootType = LootType.Blessed;
|
||||
this.SetHue = 1109;
|
||||
|
||||
this.Attributes.RegenHits = 1;
|
||||
this.Attributes.AttackChance = 5;
|
||||
|
||||
this.SetAttributes.ReflectPhysical = 25;
|
||||
this.SetAttributes.NightSight = 1;
|
||||
|
||||
this.SetSkillBonuses.SetValues(0, SkillName.Swords, 10);
|
||||
|
||||
this.SetSelfRepair = 3;
|
||||
|
||||
this.SetPhysicalBonus = 2;
|
||||
this.SetFireBonus = 5;
|
||||
this.SetColdBonus = 5;
|
||||
this.SetPoisonBonus = 3;
|
||||
this.SetEnergyBonus = 5;
|
||||
}
|
||||
|
||||
public HelmofIgnorance2(Serial serial)
|
||||
: base(serial)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
public override int BasePhysicalResistance
|
||||
{
|
||||
get
|
||||
{
|
||||
return 4;
|
||||
}
|
||||
}
|
||||
public override int BaseFireResistance
|
||||
{
|
||||
get
|
||||
{
|
||||
return 9;
|
||||
}
|
||||
}
|
||||
public override int BaseColdResistance
|
||||
{
|
||||
get
|
||||
{
|
||||
return 3;
|
||||
}
|
||||
}
|
||||
public override int BasePoisonResistance
|
||||
{
|
||||
get
|
||||
{
|
||||
return 6;
|
||||
}
|
||||
}
|
||||
public override int BaseEnergyResistance
|
||||
{
|
||||
get
|
||||
{
|
||||
return 8;
|
||||
}
|
||||
}
|
||||
public override void Serialize(GenericWriter writer)
|
||||
{
|
||||
base.Serialize(writer);
|
||||
|
||||
writer.Write((int)0); // version
|
||||
}
|
||||
|
||||
public override void Deserialize(GenericReader reader)
|
||||
{
|
||||
base.Deserialize(reader);
|
||||
|
||||
int version = reader.ReadInt();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,87 @@
|
||||
using System;
|
||||
|
||||
namespace Server.Items
|
||||
{
|
||||
public class LegsofSloth2 : PlateLegs
|
||||
{
|
||||
public override bool IsArtifact { get { return true; } }
|
||||
[Constructable]
|
||||
public LegsofSloth2()
|
||||
: base()
|
||||
{
|
||||
|
||||
this.Name = "Legs of Sloth";
|
||||
LootType = LootType.Blessed;
|
||||
this.SetHue = 1109;
|
||||
|
||||
this.Attributes.RegenHits = 1;
|
||||
this.Attributes.AttackChance = 5;
|
||||
|
||||
this.SetAttributes.ReflectPhysical = 25;
|
||||
this.SetAttributes.NightSight = 1;
|
||||
|
||||
this.SetSkillBonuses.SetValues(0, SkillName.Swords, 10);
|
||||
|
||||
this.SetSelfRepair = 3;
|
||||
|
||||
this.SetPhysicalBonus = 2;
|
||||
this.SetFireBonus = 5;
|
||||
this.SetColdBonus = 5;
|
||||
this.SetPoisonBonus = 3;
|
||||
this.SetEnergyBonus = 5;
|
||||
}
|
||||
|
||||
public LegsofSloth2(Serial serial)
|
||||
: base(serial)
|
||||
{
|
||||
}
|
||||
public override int BasePhysicalResistance
|
||||
{
|
||||
get
|
||||
{
|
||||
return 8;
|
||||
}
|
||||
}
|
||||
public override int BaseFireResistance
|
||||
{
|
||||
get
|
||||
{
|
||||
return 5;
|
||||
}
|
||||
}
|
||||
public override int BaseColdResistance
|
||||
{
|
||||
get
|
||||
{
|
||||
return 5;
|
||||
}
|
||||
}
|
||||
public override int BasePoisonResistance
|
||||
{
|
||||
get
|
||||
{
|
||||
return 7;
|
||||
}
|
||||
}
|
||||
public override int BaseEnergyResistance
|
||||
{
|
||||
get
|
||||
{
|
||||
return 5;
|
||||
}
|
||||
}
|
||||
public override void Serialize(GenericWriter writer)
|
||||
{
|
||||
base.Serialize(writer);
|
||||
|
||||
writer.Write((int)0); // version
|
||||
}
|
||||
|
||||
public override void Deserialize(GenericReader reader)
|
||||
{
|
||||
base.Deserialize(reader);
|
||||
|
||||
int version = reader.ReadInt();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,86 @@
|
||||
using System;
|
||||
|
||||
namespace Server.Items
|
||||
{
|
||||
public class UnbendingNeck2 : PlateGorget
|
||||
{
|
||||
public override bool IsArtifact { get { return true; } }
|
||||
[Constructable]
|
||||
public UnbendingNeck2()
|
||||
: base()
|
||||
{
|
||||
this.SetHue = 1109;
|
||||
this.Name = "Unbending Neck";
|
||||
LootType = LootType.Blessed;
|
||||
this.Attributes.RegenHits = 1;
|
||||
this.Attributes.AttackChance = 5;
|
||||
|
||||
this.SetAttributes.ReflectPhysical = 25;
|
||||
this.SetAttributes.NightSight = 1;
|
||||
|
||||
this.SetSkillBonuses.SetValues(0, SkillName.Swords, 10);
|
||||
|
||||
this.SetSelfRepair = 3;
|
||||
this.SetPhysicalBonus = 2;
|
||||
this.SetFireBonus = 5;
|
||||
this.SetColdBonus = 5;
|
||||
this.SetPoisonBonus = 3;
|
||||
this.SetEnergyBonus = 5;
|
||||
}
|
||||
|
||||
public UnbendingNeck2(Serial serial)
|
||||
: base(serial)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
public override int BasePhysicalResistance
|
||||
{
|
||||
get
|
||||
{
|
||||
return 8;
|
||||
}
|
||||
}
|
||||
public override int BaseFireResistance
|
||||
{
|
||||
get
|
||||
{
|
||||
return 5;
|
||||
}
|
||||
}
|
||||
public override int BaseColdResistance
|
||||
{
|
||||
get
|
||||
{
|
||||
return 5;
|
||||
}
|
||||
}
|
||||
public override int BasePoisonResistance
|
||||
{
|
||||
get
|
||||
{
|
||||
return 7;
|
||||
}
|
||||
}
|
||||
public override int BaseEnergyResistance
|
||||
{
|
||||
get
|
||||
{
|
||||
return 5;
|
||||
}
|
||||
}
|
||||
public override void Serialize(GenericWriter writer)
|
||||
{
|
||||
base.Serialize(writer);
|
||||
|
||||
writer.Write((int)0); // version
|
||||
}
|
||||
|
||||
public override void Deserialize(GenericReader reader)
|
||||
{
|
||||
base.Deserialize(reader);
|
||||
|
||||
int version = reader.ReadInt();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,47 @@
|
||||
using System;
|
||||
using Server;
|
||||
|
||||
namespace Server.Items
|
||||
{
|
||||
public class ViceInfusedShield : BaseShield
|
||||
{
|
||||
public override int BasePhysicalResistance{ get{ return 0; } }
|
||||
public override int BaseFireResistance{ get{ return 1; } }
|
||||
public override int BaseColdResistance{ get{ return 0; } }
|
||||
public override int BasePoisonResistance{ get{ return 0; } }
|
||||
public override int BaseEnergyResistance{ get{ return 0; } }
|
||||
|
||||
public override int InitMinHits{ get{ return 50; } }
|
||||
public override int InitMaxHits{ get{ return 65; } }
|
||||
|
||||
public override int AosStrReq{ get{ return 90; } }
|
||||
|
||||
public override int ArmorBase{ get{ return 23; } }
|
||||
|
||||
[Constructable]
|
||||
public ViceInfusedShield() : base( 11009 )
|
||||
{
|
||||
Weight = 8.0;
|
||||
Hue = 1109;
|
||||
Name = "Vice Infused Shield";
|
||||
}
|
||||
|
||||
public ViceInfusedShield( Serial serial ) : base(serial)
|
||||
{
|
||||
}
|
||||
|
||||
public override void Deserialize( GenericReader reader )
|
||||
{
|
||||
base.Deserialize( reader );
|
||||
|
||||
int version = reader.ReadInt();
|
||||
}
|
||||
|
||||
public override void Serialize( GenericWriter writer )
|
||||
{
|
||||
base.Serialize( writer );
|
||||
|
||||
writer.Write( (int)0 );//version
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,338 @@
|
||||
//// D&D style Death Knight by Pappa Smurf ////
|
||||
//// Thanks to the Following ////
|
||||
//// David from RunUO.com for giving me an interest in Timers ////
|
||||
//// oO_Sithid_Oo from RunUO.com for proof reading and pointing out my mistakes ////
|
||||
//// and helping with the timer ////
|
||||
//// TMSTKSBK for putting up with me complaining about my timers not working ////
|
||||
//// The RunUO Dev Team for creating RunUO without which this script would be pointless ////
|
||||
//// A_Li_N from RunUO for suggesting using a DateTime Method instead of a timer ////
|
||||
//// Updated on 11/16/2008 to include new Abilities and Updates for RunUO 2.0 SVN 301 ////
|
||||
//// Damage and Armor Rating calcuations, Additional Loot Drops added. ////
|
||||
//////////////////////////////////////////////////////////////////////////////////////////////
|
||||
//////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
using System;
|
||||
using Server.Mobiles;
|
||||
using Server.Spells.Necromancy;
|
||||
using Server;
|
||||
using System.Collections;
|
||||
using Server.Items;
|
||||
using Server.Misc;
|
||||
using Server.Network;
|
||||
using Server.Targeting;
|
||||
using Server.Spells;
|
||||
using Server.Engines.CannedEvil;
|
||||
|
||||
|
||||
namespace Server.Mobiles
|
||||
{
|
||||
|
||||
[CorpseName("corpse of Dupre")]
|
||||
public class FallenDupre : BaseChampion
|
||||
{
|
||||
public override ChampionSkullType SkullType { get { return ChampionSkullType.Despair; } }
|
||||
|
||||
public override WeaponAbility GetWeaponAbility()
|
||||
{
|
||||
switch (Utility.Random(2))
|
||||
{
|
||||
default:
|
||||
case 1: return WeaponAbility.DoubleStrike;
|
||||
case 2: return WeaponAbility.ArmorIgnore;
|
||||
}
|
||||
}
|
||||
|
||||
private DateTime m_NextPowerWordKillTime;
|
||||
[CommandProperty(AccessLevel.GameMaster)]
|
||||
public DateTime NextPowerWordKillTime
|
||||
{
|
||||
get
|
||||
{
|
||||
return m_NextPowerWordKillTime;
|
||||
}
|
||||
set
|
||||
{
|
||||
m_NextPowerWordKillTime = value;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public override bool ClickTitle { get { return false; } }
|
||||
|
||||
[Constructable]
|
||||
public FallenDupre(): base(AIType.AI_Melee)
|
||||
{
|
||||
Name = "Dupre";
|
||||
Title = "Fallen Champion of the Virtues";
|
||||
Body = 744;
|
||||
Hue = 0x4001;
|
||||
SetStr(488, 620);
|
||||
SetDex(121, 170);
|
||||
SetInt(498, 657);
|
||||
|
||||
SetHits(12000 , 15000);
|
||||
SetStam(102, 300);
|
||||
|
||||
SetDamage(10, 20);
|
||||
|
||||
SetDamageType(ResistanceType.Physical, 25);
|
||||
SetDamageType(ResistanceType.Energy, 50);
|
||||
SetResistance(ResistanceType.Physical, 35);
|
||||
SetResistance(ResistanceType.Fire, 50);
|
||||
SetResistance(ResistanceType.Cold, 60);
|
||||
SetResistance(ResistanceType.Poison, 25);
|
||||
SetResistance(ResistanceType.Energy, 40);
|
||||
SetSkill( SkillName.Parry, 120.0 );
|
||||
SetSkill( SkillName.Swords, 120.0 );
|
||||
SetSkill( SkillName.Tactics, 120.0 );
|
||||
SetSkill( SkillName.Anatomy, 120.0 );
|
||||
SetSkill( SkillName.Magery, 120.0);
|
||||
SetSkill( SkillName.SpiritSpeak, 120.0);
|
||||
SetSkill( SkillName.Healing, 120.0);
|
||||
SetSkill(SkillName.EvalInt, 120.0);
|
||||
SetSkill(SkillName.MagicResist, 140.0);
|
||||
SetSkill(SkillName.Chivalry, 120.0);
|
||||
|
||||
|
||||
Fame = 25000;
|
||||
Karma = -25000;
|
||||
|
||||
|
||||
AddItem(new ArmsofApathy2());
|
||||
AddItem(new HeartofObsidian2());
|
||||
AddItem(new GlovesofInjustice2());
|
||||
AddItem(new LegsofSloth2());
|
||||
AddItem(new ThighBoots());
|
||||
AddItem(new Katana());
|
||||
AddItem(new HelmofIgnorance2());
|
||||
AddItem(new ViceInfusedShield());
|
||||
AddItem(new UnbendingNeck2());
|
||||
|
||||
PackGold( 200, 250 );
|
||||
|
||||
new Nightmare().Rider = this;
|
||||
|
||||
}
|
||||
public override Type[] UniqueList
|
||||
{
|
||||
get
|
||||
{
|
||||
return new Type[] { typeof(FangOfRactus) };
|
||||
}
|
||||
}
|
||||
public override Type[] SharedList
|
||||
{
|
||||
get
|
||||
{
|
||||
return new Type[]
|
||||
{
|
||||
typeof(RoyalGuardInvestigatorsCloak),
|
||||
typeof(DjinnisRing),
|
||||
typeof(DetectiveBoots),
|
||||
typeof(GauntletsOfAnger)
|
||||
};
|
||||
}
|
||||
}
|
||||
public override Type[] DecorativeList
|
||||
{
|
||||
get
|
||||
{
|
||||
return new Type[] { typeof(SwampTile), typeof(MonsterStatuette) };
|
||||
}
|
||||
}
|
||||
public override MonsterStatuetteType[] StatueTypes
|
||||
{
|
||||
get
|
||||
{
|
||||
return new MonsterStatuetteType[] { MonsterStatuetteType.Slime };
|
||||
}
|
||||
}
|
||||
public override bool OnBeforeDeath()
|
||||
{
|
||||
IMount mount = this.Mount;
|
||||
|
||||
if (mount != null)
|
||||
mount.Rider = null;
|
||||
|
||||
if (mount is Mobile)
|
||||
((Mobile)mount).Delete();
|
||||
|
||||
return base.OnBeforeDeath();
|
||||
}
|
||||
|
||||
public override void GenerateLoot()
|
||||
{
|
||||
AddLoot(LootPack.UltraRich, 4);
|
||||
AddLoot(LootPack.FilthyRich, 2);
|
||||
AddLoot(LootPack.MedScrolls, 2);
|
||||
switch (Utility.Random(6))
|
||||
{
|
||||
case 0: AddItem(new ArmsofApathy()); break;
|
||||
case 1: AddItem(new HeartofObsidian()); break;
|
||||
case 2: AddItem(new LegsofSloth()); break;
|
||||
case 3: AddItem(new HelmofIgnorance()); break;
|
||||
case 4: AddItem(new GlovesofInjustice()); break;
|
||||
case 5: AddItem(new UnbendingNeck()); break;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
public override bool AlwaysMurderer { get { return true; } }
|
||||
public override bool AutoDispel { get { return true; } }
|
||||
public override double AutoDispelChance { get { return 1.0; } }
|
||||
public override bool BardImmune { get { return !Core.SE; } }
|
||||
public override bool Unprovokable { get { return Core.SE; } }
|
||||
public override bool Uncalmable { get { return Core.SE; } }
|
||||
public override Poison PoisonImmune{ get{ return Poison.Lethal; } }
|
||||
|
||||
public override void OnDamage(int amount, Mobile from, bool willKill)
|
||||
{
|
||||
if (from != null && !willKill && amount > 5 && from.Player && 5 > Utility.Random(10))
|
||||
{
|
||||
string[] toSay = new string[]
|
||||
{
|
||||
"I sacraficed myself for the virtues, this was my reward",
|
||||
"{0}, Fight me with Honor, Die like a Man!",
|
||||
"{0}, You should retreat your skills are no match for mine",
|
||||
"In life I stood against the evils of this world. Now I serve them to bring your doom!",
|
||||
"{0}, You worm, you should be honored to die by my hand!" ,
|
||||
"Tis' but a scratch!"
|
||||
};
|
||||
this.Say(true, String.Format(toSay[Utility.Random(toSay.Length)], from.Name));
|
||||
}
|
||||
|
||||
base.OnDamage(amount, from, willKill);
|
||||
}
|
||||
|
||||
public void PowerWordKill()
|
||||
{
|
||||
ArrayList list = new ArrayList();
|
||||
|
||||
foreach (Mobile m in this.GetMobilesInRange(1))
|
||||
{
|
||||
if (m == this || !CanBeHarmful(m))
|
||||
continue;
|
||||
|
||||
if (m.Player)
|
||||
list.Add(m);
|
||||
}
|
||||
|
||||
foreach (Mobile m in list)
|
||||
{
|
||||
m.SendMessage("Dupre's corruption has given him a remarkable power over death, the ability to kill with a single word.....too bad you were listening!");
|
||||
DoHarmful(m);
|
||||
m.FixedParticles(0x36CB, 1, 9, 9911, 67, 5, EffectLayer.Head);
|
||||
int toPowerWordKill = Utility.RandomMinMax(50000, 60000);
|
||||
m.Damage(toPowerWordKill, this);
|
||||
}
|
||||
NextPowerWordKillTime = DateTime.Now + TimeSpan.FromMinutes(15.0);
|
||||
}
|
||||
|
||||
public void SpawnUndeadArmy(Mobile target)
|
||||
{
|
||||
|
||||
|
||||
Map map = this.Map;
|
||||
|
||||
if (map == null)
|
||||
return;
|
||||
|
||||
int knights = 0;
|
||||
|
||||
foreach (Mobile m in this.GetMobilesInRange(10))
|
||||
{
|
||||
if (m is UndeadKnight || m is WailingBanshee)
|
||||
++knights;
|
||||
|
||||
|
||||
}
|
||||
|
||||
if (knights < 1)
|
||||
{
|
||||
PlaySound(0x567);
|
||||
|
||||
int newUndead = Utility.Random(13);
|
||||
|
||||
for (int i = 0; i < newUndead; ++i)
|
||||
{
|
||||
BaseCreature skeleton;
|
||||
|
||||
switch (Utility.Random(2))
|
||||
{
|
||||
default:
|
||||
case 0: skeleton = new WailingBanshee(); break;
|
||||
case 1: skeleton = new UndeadKnight(); break;
|
||||
|
||||
}
|
||||
|
||||
skeleton.Team = this.Team;
|
||||
|
||||
bool validLocation = false;
|
||||
Point3D loc = this.Location;
|
||||
|
||||
for (int j = 0; !validLocation && j < 10; ++j)
|
||||
{
|
||||
int x = X + Utility.Random(3) - 1;
|
||||
int y = Y + Utility.Random(3) - 1;
|
||||
int z = map.GetAverageZ(x, y);
|
||||
|
||||
if (validLocation = map.CanFit(x, y, this.Z, 16, false, false))
|
||||
loc = new Point3D(x, y, Z);
|
||||
else if (validLocation = map.CanFit(x, y, z, 16, false, false))
|
||||
loc = new Point3D(x, y, z);
|
||||
}
|
||||
|
||||
skeleton.MoveToWorld(loc, map);
|
||||
skeleton.Combatant = target;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public override void OnThink()
|
||||
{
|
||||
if (Hits < 250 && DateTime.Now >= m_NextPowerWordKillTime)
|
||||
PowerWordKill();
|
||||
|
||||
|
||||
}
|
||||
|
||||
public void DoSpecialAbility(Mobile target)
|
||||
{
|
||||
if (Hits < 500 )
|
||||
SpawnUndeadArmy(target);
|
||||
|
||||
}
|
||||
|
||||
public override void OnGotMeleeAttack(Mobile attacker)
|
||||
{
|
||||
base.OnGotMeleeAttack(attacker);
|
||||
DoSpecialAbility(attacker);
|
||||
}
|
||||
|
||||
public override void OnGaveMeleeAttack(Mobile defender)
|
||||
{
|
||||
base.OnGaveMeleeAttack(defender);
|
||||
DoSpecialAbility(defender);
|
||||
}
|
||||
|
||||
|
||||
public FallenDupre( Serial serial ) : base( serial )
|
||||
{
|
||||
}
|
||||
|
||||
public override void Serialize( GenericWriter writer )
|
||||
{
|
||||
base.Serialize( writer );
|
||||
writer.Write( (int) 0 ); // version
|
||||
}
|
||||
|
||||
public override void Deserialize( GenericReader reader )
|
||||
{
|
||||
base.Deserialize( reader );
|
||||
int version = reader.ReadInt();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -21,14 +21,17 @@ namespace Server.Items
|
||||
[Constructable]
|
||||
public HeritageSovereign(int amount) : base(0x14EF) // ORIGINAL ITEM ID
|
||||
{
|
||||
LootType = LootType.Blessed;
|
||||
LootType = LootType.Cursed;
|
||||
Hue = 2713; // ORIGINAL HUE
|
||||
Stackable = true;
|
||||
Amount = amount;
|
||||
|
||||
UpdateName();
|
||||
}
|
||||
|
||||
public static bool CanSearch(Mobile m)
|
||||
{
|
||||
return m != null && m.Region.GetLogoutDelay(m) <= TimeSpan.Zero;
|
||||
}
|
||||
public HeritageSovereign(Serial serial) : base(serial)
|
||||
{
|
||||
}
|
||||
@@ -65,13 +68,21 @@ namespace Server.Items
|
||||
|
||||
public override void OnDoubleClick(Mobile from)
|
||||
{
|
||||
if (!IsChildOf(from.Backpack))
|
||||
|
||||
if (from.AccessLevel < AccessLevel.Counselor && !CanSearch(from))
|
||||
{
|
||||
// Before using the in game store, you must be in a safe log-out location
|
||||
// such as an inn or a house which has you on its Owner, Co-owner, or Friends list.
|
||||
from.SendLocalizedMessage(1156586);
|
||||
return;
|
||||
}
|
||||
else if (!IsChildOf(from.Backpack))
|
||||
{
|
||||
from.SendLocalizedMessage(1042001); // Must be in pack
|
||||
return;
|
||||
}
|
||||
|
||||
if (from is PlayerMobile pm)
|
||||
else if (from is PlayerMobile pm)
|
||||
{
|
||||
pm.DepositSovereigns(Amount);
|
||||
Delete();
|
||||
@@ -161,7 +172,7 @@ namespace Server.CustomSystems
|
||||
// 4. Determine Drop Chance
|
||||
if (!isEndgameBoss)
|
||||
{
|
||||
if (Utility.RandomDouble() > 0.10)
|
||||
if (Utility.RandomDouble() > 0.05)
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -171,7 +182,7 @@ namespace Server.CustomSystems
|
||||
|
||||
if (isEndgameBoss)
|
||||
{
|
||||
baseReward = 200;
|
||||
baseReward = 100;
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -180,9 +191,9 @@ namespace Server.CustomSystems
|
||||
else if (maxHits >= 1000 && maxHits < 5000)
|
||||
baseReward = 10;
|
||||
else if (maxHits >= 5000 && maxHits < 10000)
|
||||
baseReward = 50;
|
||||
baseReward = 25;
|
||||
else if (maxHits >= 10000)
|
||||
baseReward = 100;
|
||||
baseReward = 50;
|
||||
}
|
||||
|
||||
if (baseReward == 0)
|
||||
|
||||
@@ -1,45 +0,0 @@
|
||||
using System;
|
||||
using Server;
|
||||
using Server.Mobiles;
|
||||
using Server.Gumps;
|
||||
|
||||
public class InsuranceAgent : BaseCreature
|
||||
{
|
||||
[Constructable]
|
||||
public InsuranceAgent()
|
||||
: base(AIType.AI_Vendor, FightMode.None, 0, 0, 0.2, 0.4)
|
||||
{
|
||||
Name = "an Insurance Agent";
|
||||
Body = 0x190; // male human
|
||||
Hue = Utility.RandomSkinHue();
|
||||
|
||||
Blessed = true; // invulnerable
|
||||
CantWalk = true; // stationary
|
||||
Frozen = true; // cannot be moved
|
||||
Warmode = false; // never fights
|
||||
}
|
||||
|
||||
public override void OnDoubleClick(Mobile from)
|
||||
{
|
||||
if (from is PlayerMobile pm && pm !=null)
|
||||
{
|
||||
this.Say("Here are your insurance options.");
|
||||
|
||||
pm.OpenItemInsuranceMenu(new ItemInsuranceMenuGump(pm, pm.Items, null, 0));
|
||||
}
|
||||
}
|
||||
|
||||
public InsuranceAgent(Serial serial) : base(serial) { }
|
||||
|
||||
public override void Serialize(GenericWriter writer)
|
||||
{
|
||||
base.Serialize(writer);
|
||||
writer.Write(0);
|
||||
}
|
||||
|
||||
public override void Deserialize(GenericReader reader)
|
||||
{
|
||||
base.Deserialize(reader);
|
||||
reader.ReadInt();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,121 @@
|
||||
using System;
|
||||
using Server;
|
||||
using Server.Items;
|
||||
using Server.Targeting;
|
||||
using Server.Engines.XmlSpawner2;
|
||||
|
||||
namespace Server.Items
|
||||
{
|
||||
public class OilOfRestoration : Item
|
||||
{
|
||||
[Constructable]
|
||||
public OilOfRestoration() : base(0x1C18) // Bottle graphic
|
||||
{
|
||||
Name = "Oil of Restoration";
|
||||
Weight = 1.0;
|
||||
Hue = 241;
|
||||
}
|
||||
|
||||
public OilOfRestoration(Serial serial) : base(serial)
|
||||
{
|
||||
}
|
||||
|
||||
public override void OnDoubleClick(Mobile from)
|
||||
{
|
||||
if (!IsChildOf(from.Backpack))
|
||||
{
|
||||
from.SendMessage("This must be in your pack to use.");
|
||||
return;
|
||||
}
|
||||
|
||||
from.SendMessage("Select an oil cloth to apply the oil to.");
|
||||
from.Target = new OilClothTarget(this);
|
||||
}
|
||||
|
||||
private class OilClothTarget : Target
|
||||
{
|
||||
private OilOfRestoration m_Oil;
|
||||
|
||||
public OilClothTarget(OilOfRestoration oil)
|
||||
: base(1, false, TargetFlags.None)
|
||||
{
|
||||
m_Oil = oil;
|
||||
}
|
||||
|
||||
protected override void OnTarget(Mobile from, object targeted)
|
||||
{
|
||||
if (m_Oil.Deleted)
|
||||
return;
|
||||
|
||||
if (!(targeted is OilCloth cloth))
|
||||
{
|
||||
from.SendMessage("You must target an oil cloth.");
|
||||
return;
|
||||
}
|
||||
|
||||
from.SendMessage("Select the item you wish to restore.");
|
||||
from.Target = new RestoreItemTarget(m_Oil, cloth);
|
||||
}
|
||||
}
|
||||
|
||||
private class RestoreItemTarget : Target
|
||||
{
|
||||
private OilOfRestoration m_Oil;
|
||||
private OilCloth m_Cloth;
|
||||
|
||||
public RestoreItemTarget(OilOfRestoration oil, OilCloth cloth)
|
||||
: base(1, false, TargetFlags.None)
|
||||
{
|
||||
m_Oil = oil;
|
||||
m_Cloth = cloth;
|
||||
}
|
||||
|
||||
protected override void OnTarget(Mobile from, object targeted)
|
||||
{
|
||||
if (m_Oil.Deleted || m_Cloth.Deleted)
|
||||
return;
|
||||
|
||||
if (!(targeted is Item item))
|
||||
{
|
||||
from.SendMessage("That is not a valid item.");
|
||||
return;
|
||||
}
|
||||
|
||||
// Get durability attachment
|
||||
var dura = XmlAttach.FindAttachment(item, typeof(Server.Custom.DurabilityAttachment))
|
||||
as Server.Custom.DurabilityAttachment;
|
||||
|
||||
if (dura == null || !dura.RepairLocked)
|
||||
{
|
||||
from.SendMessage("That item is not tempered and does not require restoration.");
|
||||
return;
|
||||
}
|
||||
|
||||
// Remove repair lock
|
||||
dura.RepairLocked = false;
|
||||
|
||||
// Refresh tooltip
|
||||
item.InvalidateProperties();
|
||||
|
||||
// Consume both items
|
||||
m_Oil.Delete();
|
||||
m_Cloth.Delete();
|
||||
|
||||
from.SendMessage("The oil soaks in and restores the malleability of your item.");
|
||||
from.PlaySound(0x240);
|
||||
}
|
||||
}
|
||||
|
||||
public override void Serialize(GenericWriter writer)
|
||||
{
|
||||
base.Serialize(writer);
|
||||
writer.Write(0);
|
||||
}
|
||||
|
||||
public override void Deserialize(GenericReader reader)
|
||||
{
|
||||
base.Deserialize(reader);
|
||||
reader.ReadInt();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,140 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace Server
|
||||
{
|
||||
public static class MiniJson
|
||||
{
|
||||
public static object Parse(string json)
|
||||
{
|
||||
return new Parser(json).ParseValue();
|
||||
}
|
||||
|
||||
private class Parser
|
||||
{
|
||||
private readonly string _json;
|
||||
private int _index;
|
||||
|
||||
public Parser(string json)
|
||||
{
|
||||
_json = json;
|
||||
}
|
||||
|
||||
public object ParseValue()
|
||||
{
|
||||
SkipWhitespace();
|
||||
|
||||
if (_index >= _json.Length)
|
||||
return null;
|
||||
|
||||
char c = _json[_index];
|
||||
|
||||
if (c == '{') return ParseObject();
|
||||
if (c == '[') return ParseArray();
|
||||
if (c == '"') return ParseString();
|
||||
if (char.IsDigit(c) || c == '-') return ParseNumber();
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
private Dictionary<string, object> ParseObject()
|
||||
{
|
||||
var dict = new Dictionary<string, object>();
|
||||
_index++; // skip {
|
||||
|
||||
while (true)
|
||||
{
|
||||
SkipWhitespace();
|
||||
if (_json[_index] == '}')
|
||||
{
|
||||
_index++;
|
||||
return dict;
|
||||
}
|
||||
|
||||
string key = ParseString();
|
||||
|
||||
SkipWhitespace();
|
||||
_index++; // skip :
|
||||
|
||||
object value = ParseValue();
|
||||
dict[key] = value;
|
||||
|
||||
SkipWhitespace();
|
||||
if (_json[_index] == ',')
|
||||
{
|
||||
_index++;
|
||||
continue;
|
||||
}
|
||||
|
||||
if (_json[_index] == '}')
|
||||
{
|
||||
_index++;
|
||||
return dict;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private List<object> ParseArray()
|
||||
{
|
||||
var list = new List<object>();
|
||||
_index++; // skip [
|
||||
|
||||
while (true)
|
||||
{
|
||||
SkipWhitespace();
|
||||
if (_json[_index] == ']')
|
||||
{
|
||||
_index++;
|
||||
return list;
|
||||
}
|
||||
|
||||
list.Add(ParseValue());
|
||||
|
||||
SkipWhitespace();
|
||||
if (_json[_index] == ',')
|
||||
{
|
||||
_index++;
|
||||
continue;
|
||||
}
|
||||
|
||||
if (_json[_index] == ']')
|
||||
{
|
||||
_index++;
|
||||
return list;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private string ParseString()
|
||||
{
|
||||
_index++; // skip "
|
||||
int start = _index;
|
||||
|
||||
while (_json[_index] != '"')
|
||||
_index++;
|
||||
|
||||
string s = _json.Substring(start, _index - start);
|
||||
_index++; // skip closing "
|
||||
return s;
|
||||
}
|
||||
|
||||
private object ParseNumber()
|
||||
{
|
||||
int start = _index;
|
||||
|
||||
while (_index < _json.Length && (char.IsDigit(_json[_index]) || _json[_index] == '-'))
|
||||
_index++;
|
||||
|
||||
string num = _json.Substring(start, _index - start);
|
||||
return int.Parse(num);
|
||||
}
|
||||
|
||||
private void SkipWhitespace()
|
||||
{
|
||||
while (_index < _json.Length && char.IsWhiteSpace(_json[_index]))
|
||||
_index++;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,50 +0,0 @@
|
||||
using Server;
|
||||
using Server.Gumps;
|
||||
using Server.Network;
|
||||
|
||||
namespace Server.CustomSystems
|
||||
{
|
||||
public class RoyalMintGump : Gump
|
||||
{
|
||||
private readonly Mobile m_From;
|
||||
private readonly RoyalMintOfficial m_NPC;
|
||||
|
||||
public RoyalMintGump(Mobile from, RoyalMintOfficial npc)
|
||||
: base(50, 50)
|
||||
{
|
||||
m_From = from;
|
||||
m_NPC = npc;
|
||||
|
||||
Closable = true;
|
||||
Dragable = true;
|
||||
|
||||
AddPage(0);
|
||||
|
||||
AddBackground(0, 0, 350, 250, 9270);
|
||||
AddLabel(110, 20, 1152, "Royal Mint Services");
|
||||
|
||||
AddButton(40, 70, 4005, 4007, 1, GumpButtonType.Reply, 0);
|
||||
AddLabel(80, 70, 0x34, "Consolidate Your Notes");
|
||||
|
||||
AddButton(40, 120, 4005, 4007, 2, GumpButtonType.Reply, 0);
|
||||
AddLabel(80, 120, 0x34, "Purchase Mint Box (5000)");
|
||||
|
||||
AddButton(40, 170, 4017, 4019, 0, GumpButtonType.Reply, 0);
|
||||
AddLabel(80, 170, 0x34, "Close");
|
||||
}
|
||||
|
||||
public override void OnResponse(NetState sender, RelayInfo info)
|
||||
{
|
||||
switch (info.ButtonID)
|
||||
{
|
||||
case 1:
|
||||
m_NPC.ConsolidateNotes(m_From);
|
||||
break;
|
||||
|
||||
case 2:
|
||||
m_NPC.PurchaseMintBox(m_From);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -15,61 +15,14 @@ namespace Server.CustomSystems
|
||||
public RoyalMintOfficial()
|
||||
: base(AIType.AI_Vendor, FightMode.None, 10, 1, 0.2, 0.4)
|
||||
{
|
||||
Title = "The Royal Mint Official";
|
||||
Hue = Utility.RandomSkinHue();
|
||||
|
||||
if (Female = Utility.RandomBool())
|
||||
{
|
||||
Body = 0x191;
|
||||
Name = NameList.RandomName("female");
|
||||
|
||||
AddItem(new PlateChest());
|
||||
AddItem(new PlateArms());
|
||||
AddItem(new PlateLegs());
|
||||
AddItem(new Cloak(113));
|
||||
|
||||
switch (Utility.Random(3))
|
||||
{
|
||||
case 0:
|
||||
AddItem(new Doublet(Utility.RandomNondyedHue()));
|
||||
break;
|
||||
case 1:
|
||||
AddItem(new Tunic(Utility.RandomNondyedHue()));
|
||||
break;
|
||||
case 2:
|
||||
AddItem(new BodySash(Utility.RandomNondyedHue()));
|
||||
break;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
Name = "Royal Mint Official";
|
||||
Title = "the Sovereign Clerk";
|
||||
Body = 0x190;
|
||||
Name = NameList.RandomName("male");
|
||||
Hue = 33770;
|
||||
|
||||
AddItem(new PlateChest());
|
||||
AddItem(new PlateArms());
|
||||
AddItem(new PlateLegs());
|
||||
AddItem(new Cloak(113));
|
||||
|
||||
switch (Utility.Random(3))
|
||||
{
|
||||
case 0:
|
||||
AddItem(new Doublet(Utility.RandomNondyedHue()));
|
||||
break;
|
||||
case 1:
|
||||
AddItem(new Tunic(Utility.RandomNondyedHue()));
|
||||
break;
|
||||
case 2:
|
||||
AddItem(new BodySash(Utility.RandomNondyedHue()));
|
||||
break;
|
||||
}
|
||||
}
|
||||
Utility.AssignRandomHair(this);
|
||||
|
||||
if (Utility.RandomBool())
|
||||
{
|
||||
Utility.AssignRandomFacialHair(this, HairHue);
|
||||
}
|
||||
AddItem(new Robe(2713));
|
||||
AddItem(new Sandals(1150));
|
||||
AddItem(new GoldBracelet());
|
||||
}
|
||||
|
||||
public RoyalMintOfficial(Serial serial) : base(serial)
|
||||
|
||||
@@ -325,10 +325,8 @@ namespace Server.Gumps
|
||||
sb.Append(((maxIOCP - curIOCP) * 100) / maxIOCP);
|
||||
sb.Append("%");
|
||||
|
||||
List<BufferPool> pools = BufferPool.Pools;
|
||||
IList<BufferPool> pools = BufferPool.Pools;
|
||||
|
||||
lock (pools)
|
||||
{
|
||||
for (int i = 0; i < pools.Count; ++i)
|
||||
{
|
||||
BufferPool pool = pools[i];
|
||||
@@ -360,7 +358,6 @@ namespace Server.Gumps
|
||||
sb.Append(" of ");
|
||||
sb.Append(FormatByteAmount(currentCapacity * bufferSize));
|
||||
}
|
||||
}
|
||||
|
||||
this.AddLabel(20, 200, LabelHue, "Pooling:");
|
||||
this.AddHtml(20, 220, 380, 150, sb.ToString(), true, true);
|
||||
@@ -2041,7 +2038,7 @@ namespace Server.Gumps
|
||||
|
||||
if (level > AccessLevel.VIP)
|
||||
{
|
||||
List<NetState> clients = NetState.Instances;
|
||||
IList<NetState> clients = NetState.Instances;
|
||||
int count = 0;
|
||||
|
||||
for (int i = 0; i < clients.Count; ++i)
|
||||
@@ -2178,7 +2175,7 @@ namespace Server.Gumps
|
||||
}
|
||||
else
|
||||
{
|
||||
List<NetState> instances = NetState.Instances;
|
||||
IList<NetState> instances = NetState.Instances;
|
||||
|
||||
for (int i = 0; i < instances.Count; ++i)
|
||||
{
|
||||
|
||||
@@ -81,7 +81,7 @@ namespace Server.Gumps
|
||||
filter = filter.ToLower();
|
||||
|
||||
List<Mobile> list = new List<Mobile>();
|
||||
List<NetState> states = NetState.Instances;
|
||||
IList<NetState> states = NetState.Instances;
|
||||
|
||||
for (int i = 0; i < states.Count; ++i)
|
||||
{
|
||||
|
||||
@@ -1,65 +1,53 @@
|
||||
using System;
|
||||
using Server.Network;
|
||||
using Server.Targeting;
|
||||
using Server.Custom; // Required for durability extension methods
|
||||
|
||||
namespace Server.Items
|
||||
{
|
||||
public class PowderOfTemperament : Item, IUsesRemaining
|
||||
{
|
||||
public static bool CanPOFJewelry = Config.Get("Loot.CanPOFJewelry", false);
|
||||
|
||||
private int m_UsesRemaining;
|
||||
|
||||
[Constructable]
|
||||
public PowderOfTemperament()
|
||||
: this(10)
|
||||
public PowderOfTemperament() : this(10)
|
||||
{
|
||||
}
|
||||
|
||||
[Constructable]
|
||||
public PowderOfTemperament(int charges)
|
||||
: base(4102)
|
||||
public PowderOfTemperament(int charges) : base(4102)
|
||||
{
|
||||
Weight = 1.0;
|
||||
Hue = 2419;
|
||||
UsesRemaining = charges;
|
||||
}
|
||||
|
||||
public PowderOfTemperament(Serial serial)
|
||||
: base(serial)
|
||||
public PowderOfTemperament(Serial serial) : base(serial)
|
||||
{
|
||||
}
|
||||
|
||||
[CommandProperty(AccessLevel.GameMaster)]
|
||||
public int UsesRemaining
|
||||
{
|
||||
get
|
||||
{
|
||||
return m_UsesRemaining;
|
||||
}
|
||||
get { return m_UsesRemaining; }
|
||||
set
|
||||
{
|
||||
m_UsesRemaining = value;
|
||||
InvalidateProperties();
|
||||
}
|
||||
}
|
||||
|
||||
public bool ShowUsesRemaining
|
||||
{
|
||||
get
|
||||
{
|
||||
return true;
|
||||
}
|
||||
set
|
||||
{
|
||||
}
|
||||
get { return true; }
|
||||
set { }
|
||||
}
|
||||
|
||||
public override int LabelNumber
|
||||
{
|
||||
get
|
||||
{
|
||||
return 1049082;
|
||||
get { return 1049082; } // powder of fortifying
|
||||
}
|
||||
}// powder of fortifying
|
||||
|
||||
public override void Serialize(GenericWriter writer)
|
||||
{
|
||||
base.Serialize(writer);
|
||||
@@ -74,31 +62,13 @@ namespace Server.Items
|
||||
|
||||
int version = reader.ReadInt();
|
||||
|
||||
switch ( version )
|
||||
{
|
||||
case 0:
|
||||
{
|
||||
if (version == 0)
|
||||
m_UsesRemaining = reader.ReadInt();
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public override void AddUsesRemainingProperties(ObjectPropertyList list)
|
||||
{
|
||||
list.Add(1060584, m_UsesRemaining.ToString()); // uses remaining: ~1_val~
|
||||
}
|
||||
|
||||
public virtual void DisplayDurabilityTo(Mobile m)
|
||||
{
|
||||
LabelToAffix(m, 1017323, AffixType.Append, ": " + m_UsesRemaining.ToString()); // Durability
|
||||
}
|
||||
|
||||
public override void OnSingleClick(Mobile from)
|
||||
{
|
||||
DisplayDurabilityTo(from);
|
||||
|
||||
base.OnSingleClick(from);
|
||||
list.Add(1060584, m_UsesRemaining.ToString());
|
||||
}
|
||||
|
||||
public override void OnDoubleClick(Mobile from)
|
||||
@@ -106,12 +76,13 @@ namespace Server.Items
|
||||
if (IsChildOf(from.Backpack))
|
||||
from.Target = new InternalTarget(this);
|
||||
else
|
||||
from.SendLocalizedMessage(1042001); // That must be in your pack for you to use it.
|
||||
from.SendLocalizedMessage(1042001); // Must be in pack
|
||||
}
|
||||
|
||||
private class InternalTarget : Target
|
||||
{
|
||||
private readonly PowderOfTemperament m_Powder;
|
||||
private PowderOfTemperament m_Powder;
|
||||
|
||||
public InternalTarget(PowderOfTemperament powder)
|
||||
: base(2, false, TargetFlags.None)
|
||||
{
|
||||
@@ -122,153 +93,169 @@ namespace Server.Items
|
||||
{
|
||||
if (m_Powder.Deleted || m_Powder.UsesRemaining <= 0)
|
||||
{
|
||||
from.SendLocalizedMessage(1049086); // You have used up your powder of temperament.
|
||||
from.SendLocalizedMessage(1049086); // used up
|
||||
return;
|
||||
}
|
||||
|
||||
if (targeted is Item)
|
||||
{
|
||||
Item item = (Item)targeted;
|
||||
bool noGo = false;
|
||||
int antique = 0;
|
||||
Item item = targeted as Item;
|
||||
|
||||
if (!Server.Engines.Craft.Repair.AllowsRepair(item, null) || (item is BaseJewel && !CanPOFJewelry))
|
||||
if (item == null)
|
||||
{
|
||||
from.SendLocalizedMessage(1049083); // You cannot use the powder on that item.
|
||||
from.SendLocalizedMessage(1042001);
|
||||
return;
|
||||
}
|
||||
|
||||
#region SA
|
||||
if (item is BaseWeapon)
|
||||
// Jewelry cannot be fortified (OSI)
|
||||
if (item is BaseJewel)
|
||||
{
|
||||
if (((BaseWeapon)item).Attributes.Brittle > 0 || ((BaseWeapon)item).NegativeAttributes.Brittle > 0)
|
||||
noGo = true;
|
||||
antique = ((BaseWeapon)item).NegativeAttributes.Antique;
|
||||
}
|
||||
else if (item is BaseArmor)
|
||||
{
|
||||
if (((BaseArmor)item).Attributes.Brittle > 0 || ((BaseArmor)item).NegativeAttributes.Brittle > 0)
|
||||
noGo = true;
|
||||
antique = ((BaseArmor)item).NegativeAttributes.Antique;
|
||||
}
|
||||
else if (item is BaseClothing)
|
||||
{
|
||||
if (((BaseClothing)item).Attributes.Brittle > 0 || ((BaseClothing)item).NegativeAttributes.Brittle > 0)
|
||||
noGo = true;
|
||||
antique = ((BaseClothing)item).NegativeAttributes.Antique;
|
||||
}
|
||||
else if (item is BaseJewel)
|
||||
{
|
||||
if (((BaseJewel)item).Attributes.Brittle > 0 || ((BaseJewel)item).NegativeAttributes.Brittle > 0)
|
||||
noGo = true;
|
||||
antique = ((BaseJewel)item).NegativeAttributes.Antique;
|
||||
}
|
||||
else if (item is BaseTalisman && ((BaseTalisman)item).Attributes.Brittle > 0)
|
||||
{
|
||||
noGo = true;
|
||||
}
|
||||
if (noGo)
|
||||
{
|
||||
from.SendLocalizedMessage(1149799); //That cannot be used on brittle items.
|
||||
return;
|
||||
}
|
||||
#endregion
|
||||
|
||||
if (targeted is IDurability)
|
||||
{
|
||||
IDurability wearable = (IDurability)targeted;
|
||||
|
||||
if (!wearable.CanFortify)
|
||||
{
|
||||
from.SendLocalizedMessage(1049083); // You cannot use the powder on that item.
|
||||
from.SendLocalizedMessage(1049083);
|
||||
return;
|
||||
}
|
||||
|
||||
if ((item.IsChildOf(from.Backpack) || (Core.ML && item.Parent == from)) && m_Powder.IsChildOf(from.Backpack))
|
||||
// Brittle or Antique items cannot be fortified (OSI)
|
||||
if (IsBrittle(item) || IsAntique(item))
|
||||
{
|
||||
int origMaxHP = wearable.MaxHitPoints;
|
||||
int origCurHP = wearable.HitPoints;
|
||||
|
||||
if (origMaxHP > 0)
|
||||
{
|
||||
int initMaxHP = antique <= 0 ? 255 : antique == 1 ? 250 : antique == 2 ? 200 : 150;
|
||||
|
||||
wearable.UnscaleDurability();
|
||||
|
||||
if (wearable.MaxHitPoints < initMaxHP)
|
||||
{
|
||||
if (antique > 0)
|
||||
{
|
||||
wearable.MaxHitPoints = initMaxHP;
|
||||
wearable.HitPoints += initMaxHP;
|
||||
}
|
||||
else
|
||||
{
|
||||
int bonus = initMaxHP - wearable.MaxHitPoints;
|
||||
|
||||
if (bonus > 10)
|
||||
bonus = 10;
|
||||
|
||||
wearable.MaxHitPoints += bonus;
|
||||
wearable.HitPoints += bonus;
|
||||
from.SendLocalizedMessage(1049083);
|
||||
return;
|
||||
}
|
||||
|
||||
wearable.ScaleDurability();
|
||||
IDurability wearable = targeted as IDurability;
|
||||
|
||||
if (wearable.MaxHitPoints > 255)
|
||||
wearable.MaxHitPoints = 255;
|
||||
if (wearable.HitPoints > 255)
|
||||
wearable.HitPoints = 255;
|
||||
|
||||
if (wearable.MaxHitPoints > origMaxHP)
|
||||
if (wearable == null || !wearable.CanFortify)
|
||||
{
|
||||
from.SendLocalizedMessage(1049084); // You successfully use the powder on the item.
|
||||
from.SendLocalizedMessage(1049083);
|
||||
return;
|
||||
}
|
||||
|
||||
if (!(item.IsChildOf(from.Backpack) || (Core.ML && item.Parent == from)) || !m_Powder.IsChildOf(from.Backpack))
|
||||
{
|
||||
from.SendLocalizedMessage(1049085);
|
||||
return;
|
||||
}
|
||||
|
||||
// ===============================
|
||||
// HARD CAP CHECK — OSI ACCURATE
|
||||
// ===============================
|
||||
int oldMax = wearable.MaxHitPoints;
|
||||
|
||||
if (oldMax >= 255)
|
||||
{
|
||||
from.SendMessage("This item cannot be fortified any further.");
|
||||
return;
|
||||
}
|
||||
|
||||
// ===============================
|
||||
// APPLY +10 DURABILITY (CAPPED)
|
||||
// ===============================
|
||||
int delta = 10;
|
||||
|
||||
if (oldMax + delta > 255)
|
||||
delta = 255 - oldMax;
|
||||
|
||||
if (delta <= 0)
|
||||
{
|
||||
from.SendMessage("This item cannot be fortified any further.");
|
||||
return;
|
||||
}
|
||||
|
||||
int newMax = oldMax + delta;
|
||||
|
||||
wearable.MaxHitPoints = newMax;
|
||||
wearable.HitPoints += delta;
|
||||
|
||||
if (wearable.HitPoints > wearable.MaxHitPoints)
|
||||
wearable.HitPoints = wearable.MaxHitPoints;
|
||||
|
||||
// ===============================================
|
||||
// REMOVE SELF REPAIR ON FIRST PoF USE
|
||||
// ===============================================
|
||||
if (item is BaseWeapon bw)
|
||||
{
|
||||
bw.WeaponAttributes.SelfRepair = 0;
|
||||
}
|
||||
|
||||
if (item is BaseArmor ba)
|
||||
{
|
||||
ba.ArmorAttributes.SelfRepair = 0;
|
||||
}
|
||||
|
||||
if (item is BaseShield bs)
|
||||
{
|
||||
bs.ArmorAttributes.SelfRepair = 0;
|
||||
}
|
||||
|
||||
if (item is BaseClothing bc)
|
||||
{
|
||||
bc.ClothingAttributes.SelfRepair = 0;
|
||||
}
|
||||
|
||||
// ===============================
|
||||
// TRACK POF USES
|
||||
// ===============================
|
||||
item.SetPoFUses(item.GetPoFUses() + 1);
|
||||
// ===============================
|
||||
// APPLY REPAIR LOCK
|
||||
// ===============================
|
||||
item.SetRepairLocked(true);
|
||||
|
||||
|
||||
|
||||
from.SendMessage("You successfully fortify the item.");
|
||||
from.PlaySound(0x247);
|
||||
|
||||
--m_Powder.UsesRemaining;
|
||||
m_Powder.UsesRemaining--;
|
||||
|
||||
if (m_Powder.UsesRemaining <= 0)
|
||||
{
|
||||
from.SendLocalizedMessage(1049086); // You have used up your powder of fortifying.
|
||||
from.SendLocalizedMessage(1049086);
|
||||
m_Powder.Delete();
|
||||
}
|
||||
}
|
||||
|
||||
if (antique > 0)
|
||||
private bool IsBrittle(Item item)
|
||||
{
|
||||
if (item is BaseWeapon) ((BaseWeapon)item).NegativeAttributes.Antique++;
|
||||
if (item is BaseArmor) ((BaseArmor)item).NegativeAttributes.Antique++;
|
||||
if (item is BaseJewel) ((BaseJewel)item).NegativeAttributes.Antique++;
|
||||
if (item is BaseClothing) ((BaseClothing)item).NegativeAttributes.Antique++;
|
||||
BaseWeapon bw = item as BaseWeapon;
|
||||
if (bw != null && (bw.Attributes.Brittle > 0 || bw.NegativeAttributes.Brittle > 0))
|
||||
return true;
|
||||
|
||||
BaseArmor ba = item as BaseArmor;
|
||||
if (ba != null && (ba.Attributes.Brittle > 0 || ba.NegativeAttributes.Brittle > 0))
|
||||
return true;
|
||||
|
||||
BaseClothing bc = item as BaseClothing;
|
||||
if (bc != null && (bc.Attributes.Brittle > 0 || bc.NegativeAttributes.Brittle > 0))
|
||||
return true;
|
||||
|
||||
BaseJewel bj = item as BaseJewel;
|
||||
if (bj != null && (bj.Attributes.Brittle > 0 || bj.NegativeAttributes.Brittle > 0))
|
||||
return true;
|
||||
|
||||
BaseTalisman bt = item as BaseTalisman;
|
||||
if (bt != null && bt.Attributes.Brittle > 0)
|
||||
return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
else
|
||||
|
||||
private bool IsAntique(Item item)
|
||||
{
|
||||
wearable.MaxHitPoints = origMaxHP;
|
||||
wearable.HitPoints = origCurHP;
|
||||
from.SendLocalizedMessage(1049085); // The item cannot be improved any further.
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
from.SendLocalizedMessage(1049085); // The item cannot be improved any further.
|
||||
wearable.ScaleDurability();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
from.SendLocalizedMessage(1049083); // You cannot use the powder on that item.
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
from.SendLocalizedMessage(1042001); // That must be in your pack for you to use it.
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
from.SendLocalizedMessage(1049083); // You cannot use the powder on that item.
|
||||
}
|
||||
BaseWeapon bw = item as BaseWeapon;
|
||||
if (bw != null && bw.NegativeAttributes.Antique > 0)
|
||||
return true;
|
||||
|
||||
BaseArmor ba = item as BaseArmor;
|
||||
if (ba != null && ba.NegativeAttributes.Antique > 0)
|
||||
return true;
|
||||
|
||||
BaseClothing bc = item as BaseClothing;
|
||||
if (bc != null && bc.NegativeAttributes.Antique > 0)
|
||||
return true;
|
||||
|
||||
BaseJewel bj = item as BaseJewel;
|
||||
if (bj != null && bj.NegativeAttributes.Antique > 0)
|
||||
return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -424,7 +424,7 @@ namespace Server.Items
|
||||
if (m_Protection != ArmorProtectionLevel.Regular)
|
||||
ar += 10 + (5 * (int)m_Protection);
|
||||
|
||||
switch ( m_Resource )
|
||||
switch (m_Resource)
|
||||
{
|
||||
case CraftResource.DullCopper:
|
||||
ar += 2;
|
||||
@@ -1298,7 +1298,7 @@ namespace Server.Items
|
||||
{
|
||||
get
|
||||
{
|
||||
switch ( Layer )
|
||||
switch (Layer)
|
||||
{
|
||||
default:
|
||||
case Layer.Neck:
|
||||
@@ -1327,7 +1327,7 @@ namespace Server.Items
|
||||
|
||||
public int GetProtOffset()
|
||||
{
|
||||
switch ( m_Protection )
|
||||
switch (m_Protection)
|
||||
{
|
||||
case ArmorProtectionLevel.Guarding:
|
||||
return 1;
|
||||
@@ -1372,10 +1372,10 @@ namespace Server.Items
|
||||
{
|
||||
int bonus = 0;
|
||||
|
||||
if (m_Quality == ItemQuality.Exceptional &&!(this is GargishLeatherWingArmor))
|
||||
if (m_Quality == ItemQuality.Exceptional && !(this is GargishLeatherWingArmor))
|
||||
bonus += 20;
|
||||
|
||||
switch ( m_Durability )
|
||||
switch (m_Durability)
|
||||
{
|
||||
case ArmorDurabilityLevel.Durable:
|
||||
bonus += 20;
|
||||
@@ -1903,7 +1903,7 @@ namespace Server.Items
|
||||
|
||||
int version = reader.ReadInt();
|
||||
|
||||
switch ( version )
|
||||
switch (version)
|
||||
{
|
||||
case 15:
|
||||
case 14:
|
||||
@@ -2198,7 +2198,8 @@ namespace Server.Items
|
||||
if (m_ArmorBase == RevertArmorBase)
|
||||
m_ArmorBase = -1;
|
||||
|
||||
/*m_BodyPos = (ArmorBodyType)*/reader.ReadInt();
|
||||
/*m_BodyPos = (ArmorBodyType)*/
|
||||
reader.ReadInt();
|
||||
|
||||
if (version < 4)
|
||||
{
|
||||
@@ -2217,7 +2218,7 @@ namespace Server.Items
|
||||
{
|
||||
OreInfo info;
|
||||
|
||||
switch ( reader.ReadInt() )
|
||||
switch (reader.ReadInt())
|
||||
{
|
||||
default:
|
||||
case 0:
|
||||
@@ -2682,7 +2683,7 @@ namespace Server.Items
|
||||
{
|
||||
int oreType;
|
||||
|
||||
switch ( m_Resource )
|
||||
switch (m_Resource)
|
||||
{
|
||||
case CraftResource.DullCopper: oreType = 1053108; break; // dull copper
|
||||
case CraftResource.ShadowIron: oreType = 1053107; break; // shadow iron
|
||||
@@ -2794,6 +2795,17 @@ namespace Server.Items
|
||||
{
|
||||
base.AddNameProperties(list);
|
||||
|
||||
// ===============================================
|
||||
// DURABILITY TOOLTIP: TEMPERED / REPAIR LOCKED
|
||||
// ===============================================
|
||||
var dura = XmlAttach.FindAttachment(this, typeof(Server.Custom.DurabilityAttachment))
|
||||
as Server.Custom.DurabilityAttachment;
|
||||
|
||||
if (dura != null && dura.RepairLocked)
|
||||
{
|
||||
list.Add("Tempered — Cannot be repaired");
|
||||
}
|
||||
|
||||
#region Factions
|
||||
FactionEquipment.AddFactionProperties(this, list);
|
||||
#endregion
|
||||
@@ -2899,7 +2911,7 @@ namespace Server.Items
|
||||
if ((prop = m_AosArmorAttributes.SoulCharge) != 0)
|
||||
list.Add(1113630, prop.ToString()); // Soul Charge ~1_val~%
|
||||
|
||||
if((prop = m_AosArmorAttributes.ReactiveParalyze) != 0)
|
||||
if ((prop = m_AosArmorAttributes.ReactiveParalyze) != 0)
|
||||
list.Add(1112364); // reactive paralyze
|
||||
|
||||
if ((prop = m_SAAbsorptionAttributes.EaterFire) != 0)
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
using System;
|
||||
using Server.Network;
|
||||
using Server.Engines.XmlSpawner2;
|
||||
|
||||
|
||||
namespace Server.Items
|
||||
{
|
||||
@@ -69,6 +71,16 @@ namespace Server.Items
|
||||
public override void AddNameProperties(ObjectPropertyList list)
|
||||
{
|
||||
base.AddNameProperties(list);
|
||||
// ===============================================
|
||||
// DURABILITY TOOLTIP: TEMPERED / REPAIR LOCKED
|
||||
// ===============================================
|
||||
var dura = XmlAttach.FindAttachment(this, typeof(Server.Custom.DurabilityAttachment))
|
||||
as Server.Custom.DurabilityAttachment;
|
||||
|
||||
if (dura != null && dura.RepairLocked)
|
||||
{
|
||||
list.Add("Tempered — Cannot be repaired");
|
||||
}
|
||||
|
||||
if (Core.EJ && LastParryChance > 0)
|
||||
{
|
||||
|
||||
@@ -5,6 +5,8 @@ using Server.Engines.Craft;
|
||||
using Server.Factions;
|
||||
using Server.Network;
|
||||
using Server.Mobiles;
|
||||
using Server.Engines.XmlSpawner2;
|
||||
|
||||
|
||||
namespace Server.Items
|
||||
{
|
||||
@@ -955,7 +957,7 @@ namespace Server.Items
|
||||
{
|
||||
int oreType;
|
||||
|
||||
switch ( m_Resource )
|
||||
switch (m_Resource)
|
||||
{
|
||||
case CraftResource.DullCopper:
|
||||
oreType = 1053108;
|
||||
@@ -1071,6 +1073,16 @@ namespace Server.Items
|
||||
public override void AddNameProperties(ObjectPropertyList list)
|
||||
{
|
||||
base.AddNameProperties(list);
|
||||
// ===============================================
|
||||
// DURABILITY TOOLTIP: TEMPERED / REPAIR LOCKED
|
||||
// ===============================================
|
||||
var dura = XmlAttach.FindAttachment(this, typeof(Server.Custom.DurabilityAttachment))
|
||||
as Server.Custom.DurabilityAttachment;
|
||||
|
||||
if (dura != null && dura.RepairLocked)
|
||||
{
|
||||
list.Add("Tempered — Cannot be repaired");
|
||||
}
|
||||
|
||||
#region Factions
|
||||
FactionEquipment.AddFactionProperties(this, list);
|
||||
@@ -1614,7 +1626,7 @@ namespace Server.Items
|
||||
|
||||
int version = reader.ReadInt();
|
||||
|
||||
switch ( version )
|
||||
switch (version)
|
||||
{
|
||||
case 12:
|
||||
case 11:
|
||||
@@ -1668,7 +1680,7 @@ namespace Server.Items
|
||||
}
|
||||
case 6:
|
||||
{
|
||||
if(version == 6)
|
||||
if (version == 6)
|
||||
m_SAAbsorptionAttributes = new SAAbsorptionAttributes(this);
|
||||
|
||||
m_TimesImbued = reader.ReadInt();
|
||||
@@ -1933,7 +1945,7 @@ namespace Server.Items
|
||||
{
|
||||
for (int i = 0; i < amount; ++i)
|
||||
{
|
||||
switch ( Utility.Random(5) )
|
||||
switch (Utility.Random(5))
|
||||
{
|
||||
case 0: ++m_AosResistances.Physical; break;
|
||||
case 1: ++m_AosResistances.Fire; break;
|
||||
|
||||
@@ -2237,12 +2237,12 @@ namespace Server.Items
|
||||
|
||||
PlaySwingAnimation(attacker);
|
||||
|
||||
if(defender != null)
|
||||
if (defender != null)
|
||||
PlayHurtAnimation(defender);
|
||||
|
||||
attacker.PlaySound(GetHitAttackSound(attacker, defender));
|
||||
|
||||
if(defender != null)
|
||||
if (defender != null)
|
||||
defender.PlaySound(GetHitDefendSound(attacker, defender));
|
||||
|
||||
int damage = ComputeDamage(attacker, defender);
|
||||
@@ -2969,7 +2969,7 @@ namespace Server.Items
|
||||
{
|
||||
var attrs = RunicReforging.GetAosWeaponAttributes(helm);
|
||||
|
||||
if(attrs != null)
|
||||
if (attrs != null)
|
||||
hldGlasses = attrs.HitLowerDefend;
|
||||
}
|
||||
|
||||
@@ -3327,7 +3327,7 @@ namespace Server.Items
|
||||
|
||||
var count = 0;
|
||||
|
||||
foreach(var m in list)
|
||||
foreach (var m in list)
|
||||
{
|
||||
++count;
|
||||
|
||||
@@ -3475,7 +3475,7 @@ namespace Server.Items
|
||||
#region Elemental Damage
|
||||
public static int[] GetElementDamages(Mobile m)
|
||||
{
|
||||
var o = new[] {100, 0, 0, 0, 0, 0, 0};
|
||||
var o = new[] { 100, 0, 0, 0, 0, 0, 0 };
|
||||
|
||||
var w = m.Weapon as BaseWeapon ?? Fists;
|
||||
|
||||
@@ -3573,7 +3573,7 @@ namespace Server.Items
|
||||
PlaySwingAnimation(attacker);
|
||||
attacker.PlaySound(GetMissAttackSound(attacker, defender));
|
||||
|
||||
if(defender != null)
|
||||
if (defender != null)
|
||||
defender.PlaySound(GetMissDefendSound(attacker, defender));
|
||||
|
||||
WeaponAbility ability = WeaponAbility.GetCurrentAbility(attacker);
|
||||
@@ -3869,7 +3869,7 @@ namespace Server.Items
|
||||
if (Type == WeaponType.Axe)
|
||||
{
|
||||
double lumberValue = attacker.Skills[SkillName.Lumberjacking].Value;
|
||||
lumberValue = (lumberValue/5.0)/100.0;
|
||||
lumberValue = (lumberValue / 5.0) / 100.0;
|
||||
if (lumberValue > 0.2)
|
||||
lumberValue = 0.2;
|
||||
|
||||
@@ -4502,7 +4502,7 @@ namespace Server.Items
|
||||
}
|
||||
case 16:
|
||||
{
|
||||
if(version == 17)
|
||||
if (version == 17)
|
||||
reader.ReadBool();
|
||||
|
||||
_Owner = reader.ReadMobile();
|
||||
@@ -4640,7 +4640,7 @@ namespace Server.Items
|
||||
{
|
||||
SaveFlag flags;
|
||||
|
||||
if(version < 13)
|
||||
if (version < 13)
|
||||
flags = (SaveFlag)reader.ReadInt();
|
||||
else
|
||||
flags = (SaveFlag)reader.ReadLong();
|
||||
@@ -5515,6 +5515,16 @@ namespace Server.Items
|
||||
public override void AddNameProperties(ObjectPropertyList list)
|
||||
{
|
||||
base.AddNameProperties(list);
|
||||
// ===============================================
|
||||
// DURABILITY TOOLTIP: TEMPERED / REPAIR LOCKED
|
||||
// ===============================================
|
||||
var dura = XmlAttach.FindAttachment(this, typeof(Server.Custom.DurabilityAttachment))
|
||||
as Server.Custom.DurabilityAttachment;
|
||||
|
||||
if (dura != null && dura.RepairLocked)
|
||||
{
|
||||
list.Add("Tempered — Cannot be repaired");
|
||||
}
|
||||
|
||||
#region Factions
|
||||
FactionEquipment.AddFactionProperties(this, list);
|
||||
|
||||
Executable → Regular
+10
-3
@@ -119,7 +119,7 @@ namespace Server.Items
|
||||
{
|
||||
m_BagOfSendingHue = value;
|
||||
|
||||
switch ( value )
|
||||
switch (value)
|
||||
{
|
||||
case BagOfSendingHue.Yellow:
|
||||
Hue = 0x8A5;
|
||||
@@ -135,7 +135,7 @@ namespace Server.Items
|
||||
}
|
||||
public static BagOfSendingHue RandomHue()
|
||||
{
|
||||
switch ( Utility.Random(3) )
|
||||
switch (Utility.Random(3))
|
||||
{
|
||||
case 0:
|
||||
return BagOfSendingHue.Yellow;
|
||||
@@ -206,7 +206,7 @@ namespace Server.Items
|
||||
|
||||
int version = reader.ReadEncodedInt();
|
||||
|
||||
switch ( version )
|
||||
switch (version)
|
||||
{
|
||||
case 1:
|
||||
{
|
||||
@@ -260,6 +260,13 @@ namespace Server.Items
|
||||
if (m_Bag.Deleted)
|
||||
return;
|
||||
|
||||
// Block usage anywhere in Felucca
|
||||
if (from.Map == Map.Felucca)
|
||||
{
|
||||
from.SendMessage("A mysterious force prevents the bag from working in Felucca.");
|
||||
return;
|
||||
}
|
||||
|
||||
if (from.Region.IsPartOf<Regions.Jail>())
|
||||
{
|
||||
from.SendMessage("You may not do that in jail.");
|
||||
|
||||
Executable
+318
@@ -0,0 +1,318 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using Server.ContextMenus;
|
||||
using Server.Network;
|
||||
using Server.Targeting;
|
||||
|
||||
namespace Server.Items
|
||||
{
|
||||
public enum BagOfSendingHue
|
||||
{
|
||||
Yellow,
|
||||
Blue,
|
||||
Red
|
||||
}
|
||||
|
||||
public class BagOfSending : Item, TranslocationItem
|
||||
{
|
||||
private int m_Charges;
|
||||
private int m_Recharges;
|
||||
private BagOfSendingHue m_BagOfSendingHue;
|
||||
[Constructable]
|
||||
public BagOfSending()
|
||||
: this(RandomHue())
|
||||
{
|
||||
}
|
||||
|
||||
[Constructable]
|
||||
public BagOfSending(BagOfSendingHue hue)
|
||||
: base(0xE76)
|
||||
{
|
||||
Weight = 2.0;
|
||||
|
||||
BagOfSendingHue = hue;
|
||||
|
||||
m_Charges = Utility.RandomMinMax(3, 9);
|
||||
}
|
||||
|
||||
public BagOfSending(Serial serial)
|
||||
: base(serial)
|
||||
{
|
||||
}
|
||||
|
||||
[CommandProperty(AccessLevel.GameMaster)]
|
||||
public int Charges
|
||||
{
|
||||
get
|
||||
{
|
||||
return m_Charges;
|
||||
}
|
||||
set
|
||||
{
|
||||
if (value > MaxCharges)
|
||||
m_Charges = MaxCharges;
|
||||
else if (value < 0)
|
||||
m_Charges = 0;
|
||||
else
|
||||
m_Charges = value;
|
||||
|
||||
InvalidateProperties();
|
||||
}
|
||||
}
|
||||
[CommandProperty(AccessLevel.GameMaster)]
|
||||
public int Recharges
|
||||
{
|
||||
get
|
||||
{
|
||||
return m_Recharges;
|
||||
}
|
||||
set
|
||||
{
|
||||
if (value > MaxRecharges)
|
||||
m_Recharges = MaxRecharges;
|
||||
else if (value < 0)
|
||||
m_Recharges = 0;
|
||||
else
|
||||
m_Recharges = value;
|
||||
|
||||
InvalidateProperties();
|
||||
}
|
||||
}
|
||||
[CommandProperty(AccessLevel.GameMaster)]
|
||||
public int MaxCharges
|
||||
{
|
||||
get
|
||||
{
|
||||
return 30;
|
||||
}
|
||||
}
|
||||
[CommandProperty(AccessLevel.GameMaster)]
|
||||
public int MaxRecharges
|
||||
{
|
||||
get
|
||||
{
|
||||
return 255;
|
||||
}
|
||||
}
|
||||
public string TranslocationItemName
|
||||
{
|
||||
get
|
||||
{
|
||||
return "bag of sending";
|
||||
}
|
||||
}
|
||||
public override int LabelNumber
|
||||
{
|
||||
get
|
||||
{
|
||||
return 1054104;
|
||||
}
|
||||
}// a bag of sending
|
||||
[CommandProperty(AccessLevel.GameMaster)]
|
||||
public BagOfSendingHue BagOfSendingHue
|
||||
{
|
||||
get
|
||||
{
|
||||
return m_BagOfSendingHue;
|
||||
}
|
||||
set
|
||||
{
|
||||
m_BagOfSendingHue = value;
|
||||
|
||||
switch ( value )
|
||||
{
|
||||
case BagOfSendingHue.Yellow:
|
||||
Hue = 0x8A5;
|
||||
break;
|
||||
case BagOfSendingHue.Blue:
|
||||
Hue = 0x8AD;
|
||||
break;
|
||||
case BagOfSendingHue.Red:
|
||||
Hue = 0x89B;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
public static BagOfSendingHue RandomHue()
|
||||
{
|
||||
switch ( Utility.Random(3) )
|
||||
{
|
||||
case 0:
|
||||
return BagOfSendingHue.Yellow;
|
||||
case 1:
|
||||
return BagOfSendingHue.Blue;
|
||||
default:
|
||||
return BagOfSendingHue.Red;
|
||||
}
|
||||
}
|
||||
|
||||
public override void GetProperties(ObjectPropertyList list)
|
||||
{
|
||||
base.GetProperties(list);
|
||||
|
||||
list.Add(1060741, m_Charges.ToString()); // charges: ~1_val~
|
||||
}
|
||||
|
||||
public override void OnSingleClick(Mobile from)
|
||||
{
|
||||
base.OnSingleClick(from);
|
||||
|
||||
LabelTo(from, 1060741, m_Charges.ToString()); // charges: ~1_val~
|
||||
}
|
||||
|
||||
public override void GetContextMenuEntries(Mobile from, List<ContextMenuEntry> list)
|
||||
{
|
||||
base.GetContextMenuEntries(from, list);
|
||||
|
||||
if (from.Alive)
|
||||
list.Add(new UseBagEntry(this, Charges > 0 && IsChildOf(from.Backpack)));
|
||||
}
|
||||
|
||||
public override void OnDoubleClick(Mobile from)
|
||||
{
|
||||
if (from.Region.IsPartOf<Regions.Jail>())
|
||||
{
|
||||
from.SendMessage("You may not do that in jail.");
|
||||
}
|
||||
else if (!IsChildOf(from.Backpack))
|
||||
{
|
||||
MessageHelper.SendLocalizedMessageTo(this, from, 1062334, 0x59); // The bag of sending must be in your backpack.
|
||||
}
|
||||
else if (Charges == 0)
|
||||
{
|
||||
MessageHelper.SendLocalizedMessageTo(this, from, 1042544, 0x59); // This item is out of charges.
|
||||
}
|
||||
else
|
||||
{
|
||||
from.Target = new SendTarget(this);
|
||||
}
|
||||
}
|
||||
|
||||
public override void Serialize(GenericWriter writer)
|
||||
{
|
||||
base.Serialize(writer);
|
||||
|
||||
writer.WriteEncodedInt((int)1); // version
|
||||
|
||||
writer.WriteEncodedInt((int)m_Recharges);
|
||||
|
||||
writer.WriteEncodedInt((int)m_Charges);
|
||||
writer.WriteEncodedInt((int)m_BagOfSendingHue);
|
||||
}
|
||||
|
||||
public override void Deserialize(GenericReader reader)
|
||||
{
|
||||
base.Deserialize(reader);
|
||||
|
||||
int version = reader.ReadEncodedInt();
|
||||
|
||||
switch ( version )
|
||||
{
|
||||
case 1:
|
||||
{
|
||||
m_Recharges = reader.ReadEncodedInt();
|
||||
goto case 0;
|
||||
}
|
||||
case 0:
|
||||
{
|
||||
m_Charges = Math.Min(reader.ReadEncodedInt(), MaxCharges);
|
||||
m_BagOfSendingHue = (BagOfSendingHue)reader.ReadEncodedInt();
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private class UseBagEntry : ContextMenuEntry
|
||||
{
|
||||
private readonly BagOfSending m_Bag;
|
||||
public UseBagEntry(BagOfSending bag, bool enabled)
|
||||
: base(6189)
|
||||
{
|
||||
m_Bag = bag;
|
||||
|
||||
if (!enabled)
|
||||
Flags |= CMEFlags.Disabled;
|
||||
}
|
||||
|
||||
public override void OnClick()
|
||||
{
|
||||
if (m_Bag.Deleted)
|
||||
return;
|
||||
|
||||
Mobile from = Owner.From;
|
||||
|
||||
if (from.CheckAlive())
|
||||
m_Bag.OnDoubleClick(from);
|
||||
}
|
||||
}
|
||||
|
||||
private class SendTarget : Target
|
||||
{
|
||||
private readonly BagOfSending m_Bag;
|
||||
public SendTarget(BagOfSending bag)
|
||||
: base(-1, false, TargetFlags.None)
|
||||
{
|
||||
m_Bag = bag;
|
||||
}
|
||||
|
||||
protected override void OnTarget(Mobile from, object targeted)
|
||||
{
|
||||
if (m_Bag.Deleted)
|
||||
return;
|
||||
|
||||
if (from.Region.IsPartOf<Regions.Jail>())
|
||||
{
|
||||
from.SendMessage("You may not do that in jail.");
|
||||
}
|
||||
else if (!m_Bag.IsChildOf(from.Backpack))
|
||||
{
|
||||
MessageHelper.SendLocalizedMessageTo(m_Bag, from, 1062334, 0x59); // The bag of sending must be in your backpack. 1054107 is gone from client, using generic response
|
||||
}
|
||||
else if (m_Bag.Charges == 0)
|
||||
{
|
||||
MessageHelper.SendLocalizedMessageTo(m_Bag, from, 1042544, 0x59); // This item is out of charges.
|
||||
}
|
||||
else if (targeted is Item)
|
||||
{
|
||||
Item item = (Item)targeted;
|
||||
int reqCharges = 1; // (int)Math.Max(1, Math.Ceiling(item.TotalWeight / 10.0));
|
||||
// change was ML, however reverted during ML period so we can put it at 1
|
||||
|
||||
if (!item.IsChildOf(from.Backpack))
|
||||
{
|
||||
MessageHelper.SendLocalizedMessageTo(m_Bag, from, 1054152, 0x59); // You may only send items from your backpack to your bank box.
|
||||
}
|
||||
else if (item is BagOfSending || item is Container)
|
||||
{
|
||||
from.Send(new AsciiMessage(m_Bag.Serial, m_Bag.ItemID, MessageType.Regular, 0x3B2, 3, "", "You cannot send a container through the bag of sending."));
|
||||
}
|
||||
else if (item.LootType == LootType.Cursed)
|
||||
{
|
||||
MessageHelper.SendLocalizedMessageTo(m_Bag, from, 1054108, 0x59); // The bag of sending rejects the cursed item.
|
||||
}
|
||||
else if (!item.VerifyMove(from) || item is Server.Engines.Quests.QuestItem || item.QuestItem)
|
||||
{
|
||||
MessageHelper.SendLocalizedMessageTo(m_Bag, from, 1054109, 0x59); // The bag of sending rejects that item.
|
||||
}
|
||||
else if (Spells.SpellHelper.IsDoomGauntlet(from.Map, from.Location))
|
||||
{
|
||||
from.SendLocalizedMessage(1062089); // You cannot use that here.
|
||||
}
|
||||
else if (!from.BankBox.TryDropItem(from, item, false))
|
||||
{
|
||||
MessageHelper.SendLocalizedMessageTo(m_Bag, from, 1054110, 0x59); // Your bank box is full.
|
||||
}
|
||||
else if (Core.ML && reqCharges > m_Bag.Charges)
|
||||
{
|
||||
from.SendLocalizedMessage(1079932); //You don't have enough charges to send that much weight
|
||||
}
|
||||
else
|
||||
{
|
||||
m_Bag.Charges -= (Core.ML ? reqCharges : 1);
|
||||
MessageHelper.SendLocalizedMessageTo(m_Bag, from, 1054150, 0x59); // The item was placed in your bank box.
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -192,6 +192,16 @@ namespace Server
|
||||
totalDamage += (int)((double)totalDamage * .1);
|
||||
}
|
||||
|
||||
if (Core.HS && type == DamageType.Spell)
|
||||
{
|
||||
if (from?.FindItemOnLayer(Layer.MiddleTorso) is SpellFocusingSash spellSash)
|
||||
{
|
||||
spellSash.ValidateTarget(from, m, out var sdiOffset);
|
||||
|
||||
totalDamage += Scale(totalDamage, sdiOffset);
|
||||
}
|
||||
}
|
||||
|
||||
if (totalDamage < 1)
|
||||
totalDamage = 1;
|
||||
}
|
||||
|
||||
@@ -139,7 +139,7 @@ namespace Server.Misc
|
||||
return;
|
||||
}
|
||||
|
||||
var ns = states.Find(o => o.Account != null && o.Mobile != null && Insensitive.StartsWith(sub, o.Mobile.RawName));
|
||||
var ns = states.FirstOrDefault(o => o.Account != null && o.Mobile != null && Insensitive.StartsWith(sub, o.Mobile.RawName));
|
||||
|
||||
if (ns != null)
|
||||
{
|
||||
@@ -163,7 +163,7 @@ namespace Server.Misc
|
||||
return;
|
||||
}
|
||||
|
||||
var ns = states.Find(o => o.Account != null && o.Mobile != null && Insensitive.StartsWith(sub, o.Mobile.RawName));
|
||||
var ns = states.FirstOrDefault(o => o.Account != null && o.Mobile != null && Insensitive.StartsWith(sub, o.Mobile.RawName));
|
||||
|
||||
if (ns != null)
|
||||
{
|
||||
|
||||
@@ -212,7 +212,7 @@ namespace Server.Misc
|
||||
|
||||
try
|
||||
{
|
||||
List<NetState> states = NetState.Instances;
|
||||
IList<NetState> states = NetState.Instances;
|
||||
|
||||
op.WriteLine("- Count: {0}", states.Count);
|
||||
|
||||
|
||||
@@ -43,7 +43,7 @@ namespace Server
|
||||
PacketHandlers.SingleClickProps = true; // single click for everything is overriden to check object property list
|
||||
}
|
||||
|
||||
Mobile.ActionDelay = Core.TOL ? 500 : Core.AOS ? 750 : 500;
|
||||
Mobile.ActionDelay = Core.TOL ? 500 : Core.AOS ? 1000 : 500;
|
||||
Mobile.AOSStatusHandler = AOS.GetStatus;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -125,8 +125,6 @@ namespace Server
|
||||
}
|
||||
}
|
||||
|
||||
public static readonly LootPackItem[] HeritageSovereign = new[] {new LootPackItem(typeof(HeritageSovereign), 1)};
|
||||
|
||||
public static readonly LootPackItem[] Gold = new[] {new LootPackItem(typeof(Gold), 1)};
|
||||
|
||||
public static readonly LootPackItem[] Instruments = new[] {new LootPackItem(typeof(BaseInstrument), 1)};
|
||||
@@ -340,7 +338,7 @@ namespace Server
|
||||
new[]
|
||||
{
|
||||
new LootPackEntry(true, Gold, 100.00, "1d10+10"), new LootPackEntry(false, AosMagicItemsPoor, 0.02, 1, 5, 0, 90),
|
||||
new LootPackEntry(false, Instruments, 0.02, 1), new LootPackEntry(true, HeritageSovereign, 1, "1d10+1")
|
||||
new LootPackEntry(false, Instruments, 0.02, 1)
|
||||
});
|
||||
|
||||
public static readonly LootPack AosMeager =
|
||||
@@ -350,7 +348,7 @@ namespace Server
|
||||
new LootPackEntry(true, Gold, 100.00, "3d10+20"),
|
||||
new LootPackEntry(false, AosMagicItemsMeagerType1, 1.00, 1, 2, 0, 10),
|
||||
new LootPackEntry(false, AosMagicItemsMeagerType2, 0.20, 1, 5, 0, 90),
|
||||
new LootPackEntry(false, Instruments, 0.10, 1), new LootPackEntry(true, HeritageSovereign, 1, "1d10+5")
|
||||
new LootPackEntry(false, Instruments, 0.10, 1)
|
||||
});
|
||||
|
||||
public static readonly LootPack AosAverage =
|
||||
@@ -361,7 +359,7 @@ namespace Server
|
||||
new LootPackEntry(false, AosMagicItemsAverageType1, 5.00, 1, 4, 0, 20),
|
||||
new LootPackEntry(false, AosMagicItemsAverageType1, 2.00, 1, 3, 0, 50),
|
||||
new LootPackEntry(false, AosMagicItemsAverageType2, 0.50, 1, 5, 0, 90),
|
||||
new LootPackEntry(false, Instruments, 0.40, 1), new LootPackEntry(true, HeritageSovereign, 1, "1d10+10")
|
||||
new LootPackEntry(false, Instruments, 0.40, 1)
|
||||
});
|
||||
|
||||
public static readonly LootPack AosRich =
|
||||
@@ -371,8 +369,7 @@ namespace Server
|
||||
new LootPackEntry(true, Gold, 100.00, "10d10+150"),
|
||||
new LootPackEntry(false, AosMagicItemsRichType1, 20.00, 1, 4, 0, 40),
|
||||
new LootPackEntry(false, AosMagicItemsRichType1, 10.00, 1, 5, 0, 60),
|
||||
new LootPackEntry(false, AosMagicItemsRichType2, 1.00, 1, 5, 0, 90), new LootPackEntry(false, Instruments, 1.00, 1),
|
||||
new LootPackEntry(true, HeritageSovereign, 10, "1d10+1")
|
||||
new LootPackEntry(false, AosMagicItemsRichType2, 1.00, 1, 5, 0, 90), new LootPackEntry(false, Instruments, 1.00, 1)
|
||||
});
|
||||
|
||||
public static readonly LootPack AosFilthyRich =
|
||||
@@ -384,7 +381,7 @@ namespace Server
|
||||
new LootPackEntry(false, AosMagicItemsFilthyRichType1, 33.00, 1, 4, 0, 60),
|
||||
new LootPackEntry(false, AosMagicItemsFilthyRichType2, 20.00, 1, 5, 0, 75),
|
||||
new LootPackEntry(false, AosMagicItemsFilthyRichType2, 5.00, 1, 5, 0, 100),
|
||||
new LootPackEntry(false, Instruments, 2.00, 1), new LootPackEntry(true, HeritageSovereign, 10, "1d10+5")
|
||||
new LootPackEntry(false, Instruments, 2.00, 1)
|
||||
});
|
||||
|
||||
public static readonly LootPack AosUltraRich =
|
||||
@@ -398,7 +395,7 @@ namespace Server
|
||||
new LootPackEntry(false, AosMagicItemsUltraRich, 100.00, 1, 5, 25, 100),
|
||||
new LootPackEntry(false, AosMagicItemsUltraRich, 100.00, 1, 5, 25, 100),
|
||||
new LootPackEntry(false, AosMagicItemsUltraRich, 100.00, 1, 5, 35, 100),
|
||||
new LootPackEntry(false, Instruments, 2.00, 1), new LootPackEntry(true, HeritageSovereign, 10, "1d10+10")
|
||||
new LootPackEntry(false, Instruments, 2.00, 1)
|
||||
});
|
||||
|
||||
public static readonly LootPack AosSuperBoss =
|
||||
@@ -416,7 +413,7 @@ namespace Server
|
||||
new LootPackEntry(false, AosMagicItemsUltraRich, 100.00, 1, 5, 33, 100),
|
||||
new LootPackEntry(false, AosMagicItemsUltraRich, 100.00, 1, 5, 50, 100),
|
||||
new LootPackEntry(false, AosMagicItemsUltraRich, 100.00, 1, 5, 50, 100),
|
||||
new LootPackEntry(false, Instruments, 2.00, 1), new LootPackEntry(true, HeritageSovereign, 20, "1d10+10")
|
||||
new LootPackEntry(false, Instruments, 2.00, 1)
|
||||
});
|
||||
#endregion
|
||||
|
||||
|
||||
+6
-171
@@ -7,64 +7,20 @@ using System.Net.NetworkInformation;
|
||||
using System.Net.Sockets;
|
||||
using System.Text.RegularExpressions;
|
||||
using System.Threading;
|
||||
|
||||
using Server.Network;
|
||||
#endregion
|
||||
|
||||
namespace Server.Misc
|
||||
{
|
||||
public class ServerList
|
||||
{
|
||||
/*
|
||||
* The default setting for Address, a value of 'null', will use your local IP address. If all of your local IP addresses
|
||||
* are private network addresses and AutoDetect is 'true' then ServUO will attempt to discover your public IP address
|
||||
* for you automatically.
|
||||
*
|
||||
* If you do not plan on allowing clients outside of your LAN to connect, you can set AutoDetect to 'false' and leave
|
||||
* Address set to 'null'.
|
||||
*
|
||||
* If your public IP address cannot be determined, you must change the value of Address to your public IP address
|
||||
* manually to allow clients outside of your LAN to connect to your server. Address can be either an IP address or
|
||||
* a hostname that will be resolved when ServUO starts.
|
||||
*
|
||||
* If you want players outside your LAN to be able to connect to your server and you are behind a router, you must also
|
||||
* forward TCP port 2593 to your private IP address. The procedure for doing this varies by manufacturer but generally
|
||||
* involves configuration of the router through your web browser.
|
||||
*
|
||||
* ServerList will direct connecting clients depending on both the address they are connecting from and the address and
|
||||
* port they are connecting to. If it is determined that both ends of a connection are private IP addresses, ServerList
|
||||
* will direct the client to the local private IP address. If a client is connecting to a local public IP address, they
|
||||
* will be directed to whichever address and port they initially connected to. This allows multihomed servers to function
|
||||
* properly and fully supports listening on multiple ports. If a client with a public IP address is connecting to a
|
||||
* locally private address, the server will direct the client to either the AutoDetected IP address or the manually entered
|
||||
* IP address or hostname, whichever is applicable. Loopback clients will be directed to loopback.
|
||||
*
|
||||
* If you would like to listen on additional ports (i.e. 22, 23, 80, for clients behind highly restrictive egress
|
||||
* firewalls) or specific IP adddresses you can do so by modifying the file SocketOptions.cs found in this directory.
|
||||
*/
|
||||
|
||||
public static readonly string Address = Config.Get("Server.Address", default(string));
|
||||
|
||||
public static readonly bool AutoDetect = Config.Get("Server.AutoDetect", true);
|
||||
|
||||
public static string ServerName = Config.Get("Server.Name", "My Shard");
|
||||
|
||||
private static IPAddress _PublicAddress;
|
||||
|
||||
private static readonly Regex _AddressPattern = new Regex(@"([0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3})");
|
||||
public static IPAddress Address => Config.Get("Server.Address", IPAddress.Loopback);
|
||||
|
||||
public static void Initialize()
|
||||
{
|
||||
if (Address == null)
|
||||
{
|
||||
if (AutoDetect)
|
||||
{
|
||||
AutoDetection();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
Resolve(Address, out _PublicAddress);
|
||||
}
|
||||
|
||||
EventSink.ServerList += EventSink_ServerList;
|
||||
}
|
||||
|
||||
@@ -80,13 +36,13 @@ namespace Server.Misc
|
||||
var localAddress = ipep.Address;
|
||||
var localPort = ipep.Port;
|
||||
|
||||
if (IsPrivateNetwork(localAddress))
|
||||
if (!IPAddress.IsLoopback(localAddress) && IsPrivateNetwork(localAddress))
|
||||
{
|
||||
ipep = (IPEndPoint)s.RemoteEndPoint;
|
||||
|
||||
if (!IsPrivateNetwork(ipep.Address) && _PublicAddress != null)
|
||||
if (!IsPrivateNetwork(ipep.Address))
|
||||
{
|
||||
localAddress = _PublicAddress;
|
||||
localAddress = Address;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -98,67 +54,6 @@ namespace Server.Misc
|
||||
}
|
||||
}
|
||||
|
||||
public static string[] IPServices =
|
||||
{
|
||||
"http://services.servuo.com/ip.php", "http://api.ipify.org",
|
||||
"http://checkip.dyndns.org/"
|
||||
};
|
||||
|
||||
private static void AutoDetection()
|
||||
{
|
||||
if (!HasPublicIPAddress())
|
||||
{
|
||||
Utility.PushColor(ConsoleColor.Yellow);
|
||||
Console.WriteLine("ServerList: Auto-detecting public IP address...");
|
||||
|
||||
_PublicAddress = FindPublicAddress(IPServices);
|
||||
|
||||
if (_PublicAddress != null)
|
||||
{
|
||||
Console.WriteLine("ServerList: Done: '{0}'", _PublicAddress);
|
||||
}
|
||||
else
|
||||
{
|
||||
_PublicAddress = IPAddress.Any;
|
||||
|
||||
Console.WriteLine("ServerList: Failed: reverting to private IP address...");
|
||||
}
|
||||
|
||||
Utility.PopColor();
|
||||
}
|
||||
}
|
||||
|
||||
private static void Resolve(string addr, out IPAddress outValue)
|
||||
{
|
||||
if (IPAddress.TryParse(addr, out outValue))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
var iphe = Dns.GetHostEntry(addr);
|
||||
|
||||
if (iphe.AddressList.Length > 0)
|
||||
{
|
||||
outValue = iphe.AddressList[iphe.AddressList.Length - 1];
|
||||
}
|
||||
}
|
||||
catch
|
||||
{ }
|
||||
}
|
||||
|
||||
private static bool HasPublicIPAddress()
|
||||
{
|
||||
var adapters = NetworkInterface.GetAllNetworkInterfaces();
|
||||
var uips = adapters.Select(a => a.GetIPProperties())
|
||||
.SelectMany(p => p.UnicastAddresses.Cast<IPAddressInformation>(), (p, u) => u.Address);
|
||||
|
||||
return
|
||||
uips.Any(
|
||||
ip => !IPAddress.IsLoopback(ip) && ip.AddressFamily != AddressFamily.InterNetworkV6 && !IsPrivateNetwork(ip));
|
||||
}
|
||||
|
||||
private static bool IsPrivateNetwork(IPAddress ip)
|
||||
{
|
||||
// 10.0.0.0/8
|
||||
@@ -199,65 +94,5 @@ namespace Server.Misc
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public static IPAddress FindPublicAddress(params string[] services)
|
||||
{
|
||||
if (services == null || services.Length == 0)
|
||||
{
|
||||
services = IPServices;
|
||||
}
|
||||
|
||||
if (services == null || services.Length == 0)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
IPAddress ip = null;
|
||||
|
||||
Uri uri;
|
||||
string data;
|
||||
Match match;
|
||||
|
||||
foreach (var service in services.Where(s => !String.IsNullOrWhiteSpace(s)))
|
||||
{
|
||||
try
|
||||
{
|
||||
uri = new Uri(service);
|
||||
|
||||
Console.WriteLine("ServerList: >>> {0}", uri.Host);
|
||||
|
||||
using (var client = new WebClient())
|
||||
{
|
||||
data = client.DownloadString(uri);
|
||||
}
|
||||
|
||||
Console.WriteLine("ServerList: <<< {0}", data);
|
||||
|
||||
match = _AddressPattern.Match(data);
|
||||
|
||||
if (!match.Success || !IPAddress.TryParse(match.Value, out ip))
|
||||
{
|
||||
ip = null;
|
||||
}
|
||||
}
|
||||
catch (UriFormatException)
|
||||
{
|
||||
Console.WriteLine("ServerList: Invalid IP service Uri '{0}'", service);
|
||||
|
||||
ip = null;
|
||||
}
|
||||
catch
|
||||
{
|
||||
ip = null;
|
||||
}
|
||||
|
||||
if (ip != null)
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return ip;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -25,7 +25,7 @@ namespace System
|
||||
{
|
||||
get
|
||||
{
|
||||
return String.Format("{0:D2}:{1:D2}:{2:D2} ", DateTime.Now.Hour, DateTime.Now.Minute, DateTime.Now.Second);
|
||||
return String.Format("{0:D2}:{1:D2}:{2:D2} ", DateTime.UtcNow.Hour, DateTime.UtcNow.Minute, DateTime.UtcNow.Second);
|
||||
}
|
||||
}
|
||||
public static void Initialize()
|
||||
|
||||
@@ -381,7 +381,7 @@ namespace Server.Misc
|
||||
else
|
||||
type = 2;
|
||||
|
||||
List<NetState> states = NetState.Instances;
|
||||
IList<NetState> states = NetState.Instances;
|
||||
|
||||
Packet weatherPacket = null;
|
||||
|
||||
|
||||
@@ -284,7 +284,7 @@ namespace Server.Mobiles
|
||||
int level;
|
||||
double random = Utility.RandomDouble();
|
||||
|
||||
if (0.2 >= random)
|
||||
if (0.05 >= random)
|
||||
level = 20;
|
||||
else if (0.4 >= random)
|
||||
level = 15;
|
||||
|
||||
@@ -2373,10 +2373,12 @@ namespace Server.Mobiles
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (Siege.SiegeShard)
|
||||
/* else if (Siege.SiegeShard)
|
||||
{
|
||||
list.Add(new CallbackEntry(3006168, SiegeBlessItem));
|
||||
}
|
||||
} */
|
||||
|
||||
list.Add(new CallbackEntry(3006168, SiegeBlessItem));
|
||||
|
||||
if (Core.ML && Alive)
|
||||
{
|
||||
|
||||
@@ -47,6 +47,10 @@ namespace Server.Items
|
||||
case ChampionSkullType.Pain:
|
||||
Hue = 0x035;
|
||||
break;
|
||||
//Soth Skull
|
||||
case ChampionSkullType.Despair:
|
||||
Hue = 0x455;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -10,6 +10,8 @@ namespace Server.Engines.CannedEvil
|
||||
Venom,
|
||||
Pain,
|
||||
Greed,
|
||||
Death
|
||||
Death,
|
||||
//Dupre Skull
|
||||
Despair
|
||||
}
|
||||
}
|
||||
@@ -467,7 +467,7 @@ namespace Server.Engines.CannedEvil
|
||||
{
|
||||
if (RandomizeType)
|
||||
{
|
||||
switch (Utility.Random(5))
|
||||
switch (Utility.Random(6))
|
||||
{
|
||||
case 0:
|
||||
Type = ChampionSpawnType.Abyss; break;
|
||||
@@ -479,6 +479,7 @@ namespace Server.Engines.CannedEvil
|
||||
Type = ChampionSpawnType.VerminHorde; break;
|
||||
case 4:
|
||||
Type = ChampionSpawnType.UnholyTerror; break;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -97,7 +97,6 @@ namespace Server.Engines.CleanUpBritannia
|
||||
Rewards.Add(new CollectionItem(typeof(DragonHeadAddonDeed), 0x2234, 1028756, 0, 50000));
|
||||
Rewards.Add(new CollectionItem(typeof(NestWithEggs), 0x1AD4, 1026868, 2415, 50000));
|
||||
|
||||
|
||||
if (Core.HS)
|
||||
{
|
||||
Rewards.Add(new CollectionItem(typeof(FishermansHat), 0x1716, 1151238, 2578, 50000));
|
||||
@@ -173,7 +172,6 @@ namespace Server.Engines.CleanUpBritannia
|
||||
Rewards.Add(new CollectionItem(typeof(MysticsMemento), 0x2F5B, 1154744, 1912, 300000));
|
||||
|
||||
Rewards.Add(new CollectionItem(typeof(VollemHeldInCrystal), 0x1f19, 1113629, 1154, 500000));
|
||||
Rewards.Add(new CollectionItem(typeof(ItemBlessDeed),0x14F0, 1006018, 0, 500000));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,6 +3,7 @@ using Server.Items;
|
||||
using Server.Mobiles;
|
||||
using Server.Targeting;
|
||||
using Server.Factions;
|
||||
using Server.Custom;
|
||||
|
||||
namespace Server.Engines.Craft
|
||||
{
|
||||
@@ -225,6 +226,20 @@ namespace Server.Engines.Craft
|
||||
|
||||
return;
|
||||
}
|
||||
// ===============================
|
||||
// CUSTOM REPAIR LOCK ENFORCEMENT
|
||||
// ===============================
|
||||
Item it = targeted as Item;
|
||||
|
||||
if (it != null && it.GetRepairLocked())
|
||||
{
|
||||
from.SendMessage("This item has been fortified and cannot be repaired until it is restored.");
|
||||
|
||||
if (m_Addon != null)
|
||||
m_Addon.Using = false;
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
if (m_CraftSystem.CanCraft(from, m_Tool, targeted.GetType()) == 1044267)
|
||||
{
|
||||
|
||||
@@ -25,7 +25,7 @@ namespace Server
|
||||
typeof(HelmOfSwiftness), typeof(PadsOfTheCuSidhe), typeof(QuiverOfRage), typeof(QuiverOfElements),
|
||||
typeof(RaedsGlory), typeof(RighteousAnger), typeof(RobeOfTheEclipse), typeof(RobeOfTheEquinox),
|
||||
typeof(SoulSeeker), typeof(TalonBite), typeof(TotemOfVoid), typeof(WildfireBow),
|
||||
typeof(Windsong),typeof(UrcuchiallianRidingShoes)
|
||||
typeof(Windsong)
|
||||
};
|
||||
// true - dungeon is enabled, false - dungeon is disabled
|
||||
private static bool m_PalaceOfParoxysmus;
|
||||
|
||||
@@ -2238,7 +2238,7 @@ namespace Server.Mobiles
|
||||
get
|
||||
{
|
||||
// go through all online mobiles and see if any have xmlspawner gumps open
|
||||
List<NetState> states = NetState.Instances;
|
||||
IList<NetState> states = NetState.Instances;
|
||||
|
||||
for (int i = 0; i < states.Count; ++i)
|
||||
{
|
||||
|
||||
@@ -265,7 +265,7 @@ namespace Server.Spells
|
||||
{
|
||||
Type t = item.GetType();
|
||||
|
||||
if(t.IsDefined(typeof(DispellableFieldAttribute), false) || t.IsDefined(typeof(DispellableFieldAttribute), true))
|
||||
if (t.IsDefined(typeof(DispellableFieldAttribute), false) || t.IsDefined(typeof(DispellableFieldAttribute), true))
|
||||
{
|
||||
eable.Free();
|
||||
return false;
|
||||
@@ -469,7 +469,7 @@ namespace Server.Spells
|
||||
|
||||
double percent = GetOffsetScalar(caster, target, curse);
|
||||
|
||||
switch( type )
|
||||
switch (type)
|
||||
{
|
||||
case StatType.Str:
|
||||
return (int)Math.Ceiling(target.RawStr * percent);
|
||||
@@ -866,7 +866,6 @@ namespace Server.Spells
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
if (caster != null)
|
||||
{
|
||||
if (caster.IsPlayer())
|
||||
@@ -887,7 +886,7 @@ namespace Server.Spells
|
||||
// Always allow monsters to teleport
|
||||
if (caster is BaseCreature && (type == TravelCheckType.TeleportTo || type == TravelCheckType.TeleportFrom))
|
||||
{
|
||||
BaseCreature bc = (BaseCreature) caster;
|
||||
BaseCreature bc = (BaseCreature)caster;
|
||||
|
||||
if (!bc.Controlled && !bc.Summoned)
|
||||
return true;
|
||||
@@ -1475,7 +1474,7 @@ namespace Server.Spells
|
||||
|
||||
int damageGiven = AOS.Damage(damageable, from, iDamage, phys, fire, cold, pois, nrgy, chaos, direct, dtype);
|
||||
|
||||
if(target != null)
|
||||
if (target != null)
|
||||
Spells.Mysticism.SpellPlagueSpell.OnMobileDamaged(target);
|
||||
|
||||
if (target != null && target.DFA != DFAlgorithm.Standard)
|
||||
@@ -1485,7 +1484,7 @@ namespace Server.Spells
|
||||
|
||||
NegativeAttributes.OnCombatAction(from);
|
||||
|
||||
if(from != target)
|
||||
if (from != target)
|
||||
NegativeAttributes.OnCombatAction(target);
|
||||
}
|
||||
else
|
||||
|
||||
Executable → Regular
+34
-25
@@ -1,40 +1,49 @@
|
||||
|
||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||
# Visual Studio 15
|
||||
VisualStudioVersion = 15.0.28307.539
|
||||
# Visual Studio Version 17
|
||||
VisualStudioVersion = 17.12.35527.113
|
||||
MinimumVisualStudioVersion = 10.0.40219.1
|
||||
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{EF956787-B078-4D19-B03B-4A8F2A4841AD}"
|
||||
ProjectSection(SolutionItems) = preProject
|
||||
.editorconfig = .editorconfig
|
||||
.gitignore = .gitignore
|
||||
.travis.yml = .travis.yml
|
||||
LICENSE = LICENSE
|
||||
README.md = README.md
|
||||
ServUO.exe.config = ServUO.exe.config
|
||||
_makedebug = _makedebug
|
||||
_makerelease = _makerelease
|
||||
_windebug.bat = _windebug.bat
|
||||
_winrelease.bat = _winrelease.bat
|
||||
EndProjectSection
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Ultima", "Ultima\Ultima.csproj", "{E08CFBE4-E013-44EE-8829-426D05BC083F}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Server", "Server\Server.csproj", "{AE4A9EAA-E0EB-4DC9-9604-BE4289F9F6C3}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Scripts", "Scripts\Scripts.csproj", "{308EA7C6-2873-4E47-AF3F-ABBA3F8AB63E}"
|
||||
ProjectSection(ProjectDependencies) = postProject
|
||||
{AE4A9EAA-E0EB-4DC9-9604-BE4289F9F6C3} = {AE4A9EAA-E0EB-4DC9-9604-BE4289F9F6C3}
|
||||
EndProjectSection
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Server", "Server\Server.csproj", "{AE4A9EAA-E0EB-4DC9-9604-BE4289F9F6C3}"
|
||||
EndProject
|
||||
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{EF956787-B078-4D19-B03B-4A8F2A4841AD}"
|
||||
ProjectSection(SolutionItems) = preProject
|
||||
README.md = README.md
|
||||
EndProjectSection
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Ultima", "Ultima\Ultima.csproj", "{E08CFBE4-E013-44EE-8829-426D05BC083F}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Any CPU = Debug|Any CPU
|
||||
Release|Any CPU = Release|Any CPU
|
||||
Debug|x64 = Debug|x64
|
||||
Release|x64 = Release|x64
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{308EA7C6-2873-4E47-AF3F-ABBA3F8AB63E}.Debug|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{308EA7C6-2873-4E47-AF3F-ABBA3F8AB63E}.Debug|Any CPU.Build.0 = Release|Any CPU
|
||||
{308EA7C6-2873-4E47-AF3F-ABBA3F8AB63E}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{308EA7C6-2873-4E47-AF3F-ABBA3F8AB63E}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{AE4A9EAA-E0EB-4DC9-9604-BE4289F9F6C3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{AE4A9EAA-E0EB-4DC9-9604-BE4289F9F6C3}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{AE4A9EAA-E0EB-4DC9-9604-BE4289F9F6C3}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{AE4A9EAA-E0EB-4DC9-9604-BE4289F9F6C3}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{E08CFBE4-E013-44EE-8829-426D05BC083F}.Debug|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{E08CFBE4-E013-44EE-8829-426D05BC083F}.Debug|Any CPU.Build.0 = Release|Any CPU
|
||||
{E08CFBE4-E013-44EE-8829-426D05BC083F}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{E08CFBE4-E013-44EE-8829-426D05BC083F}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{E08CFBE4-E013-44EE-8829-426D05BC083F}.Debug|x64.ActiveCfg = Debug|x64
|
||||
{E08CFBE4-E013-44EE-8829-426D05BC083F}.Debug|x64.Build.0 = Debug|x64
|
||||
{E08CFBE4-E013-44EE-8829-426D05BC083F}.Release|x64.ActiveCfg = Release|x64
|
||||
{E08CFBE4-E013-44EE-8829-426D05BC083F}.Release|x64.Build.0 = Release|x64
|
||||
{AE4A9EAA-E0EB-4DC9-9604-BE4289F9F6C3}.Debug|x64.ActiveCfg = Debug|x64
|
||||
{AE4A9EAA-E0EB-4DC9-9604-BE4289F9F6C3}.Debug|x64.Build.0 = Debug|x64
|
||||
{AE4A9EAA-E0EB-4DC9-9604-BE4289F9F6C3}.Release|x64.ActiveCfg = Release|x64
|
||||
{AE4A9EAA-E0EB-4DC9-9604-BE4289F9F6C3}.Release|x64.Build.0 = Release|x64
|
||||
{308EA7C6-2873-4E47-AF3F-ABBA3F8AB63E}.Debug|x64.ActiveCfg = Debug|x64
|
||||
{308EA7C6-2873-4E47-AF3F-ABBA3F8AB63E}.Debug|x64.Build.0 = Debug|x64
|
||||
{308EA7C6-2873-4E47-AF3F-ABBA3F8AB63E}.Release|x64.ActiveCfg = Release|x64
|
||||
{308EA7C6-2873-4E47-AF3F-ABBA3F8AB63E}.Release|x64.Build.0 = Release|x64
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
|
||||
+1
-44
@@ -4,12 +4,6 @@ using System.Resources;
|
||||
using System.Runtime.InteropServices;
|
||||
#endregion
|
||||
|
||||
//
|
||||
// General Information about an assembly is controlled through the following
|
||||
// set of attributes. Change these attribute values to modify the information
|
||||
// associated with an assembly.
|
||||
//
|
||||
|
||||
[assembly: AssemblyTitle("ServUO Server")]
|
||||
[assembly: AssemblyDescription("Ultima Online Server Emulator")]
|
||||
[assembly: AssemblyConfiguration("")]
|
||||
@@ -18,44 +12,7 @@ using System.Runtime.InteropServices;
|
||||
[assembly: AssemblyCopyright("")]
|
||||
[assembly: AssemblyTrademark("")]
|
||||
[assembly: AssemblyCulture("")]
|
||||
//
|
||||
// Version information for an assembly consists of the following four values:
|
||||
//
|
||||
// Major Version
|
||||
// Minor Version
|
||||
// Build Number
|
||||
// Revision
|
||||
//
|
||||
// You can specify all the values or you can default the Revision and Build Numbers
|
||||
// by using the '*' as shown below:
|
||||
|
||||
[assembly: AssemblyVersion("0.5.*")]
|
||||
//
|
||||
// In order to sign your assembly you must specify a key to use. Refer to the
|
||||
// Microsoft .NET Framework documentation for more information on assembly signing.
|
||||
//
|
||||
// Use the attributes below to control which key is used for signing.
|
||||
//
|
||||
// Notes:
|
||||
// (*) If no key is specified, the assembly is not signed.
|
||||
// (*) KeyName refers to a key that has been installed in the Crypto Service
|
||||
// Provider (CSP) on your machine. KeyFile refers to a file which contains
|
||||
// a key.
|
||||
// (*) If the KeyFile and the KeyName values are both specified, the
|
||||
// following processing occurs:
|
||||
// (1) If the KeyName can be found in the CSP, that key is used.
|
||||
// (2) If the KeyName does not exist and the KeyFile does exist, the key
|
||||
// in the KeyFile is installed into the CSP and used.
|
||||
// (*) In order to create a KeyFile, you can use the sn.exe (Strong Name) utility.
|
||||
// When specifying the KeyFile, the location of the KeyFile should be
|
||||
// relative to the project output directory which is
|
||||
// %Project Directory%\obj\<configuration>. For example, if your KeyFile is
|
||||
// located in the project directory, you would specify the AssemblyKeyFile
|
||||
// attribute as [assembly: AssemblyKeyFile("..\\..\\mykey.snk")]
|
||||
// (*) Delay Signing is an advanced option - see the Microsoft .NET Framework
|
||||
// documentation for more information on this.
|
||||
//
|
||||
|
||||
[assembly: AssemblyVersion("57.4")]
|
||||
[assembly: AssemblyDelaySign(false)]
|
||||
[assembly: AssemblyKeyFile("")]
|
||||
[assembly: AssemblyKeyName("")]
|
||||
|
||||
+1550
-394
File diff suppressed because it is too large
Load Diff
@@ -183,12 +183,6 @@ namespace Server.Gumps
|
||||
Add(new GumpTooltip(number));
|
||||
}
|
||||
|
||||
public void AddTooltipText(string text)
|
||||
{
|
||||
Add(new GumpTooltip(text));
|
||||
}
|
||||
|
||||
|
||||
public void AddHtml(int x, int y, int width, int height, string text, bool background, bool scrollbar)
|
||||
{
|
||||
Add(new GumpHtml(x, y, width, height, text, background, scrollbar));
|
||||
|
||||
@@ -26,17 +26,11 @@ namespace Server.Gumps
|
||||
public class GumpTooltip : GumpEntry
|
||||
{
|
||||
private int m_Number;
|
||||
private string m_Text;
|
||||
public GumpTooltip(int number)
|
||||
public GumpTooltip( int number )
|
||||
{
|
||||
m_Number = number;
|
||||
}
|
||||
|
||||
public GumpTooltip(string text)
|
||||
{
|
||||
m_Text = text;
|
||||
}
|
||||
|
||||
public int Number
|
||||
{
|
||||
get
|
||||
@@ -45,47 +39,21 @@ namespace Server.Gumps
|
||||
}
|
||||
set
|
||||
{
|
||||
Delta(ref m_Number, value);
|
||||
}
|
||||
}
|
||||
|
||||
public string Text
|
||||
{
|
||||
get
|
||||
{
|
||||
return m_Text;
|
||||
}
|
||||
set
|
||||
{
|
||||
Delta(ref m_Text, value);
|
||||
Delta( ref m_Number, value );
|
||||
}
|
||||
}
|
||||
|
||||
public override string Compile()
|
||||
{
|
||||
if (m_Number == 0 && !string.IsNullOrEmpty(m_Text))
|
||||
{ // if given: use custom text # TODO UNCHECKED -> AppendTo( IGumpWriter disp ) was used!
|
||||
return String.Format("{{ tooltip {0} @{1}@ }}", 1042971, m_Text);
|
||||
}
|
||||
else
|
||||
{ // default use cliloc localized text
|
||||
return string.Format("{{ tooltip {0} }}", m_Number);
|
||||
}
|
||||
}
|
||||
|
||||
private static byte[] m_LayoutName = Gump.StringToBuffer("tooltip");
|
||||
private static byte[] m_LayoutName = Gump.StringToBuffer( "tooltip" );
|
||||
|
||||
public override void AppendTo(IGumpWriter disp)
|
||||
public override void AppendTo( IGumpWriter disp )
|
||||
{
|
||||
if (m_Number == 0 && !string.IsNullOrEmpty(m_Text))
|
||||
{ // if given: use custom text replacing placeholder "~1_NOTHING~"
|
||||
disp.AppendLayout(Gump.StringToBuffer(String.Format("tooltip {0}@{1}@", 1042971, m_Text)));
|
||||
}
|
||||
else
|
||||
{ // default use given cliloc localized text
|
||||
disp.AppendLayout(m_LayoutName);
|
||||
disp.AppendLayout(m_Number);
|
||||
}
|
||||
disp.AppendLayout( m_LayoutName );
|
||||
disp.AppendLayout( m_Number );
|
||||
}
|
||||
}
|
||||
}
|
||||
+47
-12
@@ -2515,7 +2515,18 @@ namespace Server
|
||||
{ }
|
||||
|
||||
public virtual void OnAdded(object parent)
|
||||
{ }
|
||||
{
|
||||
// Only enforce insurance when the item is added to a Mobile (player)
|
||||
if (parent is Mobile newOwner)
|
||||
{
|
||||
if (Insured && InsuredBy != Serial.MinusOne && newOwner.Serial != InsuredBy)
|
||||
{
|
||||
Insured = false;
|
||||
InsuredBy = Serial.MinusOne;
|
||||
newOwner.SendMessage("The insurance on this item has been removed.");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
[CommandProperty(AccessLevel.Counselor, AccessLevel.Decorator)]
|
||||
public Map Map
|
||||
@@ -2620,9 +2631,9 @@ namespace Server
|
||||
// 14
|
||||
writer.Write(Sockets != null ? Sockets.Count : 0);
|
||||
|
||||
if(Sockets != null)
|
||||
if (Sockets != null)
|
||||
{
|
||||
foreach(var socket in Sockets)
|
||||
foreach (var socket in Sockets)
|
||||
{
|
||||
ItemSocket.Save(socket, writer);
|
||||
}
|
||||
@@ -3031,6 +3042,7 @@ namespace Server
|
||||
OnLockDownChange();
|
||||
}
|
||||
}
|
||||
public Serial InsuredBy;
|
||||
|
||||
public virtual void OnLockDownChange()
|
||||
{
|
||||
@@ -3125,7 +3137,7 @@ namespace Server
|
||||
case 14:
|
||||
var socketCount = reader.ReadInt();
|
||||
|
||||
for(int i = 0; i < socketCount; i++)
|
||||
for (int i = 0; i < socketCount; i++)
|
||||
{
|
||||
ItemSocket.Load(this, reader);
|
||||
}
|
||||
@@ -3185,7 +3197,7 @@ namespace Server
|
||||
{
|
||||
m_Light = (LightType)reader.ReadByte();
|
||||
}
|
||||
else if(version < 12)
|
||||
else if (version < 12)
|
||||
{
|
||||
m_Light = (LightType)m_Direction;
|
||||
}
|
||||
@@ -4619,7 +4631,7 @@ namespace Server
|
||||
module.Delete();
|
||||
}
|
||||
|
||||
if(Sockets != null)
|
||||
if (Sockets != null)
|
||||
{
|
||||
Sockets.IterateReverse(socket =>
|
||||
{
|
||||
@@ -4954,6 +4966,29 @@ namespace Server
|
||||
root.Obtained(this);
|
||||
}
|
||||
}
|
||||
// Character-bound insurance enforcement
|
||||
if (!World.Loading && Parent is Mobile newOwner)
|
||||
{
|
||||
// Murderers cannot have insured items at all
|
||||
if (newOwner.Murderer)
|
||||
{
|
||||
if (Insured)
|
||||
{
|
||||
Insured = false;
|
||||
InsuredBy = Serial.MinusOne;
|
||||
newOwner.SendMessage("The Insurance Agency will not cover items owned by murderers.");
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
// Character-bound insurance enforcement
|
||||
if (Insured && InsuredBy != Serial.MinusOne && newOwner.Serial != InsuredBy)
|
||||
{
|
||||
Insured = false;
|
||||
InsuredBy = Serial.MinusOne;
|
||||
newOwner.SendMessage("The insurance on this item has been removed.");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
[CommandProperty(AccessLevel.Decorator)]
|
||||
@@ -6256,7 +6291,7 @@ namespace Server
|
||||
|
||||
public void AttachSocket(ItemSocket socket)
|
||||
{
|
||||
if(Sockets == null)
|
||||
if (Sockets == null)
|
||||
{
|
||||
Sockets = new List<ItemSocket>();
|
||||
}
|
||||
@@ -6369,7 +6404,7 @@ namespace Server
|
||||
|
||||
public ItemSocket(TimeSpan duration)
|
||||
{
|
||||
if(duration != TimeSpan.Zero)
|
||||
if (duration != TimeSpan.Zero)
|
||||
{
|
||||
Expires = DateTime.UtcNow + duration;
|
||||
|
||||
@@ -6387,7 +6422,7 @@ namespace Server
|
||||
|
||||
protected void EndTimer()
|
||||
{
|
||||
if(Timer != null)
|
||||
if (Timer != null)
|
||||
{
|
||||
Timer.Stop();
|
||||
Timer = null;
|
||||
@@ -6396,7 +6431,7 @@ namespace Server
|
||||
|
||||
protected virtual void OnTick()
|
||||
{
|
||||
if(Expires < DateTime.UtcNow || Owner.Deleted)
|
||||
if (Expires < DateTime.UtcNow || Owner.Deleted)
|
||||
{
|
||||
Remove();
|
||||
}
|
||||
@@ -6464,9 +6499,9 @@ namespace Server
|
||||
|
||||
Expires = reader.ReadDateTime();
|
||||
|
||||
if(Expires != DateTime.MinValue)
|
||||
if (Expires != DateTime.MinValue)
|
||||
{
|
||||
if(Expires < DateTime.UtcNow)
|
||||
if (Expires < DateTime.UtcNow)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
+15
-4
@@ -47,8 +47,6 @@ namespace Server
|
||||
private static DateTime _ProfileStart;
|
||||
private static TimeSpan _ProfileTime;
|
||||
|
||||
public static MessagePump MessagePump { get; set; }
|
||||
|
||||
public static Slice Slice;
|
||||
|
||||
public static bool Profiling
|
||||
@@ -453,6 +451,19 @@ namespace Server
|
||||
Process = Process.GetCurrentProcess();
|
||||
Assembly = Assembly.GetEntryAssembly();
|
||||
|
||||
// Disable Windows-only process priority on Linux/Mono
|
||||
if (Environment.OSVersion.Platform == PlatformID.Win32NT)
|
||||
{
|
||||
try
|
||||
{
|
||||
Process.PriorityClass = ProcessPriorityClass.High;
|
||||
}
|
||||
catch
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (Thread != null)
|
||||
{
|
||||
Thread.Name = "Core Thread";
|
||||
@@ -641,7 +652,7 @@ namespace Server
|
||||
|
||||
ScriptCompiler.Invoke("Initialize");
|
||||
|
||||
MessagePump messagePump = MessagePump = new MessagePump();
|
||||
MessagePump.Start();
|
||||
|
||||
_TimerThread.Start();
|
||||
|
||||
@@ -671,7 +682,7 @@ namespace Server
|
||||
Item.ProcessDeltaQueue();
|
||||
|
||||
Timer.Slice();
|
||||
messagePump.Slice();
|
||||
MessagePump.Slice();
|
||||
|
||||
NetState.FlushAll();
|
||||
NetState.ProcessDisposedQueue();
|
||||
|
||||
+1
-1
@@ -268,6 +268,7 @@ namespace Server
|
||||
bin.Close();
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
Console.WriteLine("Warning: Multi data files not found!");
|
||||
@@ -275,7 +276,6 @@ namespace Server
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public struct MultiTileEntry
|
||||
{
|
||||
|
||||
@@ -1,32 +1,31 @@
|
||||
#region References
|
||||
using System;
|
||||
using System.Collections.Concurrent;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.ObjectModel;
|
||||
#endregion
|
||||
|
||||
namespace Server.Network
|
||||
{
|
||||
public class BufferPool
|
||||
{
|
||||
public static List<BufferPool> Pools { get; private set; }
|
||||
private static readonly ConcurrentDictionary<BufferPool, string> m_Pools = new ConcurrentDictionary<BufferPool, string>();
|
||||
|
||||
static BufferPool()
|
||||
{
|
||||
Pools = new List<BufferPool>();
|
||||
}
|
||||
public static ReadOnlyCollection<BufferPool> Pools => (ReadOnlyCollection<BufferPool>)m_Pools.Keys;
|
||||
|
||||
private readonly string m_Name;
|
||||
|
||||
private readonly int m_InitialCapacity;
|
||||
private readonly int m_BufferSize;
|
||||
|
||||
private int m_Misses;
|
||||
private volatile int m_Misses;
|
||||
|
||||
private readonly Queue<byte[]> m_FreeBuffers;
|
||||
private readonly ConcurrentQueue<byte[]> m_FreeBuffers = new ConcurrentQueue<byte[]>();
|
||||
|
||||
public int Count
|
||||
{
|
||||
get
|
||||
{
|
||||
lock (this)
|
||||
return m_FreeBuffers.Count;
|
||||
}
|
||||
}
|
||||
@@ -38,8 +37,6 @@ namespace Server.Network
|
||||
out int currentCapacity,
|
||||
out int bufferSize,
|
||||
out int misses)
|
||||
{
|
||||
lock (this)
|
||||
{
|
||||
name = m_Name;
|
||||
freeCount = m_FreeBuffers.Count;
|
||||
@@ -48,7 +45,6 @@ namespace Server.Network
|
||||
bufferSize = m_BufferSize;
|
||||
misses = m_Misses;
|
||||
}
|
||||
}
|
||||
|
||||
public BufferPool(string name, int initialCapacity, int bufferSize)
|
||||
{
|
||||
@@ -57,52 +53,46 @@ namespace Server.Network
|
||||
m_InitialCapacity = initialCapacity;
|
||||
m_BufferSize = bufferSize;
|
||||
|
||||
m_FreeBuffers = new Queue<byte[]>(initialCapacity);
|
||||
|
||||
for (int i = 0; i < initialCapacity; ++i)
|
||||
while (m_FreeBuffers.Count < initialCapacity)
|
||||
{
|
||||
m_FreeBuffers.Enqueue(new byte[bufferSize]);
|
||||
}
|
||||
|
||||
lock (Pools)
|
||||
Pools.Add(this);
|
||||
m_Pools[this] = name;
|
||||
}
|
||||
|
||||
public byte[] AcquireBuffer()
|
||||
{
|
||||
lock (this)
|
||||
if (m_FreeBuffers.TryDequeue(out var buffer))
|
||||
{
|
||||
if (m_FreeBuffers.Count > 0)
|
||||
{
|
||||
return m_FreeBuffers.Dequeue();
|
||||
return buffer;
|
||||
}
|
||||
|
||||
++m_Misses;
|
||||
|
||||
for (int i = 0; i < m_InitialCapacity; ++i)
|
||||
while (m_FreeBuffers.Count < m_InitialCapacity - 1)
|
||||
{
|
||||
m_FreeBuffers.Enqueue(new byte[m_BufferSize]);
|
||||
}
|
||||
|
||||
return m_FreeBuffers.Dequeue();
|
||||
}
|
||||
return new byte[m_BufferSize];
|
||||
}
|
||||
|
||||
public void ReleaseBuffer(byte[] buffer)
|
||||
{
|
||||
if (buffer == null)
|
||||
if (buffer == null || buffer.Length != m_BufferSize)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
lock (this)
|
||||
Array.Clear(buffer, 0, buffer.Length);
|
||||
|
||||
m_FreeBuffers.Enqueue(buffer);
|
||||
}
|
||||
|
||||
public void Free()
|
||||
{
|
||||
lock (Pools)
|
||||
Pools.Remove(this);
|
||||
m_Pools.TryRemove(this, out _);
|
||||
}
|
||||
}
|
||||
}
|
||||
+367
-101
@@ -1,10 +1,12 @@
|
||||
#region References
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Concurrent;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Net;
|
||||
using System.Net.NetworkInformation;
|
||||
using System.Net.Sockets;
|
||||
using System.Text;
|
||||
using System.Threading;
|
||||
#endregion
|
||||
|
||||
@@ -12,68 +14,97 @@ namespace Server.Network
|
||||
{
|
||||
public class Listener : IDisposable
|
||||
{
|
||||
private static readonly byte[][] m_HttpFilters =
|
||||
{
|
||||
Encoding.UTF8.GetBytes("GET"),
|
||||
Encoding.UTF8.GetBytes("POST"),
|
||||
Encoding.UTF8.GetBytes("PUT"),
|
||||
Encoding.UTF8.GetBytes("DELETE"),
|
||||
Encoding.UTF8.GetBytes("HEAD"),
|
||||
Encoding.UTF8.GetBytes("OPTIONS"),
|
||||
Encoding.UTF8.GetBytes("PATCH"),
|
||||
Encoding.UTF8.GetBytes("CONNECT"),
|
||||
Encoding.UTF8.GetBytes("TRACE"),
|
||||
};
|
||||
|
||||
private static readonly BufferPool m_ByteBufferPool = new BufferPool("Login Byte", 1024, 1);
|
||||
private static readonly BufferPool m_PeekBufferPool = new BufferPool("Login Peek", 1024, 4);
|
||||
private static readonly BufferPool m_SeedBufferPool = new BufferPool("Login Seed [0xEF]", 1024, PacketHandlers.LoginSeedLength);
|
||||
|
||||
public static IPAddress Address => Config.Get("Server.Listen", IPAddress.Any);
|
||||
|
||||
public static int Port => Config.Get("Server.Port", 2593);
|
||||
|
||||
public static IPEndPoint[] EndPoints { get; set; } =
|
||||
{
|
||||
new IPEndPoint(Address, Port)
|
||||
};
|
||||
|
||||
private long m_SliceTime, m_SliceCounter;
|
||||
|
||||
private long m_Counter, m_AcceptsPerSecond;
|
||||
|
||||
public long AcceptsPerSecond => m_AcceptsPerSecond;
|
||||
|
||||
private Socket m_Listener;
|
||||
private PingListener _PingListener;
|
||||
|
||||
private readonly Queue<Socket> m_Accepted;
|
||||
private readonly object m_AcceptedSyncRoot;
|
||||
private readonly ConcurrentQueue<SocketState> m_Accepted = new ConcurrentQueue<SocketState>();
|
||||
|
||||
private readonly AsyncCallback m_OnAccept;
|
||||
private readonly AutoResetEvent m_AcceptLimiter = new AutoResetEvent(true);
|
||||
|
||||
private static readonly Socket[] m_EmptySockets = new Socket[0];
|
||||
private readonly Thread m_AcceptThread;
|
||||
|
||||
public static IPEndPoint[] EndPoints { get; set; }
|
||||
private SocketAsyncEventArgs m_AcceptArgs;
|
||||
|
||||
public Listener(IPEndPoint ipep)
|
||||
{
|
||||
m_Accepted = new Queue<Socket>();
|
||||
m_AcceptedSyncRoot = ((ICollection)m_Accepted).SyncRoot;
|
||||
|
||||
m_Listener = Bind(ipep);
|
||||
|
||||
m_SliceTime = Core.TickCount;
|
||||
|
||||
if (m_Listener == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
DisplayListener();
|
||||
_PingListener = new PingListener(ipep);
|
||||
|
||||
m_OnAccept = OnAccept;
|
||||
try
|
||||
m_AcceptThread = new Thread(AcceptLoop)
|
||||
{
|
||||
IAsyncResult res = m_Listener.BeginAccept(m_OnAccept, m_Listener);
|
||||
}
|
||||
catch (SocketException ex)
|
||||
{
|
||||
NetState.TraceException(ex);
|
||||
}
|
||||
catch (ObjectDisposedException)
|
||||
{ }
|
||||
Name = $"Login Accept Processor",
|
||||
Priority = ThreadPriority.AboveNormal,
|
||||
};
|
||||
|
||||
m_AcceptThread.Start();
|
||||
}
|
||||
|
||||
private Socket Bind(IPEndPoint ipep)
|
||||
{
|
||||
Socket s = new Socket(ipep.AddressFamily, SocketType.Stream, ProtocolType.Tcp);
|
||||
Socket s = new Socket(ipep.AddressFamily, SocketType.Stream, ProtocolType.Tcp)
|
||||
{
|
||||
SendTimeout = 1000,
|
||||
ReceiveTimeout = 1000,
|
||||
ExclusiveAddressUse = false,
|
||||
UseOnlyOverlappedIO = false,
|
||||
NoDelay = true,
|
||||
LingerState =
|
||||
{
|
||||
Enabled = true,
|
||||
LingerTime = 0,
|
||||
},
|
||||
};
|
||||
|
||||
try
|
||||
{
|
||||
s.LingerState.Enabled = false;
|
||||
|
||||
// Default is 'false' starting Windows Vista and Server 2008. Source: https://msdn.microsoft.com/en-us/library/system.net.sockets.socket.exclusiveaddressuse(v=vs.110).aspx?f=255&MSPPError=-2147217396
|
||||
s.ExclusiveAddressUse = false;
|
||||
|
||||
s.Bind(ipep);
|
||||
s.Listen(8);
|
||||
s.Listen(1000);
|
||||
|
||||
return s;
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
if (e is SocketException)
|
||||
if (e is SocketException se)
|
||||
{
|
||||
SocketException se = (SocketException)e;
|
||||
|
||||
if (se.ErrorCode == 10048)
|
||||
{
|
||||
// WSAEADDRINUSE
|
||||
@@ -103,19 +134,19 @@ namespace Server.Network
|
||||
|
||||
private void DisplayListener()
|
||||
{
|
||||
IPEndPoint ipep = m_Listener.LocalEndPoint as IPEndPoint;
|
||||
|
||||
if (ipep == null)
|
||||
if (!(m_Listener.LocalEndPoint is IPEndPoint ipep))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (ipep.Address.Equals(IPAddress.Any) || ipep.Address.Equals(IPAddress.IPv6Any))
|
||||
{
|
||||
var adapters = NetworkInterface.GetAllNetworkInterfaces();
|
||||
NetworkInterface[] adapters = NetworkInterface.GetAllNetworkInterfaces();
|
||||
|
||||
foreach (NetworkInterface adapter in adapters)
|
||||
{
|
||||
IPInterfaceProperties properties = adapter.GetIPProperties();
|
||||
|
||||
foreach (IPAddressInformation unicast in properties.UnicastAddresses)
|
||||
{
|
||||
if (ipep.AddressFamily == unicast.Address.AddressFamily)
|
||||
@@ -126,16 +157,6 @@ namespace Server.Network
|
||||
}
|
||||
}
|
||||
}
|
||||
/*
|
||||
try {
|
||||
Console.WriteLine( "Listening: {0}:{1}", IPAddress.Loopback, ipep.Port );
|
||||
IPHostEntry iphe = Dns.GetHostEntry( Dns.GetHostName() );
|
||||
IPAddress[] ip = iphe.AddressList;
|
||||
for ( int i = 0; i < ip.Length; ++i )
|
||||
Console.WriteLine( "Listening: {0}:{1}", ip[i], ipep.Port );
|
||||
}
|
||||
catch { }
|
||||
*/
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -149,78 +170,293 @@ namespace Server.Network
|
||||
Utility.PopColor();
|
||||
}
|
||||
|
||||
private void OnAccept(IAsyncResult asyncResult)
|
||||
private SocketAsyncEventArgs Reset(ref SocketAsyncEventArgs e)
|
||||
{
|
||||
Socket listener = (Socket)asyncResult.AsyncState;
|
||||
if (e == null)
|
||||
{
|
||||
e = new SocketAsyncEventArgs();
|
||||
|
||||
Socket accepted = null;
|
||||
e.Completed += OnAccept;
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
accepted = listener.EndAccept(asyncResult);
|
||||
e.UserToken = this;
|
||||
e.AcceptSocket = null;
|
||||
e.RemoteEndPoint = null;
|
||||
|
||||
e.SocketFlags = 0;
|
||||
e.SocketError = 0;
|
||||
|
||||
e.DisconnectReuseSocket = true;
|
||||
|
||||
return e;
|
||||
}
|
||||
catch (SocketException ex)
|
||||
|
||||
[STAThread]
|
||||
private void AcceptLoop()
|
||||
{
|
||||
NetState.TraceException(ex);
|
||||
while (m_Listener != null)
|
||||
{
|
||||
Accept();
|
||||
}
|
||||
catch (ObjectDisposedException)
|
||||
}
|
||||
|
||||
private void Accept()
|
||||
{
|
||||
if (!m_AcceptLimiter.WaitOne(10))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (accepted != null)
|
||||
if (m_Listener == null)
|
||||
{
|
||||
if (VerifySocket(accepted))
|
||||
return;
|
||||
}
|
||||
|
||||
SocketAsyncEventArgs e = Reset(ref m_AcceptArgs);
|
||||
|
||||
bool iocp;
|
||||
|
||||
try
|
||||
{
|
||||
Enqueue(accepted);
|
||||
iocp = m_Listener.AcceptAsync(e);
|
||||
}
|
||||
catch
|
||||
{
|
||||
iocp = false;
|
||||
}
|
||||
|
||||
if (!iocp)
|
||||
{
|
||||
OnAccept(e);
|
||||
}
|
||||
}
|
||||
|
||||
private void OnAccept(object sender, SocketAsyncEventArgs e)
|
||||
{
|
||||
OnAccept(e);
|
||||
}
|
||||
|
||||
private void OnAccept(SocketAsyncEventArgs e)
|
||||
{
|
||||
try
|
||||
{
|
||||
Socket accepted = e.AcceptSocket;
|
||||
SocketError error = e.SocketError;
|
||||
|
||||
m_AcceptArgs = Reset(ref e);
|
||||
|
||||
if (accepted == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
Interlocked.Increment(ref m_Counter);
|
||||
|
||||
accepted.NoDelay = true;
|
||||
|
||||
if (error != 0)
|
||||
{
|
||||
Release(false, ref accepted);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
accepted.SendTimeout = 1000;
|
||||
accepted.ReceiveTimeout = 1000;
|
||||
|
||||
_ = ThreadPool.QueueUserWorkItem(o =>
|
||||
{
|
||||
Socket s = (Socket)o;
|
||||
|
||||
if (ValidateSequence(s, out byte[] seed))
|
||||
{
|
||||
Enqueue(s, seed);
|
||||
}
|
||||
else
|
||||
{
|
||||
Release(accepted);
|
||||
Release(false, ref s);
|
||||
}
|
||||
}, accepted);
|
||||
}
|
||||
catch
|
||||
{
|
||||
Release(false, ref accepted);
|
||||
}
|
||||
}
|
||||
finally
|
||||
{
|
||||
m_AcceptLimiter.Set();
|
||||
}
|
||||
}
|
||||
|
||||
private bool ValidateSequence(Socket socket, out byte[] buffer)
|
||||
{
|
||||
buffer = null;
|
||||
|
||||
byte[] peek;
|
||||
|
||||
try
|
||||
{
|
||||
peek = m_PeekBufferPool.AcquireBuffer();
|
||||
}
|
||||
catch
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
listener.BeginAccept(m_OnAccept, listener);
|
||||
}
|
||||
catch (SocketException ex)
|
||||
int recv = socket.Receive(peek, peek.Length, SocketFlags.None);
|
||||
|
||||
if (recv < peek.Length)
|
||||
{
|
||||
NetState.TraceException(ex);
|
||||
}
|
||||
catch (ObjectDisposedException)
|
||||
{ }
|
||||
return false;
|
||||
}
|
||||
|
||||
private bool VerifySocket(Socket socket)
|
||||
bool allow = false;
|
||||
|
||||
int index = 0;
|
||||
|
||||
byte packetID = peek[index++];
|
||||
|
||||
if (packetID == 0xEF)
|
||||
{
|
||||
byte[] packet = m_SeedBufferPool.AcquireBuffer();
|
||||
|
||||
try
|
||||
{
|
||||
SocketConnectEventArgs args = new SocketConnectEventArgs(socket);
|
||||
var diff = packet.Length - peek.Length;
|
||||
|
||||
EventSink.InvokeSocketConnect(args);
|
||||
recv = socket.Receive(packet, peek.Length, diff, SocketFlags.None);
|
||||
|
||||
return args.AllowConnection;
|
||||
}
|
||||
catch (Exception ex)
|
||||
if (recv == diff)
|
||||
{
|
||||
NetState.TraceException(ex);
|
||||
Buffer.BlockCopy(peek, 0, packet, 0, peek.Length);
|
||||
|
||||
uint seed = readU32(packet, ref index);
|
||||
|
||||
if (seed != 0)
|
||||
{
|
||||
uint clientMaj = readU32(packet, ref index);
|
||||
uint clientMin = readU32(packet, ref index);
|
||||
uint clientRev = readU32(packet, ref index);
|
||||
uint clientPat = readU32(packet, ref index);
|
||||
|
||||
uint version = (clientMaj << 24) | (clientMin << 16) | (clientRev << 8) | clientPat;
|
||||
|
||||
if (version != 0)
|
||||
{
|
||||
allow = true;
|
||||
|
||||
buffer = packet.ToArray();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
finally
|
||||
{
|
||||
m_SeedBufferPool.ReleaseBuffer(packet);
|
||||
}
|
||||
}
|
||||
else if (!Match(peek))
|
||||
{
|
||||
index = packetID = 0;
|
||||
|
||||
uint seed = readU32(peek, ref index);
|
||||
|
||||
if (seed != 0)
|
||||
{
|
||||
var one = m_ByteBufferPool.AcquireBuffer();
|
||||
|
||||
try
|
||||
{
|
||||
recv = socket.Receive(one, 0, one.Length, SocketFlags.None);
|
||||
|
||||
if (recv == one.Length)
|
||||
{
|
||||
packetID = one[0];
|
||||
|
||||
if (!MessagePump.CheckEncrypted(packetID))
|
||||
{
|
||||
allow = true;
|
||||
|
||||
buffer = new byte[peek.Length + one.Length];
|
||||
|
||||
Buffer.BlockCopy(peek, 0, buffer, 0, peek.Length);
|
||||
Buffer.BlockCopy(one, 0, buffer, peek.Length, one.Length);
|
||||
}
|
||||
}
|
||||
}
|
||||
finally
|
||||
{
|
||||
m_ByteBufferPool.ReleaseBuffer(one);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return allow;
|
||||
}
|
||||
catch
|
||||
{
|
||||
return false;
|
||||
}
|
||||
finally
|
||||
{
|
||||
m_PeekBufferPool.ReleaseBuffer(peek);
|
||||
}
|
||||
|
||||
uint readU32(byte[] b, ref int i)
|
||||
{
|
||||
return (uint)((b[i++] << 24) | (b[i++] << 16) | (b[i++] << 8) | b[i++]);
|
||||
}
|
||||
}
|
||||
|
||||
private bool Match(byte[] buffer)
|
||||
{
|
||||
for (int i = 0; i < m_HttpFilters.Length; i++)
|
||||
{
|
||||
byte[] filter = m_HttpFilters[i];
|
||||
|
||||
if (filter?.Length > 0)
|
||||
{
|
||||
IEnumerable<byte> fseq = filter;
|
||||
IEnumerable<byte> pseq = buffer;
|
||||
|
||||
if (filter.Length > buffer.Length)
|
||||
{
|
||||
fseq = fseq.Take(buffer.Length);
|
||||
}
|
||||
else if (buffer.Length > filter.Length)
|
||||
{
|
||||
pseq = pseq.Take(filter.Length);
|
||||
}
|
||||
|
||||
if (Enumerable.SequenceEqual(fseq, pseq))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
private void Enqueue(Socket socket)
|
||||
private void Enqueue(Socket socket, byte[] seed)
|
||||
{
|
||||
lock (m_AcceptedSyncRoot)
|
||||
{
|
||||
m_Accepted.Enqueue(socket);
|
||||
}
|
||||
m_Accepted.Enqueue(new SocketState(socket, seed));
|
||||
|
||||
Core.Set();
|
||||
}
|
||||
|
||||
private void Release(Socket socket)
|
||||
private void Release(bool graceful, ref Socket socket)
|
||||
{
|
||||
if (socket != null)
|
||||
{
|
||||
try
|
||||
{
|
||||
if (graceful)
|
||||
{
|
||||
try
|
||||
{
|
||||
@@ -230,51 +466,81 @@ namespace Server.Network
|
||||
{
|
||||
NetState.TraceException(ex);
|
||||
}
|
||||
}
|
||||
|
||||
try
|
||||
if (socket.LingerState != null)
|
||||
{
|
||||
socket.LingerState.Enabled = true;
|
||||
socket.LingerState.LingerTime = graceful ? 1 : 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
socket.LingerState = new LingerOption(true, graceful ? 1 : 0);
|
||||
}
|
||||
}
|
||||
catch
|
||||
{
|
||||
}
|
||||
finally
|
||||
{
|
||||
socket.Close();
|
||||
|
||||
socket = null;
|
||||
}
|
||||
catch (SocketException ex)
|
||||
{
|
||||
NetState.TraceException(ex);
|
||||
}
|
||||
}
|
||||
|
||||
public Socket[] Slice()
|
||||
public IEnumerable<SocketState> Slice()
|
||||
{
|
||||
Socket[] array;
|
||||
long now = Core.TickCount;
|
||||
|
||||
lock (m_AcceptedSyncRoot)
|
||||
if (now - m_SliceTime >= 1000)
|
||||
{
|
||||
if (m_Accepted.Count == 0)
|
||||
{
|
||||
return m_EmptySockets;
|
||||
var count = m_Counter;
|
||||
|
||||
Interlocked.Exchange(ref m_SliceTime, now);
|
||||
Interlocked.Exchange(ref m_AcceptsPerSecond, count - m_SliceCounter);
|
||||
Interlocked.Exchange(ref m_SliceCounter, count);
|
||||
}
|
||||
|
||||
array = m_Accepted.ToArray();
|
||||
m_Accepted.Clear();
|
||||
}
|
||||
int limit = Math.Min(m_Accepted.Count, 100);
|
||||
|
||||
return array;
|
||||
while (--limit >= 0 && m_Accepted.TryDequeue(out SocketState accepted))
|
||||
{
|
||||
Socket socket = accepted.Socket;
|
||||
|
||||
SocketConnectEventArgs args = new SocketConnectEventArgs(socket);
|
||||
|
||||
EventSink.InvokeSocketConnect(args);
|
||||
|
||||
if (args.AllowConnection)
|
||||
{
|
||||
yield return accepted;
|
||||
}
|
||||
else
|
||||
{
|
||||
Release(true, ref socket);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
Socket socket = Interlocked.Exchange(ref m_Listener, null);
|
||||
|
||||
if (socket != null)
|
||||
{
|
||||
socket.Close();
|
||||
socket?.Close();
|
||||
}
|
||||
}
|
||||
|
||||
if (_PingListener == null)
|
||||
public readonly struct SocketState
|
||||
{
|
||||
return;
|
||||
}
|
||||
public readonly Socket Socket;
|
||||
public readonly byte[] Seed;
|
||||
|
||||
_PingListener.Dispose();
|
||||
_PingListener = null;
|
||||
public SocketState(Socket socket, byte[] seed)
|
||||
{
|
||||
Socket = socket;
|
||||
Seed = seed;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,7 +1,7 @@
|
||||
#region References
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Net.Sockets;
|
||||
using System.Collections.Concurrent;
|
||||
using System.Linq;
|
||||
using System.Threading;
|
||||
|
||||
using Server.Diagnostics;
|
||||
@@ -9,15 +9,17 @@ using Server.Diagnostics;
|
||||
|
||||
namespace Server.Network
|
||||
{
|
||||
public class MessagePump
|
||||
public static class MessagePump
|
||||
{
|
||||
private Queue<NetState> m_Queue;
|
||||
private Queue<NetState> m_WorkingQueue;
|
||||
private readonly Queue<NetState> m_Throttled;
|
||||
private static readonly ConcurrentQueue<NetState> m_Queue = new ConcurrentQueue<NetState>();
|
||||
|
||||
public Listener[] Listeners { get; set; }
|
||||
private static readonly ConcurrentQueue<NetState> m_Throttled = new ConcurrentQueue<NetState>();
|
||||
|
||||
public MessagePump()
|
||||
public static Listener[] Listeners { get; private set; }
|
||||
|
||||
public static long AcceptsPerSecond => Listeners.Sum(l => l.AcceptsPerSecond);
|
||||
|
||||
public static void Start()
|
||||
{
|
||||
var ipep = Listener.EndPoints;
|
||||
|
||||
@@ -44,13 +46,9 @@ namespace Server.Network
|
||||
}
|
||||
}
|
||||
while (!success);
|
||||
|
||||
m_Queue = new Queue<NetState>();
|
||||
m_WorkingQueue = new Queue<NetState>();
|
||||
m_Throttled = new Queue<NetState>();
|
||||
}
|
||||
|
||||
public void AddListener(Listener l)
|
||||
public static void AddListener(Listener l)
|
||||
{
|
||||
var old = Listeners;
|
||||
|
||||
@@ -64,15 +62,13 @@ namespace Server.Network
|
||||
Listeners[old.Length] = l;
|
||||
}
|
||||
|
||||
private void CheckListener()
|
||||
private static void CheckListener()
|
||||
{
|
||||
foreach (Listener l in Listeners)
|
||||
{
|
||||
var accepted = l.Slice();
|
||||
|
||||
foreach (Socket s in accepted)
|
||||
foreach (SocketState state in l.Slice())
|
||||
{
|
||||
NetState ns = new NetState(s, this);
|
||||
NetState ns = new NetState(state);
|
||||
|
||||
ns.Start();
|
||||
|
||||
@@ -104,50 +100,41 @@ namespace Server.Network
|
||||
|
||||
private static string[] _NoDisplay =
|
||||
{
|
||||
"192.99.10.155",
|
||||
"192.99.69.21",
|
||||
"54.39.99.106",
|
||||
};
|
||||
|
||||
public void OnReceive(NetState ns)
|
||||
public static void OnReceive(NetState ns)
|
||||
{
|
||||
lock (this)
|
||||
m_Queue.Enqueue(ns);
|
||||
|
||||
Core.Set();
|
||||
}
|
||||
|
||||
public void Slice()
|
||||
public static void Slice()
|
||||
{
|
||||
CheckListener();
|
||||
|
||||
lock (this)
|
||||
{
|
||||
var temp = m_WorkingQueue;
|
||||
m_WorkingQueue = m_Queue;
|
||||
m_Queue = temp;
|
||||
}
|
||||
var limit = m_Queue.Count;
|
||||
|
||||
while (m_WorkingQueue.Count > 0)
|
||||
while (--limit >= 0 && m_Queue.TryDequeue(out NetState ns))
|
||||
{
|
||||
NetState ns = m_WorkingQueue.Dequeue();
|
||||
|
||||
if (ns.Running)
|
||||
{
|
||||
HandleReceive(ns);
|
||||
}
|
||||
}
|
||||
|
||||
lock (this)
|
||||
while (m_Throttled.TryDequeue(out NetState ns))
|
||||
{
|
||||
while (m_Throttled.Count > 0)
|
||||
if (ns.Running)
|
||||
{
|
||||
m_Queue.Enqueue(m_Throttled.Dequeue());
|
||||
m_Queue.Enqueue(ns);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private const int BufferSize = 4096;
|
||||
private readonly BufferPool m_Buffers = new BufferPool("Processor", 4, BufferSize);
|
||||
private static readonly BufferPool m_Buffers = new BufferPool("Processor", 4, BufferSize);
|
||||
|
||||
public static bool HandleSeed(NetState ns, ByteQueue buffer)
|
||||
{
|
||||
@@ -189,9 +176,11 @@ namespace Server.Network
|
||||
|
||||
public static bool CheckEncrypted(NetState ns, int packetID)
|
||||
{
|
||||
if (!ns.SentFirstPacket && packetID != 0xF0 && packetID != 0xF1 && packetID != 0xCF && packetID != 0x80 &&
|
||||
packetID != 0x91 && packetID != 0xA4 && packetID != 0xEF && packetID != 0xE4 && packetID != 0xFF)
|
||||
if (ns.SentFirstPacket || !CheckEncrypted(packetID))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
Utility.PushColor(ConsoleColor.Red);
|
||||
Console.WriteLine("Client: {0}: Encrypted Client Unsupported", ns);
|
||||
Utility.PopColor();
|
||||
@@ -201,10 +190,20 @@ namespace Server.Network
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
public static bool CheckEncrypted(int packetID)
|
||||
{
|
||||
return packetID != 0xF0
|
||||
&& packetID != 0xF1
|
||||
&& packetID != 0xCF
|
||||
&& packetID != 0x80
|
||||
&& packetID != 0x91
|
||||
&& packetID != 0xA4
|
||||
&& packetID != 0xEF
|
||||
&& packetID != 0xE4
|
||||
&& packetID != 0xFF;
|
||||
}
|
||||
|
||||
public void HandleReceive(NetState ns)
|
||||
public static void HandleReceive(NetState ns)
|
||||
{
|
||||
ByteQueue buffer = ns.Buffer;
|
||||
|
||||
|
||||
+108
-102
@@ -1,11 +1,14 @@
|
||||
#region References
|
||||
using System;
|
||||
using System.Collections.Concurrent;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.ObjectModel;
|
||||
using System.Diagnostics;
|
||||
using System.IO;
|
||||
using System.Net;
|
||||
using System.Net.Sockets;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
using Server.Accounting;
|
||||
using Server.Diagnostics;
|
||||
@@ -44,9 +47,6 @@ namespace Server.Network
|
||||
private readonly SendQueue m_SendQueue;
|
||||
private bool m_Running;
|
||||
|
||||
private AsyncCallback m_OnReceive, m_OnSend;
|
||||
|
||||
private readonly MessagePump m_MessagePump;
|
||||
private List<Gump> m_Gumps;
|
||||
private List<HuePicker> m_HuePickers;
|
||||
private List<IMenu> m_Menus;
|
||||
@@ -80,7 +80,8 @@ namespace Server.Network
|
||||
Paused = 0x02
|
||||
}
|
||||
|
||||
private AsyncState m_AsyncState;
|
||||
private volatile AsyncState m_AsyncState;
|
||||
|
||||
private readonly object m_AsyncLock = new object();
|
||||
|
||||
public IPacketEncoder PacketEncoder { get; set; }
|
||||
@@ -577,9 +578,10 @@ namespace Server.Network
|
||||
return m_ToString;
|
||||
}
|
||||
|
||||
private static readonly List<NetState> m_Instances = new List<NetState>();
|
||||
private static readonly ConcurrentDictionary<NetState, IPAddress> m_Instances = new ConcurrentDictionary<NetState, IPAddress>();
|
||||
|
||||
public static List<NetState> Instances { get { return m_Instances; } }
|
||||
public static ReadOnlyCollection<NetState> Instances => (ReadOnlyCollection<NetState>)m_Instances.Keys;
|
||||
public static ReadOnlyCollection<IPAddress> Addresses => (ReadOnlyCollection<IPAddress>)m_Instances.Values;
|
||||
|
||||
public const int SendBufferCapacity = 1024, SendBufferSize = 8092;
|
||||
public const int ReceiveBufferCapacity = 1024, ReceiveBufferSize = 2048;
|
||||
@@ -590,13 +592,15 @@ namespace Server.Network
|
||||
public static BufferPool SendBuffers { get { return m_SendBufferPool; } }
|
||||
public static BufferPool ReceiveBuffers { get { return m_ReceiveBufferPool; } }
|
||||
|
||||
public NetState(Socket socket, MessagePump messagePump)
|
||||
public NetState(SocketState state)
|
||||
{
|
||||
Socket = socket;
|
||||
Socket = state.Socket;
|
||||
|
||||
m_InitialData = state.Seed;
|
||||
|
||||
m_Buffer = new ByteQueue();
|
||||
|
||||
m_RecvBuffer = m_ReceiveBufferPool.AcquireBuffer();
|
||||
m_MessagePump = messagePump;
|
||||
|
||||
m_Gumps = new List<Gump>();
|
||||
m_HuePickers = new List<HuePicker>();
|
||||
@@ -607,8 +611,6 @@ namespace Server.Network
|
||||
|
||||
m_NextCheckActivity = Core.TickCount + 30000;
|
||||
|
||||
m_Instances.Add(this);
|
||||
|
||||
try
|
||||
{
|
||||
m_Address = Utility.Intern(((IPEndPoint)Socket.RemoteEndPoint).Address);
|
||||
@@ -621,6 +623,8 @@ namespace Server.Network
|
||||
m_ToString = "(error)";
|
||||
}
|
||||
|
||||
m_Instances[this] = m_Address;
|
||||
|
||||
m_ConnectedOn = DateTime.UtcNow;
|
||||
|
||||
UpdateRange = Core.GlobalUpdateRange;
|
||||
@@ -631,27 +635,30 @@ namespace Server.Network
|
||||
}
|
||||
}
|
||||
|
||||
private bool _Sending;
|
||||
private volatile bool _Sending;
|
||||
|
||||
private readonly object _SendLock = new object();
|
||||
|
||||
public virtual void Send(Packet p)
|
||||
{
|
||||
if (Socket == null || BlockAllPackets)
|
||||
if (p == null)
|
||||
{
|
||||
p.OnSend();
|
||||
return;
|
||||
}
|
||||
|
||||
int length;
|
||||
try
|
||||
{
|
||||
if (Socket == null || BlockAllPackets)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
var buffer = p.Compile(CompressionEnabled, out length);
|
||||
var buffer = p.Compile(CompressionEnabled, out int length);
|
||||
|
||||
if (buffer != null)
|
||||
{
|
||||
if (buffer.Length <= 0 || length <= 0)
|
||||
{
|
||||
p.OnSend();
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -662,11 +669,10 @@ namespace Server.Network
|
||||
prof = PacketSendProfile.Acquire(p.GetType());
|
||||
}
|
||||
|
||||
if (prof != null)
|
||||
{
|
||||
prof.Start();
|
||||
}
|
||||
prof?.Start();
|
||||
|
||||
try
|
||||
{
|
||||
var buffered = false;
|
||||
|
||||
if (PacketEncoder != null || PacketEncryptor != null)
|
||||
@@ -688,15 +694,8 @@ namespace Server.Network
|
||||
System.Buffer.BlockCopy(buffer, 0, packetBuffer, 0, packetLength);
|
||||
}
|
||||
|
||||
if (PacketEncoder != null)
|
||||
{
|
||||
PacketEncoder.EncodeOutgoingPacket(this, ref packetBuffer, ref packetLength);
|
||||
}
|
||||
|
||||
if (PacketEncryptor != null)
|
||||
{
|
||||
PacketEncryptor.EncryptOutgoingPacket(this, ref packetBuffer, ref packetLength);
|
||||
}
|
||||
PacketEncoder?.EncodeOutgoingPacket(this, ref packetBuffer, ref packetLength);
|
||||
PacketEncryptor?.EncryptOutgoingPacket(this, ref packetBuffer, ref packetLength);
|
||||
|
||||
buffered = buffer != packetBuffer && packetBuffer.Length == SendBufferSize;
|
||||
|
||||
@@ -706,10 +705,10 @@ namespace Server.Network
|
||||
|
||||
try
|
||||
{
|
||||
SendQueue.Gram gram;
|
||||
|
||||
lock (_SendLock)
|
||||
{
|
||||
SendQueue.Gram gram;
|
||||
|
||||
lock (m_SendQueue)
|
||||
{
|
||||
gram = m_SendQueue.Enqueue(buffer, length);
|
||||
@@ -726,7 +725,9 @@ namespace Server.Network
|
||||
|
||||
try
|
||||
{
|
||||
Socket.BeginSend(gram.Buffer, 0, gram.Length, SocketFlags.None, m_OnSend, Socket);
|
||||
var segment = new ArraySegment<byte>(gram.Buffer, 0, gram.Length);
|
||||
|
||||
_ = Socket.SendAsync(segment, SocketFlags.None).ContinueWith(OnSend);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
@@ -744,12 +745,10 @@ namespace Server.Network
|
||||
|
||||
Dispose(false);
|
||||
}
|
||||
|
||||
p.OnSend();
|
||||
|
||||
if (prof != null)
|
||||
}
|
||||
finally
|
||||
{
|
||||
prof.Finish(length);
|
||||
prof?.Finish(length);
|
||||
}
|
||||
}
|
||||
else
|
||||
@@ -767,12 +766,14 @@ namespace Server.Network
|
||||
Dispose();
|
||||
}
|
||||
}
|
||||
finally
|
||||
{
|
||||
p.OnSend();
|
||||
}
|
||||
}
|
||||
|
||||
public void Start()
|
||||
{
|
||||
m_OnReceive = OnReceive;
|
||||
m_OnSend = OnSend;
|
||||
|
||||
m_Running = true;
|
||||
|
||||
if (Socket == null || m_Paused)
|
||||
@@ -797,20 +798,41 @@ namespace Server.Network
|
||||
}
|
||||
}
|
||||
|
||||
private byte[] m_InitialData;
|
||||
|
||||
private void InternalBeginReceive()
|
||||
{
|
||||
m_AsyncState |= AsyncState.Pending;
|
||||
|
||||
Socket.BeginReceive(m_RecvBuffer, 0, m_RecvBuffer.Length, SocketFlags.None, m_OnReceive, Socket);
|
||||
if (m_InitialData != null)
|
||||
{
|
||||
_ = Task.Factory.StartNew(() =>
|
||||
{
|
||||
var data = Interlocked.Exchange(ref m_InitialData, null);
|
||||
|
||||
System.Buffer.BlockCopy(data, 0, m_RecvBuffer, 0, data.Length);
|
||||
|
||||
return data.Length;
|
||||
}).ContinueWith(OnReceive);
|
||||
}
|
||||
else
|
||||
{
|
||||
var segment = new ArraySegment<byte>(m_RecvBuffer, 0, m_RecvBuffer.Length);
|
||||
|
||||
_ = Socket.ReceiveAsync(segment, SocketFlags.None).ContinueWith(OnReceive);
|
||||
}
|
||||
}
|
||||
|
||||
private void OnReceive(IAsyncResult asyncResult)
|
||||
private void OnReceive(Task<int> task)
|
||||
{
|
||||
try
|
||||
{
|
||||
var s = (Socket)asyncResult.AsyncState;
|
||||
if (task.IsFaulted)
|
||||
{
|
||||
throw task.Exception;
|
||||
}
|
||||
|
||||
var byteCount = s.EndReceive(asyncResult);
|
||||
var byteCount = task.Result;
|
||||
|
||||
if (byteCount > 0)
|
||||
{
|
||||
@@ -823,20 +845,15 @@ namespace Server.Network
|
||||
buffer = m_RecvBuffer;
|
||||
}
|
||||
|
||||
if (PacketEncryptor != null)
|
||||
{
|
||||
PacketEncryptor.DecryptIncomingPacket(this, ref buffer, ref byteCount);
|
||||
}
|
||||
|
||||
if (PacketEncoder != null)
|
||||
{
|
||||
PacketEncoder.DecodeIncomingPacket(this, ref buffer, ref byteCount);
|
||||
}
|
||||
PacketEncryptor?.DecryptIncomingPacket(this, ref buffer, ref byteCount);
|
||||
PacketEncoder?.DecodeIncomingPacket(this, ref buffer, ref byteCount);
|
||||
|
||||
lock (m_Buffer)
|
||||
{
|
||||
m_Buffer.Enqueue(buffer, 0, byteCount);
|
||||
}
|
||||
|
||||
m_MessagePump.OnReceive(this);
|
||||
MessagePump.OnReceive(this);
|
||||
|
||||
lock (m_AsyncLock)
|
||||
{
|
||||
@@ -867,13 +884,16 @@ namespace Server.Network
|
||||
}
|
||||
}
|
||||
|
||||
private void OnSend(IAsyncResult asyncResult)
|
||||
private void OnSend(Task<int> task)
|
||||
{
|
||||
var s = (Socket)asyncResult.AsyncState;
|
||||
|
||||
try
|
||||
{
|
||||
var bytes = s.EndSend(asyncResult);
|
||||
if (task.IsFaulted)
|
||||
{
|
||||
throw task.Exception;
|
||||
}
|
||||
|
||||
var bytes = task.Result;
|
||||
|
||||
if (bytes <= 0)
|
||||
{
|
||||
@@ -904,7 +924,9 @@ namespace Server.Network
|
||||
{
|
||||
try
|
||||
{
|
||||
s.BeginSend(gram.Buffer, 0, gram.Length, SocketFlags.None, m_OnSend, s);
|
||||
var segment = new ArraySegment<byte>(gram.Buffer, 0, gram.Length);
|
||||
|
||||
_ = Socket.SendAsync(segment, SocketFlags.None).ContinueWith(OnSend);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
@@ -930,7 +952,7 @@ namespace Server.Network
|
||||
{
|
||||
m_Paused = true;
|
||||
|
||||
foreach (var ns in m_Instances)
|
||||
foreach (var ns in m_Instances.Keys)
|
||||
{
|
||||
lock (ns.m_AsyncLock)
|
||||
{
|
||||
@@ -943,7 +965,7 @@ namespace Server.Network
|
||||
{
|
||||
m_Paused = false;
|
||||
|
||||
foreach (var ns in m_Instances)
|
||||
foreach (var ns in m_Instances.Keys)
|
||||
{
|
||||
if (ns.Socket == null)
|
||||
{
|
||||
@@ -1001,7 +1023,11 @@ namespace Server.Network
|
||||
try
|
||||
{
|
||||
_Sending = true;
|
||||
Socket.BeginSend(gram.Buffer, 0, gram.Length, SocketFlags.None, m_OnSend, Socket);
|
||||
|
||||
var segment = new ArraySegment<byte>(gram.Buffer, 0, gram.Length);
|
||||
|
||||
_ = Socket.SendAsync(segment, SocketFlags.None).ContinueWith(OnSend);
|
||||
|
||||
return true;
|
||||
}
|
||||
catch (Exception ex)
|
||||
@@ -1027,9 +1053,9 @@ namespace Server.Network
|
||||
|
||||
public static void FlushAll()
|
||||
{
|
||||
foreach (NetState ns in m_Instances)
|
||||
foreach (NetState ns in m_Instances.Keys)
|
||||
{
|
||||
ns.Flush();
|
||||
_ = ns.Flush();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1130,12 +1156,11 @@ namespace Server.Network
|
||||
TraceException(ex);
|
||||
}
|
||||
|
||||
if (m_RecvBuffer != null)
|
||||
var buffer = Interlocked.Exchange(ref m_RecvBuffer, null);
|
||||
|
||||
if (buffer != null)
|
||||
{
|
||||
lock (m_ReceiveBufferPool)
|
||||
{
|
||||
m_ReceiveBufferPool.ReleaseBuffer(m_RecvBuffer);
|
||||
}
|
||||
m_ReceiveBufferPool.ReleaseBuffer(buffer);
|
||||
}
|
||||
|
||||
Socket = null;
|
||||
@@ -1144,27 +1169,12 @@ namespace Server.Network
|
||||
PacketEncryptor = null;
|
||||
|
||||
m_Buffer = null;
|
||||
m_RecvBuffer = null;
|
||||
|
||||
m_OnReceive = null;
|
||||
m_OnSend = null;
|
||||
|
||||
m_Running = false;
|
||||
|
||||
lock (m_Disposed)
|
||||
{
|
||||
m_Disposed.Enqueue(this);
|
||||
}
|
||||
|
||||
lock (m_SendQueue)
|
||||
{
|
||||
if (!m_SendQueue.IsEmpty)
|
||||
{
|
||||
m_SendQueue.Clear();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static void Initialize()
|
||||
{
|
||||
Timer.DelayCall(TimeSpan.FromMinutes(1.0), TimeSpan.FromMinutes(1.5), CheckAllAlive);
|
||||
@@ -1176,14 +1186,9 @@ namespace Server.Network
|
||||
{
|
||||
var curTicks = Core.TickCount;
|
||||
|
||||
var i = m_Instances.Count;
|
||||
|
||||
while (--i >= 0)
|
||||
foreach (var ns in m_Instances.Keys)
|
||||
{
|
||||
if (m_Instances[i] != null)
|
||||
{
|
||||
m_Instances[i].CheckAlive(curTicks);
|
||||
}
|
||||
ns.CheckAlive(curTicks);
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
@@ -1192,18 +1197,14 @@ namespace Server.Network
|
||||
}
|
||||
}
|
||||
|
||||
private static readonly Queue<NetState> m_Disposed = new Queue<NetState>();
|
||||
private static readonly ConcurrentQueue<NetState> m_Disposed = new ConcurrentQueue<NetState>();
|
||||
|
||||
public static void ProcessDisposedQueue()
|
||||
{
|
||||
lock (m_Disposed)
|
||||
{
|
||||
var breakout = 200;
|
||||
var breakout = m_Disposed.Count;
|
||||
|
||||
while (--breakout >= 0 && m_Disposed.Count > 0)
|
||||
while (--breakout >= 0 && m_Disposed.TryDequeue(out var ns))
|
||||
{
|
||||
var ns = m_Disposed.Dequeue();
|
||||
|
||||
var m = ns.Mobile;
|
||||
var a = ns.Account;
|
||||
|
||||
@@ -1215,14 +1216,20 @@ namespace Server.Network
|
||||
ns.Mobile = null;
|
||||
}
|
||||
|
||||
m_Instances.TryRemove(ns, out _);
|
||||
|
||||
ns.m_Gumps.Clear();
|
||||
ns.m_Menus.Clear();
|
||||
ns.m_HuePickers.Clear();
|
||||
|
||||
ns.Account = null;
|
||||
ns.ServerInfo = null;
|
||||
ns.CityInfo = null;
|
||||
|
||||
m_Instances.Remove(ns);
|
||||
if (!ns.m_SendQueue.IsEmpty)
|
||||
{
|
||||
ns.m_SendQueue.Clear();
|
||||
}
|
||||
|
||||
Utility.PushColor(ConsoleColor.Red);
|
||||
|
||||
@@ -1238,7 +1245,6 @@ namespace Server.Network
|
||||
Utility.PopColor();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
[CommandProperty(AccessLevel.Administrator, true)]
|
||||
public bool Running { get { return m_Running; } }
|
||||
@@ -1280,7 +1286,7 @@ namespace Server.Network
|
||||
|
||||
if (info.RequiredClient != null)
|
||||
{
|
||||
return ( IsEnhancedClient || Version >= info.RequiredClient );
|
||||
return (IsEnhancedClient || Version >= info.RequiredClient);
|
||||
}
|
||||
|
||||
return ((Flags & info.ClientFlags) != 0);
|
||||
|
||||
@@ -50,6 +50,8 @@ namespace Server.Network
|
||||
|
||||
public static PacketHandler[] Handlers { get { return m_Handlers; } }
|
||||
|
||||
public static int LoginSeedLength => Handlers[0xEF]?.Length ?? -1;
|
||||
|
||||
static PacketHandlers()
|
||||
{
|
||||
m_Handlers = new PacketHandler[0x100];
|
||||
|
||||
+21
-48
@@ -1,6 +1,7 @@
|
||||
#region References
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.Concurrent;
|
||||
using System.Threading;
|
||||
#endregion
|
||||
|
||||
namespace Server.Network
|
||||
@@ -9,19 +10,11 @@ namespace Server.Network
|
||||
{
|
||||
public class Gram
|
||||
{
|
||||
private static readonly Stack<Gram> _pool = new Stack<Gram>();
|
||||
private static readonly ConcurrentQueue<Gram> _pool = new ConcurrentQueue<Gram>();
|
||||
|
||||
public static Gram Acquire()
|
||||
{
|
||||
lock (_pool)
|
||||
{
|
||||
Gram gram;
|
||||
|
||||
if (_pool.Count > 0)
|
||||
{
|
||||
gram = _pool.Pop();
|
||||
}
|
||||
else
|
||||
if (!_pool.TryDequeue(out Gram gram))
|
||||
{
|
||||
gram = new Gram();
|
||||
}
|
||||
@@ -31,7 +24,6 @@ namespace Server.Network
|
||||
|
||||
return gram;
|
||||
}
|
||||
}
|
||||
|
||||
private byte[] _buffer;
|
||||
private int _length;
|
||||
@@ -60,13 +52,11 @@ namespace Server.Network
|
||||
|
||||
public void Release()
|
||||
{
|
||||
lock (_pool)
|
||||
{
|
||||
_pool.Push(this);
|
||||
_pool.Enqueue(this);
|
||||
|
||||
ReleaseBuffer(_buffer);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static int m_CoalesceBufferSize = 512;
|
||||
private static BufferPool m_UnusedBuffers = new BufferPool("Coalesced", 2048, m_CoalesceBufferSize);
|
||||
@@ -81,69 +71,52 @@ namespace Server.Network
|
||||
return;
|
||||
}
|
||||
|
||||
BufferPool old = m_UnusedBuffers;
|
||||
|
||||
lock (old)
|
||||
{
|
||||
if (m_UnusedBuffers != null)
|
||||
{
|
||||
m_UnusedBuffers.Free();
|
||||
}
|
||||
m_UnusedBuffers?.Free();
|
||||
|
||||
m_CoalesceBufferSize = value;
|
||||
m_UnusedBuffers = new BufferPool("Coalesced", 2048, m_CoalesceBufferSize);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static byte[] AcquireBuffer()
|
||||
{
|
||||
lock (m_UnusedBuffers)
|
||||
return m_UnusedBuffers.AcquireBuffer();
|
||||
}
|
||||
|
||||
public static void ReleaseBuffer(byte[] buffer)
|
||||
{
|
||||
lock (m_UnusedBuffers)
|
||||
if (buffer != null && buffer.Length == m_CoalesceBufferSize)
|
||||
{
|
||||
m_UnusedBuffers.ReleaseBuffer(buffer);
|
||||
}
|
||||
}
|
||||
|
||||
private readonly Queue<Gram> _pending;
|
||||
private readonly ConcurrentQueue<Gram> _pending = new ConcurrentQueue<Gram>();
|
||||
|
||||
private Gram _buffered;
|
||||
private volatile Gram _buffered;
|
||||
|
||||
public bool IsFlushReady { get { return (_pending.Count == 0 && _buffered != null); } }
|
||||
|
||||
public bool IsEmpty { get { return (_pending.Count == 0 && _buffered == null); } }
|
||||
|
||||
public SendQueue()
|
||||
{
|
||||
_pending = new Queue<Gram>();
|
||||
}
|
||||
|
||||
public Gram CheckFlushReady()
|
||||
{
|
||||
Gram gram = _buffered;
|
||||
_pending.Enqueue(_buffered);
|
||||
_buffered = null;
|
||||
Gram gram = Interlocked.Exchange(ref _buffered, null);
|
||||
|
||||
_pending.Enqueue(gram);
|
||||
|
||||
return gram;
|
||||
}
|
||||
|
||||
public Gram Dequeue()
|
||||
{
|
||||
Gram gram = null;
|
||||
|
||||
if (_pending.Count > 0)
|
||||
if (_pending.TryDequeue(out Gram gram))
|
||||
{
|
||||
_pending.Dequeue().Release();
|
||||
gram?.Release();
|
||||
gram = null;
|
||||
|
||||
if (_pending.Count > 0)
|
||||
{
|
||||
gram = _pending.Peek();
|
||||
}
|
||||
if (_pending.TryPeek(out Gram peek))
|
||||
gram = peek;
|
||||
}
|
||||
|
||||
return gram;
|
||||
@@ -177,7 +150,7 @@ namespace Server.Network
|
||||
throw new ArgumentException("Offset and length do not point to a valid segment within the buffer.");
|
||||
}
|
||||
|
||||
int existingBytes = (_pending.Count * m_CoalesceBufferSize) + (_buffered == null ? 0 : _buffered.Length);
|
||||
int existingBytes = (_pending.Count * m_CoalesceBufferSize) + (_buffered?.Length ?? 0);
|
||||
|
||||
if ((existingBytes + length) > PendingCap)
|
||||
{
|
||||
@@ -222,9 +195,9 @@ namespace Server.Network
|
||||
_buffered = null;
|
||||
}
|
||||
|
||||
while (_pending.Count > 0)
|
||||
while (_pending.TryDequeue(out Gram gram))
|
||||
{
|
||||
_pending.Dequeue().Release();
|
||||
gram?.Release();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+260
-536
@@ -1,485 +1,70 @@
|
||||
#region References
|
||||
using System;
|
||||
using System.CodeDom.Compiler;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
using System.Security.Cryptography;
|
||||
using System.Text;
|
||||
|
||||
using Microsoft.CSharp;
|
||||
#endregion
|
||||
|
||||
namespace Server
|
||||
{
|
||||
public static class ScriptCompiler
|
||||
{
|
||||
public static bool Dynamic { get => Config.Get("Compiler.Dynamic", true); set => Config.Set("Compiler.Dynamic", value); }
|
||||
|
||||
public static Assembly[] Assemblies { get; set; }
|
||||
|
||||
private static readonly List<string> m_AdditionalReferences = new List<string>();
|
||||
|
||||
public static string[] GetReferenceAssemblies()
|
||||
{
|
||||
var list = new List<string>();
|
||||
|
||||
var path = Path.Combine(Core.BaseDirectory, "Data/Assemblies.cfg");
|
||||
|
||||
if (File.Exists(path))
|
||||
{
|
||||
using (var ip = new StreamReader(path))
|
||||
{
|
||||
string line;
|
||||
|
||||
while ((line = ip.ReadLine()) != null)
|
||||
{
|
||||
if (line.Length > 0 && !line.StartsWith("#"))
|
||||
{
|
||||
list.Add(line);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
list.Add(Core.ExePath);
|
||||
|
||||
list.AddRange(m_AdditionalReferences);
|
||||
|
||||
return list.ToArray();
|
||||
}
|
||||
|
||||
public static string GetCompilerOptions(bool debug)
|
||||
{
|
||||
StringBuilder sb = null;
|
||||
|
||||
AppendCompilerOption(ref sb, "/d:ServUO");
|
||||
|
||||
AppendCompilerOption(ref sb, "/unsafe");
|
||||
|
||||
if (!debug)
|
||||
{
|
||||
AppendCompilerOption(ref sb, "/optimize");
|
||||
}
|
||||
else
|
||||
{
|
||||
AppendCompilerOption(ref sb, "/debug");
|
||||
AppendCompilerOption(ref sb, "/d:DEBUG");
|
||||
AppendCompilerOption(ref sb, "/d:TRACE");
|
||||
}
|
||||
|
||||
AppendCompilerOption(ref sb, "/langversion:7.2");
|
||||
|
||||
#if MONO
|
||||
AppendCompilerOption( ref sb, "/d:MONO" );
|
||||
#endif
|
||||
|
||||
if (Core.Is64Bit)
|
||||
{
|
||||
AppendCompilerOption(ref sb, "/d:x64");
|
||||
}
|
||||
|
||||
#if NEWTIMERS
|
||||
AppendCompilerOption(ref sb, "/d:NEWTIMERS");
|
||||
#endif
|
||||
|
||||
#if NEWPARENT
|
||||
AppendCompilerOption(ref sb, "/d:NEWPARENT");
|
||||
#endif
|
||||
|
||||
return (sb == null ? null : sb.ToString());
|
||||
}
|
||||
|
||||
private static void AppendCompilerOption(ref StringBuilder sb, string define)
|
||||
{
|
||||
if (sb == null)
|
||||
{
|
||||
sb = new StringBuilder();
|
||||
}
|
||||
else
|
||||
{
|
||||
sb.Append(' ');
|
||||
}
|
||||
|
||||
sb.Append(define);
|
||||
}
|
||||
|
||||
private static byte[] GetHashCode(string compiledFile, string[] scriptFiles, bool debug)
|
||||
{
|
||||
using (var ms = new MemoryStream())
|
||||
{
|
||||
using (var bin = new BinaryWriter(ms))
|
||||
{
|
||||
var fileInfo = new FileInfo(compiledFile);
|
||||
|
||||
bin.Write(fileInfo.LastWriteTimeUtc.Ticks);
|
||||
|
||||
foreach (var scriptFile in scriptFiles)
|
||||
{
|
||||
fileInfo = new FileInfo(scriptFile);
|
||||
|
||||
bin.Write(fileInfo.LastWriteTimeUtc.Ticks);
|
||||
}
|
||||
|
||||
bin.Write(debug);
|
||||
bin.Write(Core.Version.ToString());
|
||||
|
||||
ms.Position = 0;
|
||||
|
||||
using (var sha1 = SHA1.Create())
|
||||
{
|
||||
return sha1.ComputeHash(ms);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static bool CompileCSScripts(out Assembly assembly)
|
||||
{
|
||||
return CompileCSScripts(false, true, out assembly);
|
||||
}
|
||||
|
||||
public static bool CompileCSScripts(bool debug, out Assembly assembly)
|
||||
{
|
||||
return CompileCSScripts(debug, true, out assembly);
|
||||
}
|
||||
|
||||
public static bool CompileCSScripts(bool debug, bool cache, out Assembly assembly)
|
||||
{
|
||||
Utility.PushColor(ConsoleColor.Yellow);
|
||||
Console.Write("Scripts: Compiling C# scripts...");
|
||||
Utility.PopColor();
|
||||
var files = GetScripts("*.cs");
|
||||
|
||||
if (files.Length == 0)
|
||||
{
|
||||
Utility.PushColor(ConsoleColor.Red);
|
||||
Console.WriteLine("no files found.");
|
||||
Utility.PopColor();
|
||||
assembly = null;
|
||||
return true;
|
||||
}
|
||||
|
||||
if (File.Exists("Scripts/Output/Scripts.CS.dll"))
|
||||
{
|
||||
if (cache && File.Exists("Scripts/Output/Scripts.CS.hash"))
|
||||
public static bool Compile(bool debug, bool cache)
|
||||
{
|
||||
try
|
||||
{
|
||||
var hashCode = GetHashCode("Scripts/Output/Scripts.CS.dll", files, debug);
|
||||
var assemblies = new HashSet<Assembly>
|
||||
{
|
||||
typeof(ScriptCompiler).Assembly
|
||||
};
|
||||
|
||||
using (var fs = new FileStream("Scripts/Output/Scripts.CS.hash", FileMode.Open, FileAccess.Read, FileShare.Read))
|
||||
if (Dynamic)
|
||||
{
|
||||
using (var bin = new BinaryReader(fs))
|
||||
{
|
||||
var bytes = bin.ReadBytes(hashCode.Length);
|
||||
Console.WriteLine("Core: Compiling scripts...");
|
||||
|
||||
if (bytes.Length == hashCode.Length)
|
||||
{
|
||||
var valid = true;
|
||||
var path = Path.Combine(Core.BaseDirectory, "Scripts");
|
||||
|
||||
for (var i = 0; i < bytes.Length; ++i)
|
||||
foreach (var proj in Directory.EnumerateFiles(path, "Scripts.csproj"))
|
||||
{
|
||||
if (bytes[i] != hashCode[i])
|
||||
try
|
||||
{
|
||||
valid = false;
|
||||
var info = new ProcessStartInfo
|
||||
{
|
||||
FileName = "dotnet",
|
||||
Arguments = $"build \"{proj}\" -c {(debug ? "Debug" : "Release")}",
|
||||
ErrorDialog = false,
|
||||
UseShellExecute = false,
|
||||
CreateNoWindow = true,
|
||||
WindowStyle = ProcessWindowStyle.Hidden,
|
||||
RedirectStandardOutput = true,
|
||||
};
|
||||
|
||||
var proc = Process.Start(info);
|
||||
|
||||
Console.WriteLine(proc.StandardOutput.ReadToEnd());
|
||||
|
||||
proc.WaitForExit();
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
Console.WriteLine(e);
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (valid)
|
||||
{
|
||||
assembly = Assembly.LoadFrom("Scripts/Output/Scripts.CS.dll");
|
||||
|
||||
if (!m_AdditionalReferences.Contains(assembly.Location))
|
||||
{
|
||||
m_AdditionalReferences.Add(assembly.Location);
|
||||
}
|
||||
|
||||
Utility.PushColor(ConsoleColor.Green);
|
||||
Console.WriteLine("done (cached)");
|
||||
Utility.PopColor();
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
catch
|
||||
{ }
|
||||
}
|
||||
}
|
||||
|
||||
DeleteFiles("Scripts.CS*.dll");
|
||||
|
||||
#if !MONO
|
||||
using (CodeDomProvider provider = new Microsoft.CodeDom.Providers.DotNetCompilerPlatform.CSharpCodeProvider())
|
||||
#else
|
||||
using (CSharpCodeProvider provider = new CSharpCodeProvider())
|
||||
#endif
|
||||
{
|
||||
var path = GetUnusedPath("Scripts.CS");
|
||||
|
||||
var parms = new CompilerParameters(GetReferenceAssemblies(), path, debug);
|
||||
|
||||
var options = GetCompilerOptions(debug);
|
||||
|
||||
if (options != null)
|
||||
{
|
||||
parms.CompilerOptions = options;
|
||||
}
|
||||
|
||||
if (Core.HaltOnWarning)
|
||||
{
|
||||
parms.WarningLevel = 4;
|
||||
}
|
||||
|
||||
if (Core.Unix)
|
||||
{
|
||||
parms.CompilerOptions = String.Format( "{0} /nowarn:169,219,414 /recurse:Scripts/*.cs", parms.CompilerOptions );
|
||||
files = new string[0];
|
||||
}
|
||||
|
||||
var results = provider.CompileAssemblyFromFile(parms, files);
|
||||
|
||||
m_AdditionalReferences.Add(path);
|
||||
|
||||
Display(results);
|
||||
|
||||
if (results.Errors.Count > 0 && !Core.Unix)
|
||||
{
|
||||
assembly = null;
|
||||
return false;
|
||||
}
|
||||
|
||||
if (results.Errors.Count > 0 && Core.Unix)
|
||||
{
|
||||
foreach( CompilerError err in results.Errors ) {
|
||||
if ( !err.IsWarning ) {
|
||||
assembly = null;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (cache && Path.GetFileName(path) == "Scripts.CS.dll")
|
||||
{
|
||||
try
|
||||
{
|
||||
var hashCode = GetHashCode(path, files, debug);
|
||||
|
||||
using (
|
||||
var fs = new FileStream("Scripts/Output/Scripts.CS.hash", FileMode.Create, FileAccess.Write, FileShare.None))
|
||||
{
|
||||
using (var bin = new BinaryWriter(fs))
|
||||
{
|
||||
bin.Write(hashCode, 0, hashCode.Length);
|
||||
}
|
||||
}
|
||||
}
|
||||
catch
|
||||
{ }
|
||||
}
|
||||
|
||||
assembly = results.CompiledAssembly;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
public static void Display(CompilerResults results)
|
||||
{
|
||||
if (results.Errors.Count > 0)
|
||||
{
|
||||
var errors = new Dictionary<string, List<CompilerError>>(results.Errors.Count, StringComparer.OrdinalIgnoreCase);
|
||||
var warnings = new Dictionary<string, List<CompilerError>>(results.Errors.Count, StringComparer.OrdinalIgnoreCase);
|
||||
|
||||
foreach (CompilerError e in results.Errors)
|
||||
{
|
||||
var file = e.FileName;
|
||||
|
||||
// Ridiculous. FileName is null if the warning/error is internally generated in csc.
|
||||
if (string.IsNullOrEmpty(file))
|
||||
{
|
||||
Console.WriteLine("ScriptCompiler: {0}: {1}", e.ErrorNumber, e.ErrorText);
|
||||
continue;
|
||||
}
|
||||
|
||||
var table = (e.IsWarning ? warnings : errors);
|
||||
|
||||
List<CompilerError> list = null;
|
||||
table.TryGetValue(file, out list);
|
||||
|
||||
if (list == null)
|
||||
{
|
||||
table[file] = list = new List<CompilerError>();
|
||||
}
|
||||
|
||||
list.Add(e);
|
||||
}
|
||||
|
||||
if (errors.Count > 0)
|
||||
{
|
||||
Utility.PushColor(ConsoleColor.Red);
|
||||
Console.WriteLine("Failed with: {0} errors, {1} warnings", errors.Count, warnings.Count);
|
||||
Utility.PopColor();
|
||||
}
|
||||
else
|
||||
{
|
||||
Utility.PushColor(ConsoleColor.Green);
|
||||
Console.WriteLine("Finished with: {0} errors, {1} warnings", errors.Count, warnings.Count);
|
||||
Utility.PopColor();
|
||||
}
|
||||
|
||||
var scriptRoot = Path.GetFullPath(Path.Combine(Core.BaseDirectory, "Scripts" + Path.DirectorySeparatorChar));
|
||||
var scriptRootUri = new Uri(scriptRoot);
|
||||
|
||||
Utility.PushColor(ConsoleColor.Yellow);
|
||||
|
||||
if (warnings.Count > 0)
|
||||
{
|
||||
Console.WriteLine("Warnings:");
|
||||
}
|
||||
|
||||
foreach (var kvp in warnings)
|
||||
{
|
||||
var fileName = kvp.Key;
|
||||
var list = kvp.Value;
|
||||
|
||||
var fullPath = Path.GetFullPath(fileName);
|
||||
var usedPath = Uri.UnescapeDataString(scriptRootUri.MakeRelativeUri(new Uri(fullPath)).OriginalString);
|
||||
|
||||
Console.WriteLine(" + {0}:", usedPath);
|
||||
|
||||
Utility.PushColor(ConsoleColor.DarkYellow);
|
||||
|
||||
foreach (var e in list)
|
||||
{
|
||||
Console.WriteLine(" {0}: Line {1}: {2}", e.ErrorNumber, e.Line, e.ErrorText);
|
||||
}
|
||||
|
||||
Utility.PopColor();
|
||||
}
|
||||
|
||||
Utility.PopColor();
|
||||
|
||||
Utility.PushColor(ConsoleColor.Red);
|
||||
|
||||
if (errors.Count > 0)
|
||||
{
|
||||
Console.WriteLine("Errors:");
|
||||
}
|
||||
|
||||
foreach (var kvp in errors)
|
||||
{
|
||||
var fileName = kvp.Key;
|
||||
var list = kvp.Value;
|
||||
|
||||
var fullPath = Path.GetFullPath(fileName);
|
||||
var usedPath = Uri.UnescapeDataString(scriptRootUri.MakeRelativeUri(new Uri(fullPath)).OriginalString);
|
||||
|
||||
Console.WriteLine(" + {0}:", usedPath);
|
||||
|
||||
Utility.PushColor(ConsoleColor.Red);
|
||||
|
||||
foreach (var e in list)
|
||||
{
|
||||
Console.WriteLine(" {0}: Line {1}: {2}", e.ErrorNumber, e.Line, e.ErrorText);
|
||||
}
|
||||
|
||||
Utility.PopColor();
|
||||
}
|
||||
|
||||
Utility.PopColor();
|
||||
}
|
||||
else
|
||||
{
|
||||
Utility.PushColor(ConsoleColor.Green);
|
||||
Console.WriteLine("Finished with: 0 errors, 0 warnings");
|
||||
Utility.PopColor();
|
||||
}
|
||||
}
|
||||
|
||||
public static string GetUnusedPath(string name)
|
||||
{
|
||||
var path = Path.Combine(Core.BaseDirectory, String.Format("Scripts/Output/{0}.dll", name));
|
||||
|
||||
for (var i = 2; File.Exists(path) && i <= 1000; ++i)
|
||||
{
|
||||
path = Path.Combine(Core.BaseDirectory, String.Format("Scripts/Output/{0}.{1}.dll", name, i));
|
||||
}
|
||||
|
||||
return path;
|
||||
}
|
||||
|
||||
public static void DeleteFiles(string mask)
|
||||
{
|
||||
try
|
||||
{
|
||||
var files = Directory.GetFiles(Path.Combine(Core.BaseDirectory, "Scripts/Output"), mask);
|
||||
|
||||
foreach (var file in files)
|
||||
{
|
||||
try
|
||||
{
|
||||
File.Delete(file);
|
||||
}
|
||||
catch
|
||||
{ }
|
||||
}
|
||||
}
|
||||
catch
|
||||
{ }
|
||||
}
|
||||
|
||||
private delegate CompilerResults Compiler(bool debug);
|
||||
|
||||
public static bool Compile()
|
||||
{
|
||||
return Compile(false);
|
||||
}
|
||||
|
||||
public static bool Compile(bool debug)
|
||||
{
|
||||
return Compile(debug, true);
|
||||
}
|
||||
|
||||
public static bool Compile(bool debug, bool cache)
|
||||
{
|
||||
EnsureDirectory("Scripts/");
|
||||
EnsureDirectory("Scripts/Output/");
|
||||
|
||||
if (m_AdditionalReferences.Count > 0)
|
||||
{
|
||||
m_AdditionalReferences.Clear();
|
||||
}
|
||||
|
||||
var assemblies = new List<Assembly>();
|
||||
|
||||
Assembly assembly;
|
||||
|
||||
if (CompileCSScripts(debug, cache, out assembly))
|
||||
{
|
||||
if (assembly != null)
|
||||
{
|
||||
assemblies.Add(assembly);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if (assemblies.Count == 0)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
_ = assemblies.Add(Assembly.LoadFrom("Scripts.dll"));
|
||||
|
||||
Assemblies = assemblies.ToArray();
|
||||
|
||||
Utility.PushColor(ConsoleColor.Yellow);
|
||||
Console.WriteLine("Scripts: Verifying...");
|
||||
Utility.PopColor();
|
||||
Console.WriteLine("Core: Verifying entity type serialization...");
|
||||
|
||||
var watch = Stopwatch.StartNew();
|
||||
|
||||
@@ -487,17 +72,17 @@ namespace Server
|
||||
|
||||
watch.Stop();
|
||||
|
||||
Utility.PushColor(ConsoleColor.Green);
|
||||
Console.WriteLine(
|
||||
"Finished ({0} items, {1} mobiles, {2} customs) ({3:F2} seconds)",
|
||||
Core.ScriptItems,
|
||||
Core.ScriptMobiles,
|
||||
Core.ScriptCustoms,
|
||||
watch.Elapsed.TotalSeconds);
|
||||
Utility.PopColor();
|
||||
Console.WriteLine($"Core: Verified {Core.ScriptItems} item and {Core.ScriptMobiles} mobile types");
|
||||
|
||||
return true;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Console.WriteLine(ex);
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public static void Invoke(string method)
|
||||
{
|
||||
@@ -522,7 +107,7 @@ namespace Server
|
||||
|
||||
foreach (var m in invoke)
|
||||
{
|
||||
m.Invoke(null, null);
|
||||
_ = m.Invoke(null, null);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -536,9 +121,7 @@ namespace Server
|
||||
return m_NullCache ?? (m_NullCache = new TypeCache(null));
|
||||
}
|
||||
|
||||
TypeCache c;
|
||||
|
||||
m_TypeCaches.TryGetValue(asm, out c);
|
||||
_ = m_TypeCaches.TryGetValue(asm, out var c);
|
||||
|
||||
if (c == null)
|
||||
{
|
||||
@@ -548,6 +131,40 @@ namespace Server
|
||||
return c;
|
||||
}
|
||||
|
||||
public static int FindHashByName(string name)
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(name))
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
var hash = 0;
|
||||
|
||||
for (var i = 0; hash == 0 && i < Assemblies.Length; ++i)
|
||||
{
|
||||
hash = GetTypeCache(Assemblies[i]).GetTypeHashByName(name);
|
||||
}
|
||||
|
||||
return hash != 0 ? hash : GetTypeCache(Core.Assembly).GetTypeHashByName(name);
|
||||
}
|
||||
|
||||
public static int FindHashByFullName(string fullName)
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(fullName))
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
var hash = 0;
|
||||
|
||||
for (var i = 0; hash == 0 && i < Assemblies.Length; ++i)
|
||||
{
|
||||
hash = GetTypeCache(Assemblies[i]).GetTypeHashByFullName(fullName);
|
||||
}
|
||||
|
||||
return hash != 0 ? hash : GetTypeCache(Core.Assembly).GetTypeHashByFullName(fullName);
|
||||
}
|
||||
|
||||
public static Type FindTypeByFullName(string fullName)
|
||||
{
|
||||
return FindTypeByFullName(fullName, true);
|
||||
@@ -644,45 +261,90 @@ namespace Server
|
||||
}
|
||||
}
|
||||
|
||||
public static void EnsureDirectory(string dir)
|
||||
public static Type FindTypeByNameHash(int hash)
|
||||
{
|
||||
var path = Path.Combine(Core.BaseDirectory, dir);
|
||||
Type type = null;
|
||||
|
||||
if (!Directory.Exists(path))
|
||||
for (var i = 0; type == null && i < Assemblies.Length; ++i)
|
||||
{
|
||||
Directory.CreateDirectory(path);
|
||||
type = GetTypeCache(Assemblies[i]).GetTypeByNameHash(hash);
|
||||
}
|
||||
|
||||
return type ?? GetTypeCache(Core.Assembly).GetTypeByNameHash(hash);
|
||||
}
|
||||
|
||||
public static IEnumerable<Type> FindTypesByNameHash(int hash)
|
||||
{
|
||||
for (var i = 0; i < Assemblies.Length; ++i)
|
||||
{
|
||||
foreach (var t in GetTypeCache(Assemblies[i]).GetTypesByNameHash(hash))
|
||||
{
|
||||
yield return t;
|
||||
}
|
||||
}
|
||||
|
||||
public static string[] GetScripts(string filter)
|
||||
foreach (var t in GetTypeCache(Core.Assembly).GetTypesByNameHash(hash))
|
||||
{
|
||||
var list = new List<string>();
|
||||
|
||||
GetScripts(list, Path.Combine(Core.BaseDirectory, "Scripts"), filter);
|
||||
|
||||
return list.ToArray();
|
||||
yield return t;
|
||||
}
|
||||
}
|
||||
|
||||
public static void GetScripts(List<string> list, string path, string filter)
|
||||
public static Type FindTypeByFullNameHash(int hash)
|
||||
{
|
||||
foreach (var dir in Directory.GetDirectories(path))
|
||||
Type type = null;
|
||||
|
||||
for (var i = 0; type == null && i < Assemblies.Length; ++i)
|
||||
{
|
||||
GetScripts(list, dir, filter);
|
||||
type = GetTypeCache(Assemblies[i]).GetTypeByFullNameHash(hash);
|
||||
}
|
||||
|
||||
list.AddRange(Directory.GetFiles(path, filter));
|
||||
return type ?? GetTypeCache(Core.Assembly).GetTypeByFullNameHash(hash);
|
||||
}
|
||||
|
||||
public static IEnumerable<Type> FindTypesByFullNameHash(int hash)
|
||||
{
|
||||
for (var i = 0; i < Assemblies.Length; ++i)
|
||||
{
|
||||
foreach (var t in GetTypeCache(Assemblies[i]).GetTypesByFullNameHash(hash))
|
||||
{
|
||||
yield return t;
|
||||
}
|
||||
}
|
||||
|
||||
foreach (var t in GetTypeCache(Core.Assembly).GetTypesByFullNameHash(hash))
|
||||
{
|
||||
yield return t;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public class TypeCache
|
||||
{
|
||||
private readonly Type[] m_Types;
|
||||
private readonly TypeTable m_Names;
|
||||
private readonly TypeTable m_FullNames;
|
||||
|
||||
public Type[] Types { get { return m_Types; } }
|
||||
public TypeTable Names { get { return m_Names; } }
|
||||
public TypeTable FullNames { get { return m_FullNames; } }
|
||||
public Type[] Types { get; }
|
||||
public TypeTable Names { get; }
|
||||
public TypeTable FullNames => m_FullNames;
|
||||
|
||||
public Type GetTypeByNameHash(int hash)
|
||||
{
|
||||
return GetTypesByNameHash(hash).FirstOrDefault(t => t != null);
|
||||
}
|
||||
|
||||
public IEnumerable<Type> GetTypesByNameHash(int hash)
|
||||
{
|
||||
return Names.Get(hash);
|
||||
}
|
||||
|
||||
public Type GetTypeByFullNameHash(int hash)
|
||||
{
|
||||
return GetTypesByFullNameHash(hash).FirstOrDefault(t => t != null);
|
||||
}
|
||||
|
||||
public IEnumerable<Type> GetTypesByFullNameHash(int hash)
|
||||
{
|
||||
return m_FullNames.Get(hash);
|
||||
}
|
||||
|
||||
public Type GetTypeByName(string name, bool ignoreCase)
|
||||
{
|
||||
@@ -691,7 +353,7 @@ namespace Server
|
||||
|
||||
public IEnumerable<Type> GetTypesByName(string name, bool ignoreCase)
|
||||
{
|
||||
return m_Names.Get(name, ignoreCase);
|
||||
return Names.Get(name, ignoreCase);
|
||||
}
|
||||
|
||||
public Type GetTypeByFullName(string fullName, bool ignoreCase)
|
||||
@@ -704,23 +366,33 @@ namespace Server
|
||||
return m_FullNames.Get(fullName, ignoreCase);
|
||||
}
|
||||
|
||||
public int GetTypeHashByName(string name)
|
||||
{
|
||||
return Names.GetHash(name);
|
||||
}
|
||||
|
||||
public int GetTypeHashByFullName(string fullName)
|
||||
{
|
||||
return m_FullNames.GetHash(fullName);
|
||||
}
|
||||
|
||||
public TypeCache(Assembly asm)
|
||||
{
|
||||
if (asm == null)
|
||||
{
|
||||
m_Types = Type.EmptyTypes;
|
||||
Types = Type.EmptyTypes;
|
||||
}
|
||||
else
|
||||
{
|
||||
m_Types = asm.GetTypes();
|
||||
Types = asm.GetTypes();
|
||||
}
|
||||
|
||||
m_Names = new TypeTable(m_Types.Length);
|
||||
m_FullNames = new TypeTable(m_Types.Length);
|
||||
Names = new TypeTable(Types.Length);
|
||||
m_FullNames = new TypeTable(Types.Length);
|
||||
|
||||
foreach (var g in m_Types.ToLookup(t => t.Name))
|
||||
foreach (var g in Types.ToLookup(t => t.Name))
|
||||
{
|
||||
m_Names.Add(g.Key, g);
|
||||
Names.Add(g.Key, g);
|
||||
|
||||
foreach (var type in g)
|
||||
{
|
||||
@@ -738,59 +410,41 @@ namespace Server
|
||||
}
|
||||
}
|
||||
|
||||
m_Names.Prune();
|
||||
m_FullNames.Prune();
|
||||
|
||||
m_Names.Sort();
|
||||
Names.Sort();
|
||||
m_FullNames.Sort();
|
||||
}
|
||||
}
|
||||
|
||||
public class TypeTable
|
||||
{
|
||||
private readonly Dictionary<string, List<Type>> m_Sensitive;
|
||||
private readonly Dictionary<string, List<Type>> m_Insensitive;
|
||||
|
||||
public void Prune()
|
||||
{
|
||||
Prune(m_Sensitive);
|
||||
Prune(m_Insensitive);
|
||||
}
|
||||
|
||||
private static void Prune(Dictionary<string, List<Type>> types)
|
||||
{
|
||||
var buffer = new List<Type>();
|
||||
|
||||
foreach (var list in types.Values)
|
||||
{
|
||||
if (list.Count == 1)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
buffer.AddRange(list.Distinct());
|
||||
|
||||
list.Clear();
|
||||
list.AddRange(buffer);
|
||||
|
||||
buffer.Clear();
|
||||
}
|
||||
|
||||
buffer.TrimExcess();
|
||||
}
|
||||
private readonly Dictionary<string, int> m_Hashes;
|
||||
private readonly Dictionary<int, HashSet<Type>> m_Hashed;
|
||||
private readonly Dictionary<string, HashSet<Type>> m_Sensitive;
|
||||
private readonly Dictionary<string, HashSet<Type>> m_Insensitive;
|
||||
|
||||
public void Sort()
|
||||
{
|
||||
Sort(m_Hashed);
|
||||
Sort(m_Sensitive);
|
||||
Sort(m_Insensitive);
|
||||
}
|
||||
|
||||
private static void Sort(Dictionary<string, List<Type>> types)
|
||||
private static void Sort<T>(Dictionary<T, HashSet<Type>> types)
|
||||
{
|
||||
var sorter = new List<Type>();
|
||||
|
||||
foreach (var list in types.Values)
|
||||
{
|
||||
list.Sort(InternalSort);
|
||||
sorter.AddRange(list);
|
||||
sorter.Sort(InternalSort);
|
||||
|
||||
list.Clear();
|
||||
list.UnionWith(sorter);
|
||||
|
||||
sorter.Clear();
|
||||
}
|
||||
|
||||
sorter.TrimExcess();
|
||||
}
|
||||
|
||||
private static int InternalSort(Type l, Type r)
|
||||
@@ -873,28 +527,43 @@ namespace Server
|
||||
|
||||
if (!m_Sensitive.TryGetValue(key, out var sensitive) || sensitive == null)
|
||||
{
|
||||
m_Sensitive[key] = new List<Type>(types);
|
||||
m_Sensitive[key] = new HashSet<Type>(types);
|
||||
}
|
||||
else if (types.Length == 1)
|
||||
{
|
||||
sensitive.Add(types[0]);
|
||||
_ = sensitive.Add(types[0]);
|
||||
}
|
||||
else
|
||||
{
|
||||
sensitive.AddRange(types);
|
||||
sensitive.UnionWith(types);
|
||||
}
|
||||
|
||||
if (!m_Insensitive.TryGetValue(key, out var insensitive) || insensitive == null)
|
||||
{
|
||||
m_Insensitive[key] = new List<Type>(types);
|
||||
m_Insensitive[key] = new HashSet<Type>(types);
|
||||
}
|
||||
else if (types.Length == 1)
|
||||
{
|
||||
insensitive.Add(types[0]);
|
||||
_ = insensitive.Add(types[0]);
|
||||
}
|
||||
else
|
||||
{
|
||||
insensitive.AddRange(types);
|
||||
insensitive.UnionWith(types);
|
||||
}
|
||||
|
||||
var hash = GenerateHash(key);
|
||||
|
||||
if (!m_Hashed.TryGetValue(hash, out var hashed) || hashed == null)
|
||||
{
|
||||
m_Hashed[hash] = new HashSet<Type>(types);
|
||||
}
|
||||
else if (types.Length == 1)
|
||||
{
|
||||
_ = hashed.Add(types[0]);
|
||||
}
|
||||
else
|
||||
{
|
||||
hashed.UnionWith(types);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -905,15 +574,15 @@ namespace Server
|
||||
return Type.EmptyTypes;
|
||||
}
|
||||
|
||||
List<Type> t;
|
||||
HashSet<Type> t;
|
||||
|
||||
if (ignoreCase)
|
||||
{
|
||||
m_Insensitive.TryGetValue(key, out t);
|
||||
_ = m_Insensitive.TryGetValue(key, out t);
|
||||
}
|
||||
else
|
||||
{
|
||||
m_Sensitive.TryGetValue(key, out t);
|
||||
_ = m_Sensitive.TryGetValue(key, out t);
|
||||
}
|
||||
|
||||
if (t == null)
|
||||
@@ -924,10 +593,65 @@ namespace Server
|
||||
return t.AsEnumerable();
|
||||
}
|
||||
|
||||
public IEnumerable<Type> Get(int hash)
|
||||
{
|
||||
_ = m_Hashed.TryGetValue(hash, out var t);
|
||||
|
||||
if (t == null)
|
||||
{
|
||||
return Type.EmptyTypes;
|
||||
}
|
||||
|
||||
return t.AsEnumerable();
|
||||
}
|
||||
|
||||
public int GetHash(string key)
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(key))
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
_ = m_Hashes.TryGetValue(key, out var hash);
|
||||
|
||||
return hash;
|
||||
}
|
||||
|
||||
private int GenerateHash(string key)
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(key))
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
var hash = GetHash(key);
|
||||
|
||||
if (hash != 0)
|
||||
{
|
||||
return hash;
|
||||
}
|
||||
|
||||
hash = key.Length;
|
||||
|
||||
unchecked
|
||||
{
|
||||
for (var i = 0; i < key.Length; i++)
|
||||
{
|
||||
hash = (hash * 397) ^ Convert.ToInt32(key[i]);
|
||||
}
|
||||
}
|
||||
|
||||
m_Hashes[key] = hash;
|
||||
|
||||
return hash;
|
||||
}
|
||||
|
||||
public TypeTable(int capacity)
|
||||
{
|
||||
m_Sensitive = new Dictionary<string, List<Type>>(capacity);
|
||||
m_Insensitive = new Dictionary<string, List<Type>>(capacity, StringComparer.OrdinalIgnoreCase);
|
||||
m_Hashes = new Dictionary<string, int>();
|
||||
m_Hashed = new Dictionary<int, HashSet<Type>>(capacity);
|
||||
m_Sensitive = new Dictionary<string, HashSet<Type>>(capacity);
|
||||
m_Insensitive = new Dictionary<string, HashSet<Type>>(capacity, StringComparer.OrdinalIgnoreCase);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+13
-206
@@ -1,221 +1,28 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="12.0">
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
<PropertyGroup>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||
<ProjectGuid>{AE4A9EAA-E0EB-4DC9-9604-BE4289F9F6C3}</ProjectGuid>
|
||||
<TargetFramework>net48</TargetFramework>
|
||||
<OutputType>Exe</OutputType>
|
||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||
<RootNamespace>Server</RootNamespace>
|
||||
<AssemblyName>ServUO</AssemblyName>
|
||||
<ApplicationIcon>servuo.ico</ApplicationIcon>
|
||||
<StartupObject>Server.Core</StartupObject>
|
||||
<TargetFrameworkVersion>v4.8</TargetFrameworkVersion>
|
||||
<RuntimeIdentifiers>win7-x64;win7-x86;ubuntu.16.10-x64</RuntimeIdentifiers>
|
||||
<ApplicationManifest>ServUO.exe.manifest</ApplicationManifest>
|
||||
<AppendTargetFrameworkToOutputPath>False</AppendTargetFrameworkToOutputPath>
|
||||
<GenerateAssemblyInfo>False</GenerateAssemblyInfo>
|
||||
<UseVSHostingProcess>False</UseVSHostingProcess>
|
||||
<AllowUnsafeBlocks>True</AllowUnsafeBlocks>
|
||||
<Platforms>x64</Platforms>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>false</Optimize>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<OutputPath>..\</OutputPath>
|
||||
<DefineConstants>TRACE;DEBUG;NEWTIMERS;ServUO</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
|
||||
<UseVSHostingProcess>false</UseVSHostingProcess>
|
||||
<TreatWarningsAsErrors>false</TreatWarningsAsErrors>
|
||||
<Prefer32Bit>false</Prefer32Bit>
|
||||
<DebugType>embedded</DebugType>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<Optimize>true</Optimize>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<OutputPath>..\</OutputPath>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
|
||||
<TreatWarningsAsErrors>false</TreatWarningsAsErrors>
|
||||
<Prefer32Bit>false</Prefer32Bit>
|
||||
<DefineConstants>TRACE;NEWTIMERS;ServUO</DefineConstants>
|
||||
<UseVSHostingProcess>false</UseVSHostingProcess>
|
||||
<PlatformTarget>AnyCPU</PlatformTarget>
|
||||
<DebugType>none</DebugType>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup>
|
||||
<ApplicationManifest>ServUO.exe.manifest</ApplicationManifest>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
|
||||
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
||||
Other similar extension points exist, see Microsoft.Common.targets.
|
||||
<Target Name="BeforeBuild">
|
||||
</Target>
|
||||
<Target Name="AfterBuild">
|
||||
</Target>
|
||||
-->
|
||||
<ItemGroup>
|
||||
<Compile Include=".\AggressorInfo.cs" />
|
||||
<Compile Include=".\AssemblyInfo.cs" />
|
||||
<Compile Include=".\Attributes.cs" />
|
||||
<Compile Include=".\BaseVendor.cs" />
|
||||
<Compile Include=".\Body.cs" />
|
||||
<Compile Include=".\ClientVersion.cs" />
|
||||
<Compile Include=".\Commands.cs" />
|
||||
<Compile Include=".\ContextMenus\ContextMenu.cs" />
|
||||
<Compile Include=".\ContextMenus\ContextMenuEntry.cs" />
|
||||
<Compile Include=".\ContextMenus\OpenBackpackEntry.cs" />
|
||||
<Compile Include=".\ContextMenus\PaperdollEntry.cs" />
|
||||
<Compile Include=".\Customs Framework\Central Core\Base Types\BaseCore.cs" />
|
||||
<Compile Include=".\Customs Framework\Central Core\Base Types\BaseModule.cs" />
|
||||
<Compile Include=".\Customs Framework\Central Core\Base Types\BaseService.cs" />
|
||||
<Compile Include=".\Customs Framework\Central Core\Base Types\Events.cs" />
|
||||
<Compile Include=".\Customs Framework\Central Core\Base Types\SaveData.cs" />
|
||||
<Compile Include=".\Customs Framework\Central Core\CustomSerial.cs" />
|
||||
<Compile Include=".\Customs Framework\Central Core\Interfaces.cs" />
|
||||
<Compile Include=".\Customs Framework\Custom Types\LastEditedBy.cs" />
|
||||
<Compile Include=".\Customs Framework\Custom Types\Place.cs" />
|
||||
<Compile Include=".\Customs Framework\Utilities\Decompressor.cs" />
|
||||
<Compile Include=".\Customs Framework\Utilities\ObjectDumper.cs" />
|
||||
<Compile Include=".\Customs Framework\Utilities\OutgoingPacketOverride.cs" />
|
||||
<Compile Include=".\Customs Framework\Utilities\Utilities.cs" />
|
||||
<Compile Include=".\Diagnostics\BaseProfile.cs" />
|
||||
<Compile Include=".\Diagnostics\GumpProfile.cs" />
|
||||
<Compile Include=".\Diagnostics\PacketProfile.cs" />
|
||||
<Compile Include=".\Diagnostics\TargetProfile.cs" />
|
||||
<Compile Include=".\Diagnostics\TimerProfile.cs" />
|
||||
<Compile Include=".\Effects.cs" />
|
||||
<Compile Include=".\EventLog.cs" />
|
||||
<Compile Include=".\EventSink.cs" />
|
||||
<Compile Include=".\ExpansionInfo.cs" />
|
||||
<Compile Include=".\Geometry.cs" />
|
||||
<Compile Include=".\Guild.cs" />
|
||||
<Compile Include=".\HuePicker.cs" />
|
||||
<Compile Include=".\IAccount.cs" />
|
||||
<Compile Include=".\IEntity.cs" />
|
||||
<Compile Include=".\Insensitive.cs" />
|
||||
<Compile Include=".\Interfaces.cs" />
|
||||
<Compile Include=".\Item.cs" />
|
||||
<Compile Include=".\ItemBounds.cs" />
|
||||
<Compile Include=".\Items\BaseMulti.cs" />
|
||||
<Compile Include=".\Items\Container.cs" />
|
||||
<Compile Include=".\Items\Containers.cs" />
|
||||
<Compile Include=".\Items\SecureTradeContainer.cs" />
|
||||
<Compile Include=".\Items\VirtualHair.cs" />
|
||||
<Compile Include=".\KeywordList.cs" />
|
||||
<Compile Include=".\Main.cs" />
|
||||
<Compile Include=".\Map.cs" />
|
||||
<Compile Include=".\Menus\IMenu.cs" />
|
||||
<Compile Include=".\Menus\ItemListMenu.cs" />
|
||||
<Compile Include=".\Menus\QuestionMenu.cs" />
|
||||
<Compile Include=".\Mobile.cs" />
|
||||
<Compile Include=".\Movement.cs" />
|
||||
<Compile Include=".\MultiData.cs" />
|
||||
<Compile Include=".\NativeReader.cs" />
|
||||
<Compile Include=".\Network\BufferPool.cs" />
|
||||
<Compile Include=".\Network\ByteQueue.cs" />
|
||||
<Compile Include=".\Network\Compression.cs" />
|
||||
<Compile Include=".\Network\EncodedPacketHandler.cs" />
|
||||
<Compile Include=".\Network\EncodedReader.cs" />
|
||||
<Compile Include=".\Network\Listener.cs" />
|
||||
<Compile Include=".\Network\MessagePump.cs" />
|
||||
<Compile Include=".\Network\NetState.cs" />
|
||||
<Compile Include=".\Network\PacketHandler.cs" />
|
||||
<Compile Include=".\Network\PacketHandlers.cs" />
|
||||
<Compile Include=".\Network\PacketReader.cs" />
|
||||
<Compile Include=".\Network\Packets.cs" />
|
||||
<Compile Include=".\Network\PacketWriter.cs" />
|
||||
<Compile Include=".\Network\SendQueue.cs" />
|
||||
<Compile Include=".\Notoriety.cs" />
|
||||
<Compile Include=".\ObjectPropertyList.cs" />
|
||||
<Compile Include=".\Party.cs" />
|
||||
<Compile Include=".\Persistence\BinaryMemoryWriter.cs" />
|
||||
<Compile Include=".\Persistence\DualSaveStrategy.cs" />
|
||||
<Compile Include=".\Persistence\DynamicSaveStrategy.cs" />
|
||||
<Compile Include=".\Persistence\FileOperations.cs" />
|
||||
<Compile Include=".\Persistence\FileQueue.cs" />
|
||||
<Compile Include=".\Persistence\ParallelSaveStrategy.cs" />
|
||||
<Compile Include=".\Persistence\QueuedMemoryWriter.cs" />
|
||||
<Compile Include=".\Persistence\SaveMetrics.cs" />
|
||||
<Compile Include=".\Persistence\SaveStrategy.cs" />
|
||||
<Compile Include=".\Persistence\SequentialFileWriter.cs" />
|
||||
<Compile Include=".\Persistence\StandardSaveStrategy.cs" />
|
||||
<Compile Include=".\Point3DList.cs" />
|
||||
<Compile Include=".\Poison.cs" />
|
||||
<Compile Include=".\Prompt.cs" />
|
||||
<Compile Include=".\QuestArrow.cs" />
|
||||
<Compile Include=".\Race.cs" />
|
||||
<Compile Include=".\Region.cs" />
|
||||
<Compile Include=".\ScriptCompiler.cs" />
|
||||
<Compile Include=".\Sector.cs" />
|
||||
<Compile Include=".\SecureTrade.cs" />
|
||||
<Compile Include=".\Serial.cs" />
|
||||
<Compile Include=".\Serialization.cs" />
|
||||
<Compile Include=".\Skills.cs" />
|
||||
<Compile Include=".\Targeting\LandTarget.cs" />
|
||||
<Compile Include=".\Targeting\MultiTarget.cs" />
|
||||
<Compile Include=".\Targeting\StaticTarget.cs" />
|
||||
<Compile Include=".\Targeting\Target.cs" />
|
||||
<Compile Include=".\Targeting\TargetCancelType.cs" />
|
||||
<Compile Include=".\Targeting\TargetFlags.cs" />
|
||||
<Compile Include=".\TileData.cs" />
|
||||
<Compile Include=".\TileList.cs" />
|
||||
<Compile Include=".\TileMatrix.cs" />
|
||||
<Compile Include=".\TileMatrixPatch.cs" />
|
||||
<Compile Include=".\Timer.cs" />
|
||||
<Compile Include=".\Utility.cs" />
|
||||
<Compile Include=".\VirtueInfo.cs" />
|
||||
<Compile Include=".\World.cs" />
|
||||
<Compile Include="Config.cs" />
|
||||
<Compile Include="Gumps\ECHandleInput.cs" />
|
||||
<Compile Include="Gumps\Gump.cs" />
|
||||
<Compile Include="Gumps\GumpAlphaRegion.cs" />
|
||||
<Compile Include="Gumps\GumpBackground.cs" />
|
||||
<Compile Include="Gumps\GumpButton.cs" />
|
||||
<Compile Include="Gumps\GumpCheck.cs" />
|
||||
<Compile Include="Gumps\GumpEntry.cs" />
|
||||
<Compile Include="Gumps\GumpGroup.cs" />
|
||||
<Compile Include="Gumps\GumpHtml.cs" />
|
||||
<Compile Include="Gumps\GumpHtmlLocalized.cs" />
|
||||
<Compile Include="Gumps\GumpImage.cs" />
|
||||
<Compile Include="Gumps\GumpImageTileButton.cs" />
|
||||
<Compile Include="Gumps\GumpImageTiled.cs" />
|
||||
<Compile Include="Gumps\GumpItem.cs" />
|
||||
<Compile Include="Gumps\GumpItemProperty.cs" />
|
||||
<Compile Include="Gumps\GumpLabel.cs" />
|
||||
<Compile Include="Gumps\GumpLabelCropped.cs" />
|
||||
<Compile Include="Gumps\GumpPage.cs" />
|
||||
<Compile Include="Gumps\GumpRadio.cs" />
|
||||
<Compile Include="Gumps\GumpSpriteImage.cs" />
|
||||
<Compile Include="Gumps\GumpTextEntry.cs" />
|
||||
<Compile Include="Gumps\GumpTextEntryLimited.cs" />
|
||||
<Compile Include="Gumps\GumpTooltip.cs" />
|
||||
<Compile Include="Gumps\RelayInfo.cs" />
|
||||
<Compile Include="Network\PacketThrottles.cs" />
|
||||
<Compile Include="Network\PingListener.cs" />
|
||||
<Compile Include="Persistence\Persistence.cs" />
|
||||
<Compile Include="PromptExtensions.cs" />
|
||||
<Compile Include="Random.cs" />
|
||||
<Compile Include="Items\VirtualCheck.cs" />
|
||||
<Compile Include="SpawnArea.cs" />
|
||||
<ProjectReference Include="..\Ultima\Ultima.csproj" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Content Include="servuo.ico" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="Microsoft.CodeDom.Providers.DotNetCompilerPlatform, Version=2.0.1.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>..\Microsoft.CodeDom.Providers.DotNetCompilerPlatform.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Drawing" />
|
||||
<Reference Include="System.Xml" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\Ultima\Ultima.csproj">
|
||||
<Project>{e08cfbe4-e013-44ee-8829-426d05bc083f}</Project>
|
||||
<Name>Ultima</Name>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="app.config" />
|
||||
<None Include="ServUO.exe.manifest" />
|
||||
</ItemGroup>
|
||||
<Import Project="..\VersionSpecificSymbols.Common.prop" />
|
||||
</Project>
|
||||
+1
-1
@@ -319,7 +319,7 @@ namespace Server
|
||||
}
|
||||
|
||||
[CommandProperty(AccessLevel.Counselor, AccessLevel.GameMaster)]
|
||||
public double Base { get { return (m_Base / 10.0); } set { BaseFixedPoint = (int)(value * 10.0); } }
|
||||
public double Base { get => m_Base / 10.0; set => BaseFixedPoint = (int)Math.Round(value * 10.0); }
|
||||
|
||||
public int CapFixedPoint
|
||||
{
|
||||
|
||||
+1
-43
@@ -4,12 +4,6 @@ using System.Resources;
|
||||
using System.Runtime.InteropServices;
|
||||
#endregion
|
||||
|
||||
//
|
||||
// General Information about an assembly is controlled through the following
|
||||
// set of attributes. Change these attribute values to modify the information
|
||||
// associated with an assembly.
|
||||
//
|
||||
|
||||
[assembly: AssemblyTitle("UltimaSDK")]
|
||||
[assembly: AssemblyDescription("The Ultima SDK is a Software Development Kit")]
|
||||
[assembly: AssemblyConfiguration("")]
|
||||
@@ -18,43 +12,7 @@ using System.Runtime.InteropServices;
|
||||
[assembly: AssemblyCopyright("")]
|
||||
[assembly: AssemblyTrademark("")]
|
||||
[assembly: AssemblyCulture("")]
|
||||
//
|
||||
// Version information for an assembly consists of the following four values:
|
||||
//
|
||||
// Major Version
|
||||
// Minor Version
|
||||
// Build Number
|
||||
// Revision
|
||||
//
|
||||
// You can specify all the values or you can default the Revision and Build Numbers
|
||||
// by using the '*' as shown below:
|
||||
|
||||
[assembly: AssemblyVersion("2.0.*")]
|
||||
//
|
||||
// In order to sign your assembly you must specify a key to use. Refer to the
|
||||
// Microsoft .NET Framework documentation for more information on assembly signing.
|
||||
//
|
||||
// Use the attributes below to control which key is used for signing.
|
||||
//
|
||||
// Notes:
|
||||
// (*) If no key is specified, the assembly is not signed.
|
||||
// (*) KeyName refers to a key that has been installed in the Crypto Service
|
||||
// Provider (CSP) on your machine. KeyFile refers to a file which contains
|
||||
// a key.
|
||||
// (*) If the KeyFile and the KeyName values are both specified, the
|
||||
// following processing occurs:
|
||||
// (1) If the KeyName can be found in the CSP, that key is used.
|
||||
// (2) If the KeyName does not exist and the KeyFile does exist, the key
|
||||
// in the KeyFile is installed into the CSP and used.
|
||||
// (*) In order to create a KeyFile, you can use the sn.exe (Strong Name) utility.
|
||||
// When specifying the KeyFile, the location of the KeyFile should be
|
||||
// relative to the project output directory which is
|
||||
// %Project Directory%\obj\<configuration>. For example, if your KeyFile is
|
||||
// located in the project directory, you would specify the AssemblyKeyFile
|
||||
// attribute as [assembly: AssemblyKeyFile("..\\..\\mykey.snk")]
|
||||
// (*) Delay Signing is an advanced option - see the Microsoft .NET Framework
|
||||
// documentation for more information on this.
|
||||
//
|
||||
[assembly: AssemblyVersion("2.0")]
|
||||
[assembly: AssemblyDelaySign(false)]
|
||||
[assembly: AssemblyKeyFile("")]
|
||||
[assembly: AssemblyKeyName("")]
|
||||
|
||||
+10
-220
@@ -1,231 +1,21 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="4.0">
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
<PropertyGroup>
|
||||
<ProjectType>Local</ProjectType>
|
||||
<ProductVersion>9.0.30729</ProductVersion>
|
||||
<SchemaVersion>2.0</SchemaVersion>
|
||||
<ProjectGuid>{E08CFBE4-E013-44EE-8829-426D05BC083F}</ProjectGuid>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||
<ApplicationIcon>
|
||||
</ApplicationIcon>
|
||||
<AssemblyKeyContainerName>
|
||||
</AssemblyKeyContainerName>
|
||||
<AssemblyName>Ultima</AssemblyName>
|
||||
<AssemblyOriginatorKeyFile>
|
||||
</AssemblyOriginatorKeyFile>
|
||||
<DefaultClientScript>JScript</DefaultClientScript>
|
||||
<DefaultHTMLPageLayout>Grid</DefaultHTMLPageLayout>
|
||||
<DefaultTargetSchema>IE50</DefaultTargetSchema>
|
||||
<DelaySign>false</DelaySign>
|
||||
<TargetFramework>net48</TargetFramework>
|
||||
<OutputType>Library</OutputType>
|
||||
<RootNamespace>Ultima</RootNamespace>
|
||||
<RunPostBuildEvent>OnBuildSuccess</RunPostBuildEvent>
|
||||
<StartupObject>
|
||||
</StartupObject>
|
||||
<FileUpgradeFlags>
|
||||
</FileUpgradeFlags>
|
||||
<UpgradeBackupLocation>
|
||||
</UpgradeBackupLocation>
|
||||
<OldToolsVersion>3.5</OldToolsVersion>
|
||||
<TargetFrameworkVersion>v4.8</TargetFrameworkVersion>
|
||||
<RuntimeIdentifiers>win7-x64;win7-x86;ubuntu.16.10-x64</RuntimeIdentifiers>
|
||||
<AppendTargetFrameworkToOutputPath>False</AppendTargetFrameworkToOutputPath>
|
||||
<GenerateAssemblyInfo>False</GenerateAssemblyInfo>
|
||||
<UseVSHostingProcess>False</UseVSHostingProcess>
|
||||
<AllowUnsafeBlocks>True</AllowUnsafeBlocks>
|
||||
<Platforms>x64</Platforms>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<OutputPath>..\</OutputPath>
|
||||
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
|
||||
<BaseAddress>285212672</BaseAddress>
|
||||
<CheckForOverflowUnderflow>false</CheckForOverflowUnderflow>
|
||||
<ConfigurationOverrideFile>
|
||||
</ConfigurationOverrideFile>
|
||||
<DefineConstants>TRACE;DEBUG;NEWTIMERS;ServUO</DefineConstants>
|
||||
<DocumentationFile>
|
||||
</DocumentationFile>
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<FileAlignment>4096</FileAlignment>
|
||||
<NoStdLib>false</NoStdLib>
|
||||
<NoWarn>
|
||||
</NoWarn>
|
||||
<Optimize>false</Optimize>
|
||||
<RegisterForComInterop>false</RegisterForComInterop>
|
||||
<RemoveIntegerChecks>false</RemoveIntegerChecks>
|
||||
<TreatWarningsAsErrors>false</TreatWarningsAsErrors>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<DebugType>full</DebugType>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet>
|
||||
<Prefer32Bit>false</Prefer32Bit>
|
||||
<UseVSHostingProcess>false</UseVSHostingProcess>
|
||||
<PlatformTarget>AnyCPU</PlatformTarget>
|
||||
<DebugType>embedded</DebugType>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<OutputPath>..\</OutputPath>
|
||||
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
|
||||
<BaseAddress>285212672</BaseAddress>
|
||||
<CheckForOverflowUnderflow>false</CheckForOverflowUnderflow>
|
||||
<ConfigurationOverrideFile>
|
||||
</ConfigurationOverrideFile>
|
||||
<DefineConstants>TRACE;NEWTIMERS;ServUO</DefineConstants>
|
||||
<DocumentationFile>
|
||||
</DocumentationFile>
|
||||
<DebugSymbols>false</DebugSymbols>
|
||||
<FileAlignment>4096</FileAlignment>
|
||||
<NoStdLib>false</NoStdLib>
|
||||
<NoWarn>
|
||||
</NoWarn>
|
||||
<Optimize>true</Optimize>
|
||||
<RegisterForComInterop>false</RegisterForComInterop>
|
||||
<RemoveIntegerChecks>false</RemoveIntegerChecks>
|
||||
<TreatWarningsAsErrors>false</TreatWarningsAsErrors>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<DebugType>none</DebugType>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<GenerateSerializationAssemblies>Auto</GenerateSerializationAssemblies>
|
||||
<Prefer32Bit>false</Prefer32Bit>
|
||||
<UseVSHostingProcess>false</UseVSHostingProcess>
|
||||
<PlatformTarget>AnyCPU</PlatformTarget>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x64' ">
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<OutputPath>..\</OutputPath>
|
||||
<DefineConstants>TRACE;DEBUG;NEWTIMERS;ServUO</DefineConstants>
|
||||
<BaseAddress>285212672</BaseAddress>
|
||||
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
|
||||
<DebugType>full</DebugType>
|
||||
<PlatformTarget>AnyCPU</PlatformTarget>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<Prefer32Bit>false</Prefer32Bit>
|
||||
<UseVSHostingProcess>false</UseVSHostingProcess>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x64' ">
|
||||
<OutputPath>..\</OutputPath>
|
||||
<BaseAddress>285212672</BaseAddress>
|
||||
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
|
||||
<Optimize>true</Optimize>
|
||||
<DebugType>
|
||||
</DebugType>
|
||||
<PlatformTarget>AnyCPU</PlatformTarget>
|
||||
<GenerateSerializationAssemblies>Off</GenerateSerializationAssemblies>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<Prefer32Bit>false</Prefer32Bit>
|
||||
<DefineConstants>TRACE;NEWTIMERS;ServUO</DefineConstants>
|
||||
<UseVSHostingProcess>false</UseVSHostingProcess>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x86' ">
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<OutputPath>..\</OutputPath>
|
||||
<DefineConstants>TRACE;DEBUG;NEWTIMERS;ServUO</DefineConstants>
|
||||
<BaseAddress>285212672</BaseAddress>
|
||||
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
|
||||
<DebugType>full</DebugType>
|
||||
<PlatformTarget>AnyCPU</PlatformTarget>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<Prefer32Bit>false</Prefer32Bit>
|
||||
<UseVSHostingProcess>false</UseVSHostingProcess>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x86' ">
|
||||
<OutputPath>..\</OutputPath>
|
||||
<BaseAddress>285212672</BaseAddress>
|
||||
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
|
||||
<Optimize>true</Optimize>
|
||||
<DebugType>
|
||||
</DebugType>
|
||||
<PlatformTarget>AnyCPU</PlatformTarget>
|
||||
<GenerateSerializationAssemblies>Off</GenerateSerializationAssemblies>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<Prefer32Bit>false</Prefer32Bit>
|
||||
<DefineConstants>TRACE;NEWTIMERS;ServUO</DefineConstants>
|
||||
<UseVSHostingProcess>false</UseVSHostingProcess>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Drawing">
|
||||
<Name>System.Drawing</Name>
|
||||
</Reference>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="AnimationEdit.cs" />
|
||||
<Compile Include="Animations.cs">
|
||||
<SubType>Code</SubType>
|
||||
</Compile>
|
||||
<Compile Include="Animdata.cs" />
|
||||
<Compile Include="Art.cs">
|
||||
<SubType>Code</SubType>
|
||||
</Compile>
|
||||
<Compile Include="ASCIIFont.cs" />
|
||||
<Compile Include="AssemblyInfo.cs" />
|
||||
<Compile Include="CalibrationInfo.cs">
|
||||
<SubType>Code</SubType>
|
||||
</Compile>
|
||||
<Compile Include="Client.cs">
|
||||
<SubType>Code</SubType>
|
||||
</Compile>
|
||||
<Compile Include="ClientHandles.cs" />
|
||||
<Compile Include="FileIndex.cs">
|
||||
<SubType>Code</SubType>
|
||||
</Compile>
|
||||
<Compile Include="Files.cs" />
|
||||
<Compile Include="Gumps.cs">
|
||||
<SubType>Code</SubType>
|
||||
</Compile>
|
||||
<Compile Include="Hues.cs">
|
||||
<SubType>Code</SubType>
|
||||
</Compile>
|
||||
<Compile Include="Light.cs" />
|
||||
<Compile Include="LocationPointer.cs">
|
||||
<SubType>Code</SubType>
|
||||
</Compile>
|
||||
<Compile Include="Map.cs">
|
||||
<SubType>Code</SubType>
|
||||
</Compile>
|
||||
<Compile Include="MultiMap.cs" />
|
||||
<Compile Include="Multis.cs">
|
||||
<SubType>Code</SubType>
|
||||
</Compile>
|
||||
<Compile Include="NativeMethods.cs" />
|
||||
<Compile Include="ProcessStream.cs">
|
||||
<SubType>Code</SubType>
|
||||
</Compile>
|
||||
<Compile Include="RadarCol.cs" />
|
||||
<Compile Include="Settings.cs" />
|
||||
<Compile Include="SkillGroups.cs" />
|
||||
<Compile Include="Skills.cs" />
|
||||
<Compile Include="Sound.cs" />
|
||||
<Compile Include="SpeechList.cs" />
|
||||
<Compile Include="StringEntry.cs">
|
||||
<SubType>Code</SubType>
|
||||
</Compile>
|
||||
<Compile Include="StringList.cs">
|
||||
<SubType>Code</SubType>
|
||||
</Compile>
|
||||
<Compile Include="Textures.cs">
|
||||
<SubType>Code</SubType>
|
||||
</Compile>
|
||||
<Compile Include="TileData.cs">
|
||||
<SubType>Code</SubType>
|
||||
</Compile>
|
||||
<Compile Include="TileList.cs">
|
||||
<SubType>Code</SubType>
|
||||
</Compile>
|
||||
<Compile Include="TileMatrix.cs">
|
||||
<SubType>Code</SubType>
|
||||
</Compile>
|
||||
<Compile Include="TileMatrixPatch.cs">
|
||||
<SubType>Code</SubType>
|
||||
</Compile>
|
||||
<Compile Include="UnicodeFont.cs" />
|
||||
<Compile Include="Verdata.cs">
|
||||
<SubType>Code</SubType>
|
||||
</Compile>
|
||||
<Compile Include="WindowProcessStream.cs">
|
||||
<SubType>Code</SubType>
|
||||
</Compile>
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
|
||||
<PropertyGroup>
|
||||
<PreBuildEvent>
|
||||
</PreBuildEvent>
|
||||
<PostBuildEvent>
|
||||
</PostBuildEvent>
|
||||
</PropertyGroup>
|
||||
</Project>
|
||||
Reference in New Issue
Block a user