Compare commits

..

257 Commits

Author SHA1 Message Date
Akkadius 86fddc4d3b Merge pull request #552 from stheno/web_interface
Implemented some basic commands.
2016-09-14 02:01:23 -05:00
stheno 570234a6ee Implemented some basic commands.
broadcast, zone shout, entity say and shout (both npc and pc).
Alpha'd the auth handler list so it is easier to read when/if we put more in.
2016-09-05 05:58:29 -07:00
Akkadius 8e4bb3b0fe Merge pull request #544 from stheno/web_interface
zlib warning fixes in cmake
2016-08-26 14:27:33 -05:00
stheno 385f3d0394 zlib warning fixes in cmake 2016-08-21 18:24:26 -07:00
Akkadius 6186ec8e12 Merge pull request #542 from Natedog2012/web_interface
Merge main into web_interface
2016-08-18 09:13:09 -05:00
Natedog2012 aa749f27dc Merge branch 'master' of https://github.com/EQEmu/Server into web_interface
# Conflicts:
#	zone/attack.cpp
#	zone/entity.cpp
#	zone/net.cpp
#	zone/worldserver.cpp
#	zone/zone.cpp
2016-08-18 03:57:06 -07:00
Michael Cook (mackal) f9f3a8f3bd Expendable Arrows ignore EQ 2016-08-17 01:10:37 -04:00
Akkadius 1def512b4c One more test 2016-08-16 21:56:43 -05:00
Akkadius b85d5a6d98 Discord final test 2016-08-16 20:44:04 -05:00
Akkadius 94fabc87f0 Travis Discord test 2 2016-08-16 19:50:12 -05:00
Akkadius d3afde1aa1 Travis Discord test 2016-08-16 19:36:26 -05:00
Michael Cook (mackal) 5a0d2b527b Add a StopCasting function and make some use of it
Unsure if all of these cases should use interrupt or stop casting
2016-08-16 17:52:14 -04:00
Michael Cook (mackal) 3d64878e60 Skip OP_BeginCast for discs 2016-08-15 15:23:37 -04:00
Michael Cook (mackal) 26772b721c Fix overhaste stack check 2016-08-15 14:21:39 -04:00
Michael Cook (mackal) 3c95545ea3 Remove IsCasting check from Client::SendManaUpdatePacket 2016-08-15 01:23:47 -04:00
Michael Cook (mackal) ae5689ffb4 Clean up OP_ManaChange 2016-08-15 01:17:53 -04:00
Michael Cook (mackal) e894e96404 Implement Linked Spell Reuse Timers
They started linked spells at OoW launch (I think)

At least canni was linked then.

This is rather user unfriendly, but that's live like.
Ex. the spells aren't actually put on cool down so you can attempt to cast them
still but you will be interrupted.

Titanium is particularly unfriendly with large differences in reuse times
2016-08-14 23:32:27 -04:00
Akkadius ed5715ccd9 Merge pull request #540 from KinglyKrab/master
Added optional avoidance cap rules. Check changelog.txt.
2016-08-13 21:27:25 -05:00
Uleat 7f9af238f8 Fix for potential crash in ItemInst::GetTotalItemCount() 2016-08-13 19:51:12 -04:00
Michael Cook (mackal) fd1e425abc Fix potential crash in ucs/clientlist.cpp 2016-08-13 17:19:20 -04:00
Michael Cook (mackal) 35c1eccbe1 Fix potential crash in zone/worldserver.cpp 2016-08-13 17:15:57 -04:00
Michael Cook (mackal) 69f06f736c Fix potential crashes in zone/spells.cpp 2016-08-13 17:15:00 -04:00
Michael Cook (mackal) 48fb483de6 Fix typo 2016-08-13 17:05:48 -04:00
Michael Cook (mackal) 8ce2921e3d Fix potential crashes in Mob::SpellEffect 2016-08-13 16:45:32 -04:00
Michael Cook (mackal) f06a9b3dce use std::abs in Map::FindClosestZ 2016-08-13 15:58:02 -04:00
Michael Cook (mackal) 3efc925264 And another 2016-08-13 15:47:44 -04:00
Michael Cook (mackal) a8db4532d0 Fix potential crash in #iteminfo 2016-08-13 15:46:35 -04:00
Michael Cook (mackal) ab35f8b842 Fix memset in QuestReward 2016-08-13 15:39:08 -04:00
Michael Cook (mackal) ef3cf099b8 Fix potential crash in Sacrifice 2016-08-13 15:35:28 -04:00
Michael Cook (mackal) 00cfe2d25f Fix potential crashes in attack.cpp 2016-08-13 15:26:07 -04:00
Michael Cook (mackal) 7a4c9b36a8 Fix logic issue in SendAlternateAdvancementRank 2016-08-13 15:20:48 -04:00
Michael Cook (mackal) 488c4941d2 Fix potential crash 2016-08-13 15:19:10 -04:00
Michael Cook (mackal) 97dc0a84dd Fix logic paren issue 2016-08-13 15:14:31 -04:00
Michael Cook (mackal) f01c890966 Crash fix
The other thing needs to be looked at too, but I guess we never run
into an issue where this actually is a nullptr because bad things
would happen here ...
2016-08-13 15:09:43 -04:00
Kinglykrab 50de63117d Added optional avoidance cap rules. Check changelog.txt. 2016-08-13 07:19:58 -04:00
Michael Cook (mackal) 4e4d82857c Move OP_BeginCast above instant cast shortcut
For casted seplls, we should always see this. Mostly this shortcut breaks
spell awareness for NPC spells. (most of them are instant cast)
2016-08-12 22:07:03 -04:00
Michael Cook (mackal) 039e0fbb83 NPC innate procs overwrite TargetType to ST_Target 2016-08-12 21:53:14 -04:00
Michael Cook (mackal) e1a02455d8 Merge pull request #539 from clucksoft/crash_fix
Prevent crash in spell casting when group doesn't exist
2016-08-11 14:22:51 -04:00
Russell Kinasz c1c9ec2790 Prevent crash in spell casting when group doesn't exist 2016-08-11 11:04:03 -07:00
Michael Cook (mackal) e90e141a79 std::unordered_map::count is much slower than find 2016-08-10 23:51:06 -04:00
Michael Cook (mackal) 38d3f9b7c0 Client checks song flag first
This fixes bugs with buffs marked as disc and song (they go to the song window now)
Before the client got confused and gave up displaying them at all!
2016-08-10 13:16:32 -04:00
Michael Cook (mackal) 7d62b208ca Revert "Rate limit saving to at most once a second"
This reverts commit f26dce39c3.

No easy mode I guess
2016-08-09 21:30:10 -04:00
Michael Cook (mackal) 27f6826fd3 Add rule Spells:AllowItemTGB for custom servers 2016-08-08 20:21:38 -04:00
Michael Cook (mackal) 051f9ffab9 fix bard song mods on instant spells (nukes, procs) 2016-08-08 15:22:26 -04:00
Michael Cook (mackal) bdb083eac7 Previous disc buff check incorrectly excluded Savage Spirit AA line
This still doesn't fix Untamed Rage ... unsure on that one :(
2016-08-07 18:55:02 -04:00
Michael Cook (mackal) 4b93ef0a98 Fix SE_CastOnFadeEffect 2016-08-07 18:17:39 -04:00
Michael Cook (mackal) e86d11250b Actually remove expendable AAs from the DB 2016-08-07 14:32:30 -04:00
Michael Cook (mackal) e5746c3b2e Fix EVENT_LOOT broken by b43cfa126 2016-08-05 22:14:20 -04:00
Michael Cook (mackal) 6a7ea65dd0 Ask water map if we're in a zoneline to prevent false positives
I don't think this should open up any chance to exploit
Trying to use a ZL to go somewhere else is still detected etc

This should really cut down on false positives and we really can't
see real cheater from all the noise this creates
2016-08-05 01:07:12 -04:00
Michael Cook (mackal) 68df09a570 Implement PVP regions 2016-08-04 23:56:08 -04:00
Michael Cook (mackal) d53d569020 Port EQMacEmu's improved NPC stat scaling formula
Old formula can be used by setting NPC::NewLevelSacling to false
2016-08-04 22:12:33 -04:00
Michael Cook (mackal) 1d12f92934 Level 50+ NPCs will now respond to yells for help regardless of con color 2016-08-04 20:36:15 -04:00
Michael Cook (mackal) e89fa01d89 Port Aggro:UseLevelAggro from EQMacEmu
This will make level 18+ mobs braver
2016-08-04 20:33:29 -04:00
Uleat 4c49397ef6 Merge branch 'master' of https://github.com/EQEmu/Server 2016-08-04 16:12:58 -04:00
Michael Cook (mackal) 8dc8e53218 Added some more comments to PassCastRestrictions 2016-08-04 13:50:20 -04:00
Uleat d0fbbed20d Added a trap for Bot::GetNeedsCured() random crash (bot server admins: watch your logs!) 2016-08-04 07:09:34 -04:00
Michael Cook (mackal) 33407ee0da Forgot divination 2016-08-03 23:14:02 -04:00
Michael Cook (mackal) c81a5e0783 Limit casting skill ups to casting skills 2016-08-03 23:06:00 -04:00
Michael Cook (mackal) 66fec40169 Move Enrage check to after the immune ripo check 2016-08-03 22:38:33 -04:00
Michael Cook (mackal) 60f2d14caa Rework bash/kick stun based on client
This is what the client is doing. It doesn't reuse all the old rules, so those
can't be tweaked unless someone wants to add them back in
2016-08-03 17:37:09 -04:00
Michael Cook (mackal) 538d6a2a33 Hack to fix RNG Nature Veil line 2016-08-03 01:44:33 -04:00
Michael Cook (mackal) f26dce39c3 Rate limit saving to at most once a second
There are A LOT of unneeded saves ...

This will prevent a lot of excessive database hits at least
with very little room to exploit
2016-08-03 01:13:51 -04:00
Michael Cook (mackal) acb5bb3e3e If this flag is set, we JUST saved
Also saved due to an OP_Save very recently ...
2016-08-03 00:33:22 -04:00
Michael Cook (mackal) 16125c38af Lets not save here if we're zoning 2016-08-03 00:13:47 -04:00
Michael Cook (mackal) 69db67efe5 Remove extra save 2016-08-02 23:32:37 -04:00
Michael Cook (mackal) 37ecc69088 Update UF packet stuff to have 30 BUFF_COUNT 2016-08-02 21:10:32 -04:00
Michael Cook (mackal) d68a3b191e Give pets 30 buff because that's what they got 2016-08-02 21:08:05 -04:00
Michael Cook (mackal) 64cf613189 Update GetCurrentBuffSlots() for TSS free slots
The client also checks if you have any bonus from spells and items
so why not check that as well
2016-08-02 19:00:33 -04:00
Uleat f3da7773d3 Merge branch 'master' of https://github.com/EQEmu/Server 2016-08-02 17:49:17 -04:00
Uleat 7c9bd80c1e Changed SendZoneSpawnsBulk to a more like-like behavior 2016-08-02 17:49:08 -04:00
Michael Cook (mackal) 2bae779a9b NPCs don't have separate buff windows 2016-08-02 16:48:58 -04:00
Michael Cook (mackal) e862994716 RoF/RoF2 spell gem refresh in PP
This fixes issues with long recast spells
2016-07-31 18:09:04 -04:00
Michael Cook (mackal) f612f8be42 Fix typo 2016-07-31 17:35:33 -04:00
Michael Cook (mackal) ef2c17748e Implement extra spell gems!
New limits:
    Tit: 9
    SoF: 9
    SoD: 10
    UF: 12
    RoF: 12
    RoF2: 12

The SoF client doesn't actually support 10 like SoF should
RoF/RoF2 actually have 4 extra broken spell gems in the UI. They don't work and
will likely crash your client

Quest stuff assumes you are passing in valid slots.
(note the old default of 10 should be 22)

There are still somethings to do like clean up the memmed spells if one switches
to an older client that doesn't support as many as their previous client.
2016-07-31 17:16:23 -04:00
Michael Cook (mackal) 4c4b0aba0c Switch trading to call CommonBreakInvisible() 2016-07-30 12:51:17 -04:00
Uleat 4decdb3e4d Added zone map mmf discovery message 2016-07-29 21:58:42 -04:00
Uleat 6b3078d0f7 Fix for 64-bit Zone MMF compiles 2016-07-29 18:26:23 -04:00
Michael Cook (mackal) 3a4b341ad6 Allow quest controlled TS to have no returns 2016-07-29 15:29:28 -04:00
Michael Cook (mackal) 2a2ce6da5d Fix item clicks being TGBable 2016-07-29 15:14:26 -04:00
Michael Cook (mackal) 239c478f31 Add some comments to target types [skip ci] 2016-07-29 02:55:43 -04:00
Michael Cook (mackal) f6c62af82e Update comment [skip ci] 2016-07-29 02:26:26 -04:00
Uleat 84db0ec2c5 Zone MMF Implementation (for map files) 2016-07-28 22:50:06 -04:00
Michael Cook (mackal) 345f3d6301 Fix Tit OP_Buff decode 2016-07-27 19:58:24 -04:00
Michael Cook (mackal) de5170c5cb Fix mana burn 2016-07-26 17:10:06 -04:00
Michael Cook (mackal) 7674b3a077 Fix some same spell stacking issues 2016-07-26 16:25:19 -04:00
Michael Cook (mackal) 11e017ccb9 Fix bard mod in PP for UF 2016-07-25 16:37:27 -04:00
Michael Cook (mackal) bda4fcfb26 Fix up SpellBuff struct
Please report any bugs you find. There shouldn't be unless I messed up the struct
for a client I didn't throughly test for
2016-07-25 16:22:48 -04:00
Michael Cook (mackal) a7fd9312d0 Fix syntax error 2016-07-24 22:58:48 -04:00
Michael Cook (mackal) 3963897fe4 There is a different rez spell depending on race 2016-07-24 22:53:57 -04:00
Michael Cook (mackal) f42b0351fd Improve list of skipped effects in stacking code
This is the list according to the client (RoF2)

Please report any stacking anomalies
2016-07-24 22:24:53 -04:00
Uleat 37cb9f00f6 Removed another unneeded slash 2016-07-24 18:01:14 -04:00
Michael Cook (mackal) 343b781e74 Implement cast_not_standing and fix Cazic Touch
No idea why this spell field does this, but that's what the client
is doing with it ...
2016-07-23 18:40:17 -04:00
Michael Cook (mackal) f428a8a56a Add a CastWhileInvis check and fix some issues 2016-07-23 18:07:56 -04:00
Michael Cook (mackal) cd9a7f1d5d Cap tic diff to 0 for duration based calcs
This will match Splurt with the double 191
2016-07-23 17:52:30 -04:00
Michael Cook (mackal) 83548ee405 Fix buff tics
This will not fade buffs at 6s :P
2016-07-23 17:41:16 -04:00
Michael Cook (mackal) 5f588934a9 Make decaying spell bonuses not depend on CaclBonuses being called some other way
This just sets a flag that will tell us we need to recalc bonuses every tick

Before these kind of depended on it being caused some other way
2016-07-23 13:55:36 -04:00
Michael Cook (mackal) 1f5dcb6965 Make SE_SpellResistReduction not complain 2016-07-21 20:27:08 -04:00
Michael Cook (mackal) 5f111f159b Update comment [skip ci] 2016-07-21 14:05:29 -04:00
Michael Cook (mackal) 527ee56fb2 Fix Distance Mod scaling
The client clamps the distance between the min/max
2016-07-20 17:49:33 -04:00
Michael Cook (mackal) 8396f19e85 Add buff level restrictions for pets 2016-07-20 16:27:22 -04:00
Akkadius aadc4b5e6b Update eqemu_update.pl 2016-07-20 14:15:00 -05:00
Michael Cook (mackal) ccb5427b45 Make VS debug mode happy
This actually hurts microbenchmarking

I couldn't get the ModelEntry::polys vector to play nice with benchmarking
so it will just be using push_back so I don't have write a new ctor
(writing a new ctor and using emplace_back vs push_back were equal)
2016-07-18 21:57:25 -04:00
Michael Cook (mackal) 8983f3c5dc Merge pull request #537 from noudess/master
Fix for BuffDurationPacket on movement speed buffs.
2016-07-18 16:05:28 -04:00
Paul Coene 9349d5d473 Another fix for when BuffDurationPacket breaks client effects on spells.
In this case run speed spells like SoW.
2016-07-18 15:30:55 -04:00
JJ ae6ceddab7 Merge pull request #536 from noudess/master
Fix Voice Graft to work only when targetting pet.
2016-07-18 14:54:43 -04:00
Paul Coene 84c90715be Reverse checks for voice graft to short curcuit when no pet. 2016-07-18 14:37:21 -04:00
Michael Cook (mackal) aeff31ba7a Fix error with /setstartcity 2016-07-18 13:57:14 -04:00
Michael Cook (mackal) f431e820ef Optimize Map::LoadV2 a bit
Microbenchmarking showed ~33% increase in loading moors
Real world testing showed ~48%
2016-07-17 23:35:18 -04:00
Michael Cook (mackal) c41521c310 Fix saving binds on charcreate 2016-07-17 22:50:00 -04:00
Akkadius f437232db1 Overhauled worldserver logging
- Now displays account logins
 - Zoning from character select
 - Zoning from zone to zone
 - When any other server process connects to world
 - Adjust some zone bootup messages etc.

Adjusted logging code bits all over and refactored variables for readability etc.
2016-07-17 20:45:58 -05:00
Akkadius 3ed43d50f2 Resolving glitchy/choppy mob pathing issues 2016-07-17 19:07:48 -05:00
Michael Cook (mackal) 7cd613e5f2 Comment spell struct with official names for each field 2016-07-17 02:13:13 -04:00
Michael Cook (mackal) 921136c987 Exclude in other Perma Illusion spot 2016-07-16 19:40:20 -04:00
Michael Cook (mackal) d4df2e7351 Exclude Minor Illusion and Illusion: Tree from perma 2016-07-16 19:33:36 -04:00
Michael Cook (mackal) 9cf553232d Tweak spell dot stacking exempt based on client 2016-07-16 18:18:41 -04:00
Uleat 6cb2fdd737 Changed constructor call for stringstream in ClientTaskState::EnableTask/DisableTask (write position issues) 2016-07-15 19:32:46 -04:00
Michael Cook (mackal) bbf4d19de3 Revert "Changed tuple use to struct in maps.cpp (LoadV2) (should help in client drops where slow zone boot-ups are a factor)"
This reverts commit 02cedce54e.

This is breaks moors!
2016-07-15 15:20:36 -04:00
Uleat 02cedce54e Changed tuple use to struct in maps.cpp (LoadV2) (should help in client drops where slow zone boot-ups are a factor) 2016-07-14 13:22:36 -04:00
Uleat 871fcd1fc8 Fix for quest enabletask/disabletask api queries 2016-07-14 12:47:55 -04:00
Uleat 7457d832f8 Changed query in BotDatabase::LoadGroupedBotsByGroupID() to use standard table query over view use (should help in cases where players time-out when zoning) 2016-07-12 20:22:14 -04:00
Michael Cook (mackal) a9ff407657 Optimize Mapp:RotateVertex()
This function can get rather expensive and waste a surprisingly
large amount of time. Using moors as a test zone simply switching
from the C math API cos/sin to std::cos/std::sin seemed to help

11.11% Map::RotateVertex(glm::tvec3<float, (glm::precision)0>&, float, float, float)
4.16% Map::RotateVertex(glm::tvec3<float, (glm::precision)0>&, float, float, float)
2016-07-10 23:18:26 -04:00
Paul Coene 1ba7f0cd65 Fix so you can still speak to NPCS (patch to last patch for voice graft) 2016-07-09 16:35:57 -04:00
Paul Coene 56fcabc119 Fix Voice Graft to allow you to speak by targetting yourself. 2016-07-09 15:40:19 -04:00
Uleat 402353affa Important fix for mob pathing (see changelog.txt) 2016-07-09 03:10:54 -04:00
Uleat bc196f2e50 Changed world server zone boot-up failure message to 'General' level to facilitate world-initiated zone boot-up issues 2016-07-08 16:19:14 -04:00
Uleat 148eaf7048 Merge branch 'master' of https://github.com/EQEmu/Server 2016-07-08 15:33:42 -04:00
Uleat b44da7c13a Fix for command #traindisc not saving disciplines when not used on self 2016-07-08 15:33:36 -04:00
Michael Cook (mackal) 4b57f69cba Fix illusions on zone 2016-07-07 16:17:13 -04:00
Uleat 542d454fe0 Added rule 'NPC:UseClassAsLastName' to second spawn packet handler 2016-07-05 15:20:46 -04:00
Uleat 3d61df253d Added rule 'NPC:UseClassAsLastName' to allow certain npcs' class names to be hidden 2016-07-03 19:44:45 -04:00
Akkadius dcd276a5ce Merge pull request #534 from fzzzt/master
Add FreeBSD as a peer with Linux in eqemu_update.pl OS detection
2016-07-03 15:56:11 -05:00
Josh Endries bacaf6453e Add FreeBSD as a peer with Linux in eqemu_update.pl OS detection 2016-07-03 15:13:34 -04:00
Michael Cook (mackal) 860ee81a38 Break invis for AA casts 2016-06-30 21:59:50 -04:00
Michael Cook (mackal) bcec9501b7 Fix issue with invis not dropping for new item clicks
Clients using OP_ItemVerifyRequest couldn't break the invis
themselves, so we gotta for them
2016-06-30 21:49:20 -04:00
Michael Cook (mackal) 37b46d1289 Make more usage of CancelSneakHide 2016-06-30 21:49:00 -04:00
Michael Cook (mackal) 54de212214 Implement OP_CancelSneakHide
Didn't test every client, but they should all work
2016-06-30 17:50:31 -04:00
Michael Cook (mackal) a64343689c Refactor loot response a bit
Invis is dropped after ALL error checking now
Identified all the response types
2016-06-30 14:00:18 -04:00
Michael Cook (mackal) 3e0af2928b Remove duped code from CommonBreakInvisibleFromCombat 2016-06-30 01:30:51 -04:00
Uleat a5d79b25db Grr... 2016-06-28 16:56:42 -04:00
Uleat cb8843926c Merge branch 'master' of https://github.com/EQEmu/Server
# Conflicts:
#	changelog.txt
2016-06-28 16:20:17 -04:00
Michael Cook (mackal) 59ec184208 Merge pull request #533 from noudess/master
Res effects now block certain buffs like on live.  Blocked spells generate message like on live.
2016-06-28 13:34:39 -04:00
Paul Coene 9a010a90a9 Added Client:UseLiveBlockedMessage rule 2016-06-28 08:27:31 -04:00
Uleat 3d6fe8acba Fix for bot inventory save failure involving items with unlimited charges 2016-06-28 07:58:38 -04:00
Paul Coene 02ec76d2aa Res effects now block certain buffs like on live.
Blocked spells generate message as on live.
2016-06-27 11:14:33 -04:00
Natedog2012 8615df0a03 Bot names skip player name filter to allow for longer bot names.
RoF/RoF2/UF item packets allow for 1000 stack items again.. not capped at 254
2016-06-25 18:05:44 -07:00
Uleat 951f3239f1 Added rule Bots:AllowCamelCaseNames 2016-06-23 22:25:57 -04:00
Akkadius fe630bf7ca Adjust default lootdrop max level 2016-06-20 14:27:01 -05:00
Akkadius 1a2537f5d8 Adjust default lootdrop max level 2016-06-20 14:25:05 -05:00
Natedog2012 7b04b9ef4a Fix for #bot command crashing the zone when sent with no text following "#bot" 2016-06-18 23:37:17 -07:00
Michael Cook (mackal) 30b516e7bd Merge pull request #530 from EQEmu/luarocks
Add luarocks support
2016-06-17 21:09:40 -04:00
Akkadius c72749790d Update eqemu_update.pl 2016-06-16 13:14:27 -05:00
Akkadius 05780a9316 Update eqemu_update.pl 2016-06-16 02:17:11 -05:00
Akkadius 3889da7301 Update eqemu_update.pl [skip ci] 2016-06-15 02:02:32 -05:00
Michael Cook (mackal) 57ebfd2675 Merge pull request #532 from noudess/master
Changed personal faction earned min/max values to -2000/2000.
2016-06-13 14:30:39 -04:00
Paul Coene b10187f9de Changed personal faction earned min/max values to -2000/2000. 2016-06-13 14:04:23 -04:00
Michael Cook (mackal) af99db7287 Merge pull request #531 from noudess/master
Fix for detrimental/beneficial spell overwrite and/or block.
2016-06-13 13:27:41 -04:00
Paul Coene 306ecf003a Spells like listless power and dread touch should be taking down/blocking
spells like augmentation and strenthen respectively.  The stacking code
was being bypassed when a beneficial spell and a detrimental spell for the
same effect were being compared.

With this code removed, the spells are compared and the stonger of the two
spells wins and replaces or blocks the other.

Without this change, for example, dread touch takes down strengthen on the
client, but the server still things strength is up, causing a mismatch.

With this change, client/server match.
2016-06-13 09:06:44 -04:00
Michael Cook (mackal) 2b2ebc75b0 Add luarocks support
This allows one to use the lua_modules folder as their luarocks tree
ex (from the server folder with lua_modules using default location)

luarocks --tree=lua_modules install luasql-mysql MYSQL_INCDIR=/usr/include

This will install the luasql mysql module so you can now do queries from lua
2016-06-11 15:59:46 -04:00
Michael Cook (mackal) 83bb10b32b Add support for sub folder style lua modules
Ex. lua_modules/?/init.lua will work (which some lua modules do use)
2016-06-11 13:23:52 -04:00
Drajor d9bdcf2aec Merge pull request #529 from EQEmu/currency
Currency
2016-06-11 21:04:38 +10:00
Drajor 3e25a3df5c Implemented RoF2 encoder for OP_CrystalCountUpdate (0x467f) 2016-06-11 20:24:36 +10:00
Drajor 73e91be281 Fixed vulnerability in handling of OP_CrystalCreate 2016-06-11 19:53:19 +10:00
Michael Cook (mackal) 471d7ec42d Merge pull request #528 from EQEmu/altcurr
Fixes #527
2016-06-10 23:31:43 -04:00
Drajor 1b6974ade3 Alternate currency sell price now matches RoF2 client calculation 2016-06-11 13:29:56 +10:00
Drajor c1a6a23e06 Fixes #527 2016-06-11 12:48:16 +10:00
Uleat 9ec299247c Reworked EQEmuDictionary to use class LookupEntry 2016-06-06 21:59:42 -04:00
Uleat 79549ba330 Merge branch 'master' of https://github.com/EQEmu/Server 2016-06-04 20:05:04 -04:00
JJ 4b15121f70 No need to have extra slash anymore due to b997a040d7 2016-06-04 19:53:22 -04:00
Uleat c29219f214 Split InventoryVersion::Pet into discrete sub-types 2016-06-04 07:04:31 -04:00
KimLS 51d8f00418 Add appveyor badge to readme (wip but still). 2016-06-02 20:12:41 -07:00
Uleat e843f66135 Cosmetic fix to match existing naming conventions 2016-06-02 20:19:40 -04:00
Uleat 542dc16752 Fix for bandolier 2H-weapon exploit 2016-06-02 20:07:25 -04:00
Uleat 62888170b0 Better the second time around... 2016-06-02 07:14:54 -04:00
Uleat ca0b26f89f Implementation clean-up 2016-06-01 09:34:16 -04:00
Uleat cd8cd90a38 Implemented EQEmu::TextureProfile 2016-06-01 08:54:26 -04:00
Uleat ae3c98c692 Implemented EQEmu::TintProfile 2016-06-01 04:58:52 -04:00
Uleat 767dfaef70 Another penguin bite... 2016-05-31 22:28:31 -04:00
Uleat c07fe35908 Fix for gcc failure 2016-05-31 22:17:58 -04:00
Uleat ea8f81feec Converted enumeration MaterialSlots to EQEmu::textures::TextureSlot 2016-05-31 22:07:02 -04:00
Uleat a38417bf54 More eq_dictionary work - added invtype persistence checks 2016-05-31 19:12:54 -04:00
Uleat 0f54984966 Missed a few out of my working stash... 2016-05-31 01:52:51 -04:00
Uleat 6c1af93f58 Another lightsource/saylink/skills pass 2016-05-30 08:39:49 -04:00
Uleat 16895910e4 Another eq_dictionary pass 2016-05-30 06:52:25 -04:00
Uleat b155a603aa Added multi-type EQEmu::ValueWithin function 2016-05-30 03:32:01 -04:00
Uleat ecc9e41ab2 Fix for server crash related to deleting a bot with a spawned pet 2016-05-30 03:03:55 -04:00
Uleat 2a74d04635 Added offline client inventory version definitions and convertors 2016-05-29 20:30:03 -04:00
Uleat a089820464 Merged client_version and inventory_version into emu_versions files 2016-05-28 04:44:14 -04:00
Uleat 579efe83af Renamed EQEmu::Item_Struct to EQEmu::ItemBase to coincide with new inventory naming conventions (re-run shared_memory.exe) 2016-05-27 22:22:19 -04:00
Uleat a37a811014 Imported memory_buffer files from inv2 branch 2016-05-27 20:39:11 -04:00
Uleat 0ecc702612 ItemPacketType updates 2016-05-27 03:38:13 -04:00
Uleat a144ecd21b ItemPacketType note update 2016-05-26 17:23:57 -04:00
Uleat 772fa200ac Update to client limits 2016-05-26 05:27:21 -04:00
KimLS 598a4a6878 Merge branch 'master' into web_interface 2015-03-06 16:03:38 -08:00
Akkadius 6064ca95f9 Add some data returns to NPC.Position and GetInitial 2015-02-03 00:31:55 -06:00
Akkadius 3448dd1a9e Post merge Log.Out converts and header/linker fixes 2015-02-03 00:10:49 -06:00
Akkadius dd6d1d5511 Merge remote-tracking branch 'remotes/origin/master' into web_interface
Conflicts:
	CMakeLists.txt
	common/logtypes.h
	common/shareddb.cpp
	world/net.cpp
	zone/client_logs.cpp
	zone/corpse.cpp
	zone/mob.cpp
	zone/net.cpp
2015-02-02 23:11:31 -06:00
Akkadius b8dd81de66 Merge remote-tracking branch 'remotes/origin/master' into web_interface 2015-01-04 07:02:54 -06:00
Akkadius 31158ed03d Post merge fix 2015-01-04 06:50:11 -06:00
Akkadius fa5dedec11 Merge remote-tracking branch 'remotes/origin/master' into web_interface
Conflicts:
	common/shareddb.cpp
2015-01-04 06:45:50 -06:00
KimLS 774e9becbd Added __STDC_CONSTANT_MACROS to cmake defines, this should make C++ export the C99 macros even if the standard library isn't quite up to the c++11 standard yet 2014-12-20 19:34:56 -08:00
KimLS 5cbd741358 Merge from master 2014-12-20 19:32:00 -08:00
KimLS b0274e34e2 Fix for websockets linking 2014-12-19 18:11:35 -08:00
KimLS adc740da5a Wrong iter type fails on gcc 4.6 2014-12-19 17:52:53 -08:00
Akkadius 240b066f34 post merge fixing 2014-12-16 00:29:38 -06:00
Akkadius fffe59c52e Merge remote-tracking branch 'remotes/origin/master' into web_interface
Conflicts:
	common/CMakeLists.txt
	common/eqemu_config.cpp
	common/eqemu_config.h
	common/shareddb.h
2014-12-16 00:12:01 -06:00
Akkadius 7ad2ead1be Merge remote-tracking branch 'remotes/origin/master' into web_interface
Conflicts:
	common/shareddb.cpp
	zone/corpse.cpp
	zone/worldserver.cpp
	zone/zone.cpp
2014-12-15 20:15:16 -06:00
Akkadius f2114c7611 Post merge fix 2014-12-15 01:06:03 -06:00
akkadius cb009aba7c Merge remote-tracking branch 'remotes/origin/master' into web_interface
Conflicts:
	common/shareddb.cpp
	zone/attack.cpp
2014-12-11 22:22:34 -06:00
Akkadius 9df7e9e1f3 Merge remote-tracking branch 'remotes/origin/master' into web_interface 2014-12-09 05:04:27 -06:00
Akkadius 7f6997baf4 Added "heading" to Zone.SetEntityAttribute 2014-12-08 05:40:59 -06:00
Akkadius 6edb4c2b37 Added "weapon_1" and "weapon_2" to Zone.SetEntityAttribute 2014-12-08 05:40:38 -06:00
Akkadius 910ee66fce Add "gender" to Zone.SetEntityAttribute 2014-12-08 05:39:54 -06:00
Akkadius f662141f86 Add "texture" to Zone.SetEntityAttribute 2014-12-08 05:39:29 -06:00
Akkadius c5498c66fa Add "size" to Zone.SetEntityAttribute 2014-12-08 05:38:52 -06:00
Akkadius 3df5b6da57 Add Objects entities to Zone.GetInitialEntityPositions 2014-12-08 05:38:03 -06:00
Akkadius e47ad72b1c NPC aggro_range return on handle_rc_get_initial_entity_positions 2014-12-08 05:37:10 -06:00
Akkadius f3af295f34 SendIllusionPacket fix for mob base race not getting set 2014-12-08 05:31:59 -06:00
Akkadius 9eb41c7b0d Zone.GetEntityAttributes
Zone.SetEntityAttribute
2014-12-07 19:43:00 -06:00
KimLS ee8b950df1 Merge branch 'master' into web_interface 2014-12-07 13:23:55 -08:00
KimLS 29b4498534 Hopefully completely merged from master in what is the biggest merge ever 2014-12-07 13:23:16 -08:00
KimLS 91ecf759e3 First implementation of read/write file access. We need better security for this though, you could potentially overwrite any file on the local machine the user of world has write access to atm. 2014-10-23 14:35:16 -07:00
KimLS 5a7a2b0aef Wanted test to account for quest request 2014-10-12 14:49:04 -07:00
KimLS 45b83feb99 Fix for file loading 2014-10-12 14:41:53 -07:00
KimLS f4621bd5c0 Fix for crash when sending too large a response packet, less efficient but should handle every packet type now. Can retool if allocations end up being a problem. 2014-10-11 15:44:27 -07:00
KimLS 06f7f6b483 Fix for quest stuff loading junk from a file. Also will properly memset the entire buffer 2014-10-11 02:15:36 -07:00
Akkadius 509babc2d1 A few calls added, forget where I was but just pushing so KLS can start looking at the quest stuff 2014-10-03 18:45:32 -05:00
KimLS ca86763c2b Token verification 2014-08-18 20:27:15 -07:00
KimLS a602640188 Merge branch 'master' into web_interface 2014-08-18 18:36:31 -07:00
KimLS b9e6a1f5eb Fixed param problem with zone/world, also please don't put excessive periods in function names... thank.you.please.for.the.love.of.god 2014-08-11 14:10:24 -07:00
KimLS 119e0bb0ac Merge branch 'master' into web_interface 2014-08-11 13:51:11 -07:00
Akkadius 34913c2046 Added client to Zone.Get.Initial.Entity.Positions
Added type field to Zone.Get.Initial.Entity.Positions
Added method Zone.Move.Entity, currently in test mode
Made modifications to explode function in web_interface_utils.h
2014-08-07 20:13:37 -05:00
KimLS c6d8b7e337 More generic method handlers now 2014-08-05 14:30:23 -07:00
KimLS 2ed960d733 Cleanup of various things, made writing method handlers in web_interface easier now you just have to check args 2014-08-04 14:35:10 -07:00
KimLS dd88d0096b Merge branch 'master' into web_interface 2014-08-04 13:57:43 -07:00
Akkadius 7c3cfd43de Stuff 2014-08-03 01:20:19 -05:00
Akkadius 4e1fcfb7e5 Temp crash fix 2014-08-02 18:29:25 -05:00
KimLS 379ecc655c Changed a bunch of function names to be shorter but still descriptive 2014-08-02 14:31:39 -07:00
KimLS ae30d8b257 More cleanup 2014-08-01 19:07:54 -07:00
KimLS 40b555a55b More work on subscription events, and relaying through world. 2014-08-01 18:29:41 -07:00
KimLS 002f5e3bcc Work on relay 2014-07-30 20:07:36 -07:00
KimLS 780789fbad More work on getting remote calls up and running, added two remote calls list_zones and get_zone_info. 2014-07-30 15:23:14 -07:00
KimLS 927580b983 Prelim work on authorization, right now it's hard coded but it will actually check a db at some point 2014-07-25 22:11:58 -07:00
KimLS 7359eb01d4 Merge branch 'web_interface' of github.com:EQEmu/Server into web_interface 2014-07-24 19:35:04 -07:00
Chris M da6d7538b0 Position updates with do_pos_update test call 2014-07-22 23:14:44 -05:00
KimLS 69e90aac0a Racism down, uuid tracking up 2014-07-21 19:22:16 -07:00
KimLS 2dff51a4db Merge branch 'web_interface' of github.com:EQEmu/Server into web_interface 2014-07-20 14:35:54 -07:00
Chris M e442d682cd Added rapidjson library
Added web_interface_utils.cpp/.h to common to provide string based functions for outputting JSON
Adjusted CMake to include rapidjson library and new web_interface_utils.h/cpp to common

Currently, I have code set up hackishly for testing so do not think it is final. It is merely for demonstrating what I've done and played with.
2014-07-20 15:02:06 -05:00
KimLS 0e0638f11d Merge branch 'master' into web_interface 2014-07-20 12:25:17 -07:00
KimLS 5ad7b84415 Fixed memory allocation for socket write, stopgap for now we can probably set a max message out size and cut out allocations all together. 2014-07-16 23:52:52 -07:00
KimLS e0bc0e2e5c Changed websockets lib, protocol not finalized at all 2014-07-15 22:52:18 -07:00
KimLS 4109b0b88d Merge from master 2014-07-14 15:50:40 -07:00
KimLS 80892f1d4d Reworking a lot of stuff at once, this will look very chaotic. 2014-07-14 15:09:55 -07:00
KimLS 9e3e8dbfa6 Cleaned up web interface server, starting work on getting tcp connections to persist then will hook it up to the websockets/http/whatever else we deem worthy. 2014-07-07 22:19:46 -07:00
KimLS 74f07f8e19 Merge conflict 2014-07-06 15:26:58 -07:00
KimLS f866fd59d9 Merge problem 2014-07-03 14:14:14 -07:00
KimLS d6da569fc6 Auto-commit. 2014-07-03 14:11:06 -07:00
Chris M 7ec0994433 Cleanup 2014-07-03 04:15:00 -05:00
432 changed files with 52800 additions and 4599 deletions
+13 -7
View File
@@ -30,6 +30,7 @@
#EQEMU_BUILD_LUA
#EQEMU_SANITIZE_LUA_LIBS
#EQEMU_BUILD_CLIENT_FILES
#EQEMU_USE_MAP_MMFS
#EQEMU_MAP_DIR
#We set a fairly new version (as of 2013) because I found finding perl was a bit... buggy on older ones
@@ -256,7 +257,7 @@ OPTION(EQEMU_BUILD_LOGIN "Build the login server." OFF)
OPTION(EQEMU_BUILD_TESTS "Build utility tests." OFF)
OPTION(EQEMU_BUILD_PERL "Build Perl parser." ON)
OPTION(EQEMU_BUILD_LUA "Build Lua parser." ON)
OPTION(EQEMU_BUILD_CLIENT_FILES "Build Client Import/Export Data Programs." ON)
OPTION(EQEMU_BUILD_CLIENT_FILES "Build Client Inport/Export Data Programs." ON)
#C++11 stuff
IF(NOT MSVC)
@@ -264,6 +265,8 @@ IF(NOT MSVC)
IF("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-reserved-user-defined-literal")
ENDIF()
ADD_DEFINITIONS(-D__STDC_CONSTANT_MACROS)
ENDIF(NOT MSVC)
#Various definitions
@@ -275,6 +278,11 @@ IF(EQEMU_BUILD_LUA)
ADD_DEFINITIONS(-DLUA_EQEMU)
ENDIF(EQEMU_BUILD_LUA)
OPTION(EQEMU_USE_MAP_MMFS "Create and use Zone Map MMF files." OFF)
IF(EQEMU_USE_MAP_MMFS)
ADD_DEFINITIONS(-DUSE_MAP_MMFS)
ENDIF(EQEMU_USE_MAP_MMFS)
SET(EQEMU_MAP_DIR "./Maps" CACHE STRING "The dir that maps, water maps, and paths are located in.")
ADD_DEFINITIONS(-DEQDEBUG=${EQEMU_DEBUG_LEVEL})
@@ -317,7 +325,7 @@ IF(EQEMU_BUILD_LUA)
SET(BOOST_ROOT "${CMAKE_CURRENT_SOURCE_DIR}/dependencies/boost")
FIND_PACKAGE(Boost REQUIRED)
INCLUDE_DIRECTORIES(SYSTEM "${LUA_INCLUDE_DIR}" "${Boost_INCLUDE_DIRS}" "luabind")
INCLUDE_DIRECTORIES(SYSTEM "${LUA_INCLUDE_DIR}" "${Boost_INCLUDE_DIRS}" "${CMAKE_CURRENT_SOURCE_DIR}/dependencies/luabind")
OPTION(EQEMU_SANITIZE_LUA_LIBS "Sanitize Lua Libraries (Remove OS and IO standard libraries from being able to run)." ON)
IF(EQEMU_SANITIZE_LUA_LIBS)
@@ -325,11 +333,7 @@ IF(EQEMU_BUILD_LUA)
ENDIF(EQEMU_SANITIZE_LUA_LIBS)
ENDIF(EQEMU_BUILD_LUA)
INCLUDE_DIRECTORIES(SYSTEM "${ZLIB_INCLUDE_DIRS}" "${MySQL_INCLUDE_DIR}" "${CMAKE_CURRENT_SOURCE_DIR}/common/glm")
IF(EQEMU_BUILD_LUA)
ADD_SUBDIRECTORY(luabind)
ENDIF(EQEMU_BUILD_LUA)
INCLUDE_DIRECTORIES(SYSTEM "${ZLIB_INCLUDE_DIRS}" "${MySQL_INCLUDE_DIR}" "${CMAKE_CURRENT_SOURCE_DIR}/common/glm" "${CMAKE_CURRENT_SOURCE_DIR}/dependencies/libwebsockets" "${CMAKE_CURRENT_SOURCE_DIR}/common/rapidjson")
IF(EQEMU_BUILD_SERVER OR EQEMU_BUILD_LOGIN OR EQEMU_BUILD_TESTS)
ADD_SUBDIRECTORY(common)
@@ -341,6 +345,8 @@ IF(EQEMU_BUILD_SERVER)
ADD_SUBDIRECTORY(ucs)
ADD_SUBDIRECTORY(queryserv)
ADD_SUBDIRECTORY(eqlaunch)
ADD_SUBDIRECTORY(dependencies)
ADD_SUBDIRECTORY(web_interface)
ENDIF(EQEMU_BUILD_SERVER)
IF(EQEMU_BUILD_LOGIN)
ADD_SUBDIRECTORY(loginserver)
+2 -1
View File
@@ -1,7 +1,8 @@
EQEmu
===
[![Build Status](https://travis-ci.org/EQEmu/Server.svg?branch=master)](https://travis-ci.org/EQEmu/Server)
[![Linux CI](https://travis-ci.org/EQEmu/Server.svg?branch=master)](https://travis-ci.org/EQEmu/Server)
[![Windows CI](https://ci.appveyor.com/api/projects/status/d0cvokm7u732v8vl/branch/master?svg=true)](https://ci.appveyor.com/project/KimLS/server/branch/master)
Overview
---
+77
View File
@@ -1,5 +1,82 @@
EQEMu Changelog (Started on Sept 24, 2003 15:50)
-------------------------------------------------------
== 08/14/2016 ==
mackal: Implement Linked Spell Reuse Timers
- For whatever reason this is a bit unfriendly, but that's how it is on live.
- Titanium is especially unfriendly with large differences in reuse times (ex higher canni and the first 4)
- Unsure when this went live for spells, but canni was at least linked at OoW launch
== 08/13/2016 ==
Kinglykrab: Implemented optional avoidance cap rules.
- Serves to eliminate God-like characters on custom servers with high item stats
- Rule Names:
- Character:EnableAvoidanceCap (default is false)
- Character:AvoidanceCap (default is 750, beyond 1,000 seems to make characters dodge all attacks)
== 08/02/2016 ==
Uleat: Changed 'SendZoneSpawnsBulk' behavior to use near/far criteria (live-like) when sending packets.
- Zone-to-Zone client loading will see a small decrease in time (less than 10~15%)
- World-to-Zone client loading appears to greatly benefit from this (tested 'devastation' - pre-change: ~22 seconds, post-change: 12~15 seconds)
- This change does not affect the final spawning of mobs in the client
== 07/31/2016 ==
mackal: Implement more spell gems!
- There are a few things still left to due like make dealing with losing gems nice (reset AAs, going to an older client etc)
- Sadly SoF disc release doesn't support gem 10 like one might expect :(
- So changed clients:
- SoD = 10
- UF = 12
- RoF/RoF2 = 12. I know the UI supports 16, but the client does not and can cause client crashes
- The quest APIs assume you pass a valid spell gem ...
== 07/28/2016 ==
Uleat: Implemented zone memory-mapped file usage
- Zone map files are converted to pre-loaded binary files, bypassing the (sometimes) time-consuming raw data transform process
- There are three ways to convert files:
-- Do nothing! The zone bootup process will check for a mmf file and load it, if found, or create it after the 'normal' transform process is complete
-- Use the command line option: zone convert_map <zone_name>.map (for singular conversions)
-- Drop the 'convert_maps_to_mmfs.pl' into your server directory and execute it for a batch conversion
-- Note: Any zone maps not pre-converted will be processed once a zone is booted up that does not have one
- To enable this feature, you must have the 'USE_MAP_MMFS' option checked in cmake and have built binaries on that
- To disable this feature, or if you encouter problems, disable the 'USE_MAP_MMFS' option and rebuild your binaries
- This feature will test the validity of your zlib library. If you get errors/crashes upon conversion, then your zlib1.dll is most likely suspect (check our forum for solutions)
== 07/25/2016 ==
mackal: Fix up the SpellBuff struct
- THERE MAYBE BUGS
- there shouldn't though, most of the hackery was from badly named fields causing confusion
== 07/09/2016 ==
Uleat: Important fix for mob pathing
- This should fix failed pathing issues (and high cpu usage for zone.exe) for mobs in affect zones
- Changed variable 'gridno' type from int16 to int32 to reflect actual return value of fetch (values do exceed 32767 aka int16.max)
- Precision loss from int32 to int16 conversion was causing grid id to be changed to quest controlled movement in cases where (gridno & 0x8000 == true)
== 06/28/2016 ==
Noudess: Resurrection effects now block certain buffs like on live.
Noudess: Added message about why spells are blocked (rule based)
Noudess: Added new rule: Client:UseLiveBlockedMessage
Uleat: Fix for bot inventory save failure involving items with unlimited charges
== 06/13/2016 ==
Noudess: Changes personal faction earned min/max to -2000/2000 from -3000/1200
== 06/06/2016 ==
Uleat: Reworked EQEmuDictionary to use class LookupEntry
== 06/01/2016 ==
Uleat: Implemented EQEmu::TintProfile
Uleat: Implemented EQEmu::TextureProfile
== 05/31/2016 ==
Uleat: Converted enumeration MaterialSlots to EQEmu::textures::TextureSlot
== 05/28/2016 ==
Uleat: Merged client_version and inventory_version into emu_versions files
== 05/27/2016 ==
Uleat: Renamed EQEmu::Item_Struct to EQEmu::ItemBase (and appropriate files) to coincide with new inventory naming conventions
== 05/25/2016 ==
Uleat: Renamed and moved enumeration SkillUseTypes to EQEmu::skill::SkillType - added class EQEmu::SkillProfile, though not implemented at this time
Uleat: Some more work on eq_dictionary
+12 -6
View File
@@ -3,7 +3,6 @@ CMAKE_MINIMUM_REQUIRED(VERSION 2.8)
SET(common_sources
base_packet.cpp
classes.cpp
client_version.cpp
condition.cpp
crash.cpp
crc16.cpp
@@ -19,6 +18,7 @@ SET(common_sources
emu_opcodes.cpp
emu_tcp_connection.cpp
emu_tcp_server.cpp
emu_versions.cpp
eqdb.cpp
eqdb_res.cpp
eqemu_exception.cpp
@@ -35,12 +35,12 @@ SET(common_sources
faction.cpp
guild_base.cpp
guilds.cpp
inventory_version.cpp
ipc_mutex.cpp
item.cpp
item_struct.cpp
item_base.cpp
light_source.cpp
md5.cpp
memory_buffer.cpp
memory_mapped_file.cpp
misc.cpp
misc_functions.cpp
@@ -68,10 +68,13 @@ SET(common_sources
struct_strategy.cpp
tcp_connection.cpp
tcp_server.cpp
textures.cpp
timeoutmgr.cpp
timer.cpp
unix.cpp
uuid.cpp
worldconn.cpp
web_interface_utils.cpp
xml_parser.cpp
platform.cpp
patches/patches.cpp
@@ -111,7 +114,6 @@ SET(common_headers
base_data.h
bodytypes.h
classes.h
client_version.h
condition.h
crash.h
crc16.h
@@ -127,6 +129,7 @@ SET(common_headers
emu_oplist.h
emu_tcp_connection.h
emu_tcp_server.h
emu_versions.h
eq_constants.h
eq_packet_structs.h
eqdb.h
@@ -154,17 +157,17 @@ SET(common_headers
global_define.h
guild_base.h
guilds.h
inventory_version.h
ipc_mutex.h
item.h
item_base.h
item_fieldlist.h
item_struct.h
languages.h
light_source.h
linked_list.h
loottable.h
mail_oplist.h
md5.h
memory_buffer.h
memory_mapped_file.h
misc.h
misc_functions.h
@@ -199,13 +202,16 @@ SET(common_headers
tcp_basic_server.h
tcp_connection.h
tcp_server.h
textures.h
timeoutmgr.h
timer.h
types.h
unix.h
uuid.h
useperl.h
version.h
worldconn.h
web_interface_utils.h
xml_parser.h
zone_numbers.h
patches/patches.h
-128
View File
@@ -1,128 +0,0 @@
/* EQEMu: Everquest Server Emulator
Copyright (C) 2001-2016 EQEMu Development Team (http://eqemulator.net)
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; version 2 of the License.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY except by those people which sell it, which
are required to give you total support for your newly bought product;
without even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include "client_version.h"
bool EQEmu::versions::IsValidClientVersion(ClientVersion client_version)
{
if (client_version <= ClientVersion::Unknown || client_version > LastClientVersion)
return false;
return true;
}
EQEmu::versions::ClientVersion EQEmu::versions::ValidateClientVersion(ClientVersion client_version)
{
if (client_version <= ClientVersion::Unknown || client_version > LastClientVersion)
return ClientVersion::Unknown;
return client_version;
}
const char* EQEmu::versions::ClientVersionName(ClientVersion client_version)
{
switch (client_version) {
case ClientVersion::Unknown:
return "Unknown Version";
case ClientVersion::Client62:
return "Client 6.2";
case ClientVersion::Titanium:
return "Titanium";
case ClientVersion::SoF:
return "SoF";
case ClientVersion::SoD:
return "SoD";
case ClientVersion::UF:
return "UF";
case ClientVersion::RoF:
return "RoF";
case ClientVersion::RoF2:
return "RoF2";
default:
return "Invalid Version";
};
}
uint32 EQEmu::versions::ConvertClientVersionToClientVersionBit(ClientVersion client_version)
{
switch (client_version) {
case ClientVersion::Unknown:
case ClientVersion::Client62:
return bit_Unknown;
case ClientVersion::Titanium:
return bit_Titanium;
case ClientVersion::SoF:
return bit_SoF;
case ClientVersion::SoD:
return bit_SoD;
case ClientVersion::UF:
return bit_UF;
case ClientVersion::RoF:
return bit_RoF;
case ClientVersion::RoF2:
return bit_RoF2;
default:
return bit_Unknown;
}
}
EQEmu::versions::ClientVersion EQEmu::versions::ConvertClientVersionBitToClientVersion(uint32 client_version_bit)
{
switch (client_version_bit) {
case (uint32)static_cast<unsigned int>(ClientVersion::Unknown) :
case ((uint32)1 << (static_cast<unsigned int>(ClientVersion::Client62) - 1)) :
return ClientVersion::Unknown;
case ((uint32)1 << (static_cast<unsigned int>(ClientVersion::Titanium) - 1)) :
return ClientVersion::Titanium;
case ((uint32)1 << (static_cast<unsigned int>(ClientVersion::SoF) - 1)) :
return ClientVersion::SoF;
case ((uint32)1 << (static_cast<unsigned int>(ClientVersion::SoD) - 1)) :
return ClientVersion::SoD;
case ((uint32)1 << (static_cast<unsigned int>(ClientVersion::UF) - 1)) :
return ClientVersion::UF;
case ((uint32)1 << (static_cast<unsigned int>(ClientVersion::RoF) - 1)) :
return ClientVersion::RoF;
case ((uint32)1 << (static_cast<unsigned int>(ClientVersion::RoF2) - 1)) :
return ClientVersion::RoF2;
default:
return ClientVersion::Unknown;
}
}
uint32 EQEmu::versions::ConvertClientVersionToExpansion(ClientVersion client_version)
{
switch (client_version) {
case ClientVersion::Unknown:
case ClientVersion::Client62:
case ClientVersion::Titanium:
return 0x000007FFU;
case ClientVersion::SoF:
return 0x00007FFFU;
case ClientVersion::SoD:
return 0x0000FFFFU;
case ClientVersion::UF:
return 0x0001FFFFU;
case ClientVersion::RoF:
case ClientVersion::RoF2:
return 0x000FFFFFU;
default:
return 0;
}
}
+27 -20
View File
@@ -1,5 +1,6 @@
/* EQEMu: Everquest Server Emulator
Copyright (C) 2001-2014 EQEMu Development Team (http://eqemulator.net)
Copyright (C) 2001-2016 EQEMu Development Team (http://eqemulator.net)
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -13,36 +14,42 @@
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifndef COMMON_DATA_VERIFICATION_H
#define COMMON_DATA_VERIFICATION_H
#include <algorithm>
namespace EQEmu
{
template <typename T>
T Clamp(const T& value, const T& lower, const T& upper) {
return std::max(lower, std::min(value, upper));
}
template <typename T>
T Clamp(const T& value, const T& lower, const T& upper) {
return std::max(lower, std::min(value, upper));
}
template <typename T>
T ClampLower(const T& value, const T& lower) {
return std::max(lower, value);
}
template <typename T>
T ClampLower(const T& value, const T& lower) {
return std::max(lower, value);
}
template <typename T>
T ClampUpper(const T& value, const T& upper) {
return std::min(value, upper);
}
template <typename T>
T ClampUpper(const T& value, const T& upper) {
return std::min(value, upper);
}
template <typename T>
bool ValueWithin(const T& value, const T& lower, const T& upper) {
return value >= lower && value <= upper;
}
template <typename T>
bool ValueWithin(const T& value, const T& lower, const T& upper) {
return value >= lower && value <= upper;
}
template <typename T1, typename T2, typename T3>
bool ValueWithin(const T1& value, const T2& lower, const T3& upper) {
return value >= (T1)lower && value <= (T1)upper;
}
}
} /*EQEmu*/
#endif
#endif /*COMMON_DATA_VERIFICATION_H*/
+3 -3
View File
@@ -627,9 +627,9 @@ bool Database::SaveCharacterCreate(uint32 character_id, uint32 account_id, Playe
/* Save Bind Points */
query = StringFormat("REPLACE INTO `character_bind` (id, zone_id, instance_id, x, y, z, heading, slot)"
" VALUES (%u, %u, %u, %f, %f, %f, %f, %i), "
"(%u, %u, %u, %f, %f, %f, %f, %i), ",
"(%u, %u, %u, %f, %f, %f, %f, %i), ",
"(%u, %u, %u, %f, %f, %f, %f, %i), ",
"(%u, %u, %u, %f, %f, %f, %f, %i), "
"(%u, %u, %u, %f, %f, %f, %f, %i), "
"(%u, %u, %u, %f, %f, %f, %f, %i), "
"(%u, %u, %u, %f, %f, %f, %f, %i)",
character_id, pp->binds[0].zoneId, 0, pp->binds[0].x, pp->binds[0].y, pp->binds[0].z, pp->binds[0].heading, 0,
character_id, pp->binds[1].zoneId, 0, pp->binds[1].x, pp->binds[1].y, pp->binds[1].z, pp->binds[1].heading, 1,
+4 -4
View File
@@ -186,7 +186,7 @@ namespace Convert {
/*002*/ uint32 HP;
/*006*/ uint32 Mana;
/*010*/ Convert::SpellBuff_Struct Buffs[BUFF_COUNT];
/*510*/ uint32 Items[EQEmu::legacy::MaterialCount];
/*510*/ uint32 Items[EQEmu::textures::TextureCount];
/*546*/ char Name[64];
/*610*/
};
@@ -227,9 +227,9 @@ namespace Convert {
/*0304*/ uint8 ability_time_minutes;
/*0305*/ uint8 ability_time_hours; //place holder
/*0306*/ uint8 unknown0306[6]; // @bp Spacer/Flag?
/*0312*/ uint32 item_material[EQEmu::legacy::MaterialCount]; // Item texture/material of worn/held items
/*0312*/ uint32 item_material[EQEmu::textures::TextureCount]; // Item texture/material of worn/held items
/*0348*/ uint8 unknown0348[44];
/*0392*/ Convert::Color_Struct item_tint[EQEmu::legacy::MaterialCount];
/*0392*/ Convert::Color_Struct item_tint[EQEmu::textures::TextureCount];
/*0428*/ Convert::AA_Array aa_array[MAX_PP_AA_ARRAY];
/*2348*/ float unknown2384; //seen ~128, ~47
/*2352*/ char servername[32]; // length probably not right
@@ -1416,7 +1416,7 @@ bool Database::CheckDatabaseConvertPPDeblob(){
if (rquery != ""){ results = QueryDatabase(rquery); }
/* Run Material Color Convert */
first_entry = 0; rquery = "";
for (i = 0; i < EQEmu::legacy::MaterialCount; i++){
for (i = 0; i < EQEmu::textures::TextureCount; i++){
if (pp->item_tint[i].color > 0){
if (first_entry != 1){
rquery = StringFormat("REPLACE INTO `character_material` (id, slot, blue, green, red, use_tint, color) VALUES (%u, %u, %u, %u, %u, %u, %u)", character_id, i, pp->item_tint[i].rgb.blue, pp->item_tint[i].rgb.green, pp->item_tint[i].rgb.red, pp->item_tint[i].rgb.use_tint, pp->item_tint[i].color);
+21 -3
View File
@@ -22,9 +22,7 @@
#include "eq_limits.h"
#include "emu_legacy.h"
#include "inventory_version.h"
//#include "deity.h"
//#include "say_link.h"
#include "emu_versions.h"
#include <string>
@@ -46,6 +44,26 @@ namespace EQEmu
const size_t SayLinkBodySize = RoF2::constants::SayLinkBodySize;
} /*constants*/
enum class CastingSlot : uint32 {
Gem1 = 0,
Gem2 = 1,
Gem3 = 2,
Gem4 = 3,
Gem5 = 4,
Gem6 = 5,
Gem7 = 6,
Gem8 = 7,
Gem9 = 8,
Gem10 = 9,
Gem11 = 10,
Gem12 = 11,
MaxGems = 12,
Ability = 20, // HT/LoH for Tit
PotionBelt = 21, // Tit uses a different slot for PB
Item = 22,
Discipline = 23,
AltAbility = 0xFF
};
} /*EQEmu*/
-19
View File
@@ -163,20 +163,6 @@ namespace EQEmu
SlotCount
};
enum MaterialSlots : uint8 {
MaterialHead = 0,
MaterialChest,
MaterialArms,
MaterialWrist,
MaterialHands,
MaterialLegs, // 5
MaterialFeet,
MaterialPrimary,
MaterialSecondary,
MaterialCount,
MaterialInvalid = 255
};
// these are currently hard-coded for existing inventory system..do not use in place of special client version handlers until ready
static const uint16 TYPE_POSSESSIONS_SIZE = SlotCount;
static const uint16 TYPE_BANK_SIZE = 24;
@@ -251,11 +237,6 @@ namespace EQEmu
static const int16 CORPSE_BEGIN = 22;
//static const int16 CORPSE_END = RoF::consts::CORPSE_END; // not ready for use
static const int16 MATERIAL_BEGIN = MaterialHead;
static const int16 MATERIAL_END = MaterialSecondary;
static const int16 MATERIAL_TINT_END = MaterialFeet;
static const int16 MATERIAL_SIZE = MaterialCount;
// items
// common and container sizes will not increase until the new 'location' struct is implemented
static const uint16 ITEM_COMMON_SIZE = 6;//RoF::consts::ITEM_COMMON_SIZE;
+2 -2
View File
@@ -1,4 +1,4 @@
/* EQEMu: Everquest Server Emulator
/* EQEMu: Everquest Server Emulator
Copyright (C) 2001-2016 EQEMu Development Team (http://eqemulator.net)
@@ -10,7 +10,7 @@
but WITHOUT ANY WARRANTY except by those people which sell it, which
are required to give you total support for your newly bought product;
without even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE. See the GNU General Public License for more details.
A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
+58 -10
View File
@@ -1,4 +1,4 @@
/* EQEMu: Everquest Server Emulator
/* EQEMu: Everquest Server Emulator
Copyright (C) 2001-2016 EQEMu Development Team (http://eqemulator.net)
@@ -10,7 +10,7 @@
but WITHOUT ANY WARRANTY except by those people which sell it, which
are required to give you total support for your newly bought product;
without even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE. See the GNU General Public License for more details.
A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
@@ -27,29 +27,77 @@
namespace EntityLimits
{
namespace npc {
namespace NPC {
enum : int { Invalid = -1, Null, Safety };
enum : bool { False = false, True = true };
}
namespace merc {
const size_t InvTypeTradeSize = 4;
} /*NPC*/
namespace NPCMerchant {
enum : int { Invalid = -1, Null, Safety };
enum : bool { False = false, True = true };
}
namespace bot {
const size_t InvTypeTradeSize = 4;
} /*NPCMerchant*/
namespace Merc {
enum : int { Invalid = -1, Null, Safety };
enum : bool { False = false, True = true };
}
namespace pet {
const size_t InvTypeTradeSize = 4;
} /*Merc*/
namespace Bot {
enum : int { Invalid = -1, Null, Safety };
enum : bool { False = false, True = true };
}
const size_t InvTypeTradeSize = 8;
} /*Bot*/
namespace ClientPet {
enum : int { Invalid = -1, Null, Safety };
enum : bool { False = false, True = true };
const size_t InvTypeTradeSize = 4;
} /*Pet*/
namespace NPCPet {
enum : int { Invalid = -1, Null, Safety };
enum : bool { False = false, True = true };
const size_t InvTypeTradeSize = 4;
} /*Pet*/
namespace MercPet {
enum : int { Invalid = -1, Null, Safety };
enum : bool { False = false, True = true };
const size_t InvTypeTradeSize = 4;
} /*Pet*/
namespace BotPet {
enum : int { Invalid = -1, Null, Safety };
enum : bool { False = false, True = true };
const size_t InvTypeTradeSize = 4;
} /*Pet*/
}; /*EntityLimits*/
+2
View File
@@ -64,6 +64,7 @@ N(OP_BuffRemoveRequest),
N(OP_Bug),
N(OP_CameraEffect),
N(OP_Camp),
N(OP_CancelSneakHide),
N(OP_CancelTask),
N(OP_CancelTrade),
N(OP_CastSpell),
@@ -288,6 +289,7 @@ N(OP_LFGuild),
N(OP_LFPCommand),
N(OP_LFPGetMatchesRequest),
N(OP_LFPGetMatchesResponse),
N(OP_LinkedReuse),
N(OP_LoadSpellSet),
N(OP_LocInfo),
N(OP_LockoutTimerInfo),
+23
View File
@@ -363,6 +363,22 @@ bool EmuTCPConnection::LineOutQueuePush(char* line) {
safe_delete_array(line);
return(true);
}
if (strcmp(line, "**PACKETMODEWI**") == 0) {
MSendQueue.lock();
safe_delete_array(sendbuf);
if (TCPMode == modeConsole)
Send((const uchar*) "\0**PACKETMODEWI**\r", 18);
TCPMode = modePacket;
PacketMode = packetModeWebInterface;
EmuTCPNetPacket_Struct* tnps = 0;
while ((tnps = InModeQueue.pop())) {
SendPacket(tnps);
safe_delete_array(tnps);
}
MSendQueue.unlock();
safe_delete_array(line);
return(true);
}
}
return(TCPConnection::LineOutQueuePush(line));
@@ -416,6 +432,13 @@ bool EmuTCPConnection::ConnectIP(uint32 irIP, uint16 irPort, char* errbuf) {
sendbuf = new uchar[sendbuf_size];
memcpy(sendbuf, "\0**PACKETMODEQS**\r", sendbuf_size);
}
else if (PacketMode == packetModeWebInterface) {
safe_delete_array(sendbuf);
sendbuf_size = 18;
sendbuf_used = sendbuf_size;
sendbuf = new uchar[sendbuf_size];
memcpy(sendbuf, "\0**PACKETMODEWI**\r", sendbuf_size);
}
else {
//default: packetModeZone
safe_delete_array(sendbuf);
+1 -1
View File
@@ -31,7 +31,7 @@ class ServerPacket;
class EmuTCPConnection : public TCPConnection {
public:
enum eTCPMode { modeConsole, modeTransition, modePacket };
enum ePacketMode { packetModeZone, packetModeLauncher, packetModeLogin, packetModeUCS, packetModeQueryServ };
enum ePacketMode { packetModeZone, packetModeLauncher, packetModeLogin, packetModeUCS, packetModeQueryServ, packetModeWebInterface };
EmuTCPConnection(uint32 ID, EmuTCPServer* iServer, SOCKET iSock, uint32 irIP, uint16 irPort, bool iOldFormat = false);
EmuTCPConnection(bool iOldFormat = false, EmuTCPServer* iRelayServer = 0, eTCPMode iMode = modePacket); // for outgoing connections
+370
View File
@@ -0,0 +1,370 @@
/* EQEMu: Everquest Server Emulator
Copyright (C) 2001-2016 EQEMu Development Team (http://eqemulator.net)
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; version 2 of the License.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY except by those people which sell it, which
are required to give you total support for your newly bought product;
without even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include "emu_versions.h"
bool EQEmu::versions::IsValidClientVersion(ClientVersion client_version)
{
if (client_version <= ClientVersion::Unknown || client_version > LastClientVersion)
return false;
return true;
}
EQEmu::versions::ClientVersion EQEmu::versions::ValidateClientVersion(ClientVersion client_version)
{
if (client_version <= ClientVersion::Unknown || client_version > LastClientVersion)
return ClientVersion::Unknown;
return client_version;
}
const char* EQEmu::versions::ClientVersionName(ClientVersion client_version)
{
switch (client_version) {
case ClientVersion::Unknown:
return "Unknown Version";
case ClientVersion::Client62:
return "Client 6.2";
case ClientVersion::Titanium:
return "Titanium";
case ClientVersion::SoF:
return "SoF";
case ClientVersion::SoD:
return "SoD";
case ClientVersion::UF:
return "UF";
case ClientVersion::RoF:
return "RoF";
case ClientVersion::RoF2:
return "RoF2";
default:
return "Invalid Version";
};
}
uint32 EQEmu::versions::ConvertClientVersionToClientVersionBit(ClientVersion client_version)
{
switch (client_version) {
case ClientVersion::Unknown:
case ClientVersion::Client62:
return bit_Unknown;
case ClientVersion::Titanium:
return bit_Titanium;
case ClientVersion::SoF:
return bit_SoF;
case ClientVersion::SoD:
return bit_SoD;
case ClientVersion::UF:
return bit_UF;
case ClientVersion::RoF:
return bit_RoF;
case ClientVersion::RoF2:
return bit_RoF2;
default:
return bit_Unknown;
}
}
EQEmu::versions::ClientVersion EQEmu::versions::ConvertClientVersionBitToClientVersion(uint32 client_version_bit)
{
switch (client_version_bit) {
case (uint32)static_cast<unsigned int>(ClientVersion::Unknown) :
case ((uint32)1 << (static_cast<unsigned int>(ClientVersion::Client62) - 1)) :
return ClientVersion::Unknown;
case ((uint32)1 << (static_cast<unsigned int>(ClientVersion::Titanium) - 1)) :
return ClientVersion::Titanium;
case ((uint32)1 << (static_cast<unsigned int>(ClientVersion::SoF) - 1)) :
return ClientVersion::SoF;
case ((uint32)1 << (static_cast<unsigned int>(ClientVersion::SoD) - 1)) :
return ClientVersion::SoD;
case ((uint32)1 << (static_cast<unsigned int>(ClientVersion::UF) - 1)) :
return ClientVersion::UF;
case ((uint32)1 << (static_cast<unsigned int>(ClientVersion::RoF) - 1)) :
return ClientVersion::RoF;
case ((uint32)1 << (static_cast<unsigned int>(ClientVersion::RoF2) - 1)) :
return ClientVersion::RoF2;
default:
return ClientVersion::Unknown;
}
}
uint32 EQEmu::versions::ConvertClientVersionToExpansion(ClientVersion client_version)
{
switch (client_version) {
case ClientVersion::Unknown:
case ClientVersion::Client62:
case ClientVersion::Titanium:
return 0x000007FFU;
case ClientVersion::SoF:
return 0x00007FFFU;
case ClientVersion::SoD:
return 0x0000FFFFU;
case ClientVersion::UF:
return 0x0001FFFFU;
case ClientVersion::RoF:
case ClientVersion::RoF2:
return 0x000FFFFFU;
default:
return 0;
}
}
bool EQEmu::versions::IsValidInventoryVersion(InventoryVersion inventory_version)
{
if (inventory_version <= InventoryVersion::Unknown || inventory_version > LastInventoryVersion)
return false;
return true;
}
bool EQEmu::versions::IsValidPCInventoryVersion(InventoryVersion inventory_version)
{
if (inventory_version <= InventoryVersion::Unknown || inventory_version > LastPCInventoryVersion)
return false;
return true;
}
bool EQEmu::versions::IsValidNonPCInventoryVersion(InventoryVersion inventory_version)
{
if (inventory_version <= LastPCInventoryVersion || inventory_version > LastNonPCInventoryVersion)
return false;
return true;
}
bool EQEmu::versions::IsValidOfflinePCInventoryVersion(InventoryVersion inventory_version)
{
if (inventory_version <= LastNonPCInventoryVersion || inventory_version > LastOfflinePCInventoryVersion)
return false;
return true;
}
EQEmu::versions::InventoryVersion EQEmu::versions::ValidateInventoryVersion(InventoryVersion inventory_version)
{
if (inventory_version <= InventoryVersion::Unknown || inventory_version > LastInventoryVersion)
return InventoryVersion::Unknown;
return inventory_version;
}
EQEmu::versions::InventoryVersion EQEmu::versions::ValidatePCInventoryVersion(InventoryVersion inventory_version)
{
if (inventory_version <= InventoryVersion::Unknown || inventory_version > LastPCInventoryVersion)
return InventoryVersion::Unknown;
return inventory_version;
}
EQEmu::versions::InventoryVersion EQEmu::versions::ValidateNonPCInventoryVersion(InventoryVersion inventory_version)
{
if (inventory_version <= LastPCInventoryVersion || inventory_version > LastNonPCInventoryVersion)
return InventoryVersion::Unknown;
return inventory_version;
}
EQEmu::versions::InventoryVersion EQEmu::versions::ValidateOfflinePCInventoryVersion(InventoryVersion inventory_version)
{
if (inventory_version <= LastNonPCInventoryVersion || inventory_version > LastOfflinePCInventoryVersion)
return InventoryVersion::Unknown;
return inventory_version;
}
const char* EQEmu::versions::InventoryVersionName(InventoryVersion inventory_version)
{
switch (inventory_version) {
case InventoryVersion::Unknown:
return "Unknown Version";
case InventoryVersion::Client62:
return "Client 6.2";
case InventoryVersion::Titanium:
return "Titanium";
case InventoryVersion::SoF:
return "SoF";
case InventoryVersion::SoD:
return "SoD";
case InventoryVersion::UF:
return "UF";
case InventoryVersion::RoF:
return "RoF";
case InventoryVersion::RoF2:
return "RoF2";
case InventoryVersion::NPC:
return "NPC";
case InventoryVersion::NPCMerchant:
return "NPC Merchant";
case InventoryVersion::Merc:
return "Merc";
case InventoryVersion::Bot:
return "Bot";
case InventoryVersion::ClientPet:
return "Client Pet";
case InventoryVersion::NPCPet:
return "NPC Pet";
case InventoryVersion::MercPet:
return "Merc Pet";
case InventoryVersion::BotPet:
return "Bot Pet";
case InventoryVersion::OfflineTitanium:
return "Offline Titanium";
case InventoryVersion::OfflineSoF:
return "Offline SoF";
case InventoryVersion::OfflineSoD:
return "Offline SoD";
case InventoryVersion::OfflineUF:
return "Offline UF";
case InventoryVersion::OfflineRoF:
return "Offline RoF";
case InventoryVersion::OfflineRoF2:
return "Offline RoF2";
default:
return "Invalid Version";
};
}
EQEmu::versions::ClientVersion EQEmu::versions::ConvertInventoryVersionToClientVersion(InventoryVersion inventory_version)
{
switch (inventory_version) {
case InventoryVersion::Unknown:
case InventoryVersion::Client62:
return ClientVersion::Unknown;
case InventoryVersion::Titanium:
return ClientVersion::Titanium;
case InventoryVersion::SoF:
return ClientVersion::SoF;
case InventoryVersion::SoD:
return ClientVersion::SoD;
case InventoryVersion::UF:
return ClientVersion::UF;
case InventoryVersion::RoF:
return ClientVersion::RoF;
case InventoryVersion::RoF2:
return ClientVersion::RoF2;
default:
return ClientVersion::Unknown;
}
}
EQEmu::versions::InventoryVersion EQEmu::versions::ConvertClientVersionToInventoryVersion(ClientVersion client_version)
{
switch (client_version) {
case ClientVersion::Unknown:
case ClientVersion::Client62:
return InventoryVersion::Unknown;
case ClientVersion::Titanium:
return InventoryVersion::Titanium;
case ClientVersion::SoF:
return InventoryVersion::SoF;
case ClientVersion::SoD:
return InventoryVersion::SoD;
case ClientVersion::UF:
return InventoryVersion::UF;
case ClientVersion::RoF:
return InventoryVersion::RoF;
case ClientVersion::RoF2:
return InventoryVersion::RoF2;
default:
return InventoryVersion::Unknown;
}
}
EQEmu::versions::InventoryVersion EQEmu::versions::ConvertPCInventoryVersionToOfflinePCInventoryVersion(InventoryVersion inventory_version)
{
switch (inventory_version) {
case InventoryVersion::Titanium:
return InventoryVersion::OfflineTitanium;
case InventoryVersion::SoF:
return InventoryVersion::OfflineSoF;
case InventoryVersion::SoD:
return InventoryVersion::OfflineSoD;
case InventoryVersion::UF:
return InventoryVersion::OfflineUF;
case InventoryVersion::RoF:
return InventoryVersion::OfflineRoF;
case InventoryVersion::RoF2:
return InventoryVersion::OfflineRoF2;
default:
return InventoryVersion::Unknown;
}
}
EQEmu::versions::InventoryVersion EQEmu::versions::ConvertOfflinePCInventoryVersionToPCInventoryVersion(InventoryVersion inventory_version)
{
switch (inventory_version) {
case InventoryVersion::OfflineTitanium:
return InventoryVersion::Titanium;
case InventoryVersion::OfflineSoF:
return InventoryVersion::SoF;
case InventoryVersion::OfflineSoD:
return InventoryVersion::SoD;
case InventoryVersion::OfflineUF:
return InventoryVersion::UF;
case InventoryVersion::OfflineRoF:
return InventoryVersion::RoF;
case InventoryVersion::OfflineRoF2:
return InventoryVersion::RoF2;
default:
return InventoryVersion::Unknown;
}
}
EQEmu::versions::ClientVersion EQEmu::versions::ConvertOfflinePCInventoryVersionToClientVersion(InventoryVersion inventory_version)
{
switch (inventory_version) {
case InventoryVersion::OfflineTitanium:
return ClientVersion::Titanium;
case InventoryVersion::OfflineSoF:
return ClientVersion::SoF;
case InventoryVersion::OfflineSoD:
return ClientVersion::SoD;
case InventoryVersion::OfflineUF:
return ClientVersion::UF;
case InventoryVersion::OfflineRoF:
return ClientVersion::RoF;
case InventoryVersion::OfflineRoF2:
return ClientVersion::RoF2;
default:
return ClientVersion::Unknown;
}
}
EQEmu::versions::InventoryVersion EQEmu::versions::ConvertClientVersionToOfflinePCInventoryVersion(ClientVersion client_version)
{
switch (client_version) {
case ClientVersion::Titanium:
return InventoryVersion::OfflineTitanium;
case ClientVersion::SoF:
return InventoryVersion::OfflineSoF;
case ClientVersion::SoD:
return InventoryVersion::OfflineSoD;
case ClientVersion::UF:
return InventoryVersion::OfflineUF;
case ClientVersion::RoF:
return InventoryVersion::OfflineRoF;
case ClientVersion::RoF2:
return InventoryVersion::OfflineRoF2;
default:
return InventoryVersion::Unknown;
}
}
@@ -17,8 +17,8 @@
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifndef COMMON_CLIENT_VERSION_H
#define COMMON_CLIENT_VERSION_H
#ifndef COMMON_EMU_VERSIONS_H
#define COMMON_EMU_VERSIONS_H
#include "types.h"
@@ -61,8 +61,8 @@ namespace EQEmu
bit_AllClients = 0xFFFFFFFF
};
static const ClientVersion LastClientVersion = ClientVersion::RoF2;
static const size_t ClientVersionCount = (static_cast<size_t>(LastClientVersion) + 1);
const ClientVersion LastClientVersion = ClientVersion::RoF2;
const size_t ClientVersionCount = (static_cast<size_t>(LastClientVersion) + 1);
extern bool IsValidClientVersion(ClientVersion client_version);
extern ClientVersion ValidateClientVersion(ClientVersion client_version);
@@ -70,9 +70,61 @@ namespace EQEmu
extern uint32 ConvertClientVersionToClientVersionBit(ClientVersion client_version);
extern ClientVersion ConvertClientVersionBitToClientVersion(uint32 client_version_bit);
extern uint32 ConvertClientVersionToExpansion(ClientVersion client_version);
} /*versions*/
namespace versions {
enum class InventoryVersion {
Unknown = 0,
Client62,
Titanium,
SoF,
SoD,
UF,
RoF,
RoF2,
NPC,
NPCMerchant,
Merc,
Bot,
ClientPet,
NPCPet,
MercPet,
BotPet,
OfflineTitanium,
OfflineSoF,
OfflineSoD,
OfflineUF,
OfflineRoF,
OfflineRoF2
};
const InventoryVersion LastInventoryVersion = InventoryVersion::OfflineRoF2;
const InventoryVersion LastPCInventoryVersion = InventoryVersion::RoF2;
const InventoryVersion LastNonPCInventoryVersion = InventoryVersion::BotPet;
const InventoryVersion LastOfflinePCInventoryVersion = InventoryVersion::OfflineRoF2;
const size_t InventoryVersionCount = (static_cast<size_t>(LastInventoryVersion) + 1);
extern bool IsValidInventoryVersion(InventoryVersion inventory_version);
extern bool IsValidPCInventoryVersion(InventoryVersion inventory_version);
extern bool IsValidNonPCInventoryVersion(InventoryVersion inventory_version);
extern bool IsValidOfflinePCInventoryVersion(InventoryVersion inventory_version);
extern InventoryVersion ValidateInventoryVersion(InventoryVersion inventory_version);
extern InventoryVersion ValidatePCInventoryVersion(InventoryVersion inventory_version);
extern InventoryVersion ValidateNonPCInventoryVersion(InventoryVersion inventory_version);
extern InventoryVersion ValidateOfflinePCInventoryVersion(InventoryVersion inventory_version);
extern const char* InventoryVersionName(InventoryVersion inventory_version);
extern ClientVersion ConvertInventoryVersionToClientVersion(InventoryVersion inventory_version);
extern InventoryVersion ConvertClientVersionToInventoryVersion(ClientVersion client_version);
extern InventoryVersion ConvertPCInventoryVersionToOfflinePCInventoryVersion(InventoryVersion inventory_version);
extern InventoryVersion ConvertOfflinePCInventoryVersionToPCInventoryVersion(InventoryVersion inventory_version);
extern ClientVersion ConvertOfflinePCInventoryVersionToClientVersion(InventoryVersion inventory_version);
extern InventoryVersion ConvertClientVersionToOfflinePCInventoryVersion(ClientVersion client_version);
} /*versions*/
} /*EQEmu*/
#endif /*COMMON_CLIENT_VERSION_H*/
#endif /*COMMON_EMU_VERSIONS_H*/
-1
View File
@@ -516,7 +516,6 @@ static const uint8 SkillDamageTypes[EQEmu::skills::HIGHEST_SKILL + 1] = // chang
*/
#define INVALID_INDEX -1
#define NOT_USED 0
#define NO_ITEM 0
// yes..these are redundant... but, they help to identify and define what is actually being performed
+344 -484
View File
@@ -1,4 +1,4 @@
/* EQEMu: Everquest Server Emulator
/* EQEMu: Everquest Server Emulator
Copyright (C) 2001-2016 EQEMu Development Team (http://eqemulator.net)
@@ -10,7 +10,7 @@
but WITHOUT ANY WARRANTY except by those people which sell it, which
are required to give you total support for your newly bought product;
without even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE. See the GNU General Public License for more details.
A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
@@ -21,501 +21,361 @@
#include "emu_limits.h"
size_t EQEmu::constants::CharacterCreationLimit(versions::ClientVersion client_version)
static const EQEmu::constants::LookupEntry constants_lookup_entries[EQEmu::versions::ClientVersionCount] =
{
static const size_t local[versions::ClientVersionCount] = {
ClientUnknown::Null,
Client62::Null,
Titanium::constants::CharacterCreationLimit,
SoF::constants::CharacterCreationLimit,
SoD::constants::CharacterCreationLimit,
UF::constants::CharacterCreationLimit,
RoF::constants::CharacterCreationLimit,
{ // Unknown
ClientUnknown::Null
},
{ // Client62
Client62::Null
},
{ // Titanium
Titanium::constants::CharacterCreationLimit
},
{ // SoF
SoF::constants::CharacterCreationLimit
},
{ // SoD
SoD::constants::CharacterCreationLimit
},
{ // UF
UF::constants::CharacterCreationLimit
},
{ // RoF
RoF::constants::CharacterCreationLimit
},
{ // RoF2
RoF2::constants::CharacterCreationLimit
};
}
};
return local[static_cast<size_t>(versions::ValidateClientVersion(client_version))];
}
uint16 EQEmu::inventory::InventoryTypeSize(versions::InventoryVersion inventory_version, int16 inv_type)
const EQEmu::constants::LookupEntry* EQEmu::constants::Lookup(versions::ClientVersion client_version)
{
static const uint16 local[legacy::TypeCount][versions::InventoryVersionCount] = {
{ // local[TypePossessions]
ClientUnknown::Null,
Client62::Null,
legacy::TYPE_POSSESSIONS_SIZE,
legacy::TYPE_POSSESSIONS_SIZE,
legacy::TYPE_POSSESSIONS_SIZE,
legacy::TYPE_POSSESSIONS_SIZE,
legacy::TYPE_POSSESSIONS_SIZE,
legacy::TYPE_POSSESSIONS_SIZE,
legacy::TYPE_POSSESSIONS_SIZE,
legacy::TYPE_POSSESSIONS_SIZE,
legacy::TYPE_POSSESSIONS_SIZE,
legacy::TYPE_POSSESSIONS_SIZE
},
{ // local[TypeBank]
ClientUnknown::Null,
Client62::Null,
Titanium::invtype::InvTypeBankSize,
legacy::TYPE_BANK_SIZE,
legacy::TYPE_BANK_SIZE,
legacy::TYPE_BANK_SIZE,
legacy::TYPE_BANK_SIZE,
legacy::TYPE_BANK_SIZE,
EntityLimits::npc::Null,
EntityLimits::merc::Null,
EntityLimits::bot::Null,
EntityLimits::pet::Null
},
{ // local[TypeSharedBank]
ClientUnknown::Null,
Client62::Null,
legacy::TYPE_SHARED_BANK_SIZE,
legacy::TYPE_SHARED_BANK_SIZE,
legacy::TYPE_SHARED_BANK_SIZE,
legacy::TYPE_SHARED_BANK_SIZE,
legacy::TYPE_SHARED_BANK_SIZE,
legacy::TYPE_SHARED_BANK_SIZE,
EntityLimits::npc::Null,
EntityLimits::merc::Null,
EntityLimits::bot::Null,
EntityLimits::pet::Null
},
{ // local[TypeTrade]
ClientUnknown::Null,
Client62::Null,
legacy::TYPE_TRADE_SIZE,
legacy::TYPE_TRADE_SIZE,
legacy::TYPE_TRADE_SIZE,
legacy::TYPE_TRADE_SIZE,
legacy::TYPE_TRADE_SIZE,
legacy::TYPE_TRADE_SIZE,
4,
4,
legacy::TYPE_TRADE_SIZE, // client thinks this is another client
4
},
{ // local[TypeWorld]
ClientUnknown::Null,
Client62::Null,
legacy::TYPE_WORLD_SIZE,
legacy::TYPE_WORLD_SIZE,
legacy::TYPE_WORLD_SIZE,
legacy::TYPE_WORLD_SIZE,
legacy::TYPE_WORLD_SIZE,
legacy::TYPE_WORLD_SIZE,
EntityLimits::npc::Null,
EntityLimits::merc::Null,
EntityLimits::bot::Null,
EntityLimits::pet::Null
},
{ // local[TypeLimbo]
ClientUnknown::Null,
Client62::Null,
legacy::TYPE_LIMBO_SIZE,
legacy::TYPE_LIMBO_SIZE,
legacy::TYPE_LIMBO_SIZE,
legacy::TYPE_LIMBO_SIZE,
legacy::TYPE_LIMBO_SIZE,
legacy::TYPE_LIMBO_SIZE,
EntityLimits::npc::Null,
EntityLimits::merc::Null,
EntityLimits::bot::Null,
EntityLimits::pet::Null
},
{ // local[TypeTribute]
ClientUnknown::Null,
Client62::Null,
legacy::TYPE_TRIBUTE_SIZE,
legacy::TYPE_TRIBUTE_SIZE,
legacy::TYPE_TRIBUTE_SIZE,
legacy::TYPE_TRIBUTE_SIZE,
legacy::TYPE_TRIBUTE_SIZE,
legacy::TYPE_TRIBUTE_SIZE,
EntityLimits::npc::Null,
EntityLimits::merc::Null,
EntityLimits::bot::Null,
EntityLimits::pet::Null
},
{ // local[TypeTrophyTribute]
ClientUnknown::Null,
Client62::Null,
Titanium::Null,
SoF::Null,
SoD::Null,
UF::Null,
legacy::TYPE_TROPHY_TRIBUTE_SIZE,
legacy::TYPE_TROPHY_TRIBUTE_SIZE,
EntityLimits::npc::Null,
EntityLimits::merc::Null,
EntityLimits::bot::Null,
EntityLimits::pet::Null
},
{ // local[TypeGuildTribute]
ClientUnknown::Null,
Client62::Null,
Titanium::Null,
SoF::Null,
SoD::Null,
UF::Null,
legacy::TYPE_GUILD_TRIBUTE_SIZE,
legacy::TYPE_GUILD_TRIBUTE_SIZE,
EntityLimits::npc::Null,
EntityLimits::merc::Null,
EntityLimits::bot::Null,
EntityLimits::pet::Null
},
{ // local[TypeMerchant]
ClientUnknown::Null,
Client62::Null,
Titanium::Null,
SoF::Null,
SoD::Null,
UF::Null,
legacy::TYPE_MERCHANT_SIZE,
legacy::TYPE_MERCHANT_SIZE,
EntityLimits::npc::Null,
EntityLimits::merc::Null,
EntityLimits::bot::Null,
EntityLimits::pet::Null
},
{ // local[TypeDeleted]
ClientUnknown::Null,
Client62::Null,
Titanium::Null,
SoF::Null,
SoD::Null,
UF::Null,
legacy::TYPE_DELETED_SIZE,
legacy::TYPE_DELETED_SIZE,
EntityLimits::npc::Null,
EntityLimits::merc::Null,
EntityLimits::bot::Null,
EntityLimits::pet::Null
},
{ // local[TypeCorpse]
ClientUnknown::Null,
Client62::Null,
Titanium::invtype::InvTypeCorpseSize,
SoF::invtype::InvTypeCorpseSize,
SoD::invtype::InvTypeCorpseSize,
UF::invtype::InvTypeCorpseSize,
RoF::invtype::InvTypeCorpseSize,
RoF2::invtype::InvTypeCorpseSize,
EntityLimits::npc::Null,
EntityLimits::merc::Null,
EntityLimits::bot::Null,
EntityLimits::pet::Null
},
{ // local[TypeBazaar]
ClientUnknown::Null,
Client62::Null,
legacy::TYPE_BAZAAR_SIZE,
legacy::TYPE_BAZAAR_SIZE,
legacy::TYPE_BAZAAR_SIZE,
legacy::TYPE_BAZAAR_SIZE,
legacy::TYPE_BAZAAR_SIZE,
legacy::TYPE_BAZAAR_SIZE,
EntityLimits::npc::Null,
EntityLimits::merc::Null,
EntityLimits::bot::Null,
EntityLimits::pet::Null
},
{ // local[TypeInspect]
ClientUnknown::Null,
Client62::Null,
Titanium::invtype::InvTypeInspectSize,
SoF::invtype::InvTypeInspectSize,
SoD::invtype::InvTypeInspectSize,
UF::invtype::InvTypeInspectSize,
RoF::invtype::InvTypeInspectSize,
RoF2::invtype::InvTypeInspectSize,
EntityLimits::npc::Null,
EntityLimits::merc::Null,
EntityLimits::bot::Null,
EntityLimits::pet::Null
},
{ // local[TypeRealEstate]
ClientUnknown::Null,
Client62::Null,
Titanium::Null,
SoF::Null,
SoD::Null,
UF::Null,
legacy::TYPE_REAL_ESTATE_SIZE,
legacy::TYPE_REAL_ESTATE_SIZE,
EntityLimits::npc::Null,
EntityLimits::merc::Null,
EntityLimits::bot::Null,
EntityLimits::pet::Null
},
{ // local[TypeViewMODPC]
ClientUnknown::Null,
Client62::Null,
Titanium::Null,
SoF::Null,
SoD::Null,
UF::Null,
legacy::TYPE_VIEW_MOD_PC_SIZE,
legacy::TYPE_VIEW_MOD_PC_SIZE,
EntityLimits::npc::Null,
EntityLimits::merc::Null,
EntityLimits::bot::Null,
EntityLimits::pet::Null
},
{ // local[TypeViewMODBank]
ClientUnknown::Null,
Client62::Null,
Titanium::Null,
SoF::Null,
SoD::Null,
UF::Null,
legacy::TYPE_VIEW_MOD_BANK_SIZE,
legacy::TYPE_VIEW_MOD_BANK_SIZE,
EntityLimits::npc::Null,
EntityLimits::merc::Null,
EntityLimits::bot::Null,
EntityLimits::pet::Null
},
{ // local[TypeViewMODSharedBank]
ClientUnknown::Null,
Client62::Null,
Titanium::Null,
SoF::Null,
SoD::Null,
UF::Null,
legacy::TYPE_VIEW_MOD_SHARED_BANK_SIZE,
legacy::TYPE_VIEW_MOD_SHARED_BANK_SIZE,
EntityLimits::npc::Null,
EntityLimits::merc::Null,
EntityLimits::bot::Null,
EntityLimits::pet::Null
},
{ // local[TypeViewMODLimbo]
ClientUnknown::Null,
Client62::Null,
Titanium::Null,
SoF::Null,
SoD::Null,
UF::Null,
legacy::TYPE_VIEW_MOD_LIMBO_SIZE,
legacy::TYPE_VIEW_MOD_LIMBO_SIZE,
EntityLimits::npc::Null,
EntityLimits::merc::Null,
EntityLimits::bot::Null,
EntityLimits::pet::Null
},
{ // local[TypeAltStorage]
ClientUnknown::Null,
Client62::Null,
Titanium::Null,
SoF::Null,
SoD::Null,
UF::Null,
legacy::TYPE_ALT_STORAGE_SIZE,
legacy::TYPE_ALT_STORAGE_SIZE,
EntityLimits::npc::Null,
EntityLimits::merc::Null,
EntityLimits::bot::Null,
EntityLimits::pet::Null
},
{ // local[TypeArchived]
ClientUnknown::Null,
Client62::Null,
Titanium::Null,
SoF::Null,
SoD::Null,
UF::Null,
legacy::TYPE_ARCHIVED_SIZE,
legacy::TYPE_ARCHIVED_SIZE,
EntityLimits::npc::Null,
EntityLimits::merc::Null,
EntityLimits::bot::Null,
EntityLimits::pet::Null
},
{ // local[TypeMail]
ClientUnknown::Null,
Client62::Null,
Titanium::Null,
SoF::Null,
SoD::Null,
UF::Null,
legacy::TYPE_MAIL_SIZE,
legacy::TYPE_MAIL_SIZE,
EntityLimits::npc::Null,
EntityLimits::merc::Null,
EntityLimits::bot::Null,
EntityLimits::pet::Null
},
{ // local[TypeGuildTrophyTribute]
ClientUnknown::Null,
Client62::Null,
Titanium::Null,
SoF::Null,
SoD::Null,
UF::Null,
legacy::TYPE_GUILD_TROPHY_TRIBUTE_SIZE,
legacy::TYPE_GUILD_TROPHY_TRIBUTE_SIZE,
EntityLimits::npc::Null,
EntityLimits::merc::Null,
EntityLimits::bot::Null,
EntityLimits::pet::Null
},
{ // local[TypeKrono]
ClientUnknown::Null,
Client62::Null,
Titanium::Null,
SoF::Null,
SoD::Null,
UF::Null,
legacy::TYPE_KRONO_SIZE,
legacy::TYPE_KRONO_SIZE,
EntityLimits::npc::Null,
EntityLimits::merc::Null,
EntityLimits::bot::Null,
EntityLimits::pet::Null
},
{ // local[TypeOther]
ClientUnknown::Null,
Client62::Null,
Titanium::Null,
SoF::Null,
SoD::Null,
UF::Null,
legacy::TYPE_OTHER_SIZE,
legacy::TYPE_OTHER_SIZE,
EntityLimits::npc::Null,
EntityLimits::merc::Null,
EntityLimits::bot::Null,
EntityLimits::pet::Null
}
};
if ((uint16)inv_type < legacy::TypeCount)
return local[inv_type][static_cast<size_t>(versions::ValidateInventoryVersion(inventory_version))];
return NOT_USED;
return &constants_lookup_entries[static_cast<int>(versions::ValidateClientVersion(client_version))];
}
uint64 EQEmu::inventory::PossessionsBitmask(versions::InventoryVersion inventory_version)
static const EQEmu::inventory::LookupEntry inventory_lookup_entries[EQEmu::versions::InventoryVersionCount] =
{
static const uint64 local[versions::InventoryVersionCount] = {
ClientUnknown::Null,
Client62::Null,
0x000000027FDFFFFF,
0x000000027FFFFFFF,
0x000000027FFFFFFF,
0x000000027FFFFFFF,
0x00000003FFFFFFFF,
0x00000003FFFFFFFF,
EntityLimits::npc::Null,
EntityLimits::merc::Null,
EntityLimits::bot::Null,
EntityLimits::pet::Null
};
{ // Unknown
ClientUnknown::Null, ClientUnknown::Null, ClientUnknown::Null, ClientUnknown::Null, ClientUnknown::Null,
ClientUnknown::Null, ClientUnknown::Null, ClientUnknown::Null, ClientUnknown::Null, ClientUnknown::Null,
ClientUnknown::Null, ClientUnknown::Null, ClientUnknown::Null, ClientUnknown::Null, ClientUnknown::Null,
ClientUnknown::Null, ClientUnknown::Null, ClientUnknown::Null, ClientUnknown::Null, ClientUnknown::Null,
ClientUnknown::Null, ClientUnknown::Null, ClientUnknown::Null, ClientUnknown::Null, ClientUnknown::Null,
return NOT_USED;
//return local[static_cast<size_t>(versions::ValidateInventoryVersion(inventory_version))];
}
ClientUnknown::Null, ClientUnknown::Null, ClientUnknown::Null,
bool EQEmu::inventory::AllowEmptyBagInBag(versions::InventoryVersion inventory_version)
ClientUnknown::False, ClientUnknown::False, ClientUnknown::False, ClientUnknown::False
},
{ // Client62
Client62::Null, Client62::Null, Client62::Null, Client62::Null, Client62::Null,
Client62::Null, Client62::Null, Client62::Null, Client62::Null, Client62::Null,
Client62::Null, Client62::Null, Client62::Null, Client62::Null, Client62::Null,
Client62::Null, Client62::Null, Client62::Null, Client62::Null, Client62::Null,
Client62::Null, Client62::Null, Client62::Null, Client62::Null, Client62::Null,
Client62::Null, Client62::Null, Client62::Null,
Client62::False, Client62::False, Client62::False, Client62::False
},
{ // Titanium
EQEmu::legacy::TYPE_POSSESSIONS_SIZE, /*Titanium::invtype::InvTypePossessionsSize,*/ Titanium::invtype::InvTypeBankSize, Titanium::invtype::InvTypeSharedBankSize, Titanium::invtype::InvTypeTradeSize, Titanium::invtype::InvTypeWorldSize,
Titanium::invtype::InvTypeLimboSize, Titanium::invtype::InvTypeTributeSize, Titanium::Null, Titanium::Null, /*Titanium::invtype::InvTypeGuildTributeSize,*/ Titanium::invtype::InvTypeMerchantSize,
Titanium::Null, Titanium::invtype::InvTypeCorpseSize, EQEmu::legacy::TYPE_BAZAAR_SIZE, /*Titanium::invtype::InvTypeBazaarSize,*/ Titanium::invtype::InvTypeInspectSize, Titanium::Null,
Titanium::invtype::InvTypeViewMODPCSize, Titanium::invtype::InvTypeViewMODBankSize, Titanium::invtype::InvTypeViewMODSharedBankSize, Titanium::invtype::InvTypeViewMODLimboSize, Titanium::invtype::InvTypeAltStorageSize,
Titanium::invtype::InvTypeArchivedSize, Titanium::Null, Titanium::Null, Titanium::Null, Titanium::invtype::InvTypeOtherSize,
Titanium::Null, /*0x000000027FDFFFFF,*/ EQEmu::legacy::ITEM_CONTAINER_SIZE, /*Titanium::invbag::ItemBagSize,*/ EQEmu::legacy::ITEM_COMMON_SIZE, /*Titanium::invaug::ItemAugSize,*/
Titanium::inventory::AllowEmptyBagInBag, Titanium::inventory::AllowClickCastFromBag, Titanium::inventory::ConcatenateInvTypeLimbo, Titanium::inventory::AllowOverLevelEquipment
},
{ // SoF
EQEmu::legacy::TYPE_POSSESSIONS_SIZE, /*SoF::invtype::InvTypePossessionsSize,*/ SoF::invtype::InvTypeBankSize, SoF::invtype::InvTypeSharedBankSize, SoF::invtype::InvTypeTradeSize, SoF::invtype::InvTypeWorldSize,
SoF::invtype::InvTypeLimboSize, SoF::invtype::InvTypeTributeSize, SoF::Null, SoF::Null, /*SoF::invtype::InvTypeGuildTributeSize,*/ SoF::invtype::InvTypeMerchantSize,
SoF::Null, SoF::invtype::InvTypeCorpseSize, EQEmu::legacy::TYPE_BAZAAR_SIZE, /*SoF::invtype::InvTypeBazaarSize,*/ SoF::invtype::InvTypeInspectSize, SoF::Null,
SoF::invtype::InvTypeViewMODPCSize, SoF::invtype::InvTypeViewMODBankSize, SoF::invtype::InvTypeViewMODSharedBankSize, SoF::invtype::InvTypeViewMODLimboSize, SoF::invtype::InvTypeAltStorageSize,
SoF::invtype::InvTypeArchivedSize, SoF::Null, SoF::Null, SoF::Null, SoF::invtype::InvTypeOtherSize,
SoF::Null, /*0x000000027FFFFFFF,*/ EQEmu::legacy::ITEM_CONTAINER_SIZE, /*SoF::invbag::ItemBagSize,*/ EQEmu::legacy::ITEM_COMMON_SIZE, /*SoF::invaug::ItemAugSize,*/
SoF::inventory::AllowEmptyBagInBag, SoF::inventory::AllowClickCastFromBag, SoF::inventory::ConcatenateInvTypeLimbo, SoF::inventory::AllowOverLevelEquipment
},
{ // SoD
EQEmu::legacy::TYPE_POSSESSIONS_SIZE, /*SoD::invtype::InvTypePossessionsSize,*/ SoD::invtype::InvTypeBankSize, SoD::invtype::InvTypeSharedBankSize, SoD::invtype::InvTypeTradeSize, SoD::invtype::InvTypeWorldSize,
SoD::invtype::InvTypeLimboSize, SoD::invtype::InvTypeTributeSize, SoD::Null, SoD::Null, /*SoD::invtype::InvTypeGuildTributeSize,*/ SoD::invtype::InvTypeMerchantSize,
SoD::Null, SoD::invtype::InvTypeCorpseSize, EQEmu::legacy::TYPE_BAZAAR_SIZE, /*SoD::invtype::InvTypeBazaarSize,*/ SoD::invtype::InvTypeInspectSize, SoD::Null,
SoD::invtype::InvTypeViewMODPCSize, SoD::invtype::InvTypeViewMODBankSize, SoD::invtype::InvTypeViewMODSharedBankSize, SoD::invtype::InvTypeViewMODLimboSize, SoD::invtype::InvTypeAltStorageSize,
SoD::invtype::InvTypeArchivedSize, SoD::Null, SoD::Null, SoD::Null, SoD::invtype::InvTypeOtherSize,
SoD::Null, /*0x000000027FFFFFFF,*/ EQEmu::legacy::ITEM_CONTAINER_SIZE, /*SoD::invbag::ItemBagSize,*/ EQEmu::legacy::ITEM_COMMON_SIZE, /*SoD::invaug::ItemAugSize,*/
SoD::inventory::AllowEmptyBagInBag, SoD::inventory::AllowClickCastFromBag, SoD::inventory::ConcatenateInvTypeLimbo, SoD::inventory::AllowOverLevelEquipment
},
{ // UF
EQEmu::legacy::TYPE_POSSESSIONS_SIZE, /*UF::invtype::InvTypePossessionsSize,*/ UF::invtype::InvTypeBankSize, UF::invtype::InvTypeSharedBankSize, UF::invtype::InvTypeTradeSize, UF::invtype::InvTypeWorldSize,
UF::invtype::InvTypeLimboSize, UF::invtype::InvTypeTributeSize, UF::Null, UF::Null, /*UF::invtype::InvTypeGuildTributeSize,*/ UF::invtype::InvTypeMerchantSize,
UF::Null, UF::invtype::InvTypeCorpseSize, EQEmu::legacy::TYPE_BAZAAR_SIZE, /*UF::invtype::InvTypeBazaarSize,*/ UF::invtype::InvTypeInspectSize, UF::Null,
UF::invtype::InvTypeViewMODPCSize, UF::invtype::InvTypeViewMODBankSize, UF::invtype::InvTypeViewMODSharedBankSize, UF::invtype::InvTypeViewMODLimboSize, UF::invtype::InvTypeAltStorageSize,
UF::invtype::InvTypeArchivedSize, UF::Null, UF::Null, UF::Null, UF::invtype::InvTypeOtherSize,
UF::Null, /*0x000000027FFFFFFF,*/ EQEmu::legacy::ITEM_CONTAINER_SIZE, /*UF::invbag::ItemBagSize,*/ EQEmu::legacy::ITEM_COMMON_SIZE, /*UF::invaug::ItemAugSize,*/
UF::inventory::AllowEmptyBagInBag, UF::inventory::AllowClickCastFromBag, UF::inventory::ConcatenateInvTypeLimbo, UF::inventory::AllowOverLevelEquipment
},
{ // RoF
EQEmu::legacy::TYPE_POSSESSIONS_SIZE, /*RoF::invtype::InvTypePossessionsSize,*/ RoF::invtype::InvTypeBankSize, RoF::invtype::InvTypeSharedBankSize, RoF::invtype::InvTypeTradeSize, RoF::invtype::InvTypeWorldSize,
RoF::invtype::InvTypeLimboSize, RoF::invtype::InvTypeTributeSize, RoF::Null, /*RoF::invtype::InvTypeTrophyTributeSize,*/ RoF::Null, /*RoF::invtype::InvTypeGuildTributeSize,*/ RoF::invtype::InvTypeMerchantSize,
RoF::Null, /*RoF::invtype::InvTypeDeletedSize,*/ RoF::invtype::InvTypeCorpseSize, EQEmu::legacy::TYPE_BAZAAR_SIZE, /*RoF::invtype::InvTypeBazaarSize,*/ RoF::invtype::InvTypeInspectSize, RoF::Null, /*RoF::invtype::InvTypeRealEstateSize,*/
RoF::invtype::InvTypeViewMODPCSize, RoF::invtype::InvTypeViewMODBankSize, RoF::invtype::InvTypeViewMODSharedBankSize, RoF::invtype::InvTypeViewMODLimboSize, RoF::invtype::InvTypeAltStorageSize,
RoF::invtype::InvTypeArchivedSize, RoF::invtype::InvTypeMailSize, RoF::invtype::InvTypeGuildTrophyTributeSize, RoF::Null, RoF::invtype::InvTypeOtherSize,
RoF::Null, /*0x00000003FFFFFFFF,*/ EQEmu::legacy::ITEM_CONTAINER_SIZE, /*RoF::invbag::ItemBagSize,*/ EQEmu::legacy::ITEM_COMMON_SIZE, /*RoF::invaug::ItemAugSize,*/
RoF::False, /*RoF::inventory::AllowEmptyBagInBag,*/ RoF::inventory::AllowClickCastFromBag, RoF::inventory::ConcatenateInvTypeLimbo, RoF::inventory::AllowOverLevelEquipment
},
{ // RoF2
EQEmu::legacy::TYPE_POSSESSIONS_SIZE, /*RoF2::invtype::InvTypePossessionsSize,*/ RoF2::invtype::InvTypeBankSize, RoF2::invtype::InvTypeSharedBankSize, RoF2::invtype::InvTypeTradeSize, RoF2::invtype::InvTypeWorldSize,
RoF2::invtype::InvTypeLimboSize, RoF2::invtype::InvTypeTributeSize, RoF2::Null, /*RoF2::invtype::InvTypeTrophyTributeSize,*/ RoF2::Null, /*RoF2::invtype::InvTypeGuildTributeSize,*/ RoF2::invtype::InvTypeMerchantSize,
RoF2::Null, /*RoF2::invtype::InvTypeDeletedSize,*/ RoF2::invtype::InvTypeCorpseSize, EQEmu::legacy::TYPE_BAZAAR_SIZE, /*RoF2::invtype::InvTypeBazaarSize,*/ RoF2::invtype::InvTypeInspectSize, RoF2::Null, /*RoF2::invtype::InvTypeRealEstateSize*/
RoF2::invtype::InvTypeViewMODPCSize, RoF2::invtype::InvTypeViewMODBankSize, RoF2::invtype::InvTypeViewMODSharedBankSize, RoF2::invtype::InvTypeViewMODLimboSize, RoF2::invtype::InvTypeAltStorageSize,
RoF2::invtype::InvTypeArchivedSize, RoF2::invtype::InvTypeMailSize, RoF2::invtype::InvTypeGuildTrophyTributeSize, RoF2::invtype::InvTypeKronoSize, RoF2::invtype::InvTypeOtherSize,
RoF2::Null, /*0x00000003FFFFFFFF,*/ EQEmu::legacy::ITEM_CONTAINER_SIZE, /*RoF2::invbag::ItemBagSize,*/ EQEmu::legacy::ITEM_COMMON_SIZE, /*RoF2::invaug::ItemAugSize,*/
RoF2::False, /*RoF2::inventory::AllowEmptyBagInBag,*/ RoF2::inventory::AllowClickCastFromBag, RoF2::inventory::ConcatenateInvTypeLimbo, RoF2::inventory::AllowOverLevelEquipment
},
{ // NPC
EQEmu::legacy::TYPE_POSSESSIONS_SIZE, /*InvTypePossessionsSize,*/ EntityLimits::NPC::Null, EntityLimits::NPC::Null, EntityLimits::NPC::InvTypeTradeSize, EntityLimits::NPC::Null,
EntityLimits::NPC::Null, EntityLimits::NPC::Null, EntityLimits::NPC::Null, EntityLimits::NPC::Null, EntityLimits::NPC::Null,
EntityLimits::NPC::Null, EntityLimits::NPC::Null, /*InvTypeCorpseSize,*/ EntityLimits::NPC::Null, EntityLimits::NPC::Null, EntityLimits::NPC::Null,
EntityLimits::NPC::Null, EntityLimits::NPC::Null, EntityLimits::NPC::Null, EntityLimits::NPC::Null, EntityLimits::NPC::Null,
EntityLimits::NPC::Null, EntityLimits::NPC::Null, EntityLimits::NPC::Null, EntityLimits::NPC::Null, EntityLimits::NPC::Null,
EntityLimits::NPC::Null, EQEmu::legacy::ITEM_CONTAINER_SIZE, /*ItemBagSize,*/ EQEmu::legacy::ITEM_COMMON_SIZE, /*ItemAugSize,*/
EntityLimits::NPC::False, EntityLimits::NPC::False, EntityLimits::NPC::False, EntityLimits::NPC::False
},
{ // NPCMerchant
EQEmu::legacy::TYPE_POSSESSIONS_SIZE, /*InvTypePossessionsSize,*/ EntityLimits::NPCMerchant::Null, EntityLimits::NPCMerchant::Null, EntityLimits::NPCMerchant::InvTypeTradeSize, EntityLimits::NPCMerchant::Null,
EntityLimits::NPCMerchant::Null, EntityLimits::NPCMerchant::Null, EntityLimits::NPCMerchant::Null, EntityLimits::NPCMerchant::Null, EntityLimits::NPCMerchant::Null,
EntityLimits::NPCMerchant::Null, EntityLimits::NPCMerchant::Null, /*InvTypeCorpseSize,*/ EntityLimits::NPCMerchant::Null, EntityLimits::NPCMerchant::Null, EntityLimits::NPCMerchant::Null,
EntityLimits::NPCMerchant::Null, EntityLimits::NPCMerchant::Null, EntityLimits::NPCMerchant::Null, EntityLimits::NPCMerchant::Null, EntityLimits::NPCMerchant::Null,
EntityLimits::NPCMerchant::Null, EntityLimits::NPCMerchant::Null, EntityLimits::NPCMerchant::Null, EntityLimits::NPCMerchant::Null, EntityLimits::NPCMerchant::Null,
EntityLimits::NPCMerchant::Null, EQEmu::legacy::ITEM_CONTAINER_SIZE, /*ItemBagSize,*/ EQEmu::legacy::ITEM_COMMON_SIZE, /*ItemAugSize,*/
EntityLimits::NPCMerchant::False, EntityLimits::NPCMerchant::False, EntityLimits::NPCMerchant::False, EntityLimits::NPCMerchant::False
},
{ // Merc
EQEmu::legacy::TYPE_POSSESSIONS_SIZE, /*InvTypePossessionsSize,*/ EntityLimits::Merc::Null, EntityLimits::Merc::Null, EntityLimits::Merc::InvTypeTradeSize, EntityLimits::Merc::Null,
EntityLimits::Merc::Null, EntityLimits::Merc::Null, EntityLimits::Merc::Null, EntityLimits::Merc::Null, EntityLimits::Merc::Null,
EntityLimits::Merc::Null, EntityLimits::Merc::Null, /*InvTypeCorpseSize,*/ EntityLimits::Merc::Null, EntityLimits::Merc::Null, EntityLimits::Merc::Null,
EntityLimits::Merc::Null, EntityLimits::Merc::Null, EntityLimits::Merc::Null, EntityLimits::Merc::Null, EntityLimits::Merc::Null,
EntityLimits::Merc::Null, EntityLimits::Merc::Null, EntityLimits::Merc::Null, EntityLimits::Merc::Null, EntityLimits::Merc::Null,
EntityLimits::Merc::Null, EQEmu::legacy::ITEM_CONTAINER_SIZE, /*ItemBagSize,*/ EQEmu::legacy::ITEM_COMMON_SIZE, /*ItemAugSize,*/
EntityLimits::Merc::False, EntityLimits::Merc::False, EntityLimits::Merc::False, EntityLimits::Merc::False
},
{ // Bot
EQEmu::legacy::TYPE_POSSESSIONS_SIZE, /*InvTypePossessionsSize,*/ EntityLimits::Bot::Null, EntityLimits::Bot::Null, EntityLimits::Bot::InvTypeTradeSize, EntityLimits::Bot::Null,
EntityLimits::Bot::Null, EntityLimits::Bot::Null, EntityLimits::Bot::Null, EntityLimits::Bot::Null, EntityLimits::Bot::Null,
EntityLimits::Bot::Null, EntityLimits::Bot::Null, /*InvTypeCorpseSize,*/ EntityLimits::Bot::Null, EntityLimits::Bot::Null, EntityLimits::Bot::Null,
EntityLimits::Bot::Null, EntityLimits::Bot::Null, EntityLimits::Bot::Null, EntityLimits::Bot::Null, EntityLimits::Bot::Null,
EntityLimits::Bot::Null, EntityLimits::Bot::Null, EntityLimits::Bot::Null, EntityLimits::Bot::Null, EntityLimits::Bot::Null,
EntityLimits::Bot::Null, EQEmu::legacy::ITEM_CONTAINER_SIZE, /*ItemBagSize,*/ EQEmu::legacy::ITEM_COMMON_SIZE, /*ItemAugSize,*/
EntityLimits::Bot::False, EntityLimits::Bot::False, EntityLimits::Bot::False, EntityLimits::Bot::False
},
{ // ClientPet
EQEmu::legacy::TYPE_POSSESSIONS_SIZE, /*InvTypePossessionsSize,*/ EntityLimits::ClientPet::Null, EntityLimits::ClientPet::Null, EntityLimits::ClientPet::InvTypeTradeSize, EntityLimits::ClientPet::Null,
EntityLimits::ClientPet::Null, EntityLimits::ClientPet::Null, EntityLimits::ClientPet::Null, EntityLimits::ClientPet::Null, EntityLimits::ClientPet::Null,
EntityLimits::ClientPet::Null, EntityLimits::ClientPet::Null, /*InvTypeCorpseSize,*/ EntityLimits::ClientPet::Null, EntityLimits::ClientPet::Null, EntityLimits::ClientPet::Null,
EntityLimits::ClientPet::Null, EntityLimits::ClientPet::Null, EntityLimits::ClientPet::Null, EntityLimits::ClientPet::Null, EntityLimits::ClientPet::Null,
EntityLimits::ClientPet::Null, EntityLimits::ClientPet::Null, EntityLimits::ClientPet::Null, EntityLimits::ClientPet::Null, EntityLimits::ClientPet::Null,
EntityLimits::ClientPet::Null, EQEmu::legacy::ITEM_CONTAINER_SIZE, /*ItemBagSize,*/ EQEmu::legacy::ITEM_COMMON_SIZE, /*ItemAugSize,*/
EntityLimits::ClientPet::False, EntityLimits::ClientPet::False, EntityLimits::ClientPet::False, EntityLimits::ClientPet::False
},
{ // NPCPet
EQEmu::legacy::TYPE_POSSESSIONS_SIZE, /*InvTypePossessionsSize,*/ EntityLimits::NPCPet::Null, EntityLimits::NPCPet::Null, EntityLimits::NPCPet::InvTypeTradeSize, EntityLimits::NPCPet::Null,
EntityLimits::NPCPet::Null, EntityLimits::NPCPet::Null, EntityLimits::NPCPet::Null, EntityLimits::NPCPet::Null, EntityLimits::NPCPet::Null,
EntityLimits::NPCPet::Null, EntityLimits::NPCPet::Null, /*InvTypeCorpseSize,*/ EntityLimits::NPCPet::Null, EntityLimits::NPCPet::Null, EntityLimits::NPCPet::Null,
EntityLimits::NPCPet::Null, EntityLimits::NPCPet::Null, EntityLimits::NPCPet::Null, EntityLimits::NPCPet::Null, EntityLimits::NPCPet::Null,
EntityLimits::NPCPet::Null, EntityLimits::NPCPet::Null, EntityLimits::NPCPet::Null, EntityLimits::NPCPet::Null, EntityLimits::NPCPet::Null,
EntityLimits::NPCPet::Null, EQEmu::legacy::ITEM_CONTAINER_SIZE, /*ItemBagSize,*/ EQEmu::legacy::ITEM_COMMON_SIZE, /*ItemAugSize,*/
EntityLimits::NPCPet::False, EntityLimits::NPCPet::False, EntityLimits::NPCPet::False, EntityLimits::NPCPet::False
},
{ // MercPet
EQEmu::legacy::TYPE_POSSESSIONS_SIZE, /*InvTypePossessionsSize,*/ EntityLimits::MercPet::Null, EntityLimits::MercPet::Null, EntityLimits::MercPet::InvTypeTradeSize, EntityLimits::MercPet::Null,
EntityLimits::MercPet::Null, EntityLimits::MercPet::Null, EntityLimits::MercPet::Null, EntityLimits::MercPet::Null, EntityLimits::MercPet::Null,
EntityLimits::MercPet::Null, EntityLimits::MercPet::Null, /*InvTypeCorpseSize,*/ EntityLimits::MercPet::Null, EntityLimits::MercPet::Null, EntityLimits::MercPet::Null,
EntityLimits::MercPet::Null, EntityLimits::MercPet::Null, EntityLimits::MercPet::Null, EntityLimits::MercPet::Null, EntityLimits::MercPet::Null,
EntityLimits::MercPet::Null, EntityLimits::MercPet::Null, EntityLimits::MercPet::Null, EntityLimits::MercPet::Null, EntityLimits::MercPet::Null,
EntityLimits::MercPet::Null, EQEmu::legacy::ITEM_CONTAINER_SIZE, /*ItemBagSize,*/ EQEmu::legacy::ITEM_COMMON_SIZE, /*ItemAugSize,*/
EntityLimits::MercPet::False, EntityLimits::MercPet::False, EntityLimits::MercPet::False, EntityLimits::MercPet::False
},
{ // BotPet
EQEmu::legacy::TYPE_POSSESSIONS_SIZE, /*InvTypePossessionsSize,*/ EntityLimits::BotPet::Null, EntityLimits::BotPet::Null, EntityLimits::BotPet::InvTypeTradeSize, EntityLimits::BotPet::Null,
EntityLimits::BotPet::Null, EntityLimits::BotPet::Null, EntityLimits::BotPet::Null, EntityLimits::BotPet::Null, EntityLimits::BotPet::Null,
EntityLimits::BotPet::Null, EntityLimits::BotPet::Null, /*InvTypeCorpseSize,*/ EntityLimits::BotPet::Null, EntityLimits::BotPet::Null, EntityLimits::BotPet::Null,
EntityLimits::BotPet::Null, EntityLimits::BotPet::Null, EntityLimits::BotPet::Null, EntityLimits::BotPet::Null, EntityLimits::BotPet::Null,
EntityLimits::BotPet::Null, EntityLimits::BotPet::Null, EntityLimits::BotPet::Null, EntityLimits::BotPet::Null, EntityLimits::BotPet::Null,
EntityLimits::BotPet::Null, EQEmu::legacy::ITEM_CONTAINER_SIZE, /*ItemBagSize,*/ EQEmu::legacy::ITEM_COMMON_SIZE, /*ItemAugSize,*/
EntityLimits::BotPet::False, EntityLimits::BotPet::False, EntityLimits::BotPet::False, EntityLimits::BotPet::False
},
{ // OfflineTitanium
Titanium::Null, Titanium::Null, Titanium::Null, Titanium::invtype::InvTypeTradeSize, Titanium::Null,
Titanium::Null, Titanium::Null, Titanium::Null, Titanium::Null, Titanium::invtype::InvTypeMerchantSize,
Titanium::Null, Titanium::Null, Titanium::Null, /*Titanium::invtype::InvTypeBazaarSize,*/ Titanium::invtype::InvTypeInspectSize, Titanium::Null,
Titanium::invtype::InvTypeViewMODPCSize, Titanium::invtype::InvTypeViewMODBankSize, Titanium::invtype::InvTypeViewMODSharedBankSize, Titanium::invtype::InvTypeViewMODLimboSize, Titanium::Null,
Titanium::Null, Titanium::Null, Titanium::Null, Titanium::Null, Titanium::Null,
Titanium::Null, EQEmu::legacy::ITEM_CONTAINER_SIZE, /*Titanium::Null,*/ Titanium::Null,
Titanium::False, Titanium::False, Titanium::False, Titanium::False
},
{ // OfflineSoF
SoF::Null, SoF::Null, SoF::Null, SoF::invtype::InvTypeTradeSize, SoF::Null,
SoF::Null, SoF::Null, SoF::Null, SoF::Null, SoF::invtype::InvTypeMerchantSize,
SoF::Null, SoF::Null, SoF::Null, /*SoF::invtype::InvTypeBazaarSize,*/ SoF::invtype::InvTypeInspectSize, SoF::Null,
SoF::invtype::InvTypeViewMODPCSize, SoF::invtype::InvTypeViewMODBankSize, SoF::invtype::InvTypeViewMODSharedBankSize, SoF::invtype::InvTypeViewMODLimboSize, SoF::Null,
SoF::Null, SoF::Null, SoF::Null, SoF::Null, SoF::Null,
SoF::Null, EQEmu::legacy::ITEM_CONTAINER_SIZE, /*SoF::Null,*/ SoF::Null,
SoF::False, SoF::False, SoF::False, SoF::False
},
{ // OfflineSoD
SoD::Null, SoD::Null, SoD::Null, SoD::invtype::InvTypeTradeSize, SoD::Null,
SoD::Null, SoD::Null, SoD::Null, SoD::Null, SoD::invtype::InvTypeMerchantSize,
SoD::Null, SoD::Null, SoD::Null, /*SoD::invtype::InvTypeBazaarSize,*/ SoD::invtype::InvTypeInspectSize, SoD::Null,
SoD::invtype::InvTypeViewMODPCSize, SoD::invtype::InvTypeViewMODBankSize, SoD::invtype::InvTypeViewMODSharedBankSize, SoD::invtype::InvTypeViewMODLimboSize, SoD::Null,
SoD::Null, SoD::Null, SoD::Null, SoD::Null, SoD::Null,
SoD::Null, EQEmu::legacy::ITEM_CONTAINER_SIZE, /*SoD::Null,*/ SoD::Null,
SoD::False, SoD::False, SoD::False, SoD::False
},
{ // OfflineUF
UF::Null, UF::Null, UF::Null, UF::invtype::InvTypeTradeSize, UF::Null,
UF::Null, UF::Null, UF::Null, UF::Null, UF::invtype::InvTypeMerchantSize,
UF::Null, UF::Null, UF::Null, /*UF::invtype::InvTypeBazaarSize,*/ UF::invtype::InvTypeInspectSize, UF::Null,
UF::invtype::InvTypeViewMODPCSize, UF::invtype::InvTypeViewMODBankSize, UF::invtype::InvTypeViewMODSharedBankSize, UF::invtype::InvTypeViewMODLimboSize, UF::Null,
UF::Null, UF::Null, UF::Null, UF::Null, UF::Null,
UF::Null, EQEmu::legacy::ITEM_CONTAINER_SIZE, /*UF::Null,*/ UF::Null,
UF::False, UF::False, UF::False, UF::False
},
{ // OfflineRoF
RoF::Null, RoF::Null, RoF::Null, RoF::invtype::InvTypeTradeSize, RoF::Null,
RoF::Null, RoF::Null, RoF::Null, RoF::Null, RoF::invtype::InvTypeMerchantSize,
RoF::Null, RoF::Null, RoF::Null, /*RoF::invtype::InvTypeBazaarSize,*/ RoF::invtype::InvTypeInspectSize, RoF::Null,
RoF::invtype::InvTypeViewMODPCSize, RoF::invtype::InvTypeViewMODBankSize, RoF::invtype::InvTypeViewMODSharedBankSize, RoF::invtype::InvTypeViewMODLimboSize, RoF::Null,
RoF::Null, RoF::Null, RoF::Null, RoF::Null, RoF::Null,
RoF::Null, EQEmu::legacy::ITEM_CONTAINER_SIZE, /*RoF::Null,*/ RoF::Null,
RoF::False, RoF::False, RoF::False, RoF::False
},
{ // OfflineRoF2
RoF2::Null, RoF2::Null, RoF2::Null, RoF2::invtype::InvTypeTradeSize, RoF2::Null,
RoF2::Null, RoF2::Null, RoF2::Null, RoF2::Null, RoF2::invtype::InvTypeMerchantSize,
RoF2::Null, RoF2::Null, RoF2::Null, /*RoF2::invtype::InvTypeBazaarSize,*/ RoF2::invtype::InvTypeInspectSize, RoF2::Null,
RoF2::invtype::InvTypeViewMODPCSize, RoF2::invtype::InvTypeViewMODBankSize, RoF2::invtype::InvTypeViewMODSharedBankSize, RoF2::invtype::InvTypeViewMODLimboSize, RoF2::Null,
RoF2::Null, RoF2::Null, RoF2::Null, RoF2::Null, RoF2::Null,
RoF2::Null, EQEmu::legacy::ITEM_CONTAINER_SIZE, /*RoF2::Null,*/ RoF2::Null,
RoF2::False, RoF2::False, RoF2::False, RoF2::False
}
};
const EQEmu::inventory::LookupEntry* EQEmu::inventory::Lookup(versions::InventoryVersion inventory_version)
{
static const bool local[versions::InventoryVersionCount] = {
ClientUnknown::False,
Client62::False,
Titanium::behavior::AllowEmptyBagInBag,
SoF::behavior::AllowEmptyBagInBag,
SoD::behavior::AllowEmptyBagInBag,
UF::behavior::AllowEmptyBagInBag,
RoF::behavior::AllowEmptyBagInBag,
RoF2::behavior::AllowEmptyBagInBag,
EntityLimits::npc::False,
EntityLimits::merc::False,
EntityLimits::bot::False,
EntityLimits::pet::False
};
return false;
//return local[static_cast<size_t>(versions::ValidateInventoryVersion(inventory_version))];
return &inventory_lookup_entries[static_cast<int>(versions::ValidateInventoryVersion(inventory_version))];
}
bool EQEmu::inventory::AllowClickCastFromBag(versions::InventoryVersion inventory_version)
static const EQEmu::behavior::LookupEntry behavior_lookup_entries[EQEmu::versions::InventoryVersionCount] =
{
static const bool local[versions::InventoryVersionCount] = {
ClientUnknown::False,
Client62::False,
Titanium::behavior::AllowClickCastFromBag,
SoF::behavior::AllowClickCastFromBag,
SoD::behavior::AllowClickCastFromBag,
UF::behavior::AllowClickCastFromBag,
RoF::behavior::AllowClickCastFromBag,
RoF2::behavior::AllowClickCastFromBag,
EntityLimits::npc::False,
EntityLimits::merc::False,
EntityLimits::bot::False,
EntityLimits::pet::False
};
{ // Unknown
ClientUnknown::True
},
{ // Client62
Client62::True
},
{ // Titanium
Titanium::behavior::CoinHasWeight
},
{ // SoF
SoF::behavior::CoinHasWeight
},
{ // SoD
SoD::behavior::CoinHasWeight
},
{ // UF
UF::behavior::CoinHasWeight
},
{ // RoF
RoF::behavior::CoinHasWeight
},
{ // RoF2
RoF2::behavior::CoinHasWeight
},
{ // NPC
EntityLimits::NPC::True /*CoinHasWeight*/
},
{ // NPCMerchant
EntityLimits::NPC::True /*CoinHasWeight*/
},
{ // Merc
EntityLimits::Merc::True /*CoinHasWeight*/
},
{ // Bot
EntityLimits::Bot::True /*CoinHasWeight*/
},
{ // ClientPet
EntityLimits::ClientPet::True /*CoinHasWeight*/
},
{ // NPCPet
EntityLimits::NPCPet::True /*CoinHasWeight*/
},
{ // MercPet
EntityLimits::MercPet::True /*CoinHasWeight*/
},
{ // BotPet
EntityLimits::BotPet::True /*CoinHasWeight*/
},
{ // OfflineTitanium
Titanium::False
},
{ // OfflineSoF
SoF::False
},
{ // OfflineSoD
SoD::False
},
{ // OfflineUF
UF::False
},
{ // OfflineRoF
RoF::False
},
{ // OfflineRoF2
RoF2::False
}
};
return local[static_cast<size_t>(versions::ValidateInventoryVersion(inventory_version))];
}
uint16 EQEmu::inventory::ItemAugSize(versions::InventoryVersion inventory_version)
const EQEmu::behavior::LookupEntry* EQEmu::behavior::Lookup(versions::InventoryVersion inventory_version)
{
static const uint16 local[versions::InventoryVersionCount] = {
ClientUnknown::Null,
Client62::Null,
legacy::ITEM_COMMON_SIZE,
legacy::ITEM_COMMON_SIZE,
legacy::ITEM_COMMON_SIZE,
legacy::ITEM_COMMON_SIZE,
legacy::ITEM_COMMON_SIZE,
legacy::ITEM_COMMON_SIZE,
legacy::ITEM_COMMON_SIZE,
legacy::ITEM_COMMON_SIZE,
legacy::ITEM_COMMON_SIZE,
legacy::ITEM_COMMON_SIZE
};
return local[static_cast<size_t>(versions::ValidateInventoryVersion(inventory_version))];
}
uint16 EQEmu::inventory::ItemBagSize(versions::InventoryVersion inventory_version)
{
static const uint16 local[versions::InventoryVersionCount] = {
ClientUnknown::Null,
Client62::Null,
legacy::ITEM_CONTAINER_SIZE,
legacy::ITEM_CONTAINER_SIZE,
legacy::ITEM_CONTAINER_SIZE,
legacy::ITEM_CONTAINER_SIZE,
legacy::ITEM_CONTAINER_SIZE,
legacy::ITEM_CONTAINER_SIZE,
legacy::ITEM_CONTAINER_SIZE,
legacy::ITEM_CONTAINER_SIZE,
legacy::ITEM_CONTAINER_SIZE,
legacy::ITEM_CONTAINER_SIZE
};
return local[static_cast<size_t>(versions::ValidateInventoryVersion(inventory_version))];
}
bool EQEmu::profile::CoinHasWeight(versions::InventoryVersion inventory_version)
{
static const bool local[versions::InventoryVersionCount] = {
ClientUnknown::True,
Client62::True,
Titanium::behavior::CoinHasWeight,
SoF::behavior::CoinHasWeight,
SoD::behavior::CoinHasWeight,
UF::behavior::CoinHasWeight,
RoF::behavior::CoinHasWeight,
RoF::behavior::CoinHasWeight,
EntityLimits::npc::True,
EntityLimits::merc::True,
EntityLimits::bot::True,
EntityLimits::pet::True
};
return local[static_cast<size_t>(versions::ValidateInventoryVersion(inventory_version))];
return &behavior_lookup_entries[static_cast<int>(versions::ValidateInventoryVersion(inventory_version))];
}
+30 -16
View File
@@ -1,4 +1,4 @@
/* EQEMu: Everquest Server Emulator
/* EQEMu: Everquest Server Emulator
Copyright (C) 2001-2016 EQEMu Development Team (http://eqemulator.net)
@@ -10,7 +10,7 @@
but WITHOUT ANY WARRANTY except by those people which sell it, which
are required to give you total support for your newly bought product;
without even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE. See the GNU General Public License for more details.
A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
@@ -20,9 +20,10 @@
#ifndef COMMON_EQ_LIMITS_H
#define COMMON_EQ_LIMITS_H
#include "emu_legacy.h"
#include "types.h"
#include "eq_constants.h"
#include "inventory_version.h"
#include "emu_versions.h"
#include "../common/patches/titanium_limits.h"
#include "../common/patches/sof_limits.h"
#include "../common/patches/sod_limits.h"
@@ -34,30 +35,43 @@
namespace EQEmu
{
namespace constants {
extern size_t CharacterCreationLimit(versions::ClientVersion client_version);
class LookupEntry {
public:
size_t CharacterCreationLimit;
};
const LookupEntry* Lookup(versions::ClientVersion client_version);
} /*constants*/
namespace inventory {
extern uint16 InventoryTypeSize(versions::InventoryVersion inventory_version, int16 inv_type);
extern uint64 PossessionsBitmask(versions::InventoryVersion inventory_version);
class LookupEntry {
public:
size_t InventoryTypeSize[legacy::TypeCount];
extern bool AllowEmptyBagInBag(versions::InventoryVersion inventory_version);
extern bool AllowClickCastFromBag(versions::InventoryVersion inventory_version);
uint64 PossessionsBitmask;
size_t ItemBagSize;
size_t ItemAugSize;
extern uint16 ItemAugSize(versions::InventoryVersion inventory_version);
extern uint16 ItemBagSize(versions::InventoryVersion inventory_version);
bool AllowEmptyBagInBag;
bool AllowClickCastFromBag;
bool ConcatenateInvTypeLimbo;
bool AllowOverLevelEquipment;
};
extern bool ConcatenateInvTypeLimbo(versions::InventoryVersion inventory_version);
extern bool AllowOverLevelEquipment(versions::InventoryVersion inventory_version);
const LookupEntry* Lookup(versions::InventoryVersion inventory_version);
} /*inventory*/
namespace profile {
extern bool CoinHasWeight(versions::InventoryVersion inventory_version);
namespace behavior {
class LookupEntry {
public:
bool CoinHasWeight;
};
} /*profile*/
const LookupEntry* Lookup(versions::InventoryVersion inventory_version);
} /*behavior*/
} /*EQEmu*/
+59 -127
View File
@@ -25,15 +25,17 @@
#include <list>
#include <time.h>
#include "../common/version.h"
//#include "../common/item_struct.h"
#include "emu_constants.h"
#include "textures.h"
static const uint32 BUFF_COUNT = 25;
static const uint32 PET_BUFF_COUNT = 30;
static const uint32 MAX_MERC = 100;
static const uint32 MAX_MERC_GRADES = 10;
static const uint32 MAX_MERC_STANCES = 10;
static const uint32 BLOCKED_BUFF_COUNT = 20;
#include "emu_constants.h"
/*
** Compiler override to ensure
@@ -125,37 +127,7 @@ struct LDoNTrapTemplate
// All clients translate the character select information to some degree
struct Color_Struct
{
union {
struct {
uint8 Blue;
uint8 Green;
uint8 Red;
uint8 UseTint; // if there's a tint this is FF
} RGB;
uint32 Color;
};
};
struct EquipStruct
{
uint32 Material;
uint32 Unknown1;
uint32 EliteMaterial;
uint32 HeroForgeModel;
uint32 Material2; // Same as material?
};
struct CharSelectEquip
{
uint32 Material;
uint32 Unknown1;
uint32 EliteMaterial;
uint32 HeroForgeModel;
uint32 Material2;
Color_Struct Color;
};
struct CharSelectEquip : EQEmu::Texture_Struct, EQEmu::Tint_Struct {};
// RoF2-based hybrid struct
struct CharacterSelectEntry_Struct
@@ -170,7 +142,7 @@ struct CharacterSelectEntry_Struct
uint16 Instance;
uint8 Gender;
uint8 Face;
CharSelectEquip Equip[9];
CharSelectEquip Equip[EQEmu::textures::TextureCount];
uint8 Unknown15; // Seen FF
uint8 Unknown19; // Seen FF
uint32 DrakkinTattoo;
@@ -279,22 +251,7 @@ struct Spawn_Struct {
/*0189*/ uint32 petOwnerId; // If this is a pet, the spawn id of owner
/*0193*/ uint8 guildrank; // 0=normal, 1=officer, 2=leader
/*0194*/ uint8 unknown0194[3];
/*0197*/ union
{
struct
{
/*0000*/ EquipStruct equip_helmet; // Equipment: Helmet visual
/*0000*/ EquipStruct equip_chest; // Equipment: Chest visual
/*0000*/ EquipStruct equip_arms; // Equipment: Arms visual
/*0000*/ EquipStruct equip_bracers; // Equipment: Wrist visual
/*0000*/ EquipStruct equip_hands; // Equipment: Hands visual
/*0000*/ EquipStruct equip_legs; // Equipment: Legs visual
/*0000*/ EquipStruct equip_feet; // Equipment: Boots visual
/*0000*/ EquipStruct equip_primary; // Equipment: Main visual
/*0000*/ EquipStruct equip_secondary; // Equipment: Off visual
} equip;
/*0000*/ EquipStruct equipment[EQEmu::legacy::MaterialCount];
};
/*0197*/ EQEmu::TextureProfile equipment;
/*0233*/ float runspeed; // Speed when running
/*0036*/ uint8 afk; // 0=no, 1=afk
/*0238*/ uint32 guildID; // Current guild
@@ -325,22 +282,7 @@ union
/*0340*/ uint32 spawnId; // Spawn Id
/*0344*/ uint8 unknown0344[3];
/*0347*/ uint8 IsMercenary;
/*0348*/ union
{
struct
{
/*0348*/ Color_Struct color_helmet; // Color of helmet item
/*0352*/ Color_Struct color_chest; // Color of chest item
/*0356*/ Color_Struct color_arms; // Color of arms item
/*0360*/ Color_Struct color_bracers; // Color of bracers item
/*0364*/ Color_Struct color_hands; // Color of hands item
/*0368*/ Color_Struct color_legs; // Color of legs item
/*0372*/ Color_Struct color_feet; // Color of feet item
/*0376*/ Color_Struct color_primary; // Color of primary item
/*0380*/ Color_Struct color_secondary; // Color of secondary item
} equipment_colors;
/*0348*/ Color_Struct colors[EQEmu::legacy::MaterialCount]; // Array elements correspond to struct equipment_colors above
};
/*0348*/ EQEmu::TintProfile equipment_tint;
/*0384*/ uint8 lfg; // 0=off, 1=lfg on
/*0385*/
@@ -445,7 +387,19 @@ struct MemorizeSpell_Struct {
uint32 slot; // Spot in the spell book/memorized slot
uint32 spell_id; // Spell id (200 or c8 is minor healing, etc)
uint32 scribing; // 1 if memorizing a spell, set to 0 if scribing to book, 2 if un-memming
uint32 unknown12;
uint32 reduction; // lower reuse
};
/*
** Linked Spell Reuse Timer
** Length: 12
** Comes before the OP_Memorize
** Live (maybe TDS steam) has an extra DWORD after timer_id
*/
struct LinkedSpellReuseTimer_Struct {
uint32 timer_id; // Timer ID of the spell
uint32 end_time; // timestamp of when it will be ready
uint32 start_time; // timestamp of when it started
};
/*
@@ -478,10 +432,11 @@ struct DeleteSpell_Struct
struct ManaChange_Struct
{
uint32 new_mana; // New Mana AMount
uint32 stamina;
uint32 spell_id;
uint32 unknown12;
/*00*/ uint32 new_mana; // New Mana AMount
/*04*/ uint32 stamina;
/*08*/ uint32 spell_id;
/*12*/ uint8 keepcasting; // won't stop the cast. Change mana while casting?
/*13*/ uint8 padding[3]; // client doesn't read it, garbage data seems like
};
struct SwapSpell_Struct
@@ -547,30 +502,28 @@ struct SpawnAppearance_Struct
// this is used inside profile
struct SpellBuff_Struct
{
/*000*/ uint8 slotid; //badly named... seems to be 2 for a real buff, 0 otherwise
/*001*/ uint8 level;
/*000*/ uint8 effect_type; // 0 = no buff, 2 = buff, 4 = inverse affects of buff
/*001*/ uint8 level;
/*002*/ uint8 bard_modifier;
/*003*/ uint8 effect; //not real
/*003*/ uint8 unknown003; // MQ2 used to call this "damage shield" -- don't see client referencing it, so maybe server side DS type tracking? -- OSX client calls this "activated"
/*004*/ uint32 spellid;
/*008*/ int32 duration;
/*012*/ uint32 counters;
/*016*/ uint32 player_id; //'global' ID of the caster, for wearoff messages
/*020*/
/*008*/ int32 duration;
/*012*/ uint32 counters; // single book keeping value (counters, rune/vie)
/*016*/ uint32 player_id; // caster ID, pretty sure just zone ID
// extra stuff for newer packets
/*020*/ uint32 num_hits;
/*024*/ float y; // referenced by SPA 441
/*028*/ float x; // unsure if all buffs get them
/*032*/ float z; // as valid data
/*036*/
};
struct SpellBuffFade_Struct {
struct SpellBuffPacket_Struct {
/*000*/ uint32 entityid;
/*004*/ uint8 slot;
/*005*/ uint8 level;
/*006*/ uint8 effect;
/*007*/ uint8 unknown7;
/*008*/ uint32 spellid;
/*012*/ int32 duration;
/*016*/ uint32 num_hits;
/*020*/ uint32 unknown020; //prolly global player ID
/*024*/ uint32 slotid;
/*028*/ uint32 bufffade;
/*032*/
/*004*/ SpellBuff_Struct buff;
/*040*/ uint32 slotid;
/*044*/ uint32 bufffade;
/*048*/
};
// Underfoot & later struct.
@@ -583,8 +536,8 @@ struct BuffRemoveRequest_Struct
struct PetBuff_Struct {
/*000*/ uint32 petid;
/*004*/ uint32 spellid[BUFF_COUNT+5];
/*124*/ int32 ticsremaining[BUFF_COUNT+5];
/*004*/ uint32 spellid[PET_BUFF_COUNT];
/*124*/ int32 ticsremaining[PET_BUFF_COUNT];
/*244*/ uint32 buffcount;
};
@@ -881,7 +834,7 @@ struct SuspendedMinion_Struct
/*002*/ uint32 HP;
/*006*/ uint32 Mana;
/*010*/ SpellBuff_Struct Buffs[BUFF_COUNT];
/*510*/ uint32 Items[EQEmu::legacy::MaterialCount];
/*510*/ EQEmu::TextureShortProfile Items;
/*546*/ char Name[64];
/*610*/
};
@@ -895,7 +848,7 @@ struct SuspendedMinion_Struct
*/
static const uint32 MAX_PP_LANGUAGE = 28;
static const uint32 MAX_PP_SPELLBOOK = 480; // Set for all functions
static const uint32 MAX_PP_MEMSPELL = 9; // Set to latest client so functions can work right
static const uint32 MAX_PP_MEMSPELL = static_cast<uint32>(EQEmu::CastingSlot::MaxGems); // Set to latest client so functions can work right -- 12
static const uint32 MAX_PP_REF_SPELLBOOK = 480; // Set for Player Profile size retain
static const uint32 MAX_PP_REF_MEMSPELL = 9; // Set for Player Profile size retain
@@ -976,7 +929,7 @@ struct PlayerProfile_Struct
/*0245*/ uint8 guildbanker;
/*0246*/ uint8 unknown0246[6]; //
/*0252*/ uint32 intoxication;
/*0256*/ uint32 spellSlotRefresh[MAX_PP_REF_MEMSPELL]; //in ms
/*0256*/ uint32 spellSlotRefresh[MAX_PP_MEMSPELL]; //in ms
/*0292*/ uint32 abilitySlotRefresh;
/*0296*/ uint8 haircolor; // Player hair color
/*0297*/ uint8 beardcolor; // Player beard color
@@ -989,9 +942,9 @@ struct PlayerProfile_Struct
/*0304*/ uint8 ability_time_minutes;
/*0305*/ uint8 ability_time_hours; //place holder
/*0306*/ uint8 unknown0306[6]; // @bp Spacer/Flag?
/*0312*/ uint32 item_material[EQEmu::legacy::MaterialCount]; // Item texture/material of worn/held items
/*0312*/ EQEmu::TextureShortProfile item_material; // Item texture/material of worn/held items
/*0348*/ uint8 unknown0348[44];
/*0392*/ Color_Struct item_tint[EQEmu::legacy::MaterialCount];
/*0392*/ EQEmu::TintProfile item_tint;
/*0428*/ AA_Array aa_array[MAX_PP_AA_ARRAY];
/*2348*/ float unknown2384; //seen ~128, ~47
/*2352*/ char servername[32]; // length probably not right
@@ -1017,7 +970,7 @@ struct PlayerProfile_Struct
/*2580*/ uint8 unknown2616[4];
/*2584*/ uint32 spell_book[MAX_PP_REF_SPELLBOOK];
/*4504*/ uint8 unknown4540[128]; // Was [428] all 0xff
/*4632*/ uint32 mem_spells[MAX_PP_REF_MEMSPELL];
/*4632*/ uint32 mem_spells[MAX_PP_MEMSPELL];
/*4668*/ uint8 unknown4704[32]; //
/*4700*/ float y; // Player y position
/*4704*/ float x; // Player x position
@@ -1226,7 +1179,7 @@ struct WearChange_Struct{
/*010*/ uint32 elite_material; // 1 for Drakkin Elite Material
/*014*/ uint32 hero_forge_model; // New to VoA
/*018*/ uint32 unknown18; // New to RoF
/*022*/ Color_Struct color;
/*022*/ EQEmu::Tint_Struct color;
/*026*/ uint8 wear_slot_id;
/*027*/
};
@@ -1522,7 +1475,7 @@ enum ItemPacketType
ItemPacketLoot = 0x66,
ItemPacketTrade = 0x67,
ItemPacketCharInventory = 0x69,
ItemPacketSummonItem = 0x6A,
ItemPacketLimbo = 0x6A,
ItemPacketWorldContainer = 0x6B,
ItemPacketTributeItem = 0x6C,
ItemPacketGuildTribute = 0x6D,
@@ -1536,15 +1489,15 @@ enum ItemPacketType
// ItemPacketTradeView = /*101*/ 0x65,
// ItemPacketLoot = /*102*/ 0x66,
// ItemPacketTrade = /*103*/ 0x67,
// ItemPacketCharInventory = /*105*/ 0x69,
// ItemPacketLimbo = /*106*/ 0x6A, // name change
// ItemPacketCharInventory = /*105*/ 0x69, // 105 looks like raw item packet (no appearance update) thru shared bank..110, possibly possessions with appearance update
// ItemPacketLimbo = /*106*/ 0x6A,
// ItemPacketWorldContainer = /*107*/ 0x6B,
// ItemPacketTributeItem = /*108*/ 0x6C,
// ItemPacketGuildTribute = /*109*/ 0x6D, // missing from EQEmu
// ItemPacket10 = /*110*/ 0x6E,
// ItemPacket11 = /*111*/ 0x6F, // UF+ (equipment slots only) (RoF+ checks '(WORD*)slot + 4 != -1' [(WORD*)]slot + 2 would be bag index - if used) (guess)
// ItemPacket11 = /*111*/ 0x6F, // UF+ (equipment slots only) (RoF+ checks '(WORD*)slot + 4 != -1' [(WORD*)]slot + 2 would be bag index - if used) (guess) (appearance (over-level) items?)
// ItemPacket12 = /*112*/ 0x70, // RoF+ (causes stat update) (could be TrophyTribute and GuildTrophyTribute together - two case methodology - is it checking for GuildID?)
// ItemPacketRecovery = /*113*/ 0x71, (same handler as merchant..exception: parameter is '1' versus merchant '0' looks like tab id)
// ItemPacketMerchantRecovery = /*113*/ 0x71,
// ItemPacket14 = /*115*/ 0x73, (real estate/moving crate?)
// ItemPacket__ = /*xxx*/ 0xXX // switch 'default' - all clients
//};
@@ -2119,7 +2072,7 @@ struct AdventureLeaderboard_Struct
/*struct Item_Shop_Struct {
uint16 merchantid;
uint8 itemtype;
EQEmu::Item_Struct item;
EQEmu::ItemBase item;
uint8 iss_unknown001[6];
};*/
@@ -2145,7 +2098,7 @@ struct Illusion_Struct { //size: 256 - SoF
/*092*/ uint32 drakkin_heritage; //
/*096*/ uint32 drakkin_tattoo; //
/*100*/ uint32 drakkin_details; //
/*104*/ uint32 armor_tint[EQEmu::legacy::MaterialCount]; //
/*104*/ EQEmu::TintProfile armor_tint; //
/*140*/ uint8 eyecolor1; // Field Not Identified in any Illusion Struct
/*141*/ uint8 eyecolor2; // Field Not Identified in any Illusion Struct
/*142*/ uint8 unknown138[114]; //
@@ -3415,27 +3368,6 @@ struct PetitionBug_Struct{
char text[1028];
};
struct DyeStruct
{
union
{
struct
{
struct Color_Struct head;
struct Color_Struct chest;
struct Color_Struct arms;
struct Color_Struct wrists;
struct Color_Struct hands;
struct Color_Struct legs;
struct Color_Struct feet;
struct Color_Struct primary; // you can't actually dye this
struct Color_Struct secondary; // or this
}
dyes;
struct Color_Struct dye[EQEmu::legacy::MaterialCount];
};
};
struct ApproveZone_Struct {
char name[64];
uint32 zoneid;
+1 -1
View File
@@ -4,7 +4,7 @@
//this is the only part of an EQStream that is seen by the application.
#include <string>
#include "client_version.h" // inv2 watch
#include "emu_versions.h"
typedef enum {
ESTABLISHED,
+30 -2
View File
@@ -29,7 +29,7 @@ EQEmuConfig *EQEmuConfig::_config = nullptr;
void EQEmuConfig::do_world(TiXmlElement *ele)
{
const char *text;
TiXmlElement * sub_ele;;
TiXmlElement * sub_ele;
text = ParseTextBlock(ele, "shortname");
if (text) {
ShortName = text;
@@ -220,6 +220,29 @@ void EQEmuConfig::do_qsdatabase(TiXmlElement *ele)
}
}
void EQEmuConfig::do_web_interface(TiXmlElement *ele) {
const char *text;
text = ParseTextBlock(ele, "port", true);
if (text)
WebInterfacePort = atoi(text);
text = ParseTextBlock(ele, "cert", true);
if (text)
WebInterfaceCert = text;
text = ParseTextBlock(ele, "priv_key", true);
if (text)
WebInterfacePrivKey = text;
TiXmlElement *sub_ele = ele->FirstChildElement("ssl");
if (sub_ele != nullptr) {
WebInterfaceUseSSL = true;
}
}
void EQEmuConfig::do_zones(TiXmlElement *ele)
{
const char *text;
@@ -486,6 +509,8 @@ std::string EQEmuConfig::GetByName(const std::string &var_name) const
return ("");
}
void EQEmuConfig::Dump() const
{
std::cout << "ShortName = " << ShortName << std::endl;
@@ -516,6 +541,10 @@ void EQEmuConfig::Dump() const
std::cout << "QSDatabasePassword = " << QSDatabasePassword << std::endl;
std::cout << "QSDatabaseDB = " << QSDatabaseDB << std::endl;
std::cout << "QSDatabasePort = " << QSDatabasePort << std::endl;
std::cout << "WebInterfacePort = " << WebInterfacePort << std::endl;
std::cout << "WebInterfaceUseSSL = " << WebInterfaceUseSSL << std::endl;
std::cout << "WebInterfaceCert = " << WebInterfaceCert << std::endl;
std::cout << "WebInterfacePrivKey = " << WebInterfacePrivKey << std::endl;
std::cout << "SpellsFile = " << SpellsFile << std::endl;
std::cout << "OpCodesFile = " << OpCodesFile << std::endl;
std::cout << "PluginPlFile = " << PluginPlFile << std::endl;
@@ -529,6 +558,5 @@ void EQEmuConfig::Dump() const
std::cout << "ZonePortLow = " << ZonePortLow << std::endl;
std::cout << "ZonePortHigh = " << ZonePortHigh << std::endl;
std::cout << "DefaultStatus = " << (int)DefaultStatus << std::endl;
// std::cout << "DynamicCount = " << DynamicCount << std::endl;
}
+7 -1
View File
@@ -76,6 +76,12 @@ class EQEmuConfig : public XMLParser
std::string QSDatabaseDB;
uint16 QSDatabasePort;
// from <web_interface>
uint16 WebInterfacePort;
bool WebInterfaceUseSSL;
std::string WebInterfaceCert;
std::string WebInterfacePrivKey;
// From <files/>
std::string SpellsFile;
std::string OpCodesFile;
@@ -220,7 +226,7 @@ class EQEmuConfig : public XMLParser
return _config->ParseFile(EQEmuConfig::ConfigFile.c_str(), "server");
}
void Dump() const;
void Dump() const;
};
#endif
+1
View File
@@ -4,6 +4,7 @@ ELEMENT(mailserver)
ELEMENT(zones)
ELEMENT(database)
ELEMENT(qsdatabase)
ELEMENT(web_interface)
ELEMENT(files)
ELEMENT(directories)
ELEMENT(launcher)
+1 -1
View File
@@ -40,7 +40,7 @@ struct ExtendedProfile_Struct {
uint16 old_pet_hp; /* Not Used */
uint16 old_pet_mana; /* Not Used */
SpellBuff_Struct pet_buffs[BUFF_COUNT]; /* Not Used */
uint32 pet_items[EQEmu::legacy::MaterialCount]; /* Not Used */
EQEmu::TextureShortProfile pet_items; /* Not Used */
char merc_name[64]; /* Used */
uint32 aa_effects; /* Used */
+2 -2
View File
@@ -213,8 +213,8 @@ enum { //some random constants
#define MAX_NPC_FACTIONS 20
//individual faction pool
#define MAX_PERSONAL_FACTION 1200
#define MIN_PERSONAL_FACTION -3000
#define MAX_PERSONAL_FACTION 2000
#define MIN_PERSONAL_FACTION -2000
//The Level Cap:
//#define LEVEL_CAP RuleI(Character, MaxLevel) //hard cap is 127
-147
View File
@@ -1,147 +0,0 @@
/* EQEMu: Everquest Server Emulator
Copyright (C) 2001-2016 EQEMu Development Team (http://eqemulator.net)
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; version 2 of the License.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY except by those people which sell it, which
are required to give you total support for your newly bought product;
without even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include "inventory_version.h"
bool EQEmu::versions::IsValidInventoryVersion(InventoryVersion inventory_version)
{
if (inventory_version <= InventoryVersion::Unknown || inventory_version > LastInventoryVersion)
return false;
return true;
}
bool EQEmu::versions::IsValidPCInventoryVersion(InventoryVersion inventory_version)
{
if (inventory_version <= InventoryVersion::Unknown || inventory_version > LastPCInventoryVersion)
return false;
return true;
}
bool EQEmu::versions::IsValidNonPCInventoryVersion(InventoryVersion inventory_version)
{
if (inventory_version <= LastPCInventoryVersion || inventory_version > LastNonPCInventoryVersion)
return false;
return true;
}
EQEmu::versions::InventoryVersion EQEmu::versions::ValidateInventoryVersion(InventoryVersion inventory_version)
{
if (inventory_version <= InventoryVersion::Unknown || inventory_version > LastInventoryVersion)
return InventoryVersion::Unknown;
return inventory_version;
}
EQEmu::versions::InventoryVersion EQEmu::versions::ValidatePCInventoryVersion(InventoryVersion inventory_version)
{
if (inventory_version <= InventoryVersion::Unknown || inventory_version > LastPCInventoryVersion)
return InventoryVersion::Unknown;
return inventory_version;
}
EQEmu::versions::InventoryVersion EQEmu::versions::ValidateNonPCInventoryVersion(InventoryVersion inventory_version)
{
if (inventory_version <= LastPCInventoryVersion || inventory_version > LastNonPCInventoryVersion)
return InventoryVersion::Unknown;
return inventory_version;
}
const char* EQEmu::versions::InventoryVersionName(InventoryVersion inventory_version)
{
switch (inventory_version) {
case InventoryVersion::Unknown:
return "Unknown Version";
case InventoryVersion::Client62:
return "Client 6.2";
case InventoryVersion::Titanium:
return "Titanium";
case InventoryVersion::SoF:
return "SoF";
case InventoryVersion::SoD:
return "SoD";
case InventoryVersion::UF:
return "UF";
case InventoryVersion::RoF:
return "RoF";
case InventoryVersion::RoF2:
return "RoF2";
case InventoryVersion::NPC:
return "NPC";
case InventoryVersion::Merc:
return "Merc";
case InventoryVersion::Bot:
return "Bot";
case InventoryVersion::Pet:
return "Pet";
default:
return "Invalid Version";
};
}
EQEmu::versions::ClientVersion EQEmu::versions::ConvertInventoryVersionToClientVersion(InventoryVersion inventory_version)
{
switch (inventory_version) {
case InventoryVersion::Unknown:
case InventoryVersion::Client62:
return ClientVersion::Unknown;
case InventoryVersion::Titanium:
return ClientVersion::Titanium;
case InventoryVersion::SoF:
return ClientVersion::SoF;
case InventoryVersion::SoD:
return ClientVersion::SoD;
case InventoryVersion::UF:
return ClientVersion::UF;
case InventoryVersion::RoF:
return ClientVersion::RoF;
case InventoryVersion::RoF2:
return ClientVersion::RoF2;
default:
return ClientVersion::Unknown;
}
}
EQEmu::versions::InventoryVersion EQEmu::versions::ConvertClientVersionToInventoryVersion(ClientVersion client_version)
{
switch (client_version) {
case ClientVersion::Unknown:
case ClientVersion::Client62:
return InventoryVersion::Unknown;
case ClientVersion::Titanium:
return InventoryVersion::Titanium;
case ClientVersion::SoF:
return InventoryVersion::SoF;
case ClientVersion::SoD:
return InventoryVersion::SoD;
case ClientVersion::UF:
return InventoryVersion::UF;
case ClientVersion::RoF:
return InventoryVersion::RoF;
case ClientVersion::RoF2:
return InventoryVersion::RoF2;
default:
return InventoryVersion::Unknown;
}
}
-63
View File
@@ -1,63 +0,0 @@
/* EQEMu: Everquest Server Emulator
Copyright (C) 2001-2016 EQEMu Development Team (http://eqemulator.net)
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; version 2 of the License.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY except by those people which sell it, which
are required to give you total support for your newly bought product;
without even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifndef COMMON_INVENTORY_VERSION_H
#define COMMON_INVENTORY_VERSION_H
#include "client_version.h"
namespace EQEmu
{
namespace versions {
enum class InventoryVersion {
Unknown = 0,
Client62,
Titanium,
SoF,
SoD,
UF,
RoF,
RoF2,
NPC,
Merc,
Bot,
Pet
};
static const InventoryVersion LastInventoryVersion = InventoryVersion::Pet;
static const InventoryVersion LastPCInventoryVersion = InventoryVersion::RoF2;
static const InventoryVersion LastNonPCInventoryVersion = InventoryVersion::Pet;
static const size_t InventoryVersionCount = (static_cast<size_t>(LastInventoryVersion) + 1);
extern bool IsValidInventoryVersion(InventoryVersion inventory_version);
extern bool IsValidPCInventoryVersion(InventoryVersion inventory_version);
extern bool IsValidNonPCInventoryVersion(InventoryVersion inventory_version);
extern InventoryVersion ValidateInventoryVersion(InventoryVersion inventory_version);
extern InventoryVersion ValidatePCInventoryVersion(InventoryVersion inventory_version);
extern InventoryVersion ValidateNonPCInventoryVersion(InventoryVersion inventory_version);
extern const char* InventoryVersionName(InventoryVersion inventory_version);
extern ClientVersion ConvertInventoryVersionToClientVersion(InventoryVersion inventory_version);
extern InventoryVersion ConvertClientVersionToInventoryVersion(ClientVersion client_version);
} /*versions*/
} /*EQEmu*/
#endif /*COMMON_INVENTORY_VERSION_H*/
+37 -34
View File
@@ -370,7 +370,7 @@ ItemInst* Inventory::PopItem(int16 slot_id)
return p;
}
bool Inventory::HasSpaceForItem(const EQEmu::Item_Struct *ItemToTry, int16 Quantity) {
bool Inventory::HasSpaceForItem(const EQEmu::ItemBase *ItemToTry, int16 Quantity) {
if (ItemToTry->Stackable) {
@@ -852,23 +852,23 @@ int16 Inventory::CalcSlotFromMaterial(uint8 material)
{
switch (material)
{
case EQEmu::legacy::MaterialHead:
case EQEmu::textures::TextureHead:
return EQEmu::legacy::SlotHead;
case EQEmu::legacy::MaterialChest:
case EQEmu::textures::TextureChest:
return EQEmu::legacy::SlotChest;
case EQEmu::legacy::MaterialArms:
case EQEmu::textures::TextureArms:
return EQEmu::legacy::SlotArms;
case EQEmu::legacy::MaterialWrist:
case EQEmu::textures::TextureWrist:
return EQEmu::legacy::SlotWrist1; // there's 2 bracers, only one bracer material
case EQEmu::legacy::MaterialHands:
case EQEmu::textures::TextureHands:
return EQEmu::legacy::SlotHands;
case EQEmu::legacy::MaterialLegs:
case EQEmu::textures::TextureLegs:
return EQEmu::legacy::SlotLegs;
case EQEmu::legacy::MaterialFeet:
case EQEmu::textures::TextureFeet:
return EQEmu::legacy::SlotFeet;
case EQEmu::legacy::MaterialPrimary:
case EQEmu::textures::TexturePrimary:
return EQEmu::legacy::SlotPrimary;
case EQEmu::legacy::MaterialSecondary:
case EQEmu::textures::TextureSecondary:
return EQEmu::legacy::SlotSecondary;
default:
return INVALID_INDEX;
@@ -880,30 +880,30 @@ uint8 Inventory::CalcMaterialFromSlot(int16 equipslot)
switch (equipslot)
{
case EQEmu::legacy::SlotHead:
return EQEmu::legacy::MaterialHead;
return EQEmu::textures::TextureHead;
case EQEmu::legacy::SlotChest:
return EQEmu::legacy::MaterialChest;
return EQEmu::textures::TextureChest;
case EQEmu::legacy::SlotArms:
return EQEmu::legacy::MaterialArms;
return EQEmu::textures::TextureArms;
case EQEmu::legacy::SlotWrist1:
//case SLOT_BRACER02: // non-live behavior
return EQEmu::legacy::MaterialWrist;
return EQEmu::textures::TextureWrist;
case EQEmu::legacy::SlotHands:
return EQEmu::legacy::MaterialHands;
return EQEmu::textures::TextureHands;
case EQEmu::legacy::SlotLegs:
return EQEmu::legacy::MaterialLegs;
return EQEmu::textures::TextureLegs;
case EQEmu::legacy::SlotFeet:
return EQEmu::legacy::MaterialFeet;
return EQEmu::textures::TextureFeet;
case EQEmu::legacy::SlotPrimary:
return EQEmu::legacy::MaterialPrimary;
return EQEmu::textures::TexturePrimary;
case EQEmu::legacy::SlotSecondary:
return EQEmu::legacy::MaterialSecondary;
return EQEmu::textures::TextureSecondary;
default:
return EQEmu::legacy::MaterialInvalid;
return EQEmu::textures::TextureInvalid;
}
}
bool Inventory::CanItemFitInContainer(const EQEmu::Item_Struct *ItemToTry, const EQEmu::Item_Struct *Container) {
bool Inventory::CanItemFitInContainer(const EQEmu::ItemBase *ItemToTry, const EQEmu::ItemBase *Container) {
if (!ItemToTry || !Container)
return false;
@@ -929,7 +929,7 @@ bool Inventory::SupportsClickCasting(int16 slot_id)
}
else if (slot_id >= EQEmu::legacy::GENERAL_BAGS_BEGIN && slot_id <= EQEmu::legacy::GENERAL_BAGS_END)
{
if (EQEmu::inventory::AllowClickCastFromBag(m_inventory_version))
if (EQEmu::inventory::Lookup(m_inventory_version)->AllowClickCastFromBag)
return true;
}
@@ -1440,10 +1440,10 @@ int16 Inventory::_HasItemByLoreGroup(ItemInstQueue& iqueue, uint32 loregroup)
//
// class ItemInst
//
ItemInst::ItemInst(const EQEmu::Item_Struct* item, int16 charges) {
ItemInst::ItemInst(const EQEmu::ItemBase* item, int16 charges) {
m_use_type = ItemInstNormal;
if(item) {
m_item = new EQEmu::Item_Struct(*item);
m_item = new EQEmu::ItemBase(*item);
} else {
m_item = nullptr;
}
@@ -1474,7 +1474,7 @@ ItemInst::ItemInst(SharedDatabase *db, uint32 item_id, int16 charges) {
m_use_type = ItemInstNormal;
m_item = db->GetItem(item_id);
if(m_item) {
m_item = new EQEmu::Item_Struct(*m_item);
m_item = new EQEmu::ItemBase(*m_item);
}
else {
m_item = nullptr;
@@ -1529,7 +1529,7 @@ ItemInst::ItemInst(const ItemInst& copy)
{
m_use_type=copy.m_use_type;
if(copy.m_item)
m_item = new EQEmu::Item_Struct(*copy.m_item);
m_item = new EQEmu::ItemBase(*copy.m_item);
else
m_item = nullptr;
@@ -1565,7 +1565,7 @@ ItemInst::ItemInst(const ItemInst& copy)
m_evolveLvl = copy.m_evolveLvl;
m_activated = copy.m_activated;
if (copy.m_scaledItem)
m_scaledItem = new EQEmu::Item_Struct(*copy.m_scaledItem);
m_scaledItem = new EQEmu::ItemBase(*copy.m_scaledItem);
else
m_scaledItem = nullptr;
@@ -1800,7 +1800,7 @@ void ItemInst::ClearByFlags(byFlagSetting is_nodrop, byFlagSetting is_norent)
continue;
}
const EQEmu::Item_Struct* item = inst->GetItem();
const EQEmu::ItemBase* item = inst->GetItem();
if (item == nullptr) {
cur = m_contents.erase(cur);
continue;
@@ -1863,6 +1863,9 @@ uint8 ItemInst::FirstOpenSlot() const
uint8 ItemInst::GetTotalItemCount() const
{
if (!m_item)
return 0;
uint8 item_count = 1;
if (m_item && !m_item->IsClassBag()) { return item_count; }
@@ -1941,7 +1944,7 @@ bool ItemInst::UpdateOrnamentationInfo() {
int32 ornamentationAugtype = RuleI(Character, OrnamentationAugmentType);
if (GetOrnamentationAug(ornamentationAugtype))
{
const EQEmu::Item_Struct* ornamentItem;
const EQEmu::ItemBase* ornamentItem;
ornamentItem = GetOrnamentationAug(ornamentationAugtype)->GetItem();
if (ornamentItem != nullptr)
{
@@ -1968,7 +1971,7 @@ bool ItemInst::UpdateOrnamentationInfo() {
return ornamentSet;
}
bool ItemInst::CanTransform(const EQEmu::Item_Struct *ItemToTry, const EQEmu::Item_Struct *Container, bool AllowAll) {
bool ItemInst::CanTransform(const EQEmu::ItemBase *ItemToTry, const EQEmu::ItemBase *Container, bool AllowAll) {
if (!ItemToTry || !Container) return false;
if (ItemToTry->ItemType == EQEmu::item::ItemTypeArrow || strnlen(Container->CharmFile, 30) == 0)
@@ -2102,7 +2105,7 @@ bool ItemInst::IsAmmo() const
}
const EQEmu::Item_Struct* ItemInst::GetItem() const
const EQEmu::ItemBase* ItemInst::GetItem() const
{
if (!m_item)
return nullptr;
@@ -2113,7 +2116,7 @@ const EQEmu::Item_Struct* ItemInst::GetItem() const
return m_item;
}
const EQEmu::Item_Struct* ItemInst::GetUnscaledItem() const
const EQEmu::ItemBase* ItemInst::GetUnscaledItem() const
{
// No operator calls and defaults to nullptr
return m_item;
@@ -2221,10 +2224,10 @@ void ItemInst::ScaleItem() {
return;
if (m_scaledItem) {
memcpy(m_scaledItem, m_item, sizeof(EQEmu::Item_Struct));
memcpy(m_scaledItem, m_item, sizeof(EQEmu::ItemBase));
}
else {
m_scaledItem = new EQEmu::Item_Struct(*m_item);
m_scaledItem = new EQEmu::ItemBase(*m_item);
}
float Mult = (float)(GetExp()) / 10000; // scaling is determined by exp, with 10,000 being full stats
+11 -13
View File
@@ -29,16 +29,14 @@ class ItemParse; // Parses item packets
class EvolveInfo; // Stores information about an evolving item family
#include "../common/eq_constants.h"
#include "../common/item_struct.h"
#include "../common/item_base.h"
#include "../common/timer.h"
#include "../common/bodytypes.h"
#include "../common/deity.h" // aren't we already in '/common'?
#include "string_util.h"
#include "../common/deity.h"
#include "../common/memory_buffer.h"
#include <list>
#include <map>
//#include <sstream>
namespace ItemField
@@ -177,7 +175,7 @@ public:
ItemInst* PopItem(int16 slot_id);
// Check whether there is space for the specified number of the specified item.
bool HasSpaceForItem(const EQEmu::Item_Struct *ItemToTry, int16 Quantity);
bool HasSpaceForItem(const EQEmu::ItemBase *ItemToTry, int16 Quantity);
// Check whether item exists in inventory
// where argument specifies OR'd list of invWhere constants to look
@@ -202,7 +200,7 @@ public:
static int16 CalcSlotFromMaterial(uint8 material);
static uint8 CalcMaterialFromSlot(int16 equipslot);
static bool CanItemFitInContainer(const EQEmu::Item_Struct *ItemToTry, const EQEmu::Item_Struct *Container);
static bool CanItemFitInContainer(const EQEmu::ItemBase *ItemToTry, const EQEmu::ItemBase *Container);
// Test for valid inventory casting slot
bool SupportsClickCasting(int16 slot_id);
@@ -279,7 +277,7 @@ public:
/////////////////////////
// Constructors/Destructor
ItemInst(const EQEmu::Item_Struct* item = nullptr, int16 charges = 0);
ItemInst(const EQEmu::ItemBase* item = nullptr, int16 charges = 0);
ItemInst(SharedDatabase *db, uint32 item_id, int16 charges = 0);
@@ -348,7 +346,7 @@ public:
bool IsAugmented();
ItemInst* GetOrnamentationAug(int32 ornamentationAugtype) const;
bool UpdateOrnamentationInfo();
static bool CanTransform(const EQEmu::Item_Struct *ItemToTry, const EQEmu::Item_Struct *Container, bool AllowAll = false);
static bool CanTransform(const EQEmu::ItemBase *ItemToTry, const EQEmu::ItemBase *Container, bool AllowAll = false);
// Has attack/delay?
bool IsWeapon() const;
@@ -357,8 +355,8 @@ public:
// Accessors
const uint32 GetID() const { return ((m_item) ? m_item->ID : NO_ITEM); }
const uint32 GetItemScriptID() const { return ((m_item) ? m_item->ScriptFileID : NO_ITEM); }
const EQEmu::Item_Struct* GetItem() const;
const EQEmu::Item_Struct* GetUnscaledItem() const;
const EQEmu::ItemBase* GetItem() const;
const EQEmu::ItemBase* GetUnscaledItem() const;
int16 GetCharges() const { return m_charges; }
void SetCharges(int16 charges) { m_charges = charges; }
@@ -502,7 +500,7 @@ protected:
void _PutItem(uint8 index, ItemInst* inst) { m_contents[index] = inst; }
ItemInstTypes m_use_type; // Usage type for item
const EQEmu::Item_Struct* m_item; // Ptr to item data
const EQEmu::ItemBase* m_item; // Ptr to item data
int16 m_charges; // # of charges for chargeable items
uint32 m_price; // Bazaar /trader price
uint32 m_color;
@@ -514,7 +512,7 @@ protected:
uint32 m_exp;
int8 m_evolveLvl;
bool m_activated;
EQEmu::Item_Struct* m_scaledItem;
EQEmu::ItemBase* m_scaledItem;
EvolveInfo* m_evolveInfo;
bool m_scaling;
uint32 m_ornamenticon;
@@ -17,7 +17,7 @@
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include "item_struct.h"
#include "item_base.h"
#include "classes.h"
#include "races.h"
//#include "deity.h"
@@ -167,7 +167,7 @@ uint8 EQEmu::item::ConvertAugTypeBitToAugType(uint32 aug_type_bit)
}
}
bool EQEmu::Item_Struct::IsEquipable(uint16 race_id, uint16 class_id)
bool EQEmu::ItemBase::IsEquipable(uint16 race_id, uint16 class_id)
{
if (!(Races & GetPlayerRaceBit(race_id)))
return false;
@@ -178,32 +178,32 @@ bool EQEmu::Item_Struct::IsEquipable(uint16 race_id, uint16 class_id)
return true;
}
bool EQEmu::Item_Struct::IsClassCommon()
bool EQEmu::ItemBase::IsClassCommon()
{
return (ItemClass == item::ItemClassCommon);
}
bool EQEmu::Item_Struct::IsClassBag()
bool EQEmu::ItemBase::IsClassBag()
{
return (ItemClass == item::ItemClassBag);
}
bool EQEmu::Item_Struct::IsClassBook()
bool EQEmu::ItemBase::IsClassBook()
{
return (ItemClass == item::ItemClassBook);
}
bool EQEmu::Item_Struct::IsType1HWeapon()
bool EQEmu::ItemBase::IsType1HWeapon()
{
return ((ItemType == item::ItemType1HBlunt) || (ItemType == item::ItemType1HSlash) || (ItemType == item::ItemType1HPiercing));
}
bool EQEmu::Item_Struct::IsType2HWeapon()
bool EQEmu::ItemBase::IsType2HWeapon()
{
return ((ItemType == item::ItemType2HBlunt) || (ItemType == item::ItemType2HSlash) || (ItemType == item::ItemType2HPiercing));
}
bool EQEmu::Item_Struct::IsTypeShield()
bool EQEmu::ItemBase::IsTypeShield()
{
return (ItemType == item::ItemTypeShield);
}
+16 -16
View File
@@ -17,8 +17,8 @@
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 04111-1307 USA
*/
#ifndef COMMON_ITEM_STRUCT_H
#define COMMON_ITEM_STRUCT_H
#ifndef COMMON_ITEM_BASE_H
#define COMMON_ITEM_BASE_H
/*
@@ -336,10 +336,10 @@ namespace EQEmu
};
enum ItemDataType : uint8 {
ItemDataTypeBase = 0,
ItemDataTypeScaling,
ItemDataTypeEvolving,
ItemDataTypeCount
ItemDataBase = 0,
ItemDataScaling,
ItemDataEvolving,
ItemDataCount
};
struct ItemEffect_Struct {
@@ -364,10 +364,10 @@ namespace EQEmu
const void * inst;
};
struct Item_Struct {
struct ItemBase {
// Non packet based fields
uint8 MinStatus;
//uint8 ItemDataType;
uint8 ItemDataType; // memset to item::ItemDataBase ('0') during mmf load
// Packet based fields
uint8 ItemClass; // Item Type: 0=common, 1=container, 2=book
@@ -551,15 +551,15 @@ namespace EQEmu
bool IsType2HWeapon();
bool IsTypeShield();
bool IsEquipable(uint16 Race, uint16 Class) const { return const_cast<Item_Struct*>(this)->IsEquipable(Race, Class); }
bool IsClassCommon() const { return const_cast<Item_Struct*>(this)->IsClassCommon(); }
bool IsClassBag() const { return const_cast<Item_Struct*>(this)->IsClassBag(); }
bool IsClassBook() const { return const_cast<Item_Struct*>(this)->IsClassBook(); }
bool IsType1HWeapon() const { return const_cast<Item_Struct*>(this)->IsType1HWeapon(); }
bool IsType2HWeapon() const { return const_cast<Item_Struct*>(this)->IsType2HWeapon(); }
bool IsTypeShield() const { return const_cast<Item_Struct*>(this)->IsTypeShield(); }
bool IsEquipable(uint16 Race, uint16 Class) const { return const_cast<ItemBase*>(this)->IsEquipable(Race, Class); }
bool IsClassCommon() const { return const_cast<ItemBase*>(this)->IsClassCommon(); }
bool IsClassBag() const { return const_cast<ItemBase*>(this)->IsClassBag(); }
bool IsClassBook() const { return const_cast<ItemBase*>(this)->IsClassBook(); }
bool IsType1HWeapon() const { return const_cast<ItemBase*>(this)->IsType1HWeapon(); }
bool IsType2HWeapon() const { return const_cast<ItemBase*>(this)->IsType2HWeapon(); }
bool IsTypeShield() const { return const_cast<ItemBase*>(this)->IsTypeShield(); }
};
} /*EQEmu*/
#endif /*COMMON_ITEM_STRUCT_H*/
#endif /*COMMON_ITEM_BASE_H*/
+4 -4
View File
@@ -10,7 +10,7 @@
but WITHOUT ANY WARRANTY except by those people which sell it, which
are required to give you total support for your newly bought product;
without even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE. See the GNU General Public License for more details.
A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
@@ -82,14 +82,14 @@ bool EQEmu::lightsource::IsLevelGreater(uint8 left_type, uint8 right_type)
return (light_levels[left_type] > light_levels[right_type]);
}
EQEmu::lightsource::Light_Struct::Light_Struct()
EQEmu::LightSource_Struct::LightSource_Struct()
{
Clear();
}
void EQEmu::lightsource::Light_Struct::Clear()
void EQEmu::LightSource_Struct::Clear()
{
memset(&Slot, 0, (sizeof(uint8) * sizeof(Slot)));
memset(&Slot, 0, (sizeof(uint8) * lightsource::LightCount));
}
void EQEmu::LightSourceProfile::Clear()
+13 -14
View File
@@ -10,7 +10,7 @@
but WITHOUT ANY WARRANTY except by those people which sell it, which
are required to give you total support for your newly bought product;
without even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE. See the GNU General Public License for more details.
A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
@@ -34,7 +34,6 @@ namespace EQEmu
LightCount
};
enum LightType {
LightTypeNone = 0,
LightTypeCandle,
@@ -70,21 +69,21 @@ namespace EQEmu
LightLevelCount
};
struct Light_Struct {
uint8 Slot[LightCount];
Light_Struct();
void Clear();
inline uint8& operator[](LightSlot index) { return Slot[index]; }
};
extern uint8 TypeToLevel(uint8 light_type);
extern bool IsLevelGreater(uint8 left_type, uint8 right_type);
}; /*lightsource*/
struct LightSource_Struct {
uint8 Slot[lightsource::LightCount];
LightSource_Struct();
void Clear();
inline uint8& operator[](lightsource::LightSlot index) { return Slot[index]; }
};
struct LightSourceProfile {
/*
Current criteria (light types):
@@ -103,8 +102,8 @@ namespace EQEmu
-- The timer-based update cancels out the invalid light source
*/
lightsource::Light_Struct Type; // Light types (classifications)
lightsource::Light_Struct Level; // Light levels (intensities) - used to determine which light source should be active
LightSource_Struct Type; // Light types (classifications)
LightSource_Struct Level; // Light levels (intensities) - used to determine which light source should be active
LightSourceProfile() { }
+277
View File
@@ -0,0 +1,277 @@
/* EQEMu: Everquest Server Emulator
Copyright (C) 2001-2016 EQEMu Development Team (http://eqemulator.net)
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; version 2 of the License.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY except by those people which sell it, which
are required to give you total support for your newly bought product;
without even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include "memory_buffer.h"
EQEmu::MemoryBuffer::MemoryBuffer()
{
buffer_ = nullptr;
size_ = 0;
capacity_ = 0;
read_pos_ = 0;
write_pos_ = 0;
}
EQEmu::MemoryBuffer::MemoryBuffer(size_t sz)
{
buffer_ = nullptr;
size_ = 0;
capacity_ = 0;
read_pos_ = 0;
write_pos_ = 0;
Resize(sz);
}
EQEmu::MemoryBuffer::MemoryBuffer(const MemoryBuffer &other)
{
if(other.capacity_) {
buffer_ = new uchar[other.capacity_];
memcpy(buffer_, other.buffer_, other.capacity_);
} else {
buffer_ = nullptr;
}
size_ = other.size_;
capacity_ = other.capacity_;
write_pos_ = other.write_pos_;
read_pos_ = other.read_pos_;
}
EQEmu::MemoryBuffer::MemoryBuffer(MemoryBuffer &&other)
{
uchar *tbuf = other.buffer_;
size_t tsz = other.size_;
size_t tcapacity = other.capacity_;
size_t twrite_pos = other.write_pos_;
size_t tread_pos = other.read_pos_;
other.buffer_ = nullptr;
other.size_ = 0;
other.capacity_ = 0;
other.read_pos_ = 0;
other.write_pos_ = 0;
buffer_ = tbuf;
size_ = tsz;
capacity_ = tcapacity;
write_pos_ = twrite_pos;
read_pos_ = tread_pos;
}
EQEmu::MemoryBuffer& EQEmu::MemoryBuffer::operator=(const MemoryBuffer &other)
{
if(this == &other) {
return *this;
}
if(buffer_) {
delete[] buffer_;
}
if(other.capacity_) {
buffer_ = new uchar[other.capacity_];
memcpy(buffer_, other.buffer_, other.capacity_);
}
else {
buffer_ = nullptr;
}
size_ = other.size_;
capacity_ = other.capacity_;
write_pos_ = other.write_pos_;
read_pos_ = other.read_pos_;
return *this;
}
EQEmu::MemoryBuffer& EQEmu::MemoryBuffer::operator=(MemoryBuffer &&other)
{
uchar *tbuf = other.buffer_;
size_t tsz = other.size_;
size_t tcapacity = other.capacity_;
size_t twrite_pos = other.write_pos_;
size_t tread_pos = other.read_pos_;
other.buffer_ = nullptr;
other.size_ = 0;
other.capacity_ = 0;
other.read_pos_ = 0;
other.write_pos_ = 0;
buffer_ = tbuf;
size_ = tsz;
capacity_ = tcapacity;
write_pos_ = twrite_pos;
read_pos_ = tread_pos;
return *this;
}
EQEmu::MemoryBuffer& EQEmu::MemoryBuffer::operator+=(const MemoryBuffer &rhs)
{
if(!rhs.buffer_) {
return *this;
}
if(buffer_) {
size_t old_size = size_;
Resize(size_ + rhs.size_);
memcpy(&buffer_[old_size], rhs.buffer_, rhs.size_);
} else {
buffer_ = new uchar[rhs.capacity_];
memcpy(buffer_, rhs.buffer_, rhs.capacity_);
size_ = rhs.size_;
capacity_ = rhs.capacity_;
}
return *this;
}
EQEmu::MemoryBuffer::~MemoryBuffer()
{
Clear();
}
uchar& EQEmu::MemoryBuffer::operator[](size_t pos)
{
return buffer_[pos];
}
const uchar& EQEmu::MemoryBuffer::operator[](size_t pos) const
{
return buffer_[pos];
}
bool EQEmu::MemoryBuffer::Empty()
{
return size_ == 0;
}
bool EQEmu::MemoryBuffer::Empty() const
{
return size_ == 0;
}
size_t EQEmu::MemoryBuffer::Size()
{
return size_;
}
size_t EQEmu::MemoryBuffer::Size() const
{
return size_;
}
size_t EQEmu::MemoryBuffer::Capacity()
{
return capacity_;
}
size_t EQEmu::MemoryBuffer::Capacity() const
{
return capacity_;
}
void EQEmu::MemoryBuffer::Resize(size_t sz)
{
if(!buffer_) {
size_t new_size = sz + 64;
buffer_ = new uchar[new_size];
capacity_ = new_size;
size_ = sz;
memset(buffer_, 0, capacity_);
return;
}
if(sz > capacity_) {
size_t new_size = sz + 32;
uchar *temp = new uchar[new_size];
memcpy(temp, buffer_, capacity_);
delete[] buffer_;
buffer_ = temp;
capacity_ = new_size;
size_ = sz;
}
else {
size_ = sz;
}
}
void EQEmu::MemoryBuffer::Clear()
{
if(buffer_) {
delete[] buffer_;
buffer_ = nullptr;
}
size_ = 0;
capacity_ = 0;
write_pos_ = 0;
read_pos_ = 0;
}
void EQEmu::MemoryBuffer::Zero()
{
if(buffer_) {
memset(buffer_, 0, capacity_);
}
}
void EQEmu::MemoryBuffer::Write(const char *val, size_t len)
{
size_t size_needed = write_pos_ + len;
Resize(size_needed);
memcpy(&buffer_[write_pos_], val, len);
write_pos_ += len;
}
void EQEmu::MemoryBuffer::Read(uchar *buf, size_t len)
{
memcpy(buf, &buffer_[read_pos_], len);
read_pos_ += len;
}
void EQEmu::MemoryBuffer::Read(char *str)
{
size_t len = strlen((const char*)&buffer_[read_pos_]);
memcpy(str, &buffer_[read_pos_], len);
read_pos_ += len;
}
void EQEmu::OutBuffer::overwrite(OutBuffer::pos_type position, const char *_Str, std::streamsize _Count)
{
auto last_pos = tellp();
seekp(position);
write(_Str, _Count);
seekp(last_pos);
}
uchar* EQEmu::OutBuffer::detach()
{
size_t buffer_size = tellp();
if (buffer_size == 0)
return nullptr;
auto out_buffer = new uchar[buffer_size];
memcpy(out_buffer, str().c_str(), buffer_size);
flush();
return out_buffer;
}
+134
View File
@@ -0,0 +1,134 @@
/* EQEMu: Everquest Server Emulator
Copyright (C) 2001-2016 EQEMu Development Team (http://eqemulator.net)
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; version 2 of the License.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY except by those people which sell it, which
are required to give you total support for your newly bought product;
without even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifndef COMMON_MEMORY_BUFFER
#define COMMON_MEMORY_BUFFER
#include "types.h"
#include <type_traits>
#include <string.h>
#include <string>
#include <sstream>
namespace EQEmu
{
class MemoryBuffer {
public:
MemoryBuffer();
MemoryBuffer(size_t sz);
MemoryBuffer(const MemoryBuffer &other);
MemoryBuffer(MemoryBuffer &&other);
MemoryBuffer& operator=(const MemoryBuffer &other);
MemoryBuffer& operator=(MemoryBuffer &&other);
MemoryBuffer& operator+=(const MemoryBuffer &rhs);
friend MemoryBuffer operator+(MemoryBuffer lhs, const MemoryBuffer& rhs) { return lhs += rhs; }
~MemoryBuffer();
uchar& operator[](size_t pos);
const uchar& operator[](size_t pos) const;
template<typename T>
operator T*() {
return reinterpret_cast<T*>(buffer_);
}
template<typename T>
operator T*() const {
return reinterpret_cast<T*>(buffer_);
}
operator bool() { return buffer_ != nullptr; }
operator bool() const { return buffer_ != nullptr; }
bool Empty();
bool Empty() const;
size_t Size();
size_t Size() const;
size_t Capacity();
size_t Capacity() const;
void Resize(size_t sz);
void Clear();
void Zero();
template<typename T>
void Write(T val) {
static_assert(std::is_pod<T>::value, "MemoryBuffer::Write<T>(T val) only works on pod and string types.");
Write((const char*)&val, sizeof(T));
}
template<typename T>
T Read() {
static_assert(std::is_pod<T>::value, "MemoryBuffer::Read<T>() only works on pod and string types.");
T temp;
Read((uchar*)&temp, sizeof(T));
return temp;
}
void Write(const std::string &val) {
Write(val.c_str(), val.length());
Write((uint8)0);
}
void Write(const char *val) {
size_t len = strlen(val);
Write(val, len);
Write((uint8)0);
}
std::string ReadString() {
std::string ret;
size_t len = strlen((const char*)&buffer_[read_pos_]);
ret.resize(len);
memcpy(&ret[0], &buffer_[read_pos_], len);
read_pos_ += len + 1;
return ret;
}
void Write(const char *val, size_t len);
void Read(uchar *buf, size_t len);
void Read(char *str);
inline size_t GetWritePosition() { return write_pos_; }
inline void SetWritePosition(size_t wp) { write_pos_ = wp; }
inline void WriteSkipBytes(size_t skip) { write_pos_ += skip; }
inline size_t GetReadPosition() { return read_pos_; }
inline void SetReadPosition(size_t rp) { read_pos_ = rp; }
inline void ReadSkipBytes(size_t skip) { read_pos_ += skip; }
private:
uchar *buffer_;
size_t size_;
size_t capacity_;
size_t write_pos_;
size_t read_pos_;
};
class OutBuffer : public std::stringstream {
public:
inline size_t size() { return tellp(); }
void overwrite(OutBuffer::pos_type position, const char *_Str, std::streamsize _Count);
uchar* detach();
};
} /*EQEmu*/
#endif /*COMMON_MEMORY_BUFFER*/
+2 -2
View File
@@ -173,7 +173,7 @@ IN(OP_TradeAcceptClick, TradeAccept_Struct);
IN(OP_BoardBoat, EntityId_Struct); //not really the struct, just 4 bytes
INz(OP_LeaveBoat); //?
IN(OP_RandomReq, RandomReq_Struct);
IN(OP_Buff, SpellBuffFade_Struct);
IN(OP_Buff, SpellBuffPacket_Struct);
IN(OP_GMHideMe, SpawnAppearance_Struct);
IN(OP_GMNameChange, GMName_Struct);
IN(OP_GMKill, GMKill_Struct);
@@ -415,7 +415,7 @@ OUTv(OP_SendAATable, SendAA_Struct);
OUT(OP_AAAction, UseAA_Struct);
OUT(OP_Bazaar, BazaarReturnDone_Struct);
//alt:OUT(OP_Bazaar, BazaarWelcome_Struct);
OUT(OP_Buff, SpellBuffFade_Struct);
OUT(OP_Buff, SpellBuffPacket_Struct);
OUT(OP_ClickObject, ClickObject_Struct);
OUT(OP_ClientUpdate, PlayerPositionUpdateServer_Struct);
OUT(OP_SpawnPositionUpdate, SpawnPositionUpdate_Struct);
+159 -74
View File
@@ -63,6 +63,9 @@ namespace RoF
// client to server text link converter
static inline void RoFToServerTextLink(std::string& serverTextLink, const std::string& rofTextLink);
static inline CastingSlot ServerToRoFCastingSlot(EQEmu::CastingSlot slot);
static inline EQEmu::CastingSlot RoFToServerCastingSlot(CastingSlot slot);
void Register(EQStreamIdentifier &into)
{
//create our opcode manager if we havent already
@@ -405,22 +408,31 @@ namespace RoF
ENCODE(OP_Buff)
{
ENCODE_LENGTH_EXACT(SpellBuffFade_Struct);
SETUP_DIRECT_ENCODE(SpellBuffFade_Struct, structs::SpellBuffFade_Struct_Live);
ENCODE_LENGTH_EXACT(SpellBuffPacket_Struct);
SETUP_DIRECT_ENCODE(SpellBuffPacket_Struct, structs::SpellBuffPacket_Struct);
OUT(entityid);
eq->unknown004 = 2;
//eq->level = 80;
//eq->effect = 0;
OUT(level);
OUT(effect);
eq->unknown007 = 0;
eq->unknown008 = 1.0f;
OUT(spellid);
OUT(duration);
eq->playerId = 0x7cde;
OUT(slotid);
OUT(num_hits);
OUT(buff.effect_type);
OUT(buff.level);
// just so we're 100% sure we get a 1.0f ...
eq->buff.bard_modifier = emu->buff.bard_modifier == 10 ? 1.0f : emu->buff.bard_modifier / 10.0f;
OUT(buff.spellid);
OUT(buff.duration);
OUT(buff.player_id);
OUT(buff.num_hits);
OUT(buff.y);
OUT(buff.x);
OUT(buff.z);
uint16 buffslot = emu->slotid;
// Not sure if this is needs amending for RoF yet.
if (buffslot >= 25)
{
buffslot += 17;
}
// TODO: implement slot_data stuff
eq->slotid = buffslot;
if (emu->bufffade == 1)
eq->bufffade = 1;
else
@@ -432,10 +444,10 @@ namespace RoF
{
outapp = new EQApplicationPacket(OP_BuffCreate, 29);
outapp->WriteUInt32(emu->entityid);
outapp->WriteUInt32(0x0271); // Unk
outapp->WriteUInt32(0); // tic timer
outapp->WriteUInt8(0); // Type of OP_BuffCreate packet ?
outapp->WriteUInt16(1); // 1 buff in this packet
outapp->WriteUInt32(emu->slotid);
outapp->WriteUInt32(buffslot);
outapp->WriteUInt32(0xffffffff); // SpellID (0xffff to remove)
outapp->WriteUInt32(0); // Duration
outapp->WriteUInt32(0); // ?
@@ -498,10 +510,7 @@ namespace RoF
ENCODE_LENGTH_EXACT(CastSpell_Struct);
SETUP_DIRECT_ENCODE(CastSpell_Struct, structs::CastSpell_Struct);
if (emu->slot == 10)
eq->slot = 13;
else
OUT(slot);
eq->slot = static_cast<uint32>(ServerToRoFCastingSlot(static_cast<EQEmu::CastingSlot>(emu->slot)));
OUT(spell_id);
eq->inventory_slot = ServerToRoFSlot(emu->inventoryslot);
@@ -1614,7 +1623,8 @@ namespace RoF
OUT(new_mana);
OUT(stamina);
OUT(spell_id);
eq->unknown16 = -1; // Self Interrupt/Success = -1, Fizzle = 1, Other Interrupt = 2?
OUT(keepcasting);
eq->slot = -1; // this is spell gem slot. It's -1 in normal operation
FINISH_ENCODE();
}
@@ -2003,18 +2013,18 @@ namespace RoF
__packet->WriteUInt8(1); // 1 indicates all buffs on the pet (0 to add or remove a single buff)
__packet->WriteUInt16(emu->buffcount);
for (uint16 i = 0; i < BUFF_COUNT; ++i)
for (uint16 i = 0; i < PET_BUFF_COUNT; ++i)
{
if (emu->spellid[i])
{
__packet->WriteUInt32(i);
__packet->WriteUInt32(emu->spellid[i]);
__packet->WriteUInt32(emu->ticsremaining[i]);
__packet->WriteUInt32(0); // Unknown
__packet->WriteUInt32(0); // numhits
__packet->WriteString("");
}
}
__packet->WriteUInt8(0); // Unknown
__packet->WriteUInt8(0); // some sort of type
FINISH_ENCODE();
}
@@ -2068,9 +2078,9 @@ namespace RoF
outapp->WriteUInt32(22); // Equipment count
for (int r = 0; r < 9; r++)
for (int r = EQEmu::textures::TextureBegin; r < EQEmu::textures::TextureCount; r++)
{
outapp->WriteUInt32(emu->item_material[r]);
outapp->WriteUInt32(emu->item_material.Slot[r].Material);
outapp->WriteUInt32(0);
outapp->WriteUInt32(0);
outapp->WriteUInt32(0);
@@ -2088,9 +2098,9 @@ namespace RoF
outapp->WriteUInt32(0);
}
outapp->WriteUInt32(9); // Equipment2 count
outapp->WriteUInt32(EQEmu::textures::TextureCount); // Equipment2 count
for (int r = 0; r < 9; r++)
for (int r = EQEmu::textures::TextureBegin; r < EQEmu::textures::TextureCount; r++)
{
outapp->WriteUInt32(0);
outapp->WriteUInt32(0);
@@ -2099,21 +2109,21 @@ namespace RoF
outapp->WriteUInt32(0);
}
outapp->WriteUInt32(9); // Tint Count
outapp->WriteUInt32(EQEmu::textures::TextureCount); // Tint Count
for (int r = 0; r < 7; r++)
{
outapp->WriteUInt32(emu->item_tint[r].Color);
outapp->WriteUInt32(emu->item_tint.Slot[r].Color);
}
// Write zeroes for extra two tint values
outapp->WriteUInt32(0);
outapp->WriteUInt32(0);
outapp->WriteUInt32(9); // Tint2 Count
outapp->WriteUInt32(EQEmu::textures::TextureCount); // Tint2 Count
for (int r = 0; r < 7; r++)
{
outapp->WriteUInt32(emu->item_tint[r].Color);
outapp->WriteUInt32(emu->item_tint.Slot[r].Color);
}
// Write zeroes for extra two tint values
outapp->WriteUInt32(0);
@@ -2250,22 +2260,23 @@ namespace RoF
outapp->WriteUInt32(structs::MAX_PP_MEMSPELL); // Memorised spell slots
for (uint32 r = 0; r < MAX_PP_MEMSPELL; r++)
for (uint32 r = 0; r < MAX_PP_MEMSPELL; r++) // first 12
{
outapp->WriteUInt32(emu->mem_spells[r]);
}
// zeroes for the rest of the slots
// zeroes for the rest of the slots -- the other 4 which don't work at all!
for (uint32 r = 0; r < structs::MAX_PP_MEMSPELL - MAX_PP_MEMSPELL; r++)
{
outapp->WriteUInt32(0xFFFFFFFFU);
}
outapp->WriteUInt32(13); // Unknown count
outapp->WriteUInt32(13); // gem refresh count
for (uint32 r = 0; r < 13; r++)
for (uint32 r = 0; r < MAX_PP_MEMSPELL; r++)
{
outapp->WriteUInt32(0); // Unknown
outapp->WriteUInt32(emu->spellSlotRefresh[r]); // spell gem refresh
}
outapp->WriteUInt32(0); // also refresh -- historically HT/LoH :P
outapp->WriteUInt8(0); // Unknown
@@ -2274,31 +2285,32 @@ namespace RoF
for (uint32 r = 0; r < BUFF_COUNT; r++)
{
float instrument_mod = 0.0f;
uint8 slotid = emu->buffs[r].slotid;
uint8 effect_type = emu->buffs[r].effect_type;
uint32 player_id = emu->buffs[r].player_id;;
if (emu->buffs[r].spellid != 0xFFFF && emu->buffs[r].spellid != 0)
{
instrument_mod = 1.0f + (emu->buffs[r].bard_modifier - 10) / 10.0f;
slotid = 2;
effect_type = 2;
player_id = 0x000717fd;
}
else
{
slotid = 0;
effect_type = 0;
}
outapp->WriteUInt8(0); // Had this as slot, but always appears to be 0 on live.
// this is different than the client struct for some reason :P
// missing a few things, shuffled around
outapp->WriteUInt8(0); // this is an unknown
outapp->WriteFloat(instrument_mod);
outapp->WriteUInt32(player_id);
outapp->WriteUInt8(0);
outapp->WriteUInt32(emu->buffs[r].counters);
//outapp->WriteUInt8(emu->buffs[r].bard_modifier);
outapp->WriteUInt32(emu->buffs[r].duration);
outapp->WriteUInt8(emu->buffs[r].level);
outapp->WriteUInt32(emu->buffs[r].spellid);
outapp->WriteUInt32(slotid); // Only ever seen 2
outapp->WriteUInt8(effect_type); // Only ever seen 2
outapp->WriteUInt32(emu->buffs[r].num_hits);
outapp->WriteUInt32(0);
outapp->WriteUInt8(0);
outapp->WriteUInt32(emu->buffs[r].counters); // Appears twice ?
for (uint32 j = 0; j < 44; ++j)
@@ -3046,13 +3058,13 @@ namespace RoF
eq_cse->Gender = emu_cse->Gender;
eq_cse->Face = emu_cse->Face;
for (int equip_index = 0; equip_index < EQEmu::legacy::MaterialCount; equip_index++) {
for (int equip_index = 0; equip_index < EQEmu::textures::TextureCount; equip_index++) {
eq_cse->Equip[equip_index].Material = emu_cse->Equip[equip_index].Material;
eq_cse->Equip[equip_index].Unknown1 = emu_cse->Equip[equip_index].Unknown1;
eq_cse->Equip[equip_index].EliteMaterial = emu_cse->Equip[equip_index].EliteMaterial;
eq_cse->Equip[equip_index].HeroForgeModel = emu_cse->Equip[equip_index].HeroForgeModel;
eq_cse->Equip[equip_index].Material2 = emu_cse->Equip[equip_index].Material2;
eq_cse->Equip[equip_index].Color.Color = emu_cse->Equip[equip_index].Color.Color;
eq_cse->Equip[equip_index].Color = emu_cse->Equip[equip_index].Color;
}
eq_cse->Unknown15 = emu_cse->Unknown15;
@@ -4083,24 +4095,24 @@ namespace RoF
if ((emu->NPC == 0) || (emu->race <= 12) || (emu->race == 128) || (emu->race == 130) || (emu->race == 330) || (emu->race == 522))
{
for (k = 0; k < 9; ++k)
for (k = EQEmu::textures::TextureBegin; k < EQEmu::textures::TextureCount; ++k)
{
{
VARSTRUCT_ENCODE_TYPE(uint32, Buffer, emu->colors[k].Color);
VARSTRUCT_ENCODE_TYPE(uint32, Buffer, emu->equipment_tint.Slot[k].Color);
}
}
structs::EquipStruct *Equipment = (structs::EquipStruct *)Buffer;
structs::Texture_Struct *Equipment = (structs::Texture_Struct *)Buffer;
for (k = 0; k < 9; k++) {
Equipment[k].Material = emu->equipment[k].Material;
Equipment[k].Unknown1 = emu->equipment[k].Unknown1;
Equipment[k].EliteMaterial = emu->equipment[k].EliteMaterial;
Equipment[k].HeroForgeModel = emu->equipment[k].HeroForgeModel;
Equipment[k].Material2 = emu->equipment[k].Material2;
for (k = EQEmu::textures::TextureBegin; k < EQEmu::textures::TextureCount; k++) {
Equipment[k].Material = emu->equipment.Slot[k].Material;
Equipment[k].Unknown1 = emu->equipment.Slot[k].Unknown1;
Equipment[k].EliteMaterial = emu->equipment.Slot[k].EliteMaterial;
Equipment[k].HeroForgeModel = emu->equipment.Slot[k].HeroForgeModel;
Equipment[k].Material2 = emu->equipment.Slot[k].Material2;
}
Buffer += (sizeof(structs::EquipStruct) * 9);
Buffer += (sizeof(structs::Texture_Struct) * EQEmu::textures::TextureCount);
}
else
{
@@ -4110,13 +4122,13 @@ namespace RoF
VARSTRUCT_ENCODE_TYPE(uint32, Buffer, 0);
VARSTRUCT_ENCODE_TYPE(uint32, Buffer, 0);
VARSTRUCT_ENCODE_TYPE(uint32, Buffer, emu->equipment[EQEmu::legacy::MaterialPrimary].Material);
VARSTRUCT_ENCODE_TYPE(uint32, Buffer, emu->equipment.Primary.Material);
VARSTRUCT_ENCODE_TYPE(uint32, Buffer, 0);
VARSTRUCT_ENCODE_TYPE(uint32, Buffer, 0);
VARSTRUCT_ENCODE_TYPE(uint32, Buffer, 0);
VARSTRUCT_ENCODE_TYPE(uint32, Buffer, 0);
VARSTRUCT_ENCODE_TYPE(uint32, Buffer, emu->equipment[EQEmu::legacy::MaterialSecondary].Material);
VARSTRUCT_ENCODE_TYPE(uint32, Buffer, emu->equipment.Secondary.Material);
VARSTRUCT_ENCODE_TYPE(uint32, Buffer, 0);
VARSTRUCT_ENCODE_TYPE(uint32, Buffer, 0);
VARSTRUCT_ENCODE_TYPE(uint32, Buffer, 0);
@@ -4290,15 +4302,15 @@ namespace RoF
DECODE(OP_Buff)
{
DECODE_LENGTH_EXACT(structs::SpellBuffFade_Struct_Live);
SETUP_DIRECT_DECODE(SpellBuffFade_Struct, structs::SpellBuffFade_Struct_Live);
DECODE_LENGTH_EXACT(structs::SpellBuffPacket_Struct);
SETUP_DIRECT_DECODE(SpellBuffPacket_Struct, structs::SpellBuffPacket_Struct);
IN(entityid);
//IN(slot);
IN(level);
IN(effect);
IN(spellid);
IN(duration);
IN(buff.effect_type);
IN(buff.level);
IN(buff.unknown003);
IN(buff.spellid);
IN(buff.duration);
IN(slotid);
IN(bufffade);
@@ -4324,10 +4336,7 @@ namespace RoF
DECODE_LENGTH_EXACT(structs::CastSpell_Struct);
SETUP_DIRECT_DECODE(CastSpell_Struct, structs::CastSpell_Struct);
if (eq->slot == 13)
emu->slot = 10;
else
IN(slot);
emu->slot = static_cast<uint32>(RoFToServerCastingSlot(static_cast<CastingSlot>(eq->slot)));
IN(spell_id);
emu->inventoryslot = RoFToServerSlot(eq->inventory_slot);
@@ -5201,7 +5210,7 @@ namespace RoF
void SerializeItem(EQEmu::OutBuffer& ob, const ItemInst *inst, int16 slot_id_in, uint8 depth)
{
const EQEmu::Item_Struct *item = inst->GetUnscaledItem();
const EQEmu::ItemBase *item = inst->GetUnscaledItem();
RoF::structs::ItemSerializationHeader hdr;
@@ -5209,7 +5218,7 @@ namespace RoF
snprintf(hdr.unknown000, sizeof(hdr.unknown000), "%016d", item->ID);
hdr.stacksize = (inst->IsStackable() ? ((inst->GetCharges() > 254) ? 0xFFFFFFFF : inst->GetCharges()) : 1);
hdr.stacksize = (inst->IsStackable() ? ((inst->GetCharges() > 1000) ? 0xFFFFFFFF : inst->GetCharges()) : 1);
hdr.unknown004 = 0;
structs::InventorySlot_Struct slot_id = ServerToRoFSlot(slot_id_in);
@@ -5641,11 +5650,11 @@ namespace RoF
{
structs::InventorySlot_Struct RoFSlot;
RoFSlot.Type = INVALID_INDEX;
RoFSlot.Unknown02 = NOT_USED;
RoFSlot.Unknown02 = 0;
RoFSlot.Slot = INVALID_INDEX;
RoFSlot.SubIndex = INVALID_INDEX;
RoFSlot.AugIndex = INVALID_INDEX;
RoFSlot.Unknown01 = NOT_USED;
RoFSlot.Unknown01 = 0;
uint32 TempSlot = 0;
@@ -5746,7 +5755,7 @@ namespace RoF
RoFSlot.Slot = INVALID_INDEX;
RoFSlot.SubIndex = INVALID_INDEX;
RoFSlot.AugIndex = INVALID_INDEX;
RoFSlot.Unknown01 = NOT_USED;
RoFSlot.Unknown01 = 0;
uint32 TempSlot = 0;
@@ -5999,4 +6008,80 @@ namespace RoF
}
}
static inline CastingSlot ServerToRoFCastingSlot(EQEmu::CastingSlot slot)
{
switch (slot) {
case EQEmu::CastingSlot::Gem1:
return CastingSlot::Gem1;
case EQEmu::CastingSlot::Gem2:
return CastingSlot::Gem2;
case EQEmu::CastingSlot::Gem3:
return CastingSlot::Gem3;
case EQEmu::CastingSlot::Gem4:
return CastingSlot::Gem4;
case EQEmu::CastingSlot::Gem5:
return CastingSlot::Gem5;
case EQEmu::CastingSlot::Gem6:
return CastingSlot::Gem6;
case EQEmu::CastingSlot::Gem7:
return CastingSlot::Gem7;
case EQEmu::CastingSlot::Gem8:
return CastingSlot::Gem8;
case EQEmu::CastingSlot::Gem9:
return CastingSlot::Gem9;
case EQEmu::CastingSlot::Gem10:
return CastingSlot::Gem10;
case EQEmu::CastingSlot::Gem11:
return CastingSlot::Gem11;
case EQEmu::CastingSlot::Gem12:
return CastingSlot::Gem12;
case EQEmu::CastingSlot::Item:
case EQEmu::CastingSlot::PotionBelt:
return CastingSlot::Item;
case EQEmu::CastingSlot::Discipline:
return CastingSlot::Discipline;
case EQEmu::CastingSlot::AltAbility:
return CastingSlot::AltAbility;
default: // we shouldn't have any issues with other slots ... just return something
return CastingSlot::Discipline;
}
}
static inline EQEmu::CastingSlot RoFToServerCastingSlot(CastingSlot slot)
{
switch (slot) {
case CastingSlot::Gem1:
return EQEmu::CastingSlot::Gem1;
case CastingSlot::Gem2:
return EQEmu::CastingSlot::Gem2;
case CastingSlot::Gem3:
return EQEmu::CastingSlot::Gem3;
case CastingSlot::Gem4:
return EQEmu::CastingSlot::Gem4;
case CastingSlot::Gem5:
return EQEmu::CastingSlot::Gem5;
case CastingSlot::Gem6:
return EQEmu::CastingSlot::Gem6;
case CastingSlot::Gem7:
return EQEmu::CastingSlot::Gem7;
case CastingSlot::Gem8:
return EQEmu::CastingSlot::Gem8;
case CastingSlot::Gem9:
return EQEmu::CastingSlot::Gem9;
case CastingSlot::Gem10:
return EQEmu::CastingSlot::Gem10;
case CastingSlot::Gem11:
return EQEmu::CastingSlot::Gem11;
case CastingSlot::Gem12:
return EQEmu::CastingSlot::Gem12;
case CastingSlot::Discipline:
return EQEmu::CastingSlot::Discipline;
case CastingSlot::Item:
return EQEmu::CastingSlot::Item;
case CastingSlot::AltAbility:
return EQEmu::CastingSlot::AltAbility;
default: // we shouldn't have any issues with other slots ... just return something
return EQEmu::CastingSlot::Discipline;
}
}
} /*RoF*/
+18
View File
@@ -50,6 +50,24 @@ namespace RoF
#include "rof_ops.h"
};
enum class CastingSlot : uint32 {
Gem1 = 0,
Gem2 = 1,
Gem3 = 2,
Gem4 = 3,
Gem5 = 4,
Gem6 = 5,
Gem7 = 6,
Gem8 = 7,
Gem9 = 8,
Gem10 = 9,
Gem11 = 10,
Gem12 = 11,
Item = 12,
Discipline = 13,
AltAbility = 0xFF
};
}; /*RoF*/
#endif /*COMMON_ROF_H*/
+176 -74
View File
@@ -63,6 +63,9 @@ namespace RoF2
// client to server text link converter
static inline void RoF2ToServerTextLink(std::string& serverTextLink, const std::string& rof2TextLink);
static inline CastingSlot ServerToRoF2CastingSlot(EQEmu::CastingSlot slot);
static inline EQEmu::CastingSlot RoF2ToServerCastingSlot(CastingSlot slot);
void Register(EQStreamIdentifier &into)
{
//create our opcode manager if we havent already
@@ -474,22 +477,34 @@ namespace RoF2
ENCODE(OP_Buff)
{
ENCODE_LENGTH_EXACT(SpellBuffFade_Struct);
SETUP_DIRECT_ENCODE(SpellBuffFade_Struct, structs::SpellBuffFade_Struct_Live);
ENCODE_LENGTH_EXACT(SpellBuffPacket_Struct);
SETUP_DIRECT_ENCODE(SpellBuffPacket_Struct, structs::SpellBuffPacket_Struct);
OUT(entityid);
eq->unknown004 = 2;
//eq->level = 80;
//eq->effect = 0;
OUT(level);
OUT(effect);
eq->unknown007 = 0;
eq->unknown008 = 1.0f;
OUT(spellid);
OUT(duration);
eq->playerId = 0x7cde;
OUT(slotid);
OUT(num_hits);
OUT(buff.effect_type);
OUT(buff.level);
// just so we're 100% sure we get a 1.0f ...
eq->buff.bard_modifier = emu->buff.bard_modifier == 10 ? 1.0f : emu->buff.bard_modifier / 10.0f;
OUT(buff.spellid);
OUT(buff.duration);
OUT(buff.player_id);
OUT(buff.num_hits);
OUT(buff.y);
OUT(buff.x);
OUT(buff.z);
uint16 buffslot = emu->slotid;
// Not sure if this is needs amending for RoF2 yet.
if (buffslot >= 25)
{
buffslot += 17;
}
// TODO: We should really just deal with these "server side"
// so we can have clients not limited to other clients.
// This fixes discs, songs were changed to 20
if (buffslot == 54)
buffslot = 62;
eq->slotid = buffslot;
// TODO: implement slot_data stuff
if (emu->bufffade == 1)
eq->bufffade = 1;
else
@@ -501,10 +516,10 @@ namespace RoF2
{
outapp = new EQApplicationPacket(OP_BuffCreate, 29);
outapp->WriteUInt32(emu->entityid);
outapp->WriteUInt32(0x0271); // Unk
outapp->WriteUInt32(0); // tic timer
outapp->WriteUInt8(0); // Type of OP_BuffCreate packet ?
outapp->WriteUInt16(1); // 1 buff in this packet
outapp->WriteUInt32(emu->slotid);
outapp->WriteUInt32(buffslot);
outapp->WriteUInt32(0xffffffff); // SpellID (0xffff to remove)
outapp->WriteUInt32(0); // Duration
outapp->WriteUInt32(0); // ?
@@ -572,10 +587,7 @@ namespace RoF2
ENCODE_LENGTH_EXACT(CastSpell_Struct);
SETUP_DIRECT_ENCODE(CastSpell_Struct, structs::CastSpell_Struct);
if (emu->slot == 10)
eq->slot = 13;
else
OUT(slot);
eq->slot = static_cast<uint32>(ServerToRoF2CastingSlot(static_cast<EQEmu::CastingSlot>(emu->slot)));
OUT(spell_id);
eq->inventory_slot = ServerToRoF2Slot(emu->inventoryslot);
@@ -1689,7 +1701,8 @@ namespace RoF2
OUT(new_mana);
OUT(stamina);
OUT(spell_id);
eq->unknown16 = -1; // Self Interrupt/Success = -1, Fizzle = 1, Other Interrupt = 2?
OUT(keepcasting);
eq->slot = -1; // this is spell gem slot. It's -1 in normal operation
FINISH_ENCODE();
}
@@ -2087,18 +2100,18 @@ namespace RoF2
__packet->WriteUInt8(1); // 1 indicates all buffs on the pet (0 to add or remove a single buff)
__packet->WriteUInt16(emu->buffcount);
for (uint16 i = 0; i < BUFF_COUNT; ++i)
for (uint16 i = 0; i < PET_BUFF_COUNT; ++i)
{
if (emu->spellid[i])
{
__packet->WriteUInt32(i);
__packet->WriteUInt32(emu->spellid[i]);
__packet->WriteUInt32(emu->ticsremaining[i]);
__packet->WriteUInt32(0); // Unknown
__packet->WriteUInt32(0); // num hits
__packet->WriteString("");
}
}
__packet->WriteUInt8(0); // Unknown
__packet->WriteUInt8(0); // some sort of type
FINISH_ENCODE();
}
@@ -2152,9 +2165,9 @@ namespace RoF2
outapp->WriteUInt32(22); // Equipment count
for (int r = 0; r < 9; r++)
for (int r = EQEmu::textures::TextureBegin; r < EQEmu::textures::TextureCount; r++)
{
outapp->WriteUInt32(emu->item_material[r]);
outapp->WriteUInt32(emu->item_material.Slot[r].Material);
outapp->WriteUInt32(0);
outapp->WriteUInt32(0);
outapp->WriteUInt32(0);
@@ -2172,9 +2185,9 @@ namespace RoF2
outapp->WriteUInt32(0);
}
outapp->WriteUInt32(9); // Equipment2 count
outapp->WriteUInt32(EQEmu::textures::TextureCount); // Equipment2 count
for (int r = 0; r < 9; r++)
for (int r = EQEmu::textures::TextureBegin; r < EQEmu::textures::TextureCount; r++)
{
outapp->WriteUInt32(0);
outapp->WriteUInt32(0);
@@ -2183,21 +2196,21 @@ namespace RoF2
outapp->WriteUInt32(0);
}
outapp->WriteUInt32(9); // Tint Count
outapp->WriteUInt32(EQEmu::textures::TextureCount); // Tint Count
for (int r = 0; r < 7; r++)
{
outapp->WriteUInt32(emu->item_tint[r].Color);
outapp->WriteUInt32(emu->item_tint.Slot[r].Color);
}
// Write zeroes for extra two tint values
outapp->WriteUInt32(0);
outapp->WriteUInt32(0);
outapp->WriteUInt32(9); // Tint2 Count
outapp->WriteUInt32(EQEmu::textures::TextureCount); // Tint2 Count
for (int r = 0; r < 7; r++)
{
outapp->WriteUInt32(emu->item_tint[r].Color);
outapp->WriteUInt32(emu->item_tint.Slot[r].Color);
}
// Write zeroes for extra two tint values
outapp->WriteUInt32(0);
@@ -2334,22 +2347,23 @@ namespace RoF2
outapp->WriteUInt32(structs::MAX_PP_MEMSPELL); // Memorised spell slots
for (uint32 r = 0; r < MAX_PP_MEMSPELL; r++)
for (uint32 r = 0; r < MAX_PP_MEMSPELL; r++) // write first 12
{
outapp->WriteUInt32(emu->mem_spells[r]);
}
// zeroes for the rest of the slots
// zeroes for the rest of the slots the other 4, which actually don't work on the client at all :D
for (uint32 r = 0; r < structs::MAX_PP_MEMSPELL - MAX_PP_MEMSPELL; r++)
{
outapp->WriteUInt32(0xFFFFFFFFU);
}
outapp->WriteUInt32(13); // Unknown count
outapp->WriteUInt32(13); // gem refresh counts
for (uint32 r = 0; r < 13; r++)
for (uint32 r = 0; r < MAX_PP_MEMSPELL; r++)
{
outapp->WriteUInt32(0); // Unknown
outapp->WriteUInt32(emu->spellSlotRefresh[r]); // spell gem refresh
}
outapp->WriteUInt32(0); // also refresh -- historically HT/LoH :P
outapp->WriteUInt8(0); // Unknown
@@ -2358,31 +2372,33 @@ namespace RoF2
for (uint32 r = 0; r < BUFF_COUNT; r++)
{
float instrument_mod = 0.0f;
uint8 slotid = emu->buffs[r].slotid;
uint8 effect_type = emu->buffs[r].effect_type;
uint32 player_id = emu->buffs[r].player_id;;
if (emu->buffs[r].spellid != 0xFFFF && emu->buffs[r].spellid != 0)
{
instrument_mod = 1.0f + (emu->buffs[r].bard_modifier - 10) / 10.0f;
slotid = 2;
effect_type = 2;
player_id = 0x000717fd;
}
else
{
slotid = 0;
effect_type = 0;
}
outapp->WriteUInt8(0); // Had this as slot, but always appears to be 0 on live.
// this is different than the client struct for some reason :P
// missing a few things, shuffled around
outapp->WriteUInt8(0); // this is an unknown
outapp->WriteFloat(instrument_mod);
outapp->WriteUInt32(player_id);
outapp->WriteUInt8(0);
outapp->WriteUInt32(emu->buffs[r].counters);
//outapp->WriteUInt8(emu->buffs[r].bard_modifier);
outapp->WriteUInt32(emu->buffs[r].duration);
outapp->WriteUInt8(emu->buffs[r].level);
outapp->WriteUInt32(emu->buffs[r].spellid);
outapp->WriteUInt32(slotid); // Only ever seen 2
outapp->WriteUInt8(effect_type); // Only ever seen 2
outapp->WriteUInt32(emu->buffs[r].num_hits);
outapp->WriteUInt32(0);
outapp->WriteUInt8(0);
outapp->WriteUInt32(emu->buffs[r].counters); // Appears twice ?
for (uint32 j = 0; j < 44; ++j)
@@ -3139,13 +3155,13 @@ namespace RoF2
eq_cse->Gender = emu_cse->Gender;
eq_cse->Face = emu_cse->Face;
for (int equip_index = 0; equip_index < EQEmu::legacy::MaterialCount; equip_index++) {
for (int equip_index = 0; equip_index < EQEmu::textures::TextureCount; equip_index++) {
eq_cse->Equip[equip_index].Material = emu_cse->Equip[equip_index].Material;
eq_cse->Equip[equip_index].Unknown1 = emu_cse->Equip[equip_index].Unknown1;
eq_cse->Equip[equip_index].EliteMaterial = emu_cse->Equip[equip_index].EliteMaterial;
eq_cse->Equip[equip_index].HeroForgeModel = emu_cse->Equip[equip_index].HeroForgeModel;
eq_cse->Equip[equip_index].Material2 = emu_cse->Equip[equip_index].Material2;
eq_cse->Equip[equip_index].Color.Color = emu_cse->Equip[equip_index].Color.Color;
eq_cse->Equip[equip_index].Color = emu_cse->Equip[equip_index].Color;
}
eq_cse->Unknown15 = emu_cse->Unknown15;
@@ -4306,24 +4322,24 @@ namespace RoF2
if ((emu->NPC == 0) || (emu->race <= 12) || (emu->race == 128) || (emu->race == 130) || (emu->race == 330) || (emu->race == 522))
{
for (k = 0; k < 9; ++k)
for (k = EQEmu::textures::TextureBegin; k < EQEmu::textures::TextureCount; ++k)
{
{
VARSTRUCT_ENCODE_TYPE(uint32, Buffer, emu->colors[k].Color);
VARSTRUCT_ENCODE_TYPE(uint32, Buffer, emu->equipment_tint.Slot[k].Color);
}
}
structs::EquipStruct *Equipment = (structs::EquipStruct *)Buffer;
structs::Texture_Struct *Equipment = (structs::Texture_Struct *)Buffer;
for (k = 0; k < 9; k++) {
Equipment[k].Material = emu->equipment[k].Material;
Equipment[k].Unknown1 = emu->equipment[k].Unknown1;
Equipment[k].EliteMaterial = emu->equipment[k].EliteMaterial;
Equipment[k].HeroForgeModel = emu->equipment[k].HeroForgeModel;
Equipment[k].Material2 = emu->equipment[k].Material2;
for (k = EQEmu::textures::TextureBegin; k < EQEmu::textures::TextureCount; k++) {
Equipment[k].Material = emu->equipment.Slot[k].Material;
Equipment[k].Unknown1 = emu->equipment.Slot[k].Unknown1;
Equipment[k].EliteMaterial = emu->equipment.Slot[k].EliteMaterial;
Equipment[k].HeroForgeModel = emu->equipment.Slot[k].HeroForgeModel;
Equipment[k].Material2 = emu->equipment.Slot[k].Material2;
}
Buffer += (sizeof(structs::EquipStruct) * 9);
Buffer += (sizeof(structs::Texture_Struct) * EQEmu::textures::TextureCount);
}
else
{
@@ -4333,13 +4349,13 @@ namespace RoF2
VARSTRUCT_ENCODE_TYPE(uint32, Buffer, 0);
VARSTRUCT_ENCODE_TYPE(uint32, Buffer, 0);
VARSTRUCT_ENCODE_TYPE(uint32, Buffer, emu->equipment[EQEmu::legacy::MaterialPrimary].Material);
VARSTRUCT_ENCODE_TYPE(uint32, Buffer, emu->equipment.Primary.Material);
VARSTRUCT_ENCODE_TYPE(uint32, Buffer, 0);
VARSTRUCT_ENCODE_TYPE(uint32, Buffer, 0);
VARSTRUCT_ENCODE_TYPE(uint32, Buffer, 0);
VARSTRUCT_ENCODE_TYPE(uint32, Buffer, 0);
VARSTRUCT_ENCODE_TYPE(uint32, Buffer, emu->equipment[EQEmu::legacy::MaterialSecondary].Material);
VARSTRUCT_ENCODE_TYPE(uint32, Buffer, emu->equipment.Secondary.Material);
VARSTRUCT_ENCODE_TYPE(uint32, Buffer, 0);
VARSTRUCT_ENCODE_TYPE(uint32, Buffer, 0);
VARSTRUCT_ENCODE_TYPE(uint32, Buffer, 0);
@@ -4389,6 +4405,19 @@ namespace RoF2
delete in;
}
ENCODE(OP_CrystalCountUpdate)
{
ENCODE_LENGTH_EXACT(CrystalCountUpdate_Struct);
SETUP_DIRECT_ENCODE(CrystalCountUpdate_Struct, structs::CrystalCountUpdate_Struct);
OUT(CurrentRadiantCrystals);
OUT(CareerRadiantCrystals);
OUT(CurrentEbonCrystals);
OUT(CareerEbonCrystals);
FINISH_ENCODE();
}
// DECODE methods
DECODE(OP_AdventureMerchantSell)
@@ -4513,15 +4542,15 @@ namespace RoF2
DECODE(OP_Buff)
{
DECODE_LENGTH_EXACT(structs::SpellBuffFade_Struct_Live);
SETUP_DIRECT_DECODE(SpellBuffFade_Struct, structs::SpellBuffFade_Struct_Live);
DECODE_LENGTH_EXACT(structs::SpellBuffPacket_Struct);
SETUP_DIRECT_DECODE(SpellBuffPacket_Struct, structs::SpellBuffPacket_Struct);
IN(entityid);
//IN(slot);
IN(level);
IN(effect);
IN(spellid);
IN(duration);
IN(buff.effect_type);
IN(buff.level);
IN(buff.unknown003);
IN(buff.spellid);
IN(buff.duration);
IN(slotid);
IN(bufffade);
@@ -4547,10 +4576,7 @@ namespace RoF2
DECODE_LENGTH_EXACT(structs::CastSpell_Struct);
SETUP_DIRECT_DECODE(CastSpell_Struct, structs::CastSpell_Struct);
if (eq->slot == 13)
emu->slot = 10;
else
IN(slot);
emu->slot = static_cast<uint32>(RoF2ToServerCastingSlot(static_cast<CastingSlot>(eq->slot)));
IN(spell_id);
emu->inventoryslot = RoF2ToServerSlot(eq->inventory_slot);
@@ -5476,7 +5502,7 @@ namespace RoF2
void SerializeItem(EQEmu::OutBuffer& ob, const ItemInst *inst, int16 slot_id_in, uint8 depth, ItemPacketType packet_type)
{
const EQEmu::Item_Struct *item = inst->GetUnscaledItem();
const EQEmu::ItemBase *item = inst->GetUnscaledItem();
RoF2::structs::ItemSerializationHeader hdr;
@@ -5484,7 +5510,7 @@ namespace RoF2
snprintf(hdr.unknown000, sizeof(hdr.unknown000), "%016d", item->ID);
hdr.stacksize = (inst->IsStackable() ? ((inst->GetCharges() > 254) ? 0xFFFFFFFF : inst->GetCharges()) : 1);
hdr.stacksize = (inst->IsStackable() ? ((inst->GetCharges() > 1000) ? 0xFFFFFFFF : inst->GetCharges()) : 1);
hdr.unknown004 = 0;
structs::InventorySlot_Struct slot_id = ServerToRoF2Slot(slot_id_in, packet_type);
@@ -5926,11 +5952,11 @@ namespace RoF2
{
structs::InventorySlot_Struct RoF2Slot;
RoF2Slot.Type = INVALID_INDEX;
RoF2Slot.Unknown02 = NOT_USED;
RoF2Slot.Unknown02 = 0;
RoF2Slot.Slot = INVALID_INDEX;
RoF2Slot.SubIndex = INVALID_INDEX;
RoF2Slot.AugIndex = INVALID_INDEX;
RoF2Slot.Unknown01 = NOT_USED;
RoF2Slot.Unknown01 = 0;
uint32 TempSlot = 0;
@@ -6039,7 +6065,7 @@ namespace RoF2
RoF2Slot.Slot = INVALID_INDEX;
RoF2Slot.SubIndex = INVALID_INDEX;
RoF2Slot.AugIndex = INVALID_INDEX;
RoF2Slot.Unknown01 = NOT_USED;
RoF2Slot.Unknown01 = 0;
uint32 TempSlot = 0;
@@ -6287,4 +6313,80 @@ namespace RoF2
}
}
static inline CastingSlot ServerToRoF2CastingSlot(EQEmu::CastingSlot slot)
{
switch (slot) {
case EQEmu::CastingSlot::Gem1:
return CastingSlot::Gem1;
case EQEmu::CastingSlot::Gem2:
return CastingSlot::Gem2;
case EQEmu::CastingSlot::Gem3:
return CastingSlot::Gem3;
case EQEmu::CastingSlot::Gem4:
return CastingSlot::Gem4;
case EQEmu::CastingSlot::Gem5:
return CastingSlot::Gem5;
case EQEmu::CastingSlot::Gem6:
return CastingSlot::Gem6;
case EQEmu::CastingSlot::Gem7:
return CastingSlot::Gem7;
case EQEmu::CastingSlot::Gem8:
return CastingSlot::Gem8;
case EQEmu::CastingSlot::Gem9:
return CastingSlot::Gem9;
case EQEmu::CastingSlot::Gem10:
return CastingSlot::Gem10;
case EQEmu::CastingSlot::Gem11:
return CastingSlot::Gem11;
case EQEmu::CastingSlot::Gem12:
return CastingSlot::Gem12;
case EQEmu::CastingSlot::Item:
case EQEmu::CastingSlot::PotionBelt:
return CastingSlot::Item;
case EQEmu::CastingSlot::Discipline:
return CastingSlot::Discipline;
case EQEmu::CastingSlot::AltAbility:
return CastingSlot::AltAbility;
default: // we shouldn't have any issues with other slots ... just return something
return CastingSlot::Discipline;
}
}
static inline EQEmu::CastingSlot RoF2ToServerCastingSlot(CastingSlot slot)
{
switch (slot) {
case CastingSlot::Gem1:
return EQEmu::CastingSlot::Gem1;
case CastingSlot::Gem2:
return EQEmu::CastingSlot::Gem2;
case CastingSlot::Gem3:
return EQEmu::CastingSlot::Gem3;
case CastingSlot::Gem4:
return EQEmu::CastingSlot::Gem4;
case CastingSlot::Gem5:
return EQEmu::CastingSlot::Gem5;
case CastingSlot::Gem6:
return EQEmu::CastingSlot::Gem6;
case CastingSlot::Gem7:
return EQEmu::CastingSlot::Gem7;
case CastingSlot::Gem8:
return EQEmu::CastingSlot::Gem8;
case CastingSlot::Gem9:
return EQEmu::CastingSlot::Gem9;
case CastingSlot::Gem10:
return EQEmu::CastingSlot::Gem10;
case CastingSlot::Gem11:
return EQEmu::CastingSlot::Gem11;
case CastingSlot::Gem12:
return EQEmu::CastingSlot::Gem12;
case CastingSlot::Discipline:
return EQEmu::CastingSlot::Discipline;
case CastingSlot::Item:
return EQEmu::CastingSlot::Item;
case CastingSlot::AltAbility:
return EQEmu::CastingSlot::AltAbility;
default: // we shouldn't have any issues with other slots ... just return something
return EQEmu::CastingSlot::Discipline;
}
}
} /*RoF2*/
+18
View File
@@ -50,6 +50,24 @@ namespace RoF2
#include "rof2_ops.h"
};
enum class CastingSlot : uint32 {
Gem1 = 0,
Gem2 = 1,
Gem3 = 2,
Gem4 = 3,
Gem5 = 4,
Gem6 = 5,
Gem7 = 6,
Gem8 = 7,
Gem9 = 8,
Gem10 = 9,
Gem11 = 10,
Gem12 = 11,
Item = 12,
Discipline = 13,
AltAbility = 0xFF
};
}; /*RoF2*/
#endif /*COMMON_ROF2_H*/
+27 -9
View File
@@ -10,7 +10,7 @@
but WITHOUT ANY WARRANTY except by those people which sell it, which
are required to give you total support for your newly bought product;
without even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE. See the GNU General Public License for more details.
A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
@@ -22,7 +22,7 @@
#include "../string_util.h"
size_t RoF2::invtype::InvTypeSize(int inv_type)
size_t RoF2::invtype::GetInvTypeSize(int inv_type)
{
switch (inv_type) {
case invtype::InvTypePossessions:
@@ -80,7 +80,7 @@ size_t RoF2::invtype::InvTypeSize(int inv_type)
}
}
const char* RoF2::invtype::InvTypeName(int inv_type)
const char* RoF2::invtype::GetInvTypeName(int inv_type)
{
switch (inv_type) {
case invtype::InvTypeInvalid:
@@ -140,7 +140,25 @@ const char* RoF2::invtype::InvTypeName(int inv_type)
}
}
const char* RoF2::invslot::InvPossessionsSlotName(int inv_slot)
bool RoF2::invtype::IsInvTypePersistent(int inv_type)
{
switch (inv_type) {
case invtype::InvTypePossessions:
case invtype::InvTypeBank:
case invtype::InvTypeSharedBank:
case invtype::InvTypeTrade:
case invtype::InvTypeWorld:
case invtype::InvTypeLimbo:
case invtype::InvTypeTribute:
case invtype::InvTypeTrophyTribute:
case invtype::InvTypeGuildTribute:
return true;
default:
return false;
}
}
const char* RoF2::invslot::GetInvPossessionsSlotName(int inv_slot)
{
switch (inv_slot) {
case invslot::InvSlotInvalid:
@@ -218,12 +236,12 @@ const char* RoF2::invslot::InvPossessionsSlotName(int inv_slot)
}
}
const char* RoF2::invslot::InvSlotName(int inv_type, int inv_slot)
const char* RoF2::invslot::GetInvSlotName(int inv_type, int inv_slot)
{
if (inv_type == invtype::InvTypePossessions)
return invslot::InvPossessionsSlotName(inv_slot);
return invslot::GetInvPossessionsSlotName(inv_slot);
size_t type_size = invtype::InvTypeSize(inv_type);
size_t type_size = invtype::GetInvTypeSize(inv_type);
if (!type_size || inv_slot == invslot::InvSlotInvalid)
return "Invalid Slot";
@@ -237,7 +255,7 @@ const char* RoF2::invslot::InvSlotName(int inv_type, int inv_slot)
return ret_str.c_str();
}
const char* RoF2::invbag::InvBagIndexName(int bag_index)
const char* RoF2::invbag::GetInvBagIndexName(int bag_index)
{
if (bag_index == invbag::InvBagInvalid)
return "Invalid Bag";
@@ -251,7 +269,7 @@ const char* RoF2::invbag::InvBagIndexName(int bag_index)
return ret_str.c_str();
}
const char* RoF2::invaug::InvAugIndexName(int aug_index)
const char* RoF2::invaug::GetInvAugIndexName(int aug_index)
{
if (aug_index == invaug::InvAugInvalid)
return "Invalid Augment";
+35 -26
View File
@@ -10,7 +10,7 @@
but WITHOUT ANY WARRANTY except by those people which sell it, which
are required to give you total support for your newly bought product;
without even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE. See the GNU General Public License for more details.
A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
@@ -21,7 +21,7 @@
#define COMMON_ROF2_LIMITS_H
#include "../types.h"
#include "../client_version.h"
#include "../emu_versions.h"
#include "../skills.h"
@@ -32,8 +32,13 @@ namespace RoF2
enum : bool { False = false, True = true };
// pre-declarations
namespace inventory {
inline EQEmu::versions::ClientVersion GetInventoryRef() { return EQEmu::versions::ClientVersion::RoF2; }
} /*inventory*/
namespace invtype {
inline EQEmu::versions::ClientVersion InvTypeRef() { return EQEmu::versions::ClientVersion::RoF2; }
inline EQEmu::versions::ClientVersion GetInvTypeRef() { return EQEmu::versions::ClientVersion::RoF2; }
enum : int { InvTypeInvalid = -1, InvTypeBegin };
@@ -69,7 +74,7 @@ namespace RoF2
} /*invtype*/
namespace invslot {
inline EQEmu::versions::ClientVersion InvSlotRef() { return EQEmu::versions::ClientVersion::RoF2; }
inline EQEmu::versions::ClientVersion GetInvSlotRef() { return EQEmu::versions::ClientVersion::RoF2; }
enum : int { InvSlotInvalid = -1, InvSlotBegin };
@@ -122,21 +127,21 @@ namespace RoF2
} /*invslot*/
namespace invbag {
inline EQEmu::versions::ClientVersion InvBagRef() { return EQEmu::versions::ClientVersion::RoF2; }
inline EQEmu::versions::ClientVersion GetInvBagRef() { return EQEmu::versions::ClientVersion::RoF2; }
enum : int { InvBagInvalid = -1, InvBagBegin };
} /*invbag*/
namespace invaug {
inline EQEmu::versions::ClientVersion InvAugRef() { return EQEmu::versions::ClientVersion::RoF2; }
inline EQEmu::versions::ClientVersion GetInvAugRef() { return EQEmu::versions::ClientVersion::RoF2; }
enum : int { InvAugInvalid = -1, InvAugBegin };
} /*invaug*/
namespace item {
inline EQEmu::versions::ClientVersion ItemRef() { return EQEmu::versions::ClientVersion::RoF2; }
inline EQEmu::versions::ClientVersion GetItemRef() { return EQEmu::versions::ClientVersion::RoF2; }
//enum Unknown : int { // looks like item class..but, RoF has it too - nothing in UF-
// Unknown1 = 0,
@@ -165,27 +170,37 @@ namespace RoF2
} /*item*/
namespace profile {
inline EQEmu::versions::ClientVersion ProfileRef() { return EQEmu::versions::ClientVersion::RoF2; }
inline EQEmu::versions::ClientVersion GetProfileRef() { return EQEmu::versions::ClientVersion::RoF2; }
} /*profile*/
namespace constants {
inline EQEmu::versions::ClientVersion ConstantsRef() { return EQEmu::versions::ClientVersion::RoF2; }
inline EQEmu::versions::ClientVersion GetConstantsRef() { return EQEmu::versions::ClientVersion::RoF2; }
} /*constants*/
namespace behavior {
inline EQEmu::versions::ClientVersion BehaviorRef() { return EQEmu::versions::ClientVersion::RoF2; }
inline EQEmu::versions::ClientVersion GetBehaviorRef() { return EQEmu::versions::ClientVersion::RoF2; }
} /*behavior*/
namespace skills {
inline EQEmu::versions::ClientVersion SkillsRef() { return EQEmu::versions::ClientVersion::RoF2; }
inline EQEmu::versions::ClientVersion GetSkillsRef() { return EQEmu::versions::ClientVersion::RoF2; }
} /*skills*/
// declarations
namespace inventory {
const bool ConcatenateInvTypeLimbo = false;
const bool AllowOverLevelEquipment = true;
const bool AllowEmptyBagInBag = true;
const bool AllowClickCastFromBag = true;
} /*inventory*/
namespace invtype {
const size_t InvTypePossessionsSize = invslot::PossessionsCount;
const size_t InvTypeBankSize = 24;
@@ -195,7 +210,7 @@ namespace RoF2
const size_t InvTypeLimboSize = 36;
const size_t InvTypeTributeSize = 5;
const size_t InvTypeTrophyTributeSize = 0;//unknown
const size_t InvTypeGuildTributeSize = 0;//unknown
const size_t InvTypeGuildTributeSize = 2;//unverified
const size_t InvTypeMerchantSize = 200;
const size_t InvTypeDeletedSize = 0;//unknown - "Recovery Tab"
const size_t InvTypeCorpseSize = InvTypePossessionsSize;
@@ -213,30 +228,30 @@ namespace RoF2
const size_t InvTypeKronoSize = 0;//unknown
const size_t InvTypeOtherSize = 0;//unknown
const size_t NPCTradeSize = 4;
extern size_t GetInvTypeSize(int inv_type);
extern const char* GetInvTypeName(int inv_type);
extern size_t InvTypeSize(int inv_type);
extern const char* InvTypeName(int inv_type);
extern bool IsInvTypePersistent(int inv_type);
} /*invtype*/
namespace invslot {
extern const char* InvPossessionsSlotName(int inv_slot);
extern const char* InvSlotName(int inv_type, int inv_slot);
extern const char* GetInvPossessionsSlotName(int inv_slot);
extern const char* GetInvSlotName(int inv_type, int inv_slot);
} /*invslot*/
namespace invbag {
const size_t ItemBagSize = 255; // server Size will be 255..unsure what actual client is (test)
extern const char* InvBagIndexName(int bag_index);
extern const char* GetInvBagIndexName(int bag_index);
} /*invbag*/
namespace invaug {
const size_t ItemAugSize = 6;
extern const char* InvAugIndexName(int aug_index);
extern const char* GetInvAugIndexName(int aug_index);
} /*invaug*/
@@ -246,6 +261,7 @@ namespace RoF2
namespace profile {
const size_t TributeSize = invtype::InvTypeTributeSize;
const size_t GuildTributeSize = invtype::InvTypeGuildTributeSize;
const size_t BandoliersSize = 20; // number of bandolier instances
const size_t BandolierItemCount = 4; // number of equipment slots in bandolier instance
@@ -264,13 +280,6 @@ namespace RoF2
} /*constants*/
namespace behavior {
const bool ConcatenateInvTypeLimbo = false;
const bool AllowOverLevelEquipment = true;
const bool AllowEmptyBagInBag = true;
const bool AllowClickCastFromBag = true;
const bool CoinHasWeight = false;
} /*behavior*/
+1
View File
@@ -141,6 +141,7 @@ E(OP_ZoneEntry)
E(OP_ZonePlayerToBind)
E(OP_ZoneServerInfo)
E(OP_ZoneSpawns)
E(OP_CrystalCountUpdate)
// Begin RoF Decodes
D(OP_AdventureMerchantSell)
D(OP_AltCurrencySell)
+121 -156
View File
@@ -163,7 +163,7 @@ struct AdventureInfo {
** Merth: Gave struct a name so gcc 2.96 would compile
**
*/
struct Color_Struct
struct Tint_Struct
{
union {
struct {
@@ -171,21 +171,65 @@ struct Color_Struct
uint8 Green;
uint8 Red;
uint8 UseTint; // if there's a tint this is FF
} RGB;
};
uint32 Color;
};
};
struct CharSelectEquip
struct TintProfile
{
union {
struct {
Tint_Struct Head;
Tint_Struct Chest;
Tint_Struct Arms;
Tint_Struct Wrist;
Tint_Struct Hands;
Tint_Struct Legs;
Tint_Struct Feet;
Tint_Struct Primary;
Tint_Struct Secondary;
};
Tint_Struct Slot[EQEmu::textures::TextureCount];
};
};
/*
* Visible equiptment.
* Size: 20 Octets
*/
struct Texture_Struct
{
uint32 Material;
uint32 Unknown1;
uint32 EliteMaterial;
uint32 HeroForgeModel;
uint32 Material2;
Color_Struct Color;
uint32 Material2; // Same as material?
};
// Needs more research regarding new slots
//struct TextureProfile
//{
// union {
// struct {
// Texture_Struct Head;
// Texture_Struct Chest;
// Texture_Struct Arms;
// Texture_Struct Wrist;
// Texture_Struct Hands;
// Texture_Struct Legs;
// Texture_Struct Feet;
// Texture_Struct Primary;
// Texture_Struct Secondary;
// };
// Texture_Struct Slot[EQEmu::textures::TextureCount];
// };
//
// TextureProfile();
//};
struct CharSelectEquip : Texture_Struct, Tint_Struct {};
struct CharacterSelectEntry_Struct
{
/*0000*/ char Name[1]; // Name null terminated
@@ -231,21 +275,6 @@ struct CharacterSelect_Struct
/*004*/ CharacterSelectEntry_Struct Entries[0];
};
/*
* Visible equiptment.
* Size: 20 Octets
*/
struct EquipStruct
{
/*00*/ uint32 Material;
/*04*/ uint32 Unknown1;
/*08*/ uint32 EliteMaterial;
/*12*/ uint32 HeroForgeModel;
/*16*/ uint32 Material2; // Same as material?
/*20*/
};
struct Membership_Entry_Struct
{
/*000*/ uint32 purchase_id; // Seen 1, then increments 90287 to 90300
@@ -447,39 +476,24 @@ struct Spawn_Struct
/*0000*/ uint32 unknown18;
/*0000*/ uint32 unknown19;
Spawn_Struct_Position Position;
/*0000*/ union
{
struct
{
/*0000*/ Color_Struct color_helmet; // Color of helmet item
/*0000*/ Color_Struct color_chest; // Color of chest item
/*0000*/ Color_Struct color_arms; // Color of arms item
/*0000*/ Color_Struct color_bracers; // Color of bracers item
/*0000*/ Color_Struct color_hands; // Color of hands item
/*0000*/ Color_Struct color_legs; // Color of legs item
/*0000*/ Color_Struct color_feet; // Color of feet item
/*0000*/ Color_Struct color_primary; // Color of primary item
/*0000*/ Color_Struct color_secondary; // Color of secondary item
} equipment_colors;
/*0000*/ Color_Struct colors[9]; // Array elements correspond to struct equipment_colors above
};
/*0000*/ TintProfile equipment_tint;
// skip these bytes if not a valid player race
/*0000*/ union
{
struct
{
/*0000*/ EquipStruct equip_helmet; // Equiptment: Helmet visual
/*0000*/ EquipStruct equip_chest; // Equiptment: Chest visual
/*0000*/ EquipStruct equip_arms; // Equiptment: Arms visual
/*0000*/ EquipStruct equip_bracers; // Equiptment: Wrist visual
/*0000*/ EquipStruct equip_hands; // Equiptment: Hands visual
/*0000*/ EquipStruct equip_legs; // Equiptment: Legs visual
/*0000*/ EquipStruct equip_feet; // Equiptment: Boots visual
/*0000*/ EquipStruct equip_primary; // Equiptment: Main visual
/*0000*/ EquipStruct equip_secondary; // Equiptment: Off visual
/*0000*/ Texture_Struct equip_helmet; // Equiptment: Helmet visual
/*0000*/ Texture_Struct equip_chest; // Equiptment: Chest visual
/*0000*/ Texture_Struct equip_arms; // Equiptment: Arms visual
/*0000*/ Texture_Struct equip_bracers; // Equiptment: Wrist visual
/*0000*/ Texture_Struct equip_hands; // Equiptment: Hands visual
/*0000*/ Texture_Struct equip_legs; // Equiptment: Legs visual
/*0000*/ Texture_Struct equip_feet; // Equiptment: Boots visual
/*0000*/ Texture_Struct equip_primary; // Equiptment: Main visual
/*0000*/ Texture_Struct equip_secondary; // Equiptment: Off visual
} equip;
/*0000*/ EquipStruct equipment[9];
/*0000*/ Texture_Struct equipment[9];
};
/*0000*/ //char title[0]; // only read if(hasTitleOrSuffix & 4)
@@ -621,7 +635,7 @@ struct MemorizeSpell_Struct {
uint32 slot; // Spot in the spell book/memorized slot
uint32 spell_id; // Spell id (200 or c8 is minor healing, etc)
uint32 scribing; // 1 if memorizing a spell, set to 0 if scribing to book, 2 if un-memming
uint32 unknown12;
uint32 reduction; // lowers reuse
};
/*
@@ -654,11 +668,12 @@ struct DeleteSpell_Struct
struct ManaChange_Struct
{
uint32 new_mana; // New Mana AMount
uint32 stamina;
uint32 spell_id;
uint32 unknown12;
uint32 unknown16;
/*00*/ uint32 new_mana; // New Mana AMount
/*04*/ uint32 stamina;
/*08*/ uint32 spell_id;
/*12*/ uint8 keepcasting; // won't stop the cast. Change mana while casting?
/*13*/ uint8 padding[3]; // client doesn't read it, garbage data seems like
/*16*/ int32 slot; // -1 for normal usage slot for when we want silent interrupt? I think it does timer stuff or something. Linked Spell Reuse interrupt uses it
};
struct SwapSpell_Struct
@@ -705,69 +720,31 @@ struct SpawnAppearance_Struct
struct SpellBuff_Struct
{
/*000*/ uint8 slotid; // badly named... seems to be 2 for a real buff, 0 otherwise
/*001*/ float unknown004; // Seen 1 for no buff
/*005*/ uint32 player_id; // 'global' ID of the caster, for wearoff messages
/*009*/ uint32 unknown016;
/*013*/ uint8 bard_modifier;
/*014*/ int32 duration;
/*018*/ uint8 level;
/*019*/ uint32 spellid;
/*023*/ uint32 counters;
/*027*/ uint8 unknown0028[53];
/*080*/
};
struct SpellBuff_Struct_Old
{
/*000*/ uint8 slotid; // badly named... seems to be 2 for a real buff, 0 otherwise
/*001*/ uint8 level;
/*002*/ uint8 bard_modifier;
/*003*/ uint8 effect; // not real
/*004*/ float unknown004; // Seen 1 for no buff
/*008*/ uint32 spellid;
/*012*/ int32 duration;
/*016*/ uint32 unknown016;
/*020*/ uint32 player_id; // 'global' ID of the caster, for wearoff messages
/*024*/ uint32 counters;
/*028*/ uint8 unknown0028[60];
/*000*/ uint8 effect_type; // 0 = no buff, 2 = buff, 4 = inverse affects of buff
/*001*/ uint8 level; // Seen 1 for no buff
/*002*/ uint8 unknown002; //pretty sure padding now
/*003*/ uint8 unknown003; // MQ2 used to call this "damage shield" -- don't see client referencing it, so maybe server side DS type tracking?
/*004*/ float bard_modifier;
/*008*/ uint32 spellid;
/*012*/ uint32 duration;
/*016*/ uint32 player_id; // caster ID, pretty sure just zone ID
/*020*/ uint32 num_hits;
/*024*/ float y; // referenced by SPA 441
/*028*/ float x; // unsure if all buffs get them
/*032*/ float z; // as valid data
/*036*/ uint32 unknown036;
/*040*/ int32 slot_data[12]; // book keeping stuff per slot (counters, rune/vie)
/*088*/
};
// Not functional yet, but this is what the packet looks like on Live
struct SpellBuffFade_Struct_Live {
/*000*/ uint32 entityid; // Player id who cast the buff
/*004*/ uint8 unknown004;
/*005*/ uint8 level;
/*006*/ uint8 effect;
/*007*/ uint8 unknown007;
/*008*/ float unknown008;
/*012*/ uint32 spellid;
/*016*/ int32 duration;
/*020*/ uint32 playerId; // Global player ID?
/*024*/ uint32 num_hits;
/*028*/ uint8 unknown0028[64];
struct SpellBuffPacket_Struct {
/*000*/ uint32 entityid; // Player id who cast the buff
/*004*/ SpellBuff_Struct buff;
/*092*/ uint32 slotid;
/*096*/ uint32 bufffade;
/*100*/
};
struct SpellBuffFade_Struct {
/*000*/ uint32 entityid;
/*004*/ uint8 slot;
/*005*/ uint8 level;
/*006*/ uint8 effect;
/*007*/ uint8 unknown7;
/*008*/ uint32 spellid;
/*012*/ int32 duration;
/*016*/ uint32 num_hits;
/*020*/ uint32 unknown020; // Global player ID?
/*024*/ uint32 playerId; // Player id who cast the buff
/*028*/ uint32 slotid;
/*032*/ uint32 bufffade;
/*036*/
};
struct BuffRemoveRequest_Struct
{
/*00*/ uint32 SlotID;
@@ -1078,38 +1055,38 @@ union
{
struct
{
/*00184*/ EquipStruct equip_helmet; // Equipment: Helmet visual
/*00204*/ EquipStruct equip_chest; // Equipment: Chest visual
/*00224*/ EquipStruct equip_arms; // Equipment: Arms visual
/*00244*/ EquipStruct equip_bracers; // Equipment: Wrist visual
/*00264*/ EquipStruct equip_hands; // Equipment: Hands visual
/*00284*/ EquipStruct equip_legs; // Equipment: Legs visual
/*00304*/ EquipStruct equip_feet; // Equipment: Boots visual
/*00324*/ EquipStruct equip_primary; // Equipment: Main visual
/*00344*/ EquipStruct equip_secondary; // Equipment: Off visual
/*00184*/ Texture_Struct equip_helmet; // Equipment: Helmet visual
/*00204*/ Texture_Struct equip_chest; // Equipment: Chest visual
/*00224*/ Texture_Struct equip_arms; // Equipment: Arms visual
/*00244*/ Texture_Struct equip_bracers; // Equipment: Wrist visual
/*00264*/ Texture_Struct equip_hands; // Equipment: Hands visual
/*00284*/ Texture_Struct equip_legs; // Equipment: Legs visual
/*00304*/ Texture_Struct equip_feet; // Equipment: Boots visual
/*00324*/ Texture_Struct equip_primary; // Equipment: Main visual
/*00344*/ Texture_Struct equip_secondary; // Equipment: Off visual
// Below slots are just guesses, but all 0s anyway...
/*00364*/ EquipStruct equip_charm; // Equipment: Non-visual
/*00384*/ EquipStruct equip_ear1; // Equipment: Non-visual
/*00404*/ EquipStruct equip_ear2; // Equipment: Non-visual
/*00424*/ EquipStruct equip_face; // Equipment: Non-visual
/*00444*/ EquipStruct equip_neck; // Equipment: Non-visual
/*00464*/ EquipStruct equip_shoulder; // Equipment: Non-visual
/*00484*/ EquipStruct equip_bracer2; // Equipment: Non-visual
/*00504*/ EquipStruct equip_range; // Equipment: Non-visual
/*00524*/ EquipStruct equip_ring1; // Equipment: Non-visual
/*00544*/ EquipStruct equip_ring2; // Equipment: Non-visual
/*00564*/ EquipStruct equip_waist; // Equipment: Non-visual
/*00584*/ EquipStruct equip_powersource;// Equipment: Non-visual
/*00604*/ EquipStruct equip_ammo; // Equipment: Non-visual
/*00364*/ Texture_Struct equip_charm; // Equipment: Non-visual
/*00384*/ Texture_Struct equip_ear1; // Equipment: Non-visual
/*00404*/ Texture_Struct equip_ear2; // Equipment: Non-visual
/*00424*/ Texture_Struct equip_face; // Equipment: Non-visual
/*00444*/ Texture_Struct equip_neck; // Equipment: Non-visual
/*00464*/ Texture_Struct equip_shoulder; // Equipment: Non-visual
/*00484*/ Texture_Struct equip_bracer2; // Equipment: Non-visual
/*00504*/ Texture_Struct equip_range; // Equipment: Non-visual
/*00524*/ Texture_Struct equip_ring1; // Equipment: Non-visual
/*00544*/ Texture_Struct equip_ring2; // Equipment: Non-visual
/*00564*/ Texture_Struct equip_waist; // Equipment: Non-visual
/*00584*/ Texture_Struct equip_powersource;// Equipment: Non-visual
/*00604*/ Texture_Struct equip_ammo; // Equipment: Non-visual
} equip;
/*00184*/ EquipStruct equipment[22]; // Total Slots
/*00184*/ Texture_Struct equipment[22]; // Total Slots
};
/*00624*/ uint32 equip2_count; // Seen 9
/*00628*/ EquipStruct equipment2[EQEmu::legacy::MaterialCount]; // Appears to be Visible slots, but all 0s
/*00628*/ Texture_Struct equipment2[EQEmu::textures::TextureCount]; // Appears to be Visible slots, but all 0s
/*00808*/ uint32 tint_count; // Seen 9
/*00812*/ Color_Struct item_tint[EQEmu::legacy::MaterialCount]; // RR GG BB 00
/*00812*/ TintProfile item_tint; // RR GG BB 00
/*00848*/ uint32 tint_count2; // Seen 9
/*00852*/ Color_Struct item_tint2[EQEmu::legacy::MaterialCount]; // RR GG BB 00
/*00852*/ TintProfile item_tint2; // RR GG BB 00
/*00888*/ uint8 haircolor; // Player hair color
/*00889*/ uint8 beardcolor; // Player beard color
/*00890*/ uint32 unknown_rof5; //
@@ -1385,7 +1362,7 @@ struct WearChange_Struct{
/*010*/ uint32 elite_material; // 1 for Drakkin Elite Material
/*014*/ uint32 hero_forge_model; // New to VoA
/*018*/ uint32 unknown18; // New to RoF2
/*022*/ Color_Struct color;
/*022*/ Tint_Struct color;
/*026*/ uint8 wear_slot_id;
/*027*/
};
@@ -2446,7 +2423,7 @@ struct AdventureLeaderboard_Struct
/*struct Item_Shop_Struct {
uint16 merchantid;
uint8 itemtype;
Item_Struct item;
ItemBase item;
uint8 iss_unknown001[6];
};*/
@@ -3634,27 +3611,6 @@ struct PetitionBug_Struct{
char text[1028];
};
struct DyeStruct
{
union
{
struct
{
struct Color_Struct head;
struct Color_Struct chest;
struct Color_Struct arms;
struct Color_Struct wrists;
struct Color_Struct hands;
struct Color_Struct legs;
struct Color_Struct feet;
struct Color_Struct primary; // you can't actually dye this
struct Color_Struct secondary; // or this
}
dyes;
struct Color_Struct dye[9];
};
};
struct ApproveZone_Struct {
char name[64];
uint32 zoneid;
@@ -5088,6 +5044,15 @@ struct MercenaryMerchantResponse_Struct {
/*0004*/
};
// Sent by Server to update character crystals.
struct CrystalCountUpdate_Struct
{
/*000*/ uint32 CurrentRadiantCrystals;
/*004*/ uint32 CareerRadiantCrystals;
/*008*/ uint32 CurrentEbonCrystals;
/*012*/ uint32 CareerEbonCrystals;
};
}; /*structs*/
}; /*RoF2*/
+27 -9
View File
@@ -10,7 +10,7 @@
but WITHOUT ANY WARRANTY except by those people which sell it, which
are required to give you total support for your newly bought product;
without even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE. See the GNU General Public License for more details.
A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
@@ -22,7 +22,7 @@
#include "../string_util.h"
size_t RoF::invtype::InvTypeSize(int inv_type)
size_t RoF::invtype::GetInvTypeSize(int inv_type)
{
switch (inv_type) {
case invtype::InvTypePossessions:
@@ -78,7 +78,7 @@ size_t RoF::invtype::InvTypeSize(int inv_type)
}
}
const char* RoF::invtype::InvTypeName(int inv_type)
const char* RoF::invtype::GetInvTypeName(int inv_type)
{
switch (inv_type) {
case invtype::InvTypeInvalid:
@@ -136,7 +136,25 @@ const char* RoF::invtype::InvTypeName(int inv_type)
}
}
const char* RoF::invslot::InvPossessionsSlotName(int inv_slot)
bool RoF::invtype::IsInvTypePersistent(int inv_type)
{
switch (inv_type) {
case invtype::InvTypePossessions:
case invtype::InvTypeBank:
case invtype::InvTypeSharedBank:
case invtype::InvTypeTrade:
case invtype::InvTypeWorld:
case invtype::InvTypeLimbo:
case invtype::InvTypeTribute:
case invtype::InvTypeTrophyTribute:
case invtype::InvTypeGuildTribute:
return true;
default:
return false;
}
}
const char* RoF::invslot::GetInvPossessionsSlotName(int inv_slot)
{
switch (inv_slot) {
case invslot::InvSlotInvalid:
@@ -214,12 +232,12 @@ const char* RoF::invslot::InvPossessionsSlotName(int inv_slot)
}
}
const char* RoF::invslot::InvSlotName(int inv_type, int inv_slot)
const char* RoF::invslot::GetInvSlotName(int inv_type, int inv_slot)
{
if (inv_type == invtype::InvTypePossessions)
return invslot::InvPossessionsSlotName(inv_slot);
return invslot::GetInvPossessionsSlotName(inv_slot);
size_t type_size = invtype::InvTypeSize(inv_type);
size_t type_size = invtype::GetInvTypeSize(inv_type);
if (!type_size || inv_slot == invslot::InvSlotInvalid)
return "Invalid Slot";
@@ -233,7 +251,7 @@ const char* RoF::invslot::InvSlotName(int inv_type, int inv_slot)
return ret_str.c_str();
}
const char* RoF::invbag::InvBagIndexName(int bag_index)
const char* RoF::invbag::GetInvBagIndexName(int bag_index)
{
if (bag_index == invbag::InvBagInvalid)
return "Invalid Bag";
@@ -247,7 +265,7 @@ const char* RoF::invbag::InvBagIndexName(int bag_index)
return ret_str.c_str();
}
const char* RoF::invaug::InvAugIndexName(int aug_index)
const char* RoF::invaug::GetInvAugIndexName(int aug_index)
{
if (aug_index == invaug::InvAugInvalid)
return "Invalid Augment";
+35 -26
View File
@@ -10,7 +10,7 @@
but WITHOUT ANY WARRANTY except by those people which sell it, which
are required to give you total support for your newly bought product;
without even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE. See the GNU General Public License for more details.
A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
@@ -21,7 +21,7 @@
#define COMMON_ROF_LIMITS_H
#include "../types.h"
#include "../client_version.h"
#include "../emu_versions.h"
#include "../skills.h"
@@ -32,8 +32,13 @@ namespace RoF
enum : bool { False = false, True = true };
// pre-declarations
namespace inventory {
inline EQEmu::versions::ClientVersion GetInventoryRef() { return EQEmu::versions::ClientVersion::RoF; }
} /*inventory*/
namespace invtype {
inline EQEmu::versions::ClientVersion InvTypeRef() { return EQEmu::versions::ClientVersion::RoF; }
inline EQEmu::versions::ClientVersion GetInvTypeRef() { return EQEmu::versions::ClientVersion::RoF; }
enum : int { InvTypeInvalid = -1, InvTypeBegin };
@@ -68,7 +73,7 @@ namespace RoF
} /*invtype*/
namespace invslot {
inline EQEmu::versions::ClientVersion InvSlotRef() { return EQEmu::versions::ClientVersion::RoF; }
inline EQEmu::versions::ClientVersion GetInvSlotRef() { return EQEmu::versions::ClientVersion::RoF; }
enum : int { InvSlotInvalid = -1, InvSlotBegin };
@@ -121,21 +126,21 @@ namespace RoF
} /*invslot*/
namespace invbag {
inline EQEmu::versions::ClientVersion InvBagRef() { return EQEmu::versions::ClientVersion::RoF; }
inline EQEmu::versions::ClientVersion GetInvBagRef() { return EQEmu::versions::ClientVersion::RoF; }
enum : int { InvBagInvalid = -1, InvBagBegin };
} /*invbag*/
namespace invaug {
inline EQEmu::versions::ClientVersion InvAugRef() { return EQEmu::versions::ClientVersion::RoF; }
inline EQEmu::versions::ClientVersion GetInvAugRef() { return EQEmu::versions::ClientVersion::RoF; }
enum : int { InvAugInvalid = -1, InvAugBegin };
} /*invaug*/
namespace item {
inline EQEmu::versions::ClientVersion ItemRef() { return EQEmu::versions::ClientVersion::RoF; }
inline EQEmu::versions::ClientVersion GetItemRef() { return EQEmu::versions::ClientVersion::RoF; }
enum ItemPacketType : int {
ItemPacketMerchant = 100,
@@ -157,27 +162,37 @@ namespace RoF
} /*item*/
namespace profile {
inline EQEmu::versions::ClientVersion ProfileRef() { return EQEmu::versions::ClientVersion::RoF; }
inline EQEmu::versions::ClientVersion GetProfileRef() { return EQEmu::versions::ClientVersion::RoF; }
} /*profile*/
namespace constants {
inline EQEmu::versions::ClientVersion ConstantsRef() { return EQEmu::versions::ClientVersion::RoF; }
inline EQEmu::versions::ClientVersion GetConstantsRef() { return EQEmu::versions::ClientVersion::RoF; }
} /*constants*/
namespace behavior {
inline EQEmu::versions::ClientVersion BehaviorRef() { return EQEmu::versions::ClientVersion::RoF; }
inline EQEmu::versions::ClientVersion GetBehaviorRef() { return EQEmu::versions::ClientVersion::RoF; }
} /*behavior*/
namespace skills {
inline EQEmu::versions::ClientVersion SkillsRef() { return EQEmu::versions::ClientVersion::RoF; }
inline EQEmu::versions::ClientVersion GetSkillsRef() { return EQEmu::versions::ClientVersion::RoF; }
} /*skills*/
// declarations
namespace inventory {
const bool ConcatenateInvTypeLimbo = false;
const bool AllowOverLevelEquipment = true;
const bool AllowEmptyBagInBag = true;
const bool AllowClickCastFromBag = true;
} /*inventory*/
namespace invtype {
const size_t InvTypePossessionsSize = invslot::PossessionsCount;
const size_t InvTypeBankSize = 24;
@@ -187,7 +202,7 @@ namespace RoF
const size_t InvTypeLimboSize = 36;
const size_t InvTypeTributeSize = 5;
const size_t InvTypeTrophyTributeSize = 0;//unknown
const size_t InvTypeGuildTributeSize = 0;//unknown
const size_t InvTypeGuildTributeSize = 2;//unverified
const size_t InvTypeMerchantSize = 200;
const size_t InvTypeDeletedSize = 0;//unknown - "Recovery Tab"
const size_t InvTypeCorpseSize = InvTypePossessionsSize;
@@ -204,30 +219,30 @@ namespace RoF
const size_t InvTypeGuildTrophyTributeSize = 0;//unknown
const size_t InvTypeOtherSize = 0;//unknown
const size_t NPCTradeSize = 4;
extern size_t GetInvTypeSize(int inv_type);
extern const char* GetInvTypeName(int inv_type);
extern size_t InvTypeSize(int inv_type);
extern const char* InvTypeName(int inv_type);
extern bool IsInvTypePersistent(int inv_type);
} /*invtype*/
namespace invslot {
extern const char* InvPossessionsSlotName(int inv_slot);
extern const char* InvSlotName(int inv_type, int inv_slot);
extern const char* GetInvPossessionsSlotName(int inv_slot);
extern const char* GetInvSlotName(int inv_type, int inv_slot);
} /*invslot*/
namespace invbag {
const size_t ItemBagSize = 255; // server Size will be 255..unsure what actual client is (test)
extern const char* InvBagIndexName(int bag_index);
extern const char* GetInvBagIndexName(int bag_index);
} /*invbag*/
namespace invaug {
const size_t ItemAugSize = 6;
extern const char* InvAugIndexName(int aug_index);
extern const char* GetInvAugIndexName(int aug_index);
} /*invaug*/
@@ -237,6 +252,7 @@ namespace RoF
namespace profile {
const size_t TributeSize = invtype::InvTypeTributeSize;
const size_t GuildTributeSize = invtype::InvTypeGuildTributeSize;
const size_t BandoliersSize = 20; // number of bandolier instances
const size_t BandolierItemCount = 4; // number of equipment slots in bandolier instance
@@ -255,13 +271,6 @@ namespace RoF
} /*constants*/
namespace behavior {
const bool ConcatenateInvTypeLimbo = false;
const bool AllowOverLevelEquipment = true;
const bool AllowEmptyBagInBag = true;
const bool AllowClickCastFromBag = true;
const bool CoinHasWeight = false;
} /*behavior*/
+112 -156
View File
@@ -163,7 +163,7 @@ struct AdventureInfo {
** Merth: Gave struct a name so gcc 2.96 would compile
**
*/
struct Color_Struct
struct Tint_Struct
{
union {
struct {
@@ -171,21 +171,65 @@ struct Color_Struct
uint8 Green;
uint8 Red;
uint8 UseTint; // if there's a tint this is FF
} RGB;
};
uint32 Color;
};
};
struct CharSelectEquip
struct TintProfile
{
union {
struct {
Tint_Struct Head;
Tint_Struct Chest;
Tint_Struct Arms;
Tint_Struct Wrist;
Tint_Struct Hands;
Tint_Struct Legs;
Tint_Struct Feet;
Tint_Struct Primary;
Tint_Struct Secondary;
};
Tint_Struct Slot[EQEmu::textures::TextureCount];
};
};
/*
* Visible equiptment.
* Size: 20 Octets
*/
struct Texture_Struct
{
uint32 Material;
uint32 Unknown1;
uint32 EliteMaterial;
uint32 HeroForgeModel;
uint32 Material2;
Color_Struct Color;
uint32 Material2; // Same as material?
};
// Needs more research regarding new slots
//struct TextureProfile
//{
// union {
// struct {
// Texture_Struct Head;
// Texture_Struct Chest;
// Texture_Struct Arms;
// Texture_Struct Wrist;
// Texture_Struct Hands;
// Texture_Struct Legs;
// Texture_Struct Feet;
// Texture_Struct Primary;
// Texture_Struct Secondary;
// };
// Texture_Struct Slot[EQEmu::textures::TextureCount];
// };
//
// TextureProfile();
//};
struct CharSelectEquip : Texture_Struct, Tint_Struct {};
struct CharacterSelectEntry_Struct
{
/*0000*/ char Name[1]; // Name null terminated
@@ -231,21 +275,6 @@ struct CharacterSelect_Struct
/*004*/ CharacterSelectEntry_Struct Entries[0];
};
/*
* Visible equiptment.
* Size: 20 Octets
*/
struct EquipStruct
{
/*00*/ uint32 Material;
/*04*/ uint32 Unknown1;
/*08*/ uint32 EliteMaterial;
/*12*/ uint32 HeroForgeModel;
/*16*/ uint32 Material2; // Same as material?
/*20*/
};
struct Membership_Entry_Struct
{
/*000*/ uint32 purchase_id; // Seen 1, then increments 90287 to 90300
@@ -441,39 +470,24 @@ struct Spawn_Struct
/*0000*/ uint32 unknown18;
/*0000*/ uint32 unknown19;
Spawn_Struct_Position Position;
/*0000*/ union
{
struct
{
/*0000*/ Color_Struct color_helmet; // Color of helmet item
/*0000*/ Color_Struct color_chest; // Color of chest item
/*0000*/ Color_Struct color_arms; // Color of arms item
/*0000*/ Color_Struct color_bracers; // Color of bracers item
/*0000*/ Color_Struct color_hands; // Color of hands item
/*0000*/ Color_Struct color_legs; // Color of legs item
/*0000*/ Color_Struct color_feet; // Color of feet item
/*0000*/ Color_Struct color_primary; // Color of primary item
/*0000*/ Color_Struct color_secondary; // Color of secondary item
} equipment_colors;
/*0000*/ Color_Struct colors[9]; // Array elements correspond to struct equipment_colors above
};
/*0000*/ TintProfile equipment_tint;
// skip these bytes if not a valid player race
/*0000*/ union
{
struct
{
/*0000*/ EquipStruct equip_helmet; // Equiptment: Helmet visual
/*0000*/ EquipStruct equip_chest; // Equiptment: Chest visual
/*0000*/ EquipStruct equip_arms; // Equiptment: Arms visual
/*0000*/ EquipStruct equip_bracers; // Equiptment: Wrist visual
/*0000*/ EquipStruct equip_hands; // Equiptment: Hands visual
/*0000*/ EquipStruct equip_legs; // Equiptment: Legs visual
/*0000*/ EquipStruct equip_feet; // Equiptment: Boots visual
/*0000*/ EquipStruct equip_primary; // Equiptment: Main visual
/*0000*/ EquipStruct equip_secondary; // Equiptment: Off visual
/*0000*/ Texture_Struct equip_helmet; // Equiptment: Helmet visual
/*0000*/ Texture_Struct equip_chest; // Equiptment: Chest visual
/*0000*/ Texture_Struct equip_arms; // Equiptment: Arms visual
/*0000*/ Texture_Struct equip_bracers; // Equiptment: Wrist visual
/*0000*/ Texture_Struct equip_hands; // Equiptment: Hands visual
/*0000*/ Texture_Struct equip_legs; // Equiptment: Legs visual
/*0000*/ Texture_Struct equip_feet; // Equiptment: Boots visual
/*0000*/ Texture_Struct equip_primary; // Equiptment: Main visual
/*0000*/ Texture_Struct equip_secondary; // Equiptment: Off visual
} equip;
/*0000*/ EquipStruct equipment[9];
/*0000*/ Texture_Struct equipment[9];
};
/*0000*/ //char title[0]; // only read if(hasTitleOrSuffix & 4)
@@ -610,7 +624,7 @@ struct MemorizeSpell_Struct {
uint32 slot; // Spot in the spell book/memorized slot
uint32 spell_id; // Spell id (200 or c8 is minor healing, etc)
uint32 scribing; // 1 if memorizing a spell, set to 0 if scribing to book, 2 if un-memming
uint32 unknown12;
uint32 reduction; // lowers reuse
};
/*
@@ -643,11 +657,12 @@ struct DeleteSpell_Struct
struct ManaChange_Struct
{
uint32 new_mana; // New Mana AMount
uint32 stamina;
uint32 spell_id;
uint32 unknown12;
uint32 unknown16;
/*00*/ uint32 new_mana; // New Mana AMount
/*04*/ uint32 stamina;
/*08*/ uint32 spell_id;
/*12*/ uint8 keepcasting; // won't stop the cast. Change mana while casting?
/*13*/ uint8 padding[3]; // client doesn't read it, garbage data seems like
/*16*/ int32 slot; // -1 for normal usage slot for when we want silent interrupt? I think it does timer stuff or something. Linked Spell Reuse interrupt uses it
};
struct SwapSpell_Struct
@@ -694,69 +709,31 @@ struct SpawnAppearance_Struct
struct SpellBuff_Struct
{
/*000*/ uint8 slotid; // badly named... seems to be 2 for a real buff, 0 otherwise
/*001*/ float unknown004; // Seen 1 for no buff
/*005*/ uint32 player_id; // 'global' ID of the caster, for wearoff messages
/*009*/ uint32 unknown016;
/*013*/ uint8 bard_modifier;
/*014*/ int32 duration;
/*018*/ uint8 level;
/*019*/ uint32 spellid;
/*023*/ uint32 counters;
/*027*/ uint8 unknown0028[53];
/*080*/
};
struct SpellBuff_Struct_Old
{
/*000*/ uint8 slotid; // badly named... seems to be 2 for a real buff, 0 otherwise
/*001*/ uint8 level;
/*002*/ uint8 bard_modifier;
/*003*/ uint8 effect; // not real
/*004*/ float unknown004; // Seen 1 for no buff
/*008*/ uint32 spellid;
/*012*/ int32 duration;
/*016*/ uint32 unknown016;
/*020*/ uint32 player_id; // 'global' ID of the caster, for wearoff messages
/*024*/ uint32 counters;
/*028*/ uint8 unknown0028[60];
/*000*/ uint8 effect_type; // 0 = no buff, 2 = buff, 4 = inverse affects of buff
/*001*/ uint8 level; // Seen 1 for no buff
/*002*/ uint8 unknown002; //pretty sure padding now
/*003*/ uint8 unknown003; // MQ2 used to call this "damage shield" -- don't see client referencing it, so maybe server side DS type tracking?
/*004*/ float bard_modifier;
/*008*/ uint32 spellid;
/*012*/ uint32 duration;
/*016*/ uint32 player_id; // caster ID, pretty sure just zone ID
/*020*/ uint32 num_hits;
/*024*/ float y; // referenced by SPA 441
/*028*/ float x; // unsure if all buffs get them
/*032*/ float z; // as valid data
/*036*/ uint32 unknown036;
/*040*/ int32 slot_data[12]; // book keeping stuff per slot (counters, rune/vie)
/*088*/
};
// Not functional yet, but this is what the packet looks like on Live
struct SpellBuffFade_Struct_Live {
/*000*/ uint32 entityid; // Player id who cast the buff
/*004*/ uint8 unknown004;
/*005*/ uint8 level;
/*006*/ uint8 effect;
/*007*/ uint8 unknown007;
/*008*/ float unknown008;
/*012*/ uint32 spellid;
/*016*/ int32 duration;
/*020*/ uint32 playerId; // Global player ID?
/*024*/ uint32 num_hits;
/*028*/ uint8 unknown0028[64];
struct SpellBuffPacket_Struct {
/*000*/ uint32 entityid; // Player id who cast the buff
/*004*/ SpellBuff_Struct buff;
/*092*/ uint32 slotid;
/*096*/ uint32 bufffade;
/*100*/
};
struct SpellBuffFade_Struct {
/*000*/ uint32 entityid;
/*004*/ uint8 slot;
/*005*/ uint8 level;
/*006*/ uint8 effect;
/*007*/ uint8 unknown7;
/*008*/ uint32 spellid;
/*012*/ int32 duration;
/*016*/ uint32 num_hits;
/*020*/ uint32 unknown020; // Global player ID?
/*024*/ uint32 playerId; // Player id who cast the buff
/*028*/ uint32 slotid;
/*032*/ uint32 bufffade;
/*036*/
};
struct BuffRemoveRequest_Struct
{
/*00*/ uint32 SlotID;
@@ -1061,38 +1038,38 @@ union
{
struct
{
/*00184*/ EquipStruct equip_helmet; // Equiptment: Helmet visual
/*00204*/ EquipStruct equip_chest; // Equiptment: Chest visual
/*00224*/ EquipStruct equip_arms; // Equiptment: Arms visual
/*00244*/ EquipStruct equip_bracers; // Equiptment: Wrist visual
/*00264*/ EquipStruct equip_hands; // Equiptment: Hands visual
/*00284*/ EquipStruct equip_legs; // Equiptment: Legs visual
/*00304*/ EquipStruct equip_feet; // Equiptment: Boots visual
/*00324*/ EquipStruct equip_primary; // Equiptment: Main visual
/*00344*/ EquipStruct equip_secondary; // Equiptment: Off visual
/*00184*/ Texture_Struct equip_helmet; // Equiptment: Helmet visual
/*00204*/ Texture_Struct equip_chest; // Equiptment: Chest visual
/*00224*/ Texture_Struct equip_arms; // Equiptment: Arms visual
/*00244*/ Texture_Struct equip_bracers; // Equiptment: Wrist visual
/*00264*/ Texture_Struct equip_hands; // Equiptment: Hands visual
/*00284*/ Texture_Struct equip_legs; // Equiptment: Legs visual
/*00304*/ Texture_Struct equip_feet; // Equiptment: Boots visual
/*00324*/ Texture_Struct equip_primary; // Equiptment: Main visual
/*00344*/ Texture_Struct equip_secondary; // Equiptment: Off visual
// Below slots are just guesses, but all 0s anyway...
/*00364*/ EquipStruct equip_charm; // Equiptment: Non-visual
/*00384*/ EquipStruct equip_ear1; // Equiptment: Non-visual
/*00404*/ EquipStruct equip_ear2; // Equiptment: Non-visual
/*00424*/ EquipStruct equip_face; // Equiptment: Non-visual
/*00444*/ EquipStruct equip_neck; // Equiptment: Non-visual
/*00464*/ EquipStruct equip_shoulder; // Equiptment: Non-visual
/*00484*/ EquipStruct equip_bracer2; // Equiptment: Non-visual
/*00504*/ EquipStruct equip_range; // Equiptment: Non-visual
/*00524*/ EquipStruct equip_ring1; // Equiptment: Non-visual
/*00544*/ EquipStruct equip_ring2; // Equiptment: Non-visual
/*00564*/ EquipStruct equip_waist; // Equiptment: Non-visual
/*00584*/ EquipStruct equip_powersource; // Equiptment: Non-visual
/*00604*/ EquipStruct equip_ammo; // Equiptment: Non-visual
/*00364*/ Texture_Struct equip_charm; // Equiptment: Non-visual
/*00384*/ Texture_Struct equip_ear1; // Equiptment: Non-visual
/*00404*/ Texture_Struct equip_ear2; // Equiptment: Non-visual
/*00424*/ Texture_Struct equip_face; // Equiptment: Non-visual
/*00444*/ Texture_Struct equip_neck; // Equiptment: Non-visual
/*00464*/ Texture_Struct equip_shoulder; // Equiptment: Non-visual
/*00484*/ Texture_Struct equip_bracer2; // Equiptment: Non-visual
/*00504*/ Texture_Struct equip_range; // Equiptment: Non-visual
/*00524*/ Texture_Struct equip_ring1; // Equiptment: Non-visual
/*00544*/ Texture_Struct equip_ring2; // Equiptment: Non-visual
/*00564*/ Texture_Struct equip_waist; // Equiptment: Non-visual
/*00584*/ Texture_Struct equip_powersource; // Equiptment: Non-visual
/*00604*/ Texture_Struct equip_ammo; // Equiptment: Non-visual
} equip;
/*00184*/ EquipStruct equipment[22];
/*00184*/ Texture_Struct equipment[22];
};
/*00624*/ uint32 equip2_count; // Seen 9
/*00628*/ EquipStruct equipment2[9]; // Appears to be Visible slots, but all 0s
/*00628*/ Texture_Struct equipment2[9]; // Appears to be Visible slots, but all 0s
/*00808*/ uint32 tint_count; // Seen 9
/*00812*/ Color_Struct item_tint[9]; // RR GG BB 00
/*00812*/ TintProfile item_tint; // RR GG BB 00
/*00848*/ uint32 tint_count2; // Seen 9
/*00852*/ Color_Struct item_tint2[9]; // RR GG BB 00
/*00852*/ TintProfile item_tint2; // RR GG BB 00
/*00888*/ uint8 haircolor; // Player hair color
/*00889*/ uint8 beardcolor; // Player beard color
/*00890*/ uint32 unknown_rof5; //
@@ -1415,7 +1392,7 @@ struct WearChange_Struct{
/*010*/ uint32 elite_material; // 1 for Drakkin Elite Material
/*014*/ uint32 hero_forge_model; // New to VoA
/*018*/ uint32 unknown18; // New to RoF
/*022*/ Color_Struct color;
/*022*/ Tint_Struct color;
/*026*/ uint8 wear_slot_id;
/*027*/
};
@@ -2473,7 +2450,7 @@ struct AdventureLeaderboard_Struct
/*struct Item_Shop_Struct {
uint16 merchantid;
uint8 itemtype;
Item_Struct item;
ItemBase item;
uint8 iss_unknown001[6];
};*/
@@ -3634,27 +3611,6 @@ struct PetitionBug_Struct{
char text[1028];
};
struct DyeStruct
{
union
{
struct
{
struct Color_Struct head;
struct Color_Struct chest;
struct Color_Struct arms;
struct Color_Struct wrists;
struct Color_Struct hands;
struct Color_Struct legs;
struct Color_Struct feet;
struct Color_Struct primary; // you can't actually dye this
struct Color_Struct secondary; // or this
}
dyes;
struct Color_Struct dye[9];
};
};
struct ApproveZone_Struct {
char name[64];
uint32 zoneid;
+114 -39
View File
@@ -59,6 +59,9 @@ namespace SoD
// client to server text link converter
static inline void SoDToServerTextLink(std::string& serverTextLink, const std::string& sodTextLink);
static inline CastingSlot ServerToSoDCastingSlot(EQEmu::CastingSlot slot);
static inline EQEmu::CastingSlot SoDToServerCastingSlot(CastingSlot slot);
void Register(EQStreamIdentifier &into)
{
//create our opcode manager if we havent already
@@ -301,16 +304,17 @@ namespace SoD
ENCODE(OP_Buff)
{
ENCODE_LENGTH_EXACT(SpellBuffFade_Struct);
SETUP_DIRECT_ENCODE(SpellBuffFade_Struct, structs::SpellBuffFade_Struct);
ENCODE_LENGTH_EXACT(SpellBuffPacket_Struct);
SETUP_DIRECT_ENCODE(SpellBuffPacket_Struct, structs::SpellBuffPacket_Struct);
OUT(entityid);
OUT(slot);
OUT(level);
OUT(effect);
//eq->unknown7 = 10;
OUT(spellid);
OUT(duration);
OUT(buff.effect_type);
OUT(buff.level);
OUT(buff.bard_modifier);
OUT(buff.spellid);
OUT(buff.duration);
OUT(buff.counters);
OUT(buff.player_id);
OUT(slotid);
OUT(bufffade);
@@ -1135,7 +1139,8 @@ namespace SoD
OUT(new_mana);
OUT(stamina);
OUT(spell_id);
eq->unknown16 = -1; // Self Interrupt/Success = -1, Fizzle = 1, Other Interrupt = 2?
OUT(keepcasting);
eq->slot = -1; // this is spell gem slot. It's -1 in normal operation
FINISH_ENCODE();
}
@@ -1498,7 +1503,7 @@ namespace SoD
VARSTRUCT_ENCODE_TYPE(uint32, Buffer, emu->petid);
VARSTRUCT_ENCODE_TYPE(uint16, Buffer, emu->buffcount);
for (unsigned int i = 0; i < BUFF_COUNT; ++i)
for (unsigned int i = 0; i < PET_BUFF_COUNT; ++i)
{
if (emu->spellid[i])
{
@@ -1509,7 +1514,7 @@ namespace SoD
}
}
VARSTRUCT_ENCODE_TYPE(uint8, Buffer, emu->buffcount);
VARSTRUCT_ENCODE_TYPE(uint8, Buffer, emu->buffcount); // I think this is actually some sort of type
delete[] __emu_buffer;
dest->FastQueuePacket(&in, ack_req);
@@ -1553,14 +1558,14 @@ namespace SoD
OUT(hairstyle);
OUT(beard);
// OUT(unknown00178[10]);
for (r = 0; r < 9; r++) {
eq->equipment[r].Material = emu->item_material[r];
eq->equipment[r].Unknown1 = 0;
eq->equipment[r].EliteMaterial = 0;
for (r = EQEmu::textures::TextureBegin; r < EQEmu::textures::TextureCount; r++) {
eq->equipment.Slot[r].Material = emu->item_material.Slot[r].Material;
eq->equipment.Slot[r].Unknown1 = 0;
eq->equipment.Slot[r].EliteMaterial = 0;
//eq->colors[r].color = emu->colors[r].color;
}
for (r = 0; r < 7; r++) {
OUT(item_tint[r].Color);
OUT(item_tint.Slot[r].Color);
}
// OUT(unknown00224[48]);
//NOTE: new client supports 300 AAs, our internal rep/PP
@@ -1602,10 +1607,10 @@ namespace SoD
OUT(thirst_level);
OUT(hunger_level);
for (r = 0; r < structs::BUFF_COUNT; r++) {
OUT(buffs[r].slotid);
OUT(buffs[r].effect_type);
OUT(buffs[r].level);
OUT(buffs[r].bard_modifier);
OUT(buffs[r].effect);
OUT(buffs[r].unknown003);
OUT(buffs[r].spellid);
OUT(buffs[r].duration);
OUT(buffs[r].counters);
@@ -1993,11 +1998,11 @@ namespace SoD
eq_cse->HairColor = emu_cse->HairColor;
eq_cse->Face = emu_cse->Face;
for (int equip_index = 0; equip_index < EQEmu::legacy::MaterialCount; equip_index++) {
for (int equip_index = 0; equip_index < EQEmu::textures::TextureCount; equip_index++) {
eq_cse->Equip[equip_index].Material = emu_cse->Equip[equip_index].Material;
eq_cse->Equip[equip_index].Unknown1 = emu_cse->Equip[equip_index].Unknown1;
eq_cse->Equip[equip_index].EliteMaterial = emu_cse->Equip[equip_index].EliteMaterial;
eq_cse->Equip[equip_index].Color.Color = emu_cse->Equip[equip_index].Color.Color;
eq_cse->Equip[equip_index].Color = emu_cse->Equip[equip_index].Color;
}
eq_cse->PrimaryIDFile = emu_cse->PrimaryIDFile;
@@ -2563,7 +2568,7 @@ namespace SoD
float SpawnSize = emu->size;
if (!((emu->NPC == 0) || (emu->race <= 12) || (emu->race == 128) || (emu->race == 130) || (emu->race == 330) || (emu->race == 522)))
{
PacketSize -= (sizeof(structs::EquipStruct) * 9);
PacketSize -= (sizeof(structs::Texture_Struct) * EQEmu::textures::TextureCount);
if (emu->size == 0)
{
@@ -2760,10 +2765,10 @@ namespace SoD
if ((emu->NPC == 0) || (emu->race <= 12) || (emu->race == 128) || (emu->race == 130) || (emu->race == 330) || (emu->race == 522))
{
for (k = 0; k < 9; ++k)
for (k = EQEmu::textures::TextureBegin; k < EQEmu::textures::TextureCount; ++k)
{
{
VARSTRUCT_ENCODE_TYPE(uint32, Buffer, emu->colors[k].Color);
VARSTRUCT_ENCODE_TYPE(uint32, Buffer, emu->equipment_tint.Slot[k].Color);
}
}
}
@@ -2773,11 +2778,11 @@ namespace SoD
VARSTRUCT_ENCODE_TYPE(uint32, Buffer, 0);
VARSTRUCT_ENCODE_TYPE(uint32, Buffer, 0);
VARSTRUCT_ENCODE_TYPE(uint32, Buffer, emu->equipment[EQEmu::legacy::MaterialPrimary].Material);
VARSTRUCT_ENCODE_TYPE(uint32, Buffer, emu->equipment.Primary.Material);
VARSTRUCT_ENCODE_TYPE(uint32, Buffer, 0);
VARSTRUCT_ENCODE_TYPE(uint32, Buffer, 0);
VARSTRUCT_ENCODE_TYPE(uint32, Buffer, emu->equipment[EQEmu::legacy::MaterialSecondary].Material);
VARSTRUCT_ENCODE_TYPE(uint32, Buffer, emu->equipment.Secondary.Material);
VARSTRUCT_ENCODE_TYPE(uint32, Buffer, 0);
VARSTRUCT_ENCODE_TYPE(uint32, Buffer, 0);
}
@@ -2785,15 +2790,15 @@ namespace SoD
if ((emu->NPC == 0) || (emu->race <= 12) || (emu->race == 128) || (emu->race == 130) || (emu->race == 330) || (emu->race == 522))
{
structs::EquipStruct *Equipment = (structs::EquipStruct *)Buffer;
structs::Texture_Struct *Equipment = (structs::Texture_Struct *)Buffer;
for (k = 0; k < 9; k++) {
Equipment[k].Material = emu->equipment[k].Material;
Equipment[k].Unknown1 = emu->equipment[k].Unknown1;
Equipment[k].EliteMaterial = emu->equipment[k].EliteMaterial;
for (k = EQEmu::textures::TextureBegin; k < EQEmu::textures::TextureCount; k++) {
Equipment[k].Material = emu->equipment.Slot[k].Material;
Equipment[k].Unknown1 = emu->equipment.Slot[k].Unknown1;
Equipment[k].EliteMaterial = emu->equipment.Slot[k].EliteMaterial;
}
Buffer += (sizeof(structs::EquipStruct) * 9);
Buffer += (sizeof(structs::Texture_Struct) * EQEmu::textures::TextureCount);
}
if (strlen(emu->title))
{
@@ -2907,15 +2912,16 @@ namespace SoD
DECODE(OP_Buff)
{
DECODE_LENGTH_EXACT(structs::SpellBuffFade_Struct);
SETUP_DIRECT_DECODE(SpellBuffFade_Struct, structs::SpellBuffFade_Struct);
DECODE_LENGTH_EXACT(structs::SpellBuffPacket_Struct);
SETUP_DIRECT_DECODE(SpellBuffPacket_Struct, structs::SpellBuffPacket_Struct);
IN(entityid);
IN(slot);
IN(level);
IN(effect);
IN(spellid);
IN(duration);
IN(buff.effect_type);
IN(buff.level);
IN(buff.bard_modifier);
IN(buff.spellid);
IN(buff.duration);
IN(buff.counters)
IN(slotid);
IN(bufffade);
@@ -2946,6 +2952,7 @@ namespace SoD
DECODE_LENGTH_EXACT(structs::CastSpell_Struct);
SETUP_DIRECT_DECODE(CastSpell_Struct, structs::CastSpell_Struct);
emu->slot = static_cast<uint32>(SoDToServerCastingSlot(static_cast<CastingSlot>(eq->slot)));
IN(slot);
IN(spell_id);
emu->inventoryslot = SoDToServerSlot(eq->inventoryslot);
@@ -3546,7 +3553,7 @@ namespace SoD
void SerializeItem(EQEmu::OutBuffer& ob, const ItemInst *inst, int16 slot_id_in, uint8 depth)
{
const EQEmu::Item_Struct *item = inst->GetUnscaledItem();
const EQEmu::ItemBase *item = inst->GetUnscaledItem();
SoD::structs::ItemSerializationHeader hdr;
@@ -4011,4 +4018,72 @@ namespace SoD
}
}
static inline CastingSlot ServerToSoDCastingSlot(EQEmu::CastingSlot slot)
{
switch (slot) {
case EQEmu::CastingSlot::Gem1:
return CastingSlot::Gem1;
case EQEmu::CastingSlot::Gem2:
return CastingSlot::Gem2;
case EQEmu::CastingSlot::Gem3:
return CastingSlot::Gem3;
case EQEmu::CastingSlot::Gem4:
return CastingSlot::Gem4;
case EQEmu::CastingSlot::Gem5:
return CastingSlot::Gem5;
case EQEmu::CastingSlot::Gem6:
return CastingSlot::Gem6;
case EQEmu::CastingSlot::Gem7:
return CastingSlot::Gem7;
case EQEmu::CastingSlot::Gem8:
return CastingSlot::Gem8;
case EQEmu::CastingSlot::Gem9:
return CastingSlot::Gem9;
case EQEmu::CastingSlot::Gem10:
return CastingSlot::Gem10;
case EQEmu::CastingSlot::Item:
case EQEmu::CastingSlot::PotionBelt:
return CastingSlot::Item;
case EQEmu::CastingSlot::Discipline:
return CastingSlot::Discipline;
case EQEmu::CastingSlot::AltAbility:
return CastingSlot::AltAbility;
default: // we shouldn't have any issues with other slots ... just return something
return CastingSlot::Discipline;
}
}
static inline EQEmu::CastingSlot SoDToServerCastingSlot(CastingSlot slot)
{
switch (slot) {
case CastingSlot::Gem1:
return EQEmu::CastingSlot::Gem1;
case CastingSlot::Gem2:
return EQEmu::CastingSlot::Gem2;
case CastingSlot::Gem3:
return EQEmu::CastingSlot::Gem3;
case CastingSlot::Gem4:
return EQEmu::CastingSlot::Gem4;
case CastingSlot::Gem5:
return EQEmu::CastingSlot::Gem5;
case CastingSlot::Gem6:
return EQEmu::CastingSlot::Gem6;
case CastingSlot::Gem7:
return EQEmu::CastingSlot::Gem7;
case CastingSlot::Gem8:
return EQEmu::CastingSlot::Gem8;
case CastingSlot::Gem9:
return EQEmu::CastingSlot::Gem9;
case CastingSlot::Gem10:
return EQEmu::CastingSlot::Gem10;
case CastingSlot::Discipline:
return EQEmu::CastingSlot::Discipline;
case CastingSlot::Item:
return EQEmu::CastingSlot::Item;
case CastingSlot::AltAbility:
return EQEmu::CastingSlot::AltAbility;
default: // we shouldn't have any issues with other slots ... just return something
return EQEmu::CastingSlot::Discipline;
}
}
} /*SoD*/
+16
View File
@@ -50,6 +50,22 @@ namespace SoD
#include "sod_ops.h"
};
enum class CastingSlot : uint32 {
Gem1 = 0,
Gem2 = 1,
Gem3 = 2,
Gem4 = 3,
Gem5 = 4,
Gem6 = 5,
Gem7 = 6,
Gem8 = 7,
Gem9 = 8,
Gem10 = 9,
Item = 10,
Discipline = 11,
AltAbility = 0xFF
};
}; /*SoD*/
#endif /*COMMON_SOD_H*/
+29 -12
View File
@@ -10,7 +10,7 @@
but WITHOUT ANY WARRANTY except by those people which sell it, which
are required to give you total support for your newly bought product;
without even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE. See the GNU General Public License for more details.
A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
@@ -22,7 +22,7 @@
#include "../string_util.h"
size_t SoD::invtype::InvTypeSize(int inv_type)
size_t SoD::invtype::GetInvTypeSize(int inv_type)
{
switch (inv_type) {
case invtype::InvTypePossessions:
@@ -68,7 +68,7 @@ size_t SoD::invtype::InvTypeSize(int inv_type)
}
}
const char* SoD::invtype::InvTypeName(int inv_type)
const char* SoD::invtype::GetInvTypeName(int inv_type)
{
switch (inv_type) {
case invtype::InvTypeInvalid:
@@ -116,7 +116,24 @@ const char* SoD::invtype::InvTypeName(int inv_type)
}
}
const char* SoD::invslot::InvPossessionsSlotName(int inv_slot)
bool SoD::invtype::IsInvTypePersistent(int inv_type)
{
switch (inv_type) {
case invtype::InvTypePossessions:
case invtype::InvTypeBank:
case invtype::InvTypeSharedBank:
case invtype::InvTypeTrade:
case invtype::InvTypeWorld:
case invtype::InvTypeLimbo:
case invtype::InvTypeTribute:
case invtype::InvTypeGuildTribute:
return true;
default:
return false;
}
}
const char* SoD::invslot::GetInvPossessionsSlotName(int inv_slot)
{
switch (inv_slot) {
case invslot::InvSlotInvalid:
@@ -190,9 +207,9 @@ const char* SoD::invslot::InvPossessionsSlotName(int inv_slot)
}
}
const char* SoD::invslot::InvCorpseSlotName(int inv_slot)
const char* SoD::invslot::GetInvCorpseSlotName(int inv_slot)
{
if (!invtype::InvTypeSize(invtype::InvTypeCorpse) || inv_slot == invslot::InvSlotInvalid)
if (!invtype::GetInvTypeSize(invtype::InvTypeCorpse) || inv_slot == invslot::InvSlotInvalid)
return "Invalid Slot";
// needs work
@@ -205,14 +222,14 @@ const char* SoD::invslot::InvCorpseSlotName(int inv_slot)
return ret_str.c_str();
}
const char* SoD::invslot::InvSlotName(int inv_type, int inv_slot)
const char* SoD::invslot::GetInvSlotName(int inv_type, int inv_slot)
{
if (inv_type == invtype::InvTypePossessions)
return invslot::InvPossessionsSlotName(inv_slot);
return invslot::GetInvPossessionsSlotName(inv_slot);
else if (inv_type == invtype::InvTypeCorpse)
return invslot::InvCorpseSlotName(inv_slot);
return invslot::GetInvCorpseSlotName(inv_slot);
size_t type_size = invtype::InvTypeSize(inv_type);
size_t type_size = invtype::GetInvTypeSize(inv_type);
if (!type_size || inv_slot == invslot::InvSlotInvalid)
return "Invalid Slot";
@@ -226,7 +243,7 @@ const char* SoD::invslot::InvSlotName(int inv_type, int inv_slot)
return ret_str.c_str();
}
const char* SoD::invbag::InvBagIndexName(int bag_index)
const char* SoD::invbag::GetInvBagIndexName(int bag_index)
{
if (bag_index == invbag::InvBagInvalid)
return "Invalid Bag";
@@ -240,7 +257,7 @@ const char* SoD::invbag::InvBagIndexName(int bag_index)
return ret_str.c_str();
}
const char* SoD::invaug::InvAugIndexName(int aug_index)
const char* SoD::invaug::GetInvAugIndexName(int aug_index)
{
if (aug_index == invaug::InvAugInvalid)
return "Invalid Augment";
+40 -28
View File
@@ -10,7 +10,7 @@
but WITHOUT ANY WARRANTY except by those people which sell it, which
are required to give you total support for your newly bought product;
without even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE. See the GNU General Public License for more details.
A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
@@ -21,7 +21,7 @@
#define COMMON_SOD_LIMITS_H
#include "../types.h"
#include "../client_version.h"
#include "../emu_versions.h"
#include "../skills.h"
@@ -32,8 +32,13 @@ namespace SoD
enum : bool { False = false, True = true };
// pre-declarations
namespace inventory {
inline EQEmu::versions::ClientVersion GetInventoryRef() { return EQEmu::versions::ClientVersion::SoD; }
} /*inventory*/
namespace invtype {
inline EQEmu::versions::ClientVersion InvTypeRef() { return EQEmu::versions::ClientVersion::SoD; }
inline EQEmu::versions::ClientVersion GetInvTypeRef() { return EQEmu::versions::ClientVersion::SoD; }
enum : int { InvTypeInvalid = -1, InvTypeBegin };
@@ -63,7 +68,7 @@ namespace SoD
} /*invtype*/
namespace invslot {
inline EQEmu::versions::ClientVersion InvSlotRef() { return EQEmu::versions::ClientVersion::SoD; }
inline EQEmu::versions::ClientVersion GetInvSlotRef() { return EQEmu::versions::ClientVersion::SoD; }
enum : int { InvSlotInvalid = -1, InvSlotBegin };
@@ -114,21 +119,21 @@ namespace SoD
} /*invslot*/
namespace invbag {
inline EQEmu::versions::ClientVersion InvBagRef() { return EQEmu::versions::ClientVersion::SoD; }
inline EQEmu::versions::ClientVersion GetInvBagRef() { return EQEmu::versions::ClientVersion::SoD; }
enum : int { InvBagInvalid = -1, InvBagBegin };
} /*invbag*/
namespace invaug {
inline EQEmu::versions::ClientVersion InvAugRef() { return EQEmu::versions::ClientVersion::SoD; }
inline EQEmu::versions::ClientVersion GetInvAugRef() { return EQEmu::versions::ClientVersion::SoD; }
enum : int { InvAugInvalid = -1, InvAugBegin };
} /*invaug*/
namespace item {
inline EQEmu::versions::ClientVersion ItemRef() { return EQEmu::versions::ClientVersion::SoD; }
inline EQEmu::versions::ClientVersion GetItemRef() { return EQEmu::versions::ClientVersion::SoD; }
enum ItemPacketType : int {
ItemPacketMerchant = 100,
@@ -146,27 +151,37 @@ namespace SoD
} /*item*/
namespace profile {
inline EQEmu::versions::ClientVersion ProfileRef() { return EQEmu::versions::ClientVersion::SoD; }
inline EQEmu::versions::ClientVersion GetProfileRef() { return EQEmu::versions::ClientVersion::SoD; }
} /*profile*/
namespace constants {
inline EQEmu::versions::ClientVersion ConstantsRef() { return EQEmu::versions::ClientVersion::SoD; }
inline EQEmu::versions::ClientVersion GetConstantsRef() { return EQEmu::versions::ClientVersion::SoD; }
} /*constants*/
namespace behavior {
inline EQEmu::versions::ClientVersion BehaviorRef() { return EQEmu::versions::ClientVersion::SoD; }
inline EQEmu::versions::ClientVersion GetBehaviorRef() { return EQEmu::versions::ClientVersion::SoD; }
} /*behavior*/
namespace skills {
inline EQEmu::versions::ClientVersion SkillsRef() { return EQEmu::versions::ClientVersion::SoD; }
inline EQEmu::versions::ClientVersion GetSkillsRef() { return EQEmu::versions::ClientVersion::SoD; }
} /*skills*/
// declarations
namespace inventory {
const bool ConcatenateInvTypeLimbo = true;
const bool AllowOverLevelEquipment = false;
const bool AllowEmptyBagInBag = false;
const bool AllowClickCastFromBag = false;
} /*inventory*/
namespace invtype {
const size_t InvTypePossessionsSize = invslot::PossessionsCount;
const size_t InvTypeBankSize = 24;
@@ -175,7 +190,7 @@ namespace SoD
const size_t InvTypeWorldSize = 10;
const size_t InvTypeLimboSize = 36;
const size_t InvTypeTributeSize = 5;
const size_t InvTypeGuildTributeSize = 0;//unknown
const size_t InvTypeGuildTributeSize = 2;
const size_t InvTypeMerchantSize = 80;
const size_t InvTypeCorpseSize = InvTypePossessionsSize;
const size_t InvTypeBazaarSize = 80;
@@ -188,10 +203,10 @@ namespace SoD
const size_t InvTypeArchivedSize = 0;//unknown
const size_t InvTypeOtherSize = 0;//unknown
const size_t NPCTradeSize = 4;
extern size_t GetInvTypeSize(int inv_type);
extern const char* GetInvTypeName(int inv_type);
extern size_t InvTypeSize(int inv_type);
extern const char* InvTypeName(int inv_type);
extern bool IsInvTypePersistent(int inv_type);
} /*invtype*/
@@ -210,14 +225,17 @@ namespace SoD
const int WorldEnd = (WorldBegin + invtype::InvTypeWorldSize) - 1;
const int TributeBegin = 400;
const int TributeEnd = 404;
const int TributeEnd = (TributeBegin + invtype::InvTypeTributeSize) - 1;
const int GuildTributeBegin = 450;
const int GuildTributeEnd = (GuildTributeBegin + invtype::InvTypeGuildTributeSize) - 1;
const int CorpseBegin = invslot::PossessionsGeneral1;
const int CorpseEnd = invslot::PossessionsGeneral1 + invslot::PossessionsCursor;
extern const char* InvPossessionsSlotName(int inv_slot);
extern const char* InvCorpseSlotName(int inv_slot);
extern const char* InvSlotName(int inv_type, int inv_slot);
extern const char* GetInvPossessionsSlotName(int inv_slot);
extern const char* GetInvCorpseSlotName(int inv_slot);
extern const char* GetInvSlotName(int inv_type, int inv_slot);
} /*invslot*/
@@ -244,14 +262,14 @@ namespace SoD
const int TradeBagsSize = invtype::InvTypeTradeSize * ItemBagSize;
const int TradeBagsEnd = (TradeBagsBegin + TradeBagsSize) - 1;
extern const char* InvBagIndexName(int bag_index);
extern const char* GetInvBagIndexName(int bag_index);
} /*invbag*/
namespace invaug {
const size_t ItemAugSize = 5;
extern const char* InvAugIndexName(int aug_index);
extern const char* GetInvAugIndexName(int aug_index);
} /*invaug*/
@@ -261,6 +279,7 @@ namespace SoD
namespace profile {
const size_t TributeSize = invtype::InvTypeTributeSize;
const size_t GuildTributeSize = invtype::InvTypeGuildTributeSize;
const size_t BandoliersSize = 20; // number of bandolier instances
const size_t BandolierItemCount = 4; // number of equipment slots in bandolier instance
@@ -279,13 +298,6 @@ namespace SoD
} /*constants*/
namespace behavior {
const bool ConcatenateInvTypeLimbo = true;
const bool AllowOverLevelEquipment = false;
const bool AllowEmptyBagInBag = false;
const bool AllowClickCastFromBag = false;
const bool CoinHasWeight = false;
} /*behavior*/
+72 -117
View File
@@ -122,7 +122,7 @@ struct AdventureInfo {
** Merth: Gave struct a name so gcc 2.96 would compile
**
*/
struct Color_Struct
struct Tint_Struct
{
union {
struct {
@@ -130,19 +130,62 @@ struct Color_Struct
uint8 Green;
uint8 Red;
uint8 UseTint; // if there's a tint this is FF
} RGB;
};
uint32 Color;
};
};
struct CharSelectEquip
struct TintProfile
{
union {
struct {
Tint_Struct Head;
Tint_Struct Chest;
Tint_Struct Arms;
Tint_Struct Wrist;
Tint_Struct Hands;
Tint_Struct Legs;
Tint_Struct Feet;
Tint_Struct Primary;
Tint_Struct Secondary;
};
Tint_Struct Slot[EQEmu::textures::TextureCount];
};
};
/*
* Visible equiptment.
* Size: 12 Octets
*/
struct Texture_Struct
{
uint32 Material;
uint32 Unknown1;
uint32 EliteMaterial;
Color_Struct Color;
};
struct TextureProfile
{
union {
struct {
Texture_Struct Head;
Texture_Struct Chest;
Texture_Struct Arms;
Texture_Struct Wrist;
Texture_Struct Hands;
Texture_Struct Legs;
Texture_Struct Feet;
Texture_Struct Primary;
Texture_Struct Secondary;
};
Texture_Struct Slot[EQEmu::textures::TextureCount];
};
TextureProfile();
};
struct CharSelectEquip : Texture_Struct, Tint_Struct {};
struct CharacterSelectEntry_Struct
{
/*0000*/ uint8 Level; //
@@ -152,7 +195,7 @@ struct CharacterSelectEntry_Struct
/*0000*/ uint8 Beard; //
/*0001*/ uint8 HairColor; //
/*0000*/ uint8 Face; //
/*0000*/ CharSelectEquip Equip[9];
/*0000*/ CharSelectEquip Equip[EQEmu::textures::TextureCount];
/*0000*/ uint32 PrimaryIDFile; //
/*0000*/ uint32 SecondaryIDFile; //
/*0000*/ uint8 Unknown15; // 0xff
@@ -185,19 +228,6 @@ struct CharacterSelect_Struct
/*0008*/ CharacterSelectEntry_Struct Entries[0];
};
/*
* Visible equiptment.
* Size: 12 Octets
*/
struct EquipStruct
{
/*00*/ uint32 Material;
/*04*/ uint32 Unknown1;
/*08*/ uint32 EliteMaterial;
/*12*/
};
/*
** Generic Spawn Struct
** Length: 897 Octets
@@ -314,40 +344,10 @@ struct Spawn_Struct
/*0000*/ uint32 unknown18;
/*0000*/ uint32 unknown19;
Spawn_Struct_Position Position;
/*0000*/ union
{
struct
{
/*0000*/ Color_Struct color_helmet; // Color of helmet item
/*0000*/ Color_Struct color_chest; // Color of chest item
/*0000*/ Color_Struct color_arms; // Color of arms item
/*0000*/ Color_Struct color_bracers; // Color of bracers item
/*0000*/ Color_Struct color_hands; // Color of hands item
/*0000*/ Color_Struct color_legs; // Color of legs item
/*0000*/ Color_Struct color_feet; // Color of feet item
/*0000*/ Color_Struct color_primary; // Color of primary item
/*0000*/ Color_Struct color_secondary; // Color of secondary item
} equipment_colors;
/*0000*/ Color_Struct colors[9]; // Array elements correspond to struct equipment_colors above
};
/*0000*/ TintProfile equipment_tint;
// skip these bytes if not a valid player race
/*0000*/ union
{
struct
{
/*0000*/ EquipStruct equip_helmet; // Equiptment: Helmet visual
/*0000*/ EquipStruct equip_chest; // Equiptment: Chest visual
/*0000*/ EquipStruct equip_arms; // Equiptment: Arms visual
/*0000*/ EquipStruct equip_bracers; // Equiptment: Wrist visual
/*0000*/ EquipStruct equip_hands; // Equiptment: Hands visual
/*0000*/ EquipStruct equip_legs; // Equiptment: Legs visual
/*0000*/ EquipStruct equip_feet; // Equiptment: Boots visual
/*0000*/ EquipStruct equip_primary; // Equiptment: Main visual
/*0000*/ EquipStruct equip_secondary; // Equiptment: Off visual
} equip;
/*0000*/ EquipStruct equipment[9];
};
/*0000*/ TextureProfile equipment;
/*0000*/ //char title[0]; // only read if(hasTitleOrSuffix & 4)
/*0000*/ //char suffix[0]; // only read if(hasTitleOrSuffix & 8)
@@ -479,7 +479,7 @@ struct MemorizeSpell_Struct {
uint32 slot; // Spot in the spell book/memorized slot
uint32 spell_id; // Spell id (200 or c8 is minor healing, etc)
uint32 scribing; // 1 if memorizing a spell, set to 0 if scribing to book, 2 if un-memming
//uint32 unknown12;
uint32 reduction; // lowers reuse
};
/*
@@ -512,11 +512,12 @@ struct DeleteSpell_Struct
struct ManaChange_Struct
{
uint32 new_mana; // New Mana AMount
uint32 stamina;
uint32 spell_id;
uint32 unknown12;
uint32 unknown16;
/*00*/ uint32 new_mana; // New Mana AMount
/*04*/ uint32 stamina;
/*08*/ uint32 spell_id;
/*12*/ uint8 keepcasting; // won't stop the cast. Change mana while casting?
/*13*/ uint8 padding[3]; // client doesn't read it, garbage data seems like
/*16*/ int32 slot; // -1 for normal usage slot for when we want silent interrupt? I think it does timer stuff or something. Linked Spell Reuse interrupt uses it
};
struct SwapSpell_Struct
@@ -563,32 +564,22 @@ struct SpawnAppearance_Struct
// this is used inside profile
struct SpellBuff_Struct
{
/*000*/ uint8 slotid; //badly named... seems to be 2 for a real buff, 0 otherwise
/*001*/ uint8 level;
/*002*/ uint8 bard_modifier;
/*003*/ uint8 effect; //not real
/*004*/ uint32 spellid;
/*008*/ int32 duration;
/*012*/ uint32 counters;
/*016*/ uint32 unknown004; //Might need to be swapped with player_id
/*020*/ uint32 player_id; //'global' ID of the caster, for wearoff messages
/*000*/ uint8 effect_type; // 0 = no buff, 2 = buff, 4 = inverse affects of buff
/*001*/ uint8 level; // Seen 1 for no buff
/*002*/ uint8 bard_modifier;
/*003*/ uint8 unknown003; // MQ2 used to call this "damage shield" -- don't see client referencing it, so maybe server side DS type tracking?
/*004*/ uint32 spellid;
/*008*/ uint32 duration;
/*012*/ uint32 counters;
/*016*/ uint32 unknown016;
/*020*/ uint32 player_id; // caster ID, pretty sure just zone ID
/*024*/
};
struct SpellBuffFade_Struct {
struct SpellBuffPacket_Struct {
/*000*/ uint32 entityid;
/*004*/ uint8 slot;
/*005*/ uint8 level;
/*006*/ uint8 effect;
/*007*/ uint8 unknown7;
/*008*/ uint32 spellid;
/*012*/ int32 duration;
/*016*/ uint32 unknown016;
/*020*/ uint32 unknown020; //prolly global player ID
/*024*/ uint32 playerId; // Player id who cast the buff
/*004*/ SpellBuff_Struct buff;
/*028*/ uint32 slotid;
/*032*/ uint32 bufffade;
/*036*/
@@ -903,24 +894,9 @@ struct PlayerProfile_Struct
/*00216*/ uint8 hairstyle; // Player hair style
/*00217*/ uint8 beard; // Player beard type
/*00218*/ uint8 unknown00178[14]; //[10]14 on Live? was 10
/*00232*/ union
{
struct
{
/*00228*/ EquipStruct equip_helmet; // Equiptment: Helmet visual
/*00240*/ EquipStruct equip_chest; // Equiptment: Chest visual
/*00252*/ EquipStruct equip_arms; // Equiptment: Arms visual
/*00264*/ EquipStruct equip_bracers; // Equiptment: Wrist visual
/*00276*/ EquipStruct equip_hands; // Equiptment: Hands visual
/*00288*/ EquipStruct equip_legs; // Equiptment: Legs visual
/*00300*/ EquipStruct equip_feet; // Equiptment: Boots visual
/*00312*/ EquipStruct equip_primary; // Equiptment: Main visual
/*00324*/ EquipStruct equip_secondary; // Equiptment: Off visual
} equip;
/*00228*/ EquipStruct equipment[9]; //Live Shows [108] for this part
};
/*00232*/ TextureProfile equipment;
/*00340*/ uint8 unknown00224[156]; // Live Shows [160]
/*00496*/ Color_Struct item_tint[9]; // RR GG BB 00
/*00496*/ TintProfile item_tint; // RR GG BB 00
/*00532*/ AA_Array aa_array[MAX_PP_AA_ARRAY]; // [3600] AAs 12 bytes each
/*04132*/ uint32 points; // Unspent Practice points - RELOCATED???
/*04136*/ uint32 mana; // Current mana
@@ -1177,7 +1153,7 @@ struct WearChange_Struct{
/*002*/ uint32 material;
/*006*/ uint32 unknown06;
/*010*/ uint32 elite_material; // 1 for Drakkin Elite Material
/*014*/ Color_Struct color;
/*014*/ Tint_Struct color;
/*018*/ uint8 wear_slot_id;
/*019*/
};
@@ -1995,7 +1971,7 @@ struct AdventureLeaderboard_Struct
/*struct Item_Shop_Struct {
uint16 merchantid;
uint8 itemtype;
Item_Struct item;
ItemBase item;
uint8 iss_unknown001[6];
};*/
@@ -3091,27 +3067,6 @@ struct PetitionBug_Struct{
char text[1028];
};
struct DyeStruct
{
union
{
struct
{
struct Color_Struct head;
struct Color_Struct chest;
struct Color_Struct arms;
struct Color_Struct wrists;
struct Color_Struct hands;
struct Color_Struct legs;
struct Color_Struct feet;
struct Color_Struct primary; // you can't actually dye this
struct Color_Struct secondary; // or this
}
dyes;
struct Color_Struct dye[9];
};
};
struct ApproveZone_Struct {
char name[64];
uint32 zoneid;
+130 -36
View File
@@ -59,6 +59,9 @@ namespace SoF
// client to server text link converter
static inline void SoFToServerTextLink(std::string& serverTextLink, const std::string& sofTextLink);
static inline CastingSlot ServerToSoFCastingSlot(EQEmu::CastingSlot slot);
static inline EQEmu::CastingSlot SoFToServerCastingSlot(CastingSlot slot, uint32 itemlocation);
void Register(EQStreamIdentifier &into)
{
//create our opcode manager if we havent already
@@ -283,16 +286,17 @@ namespace SoF
ENCODE(OP_Buff)
{
ENCODE_LENGTH_EXACT(SpellBuffFade_Struct);
SETUP_DIRECT_ENCODE(SpellBuffFade_Struct, structs::SpellBuffFade_Struct);
ENCODE_LENGTH_EXACT(SpellBuffPacket_Struct);
SETUP_DIRECT_ENCODE(SpellBuffPacket_Struct, structs::SpellBuffPacket_Struct);
OUT(entityid);
OUT(slot);
OUT(level);
OUT(effect);
//eq->unknown7 = 10;
OUT(spellid);
OUT(duration);
OUT(buff.effect_type);
OUT(buff.level);
OUT(buff.bard_modifier);
OUT(buff.spellid);
OUT(buff.duration);
OUT(buff.counters);
OUT(buff.player_id);
OUT(slotid);
OUT(bufffade);
@@ -932,7 +936,24 @@ namespace SoF
OUT(new_mana);
OUT(stamina);
OUT(spell_id);
eq->unknown16 = -1; // Self Interrupt/Success = -1, Fizzle = 1, Other Interrupt = 2?
OUT(keepcasting);
eq->slot = -1; // this is spell gem slot. It's -1 in normal operation
FINISH_ENCODE();
}
ENCODE(OP_MemorizeSpell)
{
ENCODE_LENGTH_EXACT(MemorizeSpell_Struct);
SETUP_DIRECT_ENCODE(MemorizeSpell_Struct, structs::MemorizeSpell_Struct);
// Since HT/LoH are translated up, we need to translate down only for memSpellSpellbar case
if (emu->scribing == 3)
eq->slot = static_cast<uint32>(ServerToSoFCastingSlot(static_cast<EQEmu::CastingSlot>(emu->slot)));
else
OUT(slot);
OUT(spell_id);
OUT(scribing);
FINISH_ENCODE();
}
@@ -1157,9 +1178,9 @@ namespace SoF
OUT(petid);
OUT(buffcount);
int EQBuffSlot = 0;
int EQBuffSlot = 0; // do we really want to shuffle them around like this?
for (uint32 EmuBuffSlot = 0; EmuBuffSlot < BUFF_COUNT; ++EmuBuffSlot)
for (uint32 EmuBuffSlot = 0; EmuBuffSlot < PET_BUFF_COUNT; ++EmuBuffSlot)
{
if (emu->spellid[EmuBuffSlot])
{
@@ -1209,14 +1230,14 @@ namespace SoF
OUT(hairstyle);
OUT(beard);
// OUT(unknown00178[10]);
for (r = 0; r < 9; r++) {
eq->equipment[r].Material = emu->item_material[r];
eq->equipment[r].Unknown1 = 0;
eq->equipment[r].EliteMaterial = 0;
for (r = EQEmu::textures::TextureBegin; r < EQEmu::textures::TextureCount; r++) {
eq->equipment.Slot[r].Material = emu->item_material.Slot[r].Material;
eq->equipment.Slot[r].Unknown1 = 0;
eq->equipment.Slot[r].EliteMaterial = 0;
//eq->colors[r].color = emu->colors[r].color;
}
for (r = 0; r < 7; r++) {
OUT(item_tint[r].Color);
OUT(item_tint.Slot[r].Color);
}
// OUT(unknown00224[48]);
//NOTE: new client supports 300 AAs, our internal rep/PP
@@ -1258,10 +1279,10 @@ namespace SoF
OUT(thirst_level);
OUT(hunger_level);
for (r = 0; r < structs::BUFF_COUNT; r++) {
OUT(buffs[r].slotid);
OUT(buffs[r].effect_type);
OUT(buffs[r].level);
OUT(buffs[r].bard_modifier);
OUT(buffs[r].effect);
OUT(buffs[r].unknown003);
OUT(buffs[r].spellid);
OUT(buffs[r].duration);
OUT(buffs[r].counters);
@@ -1649,11 +1670,11 @@ namespace SoF
eq_cse->HairColor = emu_cse->HairColor;
eq_cse->Face = emu_cse->Face;
for (int equip_index = 0; equip_index < EQEmu::legacy::MaterialCount; equip_index++) {
for (int equip_index = 0; equip_index < EQEmu::textures::TextureCount; equip_index++) {
eq_cse->Equip[equip_index].Material = emu_cse->Equip[equip_index].Material;
eq_cse->Equip[equip_index].Unknown1 = emu_cse->Equip[equip_index].Unknown1;
eq_cse->Equip[equip_index].EliteMaterial = emu_cse->Equip[equip_index].EliteMaterial;
eq_cse->Equip[equip_index].Color.Color = emu_cse->Equip[equip_index].Color.Color;
eq_cse->Equip[equip_index].Color = emu_cse->Equip[equip_index].Color;
}
eq_cse->PrimaryIDFile = emu_cse->PrimaryIDFile;
@@ -2080,11 +2101,11 @@ namespace SoF
eq->deity = emu->deity;
eq->drakkin_heritage = emu->drakkin_heritage;
eq->gender = emu->gender;
for (k = 0; k < 9; k++) {
eq->equipment[k].Material = emu->equipment[k].Material;
eq->equipment[k].Unknown1 = emu->equipment[k].Unknown1;
eq->equipment[k].EliteMaterial = emu->equipment[k].EliteMaterial;
eq->colors[k].Color = emu->colors[k].Color;
for (k = EQEmu::textures::TextureBegin; k < EQEmu::textures::TextureCount; k++) {
eq->equipment.Slot[k].Material = emu->equipment.Slot[k].Material;
eq->equipment.Slot[k].Unknown1 = emu->equipment.Slot[k].Unknown1;
eq->equipment.Slot[k].EliteMaterial = emu->equipment.Slot[k].EliteMaterial;
eq->equipment_tint.Slot[k].Color = emu->equipment_tint.Slot[k].Color;
}
eq->StandState = emu->StandState;
eq->guildID = emu->guildID;
@@ -2146,8 +2167,8 @@ namespace SoF
strcpy(eq->name, emu->name);
eq->petOwnerId = emu->petOwnerId;
eq->pvp = 0; // 0 = non-pvp colored name, 1 = red pvp name
for (k = 0; k < 9; k++) {
eq->colors[k].Color = emu->colors[k].Color;
for (k = EQEmu::textures::TextureBegin; k < EQEmu::textures::TextureCount; k++) {
eq->equipment_tint.Slot[k].Color = emu->equipment_tint.Slot[k].Color;
}
eq->anon = emu->anon;
eq->face = emu->face;
@@ -2343,15 +2364,17 @@ namespace SoF
DECODE(OP_Buff)
{
DECODE_LENGTH_EXACT(structs::SpellBuffFade_Struct);
SETUP_DIRECT_DECODE(SpellBuffFade_Struct, structs::SpellBuffFade_Struct);
DECODE_LENGTH_EXACT(structs::SpellBuffPacket_Struct);
SETUP_DIRECT_DECODE(SpellBuffPacket_Struct, structs::SpellBuffPacket_Struct);
IN(entityid);
IN(slot);
IN(level);
IN(effect);
IN(spellid);
IN(duration);
IN(buff.effect_type);
IN(buff.level);
IN(buff.bard_modifier);
IN(buff.spellid);
IN(buff.duration);
IN(buff.counters);
IN(buff.player_id);
IN(slotid);
IN(bufffade);
@@ -2363,7 +2386,7 @@ namespace SoF
DECODE_LENGTH_EXACT(structs::CastSpell_Struct);
SETUP_DIRECT_DECODE(CastSpell_Struct, structs::CastSpell_Struct);
IN(slot);
emu->slot = static_cast<uint32>(SoFToServerCastingSlot(static_cast<CastingSlot>(eq->slot), eq->inventoryslot));
IN(spell_id);
emu->inventoryslot = SoFToServerSlot(eq->inventoryslot);
IN(target_id);
@@ -2887,7 +2910,7 @@ namespace SoF
void SerializeItem(EQEmu::OutBuffer& ob, const ItemInst *inst, int16 slot_id_in, uint8 depth)
{
const EQEmu::Item_Struct *item = inst->GetUnscaledItem();
const EQEmu::ItemBase *item = inst->GetUnscaledItem();
SoF::structs::ItemSerializationHeader hdr;
@@ -3352,4 +3375,75 @@ namespace SoF
}
}
static inline CastingSlot ServerToSoFCastingSlot(EQEmu::CastingSlot slot)
{
switch (slot) {
case EQEmu::CastingSlot::Gem1:
return CastingSlot::Gem1;
case EQEmu::CastingSlot::Gem2:
return CastingSlot::Gem2;
case EQEmu::CastingSlot::Gem3:
return CastingSlot::Gem3;
case EQEmu::CastingSlot::Gem4:
return CastingSlot::Gem4;
case EQEmu::CastingSlot::Gem5:
return CastingSlot::Gem5;
case EQEmu::CastingSlot::Gem6:
return CastingSlot::Gem6;
case EQEmu::CastingSlot::Gem7:
return CastingSlot::Gem7;
case EQEmu::CastingSlot::Gem8:
return CastingSlot::Gem8;
case EQEmu::CastingSlot::Gem9:
return CastingSlot::Gem9;
case EQEmu::CastingSlot::Item:
return CastingSlot::Item;
case EQEmu::CastingSlot::PotionBelt:
return CastingSlot::PotionBelt;
case EQEmu::CastingSlot::Discipline:
return CastingSlot::Discipline;
case EQEmu::CastingSlot::AltAbility:
return CastingSlot::AltAbility;
default: // we shouldn't have any issues with other slots ... just return something
return CastingSlot::Discipline;
}
}
static inline EQEmu::CastingSlot SoFToServerCastingSlot(CastingSlot slot, uint32 itemlocation)
{
switch (slot) {
case CastingSlot::Gem1:
return EQEmu::CastingSlot::Gem1;
case CastingSlot::Gem2:
return EQEmu::CastingSlot::Gem2;
case CastingSlot::Gem3:
return EQEmu::CastingSlot::Gem3;
case CastingSlot::Gem4:
return EQEmu::CastingSlot::Gem4;
case CastingSlot::Gem5:
return EQEmu::CastingSlot::Gem5;
case CastingSlot::Gem6:
return EQEmu::CastingSlot::Gem6;
case CastingSlot::Gem7:
return EQEmu::CastingSlot::Gem7;
case CastingSlot::Gem8:
return EQEmu::CastingSlot::Gem8;
case CastingSlot::Gem9:
return EQEmu::CastingSlot::Gem9;
case CastingSlot::Ability:
return EQEmu::CastingSlot::Ability;
// Tit uses 10 for item and discipline casting, but items have a valid location
case CastingSlot::Item:
if (itemlocation == INVALID_INDEX)
return EQEmu::CastingSlot::Discipline;
else
return EQEmu::CastingSlot::Item;
case CastingSlot::PotionBelt:
return EQEmu::CastingSlot::PotionBelt;
case CastingSlot::AltAbility:
return EQEmu::CastingSlot::AltAbility;
default: // we shouldn't have any issues with other slots ... just return something
return EQEmu::CastingSlot::Discipline;
}
}
} /*SoF*/
+17
View File
@@ -50,6 +50,23 @@ namespace SoF
#include "sof_ops.h"
};
enum class CastingSlot : uint32 {
Gem1 = 0,
Gem2 = 1,
Gem3 = 2,
Gem4 = 3,
Gem5 = 4,
Gem6 = 5,
Gem7 = 6,
Gem8 = 7,
Gem9 = 8,
Ability = 9,
Item = 10,
Discipline = 10,
PotionBelt = 11,
AltAbility = 0xFF
};
}; /*SoF*/
#endif /*COMMON_SOF_H*/
+29 -12
View File
@@ -10,7 +10,7 @@
but WITHOUT ANY WARRANTY except by those people which sell it, which
are required to give you total support for your newly bought product;
without even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE. See the GNU General Public License for more details.
A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
@@ -22,7 +22,7 @@
#include "../string_util.h"
size_t SoF::invtype::InvTypeSize(int inv_type)
size_t SoF::invtype::GetInvTypeSize(int inv_type)
{
switch (inv_type) {
case invtype::InvTypePossessions:
@@ -68,7 +68,7 @@ size_t SoF::invtype::InvTypeSize(int inv_type)
}
}
const char* SoF::invtype::InvTypeName(int inv_type)
const char* SoF::invtype::GetInvTypeName(int inv_type)
{
switch (inv_type) {
case invtype::InvTypeInvalid:
@@ -116,7 +116,24 @@ const char* SoF::invtype::InvTypeName(int inv_type)
}
}
const char* SoF::invslot::InvPossessionsSlotName(int inv_slot)
bool SoF::invtype::IsInvTypePersistent(int inv_type)
{
switch (inv_type) {
case invtype::InvTypePossessions:
case invtype::InvTypeBank:
case invtype::InvTypeSharedBank:
case invtype::InvTypeTrade:
case invtype::InvTypeWorld:
case invtype::InvTypeLimbo:
case invtype::InvTypeTribute:
case invtype::InvTypeGuildTribute:
return true;
default:
return false;
}
}
const char* SoF::invslot::GetInvPossessionsSlotName(int inv_slot)
{
switch (inv_slot) {
case invslot::InvSlotInvalid:
@@ -190,9 +207,9 @@ const char* SoF::invslot::InvPossessionsSlotName(int inv_slot)
}
}
const char* SoF::invslot::InvCorpseSlotName(int inv_slot)
const char* SoF::invslot::GetInvCorpseSlotName(int inv_slot)
{
if (!invtype::InvTypeSize(invtype::InvTypeCorpse) || inv_slot == invslot::InvSlotInvalid)
if (!invtype::GetInvTypeSize(invtype::InvTypeCorpse) || inv_slot == invslot::InvSlotInvalid)
return "Invalid Slot";
// needs work
@@ -205,14 +222,14 @@ const char* SoF::invslot::InvCorpseSlotName(int inv_slot)
return ret_str.c_str();
}
const char* SoF::invslot::InvSlotName(int inv_type, int inv_slot)
const char* SoF::invslot::GetInvSlotName(int inv_type, int inv_slot)
{
if (inv_type == invtype::InvTypePossessions)
return invslot::InvPossessionsSlotName(inv_slot);
return invslot::GetInvPossessionsSlotName(inv_slot);
else if (inv_type == invtype::InvTypeCorpse)
return invslot::InvCorpseSlotName(inv_slot);
return invslot::GetInvCorpseSlotName(inv_slot);
size_t type_size = invtype::InvTypeSize(inv_type);
size_t type_size = invtype::GetInvTypeSize(inv_type);
if (!type_size || inv_slot == invslot::InvSlotInvalid)
return "Invalid Slot";
@@ -226,7 +243,7 @@ const char* SoF::invslot::InvSlotName(int inv_type, int inv_slot)
return ret_str.c_str();
}
const char* SoF::invbag::InvBagIndexName(int bag_index)
const char* SoF::invbag::GetInvBagIndexName(int bag_index)
{
if (bag_index == invbag::InvBagInvalid)
return "Invalid Bag";
@@ -240,7 +257,7 @@ const char* SoF::invbag::InvBagIndexName(int bag_index)
return ret_str.c_str();
}
const char* SoF::invaug::InvAugIndexName(int aug_index)
const char* SoF::invaug::GetInvAugIndexName(int aug_index)
{
if (aug_index == invaug::InvAugInvalid)
return "Invalid Augment";
+40 -28
View File
@@ -10,7 +10,7 @@
but WITHOUT ANY WARRANTY except by those people which sell it, which
are required to give you total support for your newly bought product;
without even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE. See the GNU General Public License for more details.
A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
@@ -21,7 +21,7 @@
#define COMMON_SOF_LIMITS_H
#include "../types.h"
#include "../client_version.h"
#include "../emu_versions.h"
#include "../skills.h"
@@ -32,8 +32,13 @@ namespace SoF
enum : bool { False = false, True = true };
// pre-declarations
namespace inventory {
inline EQEmu::versions::ClientVersion GetInventoryRef() { return EQEmu::versions::ClientVersion::SoF; }
} /*inventory*/
namespace invtype {
inline EQEmu::versions::ClientVersion InvTypeRef() { return EQEmu::versions::ClientVersion::SoF; }
inline EQEmu::versions::ClientVersion GetInvTypeRef() { return EQEmu::versions::ClientVersion::SoF; }
enum : int { InvTypeInvalid = -1, InvTypeBegin };
@@ -63,7 +68,7 @@ namespace SoF
} /*invtype*/
namespace invslot {
inline EQEmu::versions::ClientVersion InvSlotRef() { return EQEmu::versions::ClientVersion::SoF; }
inline EQEmu::versions::ClientVersion GetInvSlotRef() { return EQEmu::versions::ClientVersion::SoF; }
enum : int { InvSlotInvalid = -1, InvSlotBegin };
@@ -114,21 +119,21 @@ namespace SoF
} /*invslot*/
namespace invbag {
inline EQEmu::versions::ClientVersion InvBagRef() { return EQEmu::versions::ClientVersion::SoF; }
inline EQEmu::versions::ClientVersion GetInvBagRef() { return EQEmu::versions::ClientVersion::SoF; }
enum : int { InvBagInvalid = -1, InvBagBegin };
} /*invbag*/
namespace invaug {
inline EQEmu::versions::ClientVersion InvAugRef() { return EQEmu::versions::ClientVersion::SoF; }
inline EQEmu::versions::ClientVersion GetInvAugRef() { return EQEmu::versions::ClientVersion::SoF; }
enum : int { InvAugInvalid = -1, InvAugBegin };
} /*invaug*/
namespace item {
inline EQEmu::versions::ClientVersion ItemRef() { return EQEmu::versions::ClientVersion::SoF; }
inline EQEmu::versions::ClientVersion GetItemRef() { return EQEmu::versions::ClientVersion::SoF; }
enum ItemPacketType : int {
ItemPacketMerchant = 100,
@@ -146,27 +151,37 @@ namespace SoF
} /*item*/
namespace profile {
inline EQEmu::versions::ClientVersion ProfileRef() { return EQEmu::versions::ClientVersion::SoF; }
inline EQEmu::versions::ClientVersion GetProfileRef() { return EQEmu::versions::ClientVersion::SoF; }
} /*profile*/
namespace constants {
inline EQEmu::versions::ClientVersion ConstantsRef() { return EQEmu::versions::ClientVersion::SoF; }
inline EQEmu::versions::ClientVersion GetConstantsRef() { return EQEmu::versions::ClientVersion::SoF; }
} /*constants*/
namespace behavior {
inline EQEmu::versions::ClientVersion BehaviorRef() { return EQEmu::versions::ClientVersion::SoF; }
inline EQEmu::versions::ClientVersion GetBehaviorRef() { return EQEmu::versions::ClientVersion::SoF; }
} /*behavior*/
namespace skills {
inline EQEmu::versions::ClientVersion SkillsRef() { return EQEmu::versions::ClientVersion::SoF; }
inline EQEmu::versions::ClientVersion GetSkillsRef() { return EQEmu::versions::ClientVersion::SoF; }
} /*skills*/
// declarations
namespace inventory {
const bool ConcatenateInvTypeLimbo = true;
const bool AllowOverLevelEquipment = false;
const bool AllowEmptyBagInBag = false;
const bool AllowClickCastFromBag = false;
} /*inventory*/
namespace invtype {
const size_t InvTypePossessionsSize = invslot::PossessionsCount;
const size_t InvTypeBankSize = 24;
@@ -175,7 +190,7 @@ namespace SoF
const size_t InvTypeWorldSize = 10;
const size_t InvTypeLimboSize = 36;
const size_t InvTypeTributeSize = 5;
const size_t InvTypeGuildTributeSize = 0;//unknown
const size_t InvTypeGuildTributeSize = 2;
const size_t InvTypeMerchantSize = 80;
const size_t InvTypeCorpseSize = InvTypePossessionsSize;
const size_t InvTypeBazaarSize = 80;
@@ -188,10 +203,10 @@ namespace SoF
const size_t InvTypeArchivedSize = 0;//unknown
const size_t InvTypeOtherSize = 0;//unknown
const size_t NPCTradeSize = 4;
extern size_t GetInvTypeSize(int inv_type);
extern const char* GetInvTypeName(int inv_type);
extern size_t InvTypeSize(int inv_type);
extern const char* InvTypeName(int inv_type);
extern bool IsInvTypePersistent(int inv_type);
} /*invtype*/
@@ -210,14 +225,17 @@ namespace SoF
const int WorldEnd = (WorldBegin + invtype::InvTypeWorldSize) - 1;
const int TributeBegin = 400;
const int TributeEnd = 404;
const int TributeEnd = (TributeBegin + invtype::InvTypeTributeSize) - 1;
const int GuildTributeBegin = 450;
const int GuildTributeEnd = (GuildTributeBegin + invtype::InvTypeGuildTributeSize) - 1;
const int CorpseBegin = PossessionsGeneral1;
const int CorpseEnd = PossessionsGeneral1 + PossessionsCursor;
extern const char* InvPossessionsSlotName(int inv_slot);
extern const char* InvCorpseSlotName(int inv_slot);
extern const char* InvSlotName(int inv_type, int inv_slot);
extern const char* GetInvPossessionsSlotName(int inv_slot);
extern const char* GetInvCorpseSlotName(int inv_slot);
extern const char* GetInvSlotName(int inv_type, int inv_slot);
} /*invslot*/
@@ -244,14 +262,14 @@ namespace SoF
const int TradeBagsSize = invtype::InvTypeTradeSize * ItemBagSize;
const int TradeBagsEnd = (TradeBagsBegin + TradeBagsSize) - 1;
extern const char* InvBagIndexName(int bag_index);
extern const char* GetInvBagIndexName(int bag_index);
} /*invbag*/
namespace invaug {
const size_t ItemAugSize = 5;
extern const char* InvAugIndexName(int aug_index);
extern const char* GetInvAugIndexName(int aug_index);
} /*invaug*/
@@ -261,6 +279,7 @@ namespace SoF
namespace profile {
const size_t TributeSize = invtype::InvTypeTributeSize;
const size_t GuildTributeSize = invtype::InvTypeGuildTributeSize;
const size_t BandoliersSize = 20; // number of bandolier instances
const size_t BandolierItemCount = 4; // number of equipment slots in bandolier instance
@@ -279,13 +298,6 @@ namespace SoF
} /*constants*/
namespace behavior {
const bool ConcatenateInvTypeLimbo = true;
const bool AllowOverLevelEquipment = false;
const bool AllowEmptyBagInBag = false;
const bool AllowClickCastFromBag = false;
const bool CoinHasWeight = true;
} /*behavior*/
+1
View File
@@ -57,6 +57,7 @@ E(OP_LeadershipExpUpdate)
E(OP_LogServer)
E(OP_LootItem)
E(OP_ManaChange)
E(OP_MemorizeSpell)
E(OP_MoveItem)
E(OP_NewSpawn)
E(OP_NewZone)
+72 -116
View File
@@ -122,7 +122,7 @@ struct AdventureInfo {
** Merth: Gave struct a name so gcc 2.96 would compile
**
*/
struct Color_Struct
struct Tint_Struct
{
union {
struct {
@@ -130,19 +130,62 @@ struct Color_Struct
uint8 Green;
uint8 Red;
uint8 UseTint; // if there's a tint this is FF
} RGB;
};
uint32 Color;
};
};
struct CharSelectEquip
struct TintProfile
{
union {
struct {
Tint_Struct Head;
Tint_Struct Chest;
Tint_Struct Arms;
Tint_Struct Wrist;
Tint_Struct Hands;
Tint_Struct Legs;
Tint_Struct Feet;
Tint_Struct Primary;
Tint_Struct Secondary;
};
Tint_Struct Slot[EQEmu::textures::TextureCount];
};
};
/*
* Visible equiptment.
* Size: 12 Octets
*/
struct Texture_Struct
{
uint32 Material;
uint32 Unknown1;
uint32 EliteMaterial;
Color_Struct Color;
};
struct TextureProfile
{
union {
struct {
Texture_Struct Head;
Texture_Struct Chest;
Texture_Struct Arms;
Texture_Struct Wrist;
Texture_Struct Hands;
Texture_Struct Legs;
Texture_Struct Feet;
Texture_Struct Primary;
Texture_Struct Secondary;
};
Texture_Struct Slot[EQEmu::textures::TextureCount];
};
TextureProfile();
};
struct CharSelectEquip : Texture_Struct, Tint_Struct {};
struct CharacterSelectEntry_Struct
{
/*0000*/ uint8 Level; //
@@ -152,7 +195,7 @@ struct CharacterSelectEntry_Struct
/*0000*/ uint8 Beard; //
/*0001*/ uint8 HairColor; //
/*0000*/ uint8 Face; //
/*0000*/ CharSelectEquip Equip[9];
/*0000*/ CharSelectEquip Equip[EQEmu::textures::TextureCount];
/*0000*/ uint32 PrimaryIDFile; //
/*0000*/ uint32 SecondaryIDFile; //
/*0000*/ uint8 Unknown15; // 0xff
@@ -183,19 +226,6 @@ struct CharacterSelect_Struct
/*0008*/ CharacterSelectEntry_Struct Entries[0];
};
/*
* Visible equiptment.
* Size: 12 Octets
*/
struct EquipStruct
{
/*00*/ uint32 Material;
/*04*/ uint32 Unknown1;
/*08*/ uint32 EliteMaterial;
/*12*/
};
/*
** Generic Spawn Struct
** Length: 897 Octets
@@ -222,22 +252,7 @@ struct Spawn_Struct {
/*0018*/ uint8 unknown0018[4]; //
/*0022*/ uint8 gender; // Gender (0=male, 1=female, 2=monster)
/*0023*/ uint8 unknown0023[4]; //
/*0027*/ union
{
struct
{
/*0027*/ EquipStruct equip_helmet; // Equiptment: Helmet visual
/*0039*/ EquipStruct equip_chest; // Equiptment: Chest visual
/*0051*/ EquipStruct equip_arms; // Equiptment: Arms visual
/*0063*/ EquipStruct equip_bracers; // Equiptment: Wrist visual
/*0075*/ EquipStruct equip_hands; // Equiptment: Hands visual
/*0087*/ EquipStruct equip_legs; // Equiptment: Legs visual
/*0099*/ EquipStruct equip_feet; // Equiptment: Boots visual
/*0111*/ EquipStruct equip_primary; // Equiptment: Main visual
/*0123*/ EquipStruct equip_secondary; // Equiptment: Off visual
} equip;
/*0027*/ EquipStruct equipment[9];
};
/*0027*/ TextureProfile equipment;
/*0135*/ uint8 StandState; // Seems to be required to be set to 0x64 for normal animation.
/*0136*/ uint8 unknown0136;
@@ -314,22 +329,7 @@ union
/*0775*/ char name[64]; // Player's Name
/*0839*/ uint32 petOwnerId; // If this is a pet, the spawn id of owner
/*0843*/ uint8 pvp; // 0 = normal name color, 2 = PVP name color
/*0844*/ union
{
struct
{
/*0844*/ Color_Struct color_helmet; // Color of helmet item
/*0848*/ Color_Struct color_chest; // Color of chest item
/*0852*/ Color_Struct color_arms; // Color of arms item
/*0856*/ Color_Struct color_bracers; // Color of bracers item
/*0860*/ Color_Struct color_hands; // Color of hands item
/*0864*/ Color_Struct color_legs; // Color of legs item
/*0868*/ Color_Struct color_feet; // Color of feet item
/*0872*/ Color_Struct color_primary; // Color of primary item
/*0876*/ Color_Struct color_secondary; // Color of secondary item
} equipment_colors;
/*0844*/ Color_Struct colors[9]; // Array elements correspond to struct equipment_colors above
};
/*0844*/ TintProfile equipment_tint;
/*0880*/ uint8 anon; // 0=normal, 1=anon, 2=roleplay
/*0881*/ uint8 face;
/*0882*/ uint8 drakkin_details; // Face Details (Spikes) on Drakkin 0 - 7
@@ -458,7 +458,7 @@ struct MemorizeSpell_Struct {
uint32 slot; // Spot in the spell book/memorized slot
uint32 spell_id; // Spell id (200 or c8 is minor healing, etc)
uint32 scribing; // 1 if memorizing a spell, set to 0 if scribing to book, 2 if un-memming
//uint32 unknown12;
uint32 reduction; // lowers reuse
};
/*
@@ -491,11 +491,12 @@ struct DeleteSpell_Struct
struct ManaChange_Struct
{
uint32 new_mana; // New Mana AMount
uint32 stamina;
uint32 spell_id;
uint32 unknown12;
uint32 unknown16;
/*00*/ uint32 new_mana; // New Mana AMount
/*04*/ uint32 stamina;
/*08*/ uint32 spell_id;
/*12*/ uint8 keepcasting; // won't stop the cast. Change mana while casting?
/*13*/ uint8 padding[3]; // client doesn't read it, garbage data seems like
/*16*/ int32 slot; // -1 for normal usage slot for when we want silent interrupt? I think it does timer stuff or something. Linked Spell Reuse interrupt uses it
};
struct SwapSpell_Struct
@@ -542,32 +543,23 @@ struct SpawnAppearance_Struct
// this is used inside profile
struct SpellBuff_Struct
{
/*000*/ uint8 slotid; //badly named... seems to be 2 for a real buff, 0 otherwise
/*001*/ uint8 level;
/*002*/ uint8 bard_modifier;
/*003*/ uint8 effect; //not real
/*004*/ uint32 spellid;
/*008*/ int32 duration;
/*012*/ uint32 counters;
/*016*/ uint32 unknown004; //Might need to be swapped with player_id
/*020*/ uint32 player_id; //'global' ID of the caster, for wearoff messages
/*000*/ uint8 effect_type; // 0 = no buff, 2 = buff, 4 = inverse affects of buff
/*001*/ uint8 level; // Seen 1 for no buff
/*002*/ uint8 bard_modifier;
/*003*/ uint8 unknown003; // MQ2 used to call this "damage shield" -- don't see client referencing it, so maybe server side DS type tracking?
/*004*/ uint32 spellid;
/*008*/ uint32 duration;
/*012*/ uint32 counters;
/*016*/ uint32 unknown016;
/*020*/ uint32 player_id; // caster ID, pretty sure just zone ID
/*024*/
};
struct SpellBuffFade_Struct {
struct SpellBuffPacket_Struct {
/*000*/ uint32 entityid;
/*004*/ uint8 slot;
/*005*/ uint8 level;
/*006*/ uint8 effect;
/*007*/ uint8 unknown7;
/*008*/ uint32 spellid;
/*012*/ int32 duration;
/*016*/ uint32 unknown016;
/*020*/ uint32 unknown020; //prolly global player ID
/*024*/ uint32 playerId; // Player id who cast the buff
/*004*/ SpellBuff_Struct buff;
/*028*/ uint32 slotid;
/*032*/ uint32 bufffade;
/*036*/
@@ -882,24 +874,9 @@ struct PlayerProfile_Struct //23576 Octets
/*00216*/ uint8 hairstyle; // Player hair style
/*00217*/ uint8 beard; // Player beard type
/*00218*/ uint8 unknown00178[10]; //[10]14 on Live?
/*00228*/ union
{
struct
{
/*00228*/ EquipStruct equip_helmet; // Equiptment: Helmet visual
/*00240*/ EquipStruct equip_chest; // Equiptment: Chest visual
/*00252*/ EquipStruct equip_arms; // Equiptment: Arms visual
/*00264*/ EquipStruct equip_bracers; // Equiptment: Wrist visual
/*00276*/ EquipStruct equip_hands; // Equiptment: Hands visual
/*00288*/ EquipStruct equip_legs; // Equiptment: Legs visual
/*00300*/ EquipStruct equip_feet; // Equiptment: Boots visual
/*00312*/ EquipStruct equip_primary; // Equiptment: Main visual
/*00324*/ EquipStruct equip_secondary; // Equiptment: Off visual
} equip;
/*00228*/ EquipStruct equipment[9]; //Live Shows [108] for this part
};
/*00228*/ TextureProfile equipment;
/*00336*/ uint8 unknown00224[156]; // Live Shows [160]
/*00496*/ Color_Struct item_tint[9]; // RR GG BB 00
/*00496*/ TintProfile item_tint; // RR GG BB 00
/*00544*/ AA_Array aa_array[MAX_PP_AA_ARRAY]; // [3600] AAs 12 bytes each
/*04132*/ uint32 points; // Unspent Practice points - RELOCATED???
/*04136*/ uint32 mana; // Current mana
@@ -1155,7 +1132,7 @@ struct WearChange_Struct{
/*002*/ uint32 material;
/*006*/ uint32 unknown06;
/*010*/ uint32 elite_material; // 1 for Drakkin Elite Material
/*014*/ Color_Struct color;
/*014*/ Tint_Struct color;
/*018*/ uint8 wear_slot_id;
/*019*/
};
@@ -2954,27 +2931,6 @@ struct PetitionBug_Struct{
char text[1028];
};
struct DyeStruct
{
union
{
struct
{
struct Color_Struct head;
struct Color_Struct chest;
struct Color_Struct arms;
struct Color_Struct wrists;
struct Color_Struct hands;
struct Color_Struct legs;
struct Color_Struct feet;
struct Color_Struct primary; // you can't actually dye this
struct Color_Struct secondary; // or this
}
dyes;
struct Color_Struct dye[9];
};
};
struct ApproveZone_Struct {
char name[64];
uint32 zoneid;
+148 -20
View File
@@ -58,6 +58,9 @@ namespace Titanium
// client to server text link converter
static inline void TitaniumToServerTextLink(std::string& serverTextLink, const std::string& titaniumTextLink);
static inline CastingSlot ServerToTitaniumCastingSlot(EQEmu::CastingSlot slot);
static inline EQEmu::CastingSlot TitaniumToServerCastingSlot(CastingSlot slot, uint32 itemlocation);
void Register(EQStreamIdentifier &into)
{
auto Config = EQEmuConfig::get();
@@ -254,6 +257,25 @@ namespace Titanium
FINISH_ENCODE();
}
ENCODE(OP_Buff)
{
ENCODE_LENGTH_EXACT(SpellBuffPacket_Struct);
SETUP_DIRECT_ENCODE(SpellBuffPacket_Struct, structs::SpellBuffPacket_Struct);
OUT(entityid);
OUT(buff.effect_type);
OUT(buff.level);
OUT(buff.bard_modifier);
OUT(buff.spellid);
OUT(buff.duration);
OUT(buff.counters);
OUT(buff.player_id);
OUT(slotid);
OUT(bufffade);
FINISH_ENCODE();
}
ENCODE(OP_ChannelMessage)
{
EQApplicationPacket *in = *p;
@@ -814,6 +836,22 @@ namespace Titanium
FINISH_ENCODE();
}
ENCODE(OP_MemorizeSpell)
{
ENCODE_LENGTH_EXACT(MemorizeSpell_Struct);
SETUP_DIRECT_ENCODE(MemorizeSpell_Struct, structs::MemorizeSpell_Struct);
// Since HT/LoH are translated up, we need to translate down only for memSpellSpellbar case
if (emu->scribing == 3)
eq->slot = static_cast<uint32>(ServerToTitaniumCastingSlot(static_cast<EQEmu::CastingSlot>(emu->slot)));
else
OUT(slot);
OUT(spell_id);
OUT(scribing);
FINISH_ENCODE();
}
ENCODE(OP_MoveItem)
{
ENCODE_LENGTH_EXACT(MoveItem_Struct);
@@ -853,9 +891,9 @@ namespace Titanium
OUT(petid);
OUT(buffcount);
int EQBuffSlot = 0;
int EQBuffSlot = 0; // do we really want to shuffle them around like this?
for (uint32 EmuBuffSlot = 0; EmuBuffSlot < BUFF_COUNT; ++EmuBuffSlot)
for (uint32 EmuBuffSlot = 0; EmuBuffSlot < PET_BUFF_COUNT; ++EmuBuffSlot)
{
if (emu->spellid[EmuBuffSlot])
{
@@ -903,9 +941,9 @@ namespace Titanium
OUT(hairstyle);
OUT(beard);
// OUT(unknown00178[10]);
for (r = 0; r < 9; r++) {
OUT(item_material[r]);
OUT(item_tint[r].Color);
for (r = EQEmu::textures::TextureBegin; r < EQEmu::textures::TextureCount; r++) {
OUT(item_material.Slot[r].Material);
OUT(item_tint.Slot[r].Color);
}
// OUT(unknown00224[48]);
for (r = 0; r < structs::MAX_PP_AA_ARRAY; r++) {
@@ -945,10 +983,10 @@ namespace Titanium
OUT(thirst_level);
OUT(hunger_level);
for (r = 0; r < structs::BUFF_COUNT; r++) {
OUT(buffs[r].slotid);
OUT(buffs[r].effect_type);
OUT(buffs[r].level);
OUT(buffs[r].bard_modifier);
OUT(buffs[r].effect);
OUT(buffs[r].unknown003);
OUT(buffs[r].spellid);
OUT(buffs[r].duration);
OUT(buffs[r].counters);
@@ -1223,15 +1261,15 @@ namespace Titanium
if (eq->Race[char_index] > 473)
eq->Race[char_index] = 1;
for (int index = 0; index < EQEmu::legacy::MaterialCount; ++index) {
eq->CS_Colors[char_index][index].Color = emu_cse->Equip[index].Color.Color;
for (int index = 0; index < EQEmu::textures::TextureCount; ++index) {
eq->CS_Colors[char_index].Slot[index].Color = emu_cse->Equip[index].Color;
}
eq->BeardColor[char_index] = emu_cse->BeardColor;
eq->HairStyle[char_index] = emu_cse->HairStyle;
for (int index = 0; index < EQEmu::legacy::MaterialCount; ++index) {
eq->Equip[char_index][index] = emu_cse->Equip[index].Material;
for (int index = 0; index < EQEmu::textures::TextureCount; ++index) {
eq->Equip[char_index].Slot[index].Material = emu_cse->Equip[index].Material;
}
eq->SecondaryIDFile[char_index] = emu_cse->SecondaryIDFile;
@@ -1260,15 +1298,15 @@ namespace Titanium
for (; char_index < 10; ++char_index) {
eq->Race[char_index] = 0;
for (int index = 0; index < EQEmu::legacy::MaterialCount; ++index) {
eq->CS_Colors[char_index][index].Color = 0;
for (int index = 0; index < EQEmu::textures::TextureCount; ++index) {
eq->CS_Colors[char_index].Slot[index].Color = 0;
}
eq->BeardColor[char_index] = 0;
eq->HairStyle[char_index] = 0;
for (int index = 0; index < EQEmu::legacy::MaterialCount; ++index) {
eq->Equip[char_index][index] = 0;
for (int index = 0; index < EQEmu::textures::TextureCount; ++index) {
eq->Equip[char_index].Slot[index].Material = 0;
}
eq->SecondaryIDFile[char_index] = 0;
@@ -1599,9 +1637,9 @@ namespace Titanium
eq->petOwnerId = emu->petOwnerId;
eq->guildrank = emu->guildrank;
// eq->unknown0194[3] = emu->unknown0194[3];
for (k = 0; k < 9; k++) {
eq->equipment[k] = emu->equipment[k].Material;
eq->colors[k].Color = emu->colors[k].Color;
for (k = EQEmu::textures::TextureBegin; k < EQEmu::textures::TextureCount; k++) {
eq->equipment.Slot[k].Material = emu->equipment.Slot[k].Material;
eq->equipment_tint.Slot[k].Color = emu->equipment_tint.Slot[k].Color;
}
for (k = 0; k < 8; k++) {
eq->set_to_0xFF[k] = 0xFF;
@@ -1688,12 +1726,31 @@ namespace Titanium
FINISH_DIRECT_DECODE();
}
DECODE(OP_Buff)
{
DECODE_LENGTH_EXACT(structs::SpellBuffPacket_Struct);
SETUP_DIRECT_DECODE(SpellBuffPacket_Struct, structs::SpellBuffPacket_Struct);
IN(entityid);
IN(buff.effect_type);
IN(buff.level);
IN(buff.bard_modifier);
IN(buff.spellid);
IN(buff.duration);
IN(buff.counters);
IN(buff.player_id);
IN(slotid);
IN(bufffade);
FINISH_DIRECT_DECODE();
}
DECODE(OP_CastSpell)
{
DECODE_LENGTH_EXACT(structs::CastSpell_Struct);
SETUP_DIRECT_DECODE(CastSpell_Struct, structs::CastSpell_Struct);
IN(slot);
emu->slot = static_cast<uint32>(TitaniumToServerCastingSlot(static_cast<CastingSlot>(eq->slot), eq->inventoryslot));
IN(spell_id);
emu->inventoryslot = TitaniumToServerSlot(eq->inventoryslot);
IN(target_id);
@@ -2107,7 +2164,7 @@ namespace Titanium
void SerializeItem(EQEmu::OutBuffer& ob, const ItemInst *inst, int16 slot_id_in, uint8 depth)
{
const char* protection = "\\\\\\\\\\";
const EQEmu::Item_Struct* item = inst->GetUnscaledItem();
const EQEmu::ItemBase* item = inst->GetUnscaledItem();
ob << StringFormat("%.*s%s", (depth ? (depth - 1) : 0), protection, (depth ? "\"" : "")); // For leading quotes (and protection) if a subitem;
@@ -2449,4 +2506,75 @@ namespace Titanium
}
}
static inline CastingSlot ServerToTitaniumCastingSlot(EQEmu::CastingSlot slot)
{
switch (slot) {
case EQEmu::CastingSlot::Gem1:
return CastingSlot::Gem1;
case EQEmu::CastingSlot::Gem2:
return CastingSlot::Gem2;
case EQEmu::CastingSlot::Gem3:
return CastingSlot::Gem3;
case EQEmu::CastingSlot::Gem4:
return CastingSlot::Gem4;
case EQEmu::CastingSlot::Gem5:
return CastingSlot::Gem5;
case EQEmu::CastingSlot::Gem6:
return CastingSlot::Gem6;
case EQEmu::CastingSlot::Gem7:
return CastingSlot::Gem7;
case EQEmu::CastingSlot::Gem8:
return CastingSlot::Gem8;
case EQEmu::CastingSlot::Gem9:
return CastingSlot::Gem9;
case EQEmu::CastingSlot::Item:
return CastingSlot::Item;
case EQEmu::CastingSlot::PotionBelt:
return CastingSlot::PotionBelt;
case EQEmu::CastingSlot::Discipline:
return CastingSlot::Discipline;
case EQEmu::CastingSlot::AltAbility:
return CastingSlot::AltAbility;
default: // we shouldn't have any issues with other slots ... just return something
return CastingSlot::Discipline;
}
}
static inline EQEmu::CastingSlot TitaniumToServerCastingSlot(CastingSlot slot, uint32 itemlocation)
{
switch (slot) {
case CastingSlot::Gem1:
return EQEmu::CastingSlot::Gem1;
case CastingSlot::Gem2:
return EQEmu::CastingSlot::Gem2;
case CastingSlot::Gem3:
return EQEmu::CastingSlot::Gem3;
case CastingSlot::Gem4:
return EQEmu::CastingSlot::Gem4;
case CastingSlot::Gem5:
return EQEmu::CastingSlot::Gem5;
case CastingSlot::Gem6:
return EQEmu::CastingSlot::Gem6;
case CastingSlot::Gem7:
return EQEmu::CastingSlot::Gem7;
case CastingSlot::Gem8:
return EQEmu::CastingSlot::Gem8;
case CastingSlot::Gem9:
return EQEmu::CastingSlot::Gem9;
case CastingSlot::Ability:
return EQEmu::CastingSlot::Ability;
// Tit uses 10 for item and discipline casting, but items have a valid location
case CastingSlot::Item:
if (itemlocation == INVALID_INDEX)
return EQEmu::CastingSlot::Discipline;
else
return EQEmu::CastingSlot::Item;
case CastingSlot::PotionBelt:
return EQEmu::CastingSlot::PotionBelt;
case CastingSlot::AltAbility:
return EQEmu::CastingSlot::AltAbility;
default: // we shouldn't have any issues with other slots ... just return something
return EQEmu::CastingSlot::Discipline;
}
}
} /*Titanium*/
+17
View File
@@ -50,6 +50,23 @@ namespace Titanium
#include "titanium_ops.h"
};
enum class CastingSlot : uint32 {
Gem1 = 0,
Gem2 = 1,
Gem3 = 2,
Gem4 = 3,
Gem5 = 4,
Gem6 = 5,
Gem7 = 6,
Gem8 = 7,
Gem9 = 8,
Ability = 9,
Item = 10,
Discipline = 10,
PotionBelt = 11,
AltAbility = 0xFF
};
}; /*Titanium*/
#endif /*COMMON_TITANIUM_H*/
+29 -12
View File
@@ -10,7 +10,7 @@
but WITHOUT ANY WARRANTY except by those people which sell it, which
are required to give you total support for your newly bought product;
without even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE. See the GNU General Public License for more details.
A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
@@ -22,7 +22,7 @@
#include "../string_util.h"
size_t Titanium::invtype::InvTypeSize(int inv_type)
size_t Titanium::invtype::GetInvTypeSize(int inv_type)
{
switch (inv_type) {
case invtype::InvTypePossessions:
@@ -68,7 +68,7 @@ size_t Titanium::invtype::InvTypeSize(int inv_type)
}
}
const char* Titanium::invtype::InvTypeName(int inv_type)
const char* Titanium::invtype::GetInvTypeName(int inv_type)
{
switch (inv_type) {
case invtype::InvTypeInvalid:
@@ -116,7 +116,24 @@ const char* Titanium::invtype::InvTypeName(int inv_type)
}
}
const char* Titanium::invslot::InvPossessionsSlotName(int inv_slot)
bool Titanium::invtype::IsInvTypePersistent(int inv_type)
{
switch (inv_type) {
case invtype::InvTypePossessions:
case invtype::InvTypeBank:
case invtype::InvTypeSharedBank:
case invtype::InvTypeTrade:
case invtype::InvTypeWorld:
case invtype::InvTypeLimbo:
case invtype::InvTypeTribute:
case invtype::InvTypeGuildTribute:
return true;
default:
return false;
}
}
const char* Titanium::invslot::GetInvPossessionsSlotName(int inv_slot)
{
switch (inv_slot) {
case invslot::InvSlotInvalid:
@@ -188,9 +205,9 @@ const char* Titanium::invslot::InvPossessionsSlotName(int inv_slot)
}
}
const char* Titanium::invslot::InvCorpseSlotName(int inv_slot)
const char* Titanium::invslot::GetInvCorpseSlotName(int inv_slot)
{
if (!invtype::InvTypeSize(invtype::InvTypeCorpse) || inv_slot == invslot::InvSlotInvalid)
if (!invtype::GetInvTypeSize(invtype::InvTypeCorpse) || inv_slot == invslot::InvSlotInvalid)
return "Invalid Slot";
// needs work
@@ -203,14 +220,14 @@ const char* Titanium::invslot::InvCorpseSlotName(int inv_slot)
return ret_str.c_str();
}
const char* Titanium::invslot::InvSlotName(int inv_type, int inv_slot)
const char* Titanium::invslot::GetInvSlotName(int inv_type, int inv_slot)
{
if (inv_type == invtype::InvTypePossessions)
return invslot::InvPossessionsSlotName(inv_slot);
return invslot::GetInvPossessionsSlotName(inv_slot);
else if (inv_type == invtype::InvTypeCorpse)
return invslot::InvCorpseSlotName(inv_slot);
return invslot::GetInvCorpseSlotName(inv_slot);
size_t type_size = invtype::InvTypeSize(inv_type);
size_t type_size = invtype::GetInvTypeSize(inv_type);
if (!type_size || inv_slot == invslot::InvSlotInvalid)
return "Invalid Slot";
@@ -224,7 +241,7 @@ const char* Titanium::invslot::InvSlotName(int inv_type, int inv_slot)
return ret_str.c_str();
}
const char* Titanium::invbag::InvBagIndexName(int bag_index)
const char* Titanium::invbag::GetInvBagIndexName(int bag_index)
{
if (bag_index == invbag::InvBagInvalid)
return "Invalid Bag";
@@ -238,7 +255,7 @@ const char* Titanium::invbag::InvBagIndexName(int bag_index)
return ret_str.c_str();
}
const char* Titanium::invaug::InvAugIndexName(int aug_index)
const char* Titanium::invaug::GetInvAugIndexName(int aug_index)
{
if (aug_index == invaug::InvAugInvalid)
return "Invalid Augment";
+40 -28
View File
@@ -10,7 +10,7 @@
but WITHOUT ANY WARRANTY except by those people which sell it, which
are required to give you total support for your newly bought product;
without even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE. See the GNU General Public License for more details.
A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
@@ -21,7 +21,7 @@
#define COMMON_TITANIUM_LIMITS_H
#include "../types.h"
#include "../client_version.h"
#include "../emu_versions.h"
#include "../skills.h"
@@ -32,8 +32,13 @@ namespace Titanium
enum : bool { False = false, True = true };
// pre-declarations
namespace inventory {
inline EQEmu::versions::ClientVersion GetInventoryRef() { return EQEmu::versions::ClientVersion::Titanium; }
} /*inventory*/
namespace invtype {
inline EQEmu::versions::ClientVersion InvTypeRef() { return EQEmu::versions::ClientVersion::Titanium; }
inline EQEmu::versions::ClientVersion GetInvTypeRef() { return EQEmu::versions::ClientVersion::Titanium; }
enum : int { InvTypeInvalid = -1, InvTypeBegin };
@@ -63,7 +68,7 @@ namespace Titanium
} /*invtype*/
namespace invslot {
inline EQEmu::versions::ClientVersion InvSlotRef() { return EQEmu::versions::ClientVersion::Titanium; }
inline EQEmu::versions::ClientVersion GetInvSlotRef() { return EQEmu::versions::ClientVersion::Titanium; }
enum : int { InvSlotInvalid = -1, InvSlotBegin };
@@ -113,21 +118,21 @@ namespace Titanium
} /*invslot*/
namespace invbag {
inline EQEmu::versions::ClientVersion InvBagRef() { return EQEmu::versions::ClientVersion::Titanium; }
inline EQEmu::versions::ClientVersion GetInvBagRef() { return EQEmu::versions::ClientVersion::Titanium; }
enum : int { InvBagInvalid = -1, InvBagBegin };
} /*invbag*/
namespace invaug {
inline EQEmu::versions::ClientVersion InvAugRef() { return EQEmu::versions::ClientVersion::Titanium; }
inline EQEmu::versions::ClientVersion GetInvAugRef() { return EQEmu::versions::ClientVersion::Titanium; }
enum : int { InvAugInvalid = -1, InvAugBegin };
} /*invaug*/
namespace item {
inline EQEmu::versions::ClientVersion ItemRef() { return EQEmu::versions::ClientVersion::Titanium; }
inline EQEmu::versions::ClientVersion GetItemRef() { return EQEmu::versions::ClientVersion::Titanium; }
enum ItemPacketType : int {
ItemPacketMerchant = 100,
@@ -145,27 +150,37 @@ namespace Titanium
} /*item*/
namespace profile {
inline EQEmu::versions::ClientVersion ProfileRef() { return EQEmu::versions::ClientVersion::Titanium; }
inline EQEmu::versions::ClientVersion GetProfileRef() { return EQEmu::versions::ClientVersion::Titanium; }
} /*profile*/
namespace constants {
inline EQEmu::versions::ClientVersion ConstantsRef() { return EQEmu::versions::ClientVersion::Titanium; }
inline EQEmu::versions::ClientVersion GetConstantsRef() { return EQEmu::versions::ClientVersion::Titanium; }
} /*constants*/
namespace behavior {
inline EQEmu::versions::ClientVersion BehaviorRef() { return EQEmu::versions::ClientVersion::Titanium; }
inline EQEmu::versions::ClientVersion GetBehaviorRef() { return EQEmu::versions::ClientVersion::Titanium; }
} /*behavior*/
namespace skills {
inline EQEmu::versions::ClientVersion SkillsRef() { return EQEmu::versions::ClientVersion::Titanium; }
inline EQEmu::versions::ClientVersion GetSkillsRef() { return EQEmu::versions::ClientVersion::Titanium; }
} /*skills*/
// declarations
namespace inventory {
const bool ConcatenateInvTypeLimbo = true;
const bool AllowOverLevelEquipment = false;
const bool AllowEmptyBagInBag = false;
const bool AllowClickCastFromBag = false;
} /*inventory*/
namespace invtype {
const size_t InvTypePossessionsSize = invslot::PossessionsCount;
const size_t InvTypeBankSize = 16;
@@ -174,7 +189,7 @@ namespace Titanium
const size_t InvTypeWorldSize = 10;
const size_t InvTypeLimboSize = 36;
const size_t InvTypeTributeSize = 5;
const size_t InvTypeGuildTributeSize = 0;//unknown
const size_t InvTypeGuildTributeSize = 2;
const size_t InvTypeMerchantSize = 80;
const size_t InvTypeCorpseSize = InvTypePossessionsSize;
const size_t InvTypeBazaarSize = 80;
@@ -187,10 +202,10 @@ namespace Titanium
const size_t InvTypeArchivedSize = 0;//unknown
const size_t InvTypeOtherSize = 0;//unknown
const size_t NPCTradeSize = 4;
extern size_t GetInvTypeSize(int inv_type);
extern const char* GetInvTypeName(int inv_type);
extern size_t InvTypeSize(int inv_type);
extern const char* InvTypeName(int inv_type);
extern bool IsInvTypePersistent(int inv_type);
} /*invtype*/
@@ -209,14 +224,17 @@ namespace Titanium
const int WorldEnd = (WorldBegin + invtype::InvTypeWorldSize) - 1;
const int TributeBegin = 400;
const int TributeEnd = 404;
const int TributeEnd = (TributeBegin + invtype::InvTypeTributeSize) - 1;
const int GuildTributeBegin = 450;
const int GuildTributeEnd = (GuildTributeBegin + invtype::InvTypeGuildTributeSize) - 1;
const int CorpseBegin = PossessionsGeneral1;
const int CorpseEnd = PossessionsGeneral1 + PossessionsCursor;
extern const char* InvPossessionsSlotName(int inv_slot);
extern const char* InvCorpseSlotName(int inv_slot);
extern const char* InvSlotName(int inv_type, int inv_slot);
extern const char* GetInvPossessionsSlotName(int inv_slot);
extern const char* GetInvCorpseSlotName(int inv_slot);
extern const char* GetInvSlotName(int inv_type, int inv_slot);
} /*invslot*/
@@ -243,14 +261,14 @@ namespace Titanium
const int TradeBagsSize = invtype::InvTypeTradeSize * ItemBagSize;
const int TradeBagsEnd = (TradeBagsBegin + TradeBagsSize) - 1;
extern const char* InvBagIndexName(int bag_index);
extern const char* GetInvBagIndexName(int bag_index);
} /*invbag*/
namespace invaug {
const size_t ItemAugSize = 5;
extern const char* InvAugIndexName(int aug_index);
extern const char* GetInvAugIndexName(int aug_index);
} /*invaug*/
@@ -260,6 +278,7 @@ namespace Titanium
namespace profile {
const size_t TributeSize = invtype::InvTypeTributeSize;
const size_t GuildTributeSize = invtype::InvTypeGuildTributeSize;
const size_t BandoliersSize = 4; // number of bandolier instances
const size_t BandolierItemCount = 4; // number of equipment slots in bandolier instance
@@ -278,13 +297,6 @@ namespace Titanium
} /*constants*/
namespace behavior {
const bool ConcatenateInvTypeLimbo = true;
const bool AllowOverLevelEquipment = false;
const bool AllowEmptyBagInBag = false;
const bool AllowClickCastFromBag = false;
const bool CoinHasWeight = true;
} /*behavior*/
+3
View File
@@ -24,6 +24,7 @@ E(OP_AdventureMerchantSell)
E(OP_ApplyPoison)
E(OP_BazaarSearch)
E(OP_BecomeTrader)
E(OP_Buff)
E(OP_ChannelMessage)
E(OP_CharInventory)
E(OP_Damage)
@@ -49,6 +50,7 @@ E(OP_ItemPacket)
E(OP_LeadershipExpUpdate)
E(OP_LFGuild)
E(OP_LootItem)
E(OP_MemorizeSpell)
E(OP_MoveItem)
E(OP_OnLevelMessage)
E(OP_PetBuffWindow)
@@ -74,6 +76,7 @@ E(OP_ZoneSpawns)
D(OP_AdventureMerchantSell)
D(OP_ApplyPoison)
D(OP_AugmentItem)
D(OP_Buff)
D(OP_CastSpell)
D(OP_ChannelMessage)
D(OP_CharacterCreate)
+63 -79
View File
@@ -118,7 +118,7 @@ struct AdventureInfo {
** Merth: Gave struct a name so gcc 2.96 would compile
**
*/
struct Color_Struct
struct Tint_Struct
{
union {
struct {
@@ -126,11 +126,53 @@ struct Color_Struct
uint8 Green;
uint8 Red;
uint8 UseTint; // if there's a tint this is FF
} RGB;
};
uint32 Color;
};
};
struct TintProfile {
union {
struct {
Tint_Struct Head;
Tint_Struct Chest;
Tint_Struct Arms;
Tint_Struct Wrist;
Tint_Struct Hands;
Tint_Struct Legs;
Tint_Struct Feet;
Tint_Struct Primary;
Tint_Struct Secondary;
};
Tint_Struct Slot[EQEmu::textures::TextureCount];
};
};
struct Texture_Struct
{
uint32 Material;
};
struct TextureProfile
{
union {
struct {
Texture_Struct Head;
Texture_Struct Chest;
Texture_Struct Arms;
Texture_Struct Wrist;
Texture_Struct Hands;
Texture_Struct Legs;
Texture_Struct Feet;
Texture_Struct Primary;
Texture_Struct Secondary;
};
Texture_Struct Slot[EQEmu::textures::TextureCount];
};
TextureProfile();
};
/*
** Character Selection Struct
** Length: 1704 Bytes
@@ -139,10 +181,10 @@ struct Color_Struct
struct CharacterSelect_Struct
{
/*0000*/ uint32 Race[10]; // Characters Race
/*0040*/ Color_Struct CS_Colors[10][9]; // Characters Equipment Colors
/*0040*/ TintProfile CS_Colors[10]; // Characters Equipment Colors - packet requires length for 10 characters..but, client is limited to 8
/*0400*/ uint8 BeardColor[10]; // Characters beard Color
/*0410*/ uint8 HairStyle[10]; // Characters hair style
/*0420*/ uint32 Equip[10][9]; // 0=helm, 1=chest, 2=arm, 3=bracer, 4=hand, 5=leg, 6=boot, 7=melee1, 8=melee2 (Might not be)
/*0420*/ TextureProfile Equip[10]; // Characters texture array
/*0780*/ uint32 SecondaryIDFile[10]; // Characters secondary IDFile number
/*0820*/ uint8 Unknown820[10]; // 10x ff
/*0830*/ uint8 Unknown830[2]; // 2x 00
@@ -239,22 +281,7 @@ struct Spawn_Struct {
/*0189*/ uint32 petOwnerId; // If this is a pet, the spawn id of owner
/*0193*/ uint8 guildrank; // 0=normal, 1=officer, 2=leader
/*0194*/ uint8 unknown0194[3];
/*0197*/ union
{
struct
{
/*0197*/ uint32 equip_helmet; // Equipment: Helmet Visual
/*0201*/ uint32 equip_chest; // Equipment: Chest Visual
/*0205*/ uint32 equip_arms; // Equipment: Arms Visual
/*0209*/ uint32 equip_bracers; // Equipment: Bracers Visual
/*0213*/ uint32 equip_hands; // Equipment: Hands Visual
/*0217*/ uint32 equip_legs; // Equipment: Legs Visual
/*0221*/ uint32 equip_feet; // Equipment: Feet Visual
/*0225*/ uint32 equip_primary; // Equipment: Primary Visual
/*0229*/ uint32 equip_secondary; // Equipment: Secondary Visual
} equip;
/*0197*/ uint32 equipment[9]; // Array elements correspond to struct equipment above
};
/*0197*/ TextureProfile equipment;
/*0233*/ float runspeed; // Speed when running
/*0036*/ uint8 afk; // 0=no, 1=afk
/*0238*/ uint32 guildID; // Current guild
@@ -284,22 +311,7 @@ union
};
/*0340*/ uint32 spawnId; // Spawn Id
/*0344*/ uint8 unknown0344[4];
/*0348*/ union
{
struct
{
/*0348*/ Color_Struct color_helmet; // Color of helmet item
/*0352*/ Color_Struct color_chest; // Color of chest item
/*0356*/ Color_Struct color_arms; // Color of arms item
/*0360*/ Color_Struct color_bracers; // Color of bracers item
/*0364*/ Color_Struct color_hands; // Color of hands item
/*0368*/ Color_Struct color_legs; // Color of legs item
/*0372*/ Color_Struct color_feet; // Color of feet item
/*0376*/ Color_Struct color_primary; // Color of primary item
/*0380*/ Color_Struct color_secondary; // Color of secondary item
} equipment_colors;
/*0348*/ Color_Struct colors[9]; // Array elements correspond to struct equipment_colors above
};
/*0348*/ TintProfile equipment_tint;
/*0384*/ uint8 lfg; // 0=off, 1=lfg on
/*0385*/
@@ -378,7 +390,7 @@ struct MemorizeSpell_Struct {
uint32 slot; // Spot in the spell book/memorized slot
uint32 spell_id; // Spell id (200 or c8 is minor healing, etc)
uint32 scribing; // 1 if memorizing a spell, set to 0 if scribing to book, 2 if un-memming
uint32 unknown12;
uint32 reduction; // lowers reuse
};
/*
@@ -408,13 +420,13 @@ struct DeleteSpell_Struct
/*005*/uint8 unknowndss006[3];
/*008*/
};
struct ManaChange_Struct
{
uint32 new_mana; // New Mana AMount
uint32 stamina;
uint32 spell_id;
uint32 unknown12;
/*00*/ uint32 new_mana; // New Mana AMount
/*04*/ uint32 stamina;
/*08*/ uint32 spell_id;
/*12*/ uint8 keepcasting; // won't stop the cast. Change mana while casting?
/*13*/ uint8 padding[3]; // client doesn't read it, garbage data seems like
};
struct SwapSpell_Struct
@@ -461,26 +473,19 @@ struct SpawnAppearance_Struct
// this is used inside profile
struct SpellBuff_Struct
{
/*000*/ uint8 slotid; //badly named... seems to be 2 for a real buff, 0 otherwise
/*000*/ uint8 effect_type; // 0 = no buff, 2 = buff, 4 = inverse affects of buff
/*001*/ uint8 level;
/*002*/ uint8 bard_modifier;
/*003*/ uint8 effect; //not real
/*003*/ uint8 unknown003; // MQ2 used to call this "damage shield" -- don't see client referencing it, so maybe server side DS type tracking?
/*004*/ uint32 spellid;
/*008*/ int32 duration;
/*012*/ uint32 counters;
/*016*/ uint32 player_id; //'global' ID of the caster, for wearoff messages
/*012*/ uint32 counters; // single book keeping value (counters, rune/vie)
/*016*/ uint32 player_id; // caster ID, pretty sure just zone ID
};
struct SpellBuffFade_Struct {
struct SpellBuffPacket_Struct {
/*000*/ uint32 entityid;
/*004*/ uint8 slot;
/*005*/ uint8 level;
/*006*/ uint8 effect;
/*007*/ uint8 unknown7;
/*008*/ uint32 spellid;
/*012*/ int32 duration;
/*016*/ uint32 unknown016;
/*020*/ uint32 unknown020; //prolly global player ID
/*004*/ SpellBuff_Struct buff;
/*024*/ uint32 slotid;
/*028*/ uint32 bufffade;
/*032*/
@@ -810,9 +815,9 @@ struct PlayerProfile_Struct
/*00176*/ uint8 hairstyle; // Player hair style
/*00177*/ uint8 beard; // Player beard type
/*00178*/ uint8 unknown00178[10];
/*00188*/ uint32 item_material[9]; // Item texture/material of worn items
/*00188*/ TextureProfile item_material; // Item texture/material of worn items
/*00224*/ uint8 unknown00224[44];
/*00268*/ Color_Struct item_tint[9]; // RR GG BB 00
/*00268*/ TintProfile item_tint; // RR GG BB 00
/*00304*/ AA_Array aa_array[MAX_PP_AA_ARRAY]; // AAs
/*02224*/ uint32 points; // Unspent Practice points
/*02228*/ uint32 mana; // Current mana
@@ -1035,7 +1040,7 @@ struct SpecialMesg_Struct
struct WearChange_Struct{
/*000*/ uint16 spawn_id;
/*002*/ uint16 material;
/*004*/ Color_Struct color;
/*004*/ Tint_Struct color;
/*009*/ uint8 wear_slot_id;
};
@@ -2591,27 +2596,6 @@ struct PetitionBug_Struct{
char text[1028];
};
struct DyeStruct
{
union
{
struct
{
struct Color_Struct head;
struct Color_Struct chest;
struct Color_Struct arms;
struct Color_Struct wrists;
struct Color_Struct hands;
struct Color_Struct legs;
struct Color_Struct feet;
struct Color_Struct primary; // you can't actually dye this
struct Color_Struct secondary; // or this
}
dyes;
struct Color_Struct dye[9];
};
};
struct ApproveZone_Struct {
char name[64];
uint32 zoneid;
+145 -59
View File
@@ -59,6 +59,9 @@ namespace UF
// client to server text link converter
static inline void UFToServerTextLink(std::string& serverTextLink, const std::string& ufTextLink);
static inline CastingSlot ServerToUFCastingSlot(EQEmu::CastingSlot slot);
static inline EQEmu::CastingSlot UFToServerCastingSlot(CastingSlot slot);
void Register(EQStreamIdentifier &into)
{
//create our opcode manager if we havent already
@@ -363,20 +366,29 @@ namespace UF
ENCODE(OP_Buff)
{
ENCODE_LENGTH_EXACT(SpellBuffFade_Struct);
SETUP_DIRECT_ENCODE(SpellBuffFade_Struct, structs::SpellBuffFade_Struct_Underfoot);
ENCODE_LENGTH_EXACT(SpellBuffPacket_Struct);
SETUP_DIRECT_ENCODE(SpellBuffPacket_Struct, structs::SpellBuffPacket_Struct);
OUT(entityid);
OUT(slot);
OUT(level);
OUT(effect);
//eq->unknown7 = 10;
OUT(spellid);
OUT(duration);
OUT(slotid);
OUT(buff.effect_type);
OUT(buff.level);
// just so we're 100% sure we get a 1.0f ...
eq->buff.bard_modifier = emu->buff.bard_modifier == 10 ? 1.0f : emu->buff.bard_modifier / 10.0f;
OUT(buff.spellid);
OUT(buff.duration);
OUT(buff.num_hits);
uint16 buffslot = emu->slotid;
if (buffslot >= 25 && buffslot < 37)
{
buffslot += 5;
}
else if (buffslot >= 37)
{
buffslot += 14;
}
// TODO: implement slot_data stuff
eq->slotid = buffslot;
OUT(bufffade); // Live (October 2011) sends a 2 rather than 0 when a buff is created, but it doesn't seem to matter.
OUT(num_hits);
eq->unknown008 = 1.0f;
FINISH_ENCODE();
}
@@ -1374,7 +1386,8 @@ namespace UF
OUT(new_mana);
OUT(stamina);
OUT(spell_id);
eq->unknown16 = -1; // Self Interrupt/Success = -1, Fizzle = 1, Other Interrupt = 2?
OUT(keepcasting);
eq->slot = -1; // this is spell gem slot. It's -1 in normal operation
FINISH_ENCODE();
}
@@ -1752,18 +1765,18 @@ namespace UF
VARSTRUCT_ENCODE_TYPE(uint8, Buffer, 1);
VARSTRUCT_ENCODE_TYPE(uint16, Buffer, emu->buffcount);
for (unsigned int i = 0; i < BUFF_COUNT; ++i)
for (unsigned int i = 0; i < PET_BUFF_COUNT; ++i)
{
if (emu->spellid[i])
{
VARSTRUCT_ENCODE_TYPE(uint32, Buffer, i);
VARSTRUCT_ENCODE_TYPE(uint32, Buffer, emu->spellid[i]);
VARSTRUCT_ENCODE_TYPE(uint32, Buffer, emu->ticsremaining[i]);
VARSTRUCT_ENCODE_TYPE(uint32, Buffer, 0);
VARSTRUCT_ENCODE_TYPE(uint32, Buffer, 0); // numhits
VARSTRUCT_ENCODE_TYPE(uint8, Buffer, 0); // This is a string. Name of the caster of the buff.
}
}
VARSTRUCT_ENCODE_TYPE(uint8, Buffer, emu->buffcount);
VARSTRUCT_ENCODE_TYPE(uint8, Buffer, emu->buffcount); /// I think this is actually some sort of type
delete[] __emu_buffer;
dest->FastQueuePacket(&in, ack_req);
@@ -1806,14 +1819,14 @@ namespace UF
OUT(hairstyle);
OUT(beard);
// OUT(unknown00178[10]);
for (r = 0; r < 9; r++) {
eq->equipment[r].Material = emu->item_material[r];
eq->equipment[r].Unknown1 = 0;
eq->equipment[r].EliteMaterial = 0;
for (r = EQEmu::textures::TextureBegin; r < EQEmu::textures::TextureCount; r++) {
eq->equipment.Slot[r].Material = emu->item_material.Slot[r].Material;
eq->equipment.Slot[r].Unknown1 = 0;
eq->equipment.Slot[r].EliteMaterial = 0;
//eq->colors[r].color = emu->colors[r].color;
}
for (r = 0; r < 7; r++) {
OUT(item_tint[r].Color);
OUT(item_tint.Slot[r].Color);
}
// OUT(unknown00224[48]);
//NOTE: new client supports 300 AAs, our internal rep/PP
@@ -1858,26 +1871,26 @@ namespace UF
OUT(thirst_level);
OUT(hunger_level);
//PS this needs to be figured out more; but it was 'good enough'
for (r = 0; r < structs::BUFF_COUNT; r++)
for (r = 0; r < BUFF_COUNT; r++)
{
if (emu->buffs[r].spellid != 0xFFFF && emu->buffs[r].spellid != 0)
{
eq->buffs[r].unknown004 = 0x3f800000;
eq->buffs[r].slotid = 2;
eq->buffs[r].bard_modifier = 1.0f + (emu->buffs[r].bard_modifier - 10) / 10.0f;
eq->buffs[r].effect_type= 2;
eq->buffs[r].player_id = 0x000717fd;
}
else
{
eq->buffs[r].slotid = 0;
eq->buffs[r].effect_type = 0;
eq->buffs[r].bard_modifier = 1.0f;
}
//OUT(buffs[r].slotid);
OUT(buffs[r].effect_type);
OUT(buffs[r].level);
//OUT(buffs[r].bard_modifier);
//OUT(buffs[r].effect);
OUT(buffs[r].unknown003);
OUT(buffs[r].spellid);
OUT(buffs[r].duration);
OUT(buffs[r].counters);
//OUT(buffs[r].player_id);
OUT(buffs[r].num_hits);
OUT(buffs[r].player_id);
}
for (r = 0; r < MAX_PP_DISCIPLINES; r++) {
OUT(disciplines.values[r]);
@@ -2290,11 +2303,11 @@ namespace UF
eq_cse->HairColor = emu_cse->HairColor;
eq_cse->Face = emu_cse->Face;
for (int equip_index = 0; equip_index < EQEmu::legacy::MaterialCount; equip_index++) {
for (int equip_index = 0; equip_index < EQEmu::textures::TextureCount; equip_index++) {
eq_cse->Equip[equip_index].Material = emu_cse->Equip[equip_index].Material;
eq_cse->Equip[equip_index].Unknown1 = emu_cse->Equip[equip_index].Unknown1;
eq_cse->Equip[equip_index].EliteMaterial = emu_cse->Equip[equip_index].EliteMaterial;
eq_cse->Equip[equip_index].Color.Color = emu_cse->Equip[equip_index].Color.Color;
eq_cse->Equip[equip_index].Color = emu_cse->Equip[equip_index].Color;
}
eq_cse->PrimaryIDFile = emu_cse->PrimaryIDFile;
@@ -2858,7 +2871,7 @@ namespace UF
float SpawnSize = emu->size;
if (!((emu->NPC == 0) || (emu->race <= 12) || (emu->race == 128) || (emu->race == 130) || (emu->race == 330) || (emu->race == 522)))
{
PacketSize -= (sizeof(structs::EquipStruct) * 9);
PacketSize -= (sizeof(structs::Texture_Struct) * EQEmu::textures::TextureCount);
if (emu->size == 0)
{
@@ -3057,10 +3070,10 @@ namespace UF
if ((emu->NPC == 0) || (emu->race <= 12) || (emu->race == 128) || (emu->race == 130) || (emu->race == 330) || (emu->race == 522))
{
for (k = 0; k < 9; ++k)
for (k = EQEmu::textures::TextureBegin; k < EQEmu::textures::TextureCount; ++k)
{
{
VARSTRUCT_ENCODE_TYPE(uint32, Buffer, emu->colors[k].Color);
VARSTRUCT_ENCODE_TYPE(uint32, Buffer, emu->equipment_tint.Slot[k].Color);
}
}
}
@@ -3070,19 +3083,19 @@ namespace UF
VARSTRUCT_ENCODE_TYPE(uint32, Buffer, 0);
VARSTRUCT_ENCODE_TYPE(uint32, Buffer, 0);
if (emu->equipment[EQEmu::legacy::MaterialPrimary].Material > 99999) {
if (emu->equipment.Primary.Material > 99999) {
VARSTRUCT_ENCODE_TYPE(uint32, Buffer, 63);
} else {
VARSTRUCT_ENCODE_TYPE(uint32, Buffer, emu->equipment[EQEmu::legacy::MaterialPrimary].Material);
VARSTRUCT_ENCODE_TYPE(uint32, Buffer, emu->equipment.Primary.Material);
}
VARSTRUCT_ENCODE_TYPE(uint32, Buffer, 0);
VARSTRUCT_ENCODE_TYPE(uint32, Buffer, 0);
if (emu->equipment[EQEmu::legacy::MaterialSecondary].Material > 99999) {
if (emu->equipment.Secondary.Material > 99999) {
VARSTRUCT_ENCODE_TYPE(uint32, Buffer, 63);
} else {
VARSTRUCT_ENCODE_TYPE(uint32, Buffer, emu->equipment[EQEmu::legacy::MaterialSecondary].Material);
VARSTRUCT_ENCODE_TYPE(uint32, Buffer, emu->equipment.Secondary.Material);
}
VARSTRUCT_ENCODE_TYPE(uint32, Buffer, 0);
@@ -3091,19 +3104,19 @@ namespace UF
if ((emu->NPC == 0) || (emu->race <= 12) || (emu->race == 128) || (emu->race == 130) || (emu->race == 330) || (emu->race == 522))
{
structs::EquipStruct *Equipment = (structs::EquipStruct *)Buffer;
structs::Texture_Struct *Equipment = (structs::Texture_Struct *)Buffer;
for (k = 0; k < 9; k++) {
if (emu->equipment[k].Material > 99999) {
for (k = EQEmu::textures::TextureBegin; k < EQEmu::textures::TextureCount; k++) {
if (emu->equipment.Slot[k].Material > 99999) {
Equipment[k].Material = 63;
} else {
Equipment[k].Material = emu->equipment[k].Material;
Equipment[k].Material = emu->equipment.Slot[k].Material;
}
Equipment[k].Unknown1 = emu->equipment[k].Unknown1;
Equipment[k].EliteMaterial = emu->equipment[k].EliteMaterial;
Equipment[k].Unknown1 = emu->equipment.Slot[k].Unknown1;
Equipment[k].EliteMaterial = emu->equipment.Slot[k].EliteMaterial;
}
Buffer += (sizeof(structs::EquipStruct) * 9);
Buffer += (sizeof(structs::Texture_Struct) * EQEmu::textures::TextureCount);
}
if (strlen(emu->title))
{
@@ -3216,15 +3229,15 @@ namespace UF
DECODE(OP_Buff)
{
DECODE_LENGTH_EXACT(structs::SpellBuffFade_Struct_Underfoot);
SETUP_DIRECT_DECODE(SpellBuffFade_Struct, structs::SpellBuffFade_Struct_Underfoot);
DECODE_LENGTH_EXACT(structs::SpellBuffPacket_Struct);
SETUP_DIRECT_DECODE(SpellBuffPacket_Struct, structs::SpellBuffPacket_Struct);
IN(entityid);
IN(slot);
IN(level);
IN(effect);
IN(spellid);
IN(duration);
IN(buff.effect_type);
IN(buff.level);
IN(buff.unknown003);
IN(buff.spellid);
IN(buff.duration);
IN(slotid);
IN(bufffade);
@@ -3250,10 +3263,7 @@ namespace UF
DECODE_LENGTH_EXACT(structs::CastSpell_Struct);
SETUP_DIRECT_DECODE(CastSpell_Struct, structs::CastSpell_Struct);
if (eq->slot == 13)
emu->slot = 10;
else
IN(slot);
emu->slot = static_cast<uint32>(UFToServerCastingSlot(static_cast<CastingSlot>(eq->slot)));
IN(spell_id);
emu->inventoryslot = UFToServerSlot(eq->inventoryslot);
@@ -3841,11 +3851,11 @@ namespace UF
void SerializeItem(EQEmu::OutBuffer& ob, const ItemInst *inst, int16 slot_id_in, uint8 depth)
{
const EQEmu::Item_Struct *item = inst->GetUnscaledItem();
const EQEmu::ItemBase *item = inst->GetUnscaledItem();
UF::structs::ItemSerializationHeader hdr;
hdr.stacksize = (inst->IsStackable() ? ((inst->GetCharges() > 254) ? 0xFFFFFFFF : inst->GetCharges()) : 1);
hdr.stacksize = (inst->IsStackable() ? ((inst->GetCharges() > 1000) ? 0xFFFFFFFF : inst->GetCharges()) : 1);
hdr.unknown004 = 0;
int32 slot_id = ServerToUFSlot(slot_id_in);
@@ -3885,7 +3895,7 @@ namespace UF
int ornamentationAugtype = RuleI(Character, OrnamentationAugmentType);
uint16 ornaIcon = 0;
if (inst->GetOrnamentationAug(ornamentationAugtype)) {
const EQEmu::Item_Struct *aug_weap = inst->GetOrnamentationAug(ornamentationAugtype)->GetItem();
const EQEmu::ItemBase *aug_weap = inst->GetOrnamentationAug(ornamentationAugtype)->GetItem();
ornaIcon = aug_weap->Icon;
ob.write(aug_weap->IDFile, strlen(aug_weap->IDFile));
@@ -4369,4 +4379,80 @@ namespace UF
}
}
static inline CastingSlot ServerToUFCastingSlot(EQEmu::CastingSlot slot)
{
switch (slot) {
case EQEmu::CastingSlot::Gem1:
return CastingSlot::Gem1;
case EQEmu::CastingSlot::Gem2:
return CastingSlot::Gem2;
case EQEmu::CastingSlot::Gem3:
return CastingSlot::Gem3;
case EQEmu::CastingSlot::Gem4:
return CastingSlot::Gem4;
case EQEmu::CastingSlot::Gem5:
return CastingSlot::Gem5;
case EQEmu::CastingSlot::Gem6:
return CastingSlot::Gem6;
case EQEmu::CastingSlot::Gem7:
return CastingSlot::Gem7;
case EQEmu::CastingSlot::Gem8:
return CastingSlot::Gem8;
case EQEmu::CastingSlot::Gem9:
return CastingSlot::Gem9;
case EQEmu::CastingSlot::Gem10:
return CastingSlot::Gem10;
case EQEmu::CastingSlot::Gem11:
return CastingSlot::Gem11;
case EQEmu::CastingSlot::Gem12:
return CastingSlot::Gem12;
case EQEmu::CastingSlot::Item:
case EQEmu::CastingSlot::PotionBelt:
return CastingSlot::Item;
case EQEmu::CastingSlot::Discipline:
return CastingSlot::Discipline;
case EQEmu::CastingSlot::AltAbility:
return CastingSlot::AltAbility;
default: // we shouldn't have any issues with other slots ... just return something
return CastingSlot::Discipline;
}
}
static inline EQEmu::CastingSlot UFToServerCastingSlot(CastingSlot slot)
{
switch (slot) {
case CastingSlot::Gem1:
return EQEmu::CastingSlot::Gem1;
case CastingSlot::Gem2:
return EQEmu::CastingSlot::Gem2;
case CastingSlot::Gem3:
return EQEmu::CastingSlot::Gem3;
case CastingSlot::Gem4:
return EQEmu::CastingSlot::Gem4;
case CastingSlot::Gem5:
return EQEmu::CastingSlot::Gem5;
case CastingSlot::Gem6:
return EQEmu::CastingSlot::Gem6;
case CastingSlot::Gem7:
return EQEmu::CastingSlot::Gem7;
case CastingSlot::Gem8:
return EQEmu::CastingSlot::Gem8;
case CastingSlot::Gem9:
return EQEmu::CastingSlot::Gem9;
case CastingSlot::Gem10:
return EQEmu::CastingSlot::Gem10;
case CastingSlot::Gem11:
return EQEmu::CastingSlot::Gem11;
case CastingSlot::Gem12:
return EQEmu::CastingSlot::Gem12;
case CastingSlot::Discipline:
return EQEmu::CastingSlot::Discipline;
case CastingSlot::Item:
return EQEmu::CastingSlot::Item;
case CastingSlot::AltAbility:
return EQEmu::CastingSlot::AltAbility;
default: // we shouldn't have any issues with other slots ... just return something
return EQEmu::CastingSlot::Discipline;
}
}
} /*UF*/
+18
View File
@@ -50,6 +50,24 @@ namespace UF
#include "uf_ops.h"
};
enum class CastingSlot : uint32 {
Gem1 = 0,
Gem2 = 1,
Gem3 = 2,
Gem4 = 3,
Gem5 = 4,
Gem6 = 5,
Gem7 = 6,
Gem8 = 7,
Gem9 = 8,
Gem10 = 9,
Gem11 = 10,
Gem12 = 11,
Item = 12,
Discipline = 13,
AltAbility = 0xFF
};
}; /*UF*/
#endif /*COMMON_UF_H*/
+29 -12
View File
@@ -10,7 +10,7 @@
but WITHOUT ANY WARRANTY except by those people which sell it, which
are required to give you total support for your newly bought product;
without even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE. See the GNU General Public License for more details.
A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
@@ -22,7 +22,7 @@
#include "../string_util.h"
size_t UF::invtype::InvTypeSize(int inv_type)
size_t UF::invtype::GetInvTypeSize(int inv_type)
{
switch (inv_type) {
case invtype::InvTypePossessions:
@@ -68,7 +68,7 @@ size_t UF::invtype::InvTypeSize(int inv_type)
}
}
const char* UF::invtype::InvTypeName(int inv_type)
const char* UF::invtype::GetInvTypeName(int inv_type)
{
switch (inv_type) {
case invtype::InvTypeInvalid:
@@ -116,7 +116,24 @@ const char* UF::invtype::InvTypeName(int inv_type)
}
}
const char* UF::invslot::InvPossessionsSlotName(int inv_slot)
bool UF::invtype::IsInvTypePersistent(int inv_type)
{
switch (inv_type) {
case invtype::InvTypePossessions:
case invtype::InvTypeBank:
case invtype::InvTypeSharedBank:
case invtype::InvTypeTrade:
case invtype::InvTypeWorld:
case invtype::InvTypeLimbo:
case invtype::InvTypeTribute:
case invtype::InvTypeGuildTribute:
return true;
default:
return false;
}
}
const char* UF::invslot::GetInvPossessionsSlotName(int inv_slot)
{
switch (inv_slot) {
case invslot::InvSlotInvalid:
@@ -190,9 +207,9 @@ const char* UF::invslot::InvPossessionsSlotName(int inv_slot)
}
}
const char* UF::invslot::InvCorpseSlotName(int inv_slot)
const char* UF::invslot::GetInvCorpseSlotName(int inv_slot)
{
if (!invtype::InvTypeSize(invtype::InvTypeCorpse) || inv_slot == invslot::InvSlotInvalid)
if (!invtype::GetInvTypeSize(invtype::InvTypeCorpse) || inv_slot == invslot::InvSlotInvalid)
return "Invalid Slot";
// needs work
@@ -205,14 +222,14 @@ const char* UF::invslot::InvCorpseSlotName(int inv_slot)
return ret_str.c_str();
}
const char* UF::invslot::InvSlotName(int inv_type, int inv_slot)
const char* UF::invslot::GetInvSlotName(int inv_type, int inv_slot)
{
if (inv_type == invtype::InvTypePossessions)
return invslot::InvPossessionsSlotName(inv_slot);
return invslot::GetInvPossessionsSlotName(inv_slot);
else if (inv_type == invtype::InvTypeCorpse)
return invslot::InvCorpseSlotName(inv_slot);
return invslot::GetInvCorpseSlotName(inv_slot);
size_t type_size = invtype::InvTypeSize(inv_type);
size_t type_size = invtype::GetInvTypeSize(inv_type);
if (!type_size || inv_slot == invslot::InvSlotInvalid)
return "Invalid Slot";
@@ -226,7 +243,7 @@ const char* UF::invslot::InvSlotName(int inv_type, int inv_slot)
return ret_str.c_str();
}
const char* UF::invbag::InvBagIndexName(int bag_index)
const char* UF::invbag::GetInvBagIndexName(int bag_index)
{
if (bag_index == invbag::InvBagInvalid)
return "Invalid Bag";
@@ -240,7 +257,7 @@ const char* UF::invbag::InvBagIndexName(int bag_index)
return ret_str.c_str();
}
const char* UF::invaug::InvAugIndexName(int aug_index)
const char* UF::invaug::GetInvAugIndexName(int aug_index)
{
if (aug_index == invaug::InvAugInvalid)
return "Invalid Augment";
+40 -28
View File
@@ -10,7 +10,7 @@
but WITHOUT ANY WARRANTY except by those people which sell it, which
are required to give you total support for your newly bought product;
without even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE. See the GNU General Public License for more details.
A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
@@ -21,7 +21,7 @@
#define COMMON_UF_LIMITS_H
#include "../types.h"
#include "../client_version.h"
#include "../emu_versions.h"
#include "../skills.h"
@@ -32,8 +32,13 @@ namespace UF
enum : bool { False = false, True = true };
// pre-declarations
namespace inventory {
inline EQEmu::versions::ClientVersion GetInventoryRef() { return EQEmu::versions::ClientVersion::UF; }
} /*inventory*/
namespace invtype {
inline EQEmu::versions::ClientVersion InvTypeRef() { return EQEmu::versions::ClientVersion::UF; }
inline EQEmu::versions::ClientVersion GetInvTypeRef() { return EQEmu::versions::ClientVersion::UF; }
enum : int { InvTypeInvalid = -1, InvTypeBegin };
@@ -63,7 +68,7 @@ namespace UF
} /*invtype*/
namespace invslot {
inline EQEmu::versions::ClientVersion InvSlotRef() { return EQEmu::versions::ClientVersion::UF; }
inline EQEmu::versions::ClientVersion GetInvSlotRef() { return EQEmu::versions::ClientVersion::UF; }
enum : int { InvSlotInvalid = -1, InvSlotBegin };
@@ -114,21 +119,21 @@ namespace UF
} /*invslot*/
namespace invbag {
inline EQEmu::versions::ClientVersion InvBagRef() { return EQEmu::versions::ClientVersion::UF; }
inline EQEmu::versions::ClientVersion GetInvBagRef() { return EQEmu::versions::ClientVersion::UF; }
enum : int { InvBagInvalid = -1, InvBagBegin };
} /*invbag*/
namespace invaug {
inline EQEmu::versions::ClientVersion InvAugRef() { return EQEmu::versions::ClientVersion::UF; }
inline EQEmu::versions::ClientVersion GetInvAugRef() { return EQEmu::versions::ClientVersion::UF; }
enum : int { InvAugInvalid = -1, InvAugBegin };
} /*invaug*/
namespace item {
inline EQEmu::versions::ClientVersion ItemRef() { return EQEmu::versions::ClientVersion::UF; }
inline EQEmu::versions::ClientVersion GetItemRef() { return EQEmu::versions::ClientVersion::UF; }
enum ItemPacketType : int {
ItemPacketMerchant = 100,
@@ -147,27 +152,37 @@ namespace UF
} /*item*/
namespace profile {
inline EQEmu::versions::ClientVersion ProfileRef() { return EQEmu::versions::ClientVersion::UF; }
inline EQEmu::versions::ClientVersion GetProfileRef() { return EQEmu::versions::ClientVersion::UF; }
} /*profile*/
namespace constants {
inline EQEmu::versions::ClientVersion ConstantsRef() { return EQEmu::versions::ClientVersion::UF; }
inline EQEmu::versions::ClientVersion GetConstantsRef() { return EQEmu::versions::ClientVersion::UF; }
} /*constants*/
namespace behavior {
inline EQEmu::versions::ClientVersion BehaviorRef() { return EQEmu::versions::ClientVersion::UF; }
inline EQEmu::versions::ClientVersion GetBehaviorRef() { return EQEmu::versions::ClientVersion::UF; }
} /*behavior*/
namespace skills {
inline EQEmu::versions::ClientVersion SkillsRef() { return EQEmu::versions::ClientVersion::UF; }
inline EQEmu::versions::ClientVersion GetSkillsRef() { return EQEmu::versions::ClientVersion::UF; }
} /*skills*/
// declarations
namespace inventory {
const bool ConcatenateInvTypeLimbo = true;
const bool AllowOverLevelEquipment = true;
const bool AllowEmptyBagInBag = false;
const bool AllowClickCastFromBag = false;
} /*inventory*/
namespace invtype {
const size_t InvTypePossessionsSize = invslot::PossessionsCount;
const size_t InvTypeBankSize = 24;
@@ -176,7 +191,7 @@ namespace UF
const size_t InvTypeWorldSize = 10;
const size_t InvTypeLimboSize = 36;
const size_t InvTypeTributeSize = 5;
const size_t InvTypeGuildTributeSize = 0;//unknown
const size_t InvTypeGuildTributeSize = 2;
const size_t InvTypeMerchantSize = 80;
const size_t InvTypeCorpseSize = InvTypePossessionsSize;
const size_t InvTypeBazaarSize = 80;
@@ -189,10 +204,10 @@ namespace UF
const size_t InvTypeArchivedSize = 0;//unknown
const size_t InvTypeOtherSize = 0;//unknown
const size_t NPCTradeSize = 4;
extern size_t GetInvTypeSize(int inv_type);
extern const char* GetInvTypeName(int inv_type);
extern size_t InvTypeSize(int inv_type);
extern const char* InvTypeName(int inv_type);
extern bool IsInvTypePersistent(int inv_type);
} /*invtype*/
@@ -211,14 +226,17 @@ namespace UF
const int WorldEnd = (WorldBegin + invtype::InvTypeWorldSize) - 1;
const int TributeBegin = 400;
const int TributeEnd = 404;
const int TributeEnd = (TributeBegin + invtype::InvTypeTributeSize) - 1;
const int GuildTributeBegin = 450;
const int GuildTributeEnd = (GuildTributeBegin + invtype::InvTypeGuildTributeSize) - 1;
const int CorpseBegin = invslot::PossessionsGeneral1;
const int CorpseEnd = invslot::PossessionsGeneral1 + invslot::PossessionsCursor;
extern const char* InvPossessionsSlotName(int inv_slot);
extern const char* InvCorpseSlotName(int inv_slot);
extern const char* InvSlotName(int inv_type, int inv_slot);
extern const char* GetInvPossessionsSlotName(int inv_slot);
extern const char* GetInvCorpseSlotName(int inv_slot);
extern const char* GetInvSlotName(int inv_type, int inv_slot);
} /*invslot*/
@@ -245,14 +263,14 @@ namespace UF
const int TradeBagsSize = invtype::InvTypeTradeSize * ItemBagSize;
const int TradeBagsEnd = (TradeBagsBegin + TradeBagsSize) - 1;
extern const char* InvBagIndexName(int bag_index);
extern const char* GetInvBagIndexName(int bag_index);
} /*invbag*/
namespace invaug {
const size_t ItemAugSize = 5;
extern const char* InvAugIndexName(int aug_index);
extern const char* GetInvAugIndexName(int aug_index);
} /*invaug*/
@@ -262,6 +280,7 @@ namespace UF
namespace profile {
const size_t TributeSize = invtype::InvTypeTributeSize;
const size_t GuildTributeSize = invtype::InvTypeGuildTributeSize;
const size_t BandoliersSize = 20; // number of bandolier instances
const size_t BandolierItemCount = 4; // number of equipment slots in bandolier instance
@@ -280,13 +299,6 @@ namespace UF
} /*constants*/
namespace behavior {
const bool ConcatenateInvTypeLimbo = true;
const bool AllowOverLevelEquipment = true;
const bool AllowEmptyBagInBag = false;
const bool AllowClickCastFromBag = false;
const bool CoinHasWeight = false;
} /*behavior*/
+77 -142
View File
@@ -26,7 +26,7 @@ namespace UF
namespace structs {
static const uint32 BUFF_COUNT = 25;
static const uint32 BUFF_COUNT = 30;
/*
** Compiler override to ensure
@@ -122,27 +122,70 @@ struct AdventureInfo {
** Merth: Gave struct a name so gcc 2.96 would compile
**
*/
struct Color_Struct
struct Tint_Struct
{
union {
struct {
uint8 blue;
uint8 Blue;
uint8 Green;
uint8 Red;
uint8 UseTint; // if there's a tint this is FF
} RGB;
};
uint32 Color;
};
};
struct CharSelectEquip
struct TintProfile
{
union {
struct {
Tint_Struct Head;
Tint_Struct Chest;
Tint_Struct Arms;
Tint_Struct Wrist;
Tint_Struct Hands;
Tint_Struct Legs;
Tint_Struct Feet;
Tint_Struct Primary;
Tint_Struct Secondary;
};
Tint_Struct Slot[EQEmu::textures::TextureCount];
};
};
/*
* Visible equiptment.
* Size: 12 Octets
*/
struct Texture_Struct
{
uint32 Material;
uint32 Unknown1;
uint32 EliteMaterial;
Color_Struct Color;
};
struct TextureProfile
{
union {
struct {
Texture_Struct Head;
Texture_Struct Chest;
Texture_Struct Arms;
Texture_Struct Wrist;
Texture_Struct Hands;
Texture_Struct Legs;
Texture_Struct Feet;
Texture_Struct Primary;
Texture_Struct Secondary;
};
Texture_Struct Slot[EQEmu::textures::TextureCount];
};
TextureProfile();
};
struct CharSelectEquip : Texture_Struct, Tint_Struct {};
struct CharacterSelectEntry_Struct
{
/*0000*/ uint8 Level; //
@@ -152,7 +195,7 @@ struct CharacterSelectEntry_Struct
/*0000*/ uint8 Beard; //
/*0001*/ uint8 HairColor; //
/*0000*/ uint8 Face; //
/*0000*/ CharSelectEquip Equip[9];
/*0000*/ CharSelectEquip Equip[EQEmu::textures::TextureCount];
/*0000*/ uint32 PrimaryIDFile; //
/*0000*/ uint32 SecondaryIDFile; //
/*0000*/ uint8 Unknown15; // 0xff
@@ -185,19 +228,6 @@ struct CharacterSelect_Struct
/*0008*/ CharacterSelectEntry_Struct Entries[0];
};
/*
* Visible equiptment.
* Size: 12 Octets
*/
struct EquipStruct
{
/*00*/ uint32 Material;
/*04*/ uint32 Unknown1;
/*08*/ uint32 EliteMaterial;
/*12*/
};
/*
** Generic Spawn Struct
** Length: 897 Octets
@@ -314,40 +344,10 @@ struct Spawn_Struct
/*0000*/ uint32 unknown18;
/*0000*/ uint32 unknown19;
Spawn_Struct_Position Position;
/*0000*/ union
{
struct
{
/*0000*/ Color_Struct color_helmet; // Color of helmet item
/*0000*/ Color_Struct color_chest; // Color of chest item
/*0000*/ Color_Struct color_arms; // Color of arms item
/*0000*/ Color_Struct color_bracers; // Color of bracers item
/*0000*/ Color_Struct color_hands; // Color of hands item
/*0000*/ Color_Struct color_legs; // Color of legs item
/*0000*/ Color_Struct color_feet; // Color of feet item
/*0000*/ Color_Struct color_primary; // Color of primary item
/*0000*/ Color_Struct color_secondary; // Color of secondary item
} equipment_colors;
/*0000*/ Color_Struct colors[9]; // Array elements correspond to struct equipment_colors above
};
/*0000*/ TintProfile equipment_tint;
// skip these bytes if not a valid player race
/*0000*/ union
{
struct
{
/*0000*/ EquipStruct equip_helmet; // Equiptment: Helmet visual
/*0000*/ EquipStruct equip_chest; // Equiptment: Chest visual
/*0000*/ EquipStruct equip_arms; // Equiptment: Arms visual
/*0000*/ EquipStruct equip_bracers; // Equiptment: Wrist visual
/*0000*/ EquipStruct equip_hands; // Equiptment: Hands visual
/*0000*/ EquipStruct equip_legs; // Equiptment: Legs visual
/*0000*/ EquipStruct equip_feet; // Equiptment: Boots visual
/*0000*/ EquipStruct equip_primary; // Equiptment: Main visual
/*0000*/ EquipStruct equip_secondary; // Equiptment: Off visual
} equip;
/*0000*/ EquipStruct equipment[9];
};
/*0000*/ TextureProfile equipment;
/*0000*/ //char title[0]; // only read if(hasTitleOrSuffix & 4)
/*0000*/ //char suffix[0]; // only read if(hasTitleOrSuffix & 8)
@@ -479,7 +479,7 @@ struct MemorizeSpell_Struct {
uint32 slot; // Spot in the spell book/memorized slot
uint32 spell_id; // Spell id (200 or c8 is minor healing, etc)
uint32 scribing; // 1 if memorizing a spell, set to 0 if scribing to book, 2 if un-memming
//uint32 unknown12;
uint32 reduction; // lowers reuse
};
/*
@@ -512,11 +512,12 @@ struct DeleteSpell_Struct
struct ManaChange_Struct
{
uint32 new_mana; // New Mana AMount
uint32 stamina;
uint32 spell_id;
uint32 unknown12;
uint32 unknown16;
/*00*/ uint32 new_mana; // New Mana AMount
/*04*/ uint32 stamina;
/*08*/ uint32 spell_id;
/*12*/ uint8 keepcasting; // won't stop the cast. Change mana while casting?
/*13*/ uint8 padding[3]; // client doesn't read it, garbage data seems like
/*16*/ int32 slot; // -1 for normal usage slot for when we want silent interrupt? I think it does timer stuff or something. Linked Spell Reuse interrupt uses it
};
struct SwapSpell_Struct
@@ -566,55 +567,28 @@ struct SpawnAppearance_Struct
// Size 76 (was 24)
struct SpellBuff_Struct
{
/*000*/ uint8 slotid; // badly named... seems to be 2 for a real buff, 0 otherwise
/*001*/ uint8 level;
/*002*/ uint8 bard_modifier;
/*003*/ uint8 effect; // not real
/*004*/ uint32 unknown004; // Seen 1 for no buff
/*008*/ uint32 spellid;
/*012*/ int32 duration;
/*016*/ uint32 unknown016;
/*020*/ uint32 player_id; // 'global' ID of the caster, for wearoff messages
/*024*/ uint32 counters;
/*028*/ uint8 unknown0028[48];
/*076*/
/*000*/ uint8 effect_type; // 0 = no buff, 2 = buff, 4 = inverse affects of buff
/*001*/ uint8 level; // Seen 1 for no buff
/*002*/ uint8 unknown002; //pretty sure padding now
/*003*/ uint8 unknown003; // MQ2 used to call this "damage shield" -- don't see client referencing it, so maybe server side DS type tracking?
/*004*/ float bard_modifier;
/*008*/ uint32 spellid;
/*012*/ uint32 duration;
/*016*/ uint32 num_hits;
/*020*/ uint32 player_id; // caster ID, pretty sure just zone ID
/*024*/ uint32 unknown036;
/*028*/ int32 slot_data[12]; // book keeping stuff per slot (counters, rune/vie)
};
// Not functional yet, but this is what the packet looks like on Underfoot
struct SpellBuffFade_Struct_Underfoot {
struct SpellBuffPacket_Struct {
/*000*/ uint32 entityid; // Player id who cast the buff
/*004*/ uint8 slot;
/*005*/ uint8 level;
/*006*/ uint8 effect;
/*007*/ uint8 unknown7;
/*008*/ float unknown008;
/*012*/ uint32 spellid;
/*016*/ int32 duration;
/*020*/ uint32 num_hits;
/*024*/ uint32 playerId; // Global player ID?
/*028*/ uint32 unknown020;
/*032*/ uint8 unknown0028[48];
/*004*/ SpellBuff_Struct buff;
/*080*/ uint32 slotid;
/*084*/ uint32 bufffade;
/*088*/
};
struct SpellBuffFade_Struct {
/*000*/ uint32 entityid;
/*004*/ uint8 slot;
/*005*/ uint8 level;
/*006*/ uint8 effect;
/*007*/ uint8 unknown7;
/*008*/ uint32 spellid;
/*012*/ int32 duration;
/*016*/ uint32 unknown016;
/*020*/ uint32 unknown020; // Global player ID?
/*024*/ uint32 playerId; // Player id who cast the buff
/*028*/ uint32 slotid;
/*032*/ uint32 bufffade;
/*036*/
};
#if 0
struct BuffIconEntry_Struct {
/*000*/ uint32 buff_slot;
@@ -952,24 +926,9 @@ struct PlayerProfile_Struct
/*00230*/ uint8 hairstyle; // Player hair style
/*00231*/ uint8 beard; // Player beard type
/*00232*/ uint8 unknown00232[4]; // was 14
/*00236*/ union
{
struct
{
/*00236*/ EquipStruct equip_helmet; // Equiptment: Helmet visual
/*00248*/ EquipStruct equip_chest; // Equiptment: Chest visual
/*00260*/ EquipStruct equip_arms; // Equiptment: Arms visual
/*00272*/ EquipStruct equip_bracers; // Equiptment: Wrist visual
/*00284*/ EquipStruct equip_hands; // Equiptment: Hands visual
/*00296*/ EquipStruct equip_legs; // Equiptment: Legs visual
/*00308*/ EquipStruct equip_feet; // Equiptment: Boots visual
/*00320*/ EquipStruct equip_primary; // Equiptment: Main visual
/*00332*/ EquipStruct equip_secondary; // Equiptment: Off visual
} equip;
/*00236*/ EquipStruct equipment[9]; //Underfoot Shows [108] for this part
};
/*00236*/ TextureProfile equipment;
/*00344*/ uint8 unknown00344[168]; // Underfoot Shows [160]
/*00512*/ Color_Struct item_tint[9]; // RR GG BB 00
/*00512*/ TintProfile item_tint; // RR GG BB 00
/*00548*/ AA_Array aa_array[MAX_PP_AA_ARRAY]; // [3600] AAs 12 bytes each
/*04148*/ uint32 points; // Unspent Practice points - RELOCATED???
/*04152*/ uint32 mana; // Current mana
@@ -1000,8 +959,7 @@ struct PlayerProfile_Struct
/*07880*/ uint32 toxicity; // Potion Toxicity (15=too toxic, each potion adds 3)
/*07884*/ uint32 thirst_level; // Drink (ticks till next drink)
/*07888*/ uint32 hunger_level; // Food (ticks till next eat)
/*07892*/ SpellBuff_Struct buffs[BUFF_COUNT]; // [1900] Buffs currently on the player (30 Max) - (Each Size 76)
/*09792*/ uint8 unknown09792[380]; // BUFF_COUNT has been left at 25. These are the extra 5 buffs in Underfoot
/*07892*/ SpellBuff_Struct buffs[BUFF_COUNT]; // [2280] Buffs currently on the player (30 Max) - (Each Size 76)
/*10172*/ Disciplines_Struct disciplines; // [400] Known disciplines
/*10972*/ uint32 recastTimers[MAX_RECAST_TYPES]; // Timers (UNIX Time of last use)
/*11052*/ uint8 unknown11052[160]; // Some type of Timers
@@ -1232,7 +1190,7 @@ struct WearChange_Struct{
/*002*/ uint32 material;
/*006*/ uint32 unknown06;
/*010*/ uint32 elite_material; // 1 for Drakkin Elite Material
/*014*/ Color_Struct color;
/*014*/ Tint_Struct color;
/*018*/ uint8 wear_slot_id;
/*019*/
};
@@ -2054,7 +2012,7 @@ struct AdventureLeaderboard_Struct
/*struct Item_Shop_Struct {
uint16 merchantid;
uint8 itemtype;
Item_Struct item;
ItemBase item;
uint8 iss_unknown001[6];
};*/
@@ -2209,9 +2167,7 @@ struct GroupFollow_Struct { // Underfoot Follow Struct
struct InspectBuffs_Struct {
/*000*/ uint32 spell_id[BUFF_COUNT];
/*100*/ uint32 filler100[5]; // BUFF_COUNT is really 30...
/*120*/ int32 tics_remaining[BUFF_COUNT];
/*220*/ uint32 filler220[5]; // BUFF_COUNT is really 30...
};
@@ -3162,27 +3118,6 @@ struct PetitionBug_Struct{
char text[1028];
};
struct DyeStruct
{
union
{
struct
{
struct Color_Struct head;
struct Color_Struct chest;
struct Color_Struct arms;
struct Color_Struct wrists;
struct Color_Struct hands;
struct Color_Struct legs;
struct Color_Struct feet;
struct Color_Struct primary; // you can't actually dye this
struct Color_Struct secondary; // or this
}
dyes;
struct Color_Struct dye[9];
};
};
struct ApproveZone_Struct {
char name[64];
uint32 zoneid;
+1 -1
View File
@@ -8,7 +8,7 @@ enum EQEmuExePlatform
ExePlatformWorld,
ExePlatformLogin,
ExePlatformQueryServ,
ExePlatformSocket_Server,
ExePlatformWebInterface,
ExePlatformUCS,
ExePlatformLaunch,
ExePlatformSharedMemory,
+3 -1
View File
@@ -37,10 +37,12 @@ enum { //values for pTimerType
pTimerSenseTraps = 12,
pTimerDisarmTraps = 13,
pTimerDisciplineReuseStart = 14,
pTimerDisciplineReuseEnd = 24,
pTimerDisciplineReuseEnd = 24, // client actually has 20 ids, but still no disc go that high even on live
pTimerCombatAbility = 25,
pTimerCombatAbility2 = 26, // RoF2+ Tiger Claw is unlinked from other monk skills, generic in case other classes ever need it
pTimerBeggingPickPocket = 27,
pTimerLinkedSpellReuseStart = 28,
pTimerLinkedSpellReuseEnd = 48,
pTimerLayHands = 87, //these IDs are used by client too
pTimerHarmTouch = 89, //so dont change them
+1
View File
@@ -45,6 +45,7 @@
#define TIGER 63
#define ELEMENTAL 75
#define ALLIGATOR 91
#define OGGOK_CITIZEN 93
#define EYE_OF_ZOMM 108
#define WOLF_ELEMENTAL 120
#define INVISIBLE_MAN 127
+226
View File
@@ -0,0 +1,226 @@
#ifndef RAPIDJSON_ALLOCATORS_H_
#define RAPIDJSON_ALLOCATORS_H_
#include "rapidjson.h"
namespace rapidjson {
///////////////////////////////////////////////////////////////////////////////
// Allocator
/*! \class rapidjson::Allocator
\brief Concept for allocating, resizing and freeing memory block.
Note that Malloc() and Realloc() are non-static but Free() is static.
So if an allocator need to support Free(), it needs to put its pointer in
the header of memory block.
\code
concept Allocator {
static const bool kNeedFree; //!< Whether this allocator needs to call Free().
// Allocate a memory block.
// \param size of the memory block in bytes.
// \returns pointer to the memory block.
void* Malloc(size_t size);
// Resize a memory block.
// \param originalPtr The pointer to current memory block. Null pointer is permitted.
// \param originalSize The current size in bytes. (Design issue: since some allocator may not book-keep this, explicitly pass to it can save memory.)
// \param newSize the new size in bytes.
void* Realloc(void* originalPtr, size_t originalSize, size_t newSize);
// Free a memory block.
// \param pointer to the memory block. Null pointer is permitted.
static void Free(void *ptr);
};
\endcode
*/
///////////////////////////////////////////////////////////////////////////////
// CrtAllocator
//! C-runtime library allocator.
/*! This class is just wrapper for standard C library memory routines.
\note implements Allocator concept
*/
class CrtAllocator {
public:
static const bool kNeedFree = true;
void* Malloc(size_t size) { return malloc(size); }
void* Realloc(void* originalPtr, size_t originalSize, size_t newSize) { (void)originalSize; return realloc(originalPtr, newSize); }
static void Free(void *ptr) { free(ptr); }
};
///////////////////////////////////////////////////////////////////////////////
// MemoryPoolAllocator
//! Default memory allocator used by the parser and DOM.
/*! This allocator allocate memory blocks from pre-allocated memory chunks.
It does not free memory blocks. And Realloc() only allocate new memory.
The memory chunks are allocated by BaseAllocator, which is CrtAllocator by default.
User may also supply a buffer as the first chunk.
If the user-buffer is full then additional chunks are allocated by BaseAllocator.
The user-buffer is not deallocated by this allocator.
\tparam BaseAllocator the allocator type for allocating memory chunks. Default is CrtAllocator.
\note implements Allocator concept
*/
template <typename BaseAllocator = CrtAllocator>
class MemoryPoolAllocator {
public:
static const bool kNeedFree = false; //!< Tell users that no need to call Free() with this allocator. (concept Allocator)
//! Constructor with chunkSize.
/*! \param chunkSize The size of memory chunk. The default is kDefaultChunkSize.
\param baseAllocator The allocator for allocating memory chunks.
*/
MemoryPoolAllocator(size_t chunkSize = kDefaultChunkCapacity, BaseAllocator* baseAllocator = 0) :
chunkHead_(0), chunk_capacity_(chunkSize), userBuffer_(0), baseAllocator_(baseAllocator), ownBaseAllocator_(0)
{
if (!baseAllocator_)
ownBaseAllocator_ = baseAllocator_ = new BaseAllocator();
AddChunk(chunk_capacity_);
}
//! Constructor with user-supplied buffer.
/*! The user buffer will be used firstly. When it is full, memory pool allocates new chunk with chunk size.
The user buffer will not be deallocated when this allocator is destructed.
\param buffer User supplied buffer.
\param size Size of the buffer in bytes. It must at least larger than sizeof(ChunkHeader).
\param chunkSize The size of memory chunk. The default is kDefaultChunkSize.
\param baseAllocator The allocator for allocating memory chunks.
*/
MemoryPoolAllocator(void *buffer, size_t size, size_t chunkSize = kDefaultChunkCapacity, BaseAllocator* baseAllocator = 0) :
chunkHead_(0), chunk_capacity_(chunkSize), userBuffer_(buffer), baseAllocator_(baseAllocator), ownBaseAllocator_(0)
{
RAPIDJSON_ASSERT(buffer != 0);
RAPIDJSON_ASSERT(size > sizeof(ChunkHeader));
chunkHead_ = reinterpret_cast<ChunkHeader*>(buffer);
chunkHead_->capacity = size - sizeof(ChunkHeader);
chunkHead_->size = 0;
chunkHead_->next = 0;
}
//! Destructor.
/*! This deallocates all memory chunks, excluding the user-supplied buffer.
*/
~MemoryPoolAllocator() {
Clear();
delete ownBaseAllocator_;
}
//! Deallocates all memory chunks, excluding the user-supplied buffer.
void Clear() {
while(chunkHead_ != 0 && chunkHead_ != userBuffer_) {
ChunkHeader* next = chunkHead_->next;
baseAllocator_->Free(chunkHead_);
chunkHead_ = next;
}
}
//! Computes the total capacity of allocated memory chunks.
/*! \return total capacity in bytes.
*/
size_t Capacity() const {
size_t capacity = 0;
for (ChunkHeader* c = chunkHead_; c != 0; c = c->next)
capacity += c->capacity;
return capacity;
}
//! Computes the memory blocks allocated.
/*! \return total used bytes.
*/
size_t Size() const {
size_t size = 0;
for (ChunkHeader* c = chunkHead_; c != 0; c = c->next)
size += c->size;
return size;
}
//! Allocates a memory block. (concept Allocator)
void* Malloc(size_t size) {
size = RAPIDJSON_ALIGN(size);
if (chunkHead_->size + size > chunkHead_->capacity)
AddChunk(chunk_capacity_ > size ? chunk_capacity_ : size);
void *buffer = reinterpret_cast<char *>(chunkHead_ + 1) + chunkHead_->size;
chunkHead_->size += size;
return buffer;
}
//! Resizes a memory block (concept Allocator)
void* Realloc(void* originalPtr, size_t originalSize, size_t newSize) {
if (originalPtr == 0)
return Malloc(newSize);
// Do not shrink if new size is smaller than original
if (originalSize >= newSize)
return originalPtr;
// Simply expand it if it is the last allocation and there is sufficient space
if (originalPtr == (char *)(chunkHead_ + 1) + chunkHead_->size - originalSize) {
size_t increment = static_cast<size_t>(newSize - originalSize);
increment = RAPIDJSON_ALIGN(increment);
if (chunkHead_->size + increment <= chunkHead_->capacity) {
chunkHead_->size += increment;
return originalPtr;
}
}
// Realloc process: allocate and copy memory, do not free original buffer.
void* newBuffer = Malloc(newSize);
RAPIDJSON_ASSERT(newBuffer != 0); // Do not handle out-of-memory explicitly.
return memcpy(newBuffer, originalPtr, originalSize);
}
//! Frees a memory block (concept Allocator)
static void Free(void *ptr) { (void)ptr; } // Do nothing
private:
//! Copy constructor is not permitted.
MemoryPoolAllocator(const MemoryPoolAllocator& rhs) /* = delete */;
//! Copy assignment operator is not permitted.
MemoryPoolAllocator& operator=(const MemoryPoolAllocator& rhs) /* = delete */;
//! Creates a new chunk.
/*! \param capacity Capacity of the chunk in bytes.
*/
void AddChunk(size_t capacity) {
ChunkHeader* chunk = reinterpret_cast<ChunkHeader*>(baseAllocator_->Malloc(sizeof(ChunkHeader) + capacity));
chunk->capacity = capacity;
chunk->size = 0;
chunk->next = chunkHead_;
chunkHead_ = chunk;
}
static const int kDefaultChunkCapacity = 64 * 1024; //!< Default chunk capacity.
//! Chunk header for perpending to each chunk.
/*! Chunks are stored as a singly linked list.
*/
struct ChunkHeader {
size_t capacity; //!< Capacity of the chunk in bytes (excluding the header itself).
size_t size; //!< Current size of allocated memory in bytes.
ChunkHeader *next; //!< Next chunk in the linked list.
};
ChunkHeader *chunkHead_; //!< Head of the chunk linked-list. Only the head chunk serves allocation.
size_t chunk_capacity_; //!< The minimum capacity of chunk when they are allocated.
void *userBuffer_; //!< User supplied buffer.
BaseAllocator* baseAllocator_; //!< base allocator for allocating memory chunks.
BaseAllocator* ownBaseAllocator_; //!< base allocator created by this object.
};
} // namespace rapidjson
#endif // RAPIDJSON_ENCODINGS_H_
File diff suppressed because it is too large Load Diff
+270
View File
@@ -0,0 +1,270 @@
#ifndef RAPIDJSON_ENCODEDSTREAM_H_
#define RAPIDJSON_ENCODEDSTREAM_H_
#include "rapidjson.h"
#ifdef __GNUC__
RAPIDJSON_DIAG_PUSH
RAPIDJSON_DIAG_OFF(effc++)
#endif
namespace rapidjson {
//! Input byte stream wrapper with a statically bound encoding.
/*!
\tparam Encoding The interpretation of encoding of the stream. Either UTF8, UTF16LE, UTF16BE, UTF32LE, UTF32BE.
\tparam InputByteStream Type of input byte stream. For example, FileReadStream.
*/
template <typename Encoding, typename InputByteStream>
class EncodedInputStream {
RAPIDJSON_STATIC_ASSERT(sizeof(typename InputByteStream::Ch) == 1);
public:
typedef typename Encoding::Ch Ch;
EncodedInputStream(InputByteStream& is) : is_(is) {
current_ = Encoding::TakeBOM(is_);
}
Ch Peek() const { return current_; }
Ch Take() { Ch c = current_; current_ = Encoding::Take(is_); return c; }
size_t Tell() const { return is_.Tell(); }
// Not implemented
void Put(Ch) { RAPIDJSON_ASSERT(false); }
void Flush() { RAPIDJSON_ASSERT(false); }
Ch* PutBegin() { RAPIDJSON_ASSERT(false); return 0; }
size_t PutEnd(Ch*) { RAPIDJSON_ASSERT(false); return 0; }
private:
EncodedInputStream(const EncodedInputStream&);
EncodedInputStream& operator=(const EncodedInputStream&);
InputByteStream& is_;
Ch current_;
};
//! Output byte stream wrapper with statically bound encoding.
/*!
\tparam Encoding The interpretation of encoding of the stream. Either UTF8, UTF16LE, UTF16BE, UTF32LE, UTF32BE.
\tparam InputByteStream Type of input byte stream. For example, FileWriteStream.
*/
template <typename Encoding, typename OutputByteStream>
class EncodedOutputStream {
RAPIDJSON_STATIC_ASSERT(sizeof(typename OutputByteStream::Ch) == 1);
public:
typedef typename Encoding::Ch Ch;
EncodedOutputStream(OutputByteStream& os, bool putBOM = true) : os_(os) {
if (putBOM)
Encoding::PutBOM(os_);
}
void Put(Ch c) { Encoding::Put(os_, c); }
void Flush() { os_.Flush(); }
// Not implemented
Ch Peek() const { RAPIDJSON_ASSERT(false); }
Ch Take() { RAPIDJSON_ASSERT(false); }
size_t Tell() const { RAPIDJSON_ASSERT(false); return 0; }
Ch* PutBegin() { RAPIDJSON_ASSERT(false); return 0; }
size_t PutEnd(Ch*) { RAPIDJSON_ASSERT(false); return 0; }
private:
EncodedOutputStream(const EncodedOutputStream&);
EncodedOutputStream& operator=(const EncodedOutputStream&);
OutputByteStream& os_;
};
#define RAPIDJSON_ENCODINGS_FUNC(x) UTF8<Ch>::x, UTF16LE<Ch>::x, UTF16BE<Ch>::x, UTF32LE<Ch>::x, UTF32BE<Ch>::x
//! Input stream wrapper with dynamically bound encoding and automatic encoding detection.
/*!
\tparam CharType Type of character for reading.
\tparam InputByteStream type of input byte stream to be wrapped.
*/
template <typename CharType, typename InputByteStream>
class AutoUTFInputStream {
RAPIDJSON_STATIC_ASSERT(sizeof(typename InputByteStream::Ch) == 1);
public:
typedef CharType Ch;
//! Constructor.
/*!
\param is input stream to be wrapped.
\param type UTF encoding type if it is not detected from the stream.
*/
AutoUTFInputStream(InputByteStream& is, UTFType type = kUTF8) : is_(&is), type_(type), hasBOM_(false) {
DetectType();
static const TakeFunc f[] = { RAPIDJSON_ENCODINGS_FUNC(Take) };
takeFunc_ = f[type_];
current_ = takeFunc_(*is_);
}
UTFType GetType() const { return type_; }
bool HasBOM() const { return hasBOM_; }
Ch Peek() const { return current_; }
Ch Take() { Ch c = current_; current_ = takeFunc_(*is_); return c; }
size_t Tell() const { return is_->Tell(); }
// Not implemented
void Put(Ch) { RAPIDJSON_ASSERT(false); }
void Flush() { RAPIDJSON_ASSERT(false); }
Ch* PutBegin() { RAPIDJSON_ASSERT(false); return 0; }
size_t PutEnd(Ch*) { RAPIDJSON_ASSERT(false); return 0; }
private:
AutoUTFInputStream(const AutoUTFInputStream&);
AutoUTFInputStream& operator=(const AutoUTFInputStream&);
// Detect encoding type with BOM or RFC 4627
void DetectType() {
// BOM (Byte Order Mark):
// 00 00 FE FF UTF-32BE
// FF FE 00 00 UTF-32LE
// FE FF UTF-16BE
// FF FE UTF-16LE
// EF BB BF UTF-8
const unsigned char* c = (const unsigned char *)is_->Peek4();
if (!c)
return;
unsigned bom = c[0] | (c[1] << 8) | (c[2] << 16) | (c[3] << 24);
hasBOM_ = false;
if (bom == 0xFFFE0000) { type_ = kUTF32BE; hasBOM_ = true; is_->Take(); is_->Take(); is_->Take(); is_->Take(); }
else if (bom == 0x0000FEFF) { type_ = kUTF32LE; hasBOM_ = true; is_->Take(); is_->Take(); is_->Take(); is_->Take(); }
else if ((bom & 0xFFFF) == 0xFFFE) { type_ = kUTF16BE; hasBOM_ = true; is_->Take(); is_->Take(); }
else if ((bom & 0xFFFF) == 0xFEFF) { type_ = kUTF16LE; hasBOM_ = true; is_->Take(); is_->Take(); }
else if ((bom & 0xFFFFFF) == 0xBFBBEF) { type_ = kUTF8; hasBOM_ = true; is_->Take(); is_->Take(); is_->Take(); }
// RFC 4627: Section 3
// "Since the first two characters of a JSON text will always be ASCII
// characters [RFC0020], it is possible to determine whether an octet
// stream is UTF-8, UTF-16 (BE or LE), or UTF-32 (BE or LE) by looking
// at the pattern of nulls in the first four octets."
// 00 00 00 xx UTF-32BE
// 00 xx 00 xx UTF-16BE
// xx 00 00 00 UTF-32LE
// xx 00 xx 00 UTF-16LE
// xx xx xx xx UTF-8
if (!hasBOM_) {
unsigned pattern = (c[0] ? 1 : 0) | (c[1] ? 2 : 0) | (c[2] ? 4 : 0) | (c[3] ? 8 : 0);
switch (pattern) {
case 0x08: type_ = kUTF32BE; break;
case 0x0A: type_ = kUTF16BE; break;
case 0x01: type_ = kUTF32LE; break;
case 0x05: type_ = kUTF16LE; break;
case 0x0F: type_ = kUTF8; break;
default: break; // Use type defined by user.
}
}
// Runtime check whether the size of character type is sufficient. It only perform checks with assertion.
switch (type_) {
case kUTF8:
// Do nothing
break;
case kUTF16LE:
case kUTF16BE:
RAPIDJSON_ASSERT(sizeof(Ch) >= 2);
break;
case kUTF32LE:
case kUTF32BE:
RAPIDJSON_ASSERT(sizeof(Ch) >= 4);
break;
default:
RAPIDJSON_ASSERT(false); // Invalid type
}
}
typedef Ch (*TakeFunc)(InputByteStream& is);
InputByteStream* is_;
UTFType type_;
Ch current_;
TakeFunc takeFunc_;
bool hasBOM_;
};
//! Output stream wrapper with dynamically bound encoding and automatic encoding detection.
/*!
\tparam CharType Type of character for writing.
\tparam InputByteStream type of output byte stream to be wrapped.
*/
template <typename CharType, typename OutputByteStream>
class AutoUTFOutputStream {
RAPIDJSON_STATIC_ASSERT(sizeof(typename OutputByteStream::Ch) == 1);
public:
typedef CharType Ch;
//! Constructor.
/*!
\param os output stream to be wrapped.
\param type UTF encoding type.
\param putBOM Whether to write BOM at the beginning of the stream.
*/
AutoUTFOutputStream(OutputByteStream& os, UTFType type, bool putBOM) : os_(&os), type_(type) {
// RUntime check whether the size of character type is sufficient. It only perform checks with assertion.
switch (type_) {
case kUTF16LE:
case kUTF16BE:
RAPIDJSON_ASSERT(sizeof(Ch) >= 2);
break;
case kUTF32LE:
case kUTF32BE:
RAPIDJSON_ASSERT(sizeof(Ch) >= 4);
break;
case kUTF8:
// Do nothing
break;
default:
RAPIDJSON_ASSERT(false); // Invalid UTFType
}
static const PutFunc f[] = { RAPIDJSON_ENCODINGS_FUNC(Put) };
putFunc_ = f[type_];
if (putBOM)
PutBOM();
}
UTFType GetType() const { return type_; }
void Put(Ch c) { putFunc_(*os_, c); }
void Flush() { os_->Flush(); }
// Not implemented
Ch Peek() const { RAPIDJSON_ASSERT(false); }
Ch Take() { RAPIDJSON_ASSERT(false); }
size_t Tell() const { RAPIDJSON_ASSERT(false); return 0; }
Ch* PutBegin() { RAPIDJSON_ASSERT(false); return 0; }
size_t PutEnd(Ch*) { RAPIDJSON_ASSERT(false); return 0; }
private:
AutoUTFOutputStream(const AutoUTFOutputStream&);
AutoUTFOutputStream& operator=(const AutoUTFOutputStream&);
void PutBOM() {
typedef void (*PutBOMFunc)(OutputByteStream&);
static const PutBOMFunc f[] = { RAPIDJSON_ENCODINGS_FUNC(PutBOM) };
f[type_](*os_);
}
typedef void (*PutFunc)(OutputByteStream&, Ch);
OutputByteStream* os_;
UTFType type_;
PutFunc putFunc_;
};
#undef RAPIDJSON_ENCODINGS_FUNC
} // namespace rapidjson
#ifdef __GNUC__
RAPIDJSON_DIAG_POP
#endif
#endif // RAPIDJSON_FILESTREAM_H_
+610
View File
@@ -0,0 +1,610 @@
#ifndef RAPIDJSON_ENCODINGS_H_
#define RAPIDJSON_ENCODINGS_H_
#include "rapidjson.h"
#ifdef _MSC_VER
RAPIDJSON_DIAG_PUSH
RAPIDJSON_DIAG_OFF(4244) // conversion from 'type1' to 'type2', possible loss of data
RAPIDJSON_DIAG_OFF(4702) // unreachable code
#elif defined(__GNUC__)
RAPIDJSON_DIAG_PUSH
RAPIDJSON_DIAG_OFF(effc++)
#endif
namespace rapidjson {
///////////////////////////////////////////////////////////////////////////////
// Encoding
/*! \class rapidjson::Encoding
\brief Concept for encoding of Unicode characters.
\code
concept Encoding {
typename Ch; //! Type of character. A "character" is actually a code unit in unicode's definition.
enum { supportUnicode = 1 }; // or 0 if not supporting unicode
//! \brief Encode a Unicode codepoint to an output stream.
//! \param os Output stream.
//! \param codepoint An unicode codepoint, ranging from 0x0 to 0x10FFFF inclusively.
template<typename OutputStream>
static void Encode(OutputStream& os, unsigned codepoint);
//! \brief Decode a Unicode codepoint from an input stream.
//! \param is Input stream.
//! \param codepoint Output of the unicode codepoint.
//! \return true if a valid codepoint can be decoded from the stream.
template <typename InputStream>
static bool Decode(InputStream& is, unsigned* codepoint);
//! \brief Validate one Unicode codepoint from an encoded stream.
//! \param is Input stream to obtain codepoint.
//! \param os Output for copying one codepoint.
//! \return true if it is valid.
//! \note This function just validating and copying the codepoint without actually decode it.
template <typename InputStream, typename OutputStream>
static bool Validate(InputStream& is, OutputStream& os);
// The following functions are deal with byte streams.
//! Take a character from input byte stream, skip BOM if exist.
template <typename InputByteStream>
static CharType TakeBOM(InputByteStream& is);
//! Take a character from input byte stream.
template <typename InputByteStream>
static Ch Take(InputByteStream& is);
//! Put BOM to output byte stream.
template <typename OutputByteStream>
static void PutBOM(OutputByteStream& os);
//! Put a character to output byte stream.
template <typename OutputByteStream>
static void Put(OutputByteStream& os, Ch c);
};
\endcode
*/
///////////////////////////////////////////////////////////////////////////////
// UTF8
//! UTF-8 encoding.
/*! http://en.wikipedia.org/wiki/UTF-8
http://tools.ietf.org/html/rfc3629
\tparam CharType Code unit for storing 8-bit UTF-8 data. Default is char.
\note implements Encoding concept
*/
template<typename CharType = char>
struct UTF8 {
typedef CharType Ch;
enum { supportUnicode = 1 };
template<typename OutputStream>
static void Encode(OutputStream& os, unsigned codepoint) {
if (codepoint <= 0x7F)
os.Put(static_cast<Ch>(codepoint & 0xFF));
else if (codepoint <= 0x7FF) {
os.Put(static_cast<Ch>(0xC0 | ((codepoint >> 6) & 0xFF)));
os.Put(static_cast<Ch>(0x80 | ((codepoint & 0x3F))));
}
else if (codepoint <= 0xFFFF) {
os.Put(static_cast<Ch>(0xE0 | ((codepoint >> 12) & 0xFF)));
os.Put(static_cast<Ch>(0x80 | ((codepoint >> 6) & 0x3F)));
os.Put(static_cast<Ch>(0x80 | (codepoint & 0x3F)));
}
else {
RAPIDJSON_ASSERT(codepoint <= 0x10FFFF);
os.Put(static_cast<Ch>(0xF0 | ((codepoint >> 18) & 0xFF)));
os.Put(static_cast<Ch>(0x80 | ((codepoint >> 12) & 0x3F)));
os.Put(static_cast<Ch>(0x80 | ((codepoint >> 6) & 0x3F)));
os.Put(static_cast<Ch>(0x80 | (codepoint & 0x3F)));
}
}
template <typename InputStream>
static bool Decode(InputStream& is, unsigned* codepoint) {
#define COPY() c = is.Take(); *codepoint = (*codepoint << 6) | ((unsigned char)c & 0x3Fu)
#define TRANS(mask) result &= ((GetRange((unsigned char)c) & mask) != 0)
#define TAIL() COPY(); TRANS(0x70)
Ch c = is.Take();
if (!(c & 0x80)) {
*codepoint = (unsigned char)c;
return true;
}
unsigned char type = GetRange((unsigned char)c);
*codepoint = (0xFF >> type) & (unsigned char)c;
bool result = true;
switch (type) {
case 2: TAIL(); return result;
case 3: TAIL(); TAIL(); return result;
case 4: COPY(); TRANS(0x50); TAIL(); return result;
case 5: COPY(); TRANS(0x10); TAIL(); TAIL(); return result;
case 6: TAIL(); TAIL(); TAIL(); return result;
case 10: COPY(); TRANS(0x20); TAIL(); return result;
case 11: COPY(); TRANS(0x60); TAIL(); TAIL(); return result;
default: return false;
}
#undef COPY
#undef TRANS
#undef TAIL
}
template <typename InputStream, typename OutputStream>
static bool Validate(InputStream& is, OutputStream& os) {
#define COPY() os.Put(c = is.Take())
#define TRANS(mask) result &= ((GetRange((unsigned char)c) & mask) != 0)
#define TAIL() COPY(); TRANS(0x70)
Ch c;
COPY();
if (!(c & 0x80))
return true;
bool result = true;
switch (GetRange((unsigned char)c)) {
case 2: TAIL(); return result;
case 3: TAIL(); TAIL(); return result;
case 4: COPY(); TRANS(0x50); TAIL(); return result;
case 5: COPY(); TRANS(0x10); TAIL(); TAIL(); return result;
case 6: TAIL(); TAIL(); TAIL(); return result;
case 10: COPY(); TRANS(0x20); TAIL(); return result;
case 11: COPY(); TRANS(0x60); TAIL(); TAIL(); return result;
default: return false;
}
#undef COPY
#undef TRANS
#undef TAIL
}
static unsigned char GetRange(unsigned char c) {
// Referring to DFA of http://bjoern.hoehrmann.de/utf-8/decoder/dfa/
// With new mapping 1 -> 0x10, 7 -> 0x20, 9 -> 0x40, such that AND operation can test multiple types.
static const unsigned char type[] = {
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,
0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,
0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,
0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,
8,8,2,2,2,2,2,2,2,2,2,2,2,2,2,2, 2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,
10,3,3,3,3,3,3,3,3,3,3,3,3,4,3,3, 11,6,6,6,5,8,8,8,8,8,8,8,8,8,8,8,
};
return type[c];
}
template <typename InputByteStream>
static CharType TakeBOM(InputByteStream& is) {
RAPIDJSON_STATIC_ASSERT(sizeof(typename InputByteStream::Ch) == 1);
Ch c = Take(is);
if ((unsigned char)c != 0xEFu) return c;
c = is.Take();
if ((unsigned char)c != 0xBBu) return c;
c = is.Take();
if ((unsigned char)c != 0xBFu) return c;
c = is.Take();
return c;
}
template <typename InputByteStream>
static Ch Take(InputByteStream& is) {
RAPIDJSON_STATIC_ASSERT(sizeof(typename InputByteStream::Ch) == 1);
return is.Take();
}
template <typename OutputByteStream>
static void PutBOM(OutputByteStream& os) {
RAPIDJSON_STATIC_ASSERT(sizeof(typename OutputByteStream::Ch) == 1);
os.Put(0xEFu); os.Put(0xBBu); os.Put(0xBFu);
}
template <typename OutputByteStream>
static void Put(OutputByteStream& os, Ch c) {
RAPIDJSON_STATIC_ASSERT(sizeof(typename OutputByteStream::Ch) == 1);
os.Put(static_cast<typename OutputByteStream::Ch>(c));
}
};
///////////////////////////////////////////////////////////////////////////////
// UTF16
//! UTF-16 encoding.
/*! http://en.wikipedia.org/wiki/UTF-16
http://tools.ietf.org/html/rfc2781
\tparam CharType Type for storing 16-bit UTF-16 data. Default is wchar_t. C++11 may use char16_t instead.
\note implements Encoding concept
\note For in-memory access, no need to concern endianness. The code units and code points are represented by CPU's endianness.
For streaming, use UTF16LE and UTF16BE, which handle endianness.
*/
template<typename CharType = wchar_t>
struct UTF16 {
typedef CharType Ch;
RAPIDJSON_STATIC_ASSERT(sizeof(Ch) >= 2);
enum { supportUnicode = 1 };
template<typename OutputStream>
static void Encode(OutputStream& os, unsigned codepoint) {
RAPIDJSON_STATIC_ASSERT(sizeof(typename OutputStream::Ch) >= 2);
if (codepoint <= 0xFFFF) {
RAPIDJSON_ASSERT(codepoint < 0xD800 || codepoint > 0xDFFF); // Code point itself cannot be surrogate pair
os.Put(static_cast<typename OutputStream::Ch>(codepoint));
}
else {
RAPIDJSON_ASSERT(codepoint <= 0x10FFFF);
unsigned v = codepoint - 0x10000;
os.Put(static_cast<typename OutputStream::Ch>((v >> 10) | 0xD800));
os.Put((v & 0x3FF) | 0xDC00);
}
}
template <typename InputStream>
static bool Decode(InputStream& is, unsigned* codepoint) {
RAPIDJSON_STATIC_ASSERT(sizeof(typename InputStream::Ch) >= 2);
Ch c = is.Take();
if (c < 0xD800 || c > 0xDFFF) {
*codepoint = c;
return true;
}
else if (c <= 0xDBFF) {
*codepoint = (c & 0x3FF) << 10;
c = is.Take();
*codepoint |= (c & 0x3FF);
*codepoint += 0x10000;
return c >= 0xDC00 && c <= 0xDFFF;
}
return false;
}
template <typename InputStream, typename OutputStream>
static bool Validate(InputStream& is, OutputStream& os) {
RAPIDJSON_STATIC_ASSERT(sizeof(typename InputStream::Ch) >= 2);
RAPIDJSON_STATIC_ASSERT(sizeof(typename OutputStream::Ch) >= 2);
Ch c;
os.Put(c = is.Take());
if (c < 0xD800 || c > 0xDFFF)
return true;
else if (c <= 0xDBFF) {
os.Put(c = is.Take());
return c >= 0xDC00 && c <= 0xDFFF;
}
return false;
}
};
//! UTF-16 little endian encoding.
template<typename CharType = wchar_t>
struct UTF16LE : UTF16<CharType> {
template <typename InputByteStream>
static CharType TakeBOM(InputByteStream& is) {
RAPIDJSON_STATIC_ASSERT(sizeof(typename InputByteStream::Ch) == 1);
CharType c = Take(is);
return (unsigned short)c == 0xFEFFu ? Take(is) : c;
}
template <typename InputByteStream>
static CharType Take(InputByteStream& is) {
RAPIDJSON_STATIC_ASSERT(sizeof(typename InputByteStream::Ch) == 1);
CharType c = (unsigned char)is.Take();
c |= (unsigned char)is.Take() << 8;
return c;
}
template <typename OutputByteStream>
static void PutBOM(OutputByteStream& os) {
RAPIDJSON_STATIC_ASSERT(sizeof(typename OutputByteStream::Ch) == 1);
os.Put(0xFFu); os.Put(0xFEu);
}
template <typename OutputByteStream>
static void Put(OutputByteStream& os, CharType c) {
RAPIDJSON_STATIC_ASSERT(sizeof(typename OutputByteStream::Ch) == 1);
os.Put(c & 0xFFu);
os.Put((c >> 8) & 0xFFu);
}
};
//! UTF-16 big endian encoding.
template<typename CharType = wchar_t>
struct UTF16BE : UTF16<CharType> {
template <typename InputByteStream>
static CharType TakeBOM(InputByteStream& is) {
RAPIDJSON_STATIC_ASSERT(sizeof(typename InputByteStream::Ch) == 1);
CharType c = Take(is);
return (unsigned short)c == 0xFEFFu ? Take(is) : c;
}
template <typename InputByteStream>
static CharType Take(InputByteStream& is) {
RAPIDJSON_STATIC_ASSERT(sizeof(typename InputByteStream::Ch) == 1);
CharType c = (unsigned char)is.Take() << 8;
c |= (unsigned char)is.Take();
return c;
}
template <typename OutputByteStream>
static void PutBOM(OutputByteStream& os) {
RAPIDJSON_STATIC_ASSERT(sizeof(typename OutputByteStream::Ch) == 1);
os.Put(0xFEu); os.Put(0xFFu);
}
template <typename OutputByteStream>
static void Put(OutputByteStream& os, CharType c) {
RAPIDJSON_STATIC_ASSERT(sizeof(typename OutputByteStream::Ch) == 1);
os.Put((c >> 8) & 0xFFu);
os.Put(c & 0xFFu);
}
};
///////////////////////////////////////////////////////////////////////////////
// UTF32
//! UTF-32 encoding.
/*! http://en.wikipedia.org/wiki/UTF-32
\tparam CharType Type for storing 32-bit UTF-32 data. Default is unsigned. C++11 may use char32_t instead.
\note implements Encoding concept
\note For in-memory access, no need to concern endianness. The code units and code points are represented by CPU's endianness.
For streaming, use UTF32LE and UTF32BE, which handle endianness.
*/
template<typename CharType = unsigned>
struct UTF32 {
typedef CharType Ch;
RAPIDJSON_STATIC_ASSERT(sizeof(Ch) >= 4);
enum { supportUnicode = 1 };
template<typename OutputStream>
static void Encode(OutputStream& os, unsigned codepoint) {
RAPIDJSON_STATIC_ASSERT(sizeof(typename OutputStream::Ch) >= 4);
RAPIDJSON_ASSERT(codepoint <= 0x10FFFF);
os.Put(codepoint);
}
template <typename InputStream>
static bool Decode(InputStream& is, unsigned* codepoint) {
RAPIDJSON_STATIC_ASSERT(sizeof(typename InputStream::Ch) >= 4);
Ch c = is.Take();
*codepoint = c;
return c <= 0x10FFFF;
}
template <typename InputStream, typename OutputStream>
static bool Validate(InputStream& is, OutputStream& os) {
RAPIDJSON_STATIC_ASSERT(sizeof(typename InputStream::Ch) >= 4);
Ch c;
os.Put(c = is.Take());
return c <= 0x10FFFF;
}
};
//! UTF-32 little endian enocoding.
template<typename CharType = unsigned>
struct UTF32LE : UTF32<CharType> {
template <typename InputByteStream>
static CharType TakeBOM(InputByteStream& is) {
RAPIDJSON_STATIC_ASSERT(sizeof(typename InputByteStream::Ch) == 1);
CharType c = Take(is);
return (unsigned)c == 0x0000FEFFu ? Take(is) : c;
}
template <typename InputByteStream>
static CharType Take(InputByteStream& is) {
RAPIDJSON_STATIC_ASSERT(sizeof(typename InputByteStream::Ch) == 1);
CharType c = (unsigned char)is.Take();
c |= (unsigned char)is.Take() << 8;
c |= (unsigned char)is.Take() << 16;
c |= (unsigned char)is.Take() << 24;
return c;
}
template <typename OutputByteStream>
static void PutBOM(OutputByteStream& os) {
RAPIDJSON_STATIC_ASSERT(sizeof(typename OutputByteStream::Ch) == 1);
os.Put(0xFFu); os.Put(0xFEu); os.Put(0x00u); os.Put(0x00u);
}
template <typename OutputByteStream>
static void Put(OutputByteStream& os, CharType c) {
RAPIDJSON_STATIC_ASSERT(sizeof(typename OutputByteStream::Ch) == 1);
os.Put(c & 0xFFu);
os.Put((c >> 8) & 0xFFu);
os.Put((c >> 16) & 0xFFu);
os.Put((c >> 24) & 0xFFu);
}
};
//! UTF-32 big endian encoding.
template<typename CharType = unsigned>
struct UTF32BE : UTF32<CharType> {
template <typename InputByteStream>
static CharType TakeBOM(InputByteStream& is) {
RAPIDJSON_STATIC_ASSERT(sizeof(typename InputByteStream::Ch) == 1);
CharType c = Take(is);
return (unsigned)c == 0x0000FEFFu ? Take(is) : c;
}
template <typename InputByteStream>
static CharType Take(InputByteStream& is) {
RAPIDJSON_STATIC_ASSERT(sizeof(typename InputByteStream::Ch) == 1);
CharType c = (unsigned char)is.Take() << 24;
c |= (unsigned char)is.Take() << 16;
c |= (unsigned char)is.Take() << 8;
c |= (unsigned char)is.Take();
return c;
}
template <typename OutputByteStream>
static void PutBOM(OutputByteStream& os) {
RAPIDJSON_STATIC_ASSERT(sizeof(typename OutputByteStream::Ch) == 1);
os.Put(0x00u); os.Put(0x00u); os.Put(0xFEu); os.Put(0xFFu);
}
template <typename OutputByteStream>
static void Put(OutputByteStream& os, CharType c) {
RAPIDJSON_STATIC_ASSERT(sizeof(typename OutputByteStream::Ch) == 1);
os.Put((c >> 24) & 0xFFu);
os.Put((c >> 16) & 0xFFu);
os.Put((c >> 8) & 0xFFu);
os.Put(c & 0xFFu);
}
};
///////////////////////////////////////////////////////////////////////////////
// ASCII
//! ASCII encoding.
/*! http://en.wikipedia.org/wiki/ASCII
\tparam CharType Code unit for storing 7-bit ASCII data. Default is char.
\note implements Encoding concept
*/
template<typename CharType = char>
struct ASCII {
typedef CharType Ch;
enum { supportUnicode = 0 };
template<typename OutputStream>
static void Encode(OutputStream& os, unsigned codepoint) {
RAPIDJSON_ASSERT(codepoint <= 0x7F);
os.Put(static_cast<Ch>(codepoint & 0xFF));
}
template <typename InputStream>
static bool Decode(InputStream& is, unsigned* codepoint) {
unsigned char c = static_cast<unsigned char>(is.Take());
*codepoint = c;
return c <= 0X7F;
}
template <typename InputStream, typename OutputStream>
static bool Validate(InputStream& is, OutputStream& os) {
unsigned char c = is.Take();
os.Put(c);
return c <= 0x7F;
}
template <typename InputByteStream>
static CharType TakeBOM(InputByteStream& is) {
RAPIDJSON_STATIC_ASSERT(sizeof(typename InputByteStream::Ch) == 1);
Ch c = Take(is);
return c;
}
template <typename InputByteStream>
static Ch Take(InputByteStream& is) {
RAPIDJSON_STATIC_ASSERT(sizeof(typename InputByteStream::Ch) == 1);
return is.Take();
}
template <typename OutputByteStream>
static void PutBOM(OutputByteStream& os) {
RAPIDJSON_STATIC_ASSERT(sizeof(typename OutputByteStream::Ch) == 1);
(void)os;
}
template <typename OutputByteStream>
static void Put(OutputByteStream& os, Ch c) {
RAPIDJSON_STATIC_ASSERT(sizeof(typename OutputByteStream::Ch) == 1);
os.Put(static_cast<typename OutputByteStream::Ch>(c));
}
};
///////////////////////////////////////////////////////////////////////////////
// AutoUTF
//! Runtime-specified UTF encoding type of a stream.
enum UTFType {
kUTF8 = 0, //!< UTF-8.
kUTF16LE = 1, //!< UTF-16 little endian.
kUTF16BE = 2, //!< UTF-16 big endian.
kUTF32LE = 3, //!< UTF-32 little endian.
kUTF32BE = 4 //!< UTF-32 big endian.
};
//! Dynamically select encoding according to stream's runtime-specified UTF encoding type.
/*! \note This class can be used with AutoUTFInputtStream and AutoUTFOutputStream, which provides GetType().
*/
template<typename CharType>
struct AutoUTF {
typedef CharType Ch;
enum { supportUnicode = 1 };
#define RAPIDJSON_ENCODINGS_FUNC(x) UTF8<Ch>::x, UTF16LE<Ch>::x, UTF16BE<Ch>::x, UTF32LE<Ch>::x, UTF32BE<Ch>::x
template<typename OutputStream>
RAPIDJSON_FORCEINLINE static void Encode(OutputStream& os, unsigned codepoint) {
typedef void (*EncodeFunc)(OutputStream&, unsigned);
static const EncodeFunc f[] = { RAPIDJSON_ENCODINGS_FUNC(Encode) };
(*f[os.GetType()])(os, codepoint);
}
template <typename InputStream>
RAPIDJSON_FORCEINLINE static bool Decode(InputStream& is, unsigned* codepoint) {
typedef bool (*DecodeFunc)(InputStream&, unsigned*);
static const DecodeFunc f[] = { RAPIDJSON_ENCODINGS_FUNC(Decode) };
return (*f[is.GetType()])(is, codepoint);
}
template <typename InputStream, typename OutputStream>
RAPIDJSON_FORCEINLINE static bool Validate(InputStream& is, OutputStream& os) {
typedef bool (*ValidateFunc)(InputStream&, OutputStream&);
static const ValidateFunc f[] = { RAPIDJSON_ENCODINGS_FUNC(Validate) };
return (*f[is.GetType()])(is, os);
}
#undef RAPIDJSON_ENCODINGS_FUNC
};
///////////////////////////////////////////////////////////////////////////////
// Transcoder
//! Encoding conversion.
template<typename SourceEncoding, typename TargetEncoding>
struct Transcoder {
//! Take one Unicode codepoint from source encoding, convert it to target encoding and put it to the output stream.
template<typename InputStream, typename OutputStream>
RAPIDJSON_FORCEINLINE static bool Transcode(InputStream& is, OutputStream& os) {
unsigned codepoint;
if (!SourceEncoding::Decode(is, &codepoint))
return false;
TargetEncoding::Encode(os, codepoint);
return true;
}
//! Validate one Unicode codepoint from an encoded stream.
template<typename InputStream, typename OutputStream>
RAPIDJSON_FORCEINLINE static bool Validate(InputStream& is, OutputStream& os) {
return Transcode(is, os); // Since source/target encoding is different, must transcode.
}
};
//! Specialization of Transcoder with same source and target encoding.
template<typename Encoding>
struct Transcoder<Encoding, Encoding> {
template<typename InputStream, typename OutputStream>
RAPIDJSON_FORCEINLINE static bool Transcode(InputStream& is, OutputStream& os) {
os.Put(is.Take()); // Just copy one code unit. This semantic is different from primary template class.
return true;
}
template<typename InputStream, typename OutputStream>
RAPIDJSON_FORCEINLINE static bool Validate(InputStream& is, OutputStream& os) {
return Encoding::Validate(is, os); // source/target encoding are the same
}
};
} // namespace rapidjson
#if defined(__GNUC__) || defined(_MSV_VER)
RAPIDJSON_DIAG_POP
#endif
#endif // RAPIDJSON_ENCODINGS_H_
+52
View File
@@ -0,0 +1,52 @@
#ifndef RAPIDJSON_ERROR_EN_H__
#define RAPIDJSON_ERROR_EN_H__
#include "error.h"
namespace rapidjson {
//! Maps error code of parsing into error message.
/*!
\param parseErrorCode Error code obtained in parsing.
\return the error message.
\note User can make a copy of this function for localization.
Using switch-case is safer for future modification of error codes.
*/
inline const RAPIDJSON_ERROR_CHARTYPE* GetParseError_En(ParseErrorCode parseErrorCode) {
switch (parseErrorCode) {
case kParseErrorNone: return RAPIDJSON_ERROR_STRING("No error.");
case kParseErrorDocumentEmpty: return RAPIDJSON_ERROR_STRING("The document is empty.");
case kParseErrorDocumentRootNotObjectOrArray: return RAPIDJSON_ERROR_STRING("The document root must be either object or array.");
case kParseErrorDocumentRootNotSingular: return RAPIDJSON_ERROR_STRING("The document root must not follow by other values.");
case kParseErrorValueInvalid: return RAPIDJSON_ERROR_STRING("Invalid value.");
case kParseErrorObjectMissName: return RAPIDJSON_ERROR_STRING("Missing a name for object member.");
case kParseErrorObjectMissColon: return RAPIDJSON_ERROR_STRING("Missing a colon after a name of object member.");
case kParseErrorObjectMissCommaOrCurlyBracket: return RAPIDJSON_ERROR_STRING("Missing a comma or '}' after an object member.");
case kParseErrorArrayMissCommaOrSquareBracket: return RAPIDJSON_ERROR_STRING("Missing a comma or ']' after an array element.");
case kParseErrorStringUnicodeEscapeInvalidHex: return RAPIDJSON_ERROR_STRING("Incorrect hex digit after \\u escape in string.");
case kParseErrorStringUnicodeSurrogateInvalid: return RAPIDJSON_ERROR_STRING("The surrogate pair in string is invalid.");
case kParseErrorStringEscapeInvalid: return RAPIDJSON_ERROR_STRING("Invalid escape character in string.");
case kParseErrorStringMissQuotationMark: return RAPIDJSON_ERROR_STRING("Missing a closing quotation mark in string.");
case kParseErrorStringInvalidEncoding: return RAPIDJSON_ERROR_STRING("Invalid encoding in string.");
case kParseErrorNumberTooBig: return RAPIDJSON_ERROR_STRING("Number too big to be stored in double.");
case kParseErrorNumberMissFraction: return RAPIDJSON_ERROR_STRING("Miss fraction part in number.");
case kParseErrorNumberMissExponent: return RAPIDJSON_ERROR_STRING("Miss exponent in number.");
case kParseErrorTermination: return RAPIDJSON_ERROR_STRING("Terminate parsing due to Handler error.");
case kParseErrorUnspecificSyntaxError: return RAPIDJSON_ERROR_STRING("Unspecific syntax error.");
case kParseErrorStackSizeLimitExceeded: return RAPIDJSON_ERROR_STRING("Parsing stack size limit is exceeded.");
default:
return RAPIDJSON_ERROR_STRING("Unknown error.");
}
}
} // namespace rapidjson
#endif // RAPIDJSON_ERROR_EN_H__
+124
View File
@@ -0,0 +1,124 @@
#ifndef RAPIDJSON_ERROR_ERROR_H__
#define RAPIDJSON_ERROR_ERROR_H__
///////////////////////////////////////////////////////////////////////////////
// RAPIDJSON_ERROR_CHARTYPE
//! Character type of error messages.
/*! The default charater type is char.
On Windows, user can define this macro as TCHAR for supporting both
unicode/non-unicode settings.
*/
#ifndef RAPIDJSON_ERROR_CHARTYPE
#define RAPIDJSON_ERROR_CHARTYPE char
#endif
///////////////////////////////////////////////////////////////////////////////
// RAPIDJSON_ERROR_STRING
//! Macro for converting string literial to RAPIDJSON_ERROR_CHARTYPE[].
/*! By default this conversion macro does nothing.
On Windows, user can define this macro as _T(x) for supporting both
unicode/non-unicode settings.
*/
#ifndef RAPIDJSON_ERROR_STRING
#define RAPIDJSON_ERROR_STRING(x) x
#endif
namespace rapidjson {
///////////////////////////////////////////////////////////////////////////////
// ParseErrorCode
//! Error code of parsing.
/*! \see GenericReader::Parse, GenericReader::GetParseErrorCode
*/
enum ParseErrorCode {
kParseErrorNone = 0, //!< No error.
kParseErrorDocumentEmpty, //!< The document is empty.
kParseErrorDocumentRootNotObjectOrArray, //!< The document root must be either object or array.
kParseErrorDocumentRootNotSingular, //!< The document root must not follow by other values.
kParseErrorValueInvalid, //!< Invalid value.
kParseErrorObjectMissName, //!< Missing a name for object member.
kParseErrorObjectMissColon, //!< Missing a colon after a name of object member.
kParseErrorObjectMissCommaOrCurlyBracket, //!< Missing a comma or '}' after an object member.
kParseErrorArrayMissCommaOrSquareBracket, //!< Missing a comma or ']' after an array element.
kParseErrorStringUnicodeEscapeInvalidHex, //!< Incorrect hex digit after \\u escape in string.
kParseErrorStringUnicodeSurrogateInvalid, //!< The surrogate pair in string is invalid.
kParseErrorStringEscapeInvalid, //!< Invalid escape character in string.
kParseErrorStringMissQuotationMark, //!< Missing a closing quotation mark in string.
kParseErrorStringInvalidEncoding, //!< Invalid encoding in string.
kParseErrorNumberTooBig, //!< Number too big to be stored in double.
kParseErrorNumberMissFraction, //!< Miss fraction part in number.
kParseErrorNumberMissExponent, //!< Miss exponent in number.
kParseErrorTermination, //!< Parsing was terminated.
kParseErrorUnspecificSyntaxError, //!< Unspecific syntax error.
kParseErrorStackSizeLimitExceeded //!< Parsing stack size limit is exceeded.
};
//! Result of parsing (wraps ParseErrorCode)
/*!
\code
Document doc;
ParseResult ok = doc.Parse("[42]");
if (!ok) {
fprintf(stderr, "JSON parse error: %s (%u)",
GetParseError_En(ok.Code()), ok.Offset());
exit(EXIT_FAILURE);
}
\endcode
\see GenericReader::Parse, GenericDocument::Parse
*/
struct ParseResult {
//! Default constructor, no error.
ParseResult() : code_(kParseErrorNone), offset_(0) {}
//! Constructor to set an error.
ParseResult(ParseErrorCode code, size_t offset) : code_(code), offset_(offset) {}
//! Get the error code.
ParseErrorCode Code() const { return code_; }
//! Get the error offset, if \ref IsError(), 0 otherwise.
size_t Offset() const { return offset_; }
//! Conversion to \c bool, returns \c true, iff !\ref IsError().
operator bool() const { return !IsError(); }
//! Whether the result is an error.
bool IsError() const { return code_ != kParseErrorNone; }
bool operator==(const ParseResult& that) const { return code_ == that.code_; }
bool operator==(ParseErrorCode code) const { return code_ == code; }
friend bool operator==(ParseErrorCode code, const ParseResult & err) { return code == err.code_; }
//! Reset error code.
void Clear() { Set(kParseErrorNone); }
//! Update error code and offset.
void Set(ParseErrorCode code, size_t offset = 0) { code_ = code; offset_ = offset; }
private:
ParseErrorCode code_;
size_t offset_;
};
//! Function pointer type of GetParseError().
/*! This is the prototype for GetParseError_X(), where X is a locale.
User can dynamically change locale in runtime, e.g.:
\code
GetParseErrorFunc GetParseError = GetParseError_En; // or whatever
const RAPIDJSON_ERROR_CHARTYPE* s = GetParseError(document.GetParseErrorCode());
\endcode
*/
typedef const RAPIDJSON_ERROR_CHARTYPE* (*GetParseErrorFunc)(ParseErrorCode);
} // namespace rapidjson
#endif // RAPIDJSON_ERROR_ERROR_H__
@@ -0,0 +1,74 @@
#ifndef RAPIDJSON_FILEREADSTREAM_H_
#define RAPIDJSON_FILEREADSTREAM_H_
#include "rapidjson.h"
#include <cstdio>
namespace rapidjson {
//! File byte stream for input using fread().
/*!
\note implements Stream concept
*/
class FileReadStream {
public:
typedef char Ch; //!< Character type (byte).
//! Constructor.
/*!
\param fp File pointer opened for read.
\param buffer user-supplied buffer.
\param bufferSize size of buffer in bytes. Must >=4 bytes.
*/
FileReadStream(FILE* fp, char* buffer, size_t bufferSize) : fp_(fp), buffer_(buffer), bufferSize_(bufferSize), bufferLast_(0), current_(buffer_), readCount_(0), count_(0), eof_(false) {
RAPIDJSON_ASSERT(fp_ != 0);
RAPIDJSON_ASSERT(bufferSize >= 4);
Read();
}
Ch Peek() const { return *current_; }
Ch Take() { Ch c = *current_; Read(); return c; }
size_t Tell() const { return count_ + static_cast<size_t>(current_ - buffer_); }
// Not implemented
void Put(Ch) { RAPIDJSON_ASSERT(false); }
void Flush() { RAPIDJSON_ASSERT(false); }
Ch* PutBegin() { RAPIDJSON_ASSERT(false); return 0; }
size_t PutEnd(Ch*) { RAPIDJSON_ASSERT(false); return 0; }
// For encoding detection only.
const Ch* Peek4() const {
return (current_ + 4 <= bufferLast_) ? current_ : 0;
}
private:
void Read() {
if (current_ < bufferLast_)
++current_;
else if (!eof_) {
count_ += readCount_;
readCount_ = fread(buffer_, 1, bufferSize_, fp_);
bufferLast_ = buffer_ + readCount_ - 1;
current_ = buffer_;
if (readCount_ < bufferSize_) {
buffer_[readCount_] = '\0';
++bufferLast_;
eof_ = true;
}
}
}
FILE* fp_;
Ch *buffer_;
size_t bufferSize_;
Ch *bufferLast_;
Ch *current_;
size_t readCount_;
size_t count_; //!< Number of characters read
bool eof_;
};
} // namespace rapidjson
#endif // RAPIDJSON_FILESTREAM_H_
+53
View File
@@ -0,0 +1,53 @@
#ifndef RAPIDJSON_FILESTREAM_H_
#define RAPIDJSON_FILESTREAM_H_
#include "rapidjson.h"
#include <cstdio>
namespace rapidjson {
//! (Depreciated) Wrapper of C file stream for input or output.
/*!
This simple wrapper does not check the validity of the stream.
\note implements Stream concept
\note deprecated: This was only for basic testing in version 0.1, it is found that the performance is very low by using fgetc(). Use FileReadStream instead.
*/
class FileStream {
public:
typedef char Ch; //!< Character type. Only support char.
FileStream(FILE* fp) : fp_(fp), current_('\0'), count_(0) { Read(); }
char Peek() const { return current_; }
char Take() { char c = current_; Read(); return c; }
size_t Tell() const { return count_; }
void Put(char c) { fputc(c, fp_); }
void Flush() { fflush(fp_); }
// Not implemented
char* PutBegin() { return 0; }
size_t PutEnd(char*) { return 0; }
private:
// Prohibit copy constructor & assignment operator.
FileStream(const FileStream&);
FileStream& operator=(const FileStream&);
void Read() {
RAPIDJSON_ASSERT(fp_ != 0);
int c = fgetc(fp_);
if (c != EOF) {
current_ = (char)c;
count_++;
}
else if (current_ != '\0')
current_ = '\0';
}
FILE* fp_;
char current_;
size_t count_;
};
} // namespace rapidjson
#endif // RAPIDJSON_FILESTREAM_H_
@@ -0,0 +1,77 @@
#ifndef RAPIDJSON_FILEWRITESTREAM_H_
#define RAPIDJSON_FILEWRITESTREAM_H_
#include "rapidjson.h"
#include <cstdio>
namespace rapidjson {
//! Wrapper of C file stream for input using fread().
/*!
\note implements Stream concept
*/
class FileWriteStream {
public:
typedef char Ch; //!< Character type. Only support char.
FileWriteStream(FILE* fp, char* buffer, size_t bufferSize) : fp_(fp), buffer_(buffer), bufferEnd_(buffer + bufferSize), current_(buffer_) {
RAPIDJSON_ASSERT(fp_ != 0);
}
void Put(char c) {
if (current_ >= bufferEnd_)
Flush();
*current_++ = c;
}
void PutN(char c, size_t n) {
size_t avail = static_cast<size_t>(bufferEnd_ - current_);
while (n > avail) {
memset(current_, c, avail);
current_ += avail;
Flush();
n -= avail;
avail = static_cast<size_t>(bufferEnd_ - current_);
}
if (n > 0) {
memset(current_, c, n);
current_ += n;
}
}
void Flush() {
if (current_ != buffer_) {
fwrite(buffer_, 1, static_cast<size_t>(current_ - buffer_), fp_);
current_ = buffer_;
}
}
// Not implemented
char Peek() const { RAPIDJSON_ASSERT(false); return 0; }
char Take() { RAPIDJSON_ASSERT(false); return 0; }
size_t Tell() const { RAPIDJSON_ASSERT(false); return 0; }
char* PutBegin() { RAPIDJSON_ASSERT(false); return 0; }
size_t PutEnd(char*) { RAPIDJSON_ASSERT(false); return 0; }
private:
// Prohibit copy constructor & assignment operator.
FileWriteStream(const FileWriteStream&);
FileWriteStream& operator=(const FileWriteStream&);
FILE* fp_;
char *buffer_;
char *bufferEnd_;
char *current_;
};
//! Implement specialized version of PutN() with memset() for better performance.
template<>
inline void PutN(FileWriteStream& stream, char c, size_t n) {
stream.PutN(c, n);
}
} // namespace rapidjson
#endif // RAPIDJSON_FILESTREAM_H_
@@ -0,0 +1,77 @@
#ifndef RAPIDJSON_INTERNAL_META_H_
#define RAPIDJSON_INTERNAL_META_H_
//@cond RAPIDJSON_INTERNAL
namespace rapidjson {
namespace internal {
template <int N> struct IntegralC { enum { Value = N }; };
template <bool Cond> struct BoolType : IntegralC<Cond> {};
struct TrueType : BoolType<true> {};
struct FalseType : BoolType<false> {};
template <typename T> struct AddConst { typedef const T Type; };
template <typename T> struct RemoveConst { typedef T Type; };
template <typename T> struct RemoveConst<const T> { typedef T Type; };
template <bool Condition, typename T1, typename T2> struct SelectIfCond;
template <typename T1, typename T2> struct SelectIfCond<true,T1,T2> { typedef T1 Type; };
template <typename T1, typename T2> struct SelectIfCond<false,T1,T2> { typedef T2 Type; };
template <typename Condition, typename T1, typename T2>
struct SelectIf : SelectIfCond<Condition::Value,T1,T2> {};
template <bool Constify, typename T>
struct MaybeAddConst : SelectIfCond<Constify, const T, T> {};
template <typename T, typename U> struct IsSame : FalseType {};
template <typename T> struct IsSame<T,T> : TrueType {};
template <typename T> struct IsConst : FalseType {};
template <typename T> struct IsConst<const T> : TrueType {};
template <typename T> struct IsPointer : FalseType {};
template <typename T> struct IsPointer<T*> : TrueType {};
template <typename CT, typename T>
struct IsMoreConst {
enum { Value =
( IsSame< typename RemoveConst<CT>::Type, typename RemoveConst<T>::Type>::Value
&& ( IsConst<CT>::Value >= IsConst<T>::Value ) )
};
};
template <bool Condition, typename T = void> struct EnableIfCond;
template <typename T> struct EnableIfCond<true, T> { typedef T Type; };
template <typename T> struct EnableIfCond<false, T> { /* empty */ };
template <bool Condition, typename T = void>
struct DisableIfCond : EnableIfCond<!Condition, T> {};
template <typename Condition, typename T = void>
struct EnableIf : EnableIfCond<Condition::Value, T> {};
template <typename Condition, typename T = void>
struct DisableIf : DisableIfCond<Condition::Value, T> {};
// SFINAE helpers
struct SfinaeResultTag {};
template <typename T> struct RemoveSfinaeFptr {};
template <typename T> struct RemoveSfinaeFptr<SfinaeResultTag&(*)(T)> { typedef T Type; };
#define RAPIDJSON_REMOVEFPTR_(type) \
typename ::rapidjson::internal::RemoveSfinaeFptr \
< ::rapidjson::internal::SfinaeResultTag&(*) type>::Type
#define RAPIDJSON_ENABLEIF(cond) \
typename ::rapidjson::internal::EnableIf \
<RAPIDJSON_REMOVEFPTR_(cond)>::Type * = NULL
#define RAPIDJSON_DISABLEIF_RETURN(cond,returntype) \
typename ::rapidjson::internal::DisableIf<cond,returntype>::Type
} // namespace internal
} // namespace rapidjson
//@endcond
#endif // RAPIDJSON_INTERNAL_META_H_
@@ -0,0 +1,54 @@
#ifndef RAPIDJSON_POW10_
#define RAPIDJSON_POW10_
namespace rapidjson {
namespace internal {
//! Computes integer powers of 10 in double (10.0^n).
/*! This function uses lookup table for fast and accurate results.
\param n positive/negative exponent. Must <= 308.
\return 10.0^n
*/
inline double Pow10(int n) {
static const double e[] = { // 1e-308...1e308: 617 * 8 bytes = 4936 bytes
1e-308,1e-307,1e-306,1e-305,1e-304,1e-303,1e-302,1e-301,1e-300,
1e-299,1e-298,1e-297,1e-296,1e-295,1e-294,1e-293,1e-292,1e-291,1e-290,1e-289,1e-288,1e-287,1e-286,1e-285,1e-284,1e-283,1e-282,1e-281,1e-280,
1e-279,1e-278,1e-277,1e-276,1e-275,1e-274,1e-273,1e-272,1e-271,1e-270,1e-269,1e-268,1e-267,1e-266,1e-265,1e-264,1e-263,1e-262,1e-261,1e-260,
1e-259,1e-258,1e-257,1e-256,1e-255,1e-254,1e-253,1e-252,1e-251,1e-250,1e-249,1e-248,1e-247,1e-246,1e-245,1e-244,1e-243,1e-242,1e-241,1e-240,
1e-239,1e-238,1e-237,1e-236,1e-235,1e-234,1e-233,1e-232,1e-231,1e-230,1e-229,1e-228,1e-227,1e-226,1e-225,1e-224,1e-223,1e-222,1e-221,1e-220,
1e-219,1e-218,1e-217,1e-216,1e-215,1e-214,1e-213,1e-212,1e-211,1e-210,1e-209,1e-208,1e-207,1e-206,1e-205,1e-204,1e-203,1e-202,1e-201,1e-200,
1e-199,1e-198,1e-197,1e-196,1e-195,1e-194,1e-193,1e-192,1e-191,1e-190,1e-189,1e-188,1e-187,1e-186,1e-185,1e-184,1e-183,1e-182,1e-181,1e-180,
1e-179,1e-178,1e-177,1e-176,1e-175,1e-174,1e-173,1e-172,1e-171,1e-170,1e-169,1e-168,1e-167,1e-166,1e-165,1e-164,1e-163,1e-162,1e-161,1e-160,
1e-159,1e-158,1e-157,1e-156,1e-155,1e-154,1e-153,1e-152,1e-151,1e-150,1e-149,1e-148,1e-147,1e-146,1e-145,1e-144,1e-143,1e-142,1e-141,1e-140,
1e-139,1e-138,1e-137,1e-136,1e-135,1e-134,1e-133,1e-132,1e-131,1e-130,1e-129,1e-128,1e-127,1e-126,1e-125,1e-124,1e-123,1e-122,1e-121,1e-120,
1e-119,1e-118,1e-117,1e-116,1e-115,1e-114,1e-113,1e-112,1e-111,1e-110,1e-109,1e-108,1e-107,1e-106,1e-105,1e-104,1e-103,1e-102,1e-101,1e-100,
1e-99, 1e-98, 1e-97, 1e-96, 1e-95, 1e-94, 1e-93, 1e-92, 1e-91, 1e-90, 1e-89, 1e-88, 1e-87, 1e-86, 1e-85, 1e-84, 1e-83, 1e-82, 1e-81, 1e-80,
1e-79, 1e-78, 1e-77, 1e-76, 1e-75, 1e-74, 1e-73, 1e-72, 1e-71, 1e-70, 1e-69, 1e-68, 1e-67, 1e-66, 1e-65, 1e-64, 1e-63, 1e-62, 1e-61, 1e-60,
1e-59, 1e-58, 1e-57, 1e-56, 1e-55, 1e-54, 1e-53, 1e-52, 1e-51, 1e-50, 1e-49, 1e-48, 1e-47, 1e-46, 1e-45, 1e-44, 1e-43, 1e-42, 1e-41, 1e-40,
1e-39, 1e-38, 1e-37, 1e-36, 1e-35, 1e-34, 1e-33, 1e-32, 1e-31, 1e-30, 1e-29, 1e-28, 1e-27, 1e-26, 1e-25, 1e-24, 1e-23, 1e-22, 1e-21, 1e-20,
1e-19, 1e-18, 1e-17, 1e-16, 1e-15, 1e-14, 1e-13, 1e-12, 1e-11, 1e-10, 1e-9, 1e-8, 1e-7, 1e-6, 1e-5, 1e-4, 1e-3, 1e-2, 1e-1, 1e+0,
1e+1, 1e+2, 1e+3, 1e+4, 1e+5, 1e+6, 1e+7, 1e+8, 1e+9, 1e+10, 1e+11, 1e+12, 1e+13, 1e+14, 1e+15, 1e+16, 1e+17, 1e+18, 1e+19, 1e+20,
1e+21, 1e+22, 1e+23, 1e+24, 1e+25, 1e+26, 1e+27, 1e+28, 1e+29, 1e+30, 1e+31, 1e+32, 1e+33, 1e+34, 1e+35, 1e+36, 1e+37, 1e+38, 1e+39, 1e+40,
1e+41, 1e+42, 1e+43, 1e+44, 1e+45, 1e+46, 1e+47, 1e+48, 1e+49, 1e+50, 1e+51, 1e+52, 1e+53, 1e+54, 1e+55, 1e+56, 1e+57, 1e+58, 1e+59, 1e+60,
1e+61, 1e+62, 1e+63, 1e+64, 1e+65, 1e+66, 1e+67, 1e+68, 1e+69, 1e+70, 1e+71, 1e+72, 1e+73, 1e+74, 1e+75, 1e+76, 1e+77, 1e+78, 1e+79, 1e+80,
1e+81, 1e+82, 1e+83, 1e+84, 1e+85, 1e+86, 1e+87, 1e+88, 1e+89, 1e+90, 1e+91, 1e+92, 1e+93, 1e+94, 1e+95, 1e+96, 1e+97, 1e+98, 1e+99, 1e+100,
1e+101,1e+102,1e+103,1e+104,1e+105,1e+106,1e+107,1e+108,1e+109,1e+110,1e+111,1e+112,1e+113,1e+114,1e+115,1e+116,1e+117,1e+118,1e+119,1e+120,
1e+121,1e+122,1e+123,1e+124,1e+125,1e+126,1e+127,1e+128,1e+129,1e+130,1e+131,1e+132,1e+133,1e+134,1e+135,1e+136,1e+137,1e+138,1e+139,1e+140,
1e+141,1e+142,1e+143,1e+144,1e+145,1e+146,1e+147,1e+148,1e+149,1e+150,1e+151,1e+152,1e+153,1e+154,1e+155,1e+156,1e+157,1e+158,1e+159,1e+160,
1e+161,1e+162,1e+163,1e+164,1e+165,1e+166,1e+167,1e+168,1e+169,1e+170,1e+171,1e+172,1e+173,1e+174,1e+175,1e+176,1e+177,1e+178,1e+179,1e+180,
1e+181,1e+182,1e+183,1e+184,1e+185,1e+186,1e+187,1e+188,1e+189,1e+190,1e+191,1e+192,1e+193,1e+194,1e+195,1e+196,1e+197,1e+198,1e+199,1e+200,
1e+201,1e+202,1e+203,1e+204,1e+205,1e+206,1e+207,1e+208,1e+209,1e+210,1e+211,1e+212,1e+213,1e+214,1e+215,1e+216,1e+217,1e+218,1e+219,1e+220,
1e+221,1e+222,1e+223,1e+224,1e+225,1e+226,1e+227,1e+228,1e+229,1e+230,1e+231,1e+232,1e+233,1e+234,1e+235,1e+236,1e+237,1e+238,1e+239,1e+240,
1e+241,1e+242,1e+243,1e+244,1e+245,1e+246,1e+247,1e+248,1e+249,1e+250,1e+251,1e+252,1e+253,1e+254,1e+255,1e+256,1e+257,1e+258,1e+259,1e+260,
1e+261,1e+262,1e+263,1e+264,1e+265,1e+266,1e+267,1e+268,1e+269,1e+270,1e+271,1e+272,1e+273,1e+274,1e+275,1e+276,1e+277,1e+278,1e+279,1e+280,
1e+281,1e+282,1e+283,1e+284,1e+285,1e+286,1e+287,1e+288,1e+289,1e+290,1e+291,1e+292,1e+293,1e+294,1e+295,1e+296,1e+297,1e+298,1e+299,1e+300,
1e+301,1e+302,1e+303,1e+304,1e+305,1e+306,1e+307,1e+308
};
RAPIDJSON_ASSERT(n <= 308);
return n < -308 ? 0.0 : e[n + 308];
}
} // namespace internal
} // namespace rapidjson
#endif // RAPIDJSON_POW10_
@@ -0,0 +1,87 @@
#ifndef RAPIDJSON_INTERNAL_STACK_H_
#define RAPIDJSON_INTERNAL_STACK_H_
namespace rapidjson {
namespace internal {
///////////////////////////////////////////////////////////////////////////////
// Stack
//! A type-unsafe stack for storing different types of data.
/*! \tparam Allocator Allocator for allocating stack memory.
*/
template <typename Allocator>
class Stack {
public:
Stack(Allocator* allocator, size_t stack_capacity) : allocator_(allocator), own_allocator_(0), stack_(0), stack_top_(0), stack_end_(0), stack_capacity_(stack_capacity) {
RAPIDJSON_ASSERT(stack_capacity_ > 0);
if (!allocator_)
own_allocator_ = allocator_ = new Allocator();
stack_top_ = stack_ = (char*)allocator_->Malloc(stack_capacity_);
stack_end_ = stack_ + stack_capacity_;
}
~Stack() {
Allocator::Free(stack_);
delete own_allocator_; // Only delete if it is owned by the stack
}
void Clear() { /*stack_top_ = 0;*/ stack_top_ = stack_; }
template<typename T>
T* Push(size_t count = 1) {
// Expand the stack if needed
if (stack_top_ + sizeof(T) * count >= stack_end_) {
size_t new_capacity = stack_capacity_ * 2;
size_t size = GetSize();
size_t new_size = GetSize() + sizeof(T) * count;
if (new_capacity < new_size)
new_capacity = new_size;
stack_ = (char*)allocator_->Realloc(stack_, stack_capacity_, new_capacity);
stack_capacity_ = new_capacity;
stack_top_ = stack_ + size;
stack_end_ = stack_ + stack_capacity_;
}
T* ret = reinterpret_cast<T*>(stack_top_);
stack_top_ += sizeof(T) * count;
return ret;
}
template<typename T>
T* Pop(size_t count) {
RAPIDJSON_ASSERT(GetSize() >= count * sizeof(T));
stack_top_ -= count * sizeof(T);
return reinterpret_cast<T*>(stack_top_);
}
template<typename T>
T* Top() {
RAPIDJSON_ASSERT(GetSize() >= sizeof(T));
return reinterpret_cast<T*>(stack_top_ - sizeof(T));
}
template<typename T>
T* Bottom() { return (T*)stack_; }
Allocator& GetAllocator() { return *allocator_; }
bool Empty() const { return stack_top_ == stack_; }
size_t GetSize() const { return static_cast<size_t>(stack_top_ - stack_); }
size_t GetCapacity() const { return stack_capacity_; }
private:
// Prohibit copy constructor & assignment operator.
Stack(const Stack&);
Stack& operator=(const Stack&);
Allocator* allocator_;
Allocator* own_allocator_;
char *stack_;
char *stack_top_;
char *stack_end_;
size_t stack_capacity_;
};
} // namespace internal
} // namespace rapidjson
#endif // RAPIDJSON_STACK_H_
@@ -0,0 +1,23 @@
#ifndef RAPIDJSON_INTERNAL_STRFUNC_H_
#define RAPIDJSON_INTERNAL_STRFUNC_H_
namespace rapidjson {
namespace internal {
//! Custom strlen() which works on different character types.
/*! \tparam Ch Character type (e.g. char, wchar_t, short)
\param s Null-terminated input string.
\return Number of characters in the string.
\note This has the same semantics as strlen(), the return value is not number of Unicode codepoints.
*/
template <typename Ch>
inline SizeType StrLen(const Ch* s) {
const Ch* p = s;
while (*p) ++p;
return SizeType(p - s);
}
} // namespace internal
} // namespace rapidjson
#endif // RAPIDJSON_INTERNAL_STRFUNC_H_
@@ -0,0 +1,306 @@
// ISO C9x compliant inttypes.h for Microsoft Visual Studio
// Based on ISO/IEC 9899:TC2 Committee draft (May 6, 2005) WG14/N1124
//
// Copyright (c) 2006-2013 Alexander Chemeris
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are met:
//
// 1. Redistributions of source code must retain the above copyright notice,
// this list of conditions and the following disclaimer.
//
// 2. Redistributions in binary form must reproduce the above copyright
// notice, this list of conditions and the following disclaimer in the
// documentation and/or other materials provided with the distribution.
//
// 3. Neither the name of the product nor the names of its contributors may
// be used to endorse or promote products derived from this software
// without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
// WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
// MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
// EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
// OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
// WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
// OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
// ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
//
///////////////////////////////////////////////////////////////////////////////
#ifndef _MSC_VER // [
#error "Use this header only with Microsoft Visual C++ compilers!"
#endif // _MSC_VER ]
#ifndef _MSC_INTTYPES_H_ // [
#define _MSC_INTTYPES_H_
#if _MSC_VER > 1000
#pragma once
#endif
#include "stdint.h"
// 7.8 Format conversion of integer types
typedef struct {
intmax_t quot;
intmax_t rem;
} imaxdiv_t;
// 7.8.1 Macros for format specifiers
#if !defined(__cplusplus) || defined(__STDC_FORMAT_MACROS) // [ See footnote 185 at page 198
// The fprintf macros for signed integers are:
#define PRId8 "d"
#define PRIi8 "i"
#define PRIdLEAST8 "d"
#define PRIiLEAST8 "i"
#define PRIdFAST8 "d"
#define PRIiFAST8 "i"
#define PRId16 "hd"
#define PRIi16 "hi"
#define PRIdLEAST16 "hd"
#define PRIiLEAST16 "hi"
#define PRIdFAST16 "hd"
#define PRIiFAST16 "hi"
#define PRId32 "I32d"
#define PRIi32 "I32i"
#define PRIdLEAST32 "I32d"
#define PRIiLEAST32 "I32i"
#define PRIdFAST32 "I32d"
#define PRIiFAST32 "I32i"
#define PRId64 "I64d"
#define PRIi64 "I64i"
#define PRIdLEAST64 "I64d"
#define PRIiLEAST64 "I64i"
#define PRIdFAST64 "I64d"
#define PRIiFAST64 "I64i"
#define PRIdMAX "I64d"
#define PRIiMAX "I64i"
#define PRIdPTR "Id"
#define PRIiPTR "Ii"
// The fprintf macros for unsigned integers are:
#define PRIo8 "o"
#define PRIu8 "u"
#define PRIx8 "x"
#define PRIX8 "X"
#define PRIoLEAST8 "o"
#define PRIuLEAST8 "u"
#define PRIxLEAST8 "x"
#define PRIXLEAST8 "X"
#define PRIoFAST8 "o"
#define PRIuFAST8 "u"
#define PRIxFAST8 "x"
#define PRIXFAST8 "X"
#define PRIo16 "ho"
#define PRIu16 "hu"
#define PRIx16 "hx"
#define PRIX16 "hX"
#define PRIoLEAST16 "ho"
#define PRIuLEAST16 "hu"
#define PRIxLEAST16 "hx"
#define PRIXLEAST16 "hX"
#define PRIoFAST16 "ho"
#define PRIuFAST16 "hu"
#define PRIxFAST16 "hx"
#define PRIXFAST16 "hX"
#define PRIo32 "I32o"
#define PRIu32 "I32u"
#define PRIx32 "I32x"
#define PRIX32 "I32X"
#define PRIoLEAST32 "I32o"
#define PRIuLEAST32 "I32u"
#define PRIxLEAST32 "I32x"
#define PRIXLEAST32 "I32X"
#define PRIoFAST32 "I32o"
#define PRIuFAST32 "I32u"
#define PRIxFAST32 "I32x"
#define PRIXFAST32 "I32X"
#define PRIo64 "I64o"
#define PRIu64 "I64u"
#define PRIx64 "I64x"
#define PRIX64 "I64X"
#define PRIoLEAST64 "I64o"
#define PRIuLEAST64 "I64u"
#define PRIxLEAST64 "I64x"
#define PRIXLEAST64 "I64X"
#define PRIoFAST64 "I64o"
#define PRIuFAST64 "I64u"
#define PRIxFAST64 "I64x"
#define PRIXFAST64 "I64X"
#define PRIoMAX "I64o"
#define PRIuMAX "I64u"
#define PRIxMAX "I64x"
#define PRIXMAX "I64X"
#define PRIoPTR "Io"
#define PRIuPTR "Iu"
#define PRIxPTR "Ix"
#define PRIXPTR "IX"
// The fscanf macros for signed integers are:
#define SCNd8 "d"
#define SCNi8 "i"
#define SCNdLEAST8 "d"
#define SCNiLEAST8 "i"
#define SCNdFAST8 "d"
#define SCNiFAST8 "i"
#define SCNd16 "hd"
#define SCNi16 "hi"
#define SCNdLEAST16 "hd"
#define SCNiLEAST16 "hi"
#define SCNdFAST16 "hd"
#define SCNiFAST16 "hi"
#define SCNd32 "ld"
#define SCNi32 "li"
#define SCNdLEAST32 "ld"
#define SCNiLEAST32 "li"
#define SCNdFAST32 "ld"
#define SCNiFAST32 "li"
#define SCNd64 "I64d"
#define SCNi64 "I64i"
#define SCNdLEAST64 "I64d"
#define SCNiLEAST64 "I64i"
#define SCNdFAST64 "I64d"
#define SCNiFAST64 "I64i"
#define SCNdMAX "I64d"
#define SCNiMAX "I64i"
#ifdef _WIN64 // [
# define SCNdPTR "I64d"
# define SCNiPTR "I64i"
#else // _WIN64 ][
# define SCNdPTR "ld"
# define SCNiPTR "li"
#endif // _WIN64 ]
// The fscanf macros for unsigned integers are:
#define SCNo8 "o"
#define SCNu8 "u"
#define SCNx8 "x"
#define SCNX8 "X"
#define SCNoLEAST8 "o"
#define SCNuLEAST8 "u"
#define SCNxLEAST8 "x"
#define SCNXLEAST8 "X"
#define SCNoFAST8 "o"
#define SCNuFAST8 "u"
#define SCNxFAST8 "x"
#define SCNXFAST8 "X"
#define SCNo16 "ho"
#define SCNu16 "hu"
#define SCNx16 "hx"
#define SCNX16 "hX"
#define SCNoLEAST16 "ho"
#define SCNuLEAST16 "hu"
#define SCNxLEAST16 "hx"
#define SCNXLEAST16 "hX"
#define SCNoFAST16 "ho"
#define SCNuFAST16 "hu"
#define SCNxFAST16 "hx"
#define SCNXFAST16 "hX"
#define SCNo32 "lo"
#define SCNu32 "lu"
#define SCNx32 "lx"
#define SCNX32 "lX"
#define SCNoLEAST32 "lo"
#define SCNuLEAST32 "lu"
#define SCNxLEAST32 "lx"
#define SCNXLEAST32 "lX"
#define SCNoFAST32 "lo"
#define SCNuFAST32 "lu"
#define SCNxFAST32 "lx"
#define SCNXFAST32 "lX"
#define SCNo64 "I64o"
#define SCNu64 "I64u"
#define SCNx64 "I64x"
#define SCNX64 "I64X"
#define SCNoLEAST64 "I64o"
#define SCNuLEAST64 "I64u"
#define SCNxLEAST64 "I64x"
#define SCNXLEAST64 "I64X"
#define SCNoFAST64 "I64o"
#define SCNuFAST64 "I64u"
#define SCNxFAST64 "I64x"
#define SCNXFAST64 "I64X"
#define SCNoMAX "I64o"
#define SCNuMAX "I64u"
#define SCNxMAX "I64x"
#define SCNXMAX "I64X"
#ifdef _WIN64 // [
# define SCNoPTR "I64o"
# define SCNuPTR "I64u"
# define SCNxPTR "I64x"
# define SCNXPTR "I64X"
#else // _WIN64 ][
# define SCNoPTR "lo"
# define SCNuPTR "lu"
# define SCNxPTR "lx"
# define SCNXPTR "lX"
#endif // _WIN64 ]
#endif // __STDC_FORMAT_MACROS ]
// 7.8.2 Functions for greatest-width integer types
// 7.8.2.1 The imaxabs function
#define imaxabs _abs64
// 7.8.2.2 The imaxdiv function
// This is modified version of div() function from Microsoft's div.c found
// in %MSVC.NET%\crt\src\div.c
#ifdef STATIC_IMAXDIV // [
static
#else // STATIC_IMAXDIV ][
_inline
#endif // STATIC_IMAXDIV ]
imaxdiv_t __cdecl imaxdiv(intmax_t numer, intmax_t denom)
{
imaxdiv_t result;
result.quot = numer / denom;
result.rem = numer % denom;
if (numer < 0 && result.rem > 0) {
// did division wrong; must fix up
++result.quot;
result.rem -= denom;
}
return result;
}
// 7.8.2.3 The strtoimax and strtoumax functions
#define strtoimax _strtoi64
#define strtoumax _strtoui64
// 7.8.2.4 The wcstoimax and wcstoumax functions
#define wcstoimax _wcstoi64
#define wcstoumax _wcstoui64
#endif // _MSC_INTTYPES_H_ ]
@@ -0,0 +1,260 @@
// ISO C9x compliant stdint.h for Microsoft Visual Studio
// Based on ISO/IEC 9899:TC2 Committee draft (May 6, 2005) WG14/N1124
//
// Copyright (c) 2006-2013 Alexander Chemeris
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are met:
//
// 1. Redistributions of source code must retain the above copyright notice,
// this list of conditions and the following disclaimer.
//
// 2. Redistributions in binary form must reproduce the above copyright
// notice, this list of conditions and the following disclaimer in the
// documentation and/or other materials provided with the distribution.
//
// 3. Neither the name of the product nor the names of its contributors may
// be used to endorse or promote products derived from this software
// without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
// WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
// MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
// EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
// OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
// WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
// OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
// ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
//
///////////////////////////////////////////////////////////////////////////////
#ifndef _MSC_VER // [
#error "Use this header only with Microsoft Visual C++ compilers!"
#endif // _MSC_VER ]
#ifndef _MSC_STDINT_H_ // [
#define _MSC_STDINT_H_
#if _MSC_VER > 1000
#pragma once
#endif
// miloyip: Originally Visual Studio 2010 uses its own stdint.h. However it generates warning with INT64_C(), so change to use this file for vs2010.
#if _MSC_VER >= 1700 // [
#include <stdint.h>
#else // ] _MSC_VER >= 1700 [
#include <limits.h>
// For Visual Studio 6 in C++ mode and for many Visual Studio versions when
// compiling for ARM we should wrap <wchar.h> include with 'extern "C++" {}'
// or compiler give many errors like this:
// error C2733: second C linkage of overloaded function 'wmemchr' not allowed
#ifdef __cplusplus
extern "C" {
#endif
# include <wchar.h>
#ifdef __cplusplus
}
#endif
// Define _W64 macros to mark types changing their size, like intptr_t.
#ifndef _W64
# if !defined(__midl) && (defined(_X86_) || defined(_M_IX86)) && _MSC_VER >= 1300
# define _W64 __w64
# else
# define _W64
# endif
#endif
// 7.18.1 Integer types
// 7.18.1.1 Exact-width integer types
// Visual Studio 6 and Embedded Visual C++ 4 doesn't
// realize that, e.g. char has the same size as __int8
// so we give up on __intX for them.
#if (_MSC_VER < 1300)
typedef signed char int8_t;
typedef signed short int16_t;
typedef signed int int32_t;
typedef unsigned char uint8_t;
typedef unsigned short uint16_t;
typedef unsigned int uint32_t;
#else
typedef signed __int8 int8_t;
typedef signed __int16 int16_t;
typedef signed __int32 int32_t;
typedef unsigned __int8 uint8_t;
typedef unsigned __int16 uint16_t;
typedef unsigned __int32 uint32_t;
#endif
typedef signed __int64 int64_t;
typedef unsigned __int64 uint64_t;
// 7.18.1.2 Minimum-width integer types
typedef int8_t int_least8_t;
typedef int16_t int_least16_t;
typedef int32_t int_least32_t;
typedef int64_t int_least64_t;
typedef uint8_t uint_least8_t;
typedef uint16_t uint_least16_t;
typedef uint32_t uint_least32_t;
typedef uint64_t uint_least64_t;
// 7.18.1.3 Fastest minimum-width integer types
typedef int8_t int_fast8_t;
typedef int16_t int_fast16_t;
typedef int32_t int_fast32_t;
typedef int64_t int_fast64_t;
typedef uint8_t uint_fast8_t;
typedef uint16_t uint_fast16_t;
typedef uint32_t uint_fast32_t;
typedef uint64_t uint_fast64_t;
// 7.18.1.4 Integer types capable of holding object pointers
#ifdef _WIN64 // [
typedef signed __int64 intptr_t;
typedef unsigned __int64 uintptr_t;
#else // _WIN64 ][
typedef _W64 signed int intptr_t;
typedef _W64 unsigned int uintptr_t;
#endif // _WIN64 ]
// 7.18.1.5 Greatest-width integer types
typedef int64_t intmax_t;
typedef uint64_t uintmax_t;
// 7.18.2 Limits of specified-width integer types
#if !defined(__cplusplus) || defined(__STDC_LIMIT_MACROS) // [ See footnote 220 at page 257 and footnote 221 at page 259
// 7.18.2.1 Limits of exact-width integer types
#define INT8_MIN ((int8_t)_I8_MIN)
#define INT8_MAX _I8_MAX
#define INT16_MIN ((int16_t)_I16_MIN)
#define INT16_MAX _I16_MAX
#define INT32_MIN ((int32_t)_I32_MIN)
#define INT32_MAX _I32_MAX
#define INT64_MIN ((int64_t)_I64_MIN)
#define INT64_MAX _I64_MAX
#define UINT8_MAX _UI8_MAX
#define UINT16_MAX _UI16_MAX
#define UINT32_MAX _UI32_MAX
#define UINT64_MAX _UI64_MAX
// 7.18.2.2 Limits of minimum-width integer types
#define INT_LEAST8_MIN INT8_MIN
#define INT_LEAST8_MAX INT8_MAX
#define INT_LEAST16_MIN INT16_MIN
#define INT_LEAST16_MAX INT16_MAX
#define INT_LEAST32_MIN INT32_MIN
#define INT_LEAST32_MAX INT32_MAX
#define INT_LEAST64_MIN INT64_MIN
#define INT_LEAST64_MAX INT64_MAX
#define UINT_LEAST8_MAX UINT8_MAX
#define UINT_LEAST16_MAX UINT16_MAX
#define UINT_LEAST32_MAX UINT32_MAX
#define UINT_LEAST64_MAX UINT64_MAX
// 7.18.2.3 Limits of fastest minimum-width integer types
#define INT_FAST8_MIN INT8_MIN
#define INT_FAST8_MAX INT8_MAX
#define INT_FAST16_MIN INT16_MIN
#define INT_FAST16_MAX INT16_MAX
#define INT_FAST32_MIN INT32_MIN
#define INT_FAST32_MAX INT32_MAX
#define INT_FAST64_MIN INT64_MIN
#define INT_FAST64_MAX INT64_MAX
#define UINT_FAST8_MAX UINT8_MAX
#define UINT_FAST16_MAX UINT16_MAX
#define UINT_FAST32_MAX UINT32_MAX
#define UINT_FAST64_MAX UINT64_MAX
// 7.18.2.4 Limits of integer types capable of holding object pointers
#ifdef _WIN64 // [
# define INTPTR_MIN INT64_MIN
# define INTPTR_MAX INT64_MAX
# define UINTPTR_MAX UINT64_MAX
#else // _WIN64 ][
# define INTPTR_MIN INT32_MIN
# define INTPTR_MAX INT32_MAX
# define UINTPTR_MAX UINT32_MAX
#endif // _WIN64 ]
// 7.18.2.5 Limits of greatest-width integer types
#define INTMAX_MIN INT64_MIN
#define INTMAX_MAX INT64_MAX
#define UINTMAX_MAX UINT64_MAX
// 7.18.3 Limits of other integer types
#ifdef _WIN64 // [
# define PTRDIFF_MIN _I64_MIN
# define PTRDIFF_MAX _I64_MAX
#else // _WIN64 ][
# define PTRDIFF_MIN _I32_MIN
# define PTRDIFF_MAX _I32_MAX
#endif // _WIN64 ]
#define SIG_ATOMIC_MIN INT_MIN
#define SIG_ATOMIC_MAX INT_MAX
#ifndef SIZE_MAX // [
# ifdef _WIN64 // [
# define SIZE_MAX _UI64_MAX
# else // _WIN64 ][
# define SIZE_MAX _UI32_MAX
# endif // _WIN64 ]
#endif // SIZE_MAX ]
// WCHAR_MIN and WCHAR_MAX are also defined in <wchar.h>
#ifndef WCHAR_MIN // [
# define WCHAR_MIN 0
#endif // WCHAR_MIN ]
#ifndef WCHAR_MAX // [
# define WCHAR_MAX _UI16_MAX
#endif // WCHAR_MAX ]
#define WINT_MIN 0
#define WINT_MAX _UI16_MAX
#endif // __STDC_LIMIT_MACROS ]
// 7.18.4 Limits of other integer types
#if !defined(__cplusplus) || defined(__STDC_CONSTANT_MACROS) // [ See footnote 224 at page 260
// 7.18.4.1 Macros for minimum-width integer constants
#define INT8_C(val) val##i8
#define INT16_C(val) val##i16
#define INT32_C(val) val##i32
#define INT64_C(val) val##i64
#define UINT8_C(val) val##ui8
#define UINT16_C(val) val##ui16
#define UINT32_C(val) val##ui32
#define UINT64_C(val) val##ui64
// 7.18.4.2 Macros for greatest-width integer constants
// These #ifndef's are needed to prevent collisions with <boost/cstdint.hpp>.
// Check out Issue 9 for the details.
#ifndef INTMAX_C // [
# define INTMAX_C INT64_C
#endif // INTMAX_C ]
#ifndef UINTMAX_C // [
# define UINTMAX_C UINT64_C
#endif // UINTMAX_C ]
#endif // __STDC_CONSTANT_MACROS ]
#endif // _MSC_VER >= 1600 ]
#endif // _MSC_STDINT_H_ ]
+195
View File
@@ -0,0 +1,195 @@
#ifndef RAPIDJSON_PRETTYWRITER_H_
#define RAPIDJSON_PRETTYWRITER_H_
#include "writer.h"
#ifdef __GNUC__
RAPIDJSON_DIAG_PUSH
RAPIDJSON_DIAG_OFF(effc++)
#endif
namespace rapidjson {
//! Writer with indentation and spacing.
/*!
\tparam OutputStream Type of ouptut os.
\tparam SourceEncoding Encoding of source string.
\tparam TargetEncoding Encoding of output stream.
\tparam Allocator Type of allocator for allocating memory of stack.
*/
template<typename OutputStream, typename SourceEncoding = UTF8<>, typename TargetEncoding = UTF8<>, typename Allocator = MemoryPoolAllocator<> >
class PrettyWriter : public Writer<OutputStream, SourceEncoding, TargetEncoding, Allocator> {
public:
typedef Writer<OutputStream, SourceEncoding, TargetEncoding, Allocator> Base;
typedef typename Base::Ch Ch;
//! Constructor
/*! \param os Output stream.
\param allocator User supplied allocator. If it is null, it will create a private one.
\param levelDepth Initial capacity of stack.
*/
PrettyWriter(OutputStream& os, Allocator* allocator = 0, size_t levelDepth = Base::kDefaultLevelDepth) :
Base(os, allocator, levelDepth), indentChar_(' '), indentCharCount_(4) {}
//! Overridden for fluent API, see \ref Writer::SetDoublePrecision()
PrettyWriter& SetDoublePrecision(int p) { Base::SetDoublePrecision(p); return *this; }
//! Set custom indentation.
/*! \param indentChar Character for indentation. Must be whitespace character (' ', '\\t', '\\n', '\\r').
\param indentCharCount Number of indent characters for each indentation level.
\note The default indentation is 4 spaces.
*/
PrettyWriter& SetIndent(Ch indentChar, unsigned indentCharCount) {
RAPIDJSON_ASSERT(indentChar == ' ' || indentChar == '\t' || indentChar == '\n' || indentChar == '\r');
indentChar_ = indentChar;
indentCharCount_ = indentCharCount;
return *this;
}
/*! @name Implementation of Handler
\see Handler
*/
//@{
bool Null() { PrettyPrefix(kNullType); return Base::WriteNull(); }
bool Bool(bool b) { PrettyPrefix(b ? kTrueType : kFalseType); return Base::WriteBool(b); }
bool Int(int i) { PrettyPrefix(kNumberType); return Base::WriteInt(i); }
bool Uint(unsigned u) { PrettyPrefix(kNumberType); return Base::WriteUint(u); }
bool Int64(int64_t i64) { PrettyPrefix(kNumberType); return Base::WriteInt64(i64); }
bool Uint64(uint64_t u64) { PrettyPrefix(kNumberType); return Base::WriteUint64(u64); }
bool Double(double d) { PrettyPrefix(kNumberType); return Base::WriteDouble(d); }
bool String(const Ch* str, SizeType length, bool copy = false) {
(void)copy;
PrettyPrefix(kStringType);
return Base::WriteString(str, length);
}
bool StartObject() {
PrettyPrefix(kObjectType);
new (Base::level_stack_.template Push<typename Base::Level>()) typename Base::Level(false);
return Base::WriteStartObject();
}
bool EndObject(SizeType memberCount = 0) {
(void)memberCount;
RAPIDJSON_ASSERT(Base::level_stack_.GetSize() >= sizeof(typename Base::Level));
RAPIDJSON_ASSERT(!Base::level_stack_.template Top<typename Base::Level>()->inArray);
bool empty = Base::level_stack_.template Pop<typename Base::Level>(1)->valueCount == 0;
if (!empty) {
Base::os_->Put('\n');
WriteIndent();
}
if (!Base::WriteEndObject())
return false;
if (Base::level_stack_.Empty()) // end of json text
Base::os_->Flush();
return true;
}
bool StartArray() {
PrettyPrefix(kArrayType);
new (Base::level_stack_.template Push<typename Base::Level>()) typename Base::Level(true);
return Base::WriteStartArray();
}
bool EndArray(SizeType memberCount = 0) {
(void)memberCount;
RAPIDJSON_ASSERT(Base::level_stack_.GetSize() >= sizeof(typename Base::Level));
RAPIDJSON_ASSERT(Base::level_stack_.template Top<typename Base::Level>()->inArray);
bool empty = Base::level_stack_.template Pop<typename Base::Level>(1)->valueCount == 0;
if (!empty) {
Base::os_->Put('\n');
WriteIndent();
}
if (!Base::WriteEndArray())
return false;
if (Base::level_stack_.Empty()) // end of json text
Base::os_->Flush();
return true;
}
//@}
/*! @name Convenience extensions */
//@{
//! Simpler but slower overload.
bool String(const Ch* str) { return String(str, internal::StrLen(str)); }
//! Overridden for fluent API, see \ref Writer::Double()
bool Double(double d, int precision) {
int oldPrecision = Base::GetDoublePrecision();
SetDoublePrecision(precision);
bool ret = Double(d);
SetDoublePrecision(oldPrecision);
return ret;
}
//@}
protected:
void PrettyPrefix(Type type) {
(void)type;
if (Base::level_stack_.GetSize() != 0) { // this value is not at root
typename Base::Level* level = Base::level_stack_.template Top<typename Base::Level>();
if (level->inArray) {
if (level->valueCount > 0) {
Base::os_->Put(','); // add comma if it is not the first element in array
Base::os_->Put('\n');
}
else
Base::os_->Put('\n');
WriteIndent();
}
else { // in object
if (level->valueCount > 0) {
if (level->valueCount % 2 == 0) {
Base::os_->Put(',');
Base::os_->Put('\n');
}
else {
Base::os_->Put(':');
Base::os_->Put(' ');
}
}
else
Base::os_->Put('\n');
if (level->valueCount % 2 == 0)
WriteIndent();
}
if (!level->inArray && level->valueCount % 2 == 0)
RAPIDJSON_ASSERT(type == kStringType); // if it's in object, then even number should be a name
level->valueCount++;
}
else {
RAPIDJSON_ASSERT(type == kObjectType || type == kArrayType);
RAPIDJSON_ASSERT(!Base::hasRoot_); // Should only has one and only one root.
Base::hasRoot_ = true;
}
}
void WriteIndent() {
size_t count = (Base::level_stack_.GetSize() / sizeof(typename Base::Level)) * indentCharCount_;
PutN(*Base::os_, indentChar_, count);
}
Ch indentChar_;
unsigned indentCharCount_;
private:
// Prohibit copy constructor & assignment operator.
PrettyWriter(const PrettyWriter&);
PrettyWriter& operator=(const PrettyWriter&);
};
} // namespace rapidjson
#ifdef __GNUC__
RAPIDJSON_DIAG_POP
#endif
#endif // RAPIDJSON_RAPIDJSON_H_
+397
View File
@@ -0,0 +1,397 @@
#ifndef RAPIDJSON_RAPIDJSON_H_
#define RAPIDJSON_RAPIDJSON_H_
// Copyright (c) 2011 Milo Yip (miloyip@gmail.com)
// Version 0.1
/*!\file rapidjson.h
\brief common definitions and configuration
\todo Complete Doxygen documentation for configure macros.
*/
#include <cstdlib> // malloc(), realloc(), free()
#include <cstring> // memcpy()
///////////////////////////////////////////////////////////////////////////////
// RAPIDJSON_NO_INT64DEFINE
// Here defines int64_t and uint64_t types in global namespace as well as the
// (U)INT64_C constant macros.
// If user have their own definition, can define RAPIDJSON_NO_INT64DEFINE to disable this.
#ifndef RAPIDJSON_NO_INT64DEFINE
//!@cond RAPIDJSON_HIDDEN_FROM_DOXYGEN
#ifndef __STDC_CONSTANT_MACROS
# define __STDC_CONSTANT_MACROS 1 // required by C++ standard
#endif
#ifdef _MSC_VER
#include "msinttypes/stdint.h"
#include "msinttypes/inttypes.h"
#else
// Other compilers should have this.
#include <stdint.h>
#include <inttypes.h>
#endif
//!@endcond
#endif // RAPIDJSON_NO_INT64TYPEDEF
///////////////////////////////////////////////////////////////////////////////
// RAPIDJSON_FORCEINLINE
#ifndef RAPIDJSON_FORCEINLINE
#ifdef _MSC_VER
#define RAPIDJSON_FORCEINLINE __forceinline
#else
#define RAPIDJSON_FORCEINLINE
#endif
#endif // RAPIDJSON_FORCEINLINE
///////////////////////////////////////////////////////////////////////////////
// RAPIDJSON_ENDIAN
#define RAPIDJSON_LITTLEENDIAN 0 //!< Little endian machine
#define RAPIDJSON_BIGENDIAN 1 //!< Big endian machine
//! Endianness of the machine.
/*! GCC 4.6 provided macro for detecting endianness of the target machine. But other
compilers may not have this. User can define RAPIDJSON_ENDIAN to either
\ref RAPIDJSON_LITTLEENDIAN or \ref RAPIDJSON_BIGENDIAN.
Implemented with reference to
https://gcc.gnu.org/onlinedocs/gcc-4.6.0/cpp/Common-Predefined-Macros.html
http://www.boost.org/doc/libs/1_42_0/boost/detail/endian.hpp
*/
#ifndef RAPIDJSON_ENDIAN
// Detect with GCC 4.6's macro
# ifdef __BYTE_ORDER__
# if __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__
# define RAPIDJSON_ENDIAN RAPIDJSON_LITTLEENDIAN
# elif __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__
# define RAPIDJSON_ENDIAN RAPIDJSON_BIGENDIAN
# else
# error Unknown machine endianess detected. User needs to define RAPIDJSON_ENDIAN.
# endif // __BYTE_ORDER__
// Detect with GLIBC's endian.h
# elif defined(__GLIBC__)
# include <endian.h>
# if (__BYTE_ORDER == __LITTLE_ENDIAN)
# define RAPIDJSON_ENDIAN RAPIDJSON_LITTLEENDIAN
# elif (__BYTE_ORDER == __BIG_ENDIAN)
# define RAPIDJSON_ENDIAN RAPIDJSON_BIGENDIAN
# else
# error Unknown machine endianess detected. User needs to define RAPIDJSON_ENDIAN.
# endif // __GLIBC__
// Detect with _LITTLE_ENDIAN and _BIG_ENDIAN macro
# elif defined(_LITTLE_ENDIAN) && !defined(_BIG_ENDIAN)
# define RAPIDJSON_ENDIAN RAPIDJSON_LITTLEENDIAN
# elif defined(_BIG_ENDIAN) && !defined(_LITTLE_ENDIAN)
# define RAPIDJSON_ENDIAN RAPIDJSON_BIGENDIAN
// Detect with architecture macros
# elif defined(__sparc) || defined(__sparc__) || defined(_POWER) || defined(__powerpc__) || defined(__ppc__) || defined(__hpux) || defined(__hppa) || defined(_MIPSEB) || defined(_POWER) || defined(__s390__)
# define RAPIDJSON_ENDIAN RAPIDJSON_BIGENDIAN
# elif defined(__i386__) || defined(__alpha__) || defined(__ia64) || defined(__ia64__) || defined(_M_IX86) || defined(_M_IA64) || defined(_M_ALPHA) || defined(__amd64) || defined(__amd64__) || defined(_M_AMD64) || defined(__x86_64) || defined(__x86_64__) || defined(_M_X64) || defined(__bfin__)
# define RAPIDJSON_ENDIAN RAPIDJSON_LITTLEENDIAN
# else
# error Unknown machine endianess detected. User needs to define RAPIDJSON_ENDIAN.
# endif
#endif // RAPIDJSON_ENDIAN
///////////////////////////////////////////////////////////////////////////////
// RAPIDJSON_ALIGNSIZE
//! Data alignment of the machine.
/*!
Some machine requires strict data alignment.
Currently the default uses 4 bytes alignment. User can customize this.
*/
#ifndef RAPIDJSON_ALIGN
#define RAPIDJSON_ALIGN(x) ((x + 3u) & ~3u)
#endif
///////////////////////////////////////////////////////////////////////////////
// RAPIDJSON_SSE2/RAPIDJSON_SSE42/RAPIDJSON_SIMD
// Enable SSE2 optimization.
//#define RAPIDJSON_SSE2
// Enable SSE4.2 optimization.
//#define RAPIDJSON_SSE42
#if defined(RAPIDJSON_SSE2) || defined(RAPIDJSON_SSE42)
#define RAPIDJSON_SIMD
#endif
///////////////////////////////////////////////////////////////////////////////
// RAPIDJSON_NO_SIZETYPEDEFINE
#ifndef RAPIDJSON_NO_SIZETYPEDEFINE
namespace rapidjson {
//! Use 32-bit array/string indices even for 64-bit platform, instead of using size_t.
/*! User may override the SizeType by defining RAPIDJSON_NO_SIZETYPEDEFINE.
*/
typedef unsigned SizeType;
} // namespace rapidjson
#endif
///////////////////////////////////////////////////////////////////////////////
// RAPIDJSON_ASSERT
//! Assertion.
/*! By default, rapidjson uses C assert() for assertion.
User can override it by defining RAPIDJSON_ASSERT(x) macro.
*/
#ifndef RAPIDJSON_ASSERT
#include <cassert>
#define RAPIDJSON_ASSERT(x) assert(x)
#endif // RAPIDJSON_ASSERT
///////////////////////////////////////////////////////////////////////////////
// RAPIDJSON_STATIC_ASSERT
// Adopt from boost
#ifndef RAPIDJSON_STATIC_ASSERT
//!@cond RAPIDJSON_HIDDEN_FROM_DOXYGEN
namespace rapidjson {
template <bool x> struct STATIC_ASSERTION_FAILURE;
template <> struct STATIC_ASSERTION_FAILURE<true> { enum { value = 1 }; };
template<int x> struct StaticAssertTest {};
} // namespace rapidjson
#define RAPIDJSON_JOIN(X, Y) RAPIDJSON_DO_JOIN(X, Y)
#define RAPIDJSON_DO_JOIN(X, Y) RAPIDJSON_DO_JOIN2(X, Y)
#define RAPIDJSON_DO_JOIN2(X, Y) X##Y
#if defined(__GNUC__)
#define RAPIDJSON_STATIC_ASSERT_UNUSED_ATTRIBUTE __attribute__((unused))
#else
#define RAPIDJSON_STATIC_ASSERT_UNUSED_ATTRIBUTE
#endif
//!@endcond
/*! \def RAPIDJSON_STATIC_ASSERT
\brief (internal) macro to check for conditions at compile-time
\param x compile-time condition
\hideinitializer
*/
#define RAPIDJSON_STATIC_ASSERT(x) typedef ::rapidjson::StaticAssertTest<\
sizeof(::rapidjson::STATIC_ASSERTION_FAILURE<bool(x) >)>\
RAPIDJSON_JOIN(StaticAssertTypedef, __LINE__) RAPIDJSON_STATIC_ASSERT_UNUSED_ATTRIBUTE
#endif
///////////////////////////////////////////////////////////////////////////////
// Helpers
//!@cond RAPIDJSON_HIDDEN_FROM_DOXYGEN
#define RAPIDJSON_MULTILINEMACRO_BEGIN do {
#define RAPIDJSON_MULTILINEMACRO_END \
} while((void)0, 0)
// adopted from Boost
#define RAPIDJSON_VERSION_CODE(x,y,z) \
(((x)*100000) + ((y)*100) + (z))
// token stringification
#define RAPIDJSON_STRINGIFY(x) RAPIDJSON_DO_STRINGIFY(x)
#define RAPIDJSON_DO_STRINGIFY(x) #x
///////////////////////////////////////////////////////////////////////////////
// RAPIDJSON_DIAG_PUSH/POP, RAPIDJSON_DIAG_OFF
#if defined(__clang__) || (defined(__GNUC__) && RAPIDJSON_VERSION_CODE(__GNUC__,__GNUC_MINOR__,__GNUC_PATCHLEVEL__) >= RAPIDJSON_VERSION_CODE(4,2,0))
#define RAPIDJSON_PRAGMA(x) _Pragma(RAPIDJSON_STRINGIFY(x))
#define RAPIDJSON_DIAG_PRAGMA(x) RAPIDJSON_PRAGMA(GCC diagnostic x)
#define RAPIDJSON_DIAG_OFF(x) \
RAPIDJSON_DIAG_PRAGMA(ignored RAPIDJSON_STRINGIFY(RAPIDJSON_JOIN(-W,x)))
// push/pop support in Clang and GCC>=4.6
#if defined(__clang__) || (defined(__GNUC__) && RAPIDJSON_VERSION_CODE(__GNUC__,__GNUC_MINOR__,__GNUC_PATCHLEVEL__) >= RAPIDJSON_VERSION_CODE(4,6,0))
#define RAPIDJSON_DIAG_PUSH RAPIDJSON_DIAG_PRAGMA(push)
#define RAPIDJSON_DIAG_POP RAPIDJSON_DIAG_PRAGMA(pop)
#else // GCC >= 4.2, < 4.6
#define RAPIDJSON_DIAG_PUSH /* ignored */
#define RAPIDJSON_DIAG_POP /* ignored */
#endif
#elif defined(_MSC_VER)
// pragma (MSVC specific)
#define RAPIDJSON_PRAGMA(x) __pragma(x)
#define RAPIDJSON_DIAG_PRAGMA(x) RAPIDJSON_PRAGMA(warning(x))
#define RAPIDJSON_DIAG_OFF(x) RAPIDJSON_DIAG_PRAGMA(disable: x)
#define RAPIDJSON_DIAG_PUSH RAPIDJSON_DIAG_PRAGMA(push)
#define RAPIDJSON_DIAG_POP RAPIDJSON_DIAG_PRAGMA(pop)
#else
#define RAPIDJSON_DIAG_OFF(x) /* ignored */
#define RAPIDJSON_DIAG_PUSH /* ignored */
#define RAPIDJSON_DIAG_POP /* ignored */
#endif // RAPIDJSON_DIAG_*
//!@endcond
///////////////////////////////////////////////////////////////////////////////
// Allocators and Encodings
#include "allocators.h"
#include "encodings.h"
//! main RapidJSON namespace
namespace rapidjson {
///////////////////////////////////////////////////////////////////////////////
// Stream
/*! \class rapidjson::Stream
\brief Concept for reading and writing characters.
For read-only stream, no need to implement PutBegin(), Put(), Flush() and PutEnd().
For write-only stream, only need to implement Put() and Flush().
\code
concept Stream {
typename Ch; //!< Character type of the stream.
//! Read the current character from stream without moving the read cursor.
Ch Peek() const;
//! Read the current character from stream and moving the read cursor to next character.
Ch Take();
//! Get the current read cursor.
//! \return Number of characters read from start.
size_t Tell();
//! Begin writing operation at the current read pointer.
//! \return The begin writer pointer.
Ch* PutBegin();
//! Write a character.
void Put(Ch c);
//! Flush the buffer.
void Flush();
//! End the writing operation.
//! \param begin The begin write pointer returned by PutBegin().
//! \return Number of characters written.
size_t PutEnd(Ch* begin);
}
\endcode
*/
//! Provides additional information for stream.
/*!
By using traits pattern, this type provides a default configuration for stream.
For custom stream, this type can be specialized for other configuration.
See TEST(Reader, CustomStringStream) in readertest.cpp for example.
*/
template<typename Stream>
struct StreamTraits {
//! Whether to make local copy of stream for optimization during parsing.
/*!
By default, for safety, streams do not use local copy optimization.
Stream that can be copied fast should specialize this, like StreamTraits<StringStream>.
*/
enum { copyOptimization = 0 };
};
//! Put N copies of a character to a stream.
template<typename Stream, typename Ch>
inline void PutN(Stream& stream, Ch c, size_t n) {
for (size_t i = 0; i < n; i++)
stream.Put(c);
}
///////////////////////////////////////////////////////////////////////////////
// StringStream
//! Read-only string stream.
/*! \note implements Stream concept
*/
template <typename Encoding>
struct GenericStringStream {
typedef typename Encoding::Ch Ch;
GenericStringStream(const Ch *src) : src_(src), head_(src) {}
Ch Peek() const { return *src_; }
Ch Take() { return *src_++; }
size_t Tell() const { return static_cast<size_t>(src_ - head_); }
Ch* PutBegin() { RAPIDJSON_ASSERT(false); return 0; }
void Put(Ch) { RAPIDJSON_ASSERT(false); }
void Flush() { RAPIDJSON_ASSERT(false); }
size_t PutEnd(Ch*) { RAPIDJSON_ASSERT(false); return 0; }
const Ch* src_; //!< Current read position.
const Ch* head_; //!< Original head of the string.
};
template <typename Encoding>
struct StreamTraits<GenericStringStream<Encoding> > {
enum { copyOptimization = 1 };
};
//! String stream with UTF8 encoding.
typedef GenericStringStream<UTF8<> > StringStream;
///////////////////////////////////////////////////////////////////////////////
// InsituStringStream
//! A read-write string stream.
/*! This string stream is particularly designed for in-situ parsing.
\note implements Stream concept
*/
template <typename Encoding>
struct GenericInsituStringStream {
typedef typename Encoding::Ch Ch;
GenericInsituStringStream(Ch *src) : src_(src), dst_(0), head_(src) {}
// Read
Ch Peek() { return *src_; }
Ch Take() { return *src_++; }
size_t Tell() { return static_cast<size_t>(src_ - head_); }
// Write
Ch* PutBegin() { return dst_ = src_; }
void Put(Ch c) { RAPIDJSON_ASSERT(dst_ != 0); *dst_++ = c; }
void Flush() {}
size_t PutEnd(Ch* begin) { return static_cast<size_t>(dst_ - begin); }
Ch* src_;
Ch* dst_;
Ch* head_;
};
template <typename Encoding>
struct StreamTraits<GenericInsituStringStream<Encoding> > {
enum { copyOptimization = 1 };
};
//! Insitu string stream with UTF8 encoding.
typedef GenericInsituStringStream<UTF8<> > InsituStringStream;
///////////////////////////////////////////////////////////////////////////////
// Type
//! Type of JSON value
enum Type {
kNullType = 0, //!< null
kFalseType = 1, //!< false
kTrueType = 2, //!< true
kObjectType = 3, //!< object
kArrayType = 4, //!< array
kStringType = 5, //!< string
kNumberType = 6 //!< number
};
} // namespace rapidjson
#endif // RAPIDJSON_RAPIDJSON_H_
File diff suppressed because it is too large Load Diff
+51
View File
@@ -0,0 +1,51 @@
#ifndef RAPIDJSON_STRINGBUFFER_H_
#define RAPIDJSON_STRINGBUFFER_H_
#include "rapidjson.h"
#include "internal/stack.h"
namespace rapidjson {
//! Represents an in-memory output stream.
/*!
\tparam Encoding Encoding of the stream.
\tparam Allocator type for allocating memory buffer.
\note implements Stream concept
*/
template <typename Encoding, typename Allocator = CrtAllocator>
struct GenericStringBuffer {
typedef typename Encoding::Ch Ch;
GenericStringBuffer(Allocator* allocator = 0, size_t capacity = kDefaultCapacity) : stack_(allocator, capacity) {}
void Put(Ch c) { *stack_.template Push<Ch>() = c; }
void Flush() {}
void Clear() { stack_.Clear(); }
const Ch* GetString() const {
// Push and pop a null terminator. This is safe.
*stack_.template Push<Ch>() = '\0';
stack_.template Pop<Ch>(1);
return stack_.template Bottom<Ch>();
}
size_t GetSize() const { return stack_.GetSize(); }
static const size_t kDefaultCapacity = 256;
mutable internal::Stack<Allocator> stack_;
};
//! String buffer with UTF8 encoding
typedef GenericStringBuffer<UTF8<> > StringBuffer;
//! Implement specialized version of PutN() with memset() for better performance.
template<>
inline void PutN(GenericStringBuffer<UTF8<> >& stream, char c, size_t n) {
memset(stream.stack_.Push<char>(n), c, n * sizeof(c));
}
} // namespace rapidjson
#endif // RAPIDJSON_STRINGBUFFER_H_
+387
View File
@@ -0,0 +1,387 @@
#ifndef RAPIDJSON_WRITER_H_
#define RAPIDJSON_WRITER_H_
#include "rapidjson.h"
#include "internal/stack.h"
#include "internal/strfunc.h"
#include <cstdio> // snprintf() or _sprintf_s()
#include <new> // placement new
#ifdef _MSC_VER
RAPIDJSON_DIAG_PUSH
RAPIDJSON_DIAG_OFF(4127) // conditional expression is constant
#endif
namespace rapidjson {
//! JSON writer
/*! Writer implements the concept Handler.
It generates JSON text by events to an output os.
User may programmatically calls the functions of a writer to generate JSON text.
On the other side, a writer can also be passed to objects that generates events,
for example Reader::Parse() and Document::Accept().
\tparam OutputStream Type of output stream.
\tparam SourceEncoding Encoding of source string.
\tparam TargetEncoding Encoding of output stream.
\tparam Allocator Type of allocator for allocating memory of stack.
\note implements Handler concept
*/
template<typename OutputStream, typename SourceEncoding = UTF8<>, typename TargetEncoding = UTF8<>, typename Allocator = MemoryPoolAllocator<> >
class Writer {
public:
typedef typename SourceEncoding::Ch Ch;
//! Constructor
/*! \param os Output stream.
\param allocator User supplied allocator. If it is null, it will create a private one.
\param levelDepth Initial capacity of stack.
*/
Writer(OutputStream& os, Allocator* allocator = 0, size_t levelDepth = kDefaultLevelDepth) :
os_(&os), level_stack_(allocator, levelDepth * sizeof(Level)),
doublePrecision_(kDefaultDoublePrecision), hasRoot_(false) {}
//! Reset the writer with a new stream.
/*!
This function reset the writer with a new stream and default settings,
in order to make a Writer object reusable for output multiple JSONs.
\param os New output stream.
\code
Writer<OutputStream> writer(os1);
writer.StartObject();
// ...
writer.EndObject();
writer.Reset(os2);
writer.StartObject();
// ...
writer.EndObject();
\endcode
*/
void Reset(OutputStream& os) {
os_ = &os;
doublePrecision_ = kDefaultDoublePrecision;
hasRoot_ = false;
level_stack_.Clear();
}
//! Checks whether the output is a complete JSON.
/*!
A complete JSON has a complete root object or array.
*/
bool IsComplete() const {
return hasRoot_ && level_stack_.Empty();
}
//! Set the number of significant digits for \c double values
/*! When writing a \c double value to the \c OutputStream, the number
of significant digits is limited to 6 by default.
\param p maximum number of significant digits (default: 6)
\return The Writer itself for fluent API.
*/
Writer& SetDoublePrecision(int p = kDefaultDoublePrecision) {
if (p < 0) p = kDefaultDoublePrecision; // negative precision is ignored
doublePrecision_ = p;
return *this;
}
//! \see SetDoublePrecision()
int GetDoublePrecision() const { return doublePrecision_; }
/*!@name Implementation of Handler
\see Handler
*/
//@{
bool Null() { Prefix(kNullType); return WriteNull(); }
bool Bool(bool b) { Prefix(b ? kTrueType : kFalseType); return WriteBool(b); }
bool Int(int i) { Prefix(kNumberType); return WriteInt(i); }
bool Uint(unsigned u) { Prefix(kNumberType); return WriteUint(u); }
bool Int64(int64_t i64) { Prefix(kNumberType); return WriteInt64(i64); }
bool Uint64(uint64_t u64) { Prefix(kNumberType); return WriteUint64(u64); }
//! Writes the given \c double value to the stream
/*!
The number of significant digits (the precision) to be written
can be set by \ref SetDoublePrecision() for the Writer:
\code
Writer<...> writer(...);
writer.SetDoublePrecision(12).Double(M_PI);
\endcode
\param d The value to be written.
\return Whether it is succeed.
*/
bool Double(double d) { Prefix(kNumberType); return WriteDouble(d); }
bool String(const Ch* str, SizeType length, bool copy = false) {
(void)copy;
Prefix(kStringType);
return WriteString(str, length);
}
bool StartObject() {
Prefix(kObjectType);
new (level_stack_.template Push<Level>()) Level(false);
return WriteStartObject();
}
bool EndObject(SizeType memberCount = 0) {
(void)memberCount;
RAPIDJSON_ASSERT(level_stack_.GetSize() >= sizeof(Level));
RAPIDJSON_ASSERT(!level_stack_.template Top<Level>()->inArray);
level_stack_.template Pop<Level>(1);
bool ret = WriteEndObject();
if (level_stack_.Empty()) // end of json text
os_->Flush();
return ret;
}
bool StartArray() {
Prefix(kArrayType);
new (level_stack_.template Push<Level>()) Level(true);
return WriteStartArray();
}
bool EndArray(SizeType elementCount = 0) {
(void)elementCount;
RAPIDJSON_ASSERT(level_stack_.GetSize() >= sizeof(Level));
RAPIDJSON_ASSERT(level_stack_.template Top<Level>()->inArray);
level_stack_.template Pop<Level>(1);
bool ret = WriteEndArray();
if (level_stack_.Empty()) // end of json text
os_->Flush();
return ret;
}
//@}
/*! @name Convenience extensions */
//@{
//! Writes the given \c double value to the stream (explicit precision)
/*!
The currently set double precision is ignored in favor of the explicitly
given precision for this value.
\see Double(), SetDoublePrecision(), GetDoublePrecision()
\param d The value to be written
\param precision The number of significant digits for this value
\return Whether it is succeeded.
*/
bool Double(double d, int precision) {
int oldPrecision = GetDoublePrecision();
SetDoublePrecision(precision);
bool ret = Double(d);
SetDoublePrecision(oldPrecision);
return ret;
}
//! Simpler but slower overload.
bool String(const Ch* str) { return String(str, internal::StrLen(str)); }
//@}
protected:
//! Information for each nested level
struct Level {
Level(bool inArray_) : valueCount(0), inArray(inArray_) {}
size_t valueCount; //!< number of values in this level
bool inArray; //!< true if in array, otherwise in object
};
static const size_t kDefaultLevelDepth = 32;
bool WriteNull() {
os_->Put('n'); os_->Put('u'); os_->Put('l'); os_->Put('l'); return true;
}
bool WriteBool(bool b) {
if (b) {
os_->Put('t'); os_->Put('r'); os_->Put('u'); os_->Put('e');
}
else {
os_->Put('f'); os_->Put('a'); os_->Put('l'); os_->Put('s'); os_->Put('e');
}
return true;
}
bool WriteInt(int i) {
if (i < 0) {
os_->Put('-');
i = -i;
}
return WriteUint((unsigned)i);
}
bool WriteUint(unsigned u) {
char buffer[10];
char *p = buffer;
do {
*p++ = char(u % 10) + '0';
u /= 10;
} while (u > 0);
do {
--p;
os_->Put(*p);
} while (p != buffer);
return true;
}
bool WriteInt64(int64_t i64) {
if (i64 < 0) {
os_->Put('-');
i64 = -i64;
}
WriteUint64((uint64_t)i64);
return true;
}
bool WriteUint64(uint64_t u64) {
char buffer[20];
char *p = buffer;
do {
*p++ = char(u64 % 10) + '0';
u64 /= 10;
} while (u64 > 0);
do {
--p;
os_->Put(*p);
} while (p != buffer);
return true;
}
#ifdef _MSC_VER
#define RAPIDJSON_SNPRINTF sprintf_s
#else
#define RAPIDJSON_SNPRINTF snprintf
#endif
//! \todo Optimization with custom double-to-string converter.
bool WriteDouble(double d) {
char buffer[100];
int ret = RAPIDJSON_SNPRINTF(buffer, sizeof(buffer), "%.*g", doublePrecision_, d);
RAPIDJSON_ASSERT(ret >= 1);
for (int i = 0; i < ret; i++)
os_->Put(buffer[i]);
return true;
}
#undef RAPIDJSON_SNPRINTF
bool WriteString(const Ch* str, SizeType length) {
static const char hexDigits[16] = { '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', 'E', 'F' };
static const char escape[256] = {
#define Z16 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
//0 1 2 3 4 5 6 7 8 9 A B C D E F
'u', 'u', 'u', 'u', 'u', 'u', 'u', 'u', 'b', 't', 'n', 'u', 'f', 'r', 'u', 'u', // 00
'u', 'u', 'u', 'u', 'u', 'u', 'u', 'u', 'u', 'u', 'u', 'u', 'u', 'u', 'u', 'u', // 10
0, 0, '"', 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 20
Z16, Z16, // 30~4F
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,'\\', 0, 0, 0, // 50
Z16, Z16, Z16, Z16, Z16, Z16, Z16, Z16, Z16, Z16 // 60~FF
#undef Z16
};
os_->Put('\"');
GenericStringStream<SourceEncoding> is(str);
while (is.Tell() < length) {
const Ch c = is.Peek();
if (!TargetEncoding::supportUnicode && (unsigned)c >= 0x80) {
// Unicode escaping
unsigned codepoint;
if (!SourceEncoding::Decode(is, &codepoint))
return false;
os_->Put('\\');
os_->Put('u');
if (codepoint <= 0xD7FF || (codepoint >= 0xE000 && codepoint <= 0xFFFF)) {
os_->Put(hexDigits[(codepoint >> 12) & 15]);
os_->Put(hexDigits[(codepoint >> 8) & 15]);
os_->Put(hexDigits[(codepoint >> 4) & 15]);
os_->Put(hexDigits[(codepoint ) & 15]);
}
else if (codepoint >= 0x010000 && codepoint <= 0x10FFFF) {
// Surrogate pair
unsigned s = codepoint - 0x010000;
unsigned lead = (s >> 10) + 0xD800;
unsigned trail = (s & 0x3FF) + 0xDC00;
os_->Put(hexDigits[(lead >> 12) & 15]);
os_->Put(hexDigits[(lead >> 8) & 15]);
os_->Put(hexDigits[(lead >> 4) & 15]);
os_->Put(hexDigits[(lead ) & 15]);
os_->Put('\\');
os_->Put('u');
os_->Put(hexDigits[(trail >> 12) & 15]);
os_->Put(hexDigits[(trail >> 8) & 15]);
os_->Put(hexDigits[(trail >> 4) & 15]);
os_->Put(hexDigits[(trail ) & 15]);
}
else
return false; // invalid code point
}
else if ((sizeof(Ch) == 1 || (unsigned)c < 256) && escape[(unsigned char)c]) {
is.Take();
os_->Put('\\');
os_->Put(escape[(unsigned char)c]);
if (escape[(unsigned char)c] == 'u') {
os_->Put('0');
os_->Put('0');
os_->Put(hexDigits[(unsigned char)c >> 4]);
os_->Put(hexDigits[(unsigned char)c & 0xF]);
}
}
else
Transcoder<SourceEncoding, TargetEncoding>::Transcode(is, *os_);
}
os_->Put('\"');
return true;
}
bool WriteStartObject() { os_->Put('{'); return true; }
bool WriteEndObject() { os_->Put('}'); return true; }
bool WriteStartArray() { os_->Put('['); return true; }
bool WriteEndArray() { os_->Put(']'); return true; }
void Prefix(Type type) {
(void)type;
if (level_stack_.GetSize() != 0) { // this value is not at root
Level* level = level_stack_.template Top<Level>();
if (level->valueCount > 0) {
if (level->inArray)
os_->Put(','); // add comma if it is not the first element in array
else // in object
os_->Put((level->valueCount % 2 == 0) ? ',' : ':');
}
if (!level->inArray && level->valueCount % 2 == 0)
RAPIDJSON_ASSERT(type == kStringType); // if it's in object, then even number should be a name
level->valueCount++;
}
else {
RAPIDJSON_ASSERT(type == kObjectType || type == kArrayType);
RAPIDJSON_ASSERT(!hasRoot_); // Should only has one and only one root.
hasRoot_ = true;
}
}
OutputStream* os_;
internal::Stack<Allocator> level_stack_;
int doublePrecision_;
bool hasRoot_;
static const int kDefaultDoublePrecision = 6;
private:
// Prohibit copy constructor & assignment operator.
Writer(const Writer&);
Writer& operator=(const Writer&);
};
} // namespace rapidjson
#ifdef _MSC_VER
RAPIDJSON_DIAG_POP
#endif
#endif // RAPIDJSON_RAPIDJSON_H_
+9 -1
View File
@@ -142,6 +142,8 @@ RULE_INT(Character, InvSnapshotMinRetryM, 30) // Time (in minutes) to re-attempt
RULE_INT(Character, InvSnapshotHistoryD, 30) // Time (in days) to keep snapshot entries
RULE_BOOL(Character, RestrictSpellScribing, false) // Restricts spell scribing to allowable races/classes of spell scroll, if true
RULE_BOOL(Character, UseStackablePickPocketing, true) // Allows stackable pickpocketed items to stack instead of only being allowed in empty inventory slots
RULE_BOOL(Character, EnableAvoidanceCap, false)
RULE_INT(Character, AvoidanceCap, 750) // 750 Is a pretty good value, seen people dodge all attacks beyond 1,000 Avoidance
RULE_CATEGORY_END()
RULE_CATEGORY(Mercs)
@@ -329,7 +331,7 @@ RULE_INT(Spells, MaxBuffSlotsNPC, 25)
RULE_INT(Spells, MaxSongSlotsNPC, 10)
RULE_INT(Spells, MaxDiscSlotsNPC, 1)
RULE_INT(Spells, MaxTotalSlotsNPC, 36)
RULE_INT(Spells, MaxTotalSlotsPET, 25) // do not set this higher than 25 until the player profile is removed from the blob
RULE_INT(Spells, MaxTotalSlotsPET, 30) // do not set this higher than 25 until the player profile is removed from the blob
RULE_BOOL (Spells, EnableBlockedBuffs, true)
RULE_INT(Spells, ReflectType, 1) //0 = disabled, 1 = single target player spells only, 2 = all player spells, 3 = all single target spells, 4 = all spells
RULE_INT(Spells, VirusSpreadDistance, 30) // The distance a viral spell will jump to its next victim
@@ -379,6 +381,7 @@ RULE_BOOL(Spells, UseAdditiveFocusFromWornSlot, false) // Allows an additive foc
RULE_BOOL(Spells, AlwaysSendTargetsBuffs, false) // ignore LAA level if true
RULE_BOOL(Spells, FlatItemExtraSpellAmt, false) // allow SpellDmg stat to affect all spells, regardless of cast time/cooldown/etc
RULE_BOOL(Spells, IgnoreSpellDmgLvlRestriction, false) // ignore the 5 level spread on applying SpellDmg
RULE_BOOL(Spells, AllowItemTGB, false) // TGB doesn't work with items on live, custom servers want it though
RULE_CATEGORY_END()
RULE_CATEGORY(Combat)
@@ -502,6 +505,8 @@ RULE_BOOL(NPC, LiveLikeEnrage, false) // If set to true then only player control
RULE_BOOL(NPC, EnableMeritBasedFaction, false) // If set to true, faction will given in the same way as experience (solo/group/raid)
RULE_INT(NPC, NPCToNPCAggroTimerMin, 500)
RULE_INT(NPC, NPCToNPCAggroTimerMax, 6000)
RULE_BOOL(NPC, UseClassAsLastName, true) // Uses class archetype as LastName for npcs with none
RULE_BOOL(NPC, NewLevelScaling, true) // Better level scaling, use old if new formulas would break your server
RULE_CATEGORY_END()
RULE_CATEGORY(Aggro)
@@ -517,6 +522,7 @@ RULE_REAL(Aggro, TunnelVisionAggroMod, 0.75) //people not currently the top hate
RULE_INT(Aggro, MaxScalingProcAggro, 400) // Set to -1 for no limit. Maxmimum amount of aggro that HP scaling SPA effect in a proc will add.
RULE_INT(Aggro, IntAggroThreshold, 75) // Int <= this will aggro regardless of level difference.
RULE_BOOL(Aggro, AllowTickPulling, false) // tick pulling is an exploit in an NPC's call for help fixed sometime in 2006 on live
RULE_BOOL(Aggro, UseLevelAggro, true) // Level 18+ and Undead will aggro regardless of level difference. (this will disabled Rule:IntAggroThreshold if set to true)
RULE_CATEGORY_END()
RULE_CATEGORY(TaskSystem)
@@ -531,6 +537,7 @@ RULE_CATEGORY_END()
#ifdef BOTS
RULE_CATEGORY(Bots)
RULE_INT(Bots, AAExpansion, 8) // Bots get AAs through this expansion
RULE_BOOL(Bots, AllowCamelCaseNames, false) // Allows the use of 'MyBot' type names
RULE_INT(Bots, CommandSpellRank, 1) // Filters bot command spells by rank (1, 2 and 3 are valid filters - any other number allows all ranks)
RULE_INT(Bots, CreationLimit, 150) // Number of bots that each account can create
RULE_BOOL(Bots, FinishBuffing, false) // Allow for buffs to complete even if the bot caster is out of mana. Only affects buffing out of combat.
@@ -664,6 +671,7 @@ RULE_CATEGORY_END()
RULE_CATEGORY(Client)
RULE_BOOL(Client, UseLiveFactionMessage, false) // Allows players to see faction adjustments like Live
RULE_BOOL(Client, UseLiveBlockedMessage, false) // Allows players to see faction adjustments like Live
RULE_CATEGORY_END()
#undef RULE_CATEGORY
+80 -80
View File
@@ -1,4 +1,4 @@
/* EQEMu: Everquest Server Emulator
/* EQEMu: Everquest Server Emulator
Copyright (C) 2001-2016 EQEMu Development Team (http://eqemulator.net)
@@ -10,7 +10,7 @@
but WITHOUT ANY WARRANTY except by those people which sell it, which
are required to give you total support for your newly bought product;
without even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE. See the GNU General Public License for more details.
A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
@@ -22,16 +22,64 @@
#include "string_util.h"
#include "item.h"
#include "item_struct.h"
#include "item_base.h"
#include "../zone/zonedb.h"
EQEmu::saylink::SayLinkEngine::SayLinkEngine()
bool EQEmu::saylink::DegenerateLinkBody(SayLinkBody_Struct& say_link_body_struct, const std::string& say_link_body)
{
memset(&say_link_body_struct, 0, sizeof(say_link_body_struct));
if (say_link_body.length() != EQEmu::legacy::TEXT_LINK_BODY_LENGTH)
return false;
say_link_body_struct.unknown_1 = (uint8)strtol(say_link_body.substr(0, 1).c_str(), nullptr, 16);
say_link_body_struct.item_id = (uint32)strtol(say_link_body.substr(1, 5).c_str(), nullptr, 16);
say_link_body_struct.augment_1 = (uint32)strtol(say_link_body.substr(6, 5).c_str(), nullptr, 16);
say_link_body_struct.augment_2 = (uint32)strtol(say_link_body.substr(11, 5).c_str(), nullptr, 16);
say_link_body_struct.augment_3 = (uint32)strtol(say_link_body.substr(16, 5).c_str(), nullptr, 16);
say_link_body_struct.augment_4 = (uint32)strtol(say_link_body.substr(21, 5).c_str(), nullptr, 16);
say_link_body_struct.augment_5 = (uint32)strtol(say_link_body.substr(26, 5).c_str(), nullptr, 16);
say_link_body_struct.augment_6 = (uint32)strtol(say_link_body.substr(31, 5).c_str(), nullptr, 16);
say_link_body_struct.is_evolving = (uint8)strtol(say_link_body.substr(36, 1).c_str(), nullptr, 16);
say_link_body_struct.evolve_group = (uint32)strtol(say_link_body.substr(37, 4).c_str(), nullptr, 16);
say_link_body_struct.evolve_level = (uint8)strtol(say_link_body.substr(41, 2).c_str(), nullptr, 16);
say_link_body_struct.ornament_icon = (uint32)strtol(say_link_body.substr(43, 5).c_str(), nullptr, 16);
say_link_body_struct.hash = (int)strtol(say_link_body.substr(48, 8).c_str(), nullptr, 16);
return true;
}
bool EQEmu::saylink::GenerateLinkBody(std::string& say_link_body, const SayLinkBody_Struct& say_link_body_struct)
{
say_link_body = StringFormat(
"%1X" "%05X" "%05X" "%05X" "%05X" "%05X" "%05X" "%05X" "%1X" "%04X" "%02X" "%05X" "%08X",
(0x0F & say_link_body_struct.unknown_1),
(0x000FFFFF & say_link_body_struct.item_id),
(0x000FFFFF & say_link_body_struct.augment_1),
(0x000FFFFF & say_link_body_struct.augment_2),
(0x000FFFFF & say_link_body_struct.augment_3),
(0x000FFFFF & say_link_body_struct.augment_4),
(0x000FFFFF & say_link_body_struct.augment_5),
(0x000FFFFF & say_link_body_struct.augment_6),
(0x0F & say_link_body_struct.is_evolving),
(0x0000FFFF & say_link_body_struct.evolve_group),
(0xFF & say_link_body_struct.evolve_level),
(0x000FFFFF & say_link_body_struct.ornament_icon),
(0xFFFFFFFF & say_link_body_struct.hash)
);
if (say_link_body.length() != EQEmu::legacy::TEXT_LINK_BODY_LENGTH)
return false;
return true;
}
EQEmu::SayLinkEngine::SayLinkEngine()
{
Reset();
}
std::string EQEmu::saylink::SayLinkEngine::GenerateLink()
std::string EQEmu::SayLinkEngine::GenerateLink()
{
m_Link.clear();
m_LinkBody.clear();
@@ -59,25 +107,25 @@ std::string EQEmu::saylink::SayLinkEngine::GenerateLink()
return m_Link;
}
void EQEmu::saylink::SayLinkEngine::Reset()
void EQEmu::SayLinkEngine::Reset()
{
m_LinkType = SayLinkBlank;
m_LinkType = saylink::SayLinkBlank;
m_ItemData = nullptr;
m_LootData = nullptr;
m_ItemInst = nullptr;
m_Proxy_unknown_1 = NOT_USED;
m_ProxyItemID = NOT_USED;
m_ProxyAugment1ID = NOT_USED;
m_ProxyAugment2ID = NOT_USED;
m_ProxyAugment3ID = NOT_USED;
m_ProxyAugment4ID = NOT_USED;
m_ProxyAugment5ID = NOT_USED;
m_ProxyAugment6ID = NOT_USED;
m_ProxyIsEvolving = NOT_USED;
m_ProxyEvolveGroup = NOT_USED;
m_ProxyEvolveLevel = NOT_USED;
m_ProxyOrnamentIcon = NOT_USED;
m_ProxyHash = NOT_USED;
m_Proxy_unknown_1 = 0;
m_ProxyItemID = 0;
m_ProxyAugment1ID = 0;
m_ProxyAugment2ID = 0;
m_ProxyAugment3ID = 0;
m_ProxyAugment4ID = 0;
m_ProxyAugment5ID = 0;
m_ProxyAugment6ID = 0;
m_ProxyIsEvolving = 0;
m_ProxyEvolveGroup = 0;
m_ProxyEvolveLevel = 0;
m_ProxyOrnamentIcon = 0;
m_ProxyHash = 0;
m_ProxyText = nullptr;
m_TaskUse = false;
m_Link.clear();
@@ -86,7 +134,7 @@ void EQEmu::saylink::SayLinkEngine::Reset()
m_Error = false;
}
void EQEmu::saylink::SayLinkEngine::generate_body()
void EQEmu::SayLinkEngine::generate_body()
{
/*
Current server mask: EQClientRoF2
@@ -99,19 +147,19 @@ void EQEmu::saylink::SayLinkEngine::generate_body()
memset(&m_LinkBodyStruct, 0, sizeof(SayLinkBody_Struct));
const EQEmu::Item_Struct* item_data = nullptr;
const EQEmu::ItemBase* item_data = nullptr;
switch (m_LinkType) {
case SayLinkBlank:
case saylink::SayLinkBlank:
break;
case SayLinkItemData:
case saylink::SayLinkItemData:
if (m_ItemData == nullptr) { break; }
m_LinkBodyStruct.item_id = m_ItemData->ID;
m_LinkBodyStruct.evolve_group = m_ItemData->LoreGroup; // this probably won't work for all items
//m_LinkBodyStruct.evolve_level = m_ItemData->EvolvingLevel;
// TODO: add hash call
break;
case SayLinkLootItem:
case saylink::SayLinkLootItem:
if (m_LootData == nullptr) { break; }
item_data = database.GetItem(m_LootData->item_id);
if (item_data == nullptr) { break; }
@@ -126,7 +174,7 @@ void EQEmu::saylink::SayLinkEngine::generate_body()
//m_LinkBodyStruct.evolve_level = item_data->EvolvingLevel;
// TODO: add hash call
break;
case SayLinkItemInst:
case saylink::SayLinkItemInst:
if (m_ItemInst == nullptr) { break; }
if (m_ItemInst->GetItem() == nullptr) { break; }
m_LinkBodyStruct.item_id = m_ItemInst->GetItem()->ID;
@@ -195,29 +243,29 @@ void EQEmu::saylink::SayLinkEngine::generate_body()
);
}
void EQEmu::saylink::SayLinkEngine::generate_text()
void EQEmu::SayLinkEngine::generate_text()
{
if (m_ProxyText != nullptr) {
m_LinkText = m_ProxyText;
return;
}
const EQEmu::Item_Struct* item_data = nullptr;
const EQEmu::ItemBase* item_data = nullptr;
switch (m_LinkType) {
case SayLinkBlank:
case saylink::SayLinkBlank:
break;
case SayLinkItemData:
case saylink::SayLinkItemData:
if (m_ItemData == nullptr) { break; }
m_LinkText = m_ItemData->Name;
return;
case SayLinkLootItem:
case saylink::SayLinkLootItem:
if (m_LootData == nullptr) { break; }
item_data = database.GetItem(m_LootData->item_id);
if (item_data == nullptr) { break; }
m_LinkText = item_data->Name;
return;
case SayLinkItemInst:
case saylink::SayLinkItemInst:
if (m_ItemInst == nullptr) { break; }
if (m_ItemInst->GetItem() == nullptr) { break; }
m_LinkText = m_ItemInst->GetItem()->Name;
@@ -228,51 +276,3 @@ void EQEmu::saylink::SayLinkEngine::generate_text()
m_LinkText = "null";
}
bool EQEmu::saylink::DegenerateLinkBody(SayLinkBody_Struct& say_link_body_struct, const std::string& say_link_body)
{
memset(&say_link_body_struct, 0, sizeof(say_link_body_struct));
if (say_link_body.length() != EQEmu::legacy::TEXT_LINK_BODY_LENGTH)
return false;
say_link_body_struct.unknown_1 = (uint8)strtol(say_link_body.substr(0, 1).c_str(), nullptr, 16);
say_link_body_struct.item_id = (uint32)strtol(say_link_body.substr(1, 5).c_str(), nullptr, 16);
say_link_body_struct.augment_1 = (uint32)strtol(say_link_body.substr(6, 5).c_str(), nullptr, 16);
say_link_body_struct.augment_2 = (uint32)strtol(say_link_body.substr(11, 5).c_str(), nullptr, 16);
say_link_body_struct.augment_3 = (uint32)strtol(say_link_body.substr(16, 5).c_str(), nullptr, 16);
say_link_body_struct.augment_4 = (uint32)strtol(say_link_body.substr(21, 5).c_str(), nullptr, 16);
say_link_body_struct.augment_5 = (uint32)strtol(say_link_body.substr(26, 5).c_str(), nullptr, 16);
say_link_body_struct.augment_6 = (uint32)strtol(say_link_body.substr(31, 5).c_str(), nullptr, 16);
say_link_body_struct.is_evolving = (uint8)strtol(say_link_body.substr(36, 1).c_str(), nullptr, 16);
say_link_body_struct.evolve_group = (uint32)strtol(say_link_body.substr(37, 4).c_str(), nullptr, 16);
say_link_body_struct.evolve_level = (uint8)strtol(say_link_body.substr(41, 2).c_str(), nullptr, 16);
say_link_body_struct.ornament_icon = (uint32)strtol(say_link_body.substr(43, 5).c_str(), nullptr, 16);
say_link_body_struct.hash = (int)strtol(say_link_body.substr(48, 8).c_str(), nullptr, 16);
return true;
}
bool EQEmu::saylink::GenerateLinkBody(std::string& say_link_body, const SayLinkBody_Struct& say_link_body_struct)
{
say_link_body = StringFormat(
"%1X" "%05X" "%05X" "%05X" "%05X" "%05X" "%05X" "%05X" "%1X" "%04X" "%02X" "%05X" "%08X",
(0x0F & say_link_body_struct.unknown_1),
(0x000FFFFF & say_link_body_struct.item_id),
(0x000FFFFF & say_link_body_struct.augment_1),
(0x000FFFFF & say_link_body_struct.augment_2),
(0x000FFFFF & say_link_body_struct.augment_3),
(0x000FFFFF & say_link_body_struct.augment_4),
(0x000FFFFF & say_link_body_struct.augment_5),
(0x000FFFFF & say_link_body_struct.augment_6),
(0x0F & say_link_body_struct.is_evolving),
(0x0000FFFF & say_link_body_struct.evolve_group),
(0xFF & say_link_body_struct.evolve_level),
(0x000FFFFF & say_link_body_struct.ornament_icon),
(0xFFFFFFFF & say_link_body_struct.hash)
);
if (say_link_body.length() != EQEmu::legacy::TEXT_LINK_BODY_LENGTH)
return false;
return true;
}
+85 -90
View File
@@ -1,4 +1,4 @@
/* EQEMu: Everquest Server Emulator
/* EQEMu: Everquest Server Emulator
Copyright (C) 2001-2016 EQEMu Development Team (http://eqemulator.net)
@@ -10,7 +10,7 @@
but WITHOUT ANY WARRANTY except by those people which sell it, which
are required to give you total support for your newly bought product;
without even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE. See the GNU General Public License for more details.
A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
@@ -28,112 +28,107 @@
struct ServerLootItem_Struct;
class ItemInst;
namespace EQEmu
{
struct Item_Struct;
namespace saylink {
struct SayLinkBody_Struct; // Current server mask: EQClientRoF2
struct ItemBase;
struct SayLinkBody_Struct;
class SayLinkEngine;
namespace saylink {
enum SayLinkType {
SayLinkBlank = 0,
SayLinkItemData,
SayLinkLootItem,
SayLinkItemInst
};
extern bool DegenerateLinkBody(SayLinkBody_Struct& say_Link_body_struct, const std::string& say_link_body);
extern bool GenerateLinkBody(std::string& say_link_body, const SayLinkBody_Struct& say_link_body_struct);
}
}
} /*saylink*/
struct EQEmu::saylink::SayLinkBody_Struct
{
uint8 unknown_1; /* %1X */
uint32 item_id; /* %05X */
uint32 augment_1; /* %05X */
uint32 augment_2; /* %05X */
uint32 augment_3; /* %05X */
uint32 augment_4; /* %05X */
uint32 augment_5; /* %05X */
uint32 augment_6; /* %05X */
uint8 is_evolving; /* %1X */
uint32 evolve_group; /* %05X */
uint8 evolve_level; /* %02X */
uint32 ornament_icon; /* %05X */
int hash; /* %08X */
};
class EQEmu::saylink::SayLinkEngine
{
public:
enum SayLinkType {
SayLinkBlank = 0,
SayLinkItemData,
SayLinkLootItem,
SayLinkItemInst
struct SayLinkBody_Struct {
uint8 unknown_1; /* %1X */
uint32 item_id; /* %05X */
uint32 augment_1; /* %05X */
uint32 augment_2; /* %05X */
uint32 augment_3; /* %05X */
uint32 augment_4; /* %05X */
uint32 augment_5; /* %05X */
uint32 augment_6; /* %05X */
uint8 is_evolving; /* %1X */
uint32 evolve_group; /* %05X */
uint8 evolve_level; /* %02X */
uint32 ornament_icon; /* %05X */
int hash; /* %08X */
};
SayLinkEngine();
class SayLinkEngine {
public:
SayLinkEngine();
void SetLinkType(SayLinkType link_type) { m_LinkType = link_type; }
void SetItemData(const EQEmu::Item_Struct* item_data) { m_ItemData = item_data; }
void SetLootData(const ServerLootItem_Struct* loot_data) { m_LootData = loot_data; }
void SetItemInst(const ItemInst* item_inst) { m_ItemInst = item_inst; }
void SetLinkType(saylink::SayLinkType link_type) { m_LinkType = link_type; }
void SetItemData(const EQEmu::ItemBase* item_data) { m_ItemData = item_data; }
void SetLootData(const ServerLootItem_Struct* loot_data) { m_LootData = loot_data; }
void SetItemInst(const ItemInst* item_inst) { m_ItemInst = item_inst; }
// mainly for saylinks..but, not limited to
void SetProxyUnknown1(uint8 proxy_unknown_1) { m_Proxy_unknown_1 = proxy_unknown_1; }
void SetProxyItemID(uint32 proxy_item_id) { m_ProxyItemID = proxy_item_id; }
void SetProxyAugment1ID(uint32 proxy_augment_id) { m_ProxyAugment1ID = proxy_augment_id; }
void SetProxyAugment2ID(uint32 proxy_augment_id) { m_ProxyAugment2ID = proxy_augment_id; }
void SetProxyAugment3ID(uint32 proxy_augment_id) { m_ProxyAugment3ID = proxy_augment_id; }
void SetProxyAugment4ID(uint32 proxy_augment_id) { m_ProxyAugment4ID = proxy_augment_id; }
void SetProxyAugment5ID(uint32 proxy_augment_id) { m_ProxyAugment5ID = proxy_augment_id; }
void SetProxyAugment6ID(uint32 proxy_augment_id) { m_ProxyAugment6ID = proxy_augment_id; }
void SetProxyIsEvolving(uint8 proxy_is_evolving) { m_ProxyIsEvolving = proxy_is_evolving; }
void SetProxyEvolveGroup(uint32 proxy_evolve_group) { m_ProxyEvolveGroup = proxy_evolve_group; }
void SetProxyEvolveLevel(uint8 proxy_evolve_level) { m_ProxyEvolveLevel = proxy_evolve_level; }
void SetProxyOrnamentIcon(uint32 proxy_ornament_icon) { m_ProxyOrnamentIcon = proxy_ornament_icon; }
void SetProxyHash(int proxy_hash) { m_ProxyHash = proxy_hash; }
// mainly for saylinks..but, not limited to
void SetProxyUnknown1(uint8 proxy_unknown_1) { m_Proxy_unknown_1 = proxy_unknown_1; }
void SetProxyItemID(uint32 proxy_item_id) { m_ProxyItemID = proxy_item_id; }
void SetProxyAugment1ID(uint32 proxy_augment_id) { m_ProxyAugment1ID = proxy_augment_id; }
void SetProxyAugment2ID(uint32 proxy_augment_id) { m_ProxyAugment2ID = proxy_augment_id; }
void SetProxyAugment3ID(uint32 proxy_augment_id) { m_ProxyAugment3ID = proxy_augment_id; }
void SetProxyAugment4ID(uint32 proxy_augment_id) { m_ProxyAugment4ID = proxy_augment_id; }
void SetProxyAugment5ID(uint32 proxy_augment_id) { m_ProxyAugment5ID = proxy_augment_id; }
void SetProxyAugment6ID(uint32 proxy_augment_id) { m_ProxyAugment6ID = proxy_augment_id; }
void SetProxyIsEvolving(uint8 proxy_is_evolving) { m_ProxyIsEvolving = proxy_is_evolving; }
void SetProxyEvolveGroup(uint32 proxy_evolve_group) { m_ProxyEvolveGroup = proxy_evolve_group; }
void SetProxyEvolveLevel(uint8 proxy_evolve_level) { m_ProxyEvolveLevel = proxy_evolve_level; }
void SetProxyOrnamentIcon(uint32 proxy_ornament_icon) { m_ProxyOrnamentIcon = proxy_ornament_icon; }
void SetProxyHash(int proxy_hash) { m_ProxyHash = proxy_hash; }
void SetProxyText(const char* proxy_text) { m_ProxyText = proxy_text; } // overrides standard text use
void SetTaskUse() { m_TaskUse = true; }
void SetProxyText(const char* proxy_text) { m_ProxyText = proxy_text; } // overrides standard text use
void SetTaskUse() { m_TaskUse = true; }
std::string GenerateLink();
bool LinkError() { return m_Error; }
std::string GenerateLink();
bool LinkError() { return m_Error; }
std::string Link() { return m_Link; } // contains full string format: '/12x' '<LinkBody>' '<LinkText>' '/12x'
std::string LinkBody() { return m_LinkBody; } // contains string format: '<LinkBody>'
std::string LinkText() { return m_LinkText; } // contains string format: '<LinkText>'
std::string Link() { return m_Link; } // contains full string format: '/12x' '<LinkBody>' '<LinkText>' '/12x'
std::string LinkBody() { return m_LinkBody; } // contains string format: '<LinkBody>'
std::string LinkText() { return m_LinkText; } // contains string format: '<LinkText>'
void Reset();
void Reset();
private:
void generate_body();
void generate_text();
private:
void generate_body();
void generate_text();
int m_LinkType;
const EQEmu::Item_Struct* m_ItemData;
const ServerLootItem_Struct* m_LootData;
const ItemInst* m_ItemInst;
int m_LinkType;
const ItemBase* m_ItemData;
const ServerLootItem_Struct* m_LootData;
const ItemInst* m_ItemInst;
uint8 m_Proxy_unknown_1;
uint32 m_ProxyItemID;
uint32 m_ProxyAugment1ID;
uint32 m_ProxyAugment2ID;
uint32 m_ProxyAugment3ID;
uint32 m_ProxyAugment4ID;
uint32 m_ProxyAugment5ID;
uint32 m_ProxyAugment6ID;
uint8 m_ProxyIsEvolving;
uint32 m_ProxyEvolveGroup;
uint8 m_ProxyEvolveLevel;
uint32 m_ProxyOrnamentIcon;
int m_ProxyHash;
const char* m_ProxyText;
bool m_TaskUse;
SayLinkBody_Struct m_LinkBodyStruct;
std::string m_Link;
std::string m_LinkBody;
std::string m_LinkText;
bool m_Error;
};
uint8 m_Proxy_unknown_1;
uint32 m_ProxyItemID;
uint32 m_ProxyAugment1ID;
uint32 m_ProxyAugment2ID;
uint32 m_ProxyAugment3ID;
uint32 m_ProxyAugment4ID;
uint32 m_ProxyAugment5ID;
uint32 m_ProxyAugment6ID;
uint8 m_ProxyIsEvolving;
uint32 m_ProxyEvolveGroup;
uint8 m_ProxyEvolveLevel;
uint32 m_ProxyOrnamentIcon;
int m_ProxyHash;
const char* m_ProxyText;
bool m_TaskUse;
SayLinkBody_Struct m_LinkBodyStruct;
std::string m_Link;
std::string m_LinkBody;
std::string m_LinkText;
bool m_Error;
};
} /*EQEmu*/
#endif /*COMMON_SAY_LINK_H*/
+7 -1
View File
@@ -194,8 +194,14 @@
#define ServerOP_CZSignalNPC 0x5017
#define ServerOP_CZSetEntityVariableByNPCTypeID 0x5018
#define ServerOP_WIRemoteCall 0x5001
#define ServerOP_WIRemoteCallResponse 0x5002
#define ServerOP_WIRemoteCallToClient 0x5003
#define ServerOP_WIClientSession 0x5004
#define ServerOP_WIClientSessionResponse 0x5005
/* Query Serv Generic Packet Flag/Type Enumeration */
enum { QSG_LFGuild = 0 };
enum { QSG_LFGuild = 0 };
enum { QSG_LFGuild_PlayerMatches = 0, QSG_LFGuild_UpdatePlayerInfo, QSG_LFGuild_RequestPlayerInfo, QSG_LFGuild_UpdateGuildInfo, QSG_LFGuild_GuildMatches,
QSG_LFGuild_RequestGuildInfo };
+42 -17
View File
@@ -364,7 +364,7 @@ bool SharedDatabase::SetSharedPlatinum(uint32 account_id, int32 amount_to_add) {
bool SharedDatabase::SetStartingItems(PlayerProfile_Struct* pp, Inventory* inv, uint32 si_race, uint32 si_class, uint32 si_deity, uint32 si_current_zone, char* si_name, int admin_level) {
const EQEmu::Item_Struct* myitem;
const EQEmu::ItemBase* myitem;
std::string query = StringFormat("SELECT itemid, item_charges, slot FROM starting_items "
"WHERE (race = %i or race = 0) AND (class = %i or class = 0) AND "
@@ -436,7 +436,7 @@ bool SharedDatabase::GetSharedBank(uint32 id, Inventory *inv, bool is_charid)
aug[4] = (uint32)atoi(row[7]);
aug[5] = (uint32)atoi(row[8]);
const EQEmu::Item_Struct *item = GetItem(item_id);
const EQEmu::ItemBase *item = GetItem(item_id);
if (!item) {
Log.Out(Logs::General, Logs::Error,
@@ -455,7 +455,7 @@ bool SharedDatabase::GetSharedBank(uint32 id, Inventory *inv, bool is_charid)
}
}
if (row[9]) {
if (inst && row[9]) {
std::string data_str(row[9]);
std::string idAsString;
std::string value;
@@ -480,6 +480,7 @@ bool SharedDatabase::GetSharedBank(uint32 id, Inventory *inv, bool is_charid)
}
}
// theoretically inst can be nullptr ... this would be very bad ...
put_slot_id = inv->PutItem(slot_id, *inst);
safe_delete(inst);
@@ -538,7 +539,7 @@ bool SharedDatabase::GetInventory(uint32 char_id, Inventory *inv)
uint32 ornament_idfile = (uint32)atoul(row[13]);
uint32 ornament_hero_model = (uint32)atoul(row[14]);
const EQEmu::Item_Struct *item = GetItem(item_id);
const EQEmu::ItemBase *item = GetItem(item_id);
if (!item) {
Log.Out(Logs::General, Logs::Error,
@@ -595,8 +596,7 @@ bool SharedDatabase::GetInventory(uint32 char_id, Inventory *inv)
if (charges == 0x7FFF)
inst->SetCharges(-1);
else if (charges == 0 &&
inst->IsStackable()) // Stackable items need a minimum charge of 1 remain moveable.
else if (charges == 0 && inst->IsStackable()) // Stackable items need a minimum charge of 1 remain moveable.
inst->SetCharges(1);
else
inst->SetCharges(charges);
@@ -679,7 +679,7 @@ bool SharedDatabase::GetInventory(uint32 account_id, char *name, Inventory *inv)
uint32 ornament_idfile = (uint32)atoul(row[13]);
uint32 ornament_hero_model = (uint32)atoul(row[14]);
const EQEmu::Item_Struct *item = GetItem(item_id);
const EQEmu::ItemBase *item = GetItem(item_id);
int16 put_slot_id = INVALID_INDEX;
if (!item)
continue;
@@ -816,7 +816,7 @@ bool SharedDatabase::LoadItems(const std::string &prefix) {
mutex.Lock();
std::string file_name = Config->SharedMemDir + prefix + std::string("items");
items_mmf = std::unique_ptr<EQEmu::MemoryMappedFile>(new EQEmu::MemoryMappedFile(file_name));
items_hash = std::unique_ptr<EQEmu::FixedMemoryHashSet<EQEmu::Item_Struct>>(new EQEmu::FixedMemoryHashSet<EQEmu::Item_Struct>(reinterpret_cast<uint8*>(items_mmf->Get()), items_mmf->Size()));
items_hash = std::unique_ptr<EQEmu::FixedMemoryHashSet<EQEmu::ItemBase>>(new EQEmu::FixedMemoryHashSet<EQEmu::ItemBase>(reinterpret_cast<uint8*>(items_mmf->Get()), items_mmf->Size()));
mutex.Unlock();
} catch(std::exception& ex) {
Log.Out(Logs::General, Logs::Error, "Error Loading Items: %s", ex.what());
@@ -828,7 +828,7 @@ bool SharedDatabase::LoadItems(const std::string &prefix) {
void SharedDatabase::LoadItems(void *data, uint32 size, int32 items, uint32 max_item_id)
{
EQEmu::FixedMemoryHashSet<EQEmu::Item_Struct> hash(reinterpret_cast<uint8 *>(data), size, items, max_item_id);
EQEmu::FixedMemoryHashSet<EQEmu::ItemBase> hash(reinterpret_cast<uint8 *>(data), size, items, max_item_id);
std::string ndbuffer;
bool disableNoRent = false;
@@ -856,7 +856,7 @@ void SharedDatabase::LoadItems(void *data, uint32 size, int32 items, uint32 max_
}
}
EQEmu::Item_Struct item;
EQEmu::ItemBase item;
const std::string query = "SELECT source,"
#define F(x) "`"#x"`,"
@@ -869,7 +869,7 @@ void SharedDatabase::LoadItems(void *data, uint32 size, int32 items, uint32 max_
}
for (auto row = results.begin(); row != results.end(); ++row) {
memset(&item, 0, sizeof(EQEmu::Item_Struct));
memset(&item, 0, sizeof(EQEmu::ItemBase));
item.ItemClass = (uint8)atoi(row[ItemField::itemclass]);
strcpy(item.Name, row[ItemField::name]);
@@ -1086,7 +1086,7 @@ void SharedDatabase::LoadItems(void *data, uint32 size, int32 items, uint32 max_
}
}
const EQEmu::Item_Struct* SharedDatabase::GetItem(uint32 id) {
const EQEmu::ItemBase* SharedDatabase::GetItem(uint32 id) {
if (id == 0)
{
return nullptr;
@@ -1105,7 +1105,7 @@ const EQEmu::Item_Struct* SharedDatabase::GetItem(uint32 id) {
return nullptr;
}
const EQEmu::Item_Struct* SharedDatabase::IterateItems(uint32* id) {
const EQEmu::ItemBase* SharedDatabase::IterateItems(uint32* id) {
if(!items_hash || !id) {
return nullptr;
}
@@ -1253,7 +1253,7 @@ bool SharedDatabase::LoadNPCFactionLists(const std::string &prefix) {
// Create appropriate ItemInst class
ItemInst* SharedDatabase::CreateItem(uint32 item_id, int16 charges, uint32 aug1, uint32 aug2, uint32 aug3, uint32 aug4, uint32 aug5, uint32 aug6, uint8 attuned)
{
const EQEmu::Item_Struct* item = nullptr;
const EQEmu::ItemBase* item = nullptr;
ItemInst* inst = nullptr;
item = GetItem(item_id);
@@ -1280,7 +1280,7 @@ ItemInst* SharedDatabase::CreateItem(uint32 item_id, int16 charges, uint32 aug1,
// Create appropriate ItemInst class
ItemInst* SharedDatabase::CreateItem(const EQEmu::Item_Struct* item, int16 charges, uint32 aug1, uint32 aug2, uint32 aug3, uint32 aug4, uint32 aug5, uint32 aug6, uint8 attuned)
ItemInst* SharedDatabase::CreateItem(const EQEmu::ItemBase* item, int16 charges, uint32 aug1, uint32 aug2, uint32 aug3, uint32 aug4, uint32 aug5, uint32 aug6, uint8 attuned)
{
ItemInst* inst = nullptr;
if (item) {
@@ -1304,7 +1304,7 @@ ItemInst* SharedDatabase::CreateItem(const EQEmu::Item_Struct* item, int16 charg
return inst;
}
ItemInst* SharedDatabase::CreateBaseItem(const EQEmu::Item_Struct* item, int16 charges) {
ItemInst* SharedDatabase::CreateBaseItem(const EQEmu::ItemBase* item, int16 charges) {
ItemInst* inst = nullptr;
if (item) {
// if maxcharges is -1 that means it is an unlimited use item.
@@ -1664,7 +1664,7 @@ void SharedDatabase::LoadSpells(void *data, int max_spells) {
sp[tempid].uninterruptable=atoi(row[146]) != 0;
sp[tempid].ResistDiff=atoi(row[147]);
sp[tempid].dot_stacking_exempt=atoi(row[148]);
sp[tempid].dot_stacking_exempt = atoi(row[148]) != 0;
sp[tempid].RecourseLink = atoi(row[150]);
sp[tempid].no_partial_resist = atoi(row[151]) != 0;
@@ -1689,6 +1689,7 @@ void SharedDatabase::LoadSpells(void *data, int max_spells) {
sp[tempid].pvpresistcalc=atoi(row[178]);
sp[tempid].pvpresistcap=atoi(row[179]);
sp[tempid].spell_category=atoi(row[180]);
sp[tempid].cast_not_standing = atoi(row[184]) != 0;
sp[tempid].can_mgb=atoi(row[185]);
sp[tempid].dispel_flag = atoi(row[186]);
sp[tempid].MinResist = atoi(row[189]);
@@ -2051,3 +2052,27 @@ void SharedDatabase::SaveCharacterInspectMessage(uint32 character_id, const Insp
std::string query = StringFormat("REPLACE INTO `character_inspect_messages` (id, inspect_message) VALUES (%u, '%s')", character_id, EscapeString(message->text).c_str());
auto results = QueryDatabase(query);
}
bool SharedDatabase::VerifyToken(std::string token, int& status) {
status = 0;
if (token.length() > 64) {
token = token.substr(0, 64);
}
token = EscapeString(token);
std::string query = StringFormat("SELECT status FROM tokens WHERE token='%s'", token.c_str());
auto results = QueryDatabase(query);
if (!results.Success())
{
std::cerr << "Error in SharedDatabase::VerifyToken query '" << query << "' " << results.ErrorMessage() << std::endl;
return false;
}
if (results.RowCount() != 1) {
return false;
}
auto row = results.begin();
status = atoi(row[0]);
return true;
}
+10 -6
View File
@@ -42,9 +42,10 @@ struct SPDat_Spell_Struct;
struct NPCFactionList;
struct LootTable_Struct;
struct LootDrop_Struct;
namespace EQEmu
{
struct Item_Struct;
struct ItemBase;
class MemoryMappedFile;
}
@@ -99,8 +100,11 @@ class SharedDatabase : public Database
Item Methods
*/
ItemInst* CreateItem(uint32 item_id, int16 charges = 0, uint32 aug1 = 0, uint32 aug2 = 0, uint32 aug3 = 0, uint32 aug4 = 0, uint32 aug5 = 0, uint32 aug6 = 0, uint8 attuned = 0);
ItemInst* CreateItem(const EQEmu::Item_Struct* item, int16 charges = 0, uint32 aug1 = 0, uint32 aug2 = 0, uint32 aug3 = 0, uint32 aug4 = 0, uint32 aug5 = 0, uint32 aug6 = 0, uint8 attuned = 0);
ItemInst* CreateBaseItem(const EQEmu::Item_Struct* item, int16 charges = 0);
ItemInst* CreateItem(const EQEmu::ItemBase* item, int16 charges = 0, uint32 aug1 = 0, uint32 aug2 = 0, uint32 aug3 = 0, uint32 aug4 = 0, uint32 aug5 = 0, uint32 aug6 = 0, uint8 attuned = 0);
ItemInst* CreateBaseItem(const EQEmu::ItemBase* item, int16 charges = 0);
// Web Token Verification
bool VerifyToken(std::string token, int& status);
/*
Shared Memory crap
@@ -110,8 +114,8 @@ class SharedDatabase : public Database
void GetItemsCount(int32 &item_count, uint32 &max_id);
void LoadItems(void *data, uint32 size, int32 items, uint32 max_item_id);
bool LoadItems(const std::string &prefix);
const EQEmu::Item_Struct* IterateItems(uint32* id);
const EQEmu::Item_Struct* GetItem(uint32 id);
const EQEmu::ItemBase* IterateItems(uint32* id);
const EQEmu::ItemBase* GetItem(uint32 id);
const EvolveInfo* GetEvolveInfo(uint32 loregroup);
//faction lists
@@ -148,7 +152,7 @@ class SharedDatabase : public Database
std::unique_ptr<EQEmu::MemoryMappedFile> skill_caps_mmf;
std::unique_ptr<EQEmu::MemoryMappedFile> items_mmf;
std::unique_ptr<EQEmu::FixedMemoryHashSet<EQEmu::Item_Struct>> items_hash;
std::unique_ptr<EQEmu::FixedMemoryHashSet<EQEmu::ItemBase>> items_hash;
std::unique_ptr<EQEmu::MemoryMappedFile> faction_mmf;
std::unique_ptr<EQEmu::FixedMemoryHashSet<NPCFactionList>> faction_hash;
std::unique_ptr<EQEmu::MemoryMappedFile> loot_table_mmf;

Some files were not shown because too many files have changed in this diff Show More