Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- function ProcessRaidXml($xmlData)
- {
- global $gDb;
- if ($xmlData) $xml = xml2array("<?xml version='1.0' encoding='UTF-8' ?>" . $xmlData);
- if ($xml['kAuction'])
- {
- if ($xml['kAuction']['raid'])
- {
- $xRaid = $xml['kAuction']['raid'];
- $oRaid = new Raid(GetSqlDate($xRaid['startDate']), GetSqlDate($xRaid['endDate']), $xRaid['zone'], $xRaid['duration']);
- if ($oRaid->Id) // Valid Raid added
- {
- // Check if valid actor data
- if ($xRaid['actors'] && $xRaid['actors']['actor'])
- {
- foreach ($xRaid['actors']['actor'] as $kA => $vA)
- {
- $actor = new Actor($oRaid, $vA['name'], $vA['class'], $vA['presence']);
- if (!array_search($actor, $oRaid->Actors))
- {
- array_push($oRaid->Actors, $actor);
- }
- }
- }
- // Check if valid item data
- if ($xRaid['items'] && $xRaid['items']['item'])
- {
- foreach ($xRaid['items']['item'] as $kI => $vI)
- {
- $item = new Item($vI['itemId'], $vI['name']);
- $mob = new Mob($vI['corpseName']);
- $oActor = null;
- if ($vI['winner'])
- {
- foreach ($oRaid->Actors as $actor)
- {
- if ($actor->Name == $vI['winner'])
- {
- $oActor = $actor;
- }
- }
- }
- $auction = new Auction($oRaid, $item, $mob, GetSqlDate($vI['dateTime']), $oActor, $vI['bidType'], $vI['disenchant'], $vI['auctionType'], $vI['councilMembers']);
- // Check if valid bids data
- if ($vI['bids'] && $vI['bids']['bid'])
- {
- if (array_key_exists(0, $vI['bids']['bid'])) // Check if multiples
- {
- foreach ($vI['bids']['bid'] as $kBid => $vBid)
- {
- $bid = new Bid($auction, new Actor($oRaid, $vBid['name']), $vBid['bidType'], $oRaid, new Item($vBid['currentItemId'], $vBid['currentItemName']), $vBid['roll'], $vBid['voters']);
- if (!array_search($bid, $auction->Bids))
- {
- array_push($auction->Bids, $bid);
- }
- }
- }
- else // Check if singular
- {
- $vBid = $vI['bids']['bid'];
- $bid = new Bid($auction, new Actor($oRaid, $vBid['name']), $vBid['bidType'], $oRaid, new Item($vBid['currentItemId'], $vBid['currentItemName']), $vBid['roll'], $vBid['voters']);
- if (!array_search($bid, $auction->Bids))
- {
- array_push($auction->Bids, $bid);
- }
- }
- }
- }
- }
- $r = $gDb->GetQueryResult(new Query("SELECT Id FROM vcp_actor_raid WHERE Raid_Id = -1"));
- if ($r && mysqli_num_rows($r) > 0)
- {
- while ($row = $gDb->FetchAssoc($r))
- {
- $vrr = new VcpRaidRecord($row['Id']);
- $vrr->RaidId = $oRaid->Id;
- $vrr->Update();
- }
- }
- }
- }
- }
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement